diff options
386 files changed, 7331 insertions, 5583 deletions
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c index ab82b7f53312..d6cb1a86fd61 100644 --- a/Documentation/accounting/getdelays.c +++ b/Documentation/accounting/getdelays.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include <linux/genetlink.h> | 26 | #include <linux/genetlink.h> |
27 | #include <linux/taskstats.h> | 27 | #include <linux/taskstats.h> |
28 | #include <linux/cgroupstats.h> | ||
28 | 29 | ||
29 | /* | 30 | /* |
30 | * Generic macros for dealing with netlink sockets. Might be duplicated | 31 | * Generic macros for dealing with netlink sockets. Might be duplicated |
@@ -78,6 +79,7 @@ static void usage(void) | |||
78 | fprintf(stderr, " -i: print IO accounting (works only with -p)\n"); | 79 | fprintf(stderr, " -i: print IO accounting (works only with -p)\n"); |
79 | fprintf(stderr, " -l: listen forever\n"); | 80 | fprintf(stderr, " -l: listen forever\n"); |
80 | fprintf(stderr, " -v: debug on\n"); | 81 | fprintf(stderr, " -v: debug on\n"); |
82 | fprintf(stderr, " -C: container path\n"); | ||
81 | } | 83 | } |
82 | 84 | ||
83 | /* | 85 | /* |
@@ -212,6 +214,14 @@ void task_context_switch_counts(struct taskstats *t) | |||
212 | t->nvcsw, t->nivcsw); | 214 | t->nvcsw, t->nivcsw); |
213 | } | 215 | } |
214 | 216 | ||
217 | void print_cgroupstats(struct cgroupstats *c) | ||
218 | { | ||
219 | printf("sleeping %llu, blocked %llu, running %llu, stopped %llu, " | ||
220 | "uninterruptible %llu\n", c->nr_sleeping, c->nr_io_wait, | ||
221 | c->nr_running, c->nr_stopped, c->nr_uninterruptible); | ||
222 | } | ||
223 | |||
224 | |||
215 | void print_ioacct(struct taskstats *t) | 225 | void print_ioacct(struct taskstats *t) |
216 | { | 226 | { |
217 | printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n", | 227 | printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n", |
@@ -239,11 +249,14 @@ int main(int argc, char *argv[]) | |||
239 | int maskset = 0; | 249 | int maskset = 0; |
240 | char *logfile = NULL; | 250 | char *logfile = NULL; |
241 | int loop = 0; | 251 | int loop = 0; |
252 | int containerset = 0; | ||
253 | char containerpath[1024]; | ||
254 | int cfd = 0; | ||
242 | 255 | ||
243 | struct msgtemplate msg; | 256 | struct msgtemplate msg; |
244 | 257 | ||
245 | while (1) { | 258 | while (1) { |
246 | c = getopt(argc, argv, "qdiw:r:m:t:p:vl"); | 259 | c = getopt(argc, argv, "qdiw:r:m:t:p:vlC:"); |
247 | if (c < 0) | 260 | if (c < 0) |
248 | break; | 261 | break; |
249 | 262 | ||
@@ -260,6 +273,10 @@ int main(int argc, char *argv[]) | |||
260 | printf("printing task/process context switch rates\n"); | 273 | printf("printing task/process context switch rates\n"); |
261 | print_task_context_switch_counts = 1; | 274 | print_task_context_switch_counts = 1; |
262 | break; | 275 | break; |
276 | case 'C': | ||
277 | containerset = 1; | ||
278 | strncpy(containerpath, optarg, strlen(optarg) + 1); | ||
279 | break; | ||
263 | case 'w': | 280 | case 'w': |
264 | logfile = strdup(optarg); | 281 | logfile = strdup(optarg); |
265 | printf("write to file %s\n", logfile); | 282 | printf("write to file %s\n", logfile); |
@@ -334,6 +351,11 @@ int main(int argc, char *argv[]) | |||
334 | } | 351 | } |
335 | } | 352 | } |
336 | 353 | ||
354 | if (tid && containerset) { | ||
355 | fprintf(stderr, "Select either -t or -C, not both\n"); | ||
356 | goto err; | ||
357 | } | ||
358 | |||
337 | if (tid) { | 359 | if (tid) { |
338 | rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET, | 360 | rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET, |
339 | cmd_type, &tid, sizeof(__u32)); | 361 | cmd_type, &tid, sizeof(__u32)); |
@@ -344,6 +366,20 @@ int main(int argc, char *argv[]) | |||
344 | } | 366 | } |
345 | } | 367 | } |
346 | 368 | ||
369 | if (containerset) { | ||
370 | cfd = open(containerpath, O_RDONLY); | ||
371 | if (cfd < 0) { | ||
372 | perror("error opening container file"); | ||
373 | goto err; | ||
374 | } | ||
375 | rc = send_cmd(nl_sd, id, mypid, CGROUPSTATS_CMD_GET, | ||
376 | CGROUPSTATS_CMD_ATTR_FD, &cfd, sizeof(__u32)); | ||
377 | if (rc < 0) { | ||
378 | perror("error sending cgroupstats command"); | ||
379 | goto err; | ||
380 | } | ||
381 | } | ||
382 | |||
347 | do { | 383 | do { |
348 | int i; | 384 | int i; |
349 | 385 | ||
@@ -422,6 +458,9 @@ int main(int argc, char *argv[]) | |||
422 | } | 458 | } |
423 | break; | 459 | break; |
424 | 460 | ||
461 | case CGROUPSTATS_TYPE_CGROUP_STATS: | ||
462 | print_cgroupstats(NLA_DATA(na)); | ||
463 | break; | ||
425 | default: | 464 | default: |
426 | fprintf(stderr, "Unknown nla_type %d\n", | 465 | fprintf(stderr, "Unknown nla_type %d\n", |
427 | na->nla_type); | 466 | na->nla_type); |
@@ -443,5 +482,7 @@ err: | |||
443 | close(nl_sd); | 482 | close(nl_sd); |
444 | if (fd) | 483 | if (fd) |
445 | close(fd); | 484 | close(fd); |
485 | if (cfd) | ||
486 | close(cfd); | ||
446 | return 0; | 487 | return 0; |
447 | } | 488 | } |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 6bb9be54ab76..20c4c8bac9d7 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -181,15 +181,6 @@ Who: Nick Piggin <npiggin@suse.de> | |||
181 | 181 | ||
182 | --------------------------- | 182 | --------------------------- |
183 | 183 | ||
184 | What: Interrupt only SA_* flags | ||
185 | When: September 2007 | ||
186 | Why: The interrupt related SA_* flags are replaced by IRQF_* to move them | ||
187 | out of the signal namespace. | ||
188 | |||
189 | Who: Thomas Gleixner <tglx@linutronix.de> | ||
190 | |||
191 | --------------------------- | ||
192 | |||
193 | What: PHYSDEVPATH, PHYSDEVBUS, PHYSDEVDRIVER in the uevent environment | 184 | What: PHYSDEVPATH, PHYSDEVBUS, PHYSDEVDRIVER in the uevent environment |
194 | When: October 2008 | 185 | When: October 2008 |
195 | Why: The stacking of class devices makes these values misleading and | 186 | Why: The stacking of class devices makes these values misleading and |
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface index a17b692d2679..f4a8ebc1ef1a 100644 --- a/Documentation/hwmon/sysfs-interface +++ b/Documentation/hwmon/sysfs-interface | |||
@@ -328,6 +328,37 @@ curr[1-*]_input Current input value | |||
328 | Unit: milliampere | 328 | Unit: milliampere |
329 | RO | 329 | RO |
330 | 330 | ||
331 | ********* | ||
332 | * Power * | ||
333 | ********* | ||
334 | |||
335 | power[1-*]_average Average power use | ||
336 | Unit: microWatt | ||
337 | RO | ||
338 | |||
339 | power[1-*]_average_highest Historical average maximum power use | ||
340 | Unit: microWatt | ||
341 | RO | ||
342 | |||
343 | power[1-*]_average_lowest Historical average minimum power use | ||
344 | Unit: microWatt | ||
345 | RO | ||
346 | |||
347 | power[1-*]_input Instantaneous power use | ||
348 | Unit: microWatt | ||
349 | RO | ||
350 | |||
351 | power[1-*]_input_highest Historical maximum power use | ||
352 | Unit: microWatt | ||
353 | RO | ||
354 | |||
355 | power[1-*]_input_lowest Historical minimum power use | ||
356 | Unit: microWatt | ||
357 | RO | ||
358 | |||
359 | power[1-*]_reset_history Reset input_highest, input_lowest, | ||
360 | average_highest and average_lowest. | ||
361 | WO | ||
331 | 362 | ||
332 | ********** | 363 | ********** |
333 | * Alarms * | 364 | * Alarms * |
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index f2668390e8f7..42008395534d 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
@@ -62,8 +62,8 @@ typedef uint8_t u8; | |||
62 | #endif | 62 | #endif |
63 | /* We can have up to 256 pages for devices. */ | 63 | /* We can have up to 256 pages for devices. */ |
64 | #define DEVICE_PAGES 256 | 64 | #define DEVICE_PAGES 256 |
65 | /* This fits nicely in a single 4096-byte page. */ | 65 | /* This will occupy 2 pages: it must be a power of 2. */ |
66 | #define VIRTQUEUE_NUM 127 | 66 | #define VIRTQUEUE_NUM 128 |
67 | 67 | ||
68 | /*L:120 verbose is both a global flag and a macro. The C preprocessor allows | 68 | /*L:120 verbose is both a global flag and a macro. The C preprocessor allows |
69 | * this, and although I wouldn't recommend it, it works quite nicely here. */ | 69 | * this, and although I wouldn't recommend it, it works quite nicely here. */ |
@@ -1036,7 +1036,8 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs, | |||
1036 | void *p; | 1036 | void *p; |
1037 | 1037 | ||
1038 | /* First we need some pages for this virtqueue. */ | 1038 | /* First we need some pages for this virtqueue. */ |
1039 | pages = (vring_size(num_descs) + getpagesize() - 1) / getpagesize(); | 1039 | pages = (vring_size(num_descs, getpagesize()) + getpagesize() - 1) |
1040 | / getpagesize(); | ||
1040 | p = get_pages(pages); | 1041 | p = get_pages(pages); |
1041 | 1042 | ||
1042 | /* Initialize the configuration. */ | 1043 | /* Initialize the configuration. */ |
@@ -1045,7 +1046,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs, | |||
1045 | vq->config.pfn = to_guest_phys(p) / getpagesize(); | 1046 | vq->config.pfn = to_guest_phys(p) / getpagesize(); |
1046 | 1047 | ||
1047 | /* Initialize the vring. */ | 1048 | /* Initialize the vring. */ |
1048 | vring_init(&vq->vring, num_descs, p); | 1049 | vring_init(&vq->vring, num_descs, p, getpagesize()); |
1049 | 1050 | ||
1050 | /* Add the configuration information to this device's descriptor. */ | 1051 | /* Add the configuration information to this device's descriptor. */ |
1051 | add_desc_field(dev, VIRTIO_CONFIG_F_VIRTQUEUE, | 1052 | add_desc_field(dev, VIRTIO_CONFIG_F_VIRTQUEUE, |
@@ -1342,7 +1343,7 @@ static bool service_io(struct device *dev) | |||
1342 | if (out->type & VIRTIO_BLK_T_SCSI_CMD) { | 1343 | if (out->type & VIRTIO_BLK_T_SCSI_CMD) { |
1343 | fprintf(stderr, "Scsi commands unsupported\n"); | 1344 | fprintf(stderr, "Scsi commands unsupported\n"); |
1344 | in->status = VIRTIO_BLK_S_UNSUPP; | 1345 | in->status = VIRTIO_BLK_S_UNSUPP; |
1345 | wlen = sizeof(in); | 1346 | wlen = sizeof(*in); |
1346 | } else if (out->type & VIRTIO_BLK_T_OUT) { | 1347 | } else if (out->type & VIRTIO_BLK_T_OUT) { |
1347 | /* Write */ | 1348 | /* Write */ |
1348 | 1349 | ||
@@ -1363,7 +1364,7 @@ static bool service_io(struct device *dev) | |||
1363 | /* Die, bad Guest, die. */ | 1364 | /* Die, bad Guest, die. */ |
1364 | errx(1, "Write past end %llu+%u", off, ret); | 1365 | errx(1, "Write past end %llu+%u", off, ret); |
1365 | } | 1366 | } |
1366 | wlen = sizeof(in); | 1367 | wlen = sizeof(*in); |
1367 | in->status = (ret >= 0 ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR); | 1368 | in->status = (ret >= 0 ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR); |
1368 | } else { | 1369 | } else { |
1369 | /* Read */ | 1370 | /* Read */ |
@@ -1376,10 +1377,10 @@ static bool service_io(struct device *dev) | |||
1376 | ret = readv(vblk->fd, iov+1, in_num-1); | 1377 | ret = readv(vblk->fd, iov+1, in_num-1); |
1377 | verbose("READ from sector %llu: %i\n", out->sector, ret); | 1378 | verbose("READ from sector %llu: %i\n", out->sector, ret); |
1378 | if (ret >= 0) { | 1379 | if (ret >= 0) { |
1379 | wlen = sizeof(in) + ret; | 1380 | wlen = sizeof(*in) + ret; |
1380 | in->status = VIRTIO_BLK_S_OK; | 1381 | in->status = VIRTIO_BLK_S_OK; |
1381 | } else { | 1382 | } else { |
1382 | wlen = sizeof(in); | 1383 | wlen = sizeof(*in); |
1383 | in->status = VIRTIO_BLK_S_IOERR; | 1384 | in->status = VIRTIO_BLK_S_IOERR; |
1384 | } | 1385 | } |
1385 | } | 1386 | } |
diff --git a/Documentation/markers.txt b/Documentation/markers.txt index 295a71bc301e..d9f50a19fa0c 100644 --- a/Documentation/markers.txt +++ b/Documentation/markers.txt | |||
@@ -35,12 +35,14 @@ In order to use the macro trace_mark, you should include linux/marker.h. | |||
35 | 35 | ||
36 | And, | 36 | And, |
37 | 37 | ||
38 | trace_mark(subsystem_event, "%d %s", someint, somestring); | 38 | trace_mark(subsystem_event, "myint %d mystring %s", someint, somestring); |
39 | Where : | 39 | Where : |
40 | - subsystem_event is an identifier unique to your event | 40 | - subsystem_event is an identifier unique to your event |
41 | - subsystem is the name of your subsystem. | 41 | - subsystem is the name of your subsystem. |
42 | - event is the name of the event to mark. | 42 | - event is the name of the event to mark. |
43 | - "%d %s" is the formatted string for the serializer. | 43 | - "myint %d mystring %s" is the formatted string for the serializer. "myint" and |
44 | "mystring" are repectively the field names associated with the first and | ||
45 | second parameter. | ||
44 | - someint is an integer. | 46 | - someint is an integer. |
45 | - somestring is a char pointer. | 47 | - somestring is a char pointer. |
46 | 48 | ||
diff --git a/Documentation/networking/3c505.txt b/Documentation/networking/3c505.txt index b9d5b7230118..72f38b13101d 100644 --- a/Documentation/networking/3c505.txt +++ b/Documentation/networking/3c505.txt | |||
@@ -14,8 +14,7 @@ If no base address is given at boot time, the driver will autoprobe | |||
14 | ports 0x300, 0x280 and 0x310 (in that order). If no IRQ is given, the driver | 14 | ports 0x300, 0x280 and 0x310 (in that order). If no IRQ is given, the driver |
15 | will try to probe for it. | 15 | will try to probe for it. |
16 | 16 | ||
17 | The driver can be used as a loadable module. See net-modules.txt for details | 17 | The driver can be used as a loadable module. |
18 | of the parameters it can take. | ||
19 | 18 | ||
20 | Theoretically, one instance of the driver can now run multiple cards, | 19 | Theoretically, one instance of the driver can now run multiple cards, |
21 | in the standard way (when loading a module, say "modprobe 3c505 | 20 | in the standard way (when loading a module, say "modprobe 3c505 |
diff --git a/Documentation/rtc.txt b/Documentation/rtc.txt index c931d613f641..e20b19c1b60d 100644 --- a/Documentation/rtc.txt +++ b/Documentation/rtc.txt | |||
@@ -180,9 +180,10 @@ driver returns ENOIOCTLCMD. Some common examples: | |||
180 | * RTC_IRQP_SET, RTC_IRQP_READ: the irq_set_freq function will be called | 180 | * RTC_IRQP_SET, RTC_IRQP_READ: the irq_set_freq function will be called |
181 | to set the frequency while the framework will handle the read for you | 181 | to set the frequency while the framework will handle the read for you |
182 | since the frequency is stored in the irq_freq member of the rtc_device | 182 | since the frequency is stored in the irq_freq member of the rtc_device |
183 | structure. Also make sure you set the max_user_freq member in your | 183 | structure. Your driver needs to initialize the irq_freq member during |
184 | initialization routines so the framework can sanity check the user | 184 | init. Make sure you check the requested frequency is in range of your |
185 | input for you. | 185 | hardware in the irq_set_freq function. If you cannot actually change |
186 | the frequency, just return -ENOTTY. | ||
186 | 187 | ||
187 | If all else fails, check out the rtc-test.c driver! | 188 | If all else fails, check out the rtc-test.c driver! |
188 | 189 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 6a9702726239..cad0882754a6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3454,15 +3454,10 @@ L: lm-sensors@lm-sensors.org | |||
3454 | S: Maintained | 3454 | S: Maintained |
3455 | 3455 | ||
3456 | SOFTMAC LAYER (IEEE 802.11) | 3456 | SOFTMAC LAYER (IEEE 802.11) |
3457 | P: Johannes Berg | ||
3458 | M: johannes@sipsolutions.net | ||
3459 | P: Joe Jezak | ||
3460 | M: josejx@gentoo.org | ||
3461 | P: Daniel Drake | 3457 | P: Daniel Drake |
3462 | M: dsd@gentoo.org | 3458 | M: dsd@gentoo.org |
3463 | W: http://softmac.sipsolutions.net/ | ||
3464 | L: linux-wireless@vger.kernel.org | 3459 | L: linux-wireless@vger.kernel.org |
3465 | S: Maintained | 3460 | S: Obsolete |
3466 | 3461 | ||
3467 | SOFTWARE RAID (Multiple Disks) SUPPORT | 3462 | SOFTWARE RAID (Multiple Disks) SUPPORT |
3468 | P: Ingo Molnar | 3463 | P: Ingo Molnar |
@@ -197,8 +197,15 @@ CROSS_COMPILE ?= | |||
197 | UTS_MACHINE := $(ARCH) | 197 | UTS_MACHINE := $(ARCH) |
198 | SRCARCH := $(ARCH) | 198 | SRCARCH := $(ARCH) |
199 | 199 | ||
200 | # for i386 and x86_64 we use SRCARCH equal to x86 | 200 | # Additional ARCH settings for x86 |
201 | SRCARCH := $(if $(filter x86_64 i386,$(SRCARCH)),x86,$(SRCARCH)) | 201 | ifeq ($(ARCH),i386) |
202 | SRCARCH := x86 | ||
203 | K64BIT := n | ||
204 | endif | ||
205 | ifeq ($(ARCH),x86_64) | ||
206 | SRCARCH := x86 | ||
207 | K64BIT := y | ||
208 | endif | ||
202 | 209 | ||
203 | KCONFIG_CONFIG ?= .config | 210 | KCONFIG_CONFIG ?= .config |
204 | 211 | ||
@@ -334,7 +341,7 @@ KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) | |||
334 | KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) | 341 | KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) |
335 | 342 | ||
336 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION | 343 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION |
337 | export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC | 344 | export ARCH SRCARCH K64BIT CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC |
338 | export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE | 345 | export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE |
339 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | 346 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS |
340 | 347 | ||
@@ -194,6 +194,8 @@ CONFIGURING the kernel: | |||
194 | "make *config" checks for a file named "all{yes/mod/no/random}.config" | 194 | "make *config" checks for a file named "all{yes/mod/no/random}.config" |
195 | for symbol values that are to be forced. If this file is not found, | 195 | for symbol values that are to be forced. If this file is not found, |
196 | it checks for a file named "all.config" to contain forced values. | 196 | it checks for a file named "all.config" to contain forced values. |
197 | Finally it checks the environment variable K64BIT and if found, sets | ||
198 | the config symbol "64BIT" to the value of the K64BIT variable. | ||
197 | 199 | ||
198 | NOTES on "make config": | 200 | NOTES on "make config": |
199 | - having unnecessary drivers will make the kernel bigger, and can | 201 | - having unnecessary drivers will make the kernel bigger, and can |
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index 1873bd8cd1b2..bc91d6e66bc4 100644 --- a/arch/arm/mach-iop32x/n2100.c +++ b/arch/arm/mach-iop32x/n2100.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/f75375s.h> | ||
19 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
20 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
21 | #include <linux/pci.h> | 22 | #include <linux/pci.h> |
@@ -200,11 +201,21 @@ static struct platform_device n2100_serial_device = { | |||
200 | .resource = &n2100_uart_resource, | 201 | .resource = &n2100_uart_resource, |
201 | }; | 202 | }; |
202 | 203 | ||
204 | static struct f75375s_platform_data n2100_f75375s = { | ||
205 | .pwm = { 255, 255 }, | ||
206 | .pwm_enable = { 0, 0 }, | ||
207 | }; | ||
208 | |||
203 | static struct i2c_board_info __initdata n2100_i2c_devices[] = { | 209 | static struct i2c_board_info __initdata n2100_i2c_devices[] = { |
204 | { | 210 | { |
205 | I2C_BOARD_INFO("rtc-rs5c372", 0x32), | 211 | I2C_BOARD_INFO("rtc-rs5c372", 0x32), |
206 | .type = "rs5c372b", | 212 | .type = "rs5c372b", |
207 | }, | 213 | }, |
214 | { | ||
215 | I2C_BOARD_INFO("f75375", 0x2e), | ||
216 | .type = "f75375", | ||
217 | .platform_data = &n2100_f75375s, | ||
218 | }, | ||
208 | }; | 219 | }; |
209 | 220 | ||
210 | /* | 221 | /* |
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index 21900a9378bb..222da1501f47 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig | |||
@@ -13,6 +13,10 @@ config ZONE_DMA | |||
13 | bool | 13 | bool |
14 | default y | 14 | default y |
15 | 15 | ||
16 | config NO_DMA | ||
17 | bool | ||
18 | default y | ||
19 | |||
16 | config RWSEM_GENERIC_SPINLOCK | 20 | config RWSEM_GENERIC_SPINLOCK |
17 | bool | 21 | bool |
18 | default y | 22 | default y |
@@ -57,6 +61,10 @@ menu "General setup" | |||
57 | 61 | ||
58 | source "fs/Kconfig.binfmt" | 62 | source "fs/Kconfig.binfmt" |
59 | 63 | ||
64 | config GENERIC_HARDIRQS | ||
65 | bool | ||
66 | default y | ||
67 | |||
60 | config ETRAX_CMDLINE | 68 | config ETRAX_CMDLINE |
61 | string "Kernel command line" | 69 | string "Kernel command line" |
62 | default "root=/dev/mtdblock3" | 70 | default "root=/dev/mtdblock3" |
@@ -149,7 +157,8 @@ source "net/Kconfig" | |||
149 | 157 | ||
150 | # bring in ETRAX built-in drivers | 158 | # bring in ETRAX built-in drivers |
151 | menu "Drivers for built-in interfaces" | 159 | menu "Drivers for built-in interfaces" |
152 | source arch/cris/arch-v10/drivers/Kconfig | 160 | # arch/cris/arch is a symlink to correct arch (arch-v10 or arch-v32) |
161 | source arch/cris/arch/drivers/Kconfig | ||
153 | 162 | ||
154 | endmenu | 163 | endmenu |
155 | 164 | ||
@@ -180,6 +189,10 @@ source "drivers/isdn/Kconfig" | |||
180 | 189 | ||
181 | source "drivers/telephony/Kconfig" | 190 | source "drivers/telephony/Kconfig" |
182 | 191 | ||
192 | source "drivers/i2c/Kconfig" | ||
193 | |||
194 | source "drivers/rtc/Kconfig" | ||
195 | |||
183 | # | 196 | # |
184 | # input before char - char/joystick depends on it. As does USB. | 197 | # input before char - char/joystick depends on it. As does USB. |
185 | # | 198 | # |
@@ -194,6 +207,10 @@ source "fs/Kconfig" | |||
194 | 207 | ||
195 | source "sound/Kconfig" | 208 | source "sound/Kconfig" |
196 | 209 | ||
210 | source "drivers/pcmcia/Kconfig" | ||
211 | |||
212 | source "drivers/pci/Kconfig" | ||
213 | |||
197 | source "drivers/usb/Kconfig" | 214 | source "drivers/usb/Kconfig" |
198 | 215 | ||
199 | source "kernel/Kconfig.instrumentation" | 216 | source "kernel/Kconfig.instrumentation" |
diff --git a/arch/cris/arch-v10/defconfig b/arch/cris/arch-v10/defconfig index 710c20ba2be7..572f11926399 100644 --- a/arch/cris/arch-v10/defconfig +++ b/arch/cris/arch-v10/defconfig | |||
@@ -99,7 +99,6 @@ CONFIG_MTD=y | |||
99 | CONFIG_MTD_CFI=y | 99 | CONFIG_MTD_CFI=y |
100 | # CONFIG_MTD_CFI_INTELEXT is not set | 100 | # CONFIG_MTD_CFI_INTELEXT is not set |
101 | CONFIG_MTD_CFI_AMDSTD=y | 101 | CONFIG_MTD_CFI_AMDSTD=y |
102 | CONFIG_MTD_AMDSTD=y | ||
103 | CONFIG_MTD_CHAR=y | 102 | CONFIG_MTD_CHAR=y |
104 | CONFIG_MTD_BLOCK=y | 103 | CONFIG_MTD_BLOCK=y |
105 | CONFIG_ETRAX_I2C=y | 104 | CONFIG_ETRAX_I2C=y |
@@ -145,7 +144,6 @@ CONFIG_MTD_CFI=y | |||
145 | # CONFIG_MTD_CFI_GEOMETRY is not set | 144 | # CONFIG_MTD_CFI_GEOMETRY is not set |
146 | # CONFIG_MTD_CFI_INTELEXT is not set | 145 | # CONFIG_MTD_CFI_INTELEXT is not set |
147 | CONFIG_MTD_CFI_AMDSTD=y | 146 | CONFIG_MTD_CFI_AMDSTD=y |
148 | CONFIG_MTD_AMDSTD=y | ||
149 | # CONFIG_MTD_SHARP is not set | 147 | # CONFIG_MTD_SHARP is not set |
150 | # CONFIG_MTD_PHYSMAP is not set | 148 | # CONFIG_MTD_PHYSMAP is not set |
151 | # CONFIG_MTD_NORA is not set | 149 | # CONFIG_MTD_NORA is not set |
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig index 03e2e68f947d..faf8b4d3ca01 100644 --- a/arch/cris/arch-v10/drivers/Kconfig +++ b/arch/cris/arch-v10/drivers/Kconfig | |||
@@ -2,6 +2,7 @@ config ETRAX_ETHERNET | |||
2 | bool "Ethernet support" | 2 | bool "Ethernet support" |
3 | depends on ETRAX_ARCH_V10 | 3 | depends on ETRAX_ARCH_V10 |
4 | select NET_ETHERNET | 4 | select NET_ETHERNET |
5 | select MII | ||
5 | help | 6 | help |
6 | This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet | 7 | This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet |
7 | controller. | 8 | controller. |
@@ -605,8 +606,6 @@ config ETRAX_AXISFLASHMAP | |||
605 | select MTD | 606 | select MTD |
606 | select MTD_CFI | 607 | select MTD_CFI |
607 | select MTD_CFI_AMDSTD | 608 | select MTD_CFI_AMDSTD |
608 | select MTD_OBSOLETE_CHIPS | ||
609 | select MTD_AMDSTD | ||
610 | select MTD_CHAR | 609 | select MTD_CHAR |
611 | select MTD_BLOCK | 610 | select MTD_BLOCK |
612 | select MTD_PARTITIONS | 611 | select MTD_PARTITIONS |
diff --git a/arch/cris/arch-v10/drivers/axisflashmap.c b/arch/cris/arch-v10/drivers/axisflashmap.c index efd7b0f3a910..ea3cf2e39a14 100644 --- a/arch/cris/arch-v10/drivers/axisflashmap.c +++ b/arch/cris/arch-v10/drivers/axisflashmap.c | |||
@@ -312,12 +312,12 @@ static struct mtd_info *probe_cs(struct map_info *map_cs) | |||
312 | "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", | 312 | "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", |
313 | map_cs->name, map_cs->size, map_cs->map_priv_1); | 313 | map_cs->name, map_cs->size, map_cs->map_priv_1); |
314 | 314 | ||
315 | #ifdef CONFIG_MTD_AMDSTD | ||
316 | mtd_cs = do_map_probe("amd_flash", map_cs); | ||
317 | #endif | ||
318 | #ifdef CONFIG_MTD_CFI | 315 | #ifdef CONFIG_MTD_CFI |
316 | mtd_cs = do_map_probe("cfi_probe", map_cs); | ||
317 | #endif | ||
318 | #ifdef CONFIG_MTD_JEDECPROBE | ||
319 | if (!mtd_cs) { | 319 | if (!mtd_cs) { |
320 | mtd_cs = do_map_probe("cfi_probe", map_cs); | 320 | mtd_cs = do_map_probe("jedec_probe", map_cs); |
321 | } | 321 | } |
322 | #endif | 322 | #endif |
323 | 323 | ||
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c index f389ed6998fe..0d347a705835 100644 --- a/arch/cris/arch-v10/drivers/gpio.c +++ b/arch/cris/arch-v10/drivers/gpio.c | |||
@@ -297,8 +297,10 @@ gpio_poll(struct file *file, | |||
297 | data = *R_PORT_PB_DATA; | 297 | data = *R_PORT_PB_DATA; |
298 | else if (priv->minor == GPIO_MINOR_G) | 298 | else if (priv->minor == GPIO_MINOR_G) |
299 | data = *R_PORT_G_DATA; | 299 | data = *R_PORT_G_DATA; |
300 | else | 300 | else { |
301 | spin_unlock(&gpio_lock); | ||
301 | return 0; | 302 | return 0; |
303 | } | ||
302 | 304 | ||
303 | if ((data & priv->highalarm) || | 305 | if ((data & priv->highalarm) || |
304 | (~data & priv->lowalarm)) { | 306 | (~data & priv->lowalarm)) { |
@@ -381,18 +383,21 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count, | |||
381 | 383 | ||
382 | ssize_t retval = count; | 384 | ssize_t retval = count; |
383 | if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) { | 385 | if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) { |
384 | return -EFAULT; | 386 | retval = -EFAULT; |
387 | goto out; | ||
385 | } | 388 | } |
386 | 389 | ||
387 | if (!access_ok(VERIFY_READ, buf, count)) { | 390 | if (!access_ok(VERIFY_READ, buf, count)) { |
388 | return -EFAULT; | 391 | retval = -EFAULT; |
392 | goto out; | ||
389 | } | 393 | } |
390 | clk_mask = priv->clk_mask; | 394 | clk_mask = priv->clk_mask; |
391 | data_mask = priv->data_mask; | 395 | data_mask = priv->data_mask; |
392 | /* It must have been configured using the IO_CFG_WRITE_MODE */ | 396 | /* It must have been configured using the IO_CFG_WRITE_MODE */ |
393 | /* Perhaps a better error code? */ | 397 | /* Perhaps a better error code? */ |
394 | if (clk_mask == 0 || data_mask == 0) { | 398 | if (clk_mask == 0 || data_mask == 0) { |
395 | return -EPERM; | 399 | retval = -EPERM; |
400 | goto out; | ||
396 | } | 401 | } |
397 | write_msb = priv->write_msb; | 402 | write_msb = priv->write_msb; |
398 | D(printk("gpio_write: %lu to data 0x%02X clk 0x%02X msb: %i\n",count, data_mask, clk_mask, write_msb)); | 403 | D(printk("gpio_write: %lu to data 0x%02X clk 0x%02X msb: %i\n",count, data_mask, clk_mask, write_msb)); |
@@ -425,6 +430,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count, | |||
425 | } | 430 | } |
426 | } | 431 | } |
427 | } | 432 | } |
433 | out: | ||
428 | spin_unlock(&gpio_lock); | 434 | spin_unlock(&gpio_lock); |
429 | return retval; | 435 | return retval; |
430 | } | 436 | } |
@@ -506,6 +512,7 @@ gpio_release(struct inode *inode, struct file *filp) | |||
506 | while (p) { | 512 | while (p) { |
507 | if (p->highalarm | p->lowalarm) { | 513 | if (p->highalarm | p->lowalarm) { |
508 | gpio_some_alarms = 1; | 514 | gpio_some_alarms = 1; |
515 | spin_unlock(&gpio_lock); | ||
509 | return 0; | 516 | return 0; |
510 | } | 517 | } |
511 | p = p->next; | 518 | p = p->next; |
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S index c5844cb70f09..ec62c951fa3c 100644 --- a/arch/cris/arch-v10/kernel/entry.S +++ b/arch/cris/arch-v10/kernel/entry.S | |||
@@ -500,9 +500,8 @@ _work_notifysig: | |||
500 | ;; deal with pending signals and notify-resume requests | 500 | ;; deal with pending signals and notify-resume requests |
501 | 501 | ||
502 | move.d $r9, $r10 ; do_notify_resume syscall/irq param | 502 | move.d $r9, $r10 ; do_notify_resume syscall/irq param |
503 | moveq 0, $r11 ; oldset param - 0 in this case | 503 | move.d $sp, $r11 ; the regs param |
504 | move.d $sp, $r12 ; the regs param | 504 | move.d $r1, $r12 ; the thread_info_flags parameter |
505 | move.d $r1, $r13 ; the thread_info_flags parameter | ||
506 | jsr do_notify_resume | 505 | jsr do_notify_resume |
507 | 506 | ||
508 | ba _Rexit | 507 | ba _Rexit |
@@ -678,13 +677,19 @@ IRQ1_interrupt: | |||
678 | push $r10 ; push orig_r10 | 677 | push $r10 ; push orig_r10 |
679 | clear.d [$sp=$sp-4] ; frametype == 0, normal frame | 678 | clear.d [$sp=$sp-4] ; frametype == 0, normal frame |
680 | 679 | ||
680 | ;; If there is a glitch on the NMI pin shorter than ~100ns | ||
681 | ;; (i.e. non-active by the time we get here) then the nmi_pin bit | ||
682 | ;; in R_IRQ_MASK0_RD will already be cleared. The watchdog_nmi bit | ||
683 | ;; is cleared by us however (when feeding the watchdog), which is why | ||
684 | ;; we use that bit to determine what brought us here. | ||
685 | |||
681 | move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog? | 686 | move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog? |
682 | and.d 0x80000000, $r1 | 687 | and.d (1<<30), $r1 |
683 | beq wdog | 688 | bne wdog |
684 | move.d $sp, $r10 | 689 | move.d $sp, $r10 |
685 | jsr handle_nmi | 690 | jsr handle_nmi |
686 | setf m ; Enable NMI again | 691 | setf m ; Enable NMI again |
687 | retb ; Return from NMI | 692 | ba _Rexit ; Return the standard way |
688 | nop | 693 | nop |
689 | wdog: | 694 | wdog: |
690 | #if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) | 695 | #if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) |
@@ -775,22 +780,9 @@ multiple_interrupt: | |||
775 | push $r10 ; push orig_r10 | 780 | push $r10 ; push orig_r10 |
776 | clear.d [$sp=$sp-4] ; frametype == 0, normal frame | 781 | clear.d [$sp=$sp-4] ; frametype == 0, normal frame |
777 | 782 | ||
778 | moveq 2, $r2 ; first bit we care about is the timer0 irq | 783 | move.d $sp, $r10 |
779 | move.d [R_VECT_MASK_RD], $r0; read the irq bits that triggered the multiple irq | 784 | jsr do_multiple_IRQ |
780 | move.d $r0, [R_VECT_MASK_CLR] ; Block all active IRQs | ||
781 | 1: | ||
782 | btst $r2, $r0 ; check for the irq given by bit r2 | ||
783 | bpl 2f | ||
784 | move.d $r2, $r10 ; First argument to do_IRQ | ||
785 | move.d $sp, $r11 ; second argument to do_IRQ | ||
786 | jsr do_IRQ | ||
787 | 2: | ||
788 | addq 1, $r2 ; next vector bit | ||
789 | cmp.b 32, $r2 | ||
790 | bne 1b ; process all irq's up to and including number 31 | ||
791 | moveq 0, $r9 ; make ret_from_intr realise we came from an ir | ||
792 | 785 | ||
793 | move.d $r0, [R_VECT_MASK_SET] ; Unblock all the IRQs | ||
794 | jump ret_from_intr | 786 | jump ret_from_intr |
795 | 787 | ||
796 | do_sigtrap: | 788 | do_sigtrap: |
@@ -837,6 +829,13 @@ _ugdb_handle_breakpoint: | |||
837 | ba do_sigtrap ; SIGTRAP the offending process. | 829 | ba do_sigtrap ; SIGTRAP the offending process. |
838 | pop $dccr ; Restore dccr in delay slot. | 830 | pop $dccr ; Restore dccr in delay slot. |
839 | 831 | ||
832 | .global kernel_execve | ||
833 | kernel_execve: | ||
834 | move.d __NR_execve, $r9 | ||
835 | break 13 | ||
836 | ret | ||
837 | nop | ||
838 | |||
840 | .data | 839 | .data |
841 | 840 | ||
842 | hw_bp_trigs: | 841 | hw_bp_trigs: |
@@ -1135,6 +1134,42 @@ sys_call_table: | |||
1135 | .long sys_add_key | 1134 | .long sys_add_key |
1136 | .long sys_request_key | 1135 | .long sys_request_key |
1137 | .long sys_keyctl | 1136 | .long sys_keyctl |
1137 | .long sys_ioprio_set | ||
1138 | .long sys_ioprio_get /* 290 */ | ||
1139 | .long sys_inotify_init | ||
1140 | .long sys_inotify_add_watch | ||
1141 | .long sys_inotify_rm_watch | ||
1142 | .long sys_migrate_pages | ||
1143 | .long sys_openat /* 295 */ | ||
1144 | .long sys_mkdirat | ||
1145 | .long sys_mknodat | ||
1146 | .long sys_fchownat | ||
1147 | .long sys_futimesat | ||
1148 | .long sys_fstatat64 /* 300 */ | ||
1149 | .long sys_unlinkat | ||
1150 | .long sys_renameat | ||
1151 | .long sys_linkat | ||
1152 | .long sys_symlinkat | ||
1153 | .long sys_readlinkat /* 305 */ | ||
1154 | .long sys_fchmodat | ||
1155 | .long sys_faccessat | ||
1156 | .long sys_pselect6 | ||
1157 | .long sys_ppoll | ||
1158 | .long sys_unshare /* 310 */ | ||
1159 | .long sys_set_robust_list | ||
1160 | .long sys_get_robust_list | ||
1161 | .long sys_splice | ||
1162 | .long sys_sync_file_range | ||
1163 | .long sys_tee /* 315 */ | ||
1164 | .long sys_vmsplice | ||
1165 | .long sys_move_pages | ||
1166 | .long sys_getcpu | ||
1167 | .long sys_epoll_pwait | ||
1168 | .long sys_utimensat /* 320 */ | ||
1169 | .long sys_signalfd | ||
1170 | .long sys_timerfd | ||
1171 | .long sys_eventfd | ||
1172 | .long sys_fallocate | ||
1138 | 1173 | ||
1139 | /* | 1174 | /* |
1140 | * NOTE!! This doesn't have to be exact - we just have | 1175 | * NOTE!! This doesn't have to be exact - we just have |
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c index d3ea052e5ee1..c1a3a2100ee7 100644 --- a/arch/cris/arch-v10/kernel/fasttimer.c +++ b/arch/cris/arch-v10/kernel/fasttimer.c | |||
@@ -1,97 +1,9 @@ | |||
1 | /* $Id: fasttimer.c,v 1.9 2005/03/04 08:16:16 starvik Exp $ | 1 | /* |
2 | * linux/arch/cris/kernel/fasttimer.c | 2 | * linux/arch/cris/kernel/fasttimer.c |
3 | * | 3 | * |
4 | * Fast timers for ETRAX100/ETRAX100LX | 4 | * Fast timers for ETRAX100/ETRAX100LX |
5 | * This may be useful in other OS than Linux so use 2 space indentation... | ||
6 | * | 5 | * |
7 | * $Log: fasttimer.c,v $ | 6 | * Copyright (C) 2000-2007 Axis Communications AB, Lund, Sweden |
8 | * Revision 1.9 2005/03/04 08:16:16 starvik | ||
9 | * Merge of Linux 2.6.11. | ||
10 | * | ||
11 | * Revision 1.8 2005/01/05 06:09:29 starvik | ||
12 | * cli()/sti() will be obsolete in 2.6.11. | ||
13 | * | ||
14 | * Revision 1.7 2005/01/03 13:35:46 starvik | ||
15 | * Removed obsolete stuff. | ||
16 | * Mark fast timer IRQ as not shared. | ||
17 | * | ||
18 | * Revision 1.6 2004/05/14 10:18:39 starvik | ||
19 | * Export fast_timer_list | ||
20 | * | ||
21 | * Revision 1.5 2004/05/14 07:58:01 starvik | ||
22 | * Merge of changes from 2.4 | ||
23 | * | ||
24 | * Revision 1.4 2003/07/04 08:27:41 starvik | ||
25 | * Merge of Linux 2.5.74 | ||
26 | * | ||
27 | * Revision 1.3 2002/12/12 08:26:32 starvik | ||
28 | * Don't use C-comments inside CVS comments | ||
29 | * | ||
30 | * Revision 1.2 2002/12/11 15:42:02 starvik | ||
31 | * Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/ | ||
32 | * | ||
33 | * Revision 1.1 2002/11/18 07:58:06 starvik | ||
34 | * Fast timers (from Linux 2.4) | ||
35 | * | ||
36 | * Revision 1.5 2002/10/15 06:21:39 starvik | ||
37 | * Added call to init_waitqueue_head | ||
38 | * | ||
39 | * Revision 1.4 2002/05/28 17:47:59 johana | ||
40 | * Added del_fast_timer() | ||
41 | * | ||
42 | * Revision 1.3 2002/05/28 16:16:07 johana | ||
43 | * Handle empty fast_timer_list | ||
44 | * | ||
45 | * Revision 1.2 2002/05/27 15:38:42 johana | ||
46 | * Made it compile without warnings on Linux 2.4. | ||
47 | * (includes, wait_queue, PROC_FS and snprintf) | ||
48 | * | ||
49 | * Revision 1.1 2002/05/27 15:32:25 johana | ||
50 | * arch/etrax100/kernel/fasttimer.c v1.8 from the elinux tree. | ||
51 | * | ||
52 | * Revision 1.8 2001/11/27 13:50:40 pkj | ||
53 | * Disable interrupts while stopping the timer and while modifying the | ||
54 | * list of active timers in timer1_handler() as it may be interrupted | ||
55 | * by other interrupts (e.g., the serial interrupt) which may add fast | ||
56 | * timers. | ||
57 | * | ||
58 | * Revision 1.7 2001/11/22 11:50:32 pkj | ||
59 | * * Only store information about the last 16 timers. | ||
60 | * * proc_fasttimer_read() now uses an allocated buffer, since it | ||
61 | * requires more space than just a page even for only writing the | ||
62 | * last 16 timers. The buffer is only allocated on request, so | ||
63 | * unless /proc/fasttimer is read, it is never allocated. | ||
64 | * * Renamed fast_timer_started to fast_timers_started to match | ||
65 | * fast_timers_added and fast_timers_expired. | ||
66 | * * Some clean-up. | ||
67 | * | ||
68 | * Revision 1.6 2000/12/13 14:02:08 johana | ||
69 | * Removed volatile for fast_timer_list | ||
70 | * | ||
71 | * Revision 1.5 2000/12/13 13:55:35 johana | ||
72 | * Added DEBUG_LOG, added som cli() and cleanup | ||
73 | * | ||
74 | * Revision 1.4 2000/12/05 13:48:50 johana | ||
75 | * Added range check when writing proc file, modified timer int handling | ||
76 | * | ||
77 | * Revision 1.3 2000/11/23 10:10:20 johana | ||
78 | * More debug/logging possibilities. | ||
79 | * Moved GET_JIFFIES_USEC() to timex.h and time.c | ||
80 | * | ||
81 | * Revision 1.2 2000/11/01 13:41:04 johana | ||
82 | * Clean up and bugfixes. | ||
83 | * Created new do_gettimeofday_fast() that gets a timeval struct | ||
84 | * with time based on jiffies and *R_TIMER0_DATA, uses a table | ||
85 | * for fast conversion of timer value to microseconds. | ||
86 | * (Much faster the standard do_gettimeofday() and we don't really | ||
87 | * want to use the true time - we want the "uptime" so timers don't screw up | ||
88 | * when we change the time. | ||
89 | * TODO: Add efficient support for continuous timers as well. | ||
90 | * | ||
91 | * Revision 1.1 2000/10/26 15:49:16 johana | ||
92 | * Added fasttimer, highresolution timers. | ||
93 | * | ||
94 | * Copyright (C) 2000,2001 2002 Axis Communications AB, Lund, Sweden | ||
95 | */ | 7 | */ |
96 | 8 | ||
97 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
@@ -125,7 +37,7 @@ | |||
125 | 37 | ||
126 | #ifdef FAST_TIMER_SANITY_CHECKS | 38 | #ifdef FAST_TIMER_SANITY_CHECKS |
127 | #define SANITYCHECK(x) x | 39 | #define SANITYCHECK(x) x |
128 | static int sanity_failed = 0; | 40 | static int sanity_failed; |
129 | #else | 41 | #else |
130 | #define SANITYCHECK(x) | 42 | #define SANITYCHECK(x) |
131 | #endif | 43 | #endif |
@@ -134,15 +46,13 @@ static int sanity_failed = 0; | |||
134 | #define D2(x) | 46 | #define D2(x) |
135 | #define DP(x) | 47 | #define DP(x) |
136 | 48 | ||
137 | #define __INLINE__ inline | 49 | static unsigned int fast_timer_running; |
138 | 50 | static unsigned int fast_timers_added; | |
139 | static int fast_timer_running = 0; | 51 | static unsigned int fast_timers_started; |
140 | static int fast_timers_added = 0; | 52 | static unsigned int fast_timers_expired; |
141 | static int fast_timers_started = 0; | 53 | static unsigned int fast_timers_deleted; |
142 | static int fast_timers_expired = 0; | 54 | static unsigned int fast_timer_is_init; |
143 | static int fast_timers_deleted = 0; | 55 | static unsigned int fast_timer_ints; |
144 | static int fast_timer_is_init = 0; | ||
145 | static int fast_timer_ints = 0; | ||
146 | 56 | ||
147 | struct fast_timer *fast_timer_list = NULL; | 57 | struct fast_timer *fast_timer_list = NULL; |
148 | 58 | ||
@@ -150,8 +60,8 @@ struct fast_timer *fast_timer_list = NULL; | |||
150 | #define DEBUG_LOG_MAX 128 | 60 | #define DEBUG_LOG_MAX 128 |
151 | static const char * debug_log_string[DEBUG_LOG_MAX]; | 61 | static const char * debug_log_string[DEBUG_LOG_MAX]; |
152 | static unsigned long debug_log_value[DEBUG_LOG_MAX]; | 62 | static unsigned long debug_log_value[DEBUG_LOG_MAX]; |
153 | static int debug_log_cnt = 0; | 63 | static unsigned int debug_log_cnt; |
154 | static int debug_log_cnt_wrapped = 0; | 64 | static unsigned int debug_log_cnt_wrapped; |
155 | 65 | ||
156 | #define DEBUG_LOG(string, value) \ | 66 | #define DEBUG_LOG(string, value) \ |
157 | { \ | 67 | { \ |
@@ -206,45 +116,29 @@ int timer_freq_settings[NUM_TIMER_STATS]; | |||
206 | int timer_delay_settings[NUM_TIMER_STATS]; | 116 | int timer_delay_settings[NUM_TIMER_STATS]; |
207 | 117 | ||
208 | /* Not true gettimeofday, only checks the jiffies (uptime) + useconds */ | 118 | /* Not true gettimeofday, only checks the jiffies (uptime) + useconds */ |
209 | void __INLINE__ do_gettimeofday_fast(struct timeval *tv) | 119 | inline void do_gettimeofday_fast(struct fasttime_t *tv) |
210 | { | 120 | { |
211 | unsigned long sec = jiffies; | 121 | tv->tv_jiff = jiffies; |
212 | unsigned long usec = GET_JIFFIES_USEC(); | 122 | tv->tv_usec = GET_JIFFIES_USEC(); |
213 | |||
214 | usec += (sec % HZ) * (1000000 / HZ); | ||
215 | sec = sec / HZ; | ||
216 | |||
217 | if (usec > 1000000) | ||
218 | { | ||
219 | usec -= 1000000; | ||
220 | sec++; | ||
221 | } | ||
222 | tv->tv_sec = sec; | ||
223 | tv->tv_usec = usec; | ||
224 | } | 123 | } |
225 | 124 | ||
226 | int __INLINE__ timeval_cmp(struct timeval *t0, struct timeval *t1) | 125 | inline int fasttime_cmp(struct fasttime_t *t0, struct fasttime_t *t1) |
227 | { | 126 | { |
228 | if (t0->tv_sec < t1->tv_sec) | 127 | /* Compare jiffies. Takes care of wrapping */ |
229 | { | 128 | if (time_before(t0->tv_jiff, t1->tv_jiff)) |
230 | return -1; | 129 | return -1; |
231 | } | 130 | else if (time_after(t0->tv_jiff, t1->tv_jiff)) |
232 | else if (t0->tv_sec > t1->tv_sec) | 131 | return 1; |
233 | { | 132 | |
234 | return 1; | 133 | /* Compare us */ |
235 | } | 134 | if (t0->tv_usec < t1->tv_usec) |
236 | if (t0->tv_usec < t1->tv_usec) | 135 | return -1; |
237 | { | 136 | else if (t0->tv_usec > t1->tv_usec) |
238 | return -1; | 137 | return 1; |
239 | } | 138 | return 0; |
240 | else if (t0->tv_usec > t1->tv_usec) | ||
241 | { | ||
242 | return 1; | ||
243 | } | ||
244 | return 0; | ||
245 | } | 139 | } |
246 | 140 | ||
247 | void __INLINE__ start_timer1(unsigned long delay_us) | 141 | inline void start_timer1(unsigned long delay_us) |
248 | { | 142 | { |
249 | int freq_index = 0; /* This is the lowest resolution */ | 143 | int freq_index = 0; /* This is the lowest resolution */ |
250 | unsigned long upper_limit = MAX_DELAY_US; | 144 | unsigned long upper_limit = MAX_DELAY_US; |
@@ -285,7 +179,7 @@ void __INLINE__ start_timer1(unsigned long delay_us) | |||
285 | timer_freq_settings[fast_timers_started % NUM_TIMER_STATS] = freq_index; | 179 | timer_freq_settings[fast_timers_started % NUM_TIMER_STATS] = freq_index; |
286 | timer_delay_settings[fast_timers_started % NUM_TIMER_STATS] = delay_us; | 180 | timer_delay_settings[fast_timers_started % NUM_TIMER_STATS] = delay_us; |
287 | 181 | ||
288 | D1(printk("start_timer1 : %d us freq: %i div: %i\n", | 182 | D1(printk(KERN_DEBUG "start_timer1 : %d us freq: %i div: %i\n", |
289 | delay_us, freq_index, div)); | 183 | delay_us, freq_index, div)); |
290 | /* Clear timer1 irq */ | 184 | /* Clear timer1 irq */ |
291 | *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr); | 185 | *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr); |
@@ -340,7 +234,7 @@ void start_one_shot_timer(struct fast_timer *t, | |||
340 | printk(KERN_WARNING | 234 | printk(KERN_WARNING |
341 | "timer name: %s data: 0x%08lX already in list!\n", name, data); | 235 | "timer name: %s data: 0x%08lX already in list!\n", name, data); |
342 | sanity_failed++; | 236 | sanity_failed++; |
343 | return; | 237 | goto done; |
344 | } | 238 | } |
345 | else | 239 | else |
346 | { | 240 | { |
@@ -356,11 +250,11 @@ void start_one_shot_timer(struct fast_timer *t, | |||
356 | t->name = name; | 250 | t->name = name; |
357 | 251 | ||
358 | t->tv_expires.tv_usec = t->tv_set.tv_usec + delay_us % 1000000; | 252 | t->tv_expires.tv_usec = t->tv_set.tv_usec + delay_us % 1000000; |
359 | t->tv_expires.tv_sec = t->tv_set.tv_sec + delay_us / 1000000; | 253 | t->tv_expires.tv_jiff = t->tv_set.tv_jiff + delay_us / 1000000 / HZ; |
360 | if (t->tv_expires.tv_usec > 1000000) | 254 | if (t->tv_expires.tv_usec > 1000000) |
361 | { | 255 | { |
362 | t->tv_expires.tv_usec -= 1000000; | 256 | t->tv_expires.tv_usec -= 1000000; |
363 | t->tv_expires.tv_sec++; | 257 | t->tv_expires.tv_jiff += HZ; |
364 | } | 258 | } |
365 | #ifdef FAST_TIMER_LOG | 259 | #ifdef FAST_TIMER_LOG |
366 | timer_added_log[fast_timers_added % NUM_TIMER_STATS] = *t; | 260 | timer_added_log[fast_timers_added % NUM_TIMER_STATS] = *t; |
@@ -368,7 +262,7 @@ void start_one_shot_timer(struct fast_timer *t, | |||
368 | fast_timers_added++; | 262 | fast_timers_added++; |
369 | 263 | ||
370 | /* Check if this should timeout before anything else */ | 264 | /* Check if this should timeout before anything else */ |
371 | if (tmp == NULL || timeval_cmp(&t->tv_expires, &tmp->tv_expires) < 0) | 265 | if (tmp == NULL || fasttime_cmp(&t->tv_expires, &tmp->tv_expires) < 0) |
372 | { | 266 | { |
373 | /* Put first in list and modify the timer value */ | 267 | /* Put first in list and modify the timer value */ |
374 | t->prev = NULL; | 268 | t->prev = NULL; |
@@ -384,8 +278,8 @@ void start_one_shot_timer(struct fast_timer *t, | |||
384 | start_timer1(delay_us); | 278 | start_timer1(delay_us); |
385 | } else { | 279 | } else { |
386 | /* Put in correct place in list */ | 280 | /* Put in correct place in list */ |
387 | while (tmp->next && | 281 | while (tmp->next && fasttime_cmp(&t->tv_expires, |
388 | timeval_cmp(&t->tv_expires, &tmp->next->tv_expires) > 0) | 282 | &tmp->next->tv_expires) > 0) |
389 | { | 283 | { |
390 | tmp = tmp->next; | 284 | tmp = tmp->next; |
391 | } | 285 | } |
@@ -401,6 +295,7 @@ void start_one_shot_timer(struct fast_timer *t, | |||
401 | 295 | ||
402 | D2(printk("start_one_shot_timer: %d us done\n", delay_us)); | 296 | D2(printk("start_one_shot_timer: %d us done\n", delay_us)); |
403 | 297 | ||
298 | done: | ||
404 | local_irq_restore(flags); | 299 | local_irq_restore(flags); |
405 | } /* start_one_shot_timer */ | 300 | } /* start_one_shot_timer */ |
406 | 301 | ||
@@ -444,11 +339,18 @@ int del_fast_timer(struct fast_timer * t) | |||
444 | /* Timer 1 interrupt handler */ | 339 | /* Timer 1 interrupt handler */ |
445 | 340 | ||
446 | static irqreturn_t | 341 | static irqreturn_t |
447 | timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | 342 | timer1_handler(int irq, void *dev_id) |
448 | { | 343 | { |
449 | struct fast_timer *t; | 344 | struct fast_timer *t; |
450 | unsigned long flags; | 345 | unsigned long flags; |
451 | 346 | ||
347 | /* We keep interrupts disabled not only when we modify the | ||
348 | * fast timer list, but any time we hold a reference to a | ||
349 | * timer in the list, since del_fast_timer may be called | ||
350 | * from (another) interrupt context. Thus, the only time | ||
351 | * when interrupts are enabled is when calling the timer | ||
352 | * callback function. | ||
353 | */ | ||
452 | local_irq_save(flags); | 354 | local_irq_save(flags); |
453 | 355 | ||
454 | /* Clear timer1 irq */ | 356 | /* Clear timer1 irq */ |
@@ -466,18 +368,19 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
466 | fast_timer_running = 0; | 368 | fast_timer_running = 0; |
467 | fast_timer_ints++; | 369 | fast_timer_ints++; |
468 | 370 | ||
469 | local_irq_restore(flags); | ||
470 | |||
471 | t = fast_timer_list; | 371 | t = fast_timer_list; |
472 | while (t) | 372 | while (t) |
473 | { | 373 | { |
474 | struct timeval tv; | 374 | struct fasttime_t tv; |
375 | fast_timer_function_type *f; | ||
376 | unsigned long d; | ||
475 | 377 | ||
476 | /* Has it really expired? */ | 378 | /* Has it really expired? */ |
477 | do_gettimeofday_fast(&tv); | 379 | do_gettimeofday_fast(&tv); |
478 | D1(printk("t: %is %06ius\n", tv.tv_sec, tv.tv_usec)); | 380 | D1(printk(KERN_DEBUG "t: %is %06ius\n", |
381 | tv.tv_jiff, tv.tv_usec)); | ||
479 | 382 | ||
480 | if (timeval_cmp(&t->tv_expires, &tv) <= 0) | 383 | if (fasttime_cmp(&t->tv_expires, &tv) <= 0) |
481 | { | 384 | { |
482 | /* Yes it has expired */ | 385 | /* Yes it has expired */ |
483 | #ifdef FAST_TIMER_LOG | 386 | #ifdef FAST_TIMER_LOG |
@@ -486,7 +389,6 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
486 | fast_timers_expired++; | 389 | fast_timers_expired++; |
487 | 390 | ||
488 | /* Remove this timer before call, since it may reuse the timer */ | 391 | /* Remove this timer before call, since it may reuse the timer */ |
489 | local_irq_save(flags); | ||
490 | if (t->prev) | 392 | if (t->prev) |
491 | { | 393 | { |
492 | t->prev->next = t->next; | 394 | t->prev->next = t->next; |
@@ -501,16 +403,23 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
501 | } | 403 | } |
502 | t->prev = NULL; | 404 | t->prev = NULL; |
503 | t->next = NULL; | 405 | t->next = NULL; |
504 | local_irq_restore(flags); | ||
505 | 406 | ||
506 | if (t->function != NULL) | 407 | /* Save function callback data before enabling |
507 | { | 408 | * interrupts, since the timer may be removed and |
508 | t->function(t->data); | 409 | * we don't know how it was allocated |
509 | } | 410 | * (e.g. ->function and ->data may become overwritten |
510 | else | 411 | * after deletion if the timer was stack-allocated). |
511 | { | 412 | */ |
413 | f = t->function; | ||
414 | d = t->data; | ||
415 | |||
416 | if (f != NULL) { | ||
417 | /* Run callback with interrupts enabled. */ | ||
418 | local_irq_restore(flags); | ||
419 | f(d); | ||
420 | local_irq_save(flags); | ||
421 | } else | ||
512 | DEBUG_LOG("!timer1 %i function==NULL!\n", fast_timer_ints); | 422 | DEBUG_LOG("!timer1 %i function==NULL!\n", fast_timer_ints); |
513 | } | ||
514 | } | 423 | } |
515 | else | 424 | else |
516 | { | 425 | { |
@@ -518,16 +427,20 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
518 | D1(printk(".\n")); | 427 | D1(printk(".\n")); |
519 | } | 428 | } |
520 | 429 | ||
521 | local_irq_save(flags); | ||
522 | if ((t = fast_timer_list) != NULL) | 430 | if ((t = fast_timer_list) != NULL) |
523 | { | 431 | { |
524 | /* Start next timer.. */ | 432 | /* Start next timer.. */ |
525 | long us; | 433 | long us = 0; |
526 | struct timeval tv; | 434 | struct fasttime_t tv; |
527 | 435 | ||
528 | do_gettimeofday_fast(&tv); | 436 | do_gettimeofday_fast(&tv); |
529 | us = ((t->tv_expires.tv_sec - tv.tv_sec) * 1000000 + | 437 | |
530 | t->tv_expires.tv_usec - tv.tv_usec); | 438 | /* time_after_eq takes care of wrapping */ |
439 | if (time_after_eq(t->tv_expires.tv_jiff, tv.tv_jiff)) | ||
440 | us = ((t->tv_expires.tv_jiff - tv.tv_jiff) * | ||
441 | 1000000 / HZ + t->tv_expires.tv_usec - | ||
442 | tv.tv_usec); | ||
443 | |||
531 | if (us > 0) | 444 | if (us > 0) |
532 | { | 445 | { |
533 | if (!fast_timer_running) | 446 | if (!fast_timer_running) |
@@ -537,7 +450,6 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
537 | #endif | 450 | #endif |
538 | start_timer1(us); | 451 | start_timer1(us); |
539 | } | 452 | } |
540 | local_irq_restore(flags); | ||
541 | break; | 453 | break; |
542 | } | 454 | } |
543 | else | 455 | else |
@@ -548,9 +460,10 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
548 | D1(printk("e! %d\n", us)); | 460 | D1(printk("e! %d\n", us)); |
549 | } | 461 | } |
550 | } | 462 | } |
551 | local_irq_restore(flags); | ||
552 | } | 463 | } |
553 | 464 | ||
465 | local_irq_restore(flags); | ||
466 | |||
554 | if (!t) | 467 | if (!t) |
555 | { | 468 | { |
556 | D1(printk("t1 stop!\n")); | 469 | D1(printk("t1 stop!\n")); |
@@ -575,28 +488,17 @@ static void wake_up_func(unsigned long data) | |||
575 | void schedule_usleep(unsigned long us) | 488 | void schedule_usleep(unsigned long us) |
576 | { | 489 | { |
577 | struct fast_timer t; | 490 | struct fast_timer t; |
578 | #ifdef DECLARE_WAITQUEUE | ||
579 | wait_queue_head_t sleep_wait; | 491 | wait_queue_head_t sleep_wait; |
580 | init_waitqueue_head(&sleep_wait); | 492 | init_waitqueue_head(&sleep_wait); |
581 | { | ||
582 | DECLARE_WAITQUEUE(wait, current); | ||
583 | #else | ||
584 | struct wait_queue *sleep_wait = NULL; | ||
585 | struct wait_queue wait = { current, NULL }; | ||
586 | #endif | ||
587 | 493 | ||
588 | D1(printk("schedule_usleep(%d)\n", us)); | 494 | D1(printk("schedule_usleep(%d)\n", us)); |
589 | add_wait_queue(&sleep_wait, &wait); | ||
590 | set_current_state(TASK_INTERRUPTIBLE); | ||
591 | start_one_shot_timer(&t, wake_up_func, (unsigned long)&sleep_wait, us, | 495 | start_one_shot_timer(&t, wake_up_func, (unsigned long)&sleep_wait, us, |
592 | "usleep"); | 496 | "usleep"); |
593 | schedule(); | 497 | /* Uninterruptible sleep on the fast timer. (The condition is somewhat |
594 | set_current_state(TASK_RUNNING); | 498 | * redundant since the timer is what wakes us up.) */ |
595 | remove_wait_queue(&sleep_wait, &wait); | 499 | wait_event(sleep_wait, !fast_timer_pending(&t)); |
500 | |||
596 | D1(printk("done schedule_usleep(%d)\n", us)); | 501 | D1(printk("done schedule_usleep(%d)\n", us)); |
597 | #ifdef DECLARE_WAITQUEUE | ||
598 | } | ||
599 | #endif | ||
600 | } | 502 | } |
601 | 503 | ||
602 | #ifdef CONFIG_PROC_FS | 504 | #ifdef CONFIG_PROC_FS |
@@ -616,7 +518,7 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | |||
616 | unsigned long flags; | 518 | unsigned long flags; |
617 | int i = 0; | 519 | int i = 0; |
618 | int num_to_show; | 520 | int num_to_show; |
619 | struct timeval tv; | 521 | struct fasttime_t tv; |
620 | struct fast_timer *t, *nextt; | 522 | struct fast_timer *t, *nextt; |
621 | static char *bigbuf = NULL; | 523 | static char *bigbuf = NULL; |
622 | static unsigned long used; | 524 | static unsigned long used; |
@@ -624,7 +526,8 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | |||
624 | if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE))) | 526 | if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE))) |
625 | { | 527 | { |
626 | used = 0; | 528 | used = 0; |
627 | bigbuf[0] = '\0'; | 529 | if (buf) |
530 | buf[0] = '\0'; | ||
628 | return 0; | 531 | return 0; |
629 | } | 532 | } |
630 | 533 | ||
@@ -646,7 +549,7 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | |||
646 | used += sprintf(bigbuf + used, "Fast timer running: %s\n", | 549 | used += sprintf(bigbuf + used, "Fast timer running: %s\n", |
647 | fast_timer_running ? "yes" : "no"); | 550 | fast_timer_running ? "yes" : "no"); |
648 | used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n", | 551 | used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n", |
649 | (unsigned long)tv.tv_sec, | 552 | (unsigned long)tv.tv_jiff, |
650 | (unsigned long)tv.tv_usec); | 553 | (unsigned long)tv.tv_usec); |
651 | #ifdef FAST_TIMER_SANITY_CHECKS | 554 | #ifdef FAST_TIMER_SANITY_CHECKS |
652 | used += sprintf(bigbuf + used, "Sanity failed: %i\n", | 555 | used += sprintf(bigbuf + used, "Sanity failed: %i\n", |
@@ -696,9 +599,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | |||
696 | "d: %6li us data: 0x%08lX" | 599 | "d: %6li us data: 0x%08lX" |
697 | "\n", | 600 | "\n", |
698 | t->name, | 601 | t->name, |
699 | (unsigned long)t->tv_set.tv_sec, | 602 | (unsigned long)t->tv_set.tv_jiff, |
700 | (unsigned long)t->tv_set.tv_usec, | 603 | (unsigned long)t->tv_set.tv_usec, |
701 | (unsigned long)t->tv_expires.tv_sec, | 604 | (unsigned long)t->tv_expires.tv_jiff, |
702 | (unsigned long)t->tv_expires.tv_usec, | 605 | (unsigned long)t->tv_expires.tv_usec, |
703 | t->delay_us, | 606 | t->delay_us, |
704 | t->data | 607 | t->data |
@@ -718,9 +621,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | |||
718 | "d: %6li us data: 0x%08lX" | 621 | "d: %6li us data: 0x%08lX" |
719 | "\n", | 622 | "\n", |
720 | t->name, | 623 | t->name, |
721 | (unsigned long)t->tv_set.tv_sec, | 624 | (unsigned long)t->tv_set.tv_jiff, |
722 | (unsigned long)t->tv_set.tv_usec, | 625 | (unsigned long)t->tv_set.tv_usec, |
723 | (unsigned long)t->tv_expires.tv_sec, | 626 | (unsigned long)t->tv_expires.tv_jiff, |
724 | (unsigned long)t->tv_expires.tv_usec, | 627 | (unsigned long)t->tv_expires.tv_usec, |
725 | t->delay_us, | 628 | t->delay_us, |
726 | t->data | 629 | t->data |
@@ -738,9 +641,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | |||
738 | "d: %6li us data: 0x%08lX" | 641 | "d: %6li us data: 0x%08lX" |
739 | "\n", | 642 | "\n", |
740 | t->name, | 643 | t->name, |
741 | (unsigned long)t->tv_set.tv_sec, | 644 | (unsigned long)t->tv_set.tv_jiff, |
742 | (unsigned long)t->tv_set.tv_usec, | 645 | (unsigned long)t->tv_set.tv_usec, |
743 | (unsigned long)t->tv_expires.tv_sec, | 646 | (unsigned long)t->tv_expires.tv_jiff, |
744 | (unsigned long)t->tv_expires.tv_usec, | 647 | (unsigned long)t->tv_expires.tv_usec, |
745 | t->delay_us, | 648 | t->delay_us, |
746 | t->data | 649 | t->data |
@@ -761,15 +664,15 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | |||
761 | /* " func: 0x%08lX" */ | 664 | /* " func: 0x%08lX" */ |
762 | "\n", | 665 | "\n", |
763 | t->name, | 666 | t->name, |
764 | (unsigned long)t->tv_set.tv_sec, | 667 | (unsigned long)t->tv_set.tv_jiff, |
765 | (unsigned long)t->tv_set.tv_usec, | 668 | (unsigned long)t->tv_set.tv_usec, |
766 | (unsigned long)t->tv_expires.tv_sec, | 669 | (unsigned long)t->tv_expires.tv_jiff, |
767 | (unsigned long)t->tv_expires.tv_usec, | 670 | (unsigned long)t->tv_expires.tv_usec, |
768 | t->delay_us, | 671 | t->delay_us, |
769 | t->data | 672 | t->data |
770 | /* , t->function */ | 673 | /* , t->function */ |
771 | ); | 674 | ); |
772 | local_irq_disable(); | 675 | local_irq_save(flags); |
773 | if (t->next != nextt) | 676 | if (t->next != nextt) |
774 | { | 677 | { |
775 | printk(KERN_WARNING "timer removed!\n"); | 678 | printk(KERN_WARNING "timer removed!\n"); |
@@ -798,7 +701,7 @@ static volatile int num_test_timeout = 0; | |||
798 | static struct fast_timer tr[10]; | 701 | static struct fast_timer tr[10]; |
799 | static int exp_num[10]; | 702 | static int exp_num[10]; |
800 | 703 | ||
801 | static struct timeval tv_exp[100]; | 704 | static struct fasttime_t tv_exp[100]; |
802 | 705 | ||
803 | static void test_timeout(unsigned long data) | 706 | static void test_timeout(unsigned long data) |
804 | { | 707 | { |
@@ -836,7 +739,7 @@ static void fast_timer_test(void) | |||
836 | int prev_num; | 739 | int prev_num; |
837 | int j; | 740 | int j; |
838 | 741 | ||
839 | struct timeval tv, tv0, tv1, tv2; | 742 | struct fasttime_t tv, tv0, tv1, tv2; |
840 | 743 | ||
841 | printk("fast_timer_test() start\n"); | 744 | printk("fast_timer_test() start\n"); |
842 | do_gettimeofday_fast(&tv); | 745 | do_gettimeofday_fast(&tv); |
@@ -849,7 +752,8 @@ static void fast_timer_test(void) | |||
849 | { | 752 | { |
850 | do_gettimeofday_fast(&tv_exp[j]); | 753 | do_gettimeofday_fast(&tv_exp[j]); |
851 | } | 754 | } |
852 | printk("fast_timer_test() %is %06i\n", tv.tv_sec, tv.tv_usec); | 755 | printk(KERN_DEBUG "fast_timer_test() %is %06i\n", |
756 | tv.tv_jiff, tv.tv_usec); | ||
853 | 757 | ||
854 | for (j = 0; j < 1000; j++) | 758 | for (j = 0; j < 1000; j++) |
855 | { | 759 | { |
@@ -858,12 +762,12 @@ static void fast_timer_test(void) | |||
858 | } | 762 | } |
859 | for (j = 0; j < 100; j++) | 763 | for (j = 0; j < 100; j++) |
860 | { | 764 | { |
861 | printk("%i.%i %i.%i %i.%i %i.%i %i.%i\n", | 765 | printk(KERN_DEBUG "%i.%i %i.%i %i.%i %i.%i %i.%i\n", |
862 | tv_exp[j].tv_sec,tv_exp[j].tv_usec, | 766 | tv_exp[j].tv_jiff, tv_exp[j].tv_usec, |
863 | tv_exp[j+1].tv_sec,tv_exp[j+1].tv_usec, | 767 | tv_exp[j+1].tv_jiff, tv_exp[j+1].tv_usec, |
864 | tv_exp[j+2].tv_sec,tv_exp[j+2].tv_usec, | 768 | tv_exp[j+2].tv_jiff, tv_exp[j+2].tv_usec, |
865 | tv_exp[j+3].tv_sec,tv_exp[j+3].tv_usec, | 769 | tv_exp[j+3].tv_jiff, tv_exp[j+3].tv_usec, |
866 | tv_exp[j+4].tv_sec,tv_exp[j+4].tv_usec); | 770 | tv_exp[j+4].tv_jiff, tv_exp[j+4].tv_usec); |
867 | j += 4; | 771 | j += 4; |
868 | } | 772 | } |
869 | do_gettimeofday_fast(&tv0); | 773 | do_gettimeofday_fast(&tv0); |
@@ -895,9 +799,12 @@ static void fast_timer_test(void) | |||
895 | } | 799 | } |
896 | } | 800 | } |
897 | do_gettimeofday_fast(&tv2); | 801 | do_gettimeofday_fast(&tv2); |
898 | printk("Timers started %is %06i\n", tv0.tv_sec, tv0.tv_usec); | 802 | printk(KERN_DEBUG "Timers started %is %06i\n", |
899 | printk("Timers started at %is %06i\n", tv1.tv_sec, tv1.tv_usec); | 803 | tv0.tv_jiff, tv0.tv_usec); |
900 | printk("Timers done %is %06i\n", tv2.tv_sec, tv2.tv_usec); | 804 | printk(KERN_DEBUG "Timers started at %is %06i\n", |
805 | tv1.tv_jiff, tv1.tv_usec); | ||
806 | printk(KERN_DEBUG "Timers done %is %06i\n", | ||
807 | tv2.tv_jiff, tv2.tv_usec); | ||
901 | DP(printk("buf0:\n"); | 808 | DP(printk("buf0:\n"); |
902 | printk(buf0); | 809 | printk(buf0); |
903 | printk("buf1:\n"); | 810 | printk("buf1:\n"); |
@@ -919,9 +826,9 @@ static void fast_timer_test(void) | |||
919 | printk("%-10s set: %6is %06ius exp: %6is %06ius " | 826 | printk("%-10s set: %6is %06ius exp: %6is %06ius " |
920 | "data: 0x%08X func: 0x%08X\n", | 827 | "data: 0x%08X func: 0x%08X\n", |
921 | t->name, | 828 | t->name, |
922 | t->tv_set.tv_sec, | 829 | t->tv_set.tv_jiff, |
923 | t->tv_set.tv_usec, | 830 | t->tv_set.tv_usec, |
924 | t->tv_expires.tv_sec, | 831 | t->tv_expires.tv_jiff, |
925 | t->tv_expires.tv_usec, | 832 | t->tv_expires.tv_usec, |
926 | t->data, | 833 | t->data, |
927 | t->function | 834 | t->function |
@@ -929,10 +836,12 @@ static void fast_timer_test(void) | |||
929 | 836 | ||
930 | printk(" del: %6ius did exp: %6is %06ius as #%i error: %6li\n", | 837 | printk(" del: %6ius did exp: %6is %06ius as #%i error: %6li\n", |
931 | t->delay_us, | 838 | t->delay_us, |
932 | tv_exp[j].tv_sec, | 839 | tv_exp[j].tv_jiff, |
933 | tv_exp[j].tv_usec, | 840 | tv_exp[j].tv_usec, |
934 | exp_num[j], | 841 | exp_num[j], |
935 | (tv_exp[j].tv_sec - t->tv_expires.tv_sec)*1000000 + tv_exp[j].tv_usec - t->tv_expires.tv_usec); | 842 | (tv_exp[j].tv_jiff - t->tv_expires.tv_jiff) * |
843 | 1000000 + tv_exp[j].tv_usec - | ||
844 | t->tv_expires.tv_usec); | ||
936 | } | 845 | } |
937 | proc_fasttimer_read(buf5, NULL, 0, 0, 0); | 846 | proc_fasttimer_read(buf5, NULL, 0, 0, 0); |
938 | printk("buf5 after all done:\n"); | 847 | printk("buf5 after all done:\n"); |
@@ -942,7 +851,7 @@ static void fast_timer_test(void) | |||
942 | #endif | 851 | #endif |
943 | 852 | ||
944 | 853 | ||
945 | void fast_timer_init(void) | 854 | int fast_timer_init(void) |
946 | { | 855 | { |
947 | /* For some reason, request_irq() hangs when called froom time_init() */ | 856 | /* For some reason, request_irq() hangs when called froom time_init() */ |
948 | if (!fast_timer_is_init) | 857 | if (!fast_timer_is_init) |
@@ -975,4 +884,6 @@ void fast_timer_init(void) | |||
975 | fast_timer_test(); | 884 | fast_timer_test(); |
976 | #endif | 885 | #endif |
977 | } | 886 | } |
887 | return 0; | ||
978 | } | 888 | } |
889 | __initcall(fast_timer_init); | ||
diff --git a/arch/cris/arch-v10/kernel/io_interface_mux.c b/arch/cris/arch-v10/kernel/io_interface_mux.c index 29d48ad00df9..3a9114e89edf 100644 --- a/arch/cris/arch-v10/kernel/io_interface_mux.c +++ b/arch/cris/arch-v10/kernel/io_interface_mux.c | |||
@@ -304,7 +304,7 @@ static unsigned char clear_group_from_set(const unsigned char groups, struct if_ | |||
304 | static struct if_group *get_group(const unsigned char groups) | 304 | static struct if_group *get_group(const unsigned char groups) |
305 | { | 305 | { |
306 | int i; | 306 | int i; |
307 | for (i = 0; i < sizeof(if_groups)/sizeof(struct if_group); i++) { | 307 | for (i = 0; i < ARRAY_SIZE(if_groups); i++) { |
308 | if (groups & if_groups[i].group) { | 308 | if (groups & if_groups[i].group) { |
309 | return &if_groups[i]; | 309 | return &if_groups[i]; |
310 | } | 310 | } |
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c index 845c95f6e871..e06ab0050d37 100644 --- a/arch/cris/arch-v10/kernel/irq.c +++ b/arch/cris/arch-v10/kernel/irq.c | |||
@@ -12,10 +12,16 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <asm/irq.h> | 14 | #include <asm/irq.h> |
15 | #include <asm/current.h> | ||
15 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
17 | #include <linux/interrupt.h> | ||
16 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 19 | #include <linux/init.h> |
18 | 20 | ||
21 | /* From kgdb.c. */ | ||
22 | extern void kgdb_init(void); | ||
23 | extern void breakpoint(void); | ||
24 | |||
19 | #define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr)); | 25 | #define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr)); |
20 | #define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr)); | 26 | #define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr)); |
21 | 27 | ||
@@ -75,8 +81,8 @@ BUILD_IRQ(12, 0x1000) | |||
75 | BUILD_IRQ(13, 0x2000) | 81 | BUILD_IRQ(13, 0x2000) |
76 | void mmu_bus_fault(void); /* IRQ 14 is the bus fault interrupt */ | 82 | void mmu_bus_fault(void); /* IRQ 14 is the bus fault interrupt */ |
77 | void multiple_interrupt(void); /* IRQ 15 is the multiple IRQ interrupt */ | 83 | void multiple_interrupt(void); /* IRQ 15 is the multiple IRQ interrupt */ |
78 | BUILD_IRQ(16, 0x10000) | 84 | BUILD_IRQ(16, 0x10000 | 0x20000) /* ethernet tx interrupt needs to block rx */ |
79 | BUILD_IRQ(17, 0x20000) | 85 | BUILD_IRQ(17, 0x20000 | 0x10000) /* ...and vice versa */ |
80 | BUILD_IRQ(18, 0x40000) | 86 | BUILD_IRQ(18, 0x40000) |
81 | BUILD_IRQ(19, 0x80000) | 87 | BUILD_IRQ(19, 0x80000) |
82 | BUILD_IRQ(20, 0x100000) | 88 | BUILD_IRQ(20, 0x100000) |
@@ -147,6 +153,55 @@ void system_call(void); /* from entry.S */ | |||
147 | void do_sigtrap(void); /* from entry.S */ | 153 | void do_sigtrap(void); /* from entry.S */ |
148 | void gdb_handle_breakpoint(void); /* from entry.S */ | 154 | void gdb_handle_breakpoint(void); /* from entry.S */ |
149 | 155 | ||
156 | extern void do_IRQ(int irq, struct pt_regs * regs); | ||
157 | |||
158 | /* Handle multiple IRQs */ | ||
159 | void do_multiple_IRQ(struct pt_regs* regs) | ||
160 | { | ||
161 | int bit; | ||
162 | unsigned masked; | ||
163 | unsigned mask; | ||
164 | unsigned ethmask = 0; | ||
165 | |||
166 | /* Get interrupts to mask and handle */ | ||
167 | mask = masked = *R_VECT_MASK_RD; | ||
168 | |||
169 | /* Never mask timer IRQ */ | ||
170 | mask &= ~(IO_MASK(R_VECT_MASK_RD, timer0)); | ||
171 | |||
172 | /* | ||
173 | * If either ethernet interrupt (rx or tx) is active then block | ||
174 | * the other one too. Unblock afterwards also. | ||
175 | */ | ||
176 | if (mask & | ||
177 | (IO_STATE(R_VECT_MASK_RD, dma0, active) | | ||
178 | IO_STATE(R_VECT_MASK_RD, dma1, active))) { | ||
179 | ethmask = (IO_MASK(R_VECT_MASK_RD, dma0) | | ||
180 | IO_MASK(R_VECT_MASK_RD, dma1)); | ||
181 | } | ||
182 | |||
183 | /* Block them */ | ||
184 | *R_VECT_MASK_CLR = (mask | ethmask); | ||
185 | |||
186 | /* An extra irq_enter here to prevent softIRQs to run after | ||
187 | * each do_IRQ. This will decrease the interrupt latency. | ||
188 | */ | ||
189 | irq_enter(); | ||
190 | |||
191 | /* Handle all IRQs */ | ||
192 | for (bit = 2; bit < 32; bit++) { | ||
193 | if (masked & (1 << bit)) { | ||
194 | do_IRQ(bit, regs); | ||
195 | } | ||
196 | } | ||
197 | |||
198 | /* This irq_exit() will trigger the soft IRQs. */ | ||
199 | irq_exit(); | ||
200 | |||
201 | /* Unblock the IRQs again */ | ||
202 | *R_VECT_MASK_SET = (masked | ethmask); | ||
203 | } | ||
204 | |||
150 | /* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and | 205 | /* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and |
151 | setting the irq vector table. | 206 | setting the irq vector table. |
152 | */ | 207 | */ |
diff --git a/arch/cris/arch-v10/kernel/setup.c b/arch/cris/arch-v10/kernel/setup.c index 682ef955aec4..de27b50b72a2 100644 --- a/arch/cris/arch-v10/kernel/setup.c +++ b/arch/cris/arch-v10/kernel/setup.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/seq_file.h> | 13 | #include <linux/seq_file.h> |
14 | #include <linux/proc_fs.h> | 14 | #include <linux/proc_fs.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/param.h> | ||
16 | 17 | ||
17 | #ifdef CONFIG_PROC_FS | 18 | #ifdef CONFIG_PROC_FS |
18 | #define HAS_FPU 0x0001 | 19 | #define HAS_FPU 0x0001 |
@@ -56,8 +57,8 @@ int show_cpuinfo(struct seq_file *m, void *v) | |||
56 | 57 | ||
57 | revision = rdvr(); | 58 | revision = rdvr(); |
58 | 59 | ||
59 | if (revision >= sizeof cpu_info/sizeof *cpu_info) | 60 | if (revision >= ARRAY_SIZE(cpu_info)) |
60 | info = &cpu_info[sizeof cpu_info/sizeof *cpu_info - 1]; | 61 | info = &cpu_info[ARRAY_SIZE(cpu_info) - 1]; |
61 | else | 62 | else |
62 | info = &cpu_info[revision]; | 63 | info = &cpu_info[revision]; |
63 | 64 | ||
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c index 575a14bb1106..5976f6199c47 100644 --- a/arch/cris/arch-v10/kernel/time.c +++ b/arch/cris/arch-v10/kernel/time.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* $Id: time.c,v 1.5 2004/09/29 06:12:46 starvik Exp $ | 1 | /* |
2 | * | ||
3 | * linux/arch/cris/arch-v10/kernel/time.c | 2 | * linux/arch/cris/arch-v10/kernel/time.c |
4 | * | 3 | * |
5 | * Copyright (C) 1991, 1992, 1995 Linus Torvalds | 4 | * Copyright (C) 1991, 1992, 1995 Linus Torvalds |
@@ -20,6 +19,7 @@ | |||
20 | #include <asm/io.h> | 19 | #include <asm/io.h> |
21 | #include <asm/delay.h> | 20 | #include <asm/delay.h> |
22 | #include <asm/rtc.h> | 21 | #include <asm/rtc.h> |
22 | #include <asm/irq_regs.h> | ||
23 | 23 | ||
24 | /* define this if you need to use print_timestamp */ | 24 | /* define this if you need to use print_timestamp */ |
25 | /* it will make jiffies at 96 hz instead of 100 hz though */ | 25 | /* it will make jiffies at 96 hz instead of 100 hz though */ |
@@ -201,8 +201,9 @@ static long last_rtc_update = 0; | |||
201 | extern void cris_do_profile(struct pt_regs *regs); | 201 | extern void cris_do_profile(struct pt_regs *regs); |
202 | 202 | ||
203 | static inline irqreturn_t | 203 | static inline irqreturn_t |
204 | timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 204 | timer_interrupt(int irq, void *dev_id) |
205 | { | 205 | { |
206 | struct pt_regs *regs = get_irq_regs(); | ||
206 | /* acknowledge the timer irq */ | 207 | /* acknowledge the timer irq */ |
207 | 208 | ||
208 | #ifdef USE_CASCADE_TIMERS | 209 | #ifdef USE_CASCADE_TIMERS |
@@ -221,9 +222,11 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
221 | #endif | 222 | #endif |
222 | 223 | ||
223 | /* reset watchdog otherwise it resets us! */ | 224 | /* reset watchdog otherwise it resets us! */ |
224 | |||
225 | reset_watchdog(); | 225 | reset_watchdog(); |
226 | 226 | ||
227 | /* Update statistics. */ | ||
228 | update_process_times(user_mode(regs)); | ||
229 | |||
227 | /* call the real timer interrupt handler */ | 230 | /* call the real timer interrupt handler */ |
228 | 231 | ||
229 | do_timer(1); | 232 | do_timer(1); |
diff --git a/arch/cris/arch-v10/lib/memset.c b/arch/cris/arch-v10/lib/memset.c index 82bb66839171..42c1101043a3 100644 --- a/arch/cris/arch-v10/lib/memset.c +++ b/arch/cris/arch-v10/lib/memset.c | |||
@@ -66,7 +66,7 @@ void *memset(void *pdst, | |||
66 | 66 | ||
67 | { | 67 | { |
68 | register char *dst __asm__ ("r13") = pdst; | 68 | register char *dst __asm__ ("r13") = pdst; |
69 | 69 | ||
70 | /* This is NONPORTABLE, but since this whole routine is */ | 70 | /* This is NONPORTABLE, but since this whole routine is */ |
71 | /* grossly nonportable that doesn't matter. */ | 71 | /* grossly nonportable that doesn't matter. */ |
72 | 72 | ||
@@ -110,52 +110,52 @@ void *memset(void *pdst, | |||
110 | If you want to check that the allocation was right; then | 110 | If you want to check that the allocation was right; then |
111 | check the equalities in the first comment. It should say | 111 | check the equalities in the first comment. It should say |
112 | "r13=r13, r12=r12, r11=r11" */ | 112 | "r13=r13, r12=r12, r11=r11" */ |
113 | __asm__ volatile (" | 113 | __asm__ volatile ("\n\ |
114 | ;; Check that the following is true (same register names on | 114 | ;; Check that the following is true (same register names on \n\ |
115 | ;; both sides of equal sign, as in r8=r8): | 115 | ;; both sides of equal sign, as in r8=r8): \n\ |
116 | ;; %0=r13, %1=r12, %4=r11 | 116 | ;; %0=r13, %1=r12, %4=r11 \n\ |
117 | ;; | 117 | ;; \n\ |
118 | ;; Save the registers we'll clobber in the movem process | 118 | ;; Save the registers we'll clobber in the movem process \n\ |
119 | ;; on the stack. Don't mention them to gcc, it will only be | 119 | ;; on the stack. Don't mention them to gcc, it will only be \n\ |
120 | ;; upset. | 120 | ;; upset. \n\ |
121 | subq 11*4,$sp | 121 | subq 11*4,$sp \n\ |
122 | movem $r10,[$sp] | 122 | movem $r10,[$sp] \n\ |
123 | 123 | \n\ | |
124 | move.d $r11,$r0 | 124 | move.d $r11,$r0 \n\ |
125 | move.d $r11,$r1 | 125 | move.d $r11,$r1 \n\ |
126 | move.d $r11,$r2 | 126 | move.d $r11,$r2 \n\ |
127 | move.d $r11,$r3 | 127 | move.d $r11,$r3 \n\ |
128 | move.d $r11,$r4 | 128 | move.d $r11,$r4 \n\ |
129 | move.d $r11,$r5 | 129 | move.d $r11,$r5 \n\ |
130 | move.d $r11,$r6 | 130 | move.d $r11,$r6 \n\ |
131 | move.d $r11,$r7 | 131 | move.d $r11,$r7 \n\ |
132 | move.d $r11,$r8 | 132 | move.d $r11,$r8 \n\ |
133 | move.d $r11,$r9 | 133 | move.d $r11,$r9 \n\ |
134 | move.d $r11,$r10 | 134 | move.d $r11,$r10 \n\ |
135 | 135 | \n\ | |
136 | ;; Now we've got this: | 136 | ;; Now we've got this: \n\ |
137 | ;; r13 - dst | 137 | ;; r13 - dst \n\ |
138 | ;; r12 - n | 138 | ;; r12 - n \n\ |
139 | 139 | \n\ | |
140 | ;; Update n for the first loop | 140 | ;; Update n for the first loop \n\ |
141 | subq 12*4,$r12 | 141 | subq 12*4,$r12 \n\ |
142 | 0: | 142 | 0: \n\ |
143 | subq 12*4,$r12 | 143 | subq 12*4,$r12 \n\ |
144 | bge 0b | 144 | bge 0b \n\ |
145 | movem $r11,[$r13+] | 145 | movem $r11,[$r13+] \n\ |
146 | 146 | \n\ | |
147 | addq 12*4,$r12 ;; compensate for last loop underflowing n | 147 | addq 12*4,$r12 ;; compensate for last loop underflowing n \n\ |
148 | 148 | \n\ | |
149 | ;; Restore registers from stack | 149 | ;; Restore registers from stack \n\ |
150 | movem [$sp+],$r10" | 150 | movem [$sp+],$r10" |
151 | 151 | ||
152 | /* Outputs */ : "=r" (dst), "=r" (n) | 152 | /* Outputs */ : "=r" (dst), "=r" (n) |
153 | /* Inputs */ : "0" (dst), "1" (n), "r" (lc)); | 153 | /* Inputs */ : "0" (dst), "1" (n), "r" (lc)); |
154 | 154 | ||
155 | } | 155 | } |
156 | 156 | ||
157 | /* Either we directly starts copying, using dword copying | 157 | /* Either we directly starts copying, using dword copying |
158 | in a loop, or we copy as much as possible with 'movem' | 158 | in a loop, or we copy as much as possible with 'movem' |
159 | and then the last block (<44 bytes) is copied here. | 159 | and then the last block (<44 bytes) is copied here. |
160 | This will work since 'movem' will have updated src,dst,n. */ | 160 | This will work since 'movem' will have updated src,dst,n. */ |
161 | 161 | ||
diff --git a/arch/cris/arch-v10/lib/string.c b/arch/cris/arch-v10/lib/string.c index 15d6662b03b1..7161a2bef4fe 100644 --- a/arch/cris/arch-v10/lib/string.c +++ b/arch/cris/arch-v10/lib/string.c | |||
@@ -95,33 +95,33 @@ void *memcpy(void *pdst, | |||
95 | If you want to check that the allocation was right; then | 95 | If you want to check that the allocation was right; then |
96 | check the equalities in the first comment. It should say | 96 | check the equalities in the first comment. It should say |
97 | "r13=r13, r11=r11, r12=r12" */ | 97 | "r13=r13, r11=r11, r12=r12" */ |
98 | __asm__ volatile (" | 98 | __asm__ volatile ("\n\ |
99 | ;; Check that the following is true (same register names on | 99 | ;; Check that the following is true (same register names on \n\ |
100 | ;; both sides of equal sign, as in r8=r8): | 100 | ;; both sides of equal sign, as in r8=r8): \n\ |
101 | ;; %0=r13, %1=r11, %2=r12 | 101 | ;; %0=r13, %1=r11, %2=r12 \n\ |
102 | ;; | 102 | ;; \n\ |
103 | ;; Save the registers we'll use in the movem process | 103 | ;; Save the registers we'll use in the movem process \n\ |
104 | ;; on the stack. | 104 | ;; on the stack. \n\ |
105 | subq 11*4,$sp | 105 | subq 11*4,$sp \n\ |
106 | movem $r10,[$sp] | 106 | movem $r10,[$sp] \n\ |
107 | 107 | \n\ | |
108 | ;; Now we've got this: | 108 | ;; Now we've got this: \n\ |
109 | ;; r11 - src | 109 | ;; r11 - src \n\ |
110 | ;; r13 - dst | 110 | ;; r13 - dst \n\ |
111 | ;; r12 - n | 111 | ;; r12 - n \n\ |
112 | 112 | \n\ | |
113 | ;; Update n for the first loop | 113 | ;; Update n for the first loop \n\ |
114 | subq 44,$r12 | 114 | subq 44,$r12 \n\ |
115 | 0: | 115 | 0: \n\ |
116 | movem [$r11+],$r10 | 116 | movem [$r11+],$r10 \n\ |
117 | subq 44,$r12 | 117 | subq 44,$r12 \n\ |
118 | bge 0b | 118 | bge 0b \n\ |
119 | movem $r10,[$r13+] | 119 | movem $r10,[$r13+] \n\ |
120 | 120 | \n\ | |
121 | addq 44,$r12 ;; compensate for last loop underflowing n | 121 | addq 44,$r12 ;; compensate for last loop underflowing n \n\ |
122 | 122 | \n\ | |
123 | ;; Restore registers from stack | 123 | ;; Restore registers from stack \n\ |
124 | movem [$sp+],$r10" | 124 | movem [$sp+],$r10" |
125 | 125 | ||
126 | /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n) | 126 | /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n) |
127 | /* Inputs */ : "0" (dst), "1" (src), "2" (n)); | 127 | /* Inputs */ : "0" (dst), "1" (src), "2" (n)); |
diff --git a/arch/cris/arch-v10/lib/usercopy.c b/arch/cris/arch-v10/lib/usercopy.c index a12c708afc9a..b8e6c0430e5b 100644 --- a/arch/cris/arch-v10/lib/usercopy.c +++ b/arch/cris/arch-v10/lib/usercopy.c | |||
@@ -92,58 +92,58 @@ __copy_user (void __user *pdst, const void *psrc, unsigned long pn) | |||
92 | .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\ | 92 | .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\ |
93 | .err \n\ | 93 | .err \n\ |
94 | .endif \n\ | 94 | .endif \n\ |
95 | 95 | \n\ | |
96 | ;; Save the registers we'll use in the movem process | 96 | ;; Save the registers we'll use in the movem process \n\ |
97 | ;; on the stack. | 97 | ;; on the stack. \n\ |
98 | subq 11*4,$sp | 98 | subq 11*4,$sp \n\ |
99 | movem $r10,[$sp] | 99 | movem $r10,[$sp] \n\ |
100 | 100 | \n\ | |
101 | ;; Now we've got this: | 101 | ;; Now we've got this: \n\ |
102 | ;; r11 - src | 102 | ;; r11 - src \n\ |
103 | ;; r13 - dst | 103 | ;; r13 - dst \n\ |
104 | ;; r12 - n | 104 | ;; r12 - n \n\ |
105 | 105 | \n\ | |
106 | ;; Update n for the first loop | 106 | ;; Update n for the first loop \n\ |
107 | subq 44,$r12 | 107 | subq 44,$r12 \n\ |
108 | 108 | \n\ | |
109 | ; Since the noted PC of a faulting instruction in a delay-slot of a taken | 109 | ; Since the noted PC of a faulting instruction in a delay-slot of a taken \n\ |
110 | ; branch, is that of the branch target, we actually point at the from-movem | 110 | ; branch, is that of the branch target, we actually point at the from-movem \n\ |
111 | ; for this case. There is no ambiguity here; if there was a fault in that | 111 | ; for this case. There is no ambiguity here; if there was a fault in that \n\ |
112 | ; instruction (meaning a kernel oops), the faulted PC would be the address | 112 | ; instruction (meaning a kernel oops), the faulted PC would be the address \n\ |
113 | ; after *that* movem. | 113 | ; after *that* movem. \n\ |
114 | 114 | \n\ | |
115 | 0: | 115 | 0: \n\ |
116 | movem [$r11+],$r10 | 116 | movem [$r11+],$r10 \n\ |
117 | subq 44,$r12 | 117 | subq 44,$r12 \n\ |
118 | bge 0b | 118 | bge 0b \n\ |
119 | movem $r10,[$r13+] | 119 | movem $r10,[$r13+] \n\ |
120 | 1: | 120 | 1: \n\ |
121 | addq 44,$r12 ;; compensate for last loop underflowing n | 121 | addq 44,$r12 ;; compensate for last loop underflowing n \n\ |
122 | 122 | \n\ | |
123 | ;; Restore registers from stack | 123 | ;; Restore registers from stack \n\ |
124 | movem [$sp+],$r10 | 124 | movem [$sp+],$r10 \n\ |
125 | 2: | 125 | 2: \n\ |
126 | .section .fixup,\"ax\" | 126 | .section .fixup,\"ax\" \n\ |
127 | 127 | \n\ | |
128 | ; To provide a correct count in r10 of bytes that failed to be copied, | 128 | ; To provide a correct count in r10 of bytes that failed to be copied, \n\ |
129 | ; we jump back into the loop if the loop-branch was taken. There is no | 129 | ; we jump back into the loop if the loop-branch was taken. There is no \n\ |
130 | ; performance penalty for sany use; the program will segfault soon enough. | 130 | ; performance penalty for sany use; the program will segfault soon enough.\n\ |
131 | 131 | \n\ | |
132 | 3: | 132 | 3: \n\ |
133 | move.d [$sp],$r10 | 133 | move.d [$sp],$r10 \n\ |
134 | addq 44,$r10 | 134 | addq 44,$r10 \n\ |
135 | move.d $r10,[$sp] | 135 | move.d $r10,[$sp] \n\ |
136 | jump 0b | 136 | jump 0b \n\ |
137 | 4: | 137 | 4: \n\ |
138 | movem [$sp+],$r10 | 138 | movem [$sp+],$r10 \n\ |
139 | addq 44,$r10 | 139 | addq 44,$r10 \n\ |
140 | addq 44,$r12 | 140 | addq 44,$r12 \n\ |
141 | jump 2b | 141 | jump 2b \n\ |
142 | 142 | \n\ | |
143 | .previous | 143 | .previous \n\ |
144 | .section __ex_table,\"a\" | 144 | .section __ex_table,\"a\" \n\ |
145 | .dword 0b,3b | 145 | .dword 0b,3b \n\ |
146 | .dword 1b,4b | 146 | .dword 1b,4b \n\ |
147 | .previous" | 147 | .previous" |
148 | 148 | ||
149 | /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn) | 149 | /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn) |
@@ -253,59 +253,59 @@ __copy_user_zeroing (void __user *pdst, const void *psrc, unsigned long pn) | |||
253 | If you want to check that the allocation was right; then | 253 | If you want to check that the allocation was right; then |
254 | check the equalities in the first comment. It should say | 254 | check the equalities in the first comment. It should say |
255 | "r13=r13, r11=r11, r12=r12" */ | 255 | "r13=r13, r11=r11, r12=r12" */ |
256 | __asm__ volatile (" | 256 | __asm__ volatile ("\n\ |
257 | .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\ | 257 | .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\ |
258 | .err \n\ | 258 | .err \n\ |
259 | .endif \n\ | 259 | .endif \n\ |
260 | 260 | \n\ | |
261 | ;; Save the registers we'll use in the movem process | 261 | ;; Save the registers we'll use in the movem process \n\ |
262 | ;; on the stack. | 262 | ;; on the stack. \n\ |
263 | subq 11*4,$sp | 263 | subq 11*4,$sp \n\ |
264 | movem $r10,[$sp] | 264 | movem $r10,[$sp] \n\ |
265 | 265 | \n\ | |
266 | ;; Now we've got this: | 266 | ;; Now we've got this: \n\ |
267 | ;; r11 - src | 267 | ;; r11 - src \n\ |
268 | ;; r13 - dst | 268 | ;; r13 - dst \n\ |
269 | ;; r12 - n | 269 | ;; r12 - n \n\ |
270 | 270 | \n\ | |
271 | ;; Update n for the first loop | 271 | ;; Update n for the first loop \n\ |
272 | subq 44,$r12 | 272 | subq 44,$r12 \n\ |
273 | 0: | 273 | 0: \n\ |
274 | movem [$r11+],$r10 | 274 | movem [$r11+],$r10 \n\ |
275 | 1: | 275 | 1: \n\ |
276 | subq 44,$r12 | 276 | subq 44,$r12 \n\ |
277 | bge 0b | 277 | bge 0b \n\ |
278 | movem $r10,[$r13+] | 278 | movem $r10,[$r13+] \n\ |
279 | 279 | \n\ | |
280 | addq 44,$r12 ;; compensate for last loop underflowing n | 280 | addq 44,$r12 ;; compensate for last loop underflowing n \n\ |
281 | 281 | \n\ | |
282 | ;; Restore registers from stack | 282 | ;; Restore registers from stack \n\ |
283 | movem [$sp+],$r10 | 283 | movem [$sp+],$r10 \n\ |
284 | 4: | 284 | 4: \n\ |
285 | .section .fixup,\"ax\" | 285 | .section .fixup,\"ax\" \n\ |
286 | 286 | \n\ | |
287 | ;; Do not jump back into the loop if we fail. For some uses, we get a | 287 | ;; Do not jump back into the loop if we fail. For some uses, we get a \n\ |
288 | ;; page fault somewhere on the line. Without checking for page limits, | 288 | ;; page fault somewhere on the line. Without checking for page limits, \n\ |
289 | ;; we don't know where, but we need to copy accurately and keep an | 289 | ;; we don't know where, but we need to copy accurately and keep an \n\ |
290 | ;; accurate count; not just clear the whole line. To do that, we fall | 290 | ;; accurate count; not just clear the whole line. To do that, we fall \n\ |
291 | ;; down in the code below, proceeding with smaller amounts. It should | 291 | ;; down in the code below, proceeding with smaller amounts. It should \n\ |
292 | ;; be kept in mind that we have to cater to code like what at one time | 292 | ;; be kept in mind that we have to cater to code like what at one time \n\ |
293 | ;; was in fs/super.c: | 293 | ;; was in fs/super.c: \n\ |
294 | ;; i = size - copy_from_user((void *)page, data, size); | 294 | ;; i = size - copy_from_user((void *)page, data, size); \n\ |
295 | ;; which would cause repeated faults while clearing the remainder of | 295 | ;; which would cause repeated faults while clearing the remainder of \n\ |
296 | ;; the SIZE bytes at PAGE after the first fault. | 296 | ;; the SIZE bytes at PAGE after the first fault. \n\ |
297 | ;; A caveat here is that we must not fall through from a failing page | 297 | ;; A caveat here is that we must not fall through from a failing page \n\ |
298 | ;; to a valid page. | 298 | ;; to a valid page. \n\ |
299 | 299 | \n\ | |
300 | 3: | 300 | 3: \n\ |
301 | movem [$sp+],$r10 | 301 | movem [$sp+],$r10 \n\ |
302 | addq 44,$r12 ;; Get back count before faulting point. | 302 | addq 44,$r12 ;; Get back count before faulting point. \n\ |
303 | subq 44,$r11 ;; Get back pointer to faulting movem-line. | 303 | subq 44,$r11 ;; Get back pointer to faulting movem-line. \n\ |
304 | jump 4b ;; Fall through, pretending the fault didn't happen. | 304 | jump 4b ;; Fall through, pretending the fault didn't happen.\n\ |
305 | 305 | \n\ | |
306 | .previous | 306 | .previous \n\ |
307 | .section __ex_table,\"a\" | 307 | .section __ex_table,\"a\" \n\ |
308 | .dword 1b,3b | 308 | .dword 1b,3b \n\ |
309 | .previous" | 309 | .previous" |
310 | 310 | ||
311 | /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn) | 311 | /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn) |
@@ -425,64 +425,64 @@ __do_clear_user (void __user *pto, unsigned long pn) | |||
425 | If you want to check that the allocation was right; then | 425 | If you want to check that the allocation was right; then |
426 | check the equalities in the first comment. It should say | 426 | check the equalities in the first comment. It should say |
427 | something like "r13=r13, r11=r11, r12=r12". */ | 427 | something like "r13=r13, r11=r11, r12=r12". */ |
428 | __asm__ volatile (" | 428 | __asm__ volatile ("\n\ |
429 | .ifnc %0%1%2,$r13$r12$r10 \n\ | 429 | .ifnc %0%1%2,$r13$r12$r10 \n\ |
430 | .err \n\ | 430 | .err \n\ |
431 | .endif \n\ | 431 | .endif \n\ |
432 | 432 | \n\ | |
433 | ;; Save the registers we'll clobber in the movem process | 433 | ;; Save the registers we'll clobber in the movem process \n\ |
434 | ;; on the stack. Don't mention them to gcc, it will only be | 434 | ;; on the stack. Don't mention them to gcc, it will only be \n\ |
435 | ;; upset. | 435 | ;; upset. \n\ |
436 | subq 11*4,$sp | 436 | subq 11*4,$sp \n\ |
437 | movem $r10,[$sp] | 437 | movem $r10,[$sp] \n\ |
438 | 438 | \n\ | |
439 | clear.d $r0 | 439 | clear.d $r0 \n\ |
440 | clear.d $r1 | 440 | clear.d $r1 \n\ |
441 | clear.d $r2 | 441 | clear.d $r2 \n\ |
442 | clear.d $r3 | 442 | clear.d $r3 \n\ |
443 | clear.d $r4 | 443 | clear.d $r4 \n\ |
444 | clear.d $r5 | 444 | clear.d $r5 \n\ |
445 | clear.d $r6 | 445 | clear.d $r6 \n\ |
446 | clear.d $r7 | 446 | clear.d $r7 \n\ |
447 | clear.d $r8 | 447 | clear.d $r8 \n\ |
448 | clear.d $r9 | 448 | clear.d $r9 \n\ |
449 | clear.d $r10 | 449 | clear.d $r10 \n\ |
450 | clear.d $r11 | 450 | clear.d $r11 \n\ |
451 | 451 | \n\ | |
452 | ;; Now we've got this: | 452 | ;; Now we've got this: \n\ |
453 | ;; r13 - dst | 453 | ;; r13 - dst \n\ |
454 | ;; r12 - n | 454 | ;; r12 - n \n\ |
455 | 455 | \n\ | |
456 | ;; Update n for the first loop | 456 | ;; Update n for the first loop \n\ |
457 | subq 12*4,$r12 | 457 | subq 12*4,$r12 \n\ |
458 | 0: | 458 | 0: \n\ |
459 | subq 12*4,$r12 | 459 | subq 12*4,$r12 \n\ |
460 | bge 0b | 460 | bge 0b \n\ |
461 | movem $r11,[$r13+] | 461 | movem $r11,[$r13+] \n\ |
462 | 1: | 462 | 1: \n\ |
463 | addq 12*4,$r12 ;; compensate for last loop underflowing n | 463 | addq 12*4,$r12 ;; compensate for last loop underflowing n\n\ |
464 | 464 | \n\ | |
465 | ;; Restore registers from stack | 465 | ;; Restore registers from stack \n\ |
466 | movem [$sp+],$r10 | 466 | movem [$sp+],$r10 \n\ |
467 | 2: | 467 | 2: \n\ |
468 | .section .fixup,\"ax\" | 468 | .section .fixup,\"ax\" \n\ |
469 | 3: | 469 | 3: \n\ |
470 | move.d [$sp],$r10 | 470 | move.d [$sp],$r10 \n\ |
471 | addq 12*4,$r10 | 471 | addq 12*4,$r10 \n\ |
472 | move.d $r10,[$sp] | 472 | move.d $r10,[$sp] \n\ |
473 | clear.d $r10 | 473 | clear.d $r10 \n\ |
474 | jump 0b | 474 | jump 0b \n\ |
475 | 475 | \n\ | |
476 | 4: | 476 | 4: \n\ |
477 | movem [$sp+],$r10 | 477 | movem [$sp+],$r10 \n\ |
478 | addq 12*4,$r10 | 478 | addq 12*4,$r10 \n\ |
479 | addq 12*4,$r12 | 479 | addq 12*4,$r12 \n\ |
480 | jump 2b | 480 | jump 2b \n\ |
481 | 481 | \n\ | |
482 | .previous | 482 | .previous \n\ |
483 | .section __ex_table,\"a\" | 483 | .section __ex_table,\"a\" \n\ |
484 | .dword 0b,3b | 484 | .dword 0b,3b \n\ |
485 | .dword 1b,4b | 485 | .dword 1b,4b \n\ |
486 | .previous" | 486 | .previous" |
487 | 487 | ||
488 | /* Outputs */ : "=r" (dst), "=r" (n), "=r" (retn) | 488 | /* Outputs */ : "=r" (dst), "=r" (n), "=r" (retn) |
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig index cc6ba5423754..7f72d7c9e1ce 100644 --- a/arch/cris/arch-v32/drivers/Kconfig +++ b/arch/cris/arch-v32/drivers/Kconfig | |||
@@ -362,8 +362,6 @@ config ETRAX_AXISFLASHMAP | |||
362 | select MTD | 362 | select MTD |
363 | select MTD_CFI | 363 | select MTD_CFI |
364 | select MTD_CFI_AMDSTD | 364 | select MTD_CFI_AMDSTD |
365 | select MTD_OBSOLETE_CHIPS | ||
366 | select MTD_AMDSTD | ||
367 | select MTD_CHAR | 365 | select MTD_CHAR |
368 | select MTD_BLOCK | 366 | select MTD_BLOCK |
369 | select MTD_PARTITIONS | 367 | select MTD_PARTITIONS |
diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c index 3ec12ea44e8e..c5ff95e18269 100644 --- a/arch/cris/arch-v32/drivers/axisflashmap.c +++ b/arch/cris/arch-v32/drivers/axisflashmap.c | |||
@@ -190,13 +190,12 @@ static struct mtd_info *probe_cs(struct map_info *map_cs) | |||
190 | "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", | 190 | "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", |
191 | map_cs->name, map_cs->size, map_cs->map_priv_1); | 191 | map_cs->name, map_cs->size, map_cs->map_priv_1); |
192 | 192 | ||
193 | #ifdef CONFIG_MTD_AMDSTD | ||
194 | mtd_cs = do_map_probe("amd_flash", map_cs); | ||
195 | #endif | ||
196 | #ifdef CONFIG_MTD_CFI | 193 | #ifdef CONFIG_MTD_CFI |
197 | if (!mtd_cs) { | ||
198 | mtd_cs = do_map_probe("cfi_probe", map_cs); | 194 | mtd_cs = do_map_probe("cfi_probe", map_cs); |
199 | } | 195 | #endif |
196 | #ifdef CONFIG_MTD_JEDECPROBE | ||
197 | if (!mtd_cs) | ||
198 | mtd_cs = do_map_probe("jedec_probe", map_cs); | ||
200 | #endif | 199 | #endif |
201 | 200 | ||
202 | return mtd_cs; | 201 | return mtd_cs; |
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c index df89298aafc4..d581b0a92a3f 100644 --- a/arch/cris/arch-v32/drivers/sync_serial.c +++ b/arch/cris/arch-v32/drivers/sync_serial.c | |||
@@ -185,7 +185,7 @@ static struct sync_port ports[]= | |||
185 | } | 185 | } |
186 | }; | 186 | }; |
187 | 187 | ||
188 | #define NUMBER_OF_PORTS (sizeof(ports)/sizeof(sync_port)) | 188 | #define NUMBER_OF_PORTS ARRAY_SIZE(ports) |
189 | 189 | ||
190 | static const struct file_operations sync_serial_fops = { | 190 | static const struct file_operations sync_serial_fops = { |
191 | .owner = THIS_MODULE, | 191 | .owner = THIS_MODULE, |
diff --git a/arch/cris/arch-v32/kernel/cache.c b/arch/cris/arch-v32/kernel/cache.c new file mode 100644 index 000000000000..80da7b88a72b --- /dev/null +++ b/arch/cris/arch-v32/kernel/cache.c | |||
@@ -0,0 +1,33 @@ | |||
1 | #include <linux/module.h> | ||
2 | #include <asm/io.h> | ||
3 | #include <asm/arch/cache.h> | ||
4 | #include <asm/arch/hwregs/dma.h> | ||
5 | |||
6 | /* This file is used to workaround a cache bug, Guinness TR 106. */ | ||
7 | |||
8 | inline void flush_dma_descr(struct dma_descr_data *descr, int flush_buf) | ||
9 | { | ||
10 | /* Flush descriptor to make sure we get correct in_eop and after. */ | ||
11 | asm volatile ("ftagd [%0]" :: "r" (descr)); | ||
12 | /* Flush buffer pointed out by descriptor. */ | ||
13 | if (flush_buf) | ||
14 | cris_flush_cache_range(phys_to_virt((unsigned)descr->buf), | ||
15 | (unsigned)(descr->after - descr->buf)); | ||
16 | } | ||
17 | EXPORT_SYMBOL(flush_dma_descr); | ||
18 | |||
19 | void flush_dma_list(struct dma_descr_data *descr) | ||
20 | { | ||
21 | while (1) { | ||
22 | flush_dma_descr(descr, 1); | ||
23 | if (descr->eol) | ||
24 | break; | ||
25 | descr = phys_to_virt((unsigned)descr->next); | ||
26 | } | ||
27 | } | ||
28 | EXPORT_SYMBOL(flush_dma_list); | ||
29 | |||
30 | /* From cacheflush.S */ | ||
31 | EXPORT_SYMBOL(cris_flush_cache); | ||
32 | /* From cacheflush.S */ | ||
33 | EXPORT_SYMBOL(cris_flush_cache_range); | ||
diff --git a/arch/cris/arch-v32/kernel/cacheflush.S b/arch/cris/arch-v32/kernel/cacheflush.S new file mode 100644 index 000000000000..956e8fb82f01 --- /dev/null +++ b/arch/cris/arch-v32/kernel/cacheflush.S | |||
@@ -0,0 +1,94 @@ | |||
1 | .global cris_flush_cache_range | ||
2 | cris_flush_cache_range: | ||
3 | move.d 1024, $r12 | ||
4 | cmp.d $r11, $r12 | ||
5 | bhi cris_flush_1KB | ||
6 | nop | ||
7 | add.d $r10, $r11 | ||
8 | ftagd [$r10] | ||
9 | cris_flush_last: | ||
10 | addq 32, $r10 | ||
11 | cmp.d $r11, $r10 | ||
12 | blt cris_flush_last | ||
13 | ftagd [$r10] | ||
14 | ret | ||
15 | nop | ||
16 | cris_flush_1KB: | ||
17 | ftagd [$r10] | ||
18 | addq 32, $r10 | ||
19 | ftagd [$r10] | ||
20 | addq 32, $r10 | ||
21 | ftagd [$r10] | ||
22 | addq 32, $r10 | ||
23 | ftagd [$r10] | ||
24 | addq 32, $r10 | ||
25 | ftagd [$r10] | ||
26 | addq 32, $r10 | ||
27 | ftagd [$r10] | ||
28 | addq 32, $r10 | ||
29 | ftagd [$r10] | ||
30 | addq 32, $r10 | ||
31 | ftagd [$r10] | ||
32 | addq 32, $r10 | ||
33 | ftagd [$r10] | ||
34 | addq 32, $r10 | ||
35 | ftagd [$r10] | ||
36 | addq 32, $r10 | ||
37 | ftagd [$r10] | ||
38 | addq 32, $r10 | ||
39 | ftagd [$r10] | ||
40 | addq 32, $r10 | ||
41 | ftagd [$r10] | ||
42 | addq 32, $r10 | ||
43 | ftagd [$r10] | ||
44 | addq 32, $r10 | ||
45 | ftagd [$r10] | ||
46 | addq 32, $r10 | ||
47 | ftagd [$r10] | ||
48 | addq 32, $r10 | ||
49 | ftagd [$r10] | ||
50 | addq 32, $r10 | ||
51 | ftagd [$r10] | ||
52 | addq 32, $r10 | ||
53 | ftagd [$r10] | ||
54 | addq 32, $r10 | ||
55 | ftagd [$r10] | ||
56 | addq 32, $r10 | ||
57 | ftagd [$r10] | ||
58 | addq 32, $r10 | ||
59 | ftagd [$r10] | ||
60 | addq 32, $r10 | ||
61 | ftagd [$r10] | ||
62 | addq 32, $r10 | ||
63 | ftagd [$r10] | ||
64 | addq 32, $r10 | ||
65 | ftagd [$r10] | ||
66 | addq 32, $r10 | ||
67 | ftagd [$r10] | ||
68 | addq 32, $r10 | ||
69 | ftagd [$r10] | ||
70 | addq 32, $r10 | ||
71 | ftagd [$r10] | ||
72 | addq 32, $r10 | ||
73 | ftagd [$r10] | ||
74 | addq 32, $r10 | ||
75 | ftagd [$r10] | ||
76 | addq 32, $r10 | ||
77 | ftagd [$r10] | ||
78 | addq 32, $r10 | ||
79 | ftagd [$r10] | ||
80 | addq 32, $r10 | ||
81 | ba cris_flush_cache_range | ||
82 | sub.d $r12, $r11 | ||
83 | |||
84 | .global cris_flush_cache | ||
85 | cris_flush_cache: | ||
86 | moveq 0, $r10 | ||
87 | cris_flush_line: | ||
88 | move.d 16*1024, $r11 | ||
89 | addq 16, $r10 | ||
90 | cmp.d $r10, $r11 | ||
91 | blt cris_flush_line | ||
92 | fidxd [$r10] | ||
93 | ret | ||
94 | nop | ||
diff --git a/arch/cris/arch-v32/kernel/io.c b/arch/cris/arch-v32/kernel/io.c index dfbfcb8d2585..a22a9e02e093 100644 --- a/arch/cris/arch-v32/kernel/io.c +++ b/arch/cris/arch-v32/kernel/io.c | |||
@@ -49,7 +49,7 @@ struct crisv32_ioport crisv32_ioports[] = | |||
49 | } | 49 | } |
50 | }; | 50 | }; |
51 | 51 | ||
52 | #define NBR_OF_PORTS sizeof(crisv32_ioports)/sizeof(struct crisv32_ioport) | 52 | #define NBR_OF_PORTS ARRAY_SIZE(crisv32_ioports) |
53 | 53 | ||
54 | struct crisv32_iopin crisv32_led1_green; | 54 | struct crisv32_iopin crisv32_led1_green; |
55 | struct crisv32_iopin crisv32_led1_red; | 55 | struct crisv32_iopin crisv32_led1_red; |
diff --git a/arch/cris/arch-v32/kernel/setup.c b/arch/cris/arch-v32/kernel/setup.c index 4662f363df63..72e9e8331f63 100644 --- a/arch/cris/arch-v32/kernel/setup.c +++ b/arch/cris/arch-v32/kernel/setup.c | |||
@@ -54,12 +54,10 @@ show_cpuinfo(struct seq_file *m, void *v) | |||
54 | { | 54 | { |
55 | int i; | 55 | int i; |
56 | int cpu = (int)v - 1; | 56 | int cpu = (int)v - 1; |
57 | int entries; | ||
58 | unsigned long revision; | 57 | unsigned long revision; |
59 | struct cpu_info *info; | 58 | struct cpu_info *info; |
60 | 59 | ||
61 | entries = sizeof cpinfo / sizeof(struct cpu_info); | 60 | info = &cpinfo[ARRAY_SIZE(cpinfo) - 1]; |
62 | info = &cpinfo[entries - 1]; | ||
63 | 61 | ||
64 | #ifdef CONFIG_SMP | 62 | #ifdef CONFIG_SMP |
65 | if (!cpu_online(cpu)) | 63 | if (!cpu_online(cpu)) |
@@ -68,7 +66,7 @@ show_cpuinfo(struct seq_file *m, void *v) | |||
68 | 66 | ||
69 | revision = rdvr(); | 67 | revision = rdvr(); |
70 | 68 | ||
71 | for (i = 0; i < entries; i++) { | 69 | for (i = 0; i < ARRAY_SIZE(cpinfo); i++) { |
72 | if (cpinfo[i].rev == revision) { | 70 | if (cpinfo[i].rev == revision) { |
73 | info = &cpinfo[i]; | 71 | info = &cpinfo[i]; |
74 | break; | 72 | break; |
diff --git a/arch/cris/defconfig b/arch/cris/defconfig index 142a10818af3..9c33ae659934 100644 --- a/arch/cris/defconfig +++ b/arch/cris/defconfig | |||
@@ -226,8 +226,6 @@ CONFIG_MTD_CFI_UTIL=y | |||
226 | CONFIG_MTD_RAM=y | 226 | CONFIG_MTD_RAM=y |
227 | # CONFIG_MTD_ROM is not set | 227 | # CONFIG_MTD_ROM is not set |
228 | # CONFIG_MTD_ABSENT is not set | 228 | # CONFIG_MTD_ABSENT is not set |
229 | CONFIG_MTD_OBSOLETE_CHIPS=y | ||
230 | CONFIG_MTD_AMDSTD=y | ||
231 | # CONFIG_MTD_SHARP is not set | 229 | # CONFIG_MTD_SHARP is not set |
232 | # CONFIG_MTD_JEDEC is not set | 230 | # CONFIG_MTD_JEDEC is not set |
233 | 231 | ||
@@ -276,6 +274,7 @@ CONFIG_MTDRAM_ABS_POS=0x0 | |||
276 | # CONFIG_BLK_DEV_FD is not set | 274 | # CONFIG_BLK_DEV_FD is not set |
277 | # CONFIG_BLK_DEV_COW_COMMON is not set | 275 | # CONFIG_BLK_DEV_COW_COMMON is not set |
278 | # CONFIG_BLK_DEV_LOOP is not set | 276 | # CONFIG_BLK_DEV_LOOP is not set |
277 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | ||
279 | # CONFIG_BLK_DEV_NBD is not set | 278 | # CONFIG_BLK_DEV_NBD is not set |
280 | # CONFIG_BLK_DEV_UB is not set | 279 | # CONFIG_BLK_DEV_UB is not set |
281 | CONFIG_BLK_DEV_RAM=y | 280 | CONFIG_BLK_DEV_RAM=y |
@@ -302,16 +301,14 @@ CONFIG_IOSCHED_CFQ=y | |||
302 | # | 301 | # |
303 | # ATA/ATAPI/MFM/RLL support | 302 | # ATA/ATAPI/MFM/RLL support |
304 | # | 303 | # |
305 | CONFIG_IDE=y | 304 | # CONFIG_IDE is not set |
306 | CONFIG_BLK_DEV_IDE=y | 305 | # CONFIG_PARIDE is not set |
307 | 306 | ||
308 | # | 307 | # |
309 | # Please see Documentation/ide.txt for help/info on IDE drives | 308 | # Please see Documentation/ide.txt for help/info on IDE drives |
310 | # | 309 | # |
311 | # CONFIG_BLK_DEV_IDE_SATA is not set | 310 | # CONFIG_BLK_DEV_IDE_SATA is not set |
312 | CONFIG_BLK_DEV_IDEDISK=y | ||
313 | # CONFIG_IDEDISK_MULTI_MODE is not set | 311 | # CONFIG_IDEDISK_MULTI_MODE is not set |
314 | CONFIG_BLK_DEV_IDECD=y | ||
315 | # CONFIG_BLK_DEV_IDETAPE is not set | 312 | # CONFIG_BLK_DEV_IDETAPE is not set |
316 | # CONFIG_BLK_DEV_IDEFLOPPY is not set | 313 | # CONFIG_BLK_DEV_IDEFLOPPY is not set |
317 | # CONFIG_IDE_TASK_IOCTL is not set | 314 | # CONFIG_IDE_TASK_IOCTL is not set |
@@ -321,7 +318,6 @@ CONFIG_BLK_DEV_IDECD=y | |||
321 | # | 318 | # |
322 | # CONFIG_IDE_GENERIC is not set | 319 | # CONFIG_IDE_GENERIC is not set |
323 | # CONFIG_IDE_ARM is not set | 320 | # CONFIG_IDE_ARM is not set |
324 | CONFIG_BLK_DEV_IDEDMA=y | ||
325 | # CONFIG_IDEDMA_AUTO is not set | 321 | # CONFIG_IDEDMA_AUTO is not set |
326 | # CONFIG_BLK_DEV_HD is not set | 322 | # CONFIG_BLK_DEV_HD is not set |
327 | 323 | ||
@@ -329,6 +325,7 @@ CONFIG_BLK_DEV_IDEDMA=y | |||
329 | # SCSI device support | 325 | # SCSI device support |
330 | # | 326 | # |
331 | # CONFIG_SCSI is not set | 327 | # CONFIG_SCSI is not set |
328 | # CONFIG_ISCSI_TCP is not set | ||
332 | 329 | ||
333 | # | 330 | # |
334 | # IEEE 1394 (FireWire) support | 331 | # IEEE 1394 (FireWire) support |
@@ -414,26 +411,11 @@ CONFIG_NETFILTER=y | |||
414 | # CONFIG_NET_POLL_CONTROLLER is not set | 411 | # CONFIG_NET_POLL_CONTROLLER is not set |
415 | # CONFIG_HAMRADIO is not set | 412 | # CONFIG_HAMRADIO is not set |
416 | # CONFIG_IRDA is not set | 413 | # CONFIG_IRDA is not set |
417 | CONFIG_BT=y | 414 | # CONFIG_AF_RXRPC is not set |
418 | CONFIG_BT_L2CAP=y | 415 | # CONFIG_AF_RXRPC_DEBUG is not set |
419 | # CONFIG_BT_SCO is not set | 416 | # CONFIG_BT is not set |
420 | CONFIG_BT_RFCOMM=y | 417 | # CONFIG_I2C is not set |
421 | # CONFIG_BT_RFCOMM_TTY is not set | 418 | |
422 | CONFIG_BT_BNEP=y | ||
423 | # CONFIG_BT_BNEP_MC_FILTER is not set | ||
424 | # CONFIG_BT_BNEP_PROTO_FILTER is not set | ||
425 | # CONFIG_BT_HIDP is not set | ||
426 | |||
427 | # | ||
428 | # Bluetooth device drivers | ||
429 | # | ||
430 | CONFIG_BT_HCIUSB=y | ||
431 | # CONFIG_BT_HCIUSB_SCO is not set | ||
432 | # CONFIG_BT_HCIUART is not set | ||
433 | # CONFIG_BT_HCIBCM203X is not set | ||
434 | # CONFIG_BT_HCIBPA10X is not set | ||
435 | # CONFIG_BT_HCIBFUSB is not set | ||
436 | # CONFIG_BT_HCIVHCI is not set | ||
437 | CONFIG_NETDEVICES=y | 419 | CONFIG_NETDEVICES=y |
438 | # CONFIG_DUMMY is not set | 420 | # CONFIG_DUMMY is not set |
439 | # CONFIG_BONDING is not set | 421 | # CONFIG_BONDING is not set |
@@ -485,31 +467,17 @@ CONFIG_NET_ETHERNET=y | |||
485 | # | 467 | # |
486 | # Input device support | 468 | # Input device support |
487 | # | 469 | # |
488 | CONFIG_INPUT=y | 470 | # CONFIG_INPUT is not set |
489 | |||
490 | # | ||
491 | # Userland interfaces | ||
492 | # | ||
493 | CONFIG_INPUT_MOUSEDEV=y | ||
494 | CONFIG_INPUT_MOUSEDEV_PSAUX=y | ||
495 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 | ||
496 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 | ||
497 | # CONFIG_INPUT_JOYDEV is not set | ||
498 | # CONFIG_INPUT_TSDEV is not set | ||
499 | # CONFIG_INPUT_EVDEV is not set | ||
500 | # CONFIG_INPUT_EVBUG is not set | ||
501 | 471 | ||
502 | # | 472 | # |
503 | # Input I/O drivers | 473 | # Input I/O drivers |
504 | # | 474 | # |
505 | # CONFIG_GAMEPORT is not set | ||
506 | CONFIG_SOUND_GAMEPORT=y | ||
507 | CONFIG_SERIO=y | 475 | CONFIG_SERIO=y |
508 | # CONFIG_SERIO_I8042 is not set | 476 | # CONFIG_SERIO_I8042 is not set |
509 | # CONFIG_SERIO_SERPORT is not set | 477 | # CONFIG_SERIO_SERPORT is not set |
510 | # CONFIG_SERIO_CT82C710 is not set | 478 | # CONFIG_SERIO_LIBPS2 is not set |
511 | CONFIG_SERIO_LIBPS2=y | ||
512 | # CONFIG_SERIO_RAW is not set | 479 | # CONFIG_SERIO_RAW is not set |
480 | # CONFIG_GAMEPORT is not set | ||
513 | 481 | ||
514 | # | 482 | # |
515 | # Input Device Drivers | 483 | # Input Device Drivers |
@@ -525,6 +493,7 @@ CONFIG_MOUSE_PS2=y | |||
525 | # CONFIG_MOUSE_SERIAL is not set | 493 | # CONFIG_MOUSE_SERIAL is not set |
526 | # CONFIG_MOUSE_VSXXXAA is not set | 494 | # CONFIG_MOUSE_VSXXXAA is not set |
527 | # CONFIG_INPUT_JOYSTICK is not set | 495 | # CONFIG_INPUT_JOYSTICK is not set |
496 | # CONFIG_INPUT_TABLET is not set | ||
528 | # CONFIG_INPUT_TOUCHSCREEN is not set | 497 | # CONFIG_INPUT_TOUCHSCREEN is not set |
529 | # CONFIG_INPUT_MISC is not set | 498 | # CONFIG_INPUT_MISC is not set |
530 | 499 | ||
@@ -542,6 +511,8 @@ CONFIG_MOUSE_PS2=y | |||
542 | # | 511 | # |
543 | # Non-8250 serial port support | 512 | # Non-8250 serial port support |
544 | # | 513 | # |
514 | CONFIG_SERIAL_CORE=y | ||
515 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
545 | CONFIG_UNIX98_PTYS=y | 516 | CONFIG_UNIX98_PTYS=y |
546 | CONFIG_LEGACY_PTYS=y | 517 | CONFIG_LEGACY_PTYS=y |
547 | CONFIG_LEGACY_PTY_COUNT=256 | 518 | CONFIG_LEGACY_PTY_COUNT=256 |
@@ -559,6 +530,8 @@ CONFIG_LEGACY_PTY_COUNT=256 | |||
559 | # CONFIG_GEN_RTC is not set | 530 | # CONFIG_GEN_RTC is not set |
560 | # CONFIG_DTLK is not set | 531 | # CONFIG_DTLK is not set |
561 | # CONFIG_R3964 is not set | 532 | # CONFIG_R3964 is not set |
533 | # CONFIG_RTC_LIB is not set | ||
534 | # CONFIG_RTC_CLASS is not set | ||
562 | 535 | ||
563 | # | 536 | # |
564 | # Ftape, the floppy tape device driver | 537 | # Ftape, the floppy tape device driver |
@@ -660,7 +633,9 @@ CONFIG_NFS_V3=y | |||
660 | # CONFIG_NFSD is not set | 633 | # CONFIG_NFSD is not set |
661 | CONFIG_LOCKD=y | 634 | CONFIG_LOCKD=y |
662 | CONFIG_LOCKD_V4=y | 635 | CONFIG_LOCKD_V4=y |
636 | CONFIG_NFS_COMMON=y | ||
663 | CONFIG_SUNRPC=y | 637 | CONFIG_SUNRPC=y |
638 | # CONFIG_SUNRPC_BIND34 is not set | ||
664 | # CONFIG_RPCSEC_GSS_KRB5 is not set | 639 | # CONFIG_RPCSEC_GSS_KRB5 is not set |
665 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | 640 | # CONFIG_RPCSEC_GSS_SPKM3 is not set |
666 | # CONFIG_SMB_FS is not set | 641 | # CONFIG_SMB_FS is not set |
@@ -686,9 +661,21 @@ CONFIG_MSDOS_PARTITION=y | |||
686 | # CONFIG_SOUND is not set | 661 | # CONFIG_SOUND is not set |
687 | 662 | ||
688 | # | 663 | # |
664 | # Generic devices | ||
665 | # | ||
666 | # CONFIG_SND_MPU401_UART is not set | ||
667 | # CONFIG_SND_DUMMY is not set | ||
668 | # CONFIG_SND_VIRMIDI is not set | ||
669 | # CONFIG_SND_MTPAV is not set | ||
670 | # CONFIG_SND_SERIAL_U16550 is not set | ||
671 | # CONFIG_SND_MPU401 is not set | ||
672 | |||
673 | # | ||
689 | # PCCARD (PCMCIA/CardBus) support | 674 | # PCCARD (PCMCIA/CardBus) support |
690 | # | 675 | # |
691 | # CONFIG_PCCARD is not set | 676 | # CONFIG_PCCARD is not set |
677 | # CONFIG_PARPORT_PC_PCMCIA is not set | ||
678 | # CONFIG_NET_PCMCIA is not set | ||
692 | 679 | ||
693 | # | 680 | # |
694 | # PC-card bridges | 681 | # PC-card bridges |
@@ -734,6 +721,7 @@ CONFIG_USB_DEVICEFS=y | |||
734 | # USB Input Devices | 721 | # USB Input Devices |
735 | # | 722 | # |
736 | # CONFIG_USB_HID is not set | 723 | # CONFIG_USB_HID is not set |
724 | # HID_SUPPORT is not set | ||
737 | 725 | ||
738 | # | 726 | # |
739 | # USB HID Boot Protocol drivers | 727 | # USB HID Boot Protocol drivers |
@@ -829,7 +817,7 @@ CONFIG_USB_RTL8150=y | |||
829 | 817 | ||
830 | # | 818 | # |
831 | # Hardware crypto devices | 819 | # Hardware crypto devices |
832 | # | 820 | # CONFIG_CRYPTO_HW is not set |
833 | 821 | ||
834 | # | 822 | # |
835 | # Library routines | 823 | # Library routines |
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c index 105bb5ed48f7..62f0e752915a 100644 --- a/arch/cris/kernel/crisksyms.c +++ b/arch/cris/kernel/crisksyms.c | |||
@@ -27,6 +27,7 @@ extern void __Mod(void); | |||
27 | extern void __ashldi3(void); | 27 | extern void __ashldi3(void); |
28 | extern void __ashrdi3(void); | 28 | extern void __ashrdi3(void); |
29 | extern void __lshrdi3(void); | 29 | extern void __lshrdi3(void); |
30 | extern void __negdi2(void); | ||
30 | extern void iounmap(volatile void * __iomem); | 31 | extern void iounmap(volatile void * __iomem); |
31 | 32 | ||
32 | /* Platform dependent support */ | 33 | /* Platform dependent support */ |
@@ -34,19 +35,6 @@ EXPORT_SYMBOL(kernel_thread); | |||
34 | EXPORT_SYMBOL(get_cmos_time); | 35 | EXPORT_SYMBOL(get_cmos_time); |
35 | EXPORT_SYMBOL(loops_per_usec); | 36 | EXPORT_SYMBOL(loops_per_usec); |
36 | 37 | ||
37 | /* String functions */ | ||
38 | EXPORT_SYMBOL(memcmp); | ||
39 | EXPORT_SYMBOL(memmove); | ||
40 | EXPORT_SYMBOL(strstr); | ||
41 | EXPORT_SYMBOL(strcpy); | ||
42 | EXPORT_SYMBOL(strchr); | ||
43 | EXPORT_SYMBOL(strcmp); | ||
44 | EXPORT_SYMBOL(strlen); | ||
45 | EXPORT_SYMBOL(strcat); | ||
46 | EXPORT_SYMBOL(strncat); | ||
47 | EXPORT_SYMBOL(strncmp); | ||
48 | EXPORT_SYMBOL(strncpy); | ||
49 | |||
50 | /* Math functions */ | 38 | /* Math functions */ |
51 | EXPORT_SYMBOL(__Udiv); | 39 | EXPORT_SYMBOL(__Udiv); |
52 | EXPORT_SYMBOL(__Umod); | 40 | EXPORT_SYMBOL(__Umod); |
@@ -55,6 +43,7 @@ EXPORT_SYMBOL(__Mod); | |||
55 | EXPORT_SYMBOL(__ashldi3); | 43 | EXPORT_SYMBOL(__ashldi3); |
56 | EXPORT_SYMBOL(__ashrdi3); | 44 | EXPORT_SYMBOL(__ashrdi3); |
57 | EXPORT_SYMBOL(__lshrdi3); | 45 | EXPORT_SYMBOL(__lshrdi3); |
46 | EXPORT_SYMBOL(__negdi2); | ||
58 | 47 | ||
59 | /* Memory functions */ | 48 | /* Memory functions */ |
60 | EXPORT_SYMBOL(__ioremap); | 49 | EXPORT_SYMBOL(__ioremap); |
@@ -84,4 +73,4 @@ EXPORT_SYMBOL(start_one_shot_timer); | |||
84 | EXPORT_SYMBOL(del_fast_timer); | 73 | EXPORT_SYMBOL(del_fast_timer); |
85 | EXPORT_SYMBOL(schedule_usleep); | 74 | EXPORT_SYMBOL(schedule_usleep); |
86 | #endif | 75 | #endif |
87 | 76 | EXPORT_SYMBOL(csum_partial); | |
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c index 5c27ff86121b..2dfac8c79090 100644 --- a/arch/cris/kernel/irq.c +++ b/arch/cris/kernel/irq.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * | 2 | * |
3 | * linux/arch/cris/kernel/irq.c | 3 | * linux/arch/cris/kernel/irq.c |
4 | * | 4 | * |
5 | * Copyright (c) 2000,2001 Axis Communications AB | 5 | * Copyright (c) 2000,2007 Axis Communications AB |
6 | * | 6 | * |
7 | * Authors: Bjorn Wesen (bjornw@axis.com) | 7 | * Authors: Bjorn Wesen (bjornw@axis.com) |
8 | * | 8 | * |
@@ -92,14 +92,16 @@ skip: | |||
92 | asmlinkage void do_IRQ(int irq, struct pt_regs * regs) | 92 | asmlinkage void do_IRQ(int irq, struct pt_regs * regs) |
93 | { | 93 | { |
94 | unsigned long sp; | 94 | unsigned long sp; |
95 | struct pt_regs *old_regs = set_irq_regs(regs); | ||
95 | irq_enter(); | 96 | irq_enter(); |
96 | sp = rdsp(); | 97 | sp = rdsp(); |
97 | if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) { | 98 | if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) { |
98 | printk("do_IRQ: stack overflow: %lX\n", sp); | 99 | printk("do_IRQ: stack overflow: %lX\n", sp); |
99 | show_stack(NULL, (unsigned long *)sp); | 100 | show_stack(NULL, (unsigned long *)sp); |
100 | } | 101 | } |
101 | __do_IRQ(irq, regs); | 102 | __do_IRQ(irq); |
102 | irq_exit(); | 103 | irq_exit(); |
104 | set_irq_regs(old_regs); | ||
103 | } | 105 | } |
104 | 106 | ||
105 | void weird_irq(void) | 107 | void weird_irq(void) |
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c index 123451c44154..9ca558fc5bc8 100644 --- a/arch/cris/kernel/process.c +++ b/arch/cris/kernel/process.c | |||
@@ -195,6 +195,11 @@ EXPORT_SYMBOL(enable_hlt); | |||
195 | */ | 195 | */ |
196 | void (*pm_idle)(void); | 196 | void (*pm_idle)(void); |
197 | 197 | ||
198 | extern void default_idle(void); | ||
199 | |||
200 | void (*pm_power_off)(void); | ||
201 | EXPORT_SYMBOL(pm_power_off); | ||
202 | |||
198 | /* | 203 | /* |
199 | * The idle thread. There's no useful work to be | 204 | * The idle thread. There's no useful work to be |
200 | * done, so just try to conserve power and have a | 205 | * done, so just try to conserve power and have a |
diff --git a/arch/cris/kernel/ptrace.c b/arch/cris/kernel/ptrace.c index 1085d037027b..3ccd20e85dce 100644 --- a/arch/cris/kernel/ptrace.c +++ b/arch/cris/kernel/ptrace.c | |||
@@ -81,13 +81,13 @@ | |||
81 | /* notification of userspace execution resumption | 81 | /* notification of userspace execution resumption |
82 | * - triggered by current->work.notify_resume | 82 | * - triggered by current->work.notify_resume |
83 | */ | 83 | */ |
84 | extern int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs); | 84 | extern int do_signal(int canrestart, struct pt_regs *regs); |
85 | 85 | ||
86 | 86 | ||
87 | void do_notify_resume(int canrestart, sigset_t *oldset, struct pt_regs *regs, | 87 | void do_notify_resume(int canrestart, struct pt_regs *regs, |
88 | __u32 thread_info_flags ) | 88 | __u32 thread_info_flags ) |
89 | { | 89 | { |
90 | /* deal with pending signal delivery */ | 90 | /* deal with pending signal delivery */ |
91 | if (thread_info_flags & _TIF_SIGPENDING) | 91 | if (thread_info_flags & _TIF_SIGPENDING) |
92 | do_signal(canrestart,oldset,regs); | 92 | do_signal(canrestart,regs); |
93 | } | 93 | } |
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c index 514359b8122e..8b9984197edc 100644 --- a/arch/cris/kernel/sys_cris.c +++ b/arch/cris/kernel/sys_cris.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/syscalls.h> | 14 | #include <linux/syscalls.h> |
15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
16 | #include <linux/fs.h> | ||
16 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
17 | #include <linux/smp_lock.h> | 18 | #include <linux/smp_lock.h> |
18 | #include <linux/sem.h> | 19 | #include <linux/sem.h> |
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c index acfd04559405..7a2cc7efbcf8 100644 --- a/arch/cris/kernel/time.c +++ b/arch/cris/kernel/time.c | |||
@@ -171,10 +171,6 @@ get_cmos_time(void) | |||
171 | mon = CMOS_READ(RTC_MONTH); | 171 | mon = CMOS_READ(RTC_MONTH); |
172 | year = CMOS_READ(RTC_YEAR); | 172 | year = CMOS_READ(RTC_YEAR); |
173 | 173 | ||
174 | printk(KERN_DEBUG | ||
175 | "rtc: sec 0x%x min 0x%x hour 0x%x day 0x%x mon 0x%x year 0x%x\n", | ||
176 | sec, min, hour, day, mon, year); | ||
177 | |||
178 | BCD_TO_BIN(sec); | 174 | BCD_TO_BIN(sec); |
179 | BCD_TO_BIN(min); | 175 | BCD_TO_BIN(min); |
180 | BCD_TO_BIN(hour); | 176 | BCD_TO_BIN(hour); |
@@ -207,12 +203,12 @@ void | |||
207 | cris_do_profile(struct pt_regs* regs) | 203 | cris_do_profile(struct pt_regs* regs) |
208 | { | 204 | { |
209 | 205 | ||
210 | #if CONFIG_SYSTEM_PROFILER | 206 | #ifdef CONFIG_SYSTEM_PROFILER |
211 | cris_profile_sample(regs); | 207 | cris_profile_sample(regs); |
212 | #endif | 208 | #endif |
213 | 209 | ||
214 | #if CONFIG_PROFILING | 210 | #ifdef CONFIG_PROFILING |
215 | profile_tick(CPU_PROFILING, regs); | 211 | profile_tick(CPU_PROFILING); |
216 | #endif | 212 | #endif |
217 | } | 213 | } |
218 | 214 | ||
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c index 5181bf551f3c..8e8f8b6193ee 100644 --- a/arch/ia64/kernel/efi.c +++ b/arch/ia64/kernel/efi.c | |||
@@ -1113,7 +1113,7 @@ efi_initialize_iomem_resources(struct resource *code_resource, | |||
1113 | if (md->num_pages == 0) /* should not happen */ | 1113 | if (md->num_pages == 0) /* should not happen */ |
1114 | continue; | 1114 | continue; |
1115 | 1115 | ||
1116 | flags = IORESOURCE_MEM; | 1116 | flags = IORESOURCE_MEM | IORESOURCE_BUSY; |
1117 | switch (md->type) { | 1117 | switch (md->type) { |
1118 | 1118 | ||
1119 | case EFI_MEMORY_MAPPED_IO: | 1119 | case EFI_MEMORY_MAPPED_IO: |
@@ -1135,12 +1135,11 @@ efi_initialize_iomem_resources(struct resource *code_resource, | |||
1135 | 1135 | ||
1136 | case EFI_ACPI_MEMORY_NVS: | 1136 | case EFI_ACPI_MEMORY_NVS: |
1137 | name = "ACPI Non-volatile Storage"; | 1137 | name = "ACPI Non-volatile Storage"; |
1138 | flags |= IORESOURCE_BUSY; | ||
1139 | break; | 1138 | break; |
1140 | 1139 | ||
1141 | case EFI_UNUSABLE_MEMORY: | 1140 | case EFI_UNUSABLE_MEMORY: |
1142 | name = "reserved"; | 1141 | name = "reserved"; |
1143 | flags |= IORESOURCE_BUSY | IORESOURCE_DISABLED; | 1142 | flags |= IORESOURCE_DISABLED; |
1144 | break; | 1143 | break; |
1145 | 1144 | ||
1146 | case EFI_RESERVED_TYPE: | 1145 | case EFI_RESERVED_TYPE: |
@@ -1149,7 +1148,6 @@ efi_initialize_iomem_resources(struct resource *code_resource, | |||
1149 | case EFI_ACPI_RECLAIM_MEMORY: | 1148 | case EFI_ACPI_RECLAIM_MEMORY: |
1150 | default: | 1149 | default: |
1151 | name = "reserved"; | 1150 | name = "reserved"; |
1152 | flags |= IORESOURCE_BUSY; | ||
1153 | break; | 1151 | break; |
1154 | } | 1152 | } |
1155 | 1153 | ||
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c index 33506ff25910..5b10ac133ec8 100644 --- a/arch/mips/kernel/irixsig.c +++ b/arch/mips/kernel/irixsig.c | |||
@@ -430,6 +430,7 @@ asmlinkage int irix_sigprocmask(int how, irix_sigset_t __user *new, | |||
430 | break; | 430 | break; |
431 | 431 | ||
432 | default: | 432 | default: |
433 | spin_unlock_irq(¤t->sighand->siglock); | ||
433 | return -EINVAL; | 434 | return -EINVAL; |
434 | } | 435 | } |
435 | recalc_sigpending(); | 436 | recalc_sigpending(); |
diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c index 1899601e5862..3f23d9fda662 100644 --- a/arch/mips/vr41xx/common/icu.c +++ b/arch/mips/vr41xx/common/icu.c | |||
@@ -525,6 +525,7 @@ static inline int set_sysint1_assign(unsigned int irq, unsigned char assign) | |||
525 | intassign1 |= (uint16_t)assign << 9; | 525 | intassign1 |= (uint16_t)assign << 9; |
526 | break; | 526 | break; |
527 | default: | 527 | default: |
528 | spin_unlock_irq(&desc->lock); | ||
528 | return -EINVAL; | 529 | return -EINVAL; |
529 | } | 530 | } |
530 | 531 | ||
@@ -592,6 +593,7 @@ static inline int set_sysint2_assign(unsigned int irq, unsigned char assign) | |||
592 | intassign3 |= (uint16_t)assign << 12; | 593 | intassign3 |= (uint16_t)assign << 12; |
593 | break; | 594 | break; |
594 | default: | 595 | default: |
596 | spin_unlock_irq(&desc->lock); | ||
595 | return -EINVAL; | 597 | return -EINVAL; |
596 | } | 598 | } |
597 | 599 | ||
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 4e165342210a..bd87626c1f60 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile | |||
@@ -107,6 +107,9 @@ endif | |||
107 | # No AltiVec instruction when building kernel | 107 | # No AltiVec instruction when building kernel |
108 | KBUILD_CFLAGS += $(call cc-option,-mno-altivec) | 108 | KBUILD_CFLAGS += $(call cc-option,-mno-altivec) |
109 | 109 | ||
110 | # No SPE instruction when building kernel | ||
111 | KBUILD_CFLAGS += $(call cc-option,-mno-spe) | ||
112 | |||
110 | # Enable unit-at-a-time mode when possible. It shrinks the | 113 | # Enable unit-at-a-time mode when possible. It shrinks the |
111 | # kernel considerably. | 114 | # kernel considerably. |
112 | KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) | 115 | KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) |
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index 3ef51fb6f107..9c74fdf29eec 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c | |||
@@ -186,7 +186,9 @@ int btext_initialize(struct device_node *np) | |||
186 | pitch = *prop; | 186 | pitch = *prop; |
187 | if (pitch == 1) | 187 | if (pitch == 1) |
188 | pitch = 0x1000; | 188 | pitch = 0x1000; |
189 | prop = of_get_property(np, "address", NULL); | 189 | prop = of_get_property(np, "linux,bootx-addr", NULL); |
190 | if (prop == NULL) | ||
191 | prop = of_get_property(np, "address", NULL); | ||
190 | if (prop) | 192 | if (prop) |
191 | address = *prop; | 193 | address = *prop; |
192 | 194 | ||
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index a7572cf464bd..69a91bd46115 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -251,6 +251,9 @@ syscall_exit_cont: | |||
251 | bne- 2f | 251 | bne- 2f |
252 | 1: | 252 | 1: |
253 | #endif /* CONFIG_44x */ | 253 | #endif /* CONFIG_44x */ |
254 | BEGIN_FTR_SECTION | ||
255 | lwarx r7,0,r1 | ||
256 | END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) | ||
254 | stwcx. r0,0,r1 /* to clear the reservation */ | 257 | stwcx. r0,0,r1 /* to clear the reservation */ |
255 | lwz r4,_LINK(r1) | 258 | lwz r4,_LINK(r1) |
256 | lwz r5,_CCR(r1) | 259 | lwz r5,_CCR(r1) |
@@ -717,6 +720,9 @@ restore: | |||
717 | mtctr r11 | 720 | mtctr r11 |
718 | 721 | ||
719 | PPC405_ERR77(0,r1) | 722 | PPC405_ERR77(0,r1) |
723 | BEGIN_FTR_SECTION | ||
724 | lwarx r11,0,r1 | ||
725 | END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) | ||
720 | stwcx. r0,0,r1 /* to clear the reservation */ | 726 | stwcx. r0,0,r1 /* to clear the reservation */ |
721 | 727 | ||
722 | #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) | 728 | #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 4beb6329dfb7..c0d77723ba11 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -829,7 +829,7 @@ static void register_decrementer_clockevent(int cpu) | |||
829 | *dec = decrementer_clockevent; | 829 | *dec = decrementer_clockevent; |
830 | dec->cpumask = cpumask_of_cpu(cpu); | 830 | dec->cpumask = cpumask_of_cpu(cpu); |
831 | 831 | ||
832 | printk(KERN_INFO "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n", | 832 | printk(KERN_DEBUG "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n", |
833 | dec->name, dec->mult, dec->shift, cpu); | 833 | dec->name, dec->mult, dec->shift, cpu); |
834 | 834 | ||
835 | clockevents_register_device(dec); | 835 | clockevents_register_device(dec); |
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index d9c82d3d6482..c0f5cff77035 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c | |||
@@ -19,8 +19,6 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #undef DEBUG | ||
23 | |||
24 | #include <linux/signal.h> | 22 | #include <linux/signal.h> |
25 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
26 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
@@ -66,12 +64,6 @@ | |||
66 | 64 | ||
67 | #include "mmu_decl.h" | 65 | #include "mmu_decl.h" |
68 | 66 | ||
69 | #ifdef DEBUG | ||
70 | #define DBG(fmt...) printk(fmt) | ||
71 | #else | ||
72 | #define DBG(fmt...) | ||
73 | #endif | ||
74 | |||
75 | #if PGTABLE_RANGE > USER_VSID_RANGE | 67 | #if PGTABLE_RANGE > USER_VSID_RANGE |
76 | #warning Limited user VSID range means pagetable space is wasted | 68 | #warning Limited user VSID range means pagetable space is wasted |
77 | #endif | 69 | #endif |
@@ -175,8 +167,8 @@ void pgtable_cache_init(void) | |||
175 | int size = pgtable_cache_size[i]; | 167 | int size = pgtable_cache_size[i]; |
176 | const char *name = pgtable_cache_name[i]; | 168 | const char *name = pgtable_cache_name[i]; |
177 | 169 | ||
178 | DBG("Allocating page table cache %s (#%d) " | 170 | pr_debug("Allocating page table cache %s (#%d) " |
179 | "for size: %08x...\n", name, i, size); | 171 | "for size: %08x...\n", name, i, size); |
180 | pgtable_cache[i] = kmem_cache_create(name, | 172 | pgtable_cache[i] = kmem_cache_create(name, |
181 | size, size, | 173 | size, size, |
182 | SLAB_PANIC, | 174 | SLAB_PANIC, |
@@ -239,8 +231,8 @@ int __meminit vmemmap_populate(struct page *start_page, | |||
239 | if (!p) | 231 | if (!p) |
240 | return -ENOMEM; | 232 | return -ENOMEM; |
241 | 233 | ||
242 | printk(KERN_WARNING "vmemmap %08lx allocated at %p, " | 234 | pr_debug("vmemmap %08lx allocated at %p, physical %08lx.\n", |
243 | "physical %08lx.\n", start, p, __pa(p)); | 235 | start, p, __pa(p)); |
244 | 236 | ||
245 | mapped = htab_bolt_mapping(start, start + page_size, | 237 | mapped = htab_bolt_mapping(start, start + page_size, |
246 | __pa(p), mode_rw, mmu_linear_psize, | 238 | __pa(p), mode_rw, mmu_linear_psize, |
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c index eafbca52bff9..e2d867ce1c7e 100644 --- a/arch/powerpc/mm/tlb_64.c +++ b/arch/powerpc/mm/tlb_64.c | |||
@@ -54,12 +54,10 @@ unsigned long pte_freelist_forced_free; | |||
54 | ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \ | 54 | ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \ |
55 | / sizeof(pgtable_free_t)) | 55 | / sizeof(pgtable_free_t)) |
56 | 56 | ||
57 | #ifdef CONFIG_SMP | ||
58 | static void pte_free_smp_sync(void *arg) | 57 | static void pte_free_smp_sync(void *arg) |
59 | { | 58 | { |
60 | /* Do nothing, just ensure we sync with all CPUs */ | 59 | /* Do nothing, just ensure we sync with all CPUs */ |
61 | } | 60 | } |
62 | #endif | ||
63 | 61 | ||
64 | /* This is only called when we are critically out of memory | 62 | /* This is only called when we are critically out of memory |
65 | * (and fail to get a page in pte_free_tlb). | 63 | * (and fail to get a page in pte_free_tlb). |
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c index 66c8ad4cfce6..165981c87786 100644 --- a/arch/powerpc/sysdev/cpm_common.c +++ b/arch/powerpc/sysdev/cpm_common.c | |||
@@ -77,8 +77,6 @@ int __init cpm_muram_init(void) | |||
77 | int i = 0; | 77 | int i = 0; |
78 | int ret = 0; | 78 | int ret = 0; |
79 | 79 | ||
80 | printk("cpm_muram_init\n"); | ||
81 | |||
82 | spin_lock_init(&cpm_muram_lock); | 80 | spin_lock_init(&cpm_muram_lock); |
83 | /* initialize the info header */ | 81 | /* initialize the info header */ |
84 | rh_init(&cpm_muram_info, 1, | 82 | rh_init(&cpm_muram_info, 1, |
@@ -193,7 +191,7 @@ void __iomem *cpm_muram_addr(unsigned long offset) | |||
193 | EXPORT_SYMBOL(cpm_muram_addr); | 191 | EXPORT_SYMBOL(cpm_muram_addr); |
194 | 192 | ||
195 | /** | 193 | /** |
196 | * cpm_muram_phys - turn a muram virtual address into a DMA address | 194 | * cpm_muram_dma - turn a muram virtual address into a DMA address |
197 | * @offset: virtual address from cpm_muram_addr() to convert | 195 | * @offset: virtual address from cpm_muram_addr() to convert |
198 | */ | 196 | */ |
199 | dma_addr_t cpm_muram_dma(void __iomem *addr) | 197 | dma_addr_t cpm_muram_dma(void __iomem *addr) |
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S index b19bfef2034d..59e77eb63338 100644 --- a/arch/ppc/kernel/entry.S +++ b/arch/ppc/kernel/entry.S | |||
@@ -251,6 +251,9 @@ syscall_exit_cont: | |||
251 | bne- 2f | 251 | bne- 2f |
252 | 1: | 252 | 1: |
253 | #endif /* CONFIG_44x */ | 253 | #endif /* CONFIG_44x */ |
254 | BEGIN_FTR_SECTION | ||
255 | lwarx r7,0,r1 | ||
256 | END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) | ||
254 | stwcx. r0,0,r1 /* to clear the reservation */ | 257 | stwcx. r0,0,r1 /* to clear the reservation */ |
255 | lwz r4,_LINK(r1) | 258 | lwz r4,_LINK(r1) |
256 | lwz r5,_CCR(r1) | 259 | lwz r5,_CCR(r1) |
@@ -713,6 +716,9 @@ restore: | |||
713 | mtctr r11 | 716 | mtctr r11 |
714 | 717 | ||
715 | PPC405_ERR77(0,r1) | 718 | PPC405_ERR77(0,r1) |
719 | BEGIN_FTR_SECTION | ||
720 | lwarx r11,0,r1 | ||
721 | END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) | ||
716 | stwcx. r0,0,r1 /* to clear the reservation */ | 722 | stwcx. r0,0,r1 /* to clear the reservation */ |
717 | 723 | ||
718 | #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) | 724 | #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) |
diff --git a/arch/um/Makefile b/arch/um/Makefile index 768a5d14b755..31999bc1c8a4 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile | |||
@@ -168,7 +168,7 @@ ifneq ($(KBUILD_SRC),) | |||
168 | $(Q)mkdir -p $(objtree)/include/asm-um | 168 | $(Q)mkdir -p $(objtree)/include/asm-um |
169 | $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch | 169 | $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch |
170 | else | 170 | else |
171 | $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(HEADER_ARCH) arch | 171 | $(Q)cd $(TOPDIR)/include/asm-um && ln -fsn ../asm-$(SUBARCH) arch |
172 | endif | 172 | endif |
173 | 173 | ||
174 | $(objtree)/$(ARCH_DIR)/include: | 174 | $(objtree)/$(ARCH_DIR)/include: |
@@ -180,7 +180,7 @@ $(ARCH_DIR)/include/sysdep: $(objtree)/$(ARCH_DIR)/include | |||
180 | ifneq ($(KBUILD_SRC),) | 180 | ifneq ($(KBUILD_SRC),) |
181 | $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep | 181 | $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep |
182 | else | 182 | else |
183 | $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep | 183 | $(Q)cd $(ARCH_DIR)/include && ln -fsn sysdep-$(SUBARCH) sysdep |
184 | endif | 184 | endif |
185 | 185 | ||
186 | $(ARCH_DIR)/os: | 186 | $(ARCH_DIR)/os: |
@@ -188,7 +188,7 @@ $(ARCH_DIR)/os: | |||
188 | ifneq ($(KBUILD_SRC),) | 188 | ifneq ($(KBUILD_SRC),) |
189 | $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/os-$(OS) $(ARCH_DIR)/os | 189 | $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/os-$(OS) $(ARCH_DIR)/os |
190 | else | 190 | else |
191 | $(Q)cd $(ARCH_DIR) && ln -sf os-$(OS) os | 191 | $(Q)cd $(ARCH_DIR) && ln -fsn os-$(OS) os |
192 | endif | 192 | endif |
193 | 193 | ||
194 | # Generated files | 194 | # Generated files |
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index 8c01fa81a1ae..73681f14f9fc 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c | |||
@@ -753,6 +753,7 @@ static struct mc_device net_mc = { | |||
753 | .remove = net_remove, | 753 | .remove = net_remove, |
754 | }; | 754 | }; |
755 | 755 | ||
756 | #ifdef CONFIG_INET | ||
756 | static int uml_inetaddr_event(struct notifier_block *this, unsigned long event, | 757 | static int uml_inetaddr_event(struct notifier_block *this, unsigned long event, |
757 | void *ptr) | 758 | void *ptr) |
758 | { | 759 | { |
@@ -789,14 +790,13 @@ struct notifier_block uml_inetaddr_notifier = { | |||
789 | .notifier_call = uml_inetaddr_event, | 790 | .notifier_call = uml_inetaddr_event, |
790 | }; | 791 | }; |
791 | 792 | ||
792 | static int uml_net_init(void) | 793 | static void inet_register(void) |
793 | { | 794 | { |
794 | struct list_head *ele; | 795 | struct list_head *ele; |
795 | struct uml_net_private *lp; | 796 | struct uml_net_private *lp; |
796 | struct in_device *ip; | 797 | struct in_device *ip; |
797 | struct in_ifaddr *in; | 798 | struct in_ifaddr *in; |
798 | 799 | ||
799 | mconsole_register_dev(&net_mc); | ||
800 | register_inetaddr_notifier(¨_inetaddr_notifier); | 800 | register_inetaddr_notifier(¨_inetaddr_notifier); |
801 | 801 | ||
802 | /* Devices may have been opened already, so the uml_inetaddr_notifier | 802 | /* Devices may have been opened already, so the uml_inetaddr_notifier |
@@ -816,7 +816,17 @@ static int uml_net_init(void) | |||
816 | } | 816 | } |
817 | } | 817 | } |
818 | spin_unlock(&opened_lock); | 818 | spin_unlock(&opened_lock); |
819 | } | ||
820 | #else | ||
821 | static inline void inet_register(void) | ||
822 | { | ||
823 | } | ||
824 | #endif | ||
819 | 825 | ||
826 | static int uml_net_init(void) | ||
827 | { | ||
828 | mconsole_register_dev(&net_mc); | ||
829 | inet_register(); | ||
820 | return 0; | 830 | return 0; |
821 | } | 831 | } |
822 | 832 | ||
diff --git a/arch/um/include/user.h b/arch/um/include/user.h index 99033ff28a78..1723fac6f40d 100644 --- a/arch/um/include/user.h +++ b/arch/um/include/user.h | |||
@@ -1,11 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __USER_H__ | 6 | #ifndef __USER_H__ |
7 | #define __USER_H__ | 7 | #define __USER_H__ |
8 | 8 | ||
9 | #include "uml-config.h" | ||
10 | |||
9 | /* | 11 | /* |
10 | * The usual definition - copied here because the kernel provides its own, | 12 | * The usual definition - copied here because the kernel provides its own, |
11 | * fancier, type-safe, definition. Using that one would require | 13 | * fancier, type-safe, definition. Using that one would require |
@@ -23,8 +25,17 @@ | |||
23 | 25 | ||
24 | extern void panic(const char *fmt, ...) | 26 | extern void panic(const char *fmt, ...) |
25 | __attribute__ ((format (printf, 1, 2))); | 27 | __attribute__ ((format (printf, 1, 2))); |
28 | |||
29 | #ifdef UML_CONFIG_PRINTK | ||
26 | extern int printk(const char *fmt, ...) | 30 | extern int printk(const char *fmt, ...) |
27 | __attribute__ ((format (printf, 1, 2))); | 31 | __attribute__ ((format (printf, 1, 2))); |
32 | #else | ||
33 | static inline int printk(const char *fmt, ...) | ||
34 | { | ||
35 | return 0; | ||
36 | } | ||
37 | #endif | ||
38 | |||
28 | extern void schedule(void); | 39 | extern void schedule(void); |
29 | extern int in_aton(char *str); | 40 | extern int in_aton(char *str); |
30 | extern int open_gdb_chan(void); | 41 | extern int open_gdb_chan(void); |
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c index 70c2d625b070..ba11ccd6a8a3 100644 --- a/arch/um/kernel/irq.c +++ b/arch/um/kernel/irq.c | |||
@@ -347,14 +347,15 @@ int um_request_irq(unsigned int irq, int fd, int type, | |||
347 | { | 347 | { |
348 | int err; | 348 | int err; |
349 | 349 | ||
350 | err = request_irq(irq, handler, irqflags, devname, dev_id); | 350 | if (fd != -1) { |
351 | if (err) | ||
352 | return err; | ||
353 | |||
354 | if (fd != -1) | ||
355 | err = activate_fd(irq, fd, type, dev_id); | 351 | err = activate_fd(irq, fd, type, dev_id); |
356 | return err; | 352 | if (err) |
353 | return err; | ||
354 | } | ||
355 | |||
356 | return request_irq(irq, handler, irqflags, devname, dev_id); | ||
357 | } | 357 | } |
358 | |||
358 | EXPORT_SYMBOL(um_request_irq); | 359 | EXPORT_SYMBOL(um_request_irq); |
359 | EXPORT_SYMBOL(reactivate_fd); | 360 | EXPORT_SYMBOL(reactivate_fd); |
360 | 361 | ||
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c index d119f4f7d897..8d07a7acb909 100644 --- a/arch/um/kernel/skas/clone.c +++ b/arch/um/kernel/skas/clone.c | |||
@@ -3,7 +3,6 @@ | |||
3 | #include <sys/mman.h> | 3 | #include <sys/mman.h> |
4 | #include <sys/time.h> | 4 | #include <sys/time.h> |
5 | #include <asm/unistd.h> | 5 | #include <asm/unistd.h> |
6 | #include <asm/page.h> | ||
7 | #include "as-layout.h" | 6 | #include "as-layout.h" |
8 | #include "ptrace_user.h" | 7 | #include "ptrace_user.h" |
9 | #include "skas.h" | 8 | #include "skas.h" |
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index b542a3a021bf..f83462758627 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c | |||
@@ -496,8 +496,7 @@ int os_rcv_fd(int fd, int *helper_pid_out) | |||
496 | n = recvmsg(fd, &msg, 0); | 496 | n = recvmsg(fd, &msg, 0); |
497 | if(n < 0) | 497 | if(n < 0) |
498 | return -errno; | 498 | return -errno; |
499 | 499 | else if(n != iov.iov_len) | |
500 | else if(n != sizeof(iov.iov_len)) | ||
501 | *helper_pid_out = -1; | 500 | *helper_pid_out = -1; |
502 | 501 | ||
503 | cmsg = CMSG_FIRSTHDR(&msg); | 502 | cmsg = CMSG_FIRSTHDR(&msg); |
diff --git a/arch/x86/Kconfig.i386 b/arch/x86/Kconfig index 7331efe891a7..1eb59971af5d 100644 --- a/arch/x86/Kconfig.i386 +++ b/arch/x86/Kconfig | |||
@@ -1,18 +1,24 @@ | |||
1 | # | 1 | # x86 configuration |
2 | # For a description of the syntax of this configuration file, | 2 | mainmenu "Linux Kernel Configuration for x86" |
3 | # see Documentation/kbuild/kconfig-language.txt. | ||
4 | # | ||
5 | 3 | ||
6 | mainmenu "Linux Kernel Configuration" | 4 | # Select 32 or 64 bit |
5 | config 64BIT | ||
6 | bool "64-bit kernel" | ||
7 | default n | ||
8 | help | ||
9 | Say yes to build a 64-bit kernel - formerly known as x86_64 | ||
10 | Say no to build a 32-bit kernel - formerly known as i386 | ||
7 | 11 | ||
8 | config X86_32 | 12 | config X86_32 |
13 | def_bool !64BIT | ||
14 | |||
15 | config X86_64 | ||
16 | def_bool 64BIT | ||
17 | |||
18 | ### Arch settings | ||
19 | config X86 | ||
9 | bool | 20 | bool |
10 | default y | 21 | default y |
11 | help | ||
12 | This is Linux's home port. Linux was originally native to the Intel | ||
13 | 386, and runs on all the later x86 processors including the Intel | ||
14 | 486, 586, Pentiums, and various instruction-set-compatible chips by | ||
15 | AMD, Cyrix, and others. | ||
16 | 22 | ||
17 | config GENERIC_TIME | 23 | config GENERIC_TIME |
18 | bool | 24 | bool |
@@ -33,7 +39,7 @@ config GENERIC_CLOCKEVENTS | |||
33 | config GENERIC_CLOCKEVENTS_BROADCAST | 39 | config GENERIC_CLOCKEVENTS_BROADCAST |
34 | bool | 40 | bool |
35 | default y | 41 | default y |
36 | depends on X86_LOCAL_APIC | 42 | depends on X86_64 || (X86_32 && X86_LOCAL_APIC) |
37 | 43 | ||
38 | config LOCKDEP_SUPPORT | 44 | config LOCKDEP_SUPPORT |
39 | bool | 45 | bool |
@@ -47,10 +53,6 @@ config SEMAPHORE_SLEEPERS | |||
47 | bool | 53 | bool |
48 | default y | 54 | default y |
49 | 55 | ||
50 | config X86 | ||
51 | bool | ||
52 | default y | ||
53 | |||
54 | config MMU | 56 | config MMU |
55 | bool | 57 | bool |
56 | default y | 58 | default y |
@@ -61,7 +63,7 @@ config ZONE_DMA | |||
61 | 63 | ||
62 | config QUICKLIST | 64 | config QUICKLIST |
63 | bool | 65 | bool |
64 | default y | 66 | default X86_32 |
65 | 67 | ||
66 | config SBUS | 68 | config SBUS |
67 | bool | 69 | bool |
@@ -91,6 +93,76 @@ config DMI | |||
91 | bool | 93 | bool |
92 | default y | 94 | default y |
93 | 95 | ||
96 | config RWSEM_GENERIC_SPINLOCK | ||
97 | def_bool !X86_XADD | ||
98 | |||
99 | config RWSEM_XCHGADD_ALGORITHM | ||
100 | def_bool X86_XADD | ||
101 | |||
102 | config ARCH_HAS_ILOG2_U32 | ||
103 | def_bool n | ||
104 | |||
105 | config ARCH_HAS_ILOG2_U64 | ||
106 | def_bool n | ||
107 | |||
108 | config GENERIC_CALIBRATE_DELAY | ||
109 | def_bool y | ||
110 | |||
111 | config GENERIC_TIME_VSYSCALL | ||
112 | bool | ||
113 | default X86_64 | ||
114 | |||
115 | |||
116 | |||
117 | |||
118 | |||
119 | config ZONE_DMA32 | ||
120 | bool | ||
121 | default X86_64 | ||
122 | |||
123 | config ARCH_POPULATES_NODE_MAP | ||
124 | def_bool y | ||
125 | |||
126 | config AUDIT_ARCH | ||
127 | bool | ||
128 | default X86_64 | ||
129 | |||
130 | # Use the generic interrupt handling code in kernel/irq/: | ||
131 | config GENERIC_HARDIRQS | ||
132 | bool | ||
133 | default y | ||
134 | |||
135 | config GENERIC_IRQ_PROBE | ||
136 | bool | ||
137 | default y | ||
138 | |||
139 | config GENERIC_PENDING_IRQ | ||
140 | bool | ||
141 | depends on GENERIC_HARDIRQS && SMP | ||
142 | default y | ||
143 | |||
144 | config X86_SMP | ||
145 | bool | ||
146 | depends on X86_32 && SMP && !X86_VOYAGER | ||
147 | default y | ||
148 | |||
149 | config X86_HT | ||
150 | bool | ||
151 | depends on SMP && !(X86_VISWS || X86_VOYAGER || MK8) | ||
152 | default y | ||
153 | |||
154 | config X86_BIOS_REBOOT | ||
155 | bool | ||
156 | depends on X86_32 && !(X86_VISWS || X86_VOYAGER) | ||
157 | default y | ||
158 | |||
159 | config X86_TRAMPOLINE | ||
160 | bool | ||
161 | depends on X86_SMP || (X86_VOYAGER && SMP) | ||
162 | default y | ||
163 | |||
164 | config KTIME_SCALAR | ||
165 | def_bool X86_32 | ||
94 | source "init/Kconfig" | 166 | source "init/Kconfig" |
95 | 167 | ||
96 | menu "Processor type and features" | 168 | menu "Processor type and features" |
@@ -137,6 +209,7 @@ config X86_PC | |||
137 | 209 | ||
138 | config X86_ELAN | 210 | config X86_ELAN |
139 | bool "AMD Elan" | 211 | bool "AMD Elan" |
212 | depends on X86_32 | ||
140 | help | 213 | help |
141 | Select this for an AMD Elan processor. | 214 | Select this for an AMD Elan processor. |
142 | 215 | ||
@@ -146,6 +219,7 @@ config X86_ELAN | |||
146 | 219 | ||
147 | config X86_VOYAGER | 220 | config X86_VOYAGER |
148 | bool "Voyager (NCR)" | 221 | bool "Voyager (NCR)" |
222 | depends on X86_32 | ||
149 | select SMP if !BROKEN | 223 | select SMP if !BROKEN |
150 | help | 224 | help |
151 | Voyager is an MCA-based 32-way capable SMP architecture proprietary | 225 | Voyager is an MCA-based 32-way capable SMP architecture proprietary |
@@ -160,6 +234,7 @@ config X86_NUMAQ | |||
160 | bool "NUMAQ (IBM/Sequent)" | 234 | bool "NUMAQ (IBM/Sequent)" |
161 | select SMP | 235 | select SMP |
162 | select NUMA | 236 | select NUMA |
237 | depends on X86_32 | ||
163 | help | 238 | help |
164 | This option is used for getting Linux to run on a (IBM/Sequent) NUMA | 239 | This option is used for getting Linux to run on a (IBM/Sequent) NUMA |
165 | multiquad box. This changes the way that processors are bootstrapped, | 240 | multiquad box. This changes the way that processors are bootstrapped, |
@@ -169,7 +244,7 @@ config X86_NUMAQ | |||
169 | 244 | ||
170 | config X86_SUMMIT | 245 | config X86_SUMMIT |
171 | bool "Summit/EXA (IBM x440)" | 246 | bool "Summit/EXA (IBM x440)" |
172 | depends on SMP | 247 | depends on X86_32 && SMP |
173 | help | 248 | help |
174 | This option is needed for IBM systems that use the Summit/EXA chipset. | 249 | This option is needed for IBM systems that use the Summit/EXA chipset. |
175 | In particular, it is needed for the x440. | 250 | In particular, it is needed for the x440. |
@@ -179,7 +254,7 @@ config X86_SUMMIT | |||
179 | 254 | ||
180 | config X86_BIGSMP | 255 | config X86_BIGSMP |
181 | bool "Support for other sub-arch SMP systems with more than 8 CPUs" | 256 | bool "Support for other sub-arch SMP systems with more than 8 CPUs" |
182 | depends on SMP | 257 | depends on X86_32 && SMP |
183 | help | 258 | help |
184 | This option is needed for the systems that have more than 8 CPUs | 259 | This option is needed for the systems that have more than 8 CPUs |
185 | and if the system is not of any sub-arch type above. | 260 | and if the system is not of any sub-arch type above. |
@@ -188,6 +263,7 @@ config X86_BIGSMP | |||
188 | 263 | ||
189 | config X86_VISWS | 264 | config X86_VISWS |
190 | bool "SGI 320/540 (Visual Workstation)" | 265 | bool "SGI 320/540 (Visual Workstation)" |
266 | depends on X86_32 | ||
191 | help | 267 | help |
192 | The SGI Visual Workstation series is an IA32-based workstation | 268 | The SGI Visual Workstation series is an IA32-based workstation |
193 | based on SGI systems chips with some legacy PC hardware attached. | 269 | based on SGI systems chips with some legacy PC hardware attached. |
@@ -199,6 +275,7 @@ config X86_VISWS | |||
199 | 275 | ||
200 | config X86_GENERICARCH | 276 | config X86_GENERICARCH |
201 | bool "Generic architecture (Summit, bigsmp, ES7000, default)" | 277 | bool "Generic architecture (Summit, bigsmp, ES7000, default)" |
278 | depends on X86_32 | ||
202 | help | 279 | help |
203 | This option compiles in the Summit, bigsmp, ES7000, default subarchitectures. | 280 | This option compiles in the Summit, bigsmp, ES7000, default subarchitectures. |
204 | It is intended for a generic binary kernel. | 281 | It is intended for a generic binary kernel. |
@@ -206,18 +283,27 @@ config X86_GENERICARCH | |||
206 | 283 | ||
207 | config X86_ES7000 | 284 | config X86_ES7000 |
208 | bool "Support for Unisys ES7000 IA32 series" | 285 | bool "Support for Unisys ES7000 IA32 series" |
209 | depends on SMP | 286 | depends on X86_32 && SMP |
210 | help | 287 | help |
211 | Support for Unisys ES7000 systems. Say 'Y' here if this kernel is | 288 | Support for Unisys ES7000 systems. Say 'Y' here if this kernel is |
212 | supposed to run on an IA32-based Unisys ES7000 system. | 289 | supposed to run on an IA32-based Unisys ES7000 system. |
213 | Only choose this option if you have such a system, otherwise you | 290 | Only choose this option if you have such a system, otherwise you |
214 | should say N here. | 291 | should say N here. |
215 | 292 | ||
293 | config X86_VSMP | ||
294 | bool "Support for ScaleMP vSMP" | ||
295 | depends on X86_64 && PCI | ||
296 | help | ||
297 | Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is | ||
298 | supposed to run on these EM64T-based machines. Only choose this option | ||
299 | if you have one of these machines. | ||
300 | |||
216 | endchoice | 301 | endchoice |
217 | 302 | ||
218 | config SCHED_NO_NO_OMIT_FRAME_POINTER | 303 | config SCHED_NO_NO_OMIT_FRAME_POINTER |
219 | bool "Single-depth WCHAN output" | 304 | bool "Single-depth WCHAN output" |
220 | default y | 305 | default y |
306 | depends on X86_32 | ||
221 | help | 307 | help |
222 | Calculate simpler /proc/<PID>/wchan values. If this option | 308 | Calculate simpler /proc/<PID>/wchan values. If this option |
223 | is disabled then wchan values will recurse back to the | 309 | is disabled then wchan values will recurse back to the |
@@ -228,7 +314,7 @@ config SCHED_NO_NO_OMIT_FRAME_POINTER | |||
228 | 314 | ||
229 | config PARAVIRT | 315 | config PARAVIRT |
230 | bool | 316 | bool |
231 | depends on !(X86_VISWS || X86_VOYAGER) | 317 | depends on X86_32 && !(X86_VISWS || X86_VOYAGER) |
232 | help | 318 | help |
233 | This changes the kernel so it can modify itself when it is run | 319 | This changes the kernel so it can modify itself when it is run |
234 | under a hypervisor, potentially improving performance significantly | 320 | under a hypervisor, potentially improving performance significantly |
@@ -237,6 +323,7 @@ config PARAVIRT | |||
237 | 323 | ||
238 | menuconfig PARAVIRT_GUEST | 324 | menuconfig PARAVIRT_GUEST |
239 | bool "Paravirtualized guest support" | 325 | bool "Paravirtualized guest support" |
326 | depends on X86_32 | ||
240 | help | 327 | help |
241 | Say Y here to get to see options related to running Linux under | 328 | Say Y here to get to see options related to running Linux under |
242 | various hypervisors. This option alone does not add any kernel code. | 329 | various hypervisors. This option alone does not add any kernel code. |
@@ -264,7 +351,7 @@ endif | |||
264 | config ACPI_SRAT | 351 | config ACPI_SRAT |
265 | bool | 352 | bool |
266 | default y | 353 | default y |
267 | depends on ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH) | 354 | depends on X86_32 && ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH) |
268 | select ACPI_NUMA | 355 | select ACPI_NUMA |
269 | 356 | ||
270 | config HAVE_ARCH_PARSE_SRAT | 357 | config HAVE_ARCH_PARSE_SRAT |
@@ -275,12 +362,12 @@ config HAVE_ARCH_PARSE_SRAT | |||
275 | config X86_SUMMIT_NUMA | 362 | config X86_SUMMIT_NUMA |
276 | bool | 363 | bool |
277 | default y | 364 | default y |
278 | depends on NUMA && (X86_SUMMIT || X86_GENERICARCH) | 365 | depends on X86_32 && NUMA && (X86_SUMMIT || X86_GENERICARCH) |
279 | 366 | ||
280 | config X86_CYCLONE_TIMER | 367 | config X86_CYCLONE_TIMER |
281 | bool | 368 | bool |
282 | default y | 369 | default y |
283 | depends on X86_SUMMIT || X86_GENERICARCH | 370 | depends on X86_32 && X86_SUMMIT || X86_GENERICARCH |
284 | 371 | ||
285 | config ES7000_CLUSTERED_APIC | 372 | config ES7000_CLUSTERED_APIC |
286 | bool | 373 | bool |
@@ -290,21 +377,89 @@ config ES7000_CLUSTERED_APIC | |||
290 | source "arch/x86/Kconfig.cpu" | 377 | source "arch/x86/Kconfig.cpu" |
291 | 378 | ||
292 | config HPET_TIMER | 379 | config HPET_TIMER |
293 | bool "HPET Timer Support" | 380 | bool |
381 | prompt "HPET Timer Support" if X86_32 | ||
382 | default X86_64 | ||
294 | help | 383 | help |
295 | This enables the use of the HPET for the kernel's internal timer. | 384 | Use the IA-PC HPET (High Precision Event Timer) to manage |
296 | HPET is the next generation timer replacing legacy 8254s. | 385 | time in preference to the PIT and RTC, if a HPET is |
297 | You can safely choose Y here. However, HPET will only be | 386 | present. |
298 | activated if the platform and the BIOS support this feature. | 387 | HPET is the next generation timer replacing legacy 8254s. |
299 | Otherwise the 8254 will be used for timing services. | 388 | The HPET provides a stable time base on SMP |
389 | systems, unlike the TSC, but it is more expensive to access, | ||
390 | as it is off-chip. You can find the HPET spec at | ||
391 | <http://www.intel.com/hardwaredesign/hpetspec.htm>. | ||
300 | 392 | ||
301 | Choose N to continue using the legacy 8254 timer. | 393 | You can safely choose Y here. However, HPET will only be |
394 | activated if the platform and the BIOS support this feature. | ||
395 | Otherwise the 8254 will be used for timing services. | ||
396 | |||
397 | Choose N to continue using the legacy 8254 timer. | ||
302 | 398 | ||
303 | config HPET_EMULATE_RTC | 399 | config HPET_EMULATE_RTC |
304 | bool | 400 | bool |
305 | depends on HPET_TIMER && RTC=y | 401 | depends on HPET_TIMER && RTC=y |
306 | default y | 402 | default y |
307 | 403 | ||
404 | # Mark as embedded because too many people got it wrong. | ||
405 | # The code disables itself when not needed. | ||
406 | config GART_IOMMU | ||
407 | bool "GART IOMMU support" if EMBEDDED | ||
408 | default y | ||
409 | select SWIOTLB | ||
410 | select AGP | ||
411 | depends on X86_64 && PCI | ||
412 | help | ||
413 | Support for full DMA access of devices with 32bit memory access only | ||
414 | on systems with more than 3GB. This is usually needed for USB, | ||
415 | sound, many IDE/SATA chipsets and some other devices. | ||
416 | Provides a driver for the AMD Athlon64/Opteron/Turion/Sempron GART | ||
417 | based hardware IOMMU and a software bounce buffer based IOMMU used | ||
418 | on Intel systems and as fallback. | ||
419 | The code is only active when needed (enough memory and limited | ||
420 | device) unless CONFIG_IOMMU_DEBUG or iommu=force is specified | ||
421 | too. | ||
422 | |||
423 | config CALGARY_IOMMU | ||
424 | bool "IBM Calgary IOMMU support" | ||
425 | select SWIOTLB | ||
426 | depends on X86_64 && PCI && EXPERIMENTAL | ||
427 | help | ||
428 | Support for hardware IOMMUs in IBM's xSeries x366 and x460 | ||
429 | systems. Needed to run systems with more than 3GB of memory | ||
430 | properly with 32-bit PCI devices that do not support DAC | ||
431 | (Double Address Cycle). Calgary also supports bus level | ||
432 | isolation, where all DMAs pass through the IOMMU. This | ||
433 | prevents them from going anywhere except their intended | ||
434 | destination. This catches hard-to-find kernel bugs and | ||
435 | mis-behaving drivers and devices that do not use the DMA-API | ||
436 | properly to set up their DMA buffers. The IOMMU can be | ||
437 | turned off at boot time with the iommu=off parameter. | ||
438 | Normally the kernel will make the right choice by itself. | ||
439 | If unsure, say Y. | ||
440 | |||
441 | config CALGARY_IOMMU_ENABLED_BY_DEFAULT | ||
442 | bool "Should Calgary be enabled by default?" | ||
443 | default y | ||
444 | depends on CALGARY_IOMMU | ||
445 | help | ||
446 | Should Calgary be enabled by default? if you choose 'y', Calgary | ||
447 | will be used (if it exists). If you choose 'n', Calgary will not be | ||
448 | used even if it exists. If you choose 'n' and would like to use | ||
449 | Calgary anyway, pass 'iommu=calgary' on the kernel command line. | ||
450 | If unsure, say Y. | ||
451 | |||
452 | # need this always selected by IOMMU for the VIA workaround | ||
453 | config SWIOTLB | ||
454 | bool | ||
455 | help | ||
456 | Support for software bounce buffers used on x86-64 systems | ||
457 | which don't have a hardware IOMMU (e.g. the current generation | ||
458 | of Intel's x86-64 CPUs). Using this PCI devices which can only | ||
459 | access 32-bits of memory can be used on systems with more than | ||
460 | 3 GB of memory. If unsure, say Y. | ||
461 | |||
462 | |||
308 | config NR_CPUS | 463 | config NR_CPUS |
309 | int "Maximum number of CPUs (2-255)" | 464 | int "Maximum number of CPUs (2-255)" |
310 | range 2 255 | 465 | range 2 255 |
@@ -321,7 +476,7 @@ config NR_CPUS | |||
321 | 476 | ||
322 | config SCHED_SMT | 477 | config SCHED_SMT |
323 | bool "SMT (Hyperthreading) scheduler support" | 478 | bool "SMT (Hyperthreading) scheduler support" |
324 | depends on X86_HT | 479 | depends on (X86_64 && SMP) || (X86_32 && X86_HT) |
325 | help | 480 | help |
326 | SMT scheduler support improves the CPU scheduler's decision making | 481 | SMT scheduler support improves the CPU scheduler's decision making |
327 | when dealing with Intel Pentium 4 chips with HyperThreading at a | 482 | when dealing with Intel Pentium 4 chips with HyperThreading at a |
@@ -330,7 +485,7 @@ config SCHED_SMT | |||
330 | 485 | ||
331 | config SCHED_MC | 486 | config SCHED_MC |
332 | bool "Multi-core scheduler support" | 487 | bool "Multi-core scheduler support" |
333 | depends on X86_HT | 488 | depends on (X86_64 && SMP) || (X86_32 && X86_HT) |
334 | default y | 489 | default y |
335 | help | 490 | help |
336 | Multi-core scheduler support improves the CPU scheduler's decision | 491 | Multi-core scheduler support improves the CPU scheduler's decision |
@@ -341,7 +496,7 @@ source "kernel/Kconfig.preempt" | |||
341 | 496 | ||
342 | config X86_UP_APIC | 497 | config X86_UP_APIC |
343 | bool "Local APIC support on uniprocessors" | 498 | bool "Local APIC support on uniprocessors" |
344 | depends on !SMP && !(X86_VISWS || X86_VOYAGER || X86_GENERICARCH) | 499 | depends on X86_32 && !SMP && !(X86_VISWS || X86_VOYAGER || X86_GENERICARCH) |
345 | help | 500 | help |
346 | A local APIC (Advanced Programmable Interrupt Controller) is an | 501 | A local APIC (Advanced Programmable Interrupt Controller) is an |
347 | integrated interrupt controller in the CPU. If you have a single-CPU | 502 | integrated interrupt controller in the CPU. If you have a single-CPU |
@@ -366,17 +521,17 @@ config X86_UP_IOAPIC | |||
366 | 521 | ||
367 | config X86_LOCAL_APIC | 522 | config X86_LOCAL_APIC |
368 | bool | 523 | bool |
369 | depends on X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH | 524 | depends on X86_64 || (X86_32 && (X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH)) |
370 | default y | 525 | default y |
371 | 526 | ||
372 | config X86_IO_APIC | 527 | config X86_IO_APIC |
373 | bool | 528 | bool |
374 | depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH | 529 | depends on X86_64 || (X86_32 && (X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH)) |
375 | default y | 530 | default y |
376 | 531 | ||
377 | config X86_VISWS_APIC | 532 | config X86_VISWS_APIC |
378 | bool | 533 | bool |
379 | depends on X86_VISWS | 534 | depends on X86_32 && X86_VISWS |
380 | default y | 535 | default y |
381 | 536 | ||
382 | config X86_MCE | 537 | config X86_MCE |
@@ -396,9 +551,25 @@ config X86_MCE | |||
396 | to disable it. MCE support simply ignores non-MCE processors like | 551 | to disable it. MCE support simply ignores non-MCE processors like |
397 | the 386 and 486, so nearly everyone can say Y here. | 552 | the 386 and 486, so nearly everyone can say Y here. |
398 | 553 | ||
554 | config X86_MCE_INTEL | ||
555 | bool "Intel MCE features" | ||
556 | depends on X86_64 && X86_MCE && X86_LOCAL_APIC | ||
557 | default y | ||
558 | help | ||
559 | Additional support for intel specific MCE features such as | ||
560 | the thermal monitor. | ||
561 | |||
562 | config X86_MCE_AMD | ||
563 | bool "AMD MCE features" | ||
564 | depends on X86_64 && X86_MCE && X86_LOCAL_APIC | ||
565 | default y | ||
566 | help | ||
567 | Additional support for AMD specific MCE features such as | ||
568 | the DRAM Error Threshold. | ||
569 | |||
399 | config X86_MCE_NONFATAL | 570 | config X86_MCE_NONFATAL |
400 | tristate "Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4" | 571 | tristate "Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4" |
401 | depends on X86_MCE | 572 | depends on X86_32 && X86_MCE |
402 | help | 573 | help |
403 | Enabling this feature starts a timer that triggers every 5 seconds which | 574 | Enabling this feature starts a timer that triggers every 5 seconds which |
404 | will look at the machine check registers to see if anything happened. | 575 | will look at the machine check registers to see if anything happened. |
@@ -411,14 +582,15 @@ config X86_MCE_NONFATAL | |||
411 | 582 | ||
412 | config X86_MCE_P4THERMAL | 583 | config X86_MCE_P4THERMAL |
413 | bool "check for P4 thermal throttling interrupt." | 584 | bool "check for P4 thermal throttling interrupt." |
414 | depends on X86_MCE && (X86_UP_APIC || SMP) && !X86_VISWS | 585 | depends on X86_32 && X86_MCE && (X86_UP_APIC || SMP) && !X86_VISWS |
415 | help | 586 | help |
416 | Enabling this feature will cause a message to be printed when the P4 | 587 | Enabling this feature will cause a message to be printed when the P4 |
417 | enters thermal throttling. | 588 | enters thermal throttling. |
418 | 589 | ||
419 | config VM86 | 590 | config VM86 |
420 | default y | ||
421 | bool "Enable VM86 support" if EMBEDDED | 591 | bool "Enable VM86 support" if EMBEDDED |
592 | default y | ||
593 | depends on X86_32 | ||
422 | help | 594 | help |
423 | This option is required by programs like DOSEMU to run 16-bit legacy | 595 | This option is required by programs like DOSEMU to run 16-bit legacy |
424 | code on X86 processors. It also may be needed by software like | 596 | code on X86 processors. It also may be needed by software like |
@@ -427,6 +599,7 @@ config VM86 | |||
427 | 599 | ||
428 | config TOSHIBA | 600 | config TOSHIBA |
429 | tristate "Toshiba Laptop support" | 601 | tristate "Toshiba Laptop support" |
602 | depends on X86_32 | ||
430 | ---help--- | 603 | ---help--- |
431 | This adds a driver to safely access the System Management Mode of | 604 | This adds a driver to safely access the System Management Mode of |
432 | the CPU on Toshiba portables with a genuine Toshiba BIOS. It does | 605 | the CPU on Toshiba portables with a genuine Toshiba BIOS. It does |
@@ -442,6 +615,7 @@ config TOSHIBA | |||
442 | 615 | ||
443 | config I8K | 616 | config I8K |
444 | tristate "Dell laptop support" | 617 | tristate "Dell laptop support" |
618 | depends on X86_32 | ||
445 | ---help--- | 619 | ---help--- |
446 | This adds a driver to safely access the System Management Mode | 620 | This adds a driver to safely access the System Management Mode |
447 | of the CPU on the Dell Inspiron 8000. The System Management Mode | 621 | of the CPU on the Dell Inspiron 8000. The System Management Mode |
@@ -462,7 +636,7 @@ config I8K | |||
462 | 636 | ||
463 | config X86_REBOOTFIXUPS | 637 | config X86_REBOOTFIXUPS |
464 | bool "Enable X86 board specific fixups for reboot" | 638 | bool "Enable X86 board specific fixups for reboot" |
465 | depends on X86 | 639 | depends on X86_32 && X86 |
466 | default n | 640 | default n |
467 | ---help--- | 641 | ---help--- |
468 | This enables chipset and/or board specific fixups to be done | 642 | This enables chipset and/or board specific fixups to be done |
@@ -517,12 +691,11 @@ config X86_CPUID | |||
517 | with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to | 691 | with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to |
518 | /dev/cpu/31/cpuid. | 692 | /dev/cpu/31/cpuid. |
519 | 693 | ||
520 | source "drivers/firmware/Kconfig" | ||
521 | |||
522 | choice | 694 | choice |
523 | prompt "High Memory Support" | 695 | prompt "High Memory Support" |
524 | default HIGHMEM4G if !X86_NUMAQ | 696 | default HIGHMEM4G if !X86_NUMAQ |
525 | default HIGHMEM64G if X86_NUMAQ | 697 | default HIGHMEM64G if X86_NUMAQ |
698 | depends on X86_32 | ||
526 | 699 | ||
527 | config NOHIGHMEM | 700 | config NOHIGHMEM |
528 | bool "off" | 701 | bool "off" |
@@ -582,6 +755,7 @@ choice | |||
582 | depends on EXPERIMENTAL | 755 | depends on EXPERIMENTAL |
583 | prompt "Memory split" if EMBEDDED | 756 | prompt "Memory split" if EMBEDDED |
584 | default VMSPLIT_3G | 757 | default VMSPLIT_3G |
758 | depends on X86_32 | ||
585 | help | 759 | help |
586 | Select the desired split between kernel and user memory. | 760 | Select the desired split between kernel and user memory. |
587 | 761 | ||
@@ -619,16 +793,17 @@ config PAGE_OFFSET | |||
619 | default 0x78000000 if VMSPLIT_2G_OPT | 793 | default 0x78000000 if VMSPLIT_2G_OPT |
620 | default 0x40000000 if VMSPLIT_1G | 794 | default 0x40000000 if VMSPLIT_1G |
621 | default 0xC0000000 | 795 | default 0xC0000000 |
796 | depends on X86_32 | ||
622 | 797 | ||
623 | config HIGHMEM | 798 | config HIGHMEM |
624 | bool | 799 | bool |
625 | depends on HIGHMEM64G || HIGHMEM4G | 800 | depends on X86_32 && (HIGHMEM64G || HIGHMEM4G) |
626 | default y | 801 | default y |
627 | 802 | ||
628 | config X86_PAE | 803 | config X86_PAE |
629 | bool "PAE (Physical Address Extension) Support" | 804 | bool "PAE (Physical Address Extension) Support" |
630 | default n | 805 | default n |
631 | depends on !HIGHMEM4G | 806 | depends on X86_32 && !HIGHMEM4G |
632 | select RESOURCES_64BIT | 807 | select RESOURCES_64BIT |
633 | help | 808 | help |
634 | PAE is required for NX support, and furthermore enables | 809 | PAE is required for NX support, and furthermore enables |
@@ -639,46 +814,82 @@ config X86_PAE | |||
639 | # Common NUMA Features | 814 | # Common NUMA Features |
640 | config NUMA | 815 | config NUMA |
641 | bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)" | 816 | bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)" |
642 | depends on SMP && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) && EXPERIMENTAL | 817 | depends on SMP |
818 | depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) && EXPERIMENTAL) | ||
643 | default n if X86_PC | 819 | default n if X86_PC |
644 | default y if (X86_NUMAQ || X86_SUMMIT) | 820 | default y if (X86_NUMAQ || X86_SUMMIT) |
645 | help | 821 | help |
646 | NUMA support for i386. This is currently highly experimental | 822 | Enable NUMA (Non Uniform Memory Access) support. |
647 | and should be only used for kernel development. It might also | 823 | The kernel will try to allocate memory used by a CPU on the |
648 | cause boot failures. | 824 | local memory controller of the CPU and add some more |
825 | NUMA awareness to the kernel. | ||
826 | |||
827 | For i386 this is currently highly experimental and should be only | ||
828 | used for kernel development. It might also cause boot failures. | ||
829 | For x86_64 this is recommended on all multiprocessor Opteron systems. | ||
830 | If the system is EM64T, you should say N unless your system is | ||
831 | EM64T NUMA. | ||
649 | 832 | ||
650 | comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI" | 833 | comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI" |
651 | depends on X86_SUMMIT && (!HIGHMEM64G || !ACPI) | 834 | depends on X86_32 && X86_SUMMIT && (!HIGHMEM64G || !ACPI) |
835 | |||
836 | config K8_NUMA | ||
837 | bool "Old style AMD Opteron NUMA detection" | ||
838 | depends on X86_64 && NUMA && PCI | ||
839 | default y | ||
840 | help | ||
841 | Enable K8 NUMA node topology detection. You should say Y here if | ||
842 | you have a multi processor AMD K8 system. This uses an old | ||
843 | method to read the NUMA configuration directly from the builtin | ||
844 | Northbridge of Opteron. It is recommended to use X86_64_ACPI_NUMA | ||
845 | instead, which also takes priority if both are compiled in. | ||
846 | |||
847 | config X86_64_ACPI_NUMA | ||
848 | bool "ACPI NUMA detection" | ||
849 | depends on X86_64 && NUMA && ACPI && PCI | ||
850 | select ACPI_NUMA | ||
851 | default y | ||
852 | help | ||
853 | Enable ACPI SRAT based node topology detection. | ||
854 | |||
855 | config NUMA_EMU | ||
856 | bool "NUMA emulation" | ||
857 | depends on X86_64 && NUMA | ||
858 | help | ||
859 | Enable NUMA emulation. A flat machine will be split | ||
860 | into virtual nodes when booted with "numa=fake=N", where N is the | ||
861 | number of nodes. This is only useful for debugging. | ||
652 | 862 | ||
653 | config NODES_SHIFT | 863 | config NODES_SHIFT |
654 | int | 864 | int |
865 | default "6" if X86_64 | ||
655 | default "4" if X86_NUMAQ | 866 | default "4" if X86_NUMAQ |
656 | default "3" | 867 | default "3" |
657 | depends on NEED_MULTIPLE_NODES | 868 | depends on NEED_MULTIPLE_NODES |
658 | 869 | ||
659 | config HAVE_ARCH_BOOTMEM_NODE | 870 | config HAVE_ARCH_BOOTMEM_NODE |
660 | bool | 871 | bool |
661 | depends on NUMA | 872 | depends on X86_32 && NUMA |
662 | default y | 873 | default y |
663 | 874 | ||
664 | config ARCH_HAVE_MEMORY_PRESENT | 875 | config ARCH_HAVE_MEMORY_PRESENT |
665 | bool | 876 | bool |
666 | depends on DISCONTIGMEM | 877 | depends on X86_32 && DISCONTIGMEM |
667 | default y | 878 | default y |
668 | 879 | ||
669 | config NEED_NODE_MEMMAP_SIZE | 880 | config NEED_NODE_MEMMAP_SIZE |
670 | bool | 881 | bool |
671 | depends on DISCONTIGMEM || SPARSEMEM | 882 | depends on X86_32 && (DISCONTIGMEM || SPARSEMEM) |
672 | default y | 883 | default y |
673 | 884 | ||
674 | config HAVE_ARCH_ALLOC_REMAP | 885 | config HAVE_ARCH_ALLOC_REMAP |
675 | bool | 886 | bool |
676 | depends on NUMA | 887 | depends on X86_32 && NUMA |
677 | default y | 888 | default y |
678 | 889 | ||
679 | config ARCH_FLATMEM_ENABLE | 890 | config ARCH_FLATMEM_ENABLE |
680 | def_bool y | 891 | def_bool y |
681 | depends on (ARCH_SELECT_MEMORY_MODEL && X86_PC) | 892 | depends on (X86_32 && ARCH_SELECT_MEMORY_MODEL && X86_PC) || (X86_64 && !NUMA) |
682 | 893 | ||
683 | config ARCH_DISCONTIGMEM_ENABLE | 894 | config ARCH_DISCONTIGMEM_ENABLE |
684 | def_bool y | 895 | def_bool y |
@@ -690,21 +901,23 @@ config ARCH_DISCONTIGMEM_DEFAULT | |||
690 | 901 | ||
691 | config ARCH_SPARSEMEM_ENABLE | 902 | config ARCH_SPARSEMEM_ENABLE |
692 | def_bool y | 903 | def_bool y |
693 | depends on (NUMA || (X86_PC && EXPERIMENTAL)) | 904 | depends on NUMA || (EXPERIMENTAL && (X86_PC || X86_64)) |
694 | select SPARSEMEM_STATIC | 905 | select SPARSEMEM_STATIC if X86_32 |
906 | select SPARSEMEM_VMEMMAP_ENABLE if X86_64 | ||
695 | 907 | ||
696 | config ARCH_SELECT_MEMORY_MODEL | 908 | config ARCH_SELECT_MEMORY_MODEL |
697 | def_bool y | 909 | def_bool y |
698 | depends on ARCH_SPARSEMEM_ENABLE | 910 | depends on X86_32 && ARCH_SPARSEMEM_ENABLE |
699 | 911 | ||
700 | config ARCH_POPULATES_NODE_MAP | 912 | config ARCH_MEMORY_PROBE |
701 | def_bool y | 913 | def_bool X86_64 |
914 | depends on MEMORY_HOTPLUG | ||
702 | 915 | ||
703 | source "mm/Kconfig" | 916 | source "mm/Kconfig" |
704 | 917 | ||
705 | config HIGHPTE | 918 | config HIGHPTE |
706 | bool "Allocate 3rd-level pagetables from highmem" | 919 | bool "Allocate 3rd-level pagetables from highmem" |
707 | depends on HIGHMEM4G || HIGHMEM64G | 920 | depends on X86_32 && (HIGHMEM4G || HIGHMEM64G) |
708 | help | 921 | help |
709 | The VM uses one page table entry for each page of physical memory. | 922 | The VM uses one page table entry for each page of physical memory. |
710 | For systems with a lot of RAM, this can be wasteful of precious | 923 | For systems with a lot of RAM, this can be wasteful of precious |
@@ -712,7 +925,8 @@ config HIGHPTE | |||
712 | entries in high memory. | 925 | entries in high memory. |
713 | 926 | ||
714 | config MATH_EMULATION | 927 | config MATH_EMULATION |
715 | bool "Math emulation" | 928 | bool |
929 | prompt "Math emulation" if X86_32 | ||
716 | ---help--- | 930 | ---help--- |
717 | Linux can emulate a math coprocessor (used for floating point | 931 | Linux can emulate a math coprocessor (used for floating point |
718 | operations) if you don't have one. 486DX and Pentium processors have | 932 | operations) if you don't have one. 486DX and Pentium processors have |
@@ -772,7 +986,7 @@ config MTRR | |||
772 | 986 | ||
773 | config EFI | 987 | config EFI |
774 | bool "Boot from EFI support" | 988 | bool "Boot from EFI support" |
775 | depends on ACPI | 989 | depends on X86_32 && ACPI |
776 | default n | 990 | default n |
777 | ---help--- | 991 | ---help--- |
778 | This enables the kernel to boot on EFI platforms using | 992 | This enables the kernel to boot on EFI platforms using |
@@ -789,18 +1003,18 @@ config EFI | |||
789 | kernel should continue to boot on existing non-EFI platforms. | 1003 | kernel should continue to boot on existing non-EFI platforms. |
790 | 1004 | ||
791 | config IRQBALANCE | 1005 | config IRQBALANCE |
792 | bool "Enable kernel irq balancing" | 1006 | bool "Enable kernel irq balancing" |
793 | depends on SMP && X86_IO_APIC | 1007 | depends on X86_32 && SMP && X86_IO_APIC |
794 | default y | 1008 | default y |
795 | help | 1009 | help |
796 | The default yes will allow the kernel to do irq load balancing. | 1010 | The default yes will allow the kernel to do irq load balancing. |
797 | Saying no will keep the kernel from doing irq load balancing. | 1011 | Saying no will keep the kernel from doing irq load balancing. |
798 | 1012 | ||
799 | # turning this on wastes a bunch of space. | 1013 | # turning this on wastes a bunch of space. |
800 | # Summit needs it only when NUMA is on | 1014 | # Summit needs it only when NUMA is on |
801 | config BOOT_IOREMAP | 1015 | config BOOT_IOREMAP |
802 | bool | 1016 | bool |
803 | depends on (((X86_SUMMIT || X86_GENERICARCH) && NUMA) || (X86 && EFI)) | 1017 | depends on X86_32 && (((X86_SUMMIT || X86_GENERICARCH) && NUMA) || (X86 && EFI)) |
804 | default y | 1018 | default y |
805 | 1019 | ||
806 | config SECCOMP | 1020 | config SECCOMP |
@@ -820,6 +1034,30 @@ config SECCOMP | |||
820 | 1034 | ||
821 | If unsure, say Y. Only embedded should say N here. | 1035 | If unsure, say Y. Only embedded should say N here. |
822 | 1036 | ||
1037 | config CC_STACKPROTECTOR | ||
1038 | bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)" | ||
1039 | depends on X86_64 && EXPERIMENTAL | ||
1040 | help | ||
1041 | This option turns on the -fstack-protector GCC feature. This | ||
1042 | feature puts, at the beginning of critical functions, a canary | ||
1043 | value on the stack just before the return address, and validates | ||
1044 | the value just before actually returning. Stack based buffer | ||
1045 | overflows (that need to overwrite this return address) now also | ||
1046 | overwrite the canary, which gets detected and the attack is then | ||
1047 | neutralized via a kernel panic. | ||
1048 | |||
1049 | This feature requires gcc version 4.2 or above, or a distribution | ||
1050 | gcc with the feature backported. Older versions are automatically | ||
1051 | detected and for those versions, this configuration option is ignored. | ||
1052 | |||
1053 | config CC_STACKPROTECTOR_ALL | ||
1054 | bool "Use stack-protector for all functions" | ||
1055 | depends on CC_STACKPROTECTOR | ||
1056 | help | ||
1057 | Normally, GCC only inserts the canary value protection for | ||
1058 | functions that use large-ish on-stack buffers. By enabling | ||
1059 | this option, GCC will be asked to do this for ALL functions. | ||
1060 | |||
823 | source kernel/Kconfig.hz | 1061 | source kernel/Kconfig.hz |
824 | 1062 | ||
825 | config KEXEC | 1063 | config KEXEC |
@@ -841,7 +1079,7 @@ config KEXEC | |||
841 | config CRASH_DUMP | 1079 | config CRASH_DUMP |
842 | bool "kernel crash dumps (EXPERIMENTAL)" | 1080 | bool "kernel crash dumps (EXPERIMENTAL)" |
843 | depends on EXPERIMENTAL | 1081 | depends on EXPERIMENTAL |
844 | depends on HIGHMEM | 1082 | depends on X86_64 || (X86_32 && HIGHMEM) |
845 | help | 1083 | help |
846 | Generate crash dump after being started by kexec. | 1084 | Generate crash dump after being started by kexec. |
847 | This should be normally only set in special crash dump kernels | 1085 | This should be normally only set in special crash dump kernels |
@@ -856,6 +1094,7 @@ config CRASH_DUMP | |||
856 | config PHYSICAL_START | 1094 | config PHYSICAL_START |
857 | hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) | 1095 | hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) |
858 | default "0x1000000" if X86_NUMAQ | 1096 | default "0x1000000" if X86_NUMAQ |
1097 | default "0x200000" if X86_64 | ||
859 | default "0x100000" | 1098 | default "0x100000" |
860 | help | 1099 | help |
861 | This gives the physical address where the kernel is loaded. | 1100 | This gives the physical address where the kernel is loaded. |
@@ -908,25 +1147,31 @@ config RELOCATABLE | |||
908 | must live at a different physical address than the primary | 1147 | must live at a different physical address than the primary |
909 | kernel. | 1148 | kernel. |
910 | 1149 | ||
1150 | Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address | ||
1151 | it has been loaded at and the compile time physical address | ||
1152 | (CONFIG_PHYSICAL_START) is ignored. | ||
1153 | |||
911 | config PHYSICAL_ALIGN | 1154 | config PHYSICAL_ALIGN |
912 | hex "Alignment value to which kernel should be aligned" | 1155 | hex |
913 | default "0x100000" | 1156 | prompt "Alignment value to which kernel should be aligned" if X86_32 |
1157 | default "0x100000" if X86_32 | ||
1158 | default "0x200000" if X86_64 | ||
914 | range 0x2000 0x400000 | 1159 | range 0x2000 0x400000 |
915 | help | 1160 | help |
916 | This value puts the alignment restrictions on physical address | 1161 | This value puts the alignment restrictions on physical address |
917 | where kernel is loaded and run from. Kernel is compiled for an | 1162 | where kernel is loaded and run from. Kernel is compiled for an |
918 | address which meets above alignment restriction. | 1163 | address which meets above alignment restriction. |
919 | 1164 | ||
920 | If bootloader loads the kernel at a non-aligned address and | 1165 | If bootloader loads the kernel at a non-aligned address and |
921 | CONFIG_RELOCATABLE is set, kernel will move itself to nearest | 1166 | CONFIG_RELOCATABLE is set, kernel will move itself to nearest |
922 | address aligned to above value and run from there. | 1167 | address aligned to above value and run from there. |
923 | 1168 | ||
924 | If bootloader loads the kernel at a non-aligned address and | 1169 | If bootloader loads the kernel at a non-aligned address and |
925 | CONFIG_RELOCATABLE is not set, kernel will ignore the run time | 1170 | CONFIG_RELOCATABLE is not set, kernel will ignore the run time |
926 | load address and decompress itself to the address it has been | 1171 | load address and decompress itself to the address it has been |
927 | compiled for and run from there. The address for which kernel is | 1172 | compiled for and run from there. The address for which kernel is |
928 | compiled already meets above alignment restrictions. Hence the | 1173 | compiled already meets above alignment restrictions. Hence the |
929 | end result is that kernel runs from a physical address meeting | 1174 | end result is that kernel runs from a physical address meeting |
930 | above alignment restrictions. | 1175 | above alignment restrictions. |
931 | 1176 | ||
932 | Don't change this unless you know what you are doing. | 1177 | Don't change this unless you know what you are doing. |
@@ -938,10 +1183,13 @@ config HOTPLUG_CPU | |||
938 | Say Y here to experiment with turning CPUs off and on, and to | 1183 | Say Y here to experiment with turning CPUs off and on, and to |
939 | enable suspend on SMP systems. CPUs can be controlled through | 1184 | enable suspend on SMP systems. CPUs can be controlled through |
940 | /sys/devices/system/cpu. | 1185 | /sys/devices/system/cpu. |
1186 | Say N if you want to disable CPU hotplug and don't need to | ||
1187 | suspend. | ||
941 | 1188 | ||
942 | config COMPAT_VDSO | 1189 | config COMPAT_VDSO |
943 | bool "Compat VDSO support" | 1190 | bool "Compat VDSO support" |
944 | default y | 1191 | default y |
1192 | depends on X86_32 | ||
945 | help | 1193 | help |
946 | Map the VDSO to the predictable old-style address too. | 1194 | Map the VDSO to the predictable old-style address too. |
947 | ---help--- | 1195 | ---help--- |
@@ -955,18 +1203,35 @@ endmenu | |||
955 | 1203 | ||
956 | config ARCH_ENABLE_MEMORY_HOTPLUG | 1204 | config ARCH_ENABLE_MEMORY_HOTPLUG |
957 | def_bool y | 1205 | def_bool y |
958 | depends on HIGHMEM | 1206 | depends on X86_64 || (X86_32 && HIGHMEM) |
1207 | |||
1208 | config MEMORY_HOTPLUG_RESERVE | ||
1209 | def_bool X86_64 | ||
1210 | depends on (MEMORY_HOTPLUG && DISCONTIGMEM) | ||
1211 | |||
1212 | config HAVE_ARCH_EARLY_PFN_TO_NID | ||
1213 | def_bool X86_64 | ||
1214 | depends on NUMA | ||
959 | 1215 | ||
960 | menu "Power management options (ACPI, APM)" | 1216 | config OUT_OF_LINE_PFN_TO_PAGE |
1217 | def_bool X86_64 | ||
1218 | depends on DISCONTIGMEM | ||
1219 | |||
1220 | menu "Power management options" | ||
961 | depends on !X86_VOYAGER | 1221 | depends on !X86_VOYAGER |
962 | 1222 | ||
963 | source kernel/power/Kconfig | 1223 | config ARCH_HIBERNATION_HEADER |
1224 | bool | ||
1225 | depends on X86_64 && HIBERNATION | ||
1226 | default y | ||
1227 | |||
1228 | source "kernel/power/Kconfig" | ||
964 | 1229 | ||
965 | source "drivers/acpi/Kconfig" | 1230 | source "drivers/acpi/Kconfig" |
966 | 1231 | ||
967 | menuconfig APM | 1232 | menuconfig APM |
968 | tristate "APM (Advanced Power Management) BIOS support" | 1233 | tristate "APM (Advanced Power Management) BIOS support" |
969 | depends on PM_SLEEP && !X86_VISWS | 1234 | depends on X86_32 && PM_SLEEP && !X86_VISWS |
970 | ---help--- | 1235 | ---help--- |
971 | APM is a BIOS specification for saving power using several different | 1236 | APM is a BIOS specification for saving power using several different |
972 | techniques. This is mostly useful for battery powered laptops with | 1237 | techniques. This is mostly useful for battery powered laptops with |
@@ -1092,13 +1357,14 @@ config APM_REAL_MODE_POWER_OFF | |||
1092 | 1357 | ||
1093 | endif # APM | 1358 | endif # APM |
1094 | 1359 | ||
1095 | source "arch/x86/kernel/cpu/cpufreq/Kconfig_32" | 1360 | source "arch/x86/kernel/cpu/cpufreq/Kconfig" |
1096 | 1361 | ||
1097 | source "drivers/cpuidle/Kconfig" | 1362 | source "drivers/cpuidle/Kconfig" |
1098 | 1363 | ||
1099 | endmenu | 1364 | endmenu |
1100 | 1365 | ||
1101 | menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" | 1366 | |
1367 | menu "Bus options (PCI etc.)" | ||
1102 | 1368 | ||
1103 | config PCI | 1369 | config PCI |
1104 | bool "PCI support" if !X86_VISWS | 1370 | bool "PCI support" if !X86_VISWS |
@@ -1118,7 +1384,7 @@ config PCI | |||
1118 | 1384 | ||
1119 | choice | 1385 | choice |
1120 | prompt "PCI access mode" | 1386 | prompt "PCI access mode" |
1121 | depends on PCI && !X86_VISWS | 1387 | depends on X86_32 && PCI && !X86_VISWS |
1122 | default PCI_GOANY | 1388 | default PCI_GOANY |
1123 | ---help--- | 1389 | ---help--- |
1124 | On PCI systems, the BIOS can be used to detect the PCI devices and | 1390 | On PCI systems, the BIOS can be used to detect the PCI devices and |
@@ -1151,17 +1417,18 @@ endchoice | |||
1151 | 1417 | ||
1152 | config PCI_BIOS | 1418 | config PCI_BIOS |
1153 | bool | 1419 | bool |
1154 | depends on !X86_VISWS && PCI && (PCI_GOBIOS || PCI_GOANY) | 1420 | depends on X86_32 && !X86_VISWS && PCI && (PCI_GOBIOS || PCI_GOANY) |
1155 | default y | 1421 | default y |
1156 | 1422 | ||
1423 | # x86-64 doesn't support PCI BIOS access from long mode so always go direct. | ||
1157 | config PCI_DIRECT | 1424 | config PCI_DIRECT |
1158 | bool | 1425 | bool |
1159 | depends on PCI && ((PCI_GODIRECT || PCI_GOANY) || X86_VISWS) | 1426 | depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY) || X86_VISWS) |
1160 | default y | 1427 | default y |
1161 | 1428 | ||
1162 | config PCI_MMCONFIG | 1429 | config PCI_MMCONFIG |
1163 | bool | 1430 | bool |
1164 | depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY) | 1431 | depends on X86_32 && PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY) |
1165 | default y | 1432 | default y |
1166 | 1433 | ||
1167 | config PCI_DOMAINS | 1434 | config PCI_DOMAINS |
@@ -1169,14 +1436,52 @@ config PCI_DOMAINS | |||
1169 | depends on PCI | 1436 | depends on PCI |
1170 | default y | 1437 | default y |
1171 | 1438 | ||
1439 | config PCI_MMCONFIG | ||
1440 | bool "Support mmconfig PCI config space access" | ||
1441 | depends on X86_64 && PCI && ACPI | ||
1442 | |||
1443 | config DMAR | ||
1444 | bool "Support for DMA Remapping Devices (EXPERIMENTAL)" | ||
1445 | depends on X86_64 && PCI_MSI && ACPI && EXPERIMENTAL | ||
1446 | help | ||
1447 | DMA remapping (DMAR) devices support enables independent address | ||
1448 | translations for Direct Memory Access (DMA) from devices. | ||
1449 | These DMA remapping devices are reported via ACPI tables | ||
1450 | and include PCI device scope covered by these DMA | ||
1451 | remapping devices. | ||
1452 | |||
1453 | config DMAR_GFX_WA | ||
1454 | bool "Support for Graphics workaround" | ||
1455 | depends on DMAR | ||
1456 | default y | ||
1457 | help | ||
1458 | Current Graphics drivers tend to use physical address | ||
1459 | for DMA and avoid using DMA APIs. Setting this config | ||
1460 | option permits the IOMMU driver to set a unity map for | ||
1461 | all the OS-visible memory. Hence the driver can continue | ||
1462 | to use physical addresses for DMA. | ||
1463 | |||
1464 | config DMAR_FLOPPY_WA | ||
1465 | bool | ||
1466 | depends on DMAR | ||
1467 | default y | ||
1468 | help | ||
1469 | Floppy disk drivers are know to bypass DMA API calls | ||
1470 | thereby failing to work when IOMMU is enabled. This | ||
1471 | workaround will setup a 1:1 mapping for the first | ||
1472 | 16M to make floppy (an ISA device) work. | ||
1473 | |||
1172 | source "drivers/pci/pcie/Kconfig" | 1474 | source "drivers/pci/pcie/Kconfig" |
1173 | 1475 | ||
1174 | source "drivers/pci/Kconfig" | 1476 | source "drivers/pci/Kconfig" |
1175 | 1477 | ||
1478 | # x86_64 have no ISA slots, but do have ISA-style DMA. | ||
1176 | config ISA_DMA_API | 1479 | config ISA_DMA_API |
1177 | bool | 1480 | bool |
1178 | default y | 1481 | default y |
1179 | 1482 | ||
1483 | if X86_32 | ||
1484 | |||
1180 | config ISA | 1485 | config ISA |
1181 | bool "ISA support" | 1486 | bool "ISA support" |
1182 | depends on !(X86_VOYAGER || X86_VISWS) | 1487 | depends on !(X86_VOYAGER || X86_VISWS) |
@@ -1248,9 +1553,11 @@ config GEODE_MFGPT_TIMER | |||
1248 | MFGPTs have a better resolution and max interval than the | 1553 | MFGPTs have a better resolution and max interval than the |
1249 | generic PIT, and are suitable for use as high-res timers. | 1554 | generic PIT, and are suitable for use as high-res timers. |
1250 | 1555 | ||
1556 | endif # X86_32 | ||
1557 | |||
1251 | config K8_NB | 1558 | config K8_NB |
1252 | def_bool y | 1559 | def_bool y |
1253 | depends on AGP_AMD64 | 1560 | depends on AGP_AMD64 || (X86_64 && (GART_IOMMU || (PCI && NUMA))) |
1254 | 1561 | ||
1255 | source "drivers/pcmcia/Kconfig" | 1562 | source "drivers/pcmcia/Kconfig" |
1256 | 1563 | ||
@@ -1258,16 +1565,48 @@ source "drivers/pci/hotplug/Kconfig" | |||
1258 | 1565 | ||
1259 | endmenu | 1566 | endmenu |
1260 | 1567 | ||
1261 | menu "Executable file formats" | 1568 | |
1569 | menu "Executable file formats / Emulations" | ||
1262 | 1570 | ||
1263 | source "fs/Kconfig.binfmt" | 1571 | source "fs/Kconfig.binfmt" |
1264 | 1572 | ||
1573 | config IA32_EMULATION | ||
1574 | bool "IA32 Emulation" | ||
1575 | depends on X86_64 | ||
1576 | help | ||
1577 | Include code to run 32-bit programs under a 64-bit kernel. You should | ||
1578 | likely turn this on, unless you're 100% sure that you don't have any | ||
1579 | 32-bit programs left. | ||
1580 | |||
1581 | config IA32_AOUT | ||
1582 | tristate "IA32 a.out support" | ||
1583 | depends on IA32_EMULATION | ||
1584 | help | ||
1585 | Support old a.out binaries in the 32bit emulation. | ||
1586 | |||
1587 | config COMPAT | ||
1588 | bool | ||
1589 | depends on IA32_EMULATION | ||
1590 | default y | ||
1591 | |||
1592 | config COMPAT_FOR_U64_ALIGNMENT | ||
1593 | def_bool COMPAT | ||
1594 | depends on X86_64 | ||
1595 | |||
1596 | config SYSVIPC_COMPAT | ||
1597 | bool | ||
1598 | depends on X86_64 && COMPAT && SYSVIPC | ||
1599 | default y | ||
1600 | |||
1265 | endmenu | 1601 | endmenu |
1266 | 1602 | ||
1603 | |||
1267 | source "net/Kconfig" | 1604 | source "net/Kconfig" |
1268 | 1605 | ||
1269 | source "drivers/Kconfig" | 1606 | source "drivers/Kconfig" |
1270 | 1607 | ||
1608 | source "drivers/firmware/Kconfig" | ||
1609 | |||
1271 | source "fs/Kconfig" | 1610 | source "fs/Kconfig" |
1272 | 1611 | ||
1273 | source "kernel/Kconfig.instrumentation" | 1612 | source "kernel/Kconfig.instrumentation" |
@@ -1279,43 +1618,3 @@ source "security/Kconfig" | |||
1279 | source "crypto/Kconfig" | 1618 | source "crypto/Kconfig" |
1280 | 1619 | ||
1281 | source "lib/Kconfig" | 1620 | source "lib/Kconfig" |
1282 | |||
1283 | # | ||
1284 | # Use the generic interrupt handling code in kernel/irq/: | ||
1285 | # | ||
1286 | config GENERIC_HARDIRQS | ||
1287 | bool | ||
1288 | default y | ||
1289 | |||
1290 | config GENERIC_IRQ_PROBE | ||
1291 | bool | ||
1292 | default y | ||
1293 | |||
1294 | config GENERIC_PENDING_IRQ | ||
1295 | bool | ||
1296 | depends on GENERIC_HARDIRQS && SMP | ||
1297 | default y | ||
1298 | |||
1299 | config X86_SMP | ||
1300 | bool | ||
1301 | depends on SMP && !X86_VOYAGER | ||
1302 | default y | ||
1303 | |||
1304 | config X86_HT | ||
1305 | bool | ||
1306 | depends on SMP && !(X86_VISWS || X86_VOYAGER) | ||
1307 | default y | ||
1308 | |||
1309 | config X86_BIOS_REBOOT | ||
1310 | bool | ||
1311 | depends on !(X86_VISWS || X86_VOYAGER) | ||
1312 | default y | ||
1313 | |||
1314 | config X86_TRAMPOLINE | ||
1315 | bool | ||
1316 | depends on X86_SMP || (X86_VOYAGER && SMP) | ||
1317 | default y | ||
1318 | |||
1319 | config KTIME_SCALAR | ||
1320 | bool | ||
1321 | default y | ||
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index 0e2adadf5905..c30162202dc4 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
@@ -3,11 +3,12 @@ if !X86_ELAN | |||
3 | 3 | ||
4 | choice | 4 | choice |
5 | prompt "Processor family" | 5 | prompt "Processor family" |
6 | default M686 | 6 | default M686 if X86_32 |
7 | default GENERIC_CPU if X86_64 | ||
7 | 8 | ||
8 | config M386 | 9 | config M386 |
9 | bool "386" | 10 | bool "386" |
10 | depends on !UML | 11 | depends on X86_32 && !UML |
11 | ---help--- | 12 | ---help--- |
12 | This is the processor type of your CPU. This information is used for | 13 | This is the processor type of your CPU. This information is used for |
13 | optimizing purposes. In order to compile a kernel that can run on | 14 | optimizing purposes. In order to compile a kernel that can run on |
@@ -49,6 +50,7 @@ config M386 | |||
49 | 50 | ||
50 | config M486 | 51 | config M486 |
51 | bool "486" | 52 | bool "486" |
53 | depends on X86_32 | ||
52 | help | 54 | help |
53 | Select this for a 486 series processor, either Intel or one of the | 55 | Select this for a 486 series processor, either Intel or one of the |
54 | compatible processors from AMD, Cyrix, IBM, or Intel. Includes DX, | 56 | compatible processors from AMD, Cyrix, IBM, or Intel. Includes DX, |
@@ -57,6 +59,7 @@ config M486 | |||
57 | 59 | ||
58 | config M586 | 60 | config M586 |
59 | bool "586/K5/5x86/6x86/6x86MX" | 61 | bool "586/K5/5x86/6x86/6x86MX" |
62 | depends on X86_32 | ||
60 | help | 63 | help |
61 | Select this for an 586 or 686 series processor such as the AMD K5, | 64 | Select this for an 586 or 686 series processor such as the AMD K5, |
62 | the Cyrix 5x86, 6x86 and 6x86MX. This choice does not | 65 | the Cyrix 5x86, 6x86 and 6x86MX. This choice does not |
@@ -64,18 +67,21 @@ config M586 | |||
64 | 67 | ||
65 | config M586TSC | 68 | config M586TSC |
66 | bool "Pentium-Classic" | 69 | bool "Pentium-Classic" |
70 | depends on X86_32 | ||
67 | help | 71 | help |
68 | Select this for a Pentium Classic processor with the RDTSC (Read | 72 | Select this for a Pentium Classic processor with the RDTSC (Read |
69 | Time Stamp Counter) instruction for benchmarking. | 73 | Time Stamp Counter) instruction for benchmarking. |
70 | 74 | ||
71 | config M586MMX | 75 | config M586MMX |
72 | bool "Pentium-MMX" | 76 | bool "Pentium-MMX" |
77 | depends on X86_32 | ||
73 | help | 78 | help |
74 | Select this for a Pentium with the MMX graphics/multimedia | 79 | Select this for a Pentium with the MMX graphics/multimedia |
75 | extended instructions. | 80 | extended instructions. |
76 | 81 | ||
77 | config M686 | 82 | config M686 |
78 | bool "Pentium-Pro" | 83 | bool "Pentium-Pro" |
84 | depends on X86_32 | ||
79 | help | 85 | help |
80 | Select this for Intel Pentium Pro chips. This enables the use of | 86 | Select this for Intel Pentium Pro chips. This enables the use of |
81 | Pentium Pro extended instructions, and disables the init-time guard | 87 | Pentium Pro extended instructions, and disables the init-time guard |
@@ -83,6 +89,7 @@ config M686 | |||
83 | 89 | ||
84 | config MPENTIUMII | 90 | config MPENTIUMII |
85 | bool "Pentium-II/Celeron(pre-Coppermine)" | 91 | bool "Pentium-II/Celeron(pre-Coppermine)" |
92 | depends on X86_32 | ||
86 | help | 93 | help |
87 | Select this for Intel chips based on the Pentium-II and | 94 | Select this for Intel chips based on the Pentium-II and |
88 | pre-Coppermine Celeron core. This option enables an unaligned | 95 | pre-Coppermine Celeron core. This option enables an unaligned |
@@ -92,6 +99,7 @@ config MPENTIUMII | |||
92 | 99 | ||
93 | config MPENTIUMIII | 100 | config MPENTIUMIII |
94 | bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon" | 101 | bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon" |
102 | depends on X86_32 | ||
95 | help | 103 | help |
96 | Select this for Intel chips based on the Pentium-III and | 104 | Select this for Intel chips based on the Pentium-III and |
97 | Celeron-Coppermine core. This option enables use of some | 105 | Celeron-Coppermine core. This option enables use of some |
@@ -100,19 +108,14 @@ config MPENTIUMIII | |||
100 | 108 | ||
101 | config MPENTIUMM | 109 | config MPENTIUMM |
102 | bool "Pentium M" | 110 | bool "Pentium M" |
111 | depends on X86_32 | ||
103 | help | 112 | help |
104 | Select this for Intel Pentium M (not Pentium-4 M) | 113 | Select this for Intel Pentium M (not Pentium-4 M) |
105 | notebook chips. | 114 | notebook chips. |
106 | 115 | ||
107 | config MCORE2 | ||
108 | bool "Core 2/newer Xeon" | ||
109 | help | ||
110 | Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx) | ||
111 | CPUs. You can distinguish newer from older Xeons by the CPU family | ||
112 | in /proc/cpuinfo. Newer ones have 6 and older ones 15 (not a typo) | ||
113 | |||
114 | config MPENTIUM4 | 116 | config MPENTIUM4 |
115 | bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon" | 117 | bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon" |
118 | depends on X86_32 | ||
116 | help | 119 | help |
117 | Select this for Intel Pentium 4 chips. This includes the | 120 | Select this for Intel Pentium 4 chips. This includes the |
118 | Pentium 4, Pentium D, P4-based Celeron and Xeon, and | 121 | Pentium 4, Pentium D, P4-based Celeron and Xeon, and |
@@ -148,6 +151,7 @@ config MPENTIUM4 | |||
148 | 151 | ||
149 | config MK6 | 152 | config MK6 |
150 | bool "K6/K6-II/K6-III" | 153 | bool "K6/K6-II/K6-III" |
154 | depends on X86_32 | ||
151 | help | 155 | help |
152 | Select this for an AMD K6-family processor. Enables use of | 156 | Select this for an AMD K6-family processor. Enables use of |
153 | some extended instructions, and passes appropriate optimization | 157 | some extended instructions, and passes appropriate optimization |
@@ -155,6 +159,7 @@ config MK6 | |||
155 | 159 | ||
156 | config MK7 | 160 | config MK7 |
157 | bool "Athlon/Duron/K7" | 161 | bool "Athlon/Duron/K7" |
162 | depends on X86_32 | ||
158 | help | 163 | help |
159 | Select this for an AMD Athlon K7-family processor. Enables use of | 164 | Select this for an AMD Athlon K7-family processor. Enables use of |
160 | some extended instructions, and passes appropriate optimization | 165 | some extended instructions, and passes appropriate optimization |
@@ -169,6 +174,7 @@ config MK8 | |||
169 | 174 | ||
170 | config MCRUSOE | 175 | config MCRUSOE |
171 | bool "Crusoe" | 176 | bool "Crusoe" |
177 | depends on X86_32 | ||
172 | help | 178 | help |
173 | Select this for a Transmeta Crusoe processor. Treats the processor | 179 | Select this for a Transmeta Crusoe processor. Treats the processor |
174 | like a 586 with TSC, and sets some GCC optimization flags (like a | 180 | like a 586 with TSC, and sets some GCC optimization flags (like a |
@@ -176,11 +182,13 @@ config MCRUSOE | |||
176 | 182 | ||
177 | config MEFFICEON | 183 | config MEFFICEON |
178 | bool "Efficeon" | 184 | bool "Efficeon" |
185 | depends on X86_32 | ||
179 | help | 186 | help |
180 | Select this for a Transmeta Efficeon processor. | 187 | Select this for a Transmeta Efficeon processor. |
181 | 188 | ||
182 | config MWINCHIPC6 | 189 | config MWINCHIPC6 |
183 | bool "Winchip-C6" | 190 | bool "Winchip-C6" |
191 | depends on X86_32 | ||
184 | help | 192 | help |
185 | Select this for an IDT Winchip C6 chip. Linux and GCC | 193 | Select this for an IDT Winchip C6 chip. Linux and GCC |
186 | treat this chip as a 586TSC with some extended instructions | 194 | treat this chip as a 586TSC with some extended instructions |
@@ -188,6 +196,7 @@ config MWINCHIPC6 | |||
188 | 196 | ||
189 | config MWINCHIP2 | 197 | config MWINCHIP2 |
190 | bool "Winchip-2" | 198 | bool "Winchip-2" |
199 | depends on X86_32 | ||
191 | help | 200 | help |
192 | Select this for an IDT Winchip-2. Linux and GCC | 201 | Select this for an IDT Winchip-2. Linux and GCC |
193 | treat this chip as a 586TSC with some extended instructions | 202 | treat this chip as a 586TSC with some extended instructions |
@@ -195,6 +204,7 @@ config MWINCHIP2 | |||
195 | 204 | ||
196 | config MWINCHIP3D | 205 | config MWINCHIP3D |
197 | bool "Winchip-2A/Winchip-3" | 206 | bool "Winchip-2A/Winchip-3" |
207 | depends on X86_32 | ||
198 | help | 208 | help |
199 | Select this for an IDT Winchip-2A or 3. Linux and GCC | 209 | Select this for an IDT Winchip-2A or 3. Linux and GCC |
200 | treat this chip as a 586TSC with some extended instructions | 210 | treat this chip as a 586TSC with some extended instructions |
@@ -204,16 +214,19 @@ config MWINCHIP3D | |||
204 | 214 | ||
205 | config MGEODEGX1 | 215 | config MGEODEGX1 |
206 | bool "GeodeGX1" | 216 | bool "GeodeGX1" |
217 | depends on X86_32 | ||
207 | help | 218 | help |
208 | Select this for a Geode GX1 (Cyrix MediaGX) chip. | 219 | Select this for a Geode GX1 (Cyrix MediaGX) chip. |
209 | 220 | ||
210 | config MGEODE_LX | 221 | config MGEODE_LX |
211 | bool "Geode GX/LX" | 222 | bool "Geode GX/LX" |
223 | depends on X86_32 | ||
212 | help | 224 | help |
213 | Select this for AMD Geode GX and LX processors. | 225 | Select this for AMD Geode GX and LX processors. |
214 | 226 | ||
215 | config MCYRIXIII | 227 | config MCYRIXIII |
216 | bool "CyrixIII/VIA-C3" | 228 | bool "CyrixIII/VIA-C3" |
229 | depends on X86_32 | ||
217 | help | 230 | help |
218 | Select this for a Cyrix III or C3 chip. Presently Linux and GCC | 231 | Select this for a Cyrix III or C3 chip. Presently Linux and GCC |
219 | treat this chip as a generic 586. Whilst the CPU is 686 class, | 232 | treat this chip as a generic 586. Whilst the CPU is 686 class, |
@@ -225,6 +238,7 @@ config MCYRIXIII | |||
225 | 238 | ||
226 | config MVIAC3_2 | 239 | config MVIAC3_2 |
227 | bool "VIA C3-2 (Nehemiah)" | 240 | bool "VIA C3-2 (Nehemiah)" |
241 | depends on X86_32 | ||
228 | help | 242 | help |
229 | Select this for a VIA C3 "Nehemiah". Selecting this enables usage | 243 | Select this for a VIA C3 "Nehemiah". Selecting this enables usage |
230 | of SSE and tells gcc to treat the CPU as a 686. | 244 | of SSE and tells gcc to treat the CPU as a 686. |
@@ -232,15 +246,42 @@ config MVIAC3_2 | |||
232 | 246 | ||
233 | config MVIAC7 | 247 | config MVIAC7 |
234 | bool "VIA C7" | 248 | bool "VIA C7" |
249 | depends on X86_32 | ||
235 | help | 250 | help |
236 | Select this for a VIA C7. Selecting this uses the correct cache | 251 | Select this for a VIA C7. Selecting this uses the correct cache |
237 | shift and tells gcc to treat the CPU as a 686. | 252 | shift and tells gcc to treat the CPU as a 686. |
238 | 253 | ||
254 | config MPSC | ||
255 | bool "Intel P4 / older Netburst based Xeon" | ||
256 | depends on X86_64 | ||
257 | help | ||
258 | Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey | ||
259 | Xeon CPUs with Intel 64bit which is compatible with x86-64. | ||
260 | Note that the latest Xeons (Xeon 51xx and 53xx) are not based on the | ||
261 | Netburst core and shouldn't use this option. You can distinguish them | ||
262 | using the cpu family field | ||
263 | in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one. | ||
264 | |||
265 | config MCORE2 | ||
266 | bool "Core 2/newer Xeon" | ||
267 | help | ||
268 | Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx) | ||
269 | CPUs. You can distinguish newer from older Xeons by the CPU family | ||
270 | in /proc/cpuinfo. Newer ones have 6 and older ones 15 (not a typo) | ||
271 | |||
272 | config GENERIC_CPU | ||
273 | bool "Generic-x86-64" | ||
274 | depends on X86_64 | ||
275 | help | ||
276 | Generic x86-64 CPU. | ||
277 | Run equally well on all x86-64 CPUs. | ||
278 | |||
239 | endchoice | 279 | endchoice |
240 | 280 | ||
241 | config X86_GENERIC | 281 | config X86_GENERIC |
242 | bool "Generic x86 support" | 282 | bool "Generic x86 support" |
243 | help | 283 | depends on X86_32 |
284 | help | ||
244 | Instead of just including optimizations for the selected | 285 | Instead of just including optimizations for the selected |
245 | x86 variant (e.g. PII, Crusoe or Athlon), include some more | 286 | x86 variant (e.g. PII, Crusoe or Athlon), include some more |
246 | generic optimizations as well. This will make the kernel | 287 | generic optimizations as well. This will make the kernel |
@@ -253,44 +294,31 @@ endif | |||
253 | 294 | ||
254 | # | 295 | # |
255 | # Define implied options from the CPU selection here | 296 | # Define implied options from the CPU selection here |
256 | # | 297 | config X86_L1_CACHE_BYTES |
298 | int | ||
299 | default "128" if GENERIC_CPU || MPSC | ||
300 | default "64" if MK8 || MCORE2 | ||
301 | depends on X86_64 | ||
302 | |||
303 | config X86_INTERNODE_CACHE_BYTES | ||
304 | int | ||
305 | default "4096" if X86_VSMP | ||
306 | default X86_L1_CACHE_BYTES if !X86_VSMP | ||
307 | depends on X86_64 | ||
308 | |||
257 | config X86_CMPXCHG | 309 | config X86_CMPXCHG |
258 | bool | 310 | def_bool X86_64 || (X86_32 && !M386) |
259 | depends on !M386 | ||
260 | default y | ||
261 | 311 | ||
262 | config X86_L1_CACHE_SHIFT | 312 | config X86_L1_CACHE_SHIFT |
263 | int | 313 | int |
264 | default "7" if MPENTIUM4 || X86_GENERIC | 314 | default "7" if MPENTIUM4 || X86_GENERIC || GENERIC_CPU || MPSC |
265 | default "4" if X86_ELAN || M486 || M386 || MGEODEGX1 | 315 | default "4" if X86_ELAN || M486 || M386 || MGEODEGX1 |
266 | default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX | 316 | default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX |
267 | default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MVIAC7 | 317 | default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MVIAC7 |
268 | 318 | ||
269 | config X86_XADD | 319 | config X86_XADD |
270 | bool | 320 | bool |
271 | depends on !M386 | 321 | depends on X86_32 && !M386 |
272 | default y | ||
273 | |||
274 | config RWSEM_GENERIC_SPINLOCK | ||
275 | bool | ||
276 | depends on !X86_XADD | ||
277 | default y | ||
278 | |||
279 | config RWSEM_XCHGADD_ALGORITHM | ||
280 | bool | ||
281 | depends on X86_XADD | ||
282 | default y | ||
283 | |||
284 | config ARCH_HAS_ILOG2_U32 | ||
285 | bool | ||
286 | default n | ||
287 | |||
288 | config ARCH_HAS_ILOG2_U64 | ||
289 | bool | ||
290 | default n | ||
291 | |||
292 | config GENERIC_CALIBRATE_DELAY | ||
293 | bool | ||
294 | default y | 322 | default y |
295 | 323 | ||
296 | config X86_PPRO_FENCE | 324 | config X86_PPRO_FENCE |
@@ -305,22 +333,22 @@ config X86_F00F_BUG | |||
305 | 333 | ||
306 | config X86_WP_WORKS_OK | 334 | config X86_WP_WORKS_OK |
307 | bool | 335 | bool |
308 | depends on !M386 | 336 | depends on X86_32 && !M386 |
309 | default y | 337 | default y |
310 | 338 | ||
311 | config X86_INVLPG | 339 | config X86_INVLPG |
312 | bool | 340 | bool |
313 | depends on !M386 | 341 | depends on X86_32 && !M386 |
314 | default y | 342 | default y |
315 | 343 | ||
316 | config X86_BSWAP | 344 | config X86_BSWAP |
317 | bool | 345 | bool |
318 | depends on !M386 | 346 | depends on X86_32 && !M386 |
319 | default y | 347 | default y |
320 | 348 | ||
321 | config X86_POPAD_OK | 349 | config X86_POPAD_OK |
322 | bool | 350 | bool |
323 | depends on !M386 | 351 | depends on X86_32 && !M386 |
324 | default y | 352 | default y |
325 | 353 | ||
326 | config X86_ALIGNMENT_16 | 354 | config X86_ALIGNMENT_16 |
@@ -330,7 +358,7 @@ config X86_ALIGNMENT_16 | |||
330 | 358 | ||
331 | config X86_GOOD_APIC | 359 | config X86_GOOD_APIC |
332 | bool | 360 | bool |
333 | depends on MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 || MEFFICEON || MCORE2 || MVIAC7 | 361 | depends on MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 || MEFFICEON || MCORE2 || MVIAC7 || X86_64 |
334 | default y | 362 | default y |
335 | 363 | ||
336 | config X86_INTEL_USERCOPY | 364 | config X86_INTEL_USERCOPY |
@@ -355,7 +383,7 @@ config X86_OOSTORE | |||
355 | 383 | ||
356 | config X86_TSC | 384 | config X86_TSC |
357 | bool | 385 | bool |
358 | depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ | 386 | depends on ((MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ) || X86_64 |
359 | default y | 387 | default y |
360 | 388 | ||
361 | # this should be set for all -march=.. options where the compiler | 389 | # this should be set for all -march=.. options where the compiler |
@@ -367,6 +395,7 @@ config X86_CMOV | |||
367 | 395 | ||
368 | config X86_MINIMUM_CPU_FAMILY | 396 | config X86_MINIMUM_CPU_FAMILY |
369 | int | 397 | int |
370 | default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK | 398 | default "64" if X86_64 |
399 | default "4" if X86_32 && (X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK) | ||
371 | default "3" | 400 | default "3" |
372 | 401 | ||
diff --git a/arch/x86/Kconfig.x86_64 b/arch/x86/Kconfig.x86_64 deleted file mode 100644 index cc468ea61240..000000000000 --- a/arch/x86/Kconfig.x86_64 +++ /dev/null | |||
@@ -1,839 +0,0 @@ | |||
1 | # | ||
2 | # For a description of the syntax of this configuration file, | ||
3 | # see Documentation/kbuild/kconfig-language.txt. | ||
4 | # | ||
5 | # Note: ISA is disabled and will hopefully never be enabled. | ||
6 | # If you managed to buy an ISA x86-64 box you'll have to fix all the | ||
7 | # ISA drivers you need yourself. | ||
8 | # | ||
9 | |||
10 | mainmenu "Linux Kernel Configuration" | ||
11 | |||
12 | config X86_64 | ||
13 | bool | ||
14 | default y | ||
15 | help | ||
16 | Port to the x86-64 architecture. x86-64 is a 64-bit extension to the | ||
17 | classical 32-bit x86 architecture. For details see | ||
18 | <http://www.x86-64.org/>. | ||
19 | |||
20 | config 64BIT | ||
21 | def_bool y | ||
22 | |||
23 | config X86 | ||
24 | bool | ||
25 | default y | ||
26 | |||
27 | config GENERIC_TIME | ||
28 | bool | ||
29 | default y | ||
30 | |||
31 | config GENERIC_TIME_VSYSCALL | ||
32 | bool | ||
33 | default y | ||
34 | |||
35 | config GENERIC_CMOS_UPDATE | ||
36 | bool | ||
37 | default y | ||
38 | |||
39 | config CLOCKSOURCE_WATCHDOG | ||
40 | bool | ||
41 | default y | ||
42 | |||
43 | config GENERIC_CLOCKEVENTS | ||
44 | bool | ||
45 | default y | ||
46 | |||
47 | config GENERIC_CLOCKEVENTS_BROADCAST | ||
48 | bool | ||
49 | default y | ||
50 | |||
51 | config ZONE_DMA32 | ||
52 | bool | ||
53 | default y | ||
54 | |||
55 | config LOCKDEP_SUPPORT | ||
56 | bool | ||
57 | default y | ||
58 | |||
59 | config STACKTRACE_SUPPORT | ||
60 | bool | ||
61 | default y | ||
62 | |||
63 | config SEMAPHORE_SLEEPERS | ||
64 | bool | ||
65 | default y | ||
66 | |||
67 | config MMU | ||
68 | bool | ||
69 | default y | ||
70 | |||
71 | config ZONE_DMA | ||
72 | bool | ||
73 | default y | ||
74 | |||
75 | config ISA | ||
76 | bool | ||
77 | |||
78 | config SBUS | ||
79 | bool | ||
80 | |||
81 | config RWSEM_GENERIC_SPINLOCK | ||
82 | bool | ||
83 | default y | ||
84 | |||
85 | config RWSEM_XCHGADD_ALGORITHM | ||
86 | bool | ||
87 | |||
88 | config GENERIC_HWEIGHT | ||
89 | bool | ||
90 | default y | ||
91 | |||
92 | config GENERIC_CALIBRATE_DELAY | ||
93 | bool | ||
94 | default y | ||
95 | |||
96 | config X86_CMPXCHG | ||
97 | bool | ||
98 | default y | ||
99 | |||
100 | config GENERIC_ISA_DMA | ||
101 | bool | ||
102 | default y | ||
103 | |||
104 | config GENERIC_IOMAP | ||
105 | bool | ||
106 | default y | ||
107 | |||
108 | config ARCH_MAY_HAVE_PC_FDC | ||
109 | bool | ||
110 | default y | ||
111 | |||
112 | config ARCH_POPULATES_NODE_MAP | ||
113 | def_bool y | ||
114 | |||
115 | config DMI | ||
116 | bool | ||
117 | default y | ||
118 | |||
119 | config AUDIT_ARCH | ||
120 | bool | ||
121 | default y | ||
122 | |||
123 | config GENERIC_BUG | ||
124 | bool | ||
125 | default y | ||
126 | depends on BUG | ||
127 | |||
128 | config ARCH_HAS_ILOG2_U32 | ||
129 | bool | ||
130 | default n | ||
131 | |||
132 | config ARCH_HAS_ILOG2_U64 | ||
133 | bool | ||
134 | default n | ||
135 | |||
136 | source "init/Kconfig" | ||
137 | |||
138 | |||
139 | menu "Processor type and features" | ||
140 | |||
141 | source "kernel/time/Kconfig" | ||
142 | |||
143 | choice | ||
144 | prompt "Subarchitecture Type" | ||
145 | default X86_PC | ||
146 | |||
147 | config X86_PC | ||
148 | bool "PC-compatible" | ||
149 | help | ||
150 | Choose this option if your computer is a standard PC or compatible. | ||
151 | |||
152 | config X86_VSMP | ||
153 | bool "Support for ScaleMP vSMP" | ||
154 | depends on PCI | ||
155 | help | ||
156 | Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is | ||
157 | supposed to run on these EM64T-based machines. Only choose this option | ||
158 | if you have one of these machines. | ||
159 | |||
160 | endchoice | ||
161 | |||
162 | choice | ||
163 | prompt "Processor family" | ||
164 | default GENERIC_CPU | ||
165 | |||
166 | config MK8 | ||
167 | bool "AMD-Opteron/Athlon64" | ||
168 | help | ||
169 | Optimize for AMD Opteron/Athlon64/Hammer/K8 CPUs. | ||
170 | |||
171 | config MPSC | ||
172 | bool "Intel P4 / older Netburst based Xeon" | ||
173 | help | ||
174 | Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey | ||
175 | Xeon CPUs with Intel 64bit which is compatible with x86-64. | ||
176 | Note that the latest Xeons (Xeon 51xx and 53xx) are not based on the | ||
177 | Netburst core and shouldn't use this option. You can distinguish them | ||
178 | using the cpu family field | ||
179 | in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one. | ||
180 | |||
181 | config MCORE2 | ||
182 | bool "Intel Core2 / newer Xeon" | ||
183 | help | ||
184 | Optimize for Intel Core2 and newer Xeons (51xx) | ||
185 | You can distinguish the newer Xeons from the older ones using | ||
186 | the cpu family field in /proc/cpuinfo. 15 is an older Xeon | ||
187 | (use CONFIG_MPSC then), 6 is a newer one. | ||
188 | |||
189 | config GENERIC_CPU | ||
190 | bool "Generic-x86-64" | ||
191 | help | ||
192 | Generic x86-64 CPU. | ||
193 | Run equally well on all x86-64 CPUs. | ||
194 | |||
195 | endchoice | ||
196 | |||
197 | # | ||
198 | # Define implied options from the CPU selection here | ||
199 | # | ||
200 | config X86_L1_CACHE_BYTES | ||
201 | int | ||
202 | default "128" if GENERIC_CPU || MPSC | ||
203 | default "64" if MK8 || MCORE2 | ||
204 | |||
205 | config X86_L1_CACHE_SHIFT | ||
206 | int | ||
207 | default "7" if GENERIC_CPU || MPSC | ||
208 | default "6" if MK8 || MCORE2 | ||
209 | |||
210 | config X86_INTERNODE_CACHE_BYTES | ||
211 | int | ||
212 | default "4096" if X86_VSMP | ||
213 | default X86_L1_CACHE_BYTES if !X86_VSMP | ||
214 | |||
215 | config X86_TSC | ||
216 | bool | ||
217 | default y | ||
218 | |||
219 | config X86_GOOD_APIC | ||
220 | bool | ||
221 | default y | ||
222 | |||
223 | config MICROCODE | ||
224 | tristate "/dev/cpu/microcode - Intel CPU microcode support" | ||
225 | select FW_LOADER | ||
226 | ---help--- | ||
227 | If you say Y here the 'File systems' section, you will be | ||
228 | able to update the microcode on Intel processors. You will | ||
229 | obviously need the actual microcode binary data itself which is | ||
230 | not shipped with the Linux kernel. | ||
231 | |||
232 | For latest news and information on obtaining all the required | ||
233 | ingredients for this driver, check: | ||
234 | <http://www.urbanmyth.org/microcode/>. | ||
235 | |||
236 | To compile this driver as a module, choose M here: the | ||
237 | module will be called microcode. | ||
238 | If you use modprobe or kmod you may also want to add the line | ||
239 | 'alias char-major-10-184 microcode' to your /etc/modules.conf file. | ||
240 | |||
241 | config MICROCODE_OLD_INTERFACE | ||
242 | bool | ||
243 | depends on MICROCODE | ||
244 | default y | ||
245 | |||
246 | config X86_MSR | ||
247 | tristate "/dev/cpu/*/msr - Model-specific register support" | ||
248 | help | ||
249 | This device gives privileged processes access to the x86 | ||
250 | Model-Specific Registers (MSRs). It is a character device with | ||
251 | major 202 and minors 0 to 31 for /dev/cpu/0/msr to /dev/cpu/31/msr. | ||
252 | MSR accesses are directed to a specific CPU on multi-processor | ||
253 | systems. | ||
254 | |||
255 | config X86_CPUID | ||
256 | tristate "/dev/cpu/*/cpuid - CPU information support" | ||
257 | help | ||
258 | This device gives processes access to the x86 CPUID instruction to | ||
259 | be executed on a specific processor. It is a character device | ||
260 | with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to | ||
261 | /dev/cpu/31/cpuid. | ||
262 | |||
263 | config X86_HT | ||
264 | bool | ||
265 | depends on SMP && !MK8 | ||
266 | default y | ||
267 | |||
268 | config MATH_EMULATION | ||
269 | bool | ||
270 | |||
271 | config MCA | ||
272 | bool | ||
273 | |||
274 | config EISA | ||
275 | bool | ||
276 | |||
277 | config X86_IO_APIC | ||
278 | bool | ||
279 | default y | ||
280 | |||
281 | config X86_LOCAL_APIC | ||
282 | bool | ||
283 | default y | ||
284 | |||
285 | config MTRR | ||
286 | bool "MTRR (Memory Type Range Register) support" | ||
287 | ---help--- | ||
288 | On Intel P6 family processors (Pentium Pro, Pentium II and later) | ||
289 | the Memory Type Range Registers (MTRRs) may be used to control | ||
290 | processor access to memory ranges. This is most useful if you have | ||
291 | a video (VGA) card on a PCI or AGP bus. Enabling write-combining | ||
292 | allows bus write transfers to be combined into a larger transfer | ||
293 | before bursting over the PCI/AGP bus. This can increase performance | ||
294 | of image write operations 2.5 times or more. Saying Y here creates a | ||
295 | /proc/mtrr file which may be used to manipulate your processor's | ||
296 | MTRRs. Typically the X server should use this. | ||
297 | |||
298 | This code has a reasonably generic interface so that similar | ||
299 | control registers on other processors can be easily supported | ||
300 | as well. | ||
301 | |||
302 | Saying Y here also fixes a problem with buggy SMP BIOSes which only | ||
303 | set the MTRRs for the boot CPU and not for the secondary CPUs. This | ||
304 | can lead to all sorts of problems, so it's good to say Y here. | ||
305 | |||
306 | Just say Y here, all x86-64 machines support MTRRs. | ||
307 | |||
308 | See <file:Documentation/mtrr.txt> for more information. | ||
309 | |||
310 | config SMP | ||
311 | bool "Symmetric multi-processing support" | ||
312 | ---help--- | ||
313 | This enables support for systems with more than one CPU. If you have | ||
314 | a system with only one CPU, like most personal computers, say N. If | ||
315 | you have a system with more than one CPU, say Y. | ||
316 | |||
317 | If you say N here, the kernel will run on single and multiprocessor | ||
318 | machines, but will use only one CPU of a multiprocessor machine. If | ||
319 | you say Y here, the kernel will run on many, but not all, | ||
320 | singleprocessor machines. On a singleprocessor machine, the kernel | ||
321 | will run faster if you say N here. | ||
322 | |||
323 | If you don't know what to do here, say N. | ||
324 | |||
325 | config SCHED_SMT | ||
326 | bool "SMT (Hyperthreading) scheduler support" | ||
327 | depends on SMP | ||
328 | default n | ||
329 | help | ||
330 | SMT scheduler support improves the CPU scheduler's decision making | ||
331 | when dealing with Intel Pentium 4 chips with HyperThreading at a | ||
332 | cost of slightly increased overhead in some places. If unsure say | ||
333 | N here. | ||
334 | |||
335 | config SCHED_MC | ||
336 | bool "Multi-core scheduler support" | ||
337 | depends on SMP | ||
338 | default y | ||
339 | help | ||
340 | Multi-core scheduler support improves the CPU scheduler's decision | ||
341 | making when dealing with multi-core CPU chips at a cost of slightly | ||
342 | increased overhead in some places. If unsure say N here. | ||
343 | |||
344 | source "kernel/Kconfig.preempt" | ||
345 | |||
346 | config NUMA | ||
347 | bool "Non Uniform Memory Access (NUMA) Support" | ||
348 | depends on SMP | ||
349 | help | ||
350 | Enable NUMA (Non Uniform Memory Access) support. The kernel | ||
351 | will try to allocate memory used by a CPU on the local memory | ||
352 | controller of the CPU and add some more NUMA awareness to the kernel. | ||
353 | This code is recommended on all multiprocessor Opteron systems. | ||
354 | If the system is EM64T, you should say N unless your system is EM64T | ||
355 | NUMA. | ||
356 | |||
357 | config K8_NUMA | ||
358 | bool "Old style AMD Opteron NUMA detection" | ||
359 | depends on NUMA && PCI | ||
360 | default y | ||
361 | help | ||
362 | Enable K8 NUMA node topology detection. You should say Y here if | ||
363 | you have a multi processor AMD K8 system. This uses an old | ||
364 | method to read the NUMA configuration directly from the builtin | ||
365 | Northbridge of Opteron. It is recommended to use X86_64_ACPI_NUMA | ||
366 | instead, which also takes priority if both are compiled in. | ||
367 | |||
368 | config NODES_SHIFT | ||
369 | int | ||
370 | default "6" | ||
371 | depends on NEED_MULTIPLE_NODES | ||
372 | |||
373 | # Dummy CONFIG option to select ACPI_NUMA from drivers/acpi/Kconfig. | ||
374 | |||
375 | config X86_64_ACPI_NUMA | ||
376 | bool "ACPI NUMA detection" | ||
377 | depends on NUMA | ||
378 | select ACPI | ||
379 | select PCI | ||
380 | select ACPI_NUMA | ||
381 | default y | ||
382 | help | ||
383 | Enable ACPI SRAT based node topology detection. | ||
384 | |||
385 | config NUMA_EMU | ||
386 | bool "NUMA emulation" | ||
387 | depends on NUMA | ||
388 | help | ||
389 | Enable NUMA emulation. A flat machine will be split | ||
390 | into virtual nodes when booted with "numa=fake=N", where N is the | ||
391 | number of nodes. This is only useful for debugging. | ||
392 | |||
393 | config ARCH_DISCONTIGMEM_ENABLE | ||
394 | bool | ||
395 | depends on NUMA | ||
396 | default y | ||
397 | |||
398 | config ARCH_DISCONTIGMEM_DEFAULT | ||
399 | def_bool y | ||
400 | depends on NUMA | ||
401 | |||
402 | config ARCH_SPARSEMEM_ENABLE | ||
403 | def_bool y | ||
404 | depends on (NUMA || EXPERIMENTAL) | ||
405 | select SPARSEMEM_VMEMMAP_ENABLE | ||
406 | |||
407 | config ARCH_MEMORY_PROBE | ||
408 | def_bool y | ||
409 | depends on MEMORY_HOTPLUG | ||
410 | |||
411 | config ARCH_FLATMEM_ENABLE | ||
412 | def_bool y | ||
413 | depends on !NUMA | ||
414 | |||
415 | source "mm/Kconfig" | ||
416 | |||
417 | config MEMORY_HOTPLUG_RESERVE | ||
418 | def_bool y | ||
419 | depends on (MEMORY_HOTPLUG && DISCONTIGMEM) | ||
420 | |||
421 | config HAVE_ARCH_EARLY_PFN_TO_NID | ||
422 | def_bool y | ||
423 | depends on NUMA | ||
424 | |||
425 | config OUT_OF_LINE_PFN_TO_PAGE | ||
426 | def_bool y | ||
427 | depends on DISCONTIGMEM | ||
428 | |||
429 | config NR_CPUS | ||
430 | int "Maximum number of CPUs (2-255)" | ||
431 | range 2 255 | ||
432 | depends on SMP | ||
433 | default "8" | ||
434 | help | ||
435 | This allows you to specify the maximum number of CPUs which this | ||
436 | kernel will support. Current maximum is 255 CPUs due to | ||
437 | APIC addressing limits. Less depending on the hardware. | ||
438 | |||
439 | This is purely to save memory - each supported CPU requires | ||
440 | memory in the static kernel configuration. | ||
441 | |||
442 | config PHYSICAL_ALIGN | ||
443 | hex | ||
444 | default "0x200000" | ||
445 | |||
446 | config HOTPLUG_CPU | ||
447 | bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)" | ||
448 | depends on SMP && HOTPLUG && EXPERIMENTAL | ||
449 | help | ||
450 | Say Y here to experiment with turning CPUs off and on. CPUs | ||
451 | can be controlled through /sys/devices/system/cpu/cpu#. | ||
452 | This is also required for suspend/hibernation on SMP systems. | ||
453 | |||
454 | Say N if you want to disable CPU hotplug and don't need to | ||
455 | suspend. | ||
456 | |||
457 | config ARCH_ENABLE_MEMORY_HOTPLUG | ||
458 | def_bool y | ||
459 | |||
460 | config HPET_TIMER | ||
461 | bool | ||
462 | default y | ||
463 | help | ||
464 | Use the IA-PC HPET (High Precision Event Timer) to manage | ||
465 | time in preference to the PIT and RTC, if a HPET is | ||
466 | present. The HPET provides a stable time base on SMP | ||
467 | systems, unlike the TSC, but it is more expensive to access, | ||
468 | as it is off-chip. You can find the HPET spec at | ||
469 | <http://www.intel.com/hardwaredesign/hpetspec.htm>. | ||
470 | |||
471 | config HPET_EMULATE_RTC | ||
472 | bool | ||
473 | depends on HPET_TIMER && RTC=y | ||
474 | default y | ||
475 | |||
476 | # Mark as embedded because too many people got it wrong. | ||
477 | # The code disables itself when not needed. | ||
478 | config GART_IOMMU | ||
479 | bool "GART IOMMU support" if EMBEDDED | ||
480 | default y | ||
481 | select SWIOTLB | ||
482 | select AGP | ||
483 | depends on PCI | ||
484 | help | ||
485 | Support for full DMA access of devices with 32bit memory access only | ||
486 | on systems with more than 3GB. This is usually needed for USB, | ||
487 | sound, many IDE/SATA chipsets and some other devices. | ||
488 | Provides a driver for the AMD Athlon64/Opteron/Turion/Sempron GART | ||
489 | based hardware IOMMU and a software bounce buffer based IOMMU used | ||
490 | on Intel systems and as fallback. | ||
491 | The code is only active when needed (enough memory and limited | ||
492 | device) unless CONFIG_IOMMU_DEBUG or iommu=force is specified | ||
493 | too. | ||
494 | |||
495 | config CALGARY_IOMMU | ||
496 | bool "IBM Calgary IOMMU support" | ||
497 | select SWIOTLB | ||
498 | depends on PCI && EXPERIMENTAL | ||
499 | help | ||
500 | Support for hardware IOMMUs in IBM's xSeries x366 and x460 | ||
501 | systems. Needed to run systems with more than 3GB of memory | ||
502 | properly with 32-bit PCI devices that do not support DAC | ||
503 | (Double Address Cycle). Calgary also supports bus level | ||
504 | isolation, where all DMAs pass through the IOMMU. This | ||
505 | prevents them from going anywhere except their intended | ||
506 | destination. This catches hard-to-find kernel bugs and | ||
507 | mis-behaving drivers and devices that do not use the DMA-API | ||
508 | properly to set up their DMA buffers. The IOMMU can be | ||
509 | turned off at boot time with the iommu=off parameter. | ||
510 | Normally the kernel will make the right choice by itself. | ||
511 | If unsure, say Y. | ||
512 | |||
513 | config CALGARY_IOMMU_ENABLED_BY_DEFAULT | ||
514 | bool "Should Calgary be enabled by default?" | ||
515 | default y | ||
516 | depends on CALGARY_IOMMU | ||
517 | help | ||
518 | Should Calgary be enabled by default? if you choose 'y', Calgary | ||
519 | will be used (if it exists). If you choose 'n', Calgary will not be | ||
520 | used even if it exists. If you choose 'n' and would like to use | ||
521 | Calgary anyway, pass 'iommu=calgary' on the kernel command line. | ||
522 | If unsure, say Y. | ||
523 | |||
524 | # need this always selected by IOMMU for the VIA workaround | ||
525 | config SWIOTLB | ||
526 | bool | ||
527 | help | ||
528 | Support for software bounce buffers used on x86-64 systems | ||
529 | which don't have a hardware IOMMU (e.g. the current generation | ||
530 | of Intel's x86-64 CPUs). Using this PCI devices which can only | ||
531 | access 32-bits of memory can be used on systems with more than | ||
532 | 3 GB of memory. If unsure, say Y. | ||
533 | |||
534 | config X86_MCE | ||
535 | bool "Machine check support" if EMBEDDED | ||
536 | default y | ||
537 | help | ||
538 | Include a machine check error handler to report hardware errors. | ||
539 | This version will require the mcelog utility to decode some | ||
540 | machine check error logs. See | ||
541 | ftp://ftp.x86-64.org/pub/linux/tools/mcelog | ||
542 | |||
543 | config X86_MCE_INTEL | ||
544 | bool "Intel MCE features" | ||
545 | depends on X86_MCE && X86_LOCAL_APIC | ||
546 | default y | ||
547 | help | ||
548 | Additional support for intel specific MCE features such as | ||
549 | the thermal monitor. | ||
550 | |||
551 | config X86_MCE_AMD | ||
552 | bool "AMD MCE features" | ||
553 | depends on X86_MCE && X86_LOCAL_APIC | ||
554 | default y | ||
555 | help | ||
556 | Additional support for AMD specific MCE features such as | ||
557 | the DRAM Error Threshold. | ||
558 | |||
559 | config KEXEC | ||
560 | bool "kexec system call" | ||
561 | help | ||
562 | kexec is a system call that implements the ability to shutdown your | ||
563 | current kernel, and to start another kernel. It is like a reboot | ||
564 | but it is independent of the system firmware. And like a reboot | ||
565 | you can start any kernel with it, not just Linux. | ||
566 | |||
567 | The name comes from the similarity to the exec system call. | ||
568 | |||
569 | It is an ongoing process to be certain the hardware in a machine | ||
570 | is properly shutdown, so do not be surprised if this code does not | ||
571 | initially work for you. It may help to enable device hotplugging | ||
572 | support. As of this writing the exact hardware interface is | ||
573 | strongly in flux, so no good recommendation can be made. | ||
574 | |||
575 | config CRASH_DUMP | ||
576 | bool "kernel crash dumps (EXPERIMENTAL)" | ||
577 | depends on EXPERIMENTAL | ||
578 | help | ||
579 | Generate crash dump after being started by kexec. | ||
580 | This should be normally only set in special crash dump kernels | ||
581 | which are loaded in the main kernel with kexec-tools into | ||
582 | a specially reserved region and then later executed after | ||
583 | a crash by kdump/kexec. The crash dump kernel must be compiled | ||
584 | to a memory address not used by the main kernel or BIOS using | ||
585 | PHYSICAL_START, or it must be built as a relocatable image | ||
586 | (CONFIG_RELOCATABLE=y). | ||
587 | For more details see Documentation/kdump/kdump.txt | ||
588 | |||
589 | config RELOCATABLE | ||
590 | bool "Build a relocatable kernel (EXPERIMENTAL)" | ||
591 | depends on EXPERIMENTAL | ||
592 | help | ||
593 | Builds a relocatable kernel. This enables loading and running | ||
594 | a kernel binary from a different physical address than it has | ||
595 | been compiled for. | ||
596 | |||
597 | One use is for the kexec on panic case where the recovery kernel | ||
598 | must live at a different physical address than the primary | ||
599 | kernel. | ||
600 | |||
601 | Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address | ||
602 | it has been loaded at and the compile time physical address | ||
603 | (CONFIG_PHYSICAL_START) is ignored. | ||
604 | |||
605 | config PHYSICAL_START | ||
606 | hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) | ||
607 | default "0x200000" | ||
608 | help | ||
609 | This gives the physical address where the kernel is loaded. It | ||
610 | should be aligned to 2MB boundary. | ||
611 | |||
612 | If kernel is a not relocatable (CONFIG_RELOCATABLE=n) then | ||
613 | bzImage will decompress itself to above physical address and | ||
614 | run from there. Otherwise, bzImage will run from the address where | ||
615 | it has been loaded by the boot loader and will ignore above physical | ||
616 | address. | ||
617 | |||
618 | In normal kdump cases one does not have to set/change this option | ||
619 | as now bzImage can be compiled as a completely relocatable image | ||
620 | (CONFIG_RELOCATABLE=y) and be used to load and run from a different | ||
621 | address. This option is mainly useful for the folks who don't want | ||
622 | to use a bzImage for capturing the crash dump and want to use a | ||
623 | vmlinux instead. | ||
624 | |||
625 | So if you are using bzImage for capturing the crash dump, leave | ||
626 | the value here unchanged to 0x200000 and set CONFIG_RELOCATABLE=y. | ||
627 | Otherwise if you plan to use vmlinux for capturing the crash dump | ||
628 | change this value to start of the reserved region (Typically 16MB | ||
629 | 0x1000000). In other words, it can be set based on the "X" value as | ||
630 | specified in the "crashkernel=YM@XM" command line boot parameter | ||
631 | passed to the panic-ed kernel. Typically this parameter is set as | ||
632 | crashkernel=64M@16M. Please take a look at | ||
633 | Documentation/kdump/kdump.txt for more details about crash dumps. | ||
634 | |||
635 | Usage of bzImage for capturing the crash dump is advantageous as | ||
636 | one does not have to build two kernels. Same kernel can be used | ||
637 | as production kernel and capture kernel. | ||
638 | |||
639 | Don't change this unless you know what you are doing. | ||
640 | |||
641 | config SECCOMP | ||
642 | bool "Enable seccomp to safely compute untrusted bytecode" | ||
643 | depends on PROC_FS | ||
644 | default y | ||
645 | help | ||
646 | This kernel feature is useful for number crunching applications | ||
647 | that may need to compute untrusted bytecode during their | ||
648 | execution. By using pipes or other transports made available to | ||
649 | the process as file descriptors supporting the read/write | ||
650 | syscalls, it's possible to isolate those applications in | ||
651 | their own address space using seccomp. Once seccomp is | ||
652 | enabled via /proc/<pid>/seccomp, it cannot be disabled | ||
653 | and the task is only allowed to execute a few safe syscalls | ||
654 | defined by each seccomp mode. | ||
655 | |||
656 | If unsure, say Y. Only embedded should say N here. | ||
657 | |||
658 | config CC_STACKPROTECTOR | ||
659 | bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)" | ||
660 | depends on EXPERIMENTAL | ||
661 | help | ||
662 | This option turns on the -fstack-protector GCC feature. This | ||
663 | feature puts, at the beginning of critical functions, a canary | ||
664 | value on the stack just before the return address, and validates | ||
665 | the value just before actually returning. Stack based buffer | ||
666 | overflows (that need to overwrite this return address) now also | ||
667 | overwrite the canary, which gets detected and the attack is then | ||
668 | neutralized via a kernel panic. | ||
669 | |||
670 | This feature requires gcc version 4.2 or above, or a distribution | ||
671 | gcc with the feature backported. Older versions are automatically | ||
672 | detected and for those versions, this configuration option is ignored. | ||
673 | |||
674 | config CC_STACKPROTECTOR_ALL | ||
675 | bool "Use stack-protector for all functions" | ||
676 | depends on CC_STACKPROTECTOR | ||
677 | help | ||
678 | Normally, GCC only inserts the canary value protection for | ||
679 | functions that use large-ish on-stack buffers. By enabling | ||
680 | this option, GCC will be asked to do this for ALL functions. | ||
681 | |||
682 | source kernel/Kconfig.hz | ||
683 | |||
684 | config K8_NB | ||
685 | def_bool y | ||
686 | depends on AGP_AMD64 || GART_IOMMU || (PCI && NUMA) | ||
687 | |||
688 | endmenu | ||
689 | |||
690 | # | ||
691 | # Use the generic interrupt handling code in kernel/irq/: | ||
692 | # | ||
693 | config GENERIC_HARDIRQS | ||
694 | bool | ||
695 | default y | ||
696 | |||
697 | config GENERIC_IRQ_PROBE | ||
698 | bool | ||
699 | default y | ||
700 | |||
701 | # we have no ISA slots, but we do have ISA-style DMA. | ||
702 | config ISA_DMA_API | ||
703 | bool | ||
704 | default y | ||
705 | |||
706 | config GENERIC_PENDING_IRQ | ||
707 | bool | ||
708 | depends on GENERIC_HARDIRQS && SMP | ||
709 | default y | ||
710 | |||
711 | menu "Power management options" | ||
712 | |||
713 | source kernel/power/Kconfig | ||
714 | |||
715 | config ARCH_HIBERNATION_HEADER | ||
716 | bool | ||
717 | depends on HIBERNATION | ||
718 | default y | ||
719 | |||
720 | source "drivers/acpi/Kconfig" | ||
721 | |||
722 | source "arch/x86/kernel/cpu/cpufreq/Kconfig_64" | ||
723 | |||
724 | source "drivers/cpuidle/Kconfig" | ||
725 | |||
726 | endmenu | ||
727 | |||
728 | menu "Bus options (PCI etc.)" | ||
729 | |||
730 | config PCI | ||
731 | bool "PCI support" | ||
732 | select ARCH_SUPPORTS_MSI if (X86_LOCAL_APIC && X86_IO_APIC) | ||
733 | |||
734 | # x86-64 doesn't support PCI BIOS access from long mode so always go direct. | ||
735 | config PCI_DIRECT | ||
736 | bool | ||
737 | depends on PCI | ||
738 | default y | ||
739 | |||
740 | config PCI_MMCONFIG | ||
741 | bool "Support mmconfig PCI config space access" | ||
742 | depends on PCI && ACPI | ||
743 | |||
744 | config PCI_DOMAINS | ||
745 | bool | ||
746 | depends on PCI | ||
747 | default y | ||
748 | |||
749 | config DMAR | ||
750 | bool "Support for DMA Remapping Devices (EXPERIMENTAL)" | ||
751 | depends on PCI_MSI && ACPI && EXPERIMENTAL | ||
752 | help | ||
753 | DMA remapping (DMAR) devices support enables independent address | ||
754 | translations for Direct Memory Access (DMA) from devices. | ||
755 | These DMA remapping devices are reported via ACPI tables | ||
756 | and include PCI device scope covered by these DMA | ||
757 | remapping devices. | ||
758 | |||
759 | config DMAR_GFX_WA | ||
760 | bool "Support for Graphics workaround" | ||
761 | depends on DMAR | ||
762 | default y | ||
763 | help | ||
764 | Current Graphics drivers tend to use physical address | ||
765 | for DMA and avoid using DMA APIs. Setting this config | ||
766 | option permits the IOMMU driver to set a unity map for | ||
767 | all the OS-visible memory. Hence the driver can continue | ||
768 | to use physical addresses for DMA. | ||
769 | |||
770 | config DMAR_FLOPPY_WA | ||
771 | bool | ||
772 | depends on DMAR | ||
773 | default y | ||
774 | help | ||
775 | Floppy disk drivers are know to bypass DMA API calls | ||
776 | thereby failing to work when IOMMU is enabled. This | ||
777 | workaround will setup a 1:1 mapping for the first | ||
778 | 16M to make floppy (an ISA device) work. | ||
779 | |||
780 | source "drivers/pci/pcie/Kconfig" | ||
781 | |||
782 | source "drivers/pci/Kconfig" | ||
783 | |||
784 | source "drivers/pcmcia/Kconfig" | ||
785 | |||
786 | source "drivers/pci/hotplug/Kconfig" | ||
787 | |||
788 | endmenu | ||
789 | |||
790 | |||
791 | menu "Executable file formats / Emulations" | ||
792 | |||
793 | source "fs/Kconfig.binfmt" | ||
794 | |||
795 | config IA32_EMULATION | ||
796 | bool "IA32 Emulation" | ||
797 | help | ||
798 | Include code to run 32-bit programs under a 64-bit kernel. You should | ||
799 | likely turn this on, unless you're 100% sure that you don't have any | ||
800 | 32-bit programs left. | ||
801 | |||
802 | config IA32_AOUT | ||
803 | tristate "IA32 a.out support" | ||
804 | depends on IA32_EMULATION | ||
805 | help | ||
806 | Support old a.out binaries in the 32bit emulation. | ||
807 | |||
808 | config COMPAT | ||
809 | bool | ||
810 | depends on IA32_EMULATION | ||
811 | default y | ||
812 | |||
813 | config COMPAT_FOR_U64_ALIGNMENT | ||
814 | def_bool COMPAT | ||
815 | |||
816 | config SYSVIPC_COMPAT | ||
817 | bool | ||
818 | depends on COMPAT && SYSVIPC | ||
819 | default y | ||
820 | |||
821 | endmenu | ||
822 | |||
823 | source "net/Kconfig" | ||
824 | |||
825 | source drivers/Kconfig | ||
826 | |||
827 | source "drivers/firmware/Kconfig" | ||
828 | |||
829 | source fs/Kconfig | ||
830 | |||
831 | source "kernel/Kconfig.instrumentation" | ||
832 | |||
833 | source "arch/x86/Kconfig.debug" | ||
834 | |||
835 | source "security/Kconfig" | ||
836 | |||
837 | source "crypto/Kconfig" | ||
838 | |||
839 | source "lib/Kconfig" | ||
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 309597386a77..116b03a45636 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -1,12 +1,16 @@ | |||
1 | # Unified Makefile for i386 and x86_64 | 1 | # Unified Makefile for i386 and x86_64 |
2 | 2 | ||
3 | # select defconfig based on actual architecture | 3 | # select defconfig based on actual architecture |
4 | KBUILD_DEFCONFIG := $(ARCH)_defconfig | 4 | ifeq ($(ARCH),x86) |
5 | KBUILD_DEFCONFIG := i386_defconfig | ||
6 | else | ||
7 | KBUILD_DEFCONFIG := $(ARCH)_defconfig | ||
8 | endif | ||
5 | 9 | ||
6 | # # No need to remake these files | 10 | # No need to remake these files |
7 | $(srctree)/arch/x86/Makefile%: ; | 11 | $(srctree)/arch/x86/Makefile%: ; |
8 | 12 | ||
9 | ifeq ($(ARCH),i386) | 13 | ifeq ($(CONFIG_X86_32),y) |
10 | include $(srctree)/arch/x86/Makefile_32 | 14 | include $(srctree)/arch/x86/Makefile_32 |
11 | else | 15 | else |
12 | include $(srctree)/arch/x86/Makefile_64 | 16 | include $(srctree)/arch/x86/Makefile_64 |
diff --git a/arch/x86/Makefile_32 b/arch/x86/Makefile_32 index 346ac0766875..50394da2f6c1 100644 --- a/arch/x86/Makefile_32 +++ b/arch/x86/Makefile_32 | |||
@@ -160,7 +160,7 @@ archclean: | |||
160 | $(Q)$(MAKE) $(clean)=arch/x86/boot | 160 | $(Q)$(MAKE) $(clean)=arch/x86/boot |
161 | 161 | ||
162 | define archhelp | 162 | define archhelp |
163 | echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' | 163 | echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' |
164 | echo ' install - Install kernel using' | 164 | echo ' install - Install kernel using' |
165 | echo ' (your) ~/bin/installkernel or' | 165 | echo ' (your) ~/bin/installkernel or' |
166 | echo ' (distribution) /sbin/installkernel or' | 166 | echo ' (distribution) /sbin/installkernel or' |
@@ -170,6 +170,6 @@ define archhelp | |||
170 | echo ' isoimage - Create a boot CD-ROM image' | 170 | echo ' isoimage - Create a boot CD-ROM image' |
171 | endef | 171 | endef |
172 | 172 | ||
173 | CLEAN_FILES += arch/$(ARCH)/boot/fdimage \ | 173 | CLEAN_FILES += arch/x86/boot/fdimage \ |
174 | arch/$(ARCH)/boot/image.iso \ | 174 | arch/x86/boot/image.iso \ |
175 | arch/$(ARCH)/boot/mtools.conf | 175 | arch/x86/boot/mtools.conf |
diff --git a/arch/x86/Makefile_64 b/arch/x86/Makefile_64 index 57e714a47af7..a804860022e6 100644 --- a/arch/x86/Makefile_64 +++ b/arch/x86/Makefile_64 | |||
@@ -127,7 +127,7 @@ archclean: | |||
127 | $(Q)$(MAKE) $(clean)=$(boot) | 127 | $(Q)$(MAKE) $(clean)=$(boot) |
128 | 128 | ||
129 | define archhelp | 129 | define archhelp |
130 | echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' | 130 | echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' |
131 | echo ' install - Install kernel using' | 131 | echo ' install - Install kernel using' |
132 | echo ' (your) ~/bin/installkernel or' | 132 | echo ' (your) ~/bin/installkernel or' |
133 | echo ' (distribution) /sbin/installkernel or' | 133 | echo ' (distribution) /sbin/installkernel or' |
@@ -137,8 +137,8 @@ define archhelp | |||
137 | echo ' isoimage - Create a boot CD-ROM image' | 137 | echo ' isoimage - Create a boot CD-ROM image' |
138 | endef | 138 | endef |
139 | 139 | ||
140 | CLEAN_FILES += arch/$(ARCH)/boot/fdimage \ | 140 | CLEAN_FILES += arch/x86/boot/fdimage \ |
141 | arch/$(ARCH)/boot/image.iso \ | 141 | arch/x86/boot/image.iso \ |
142 | arch/$(ARCH)/boot/mtools.conf | 142 | arch/x86/boot/mtools.conf |
143 | 143 | ||
144 | 144 | ||
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index 89dbf970e058..7a3116ccf387 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile | |||
@@ -49,10 +49,10 @@ HOSTCFLAGS_build.o := $(LINUXINCLUDE) | |||
49 | 49 | ||
50 | # How to compile the 16-bit code. Note we always compile for -march=i386, | 50 | # How to compile the 16-bit code. Note we always compile for -march=i386, |
51 | # that way we can complain to the user if the CPU is insufficient. | 51 | # that way we can complain to the user if the CPU is insufficient. |
52 | cflags-i386 := | 52 | cflags-$(CONFIG_X86_32) := |
53 | cflags-x86_64 := -m32 | 53 | cflags-$(CONFIG_X86_64) := -m32 |
54 | KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ | 54 | KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ |
55 | $(cflags-$(ARCH)) \ | 55 | $(cflags-y) \ |
56 | -Wall -Wstrict-prototypes \ | 56 | -Wall -Wstrict-prototypes \ |
57 | -march=i386 -mregparm=3 \ | 57 | -march=i386 -mregparm=3 \ |
58 | -include $(srctree)/$(src)/code16gcc.h \ | 58 | -include $(srctree)/$(src)/code16gcc.h \ |
diff --git a/arch/x86/boot/cpucheck.c b/arch/x86/boot/cpucheck.c index e655a89c5510..769065bd23d7 100644 --- a/arch/x86/boot/cpucheck.c +++ b/arch/x86/boot/cpucheck.c | |||
@@ -42,13 +42,7 @@ static struct cpu_features cpu; | |||
42 | static u32 cpu_vendor[3]; | 42 | static u32 cpu_vendor[3]; |
43 | static u32 err_flags[NCAPINTS]; | 43 | static u32 err_flags[NCAPINTS]; |
44 | 44 | ||
45 | #ifdef CONFIG_X86_64 | ||
46 | static const int req_level = 64; | ||
47 | #elif defined(CONFIG_X86_MINIMUM_CPU_FAMILY) | ||
48 | static const int req_level = CONFIG_X86_MINIMUM_CPU_FAMILY; | 45 | static const int req_level = CONFIG_X86_MINIMUM_CPU_FAMILY; |
49 | #else | ||
50 | static const int req_level = 3; | ||
51 | #endif | ||
52 | 46 | ||
53 | static const u32 req_flags[NCAPINTS] = | 47 | static const u32 req_flags[NCAPINTS] = |
54 | { | 48 | { |
diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32 index b9d679820306..a7bc93c27662 100644 --- a/arch/x86/kernel/Makefile_32 +++ b/arch/x86/kernel/Makefile_32 | |||
@@ -3,6 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | extra-y := head_32.o init_task.o vmlinux.lds | 5 | extra-y := head_32.o init_task.o vmlinux.lds |
6 | CPPFLAGS_vmlinux.lds += -Ui386 | ||
6 | 7 | ||
7 | obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \ | 8 | obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \ |
8 | ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \ | 9 | ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \ |
@@ -60,7 +61,7 @@ quiet_cmd_syscall = SYSCALL $@ | |||
60 | cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \ | 61 | cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \ |
61 | -Wl,-T,$(filter-out FORCE,$^) -o $@ | 62 | -Wl,-T,$(filter-out FORCE,$^) -o $@ |
62 | 63 | ||
63 | export CPPFLAGS_vsyscall_32.lds += -P -C -U$(ARCH) | 64 | export CPPFLAGS_vsyscall_32.lds += -P -C -Ui386 |
64 | 65 | ||
65 | vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \ | 66 | vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \ |
66 | $(call ld-option, -Wl$(comma)--hash-style=sysv) | 67 | $(call ld-option, -Wl$(comma)--hash-style=sysv) |
diff --git a/arch/x86/kernel/Makefile_64 b/arch/x86/kernel/Makefile_64 index 24671c3838b3..5a88890d8ee9 100644 --- a/arch/x86/kernel/Makefile_64 +++ b/arch/x86/kernel/Makefile_64 | |||
@@ -3,7 +3,9 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | extra-y := head_64.o head64.o init_task.o vmlinux.lds | 5 | extra-y := head_64.o head64.o init_task.o vmlinux.lds |
6 | CPPFLAGS_vmlinux.lds += -Ux86_64 | ||
6 | EXTRA_AFLAGS := -traditional | 7 | EXTRA_AFLAGS := -traditional |
8 | |||
7 | obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \ | 9 | obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \ |
8 | ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \ | 10 | ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \ |
9 | x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \ | 11 | x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \ |
diff --git a/arch/x86/kernel/cpu/cpufreq/Kconfig_32 b/arch/x86/kernel/cpu/cpufreq/Kconfig index d8c6f132dc7a..151eda0a23fc 100644 --- a/arch/x86/kernel/cpu/cpufreq/Kconfig_32 +++ b/arch/x86/kernel/cpu/cpufreq/Kconfig | |||
@@ -19,6 +19,9 @@ config X86_ACPI_CPUFREQ | |||
19 | Processor Performance States. | 19 | Processor Performance States. |
20 | This driver also supports Intel Enhanced Speedstep. | 20 | This driver also supports Intel Enhanced Speedstep. |
21 | 21 | ||
22 | To compile this driver as a module, choose M here: the | ||
23 | module will be called acpi-cpufreq. | ||
24 | |||
22 | For details, take a look at <file:Documentation/cpu-freq/>. | 25 | For details, take a look at <file:Documentation/cpu-freq/>. |
23 | 26 | ||
24 | If in doubt, say N. | 27 | If in doubt, say N. |
@@ -26,7 +29,7 @@ config X86_ACPI_CPUFREQ | |||
26 | config ELAN_CPUFREQ | 29 | config ELAN_CPUFREQ |
27 | tristate "AMD Elan SC400 and SC410" | 30 | tristate "AMD Elan SC400 and SC410" |
28 | select CPU_FREQ_TABLE | 31 | select CPU_FREQ_TABLE |
29 | depends on X86_ELAN | 32 | depends on X86_32 && X86_ELAN |
30 | ---help--- | 33 | ---help--- |
31 | This adds the CPUFreq driver for AMD Elan SC400 and SC410 | 34 | This adds the CPUFreq driver for AMD Elan SC400 and SC410 |
32 | processors. | 35 | processors. |
@@ -42,7 +45,7 @@ config ELAN_CPUFREQ | |||
42 | config SC520_CPUFREQ | 45 | config SC520_CPUFREQ |
43 | tristate "AMD Elan SC520" | 46 | tristate "AMD Elan SC520" |
44 | select CPU_FREQ_TABLE | 47 | select CPU_FREQ_TABLE |
45 | depends on X86_ELAN | 48 | depends on X86_32 && X86_ELAN |
46 | ---help--- | 49 | ---help--- |
47 | This adds the CPUFreq driver for AMD Elan SC520 processor. | 50 | This adds the CPUFreq driver for AMD Elan SC520 processor. |
48 | 51 | ||
@@ -54,6 +57,7 @@ config SC520_CPUFREQ | |||
54 | config X86_POWERNOW_K6 | 57 | config X86_POWERNOW_K6 |
55 | tristate "AMD Mobile K6-2/K6-3 PowerNow!" | 58 | tristate "AMD Mobile K6-2/K6-3 PowerNow!" |
56 | select CPU_FREQ_TABLE | 59 | select CPU_FREQ_TABLE |
60 | depends on X86_32 | ||
57 | help | 61 | help |
58 | This adds the CPUFreq driver for mobile AMD K6-2+ and mobile | 62 | This adds the CPUFreq driver for mobile AMD K6-2+ and mobile |
59 | AMD K6-3+ processors. | 63 | AMD K6-3+ processors. |
@@ -65,6 +69,7 @@ config X86_POWERNOW_K6 | |||
65 | config X86_POWERNOW_K7 | 69 | config X86_POWERNOW_K7 |
66 | tristate "AMD Mobile Athlon/Duron PowerNow!" | 70 | tristate "AMD Mobile Athlon/Duron PowerNow!" |
67 | select CPU_FREQ_TABLE | 71 | select CPU_FREQ_TABLE |
72 | depends on X86_32 | ||
68 | help | 73 | help |
69 | This adds the CPUFreq driver for mobile AMD K7 mobile processors. | 74 | This adds the CPUFreq driver for mobile AMD K7 mobile processors. |
70 | 75 | ||
@@ -76,23 +81,27 @@ config X86_POWERNOW_K7_ACPI | |||
76 | bool | 81 | bool |
77 | depends on X86_POWERNOW_K7 && ACPI_PROCESSOR | 82 | depends on X86_POWERNOW_K7 && ACPI_PROCESSOR |
78 | depends on !(X86_POWERNOW_K7 = y && ACPI_PROCESSOR = m) | 83 | depends on !(X86_POWERNOW_K7 = y && ACPI_PROCESSOR = m) |
84 | depends on X86_32 | ||
79 | default y | 85 | default y |
80 | 86 | ||
81 | config X86_POWERNOW_K8 | 87 | config X86_POWERNOW_K8 |
82 | tristate "AMD Opteron/Athlon64 PowerNow!" | 88 | tristate "AMD Opteron/Athlon64 PowerNow!" |
83 | select CPU_FREQ_TABLE | 89 | select CPU_FREQ_TABLE |
84 | depends on EXPERIMENTAL | ||
85 | help | 90 | help |
86 | This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors. | 91 | This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors. |
87 | 92 | ||
93 | To compile this driver as a module, choose M here: the | ||
94 | module will be called powernow-k8. | ||
95 | |||
88 | For details, take a look at <file:Documentation/cpu-freq/>. | 96 | For details, take a look at <file:Documentation/cpu-freq/>. |
89 | 97 | ||
90 | If in doubt, say N. | 98 | If in doubt, say N. |
91 | 99 | ||
92 | config X86_POWERNOW_K8_ACPI | 100 | config X86_POWERNOW_K8_ACPI |
93 | bool "ACPI Support" | 101 | bool |
94 | select ACPI_PROCESSOR | 102 | prompt "ACPI Support" if X86_32 |
95 | depends on ACPI && X86_POWERNOW_K8 | 103 | depends on ACPI && X86_POWERNOW_K8 && ACPI_PROCESSOR |
104 | depends on !(X86_POWERNOW_K8 = y && ACPI_PROCESSOR = m) | ||
96 | default y | 105 | default y |
97 | help | 106 | help |
98 | This provides access to the K8s Processor Performance States via ACPI. | 107 | This provides access to the K8s Processor Performance States via ACPI. |
@@ -104,7 +113,7 @@ config X86_POWERNOW_K8_ACPI | |||
104 | 113 | ||
105 | config X86_GX_SUSPMOD | 114 | config X86_GX_SUSPMOD |
106 | tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation" | 115 | tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation" |
107 | depends on PCI | 116 | depends on X86_32 && PCI |
108 | help | 117 | help |
109 | This add the CPUFreq driver for NatSemi Geode processors which | 118 | This add the CPUFreq driver for NatSemi Geode processors which |
110 | support suspend modulation. | 119 | support suspend modulation. |
@@ -114,15 +123,20 @@ config X86_GX_SUSPMOD | |||
114 | If in doubt, say N. | 123 | If in doubt, say N. |
115 | 124 | ||
116 | config X86_SPEEDSTEP_CENTRINO | 125 | config X86_SPEEDSTEP_CENTRINO |
117 | tristate "Intel Enhanced SpeedStep" | 126 | tristate "Intel Enhanced SpeedStep (deprecated)" |
118 | select CPU_FREQ_TABLE | 127 | select CPU_FREQ_TABLE |
119 | select X86_SPEEDSTEP_CENTRINO_TABLE | 128 | select X86_SPEEDSTEP_CENTRINO_TABLE if X86_32 |
129 | depends on X86_32 || (X86_64 && ACPI_PROCESSOR) | ||
120 | help | 130 | help |
131 | This is deprecated and this functionality is now merged into | ||
132 | acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of | ||
133 | speedstep_centrino. | ||
121 | This adds the CPUFreq driver for Enhanced SpeedStep enabled | 134 | This adds the CPUFreq driver for Enhanced SpeedStep enabled |
122 | mobile CPUs. This means Intel Pentium M (Centrino) CPUs. However, | 135 | mobile CPUs. This means Intel Pentium M (Centrino) CPUs |
123 | you also need to say Y to "Use ACPI tables to decode..." below | 136 | or 64bit enabled Intel Xeons. |
124 | [which might imply enabling ACPI] if you want to use this driver | 137 | |
125 | on non-Banias CPUs. | 138 | To compile this driver as a module, choose M here: the |
139 | module will be called speedstep-centrino. | ||
126 | 140 | ||
127 | For details, take a look at <file:Documentation/cpu-freq/>. | 141 | For details, take a look at <file:Documentation/cpu-freq/>. |
128 | 142 | ||
@@ -130,7 +144,7 @@ config X86_SPEEDSTEP_CENTRINO | |||
130 | 144 | ||
131 | config X86_SPEEDSTEP_CENTRINO_TABLE | 145 | config X86_SPEEDSTEP_CENTRINO_TABLE |
132 | bool "Built-in tables for Banias CPUs" | 146 | bool "Built-in tables for Banias CPUs" |
133 | depends on X86_SPEEDSTEP_CENTRINO | 147 | depends on X86_32 && X86_SPEEDSTEP_CENTRINO |
134 | default y | 148 | default y |
135 | help | 149 | help |
136 | Use built-in tables for Banias CPUs if ACPI encoding | 150 | Use built-in tables for Banias CPUs if ACPI encoding |
@@ -141,6 +155,7 @@ config X86_SPEEDSTEP_CENTRINO_TABLE | |||
141 | config X86_SPEEDSTEP_ICH | 155 | config X86_SPEEDSTEP_ICH |
142 | tristate "Intel Speedstep on ICH-M chipsets (ioport interface)" | 156 | tristate "Intel Speedstep on ICH-M chipsets (ioport interface)" |
143 | select CPU_FREQ_TABLE | 157 | select CPU_FREQ_TABLE |
158 | depends on X86_32 | ||
144 | help | 159 | help |
145 | This adds the CPUFreq driver for certain mobile Intel Pentium III | 160 | This adds the CPUFreq driver for certain mobile Intel Pentium III |
146 | (Coppermine), all mobile Intel Pentium III-M (Tualatin) and all | 161 | (Coppermine), all mobile Intel Pentium III-M (Tualatin) and all |
@@ -154,7 +169,7 @@ config X86_SPEEDSTEP_ICH | |||
154 | config X86_SPEEDSTEP_SMI | 169 | config X86_SPEEDSTEP_SMI |
155 | tristate "Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)" | 170 | tristate "Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)" |
156 | select CPU_FREQ_TABLE | 171 | select CPU_FREQ_TABLE |
157 | depends on EXPERIMENTAL | 172 | depends on X86_32 && EXPERIMENTAL |
158 | help | 173 | help |
159 | This adds the CPUFreq driver for certain mobile Intel Pentium III | 174 | This adds the CPUFreq driver for certain mobile Intel Pentium III |
160 | (Coppermine), all mobile Intel Pentium III-M (Tualatin) | 175 | (Coppermine), all mobile Intel Pentium III-M (Tualatin) |
@@ -169,15 +184,24 @@ config X86_P4_CLOCKMOD | |||
169 | select CPU_FREQ_TABLE | 184 | select CPU_FREQ_TABLE |
170 | help | 185 | help |
171 | This adds the CPUFreq driver for Intel Pentium 4 / XEON | 186 | This adds the CPUFreq driver for Intel Pentium 4 / XEON |
172 | processors. | 187 | processors. When enabled it will lower CPU temperature by skipping |
188 | clocks. | ||
189 | |||
190 | This driver should be only used in exceptional | ||
191 | circumstances when very low power is needed because it causes severe | ||
192 | slowdowns and noticeable latencies. Normally Speedstep should be used | ||
193 | instead. | ||
194 | |||
195 | To compile this driver as a module, choose M here: the | ||
196 | module will be called p4-clockmod. | ||
173 | 197 | ||
174 | For details, take a look at <file:Documentation/cpu-freq/>. | 198 | For details, take a look at <file:Documentation/cpu-freq/>. |
175 | 199 | ||
176 | If in doubt, say N. | 200 | Unless you are absolutely sure say N. |
177 | 201 | ||
178 | config X86_CPUFREQ_NFORCE2 | 202 | config X86_CPUFREQ_NFORCE2 |
179 | tristate "nVidia nForce2 FSB changing" | 203 | tristate "nVidia nForce2 FSB changing" |
180 | depends on EXPERIMENTAL | 204 | depends on X86_32 && EXPERIMENTAL |
181 | help | 205 | help |
182 | This adds the CPUFreq driver for FSB changing on nVidia nForce2 | 206 | This adds the CPUFreq driver for FSB changing on nVidia nForce2 |
183 | platforms. | 207 | platforms. |
@@ -188,6 +212,7 @@ config X86_CPUFREQ_NFORCE2 | |||
188 | 212 | ||
189 | config X86_LONGRUN | 213 | config X86_LONGRUN |
190 | tristate "Transmeta LongRun" | 214 | tristate "Transmeta LongRun" |
215 | depends on X86_32 | ||
191 | help | 216 | help |
192 | This adds the CPUFreq driver for Transmeta Crusoe and Efficeon processors | 217 | This adds the CPUFreq driver for Transmeta Crusoe and Efficeon processors |
193 | which support LongRun. | 218 | which support LongRun. |
@@ -199,7 +224,7 @@ config X86_LONGRUN | |||
199 | config X86_LONGHAUL | 224 | config X86_LONGHAUL |
200 | tristate "VIA Cyrix III Longhaul" | 225 | tristate "VIA Cyrix III Longhaul" |
201 | select CPU_FREQ_TABLE | 226 | select CPU_FREQ_TABLE |
202 | depends on ACPI_PROCESSOR | 227 | depends on X86_32 && ACPI_PROCESSOR |
203 | help | 228 | help |
204 | This adds the CPUFreq driver for VIA Samuel/CyrixIII, | 229 | This adds the CPUFreq driver for VIA Samuel/CyrixIII, |
205 | VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T | 230 | VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T |
@@ -212,7 +237,7 @@ config X86_LONGHAUL | |||
212 | config X86_E_POWERSAVER | 237 | config X86_E_POWERSAVER |
213 | tristate "VIA C7 Enhanced PowerSaver (EXPERIMENTAL)" | 238 | tristate "VIA C7 Enhanced PowerSaver (EXPERIMENTAL)" |
214 | select CPU_FREQ_TABLE | 239 | select CPU_FREQ_TABLE |
215 | depends on EXPERIMENTAL | 240 | depends on X86_32 && EXPERIMENTAL |
216 | help | 241 | help |
217 | This adds the CPUFreq driver for VIA C7 processors. | 242 | This adds the CPUFreq driver for VIA C7 processors. |
218 | 243 | ||
@@ -233,11 +258,11 @@ config X86_ACPI_CPUFREQ_PROC_INTF | |||
233 | 258 | ||
234 | config X86_SPEEDSTEP_LIB | 259 | config X86_SPEEDSTEP_LIB |
235 | tristate | 260 | tristate |
236 | default X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD | 261 | default (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD) |
237 | 262 | ||
238 | config X86_SPEEDSTEP_RELAXED_CAP_CHECK | 263 | config X86_SPEEDSTEP_RELAXED_CAP_CHECK |
239 | bool "Relaxed speedstep capability checks" | 264 | bool "Relaxed speedstep capability checks" |
240 | depends on (X86_SPEEDSTEP_SMI || X86_SPEEDSTEP_ICH) | 265 | depends on X86_32 && (X86_SPEEDSTEP_SMI || X86_SPEEDSTEP_ICH) |
241 | help | 266 | help |
242 | Don't perform all checks for a speedstep capable system which would | 267 | Don't perform all checks for a speedstep capable system which would |
243 | normally be done. Some ancient or strange systems, though speedstep | 268 | normally be done. Some ancient or strange systems, though speedstep |
diff --git a/arch/x86/kernel/cpu/cpufreq/Kconfig_64 b/arch/x86/kernel/cpu/cpufreq/Kconfig_64 deleted file mode 100644 index 9c9699fdcf52..000000000000 --- a/arch/x86/kernel/cpu/cpufreq/Kconfig_64 +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | # | ||
2 | # CPU Frequency scaling | ||
3 | # | ||
4 | |||
5 | menu "CPU Frequency scaling" | ||
6 | |||
7 | source "drivers/cpufreq/Kconfig" | ||
8 | |||
9 | if CPU_FREQ | ||
10 | |||
11 | comment "CPUFreq processor drivers" | ||
12 | |||
13 | config X86_POWERNOW_K8 | ||
14 | tristate "AMD Opteron/Athlon64 PowerNow!" | ||
15 | select CPU_FREQ_TABLE | ||
16 | help | ||
17 | This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors. | ||
18 | |||
19 | To compile this driver as a module, choose M here: the | ||
20 | module will be called powernow-k8. | ||
21 | |||
22 | For details, take a look at <file:Documentation/cpu-freq/>. | ||
23 | |||
24 | If in doubt, say N. | ||
25 | |||
26 | config X86_POWERNOW_K8_ACPI | ||
27 | bool | ||
28 | depends on X86_POWERNOW_K8 && ACPI_PROCESSOR | ||
29 | depends on !(X86_POWERNOW_K8 = y && ACPI_PROCESSOR = m) | ||
30 | default y | ||
31 | |||
32 | config X86_SPEEDSTEP_CENTRINO | ||
33 | tristate "Intel Enhanced SpeedStep (deprecated)" | ||
34 | select CPU_FREQ_TABLE | ||
35 | depends on ACPI_PROCESSOR | ||
36 | help | ||
37 | This is deprecated and this functionality is now merged into | ||
38 | acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of | ||
39 | speedstep_centrino. | ||
40 | This adds the CPUFreq driver for Enhanced SpeedStep enabled | ||
41 | mobile CPUs. This means Intel Pentium M (Centrino) CPUs | ||
42 | or 64bit enabled Intel Xeons. | ||
43 | |||
44 | To compile this driver as a module, choose M here: the | ||
45 | module will be called speedstep-centrino. | ||
46 | |||
47 | For details, take a look at <file:Documentation/cpu-freq/>. | ||
48 | |||
49 | If in doubt, say N. | ||
50 | |||
51 | config X86_ACPI_CPUFREQ | ||
52 | tristate "ACPI Processor P-States driver" | ||
53 | select CPU_FREQ_TABLE | ||
54 | depends on ACPI_PROCESSOR | ||
55 | help | ||
56 | This driver adds a CPUFreq driver which utilizes the ACPI | ||
57 | Processor Performance States. | ||
58 | This driver also supports Intel Enhanced Speedstep. | ||
59 | |||
60 | To compile this driver as a module, choose M here: the | ||
61 | module will be called acpi-cpufreq. | ||
62 | |||
63 | For details, take a look at <file:Documentation/cpu-freq/>. | ||
64 | |||
65 | If in doubt, say N. | ||
66 | |||
67 | comment "shared options" | ||
68 | |||
69 | config X86_ACPI_CPUFREQ_PROC_INTF | ||
70 | bool "/proc/acpi/processor/../performance interface (deprecated)" | ||
71 | depends on PROC_FS | ||
72 | depends on X86_ACPI_CPUFREQ || X86_POWERNOW_K8_ACPI | ||
73 | help | ||
74 | This enables the deprecated /proc/acpi/processor/../performance | ||
75 | interface. While it is helpful for debugging, the generic, | ||
76 | cross-architecture cpufreq interfaces should be used. | ||
77 | |||
78 | If in doubt, say N. | ||
79 | |||
80 | config X86_P4_CLOCKMOD | ||
81 | tristate "Intel Pentium 4 clock modulation" | ||
82 | depends on EMBEDDED | ||
83 | select CPU_FREQ_TABLE | ||
84 | help | ||
85 | This adds the clock modulation driver for Intel Pentium 4 / XEON | ||
86 | processors. When enabled it will lower CPU temperature by skipping | ||
87 | clocks. | ||
88 | |||
89 | This driver should be only used in exceptional | ||
90 | circumstances when very low power is needed because it causes severe | ||
91 | slowdowns and noticeable latencies. Normally Speedstep should be used | ||
92 | instead. | ||
93 | |||
94 | To compile this driver as a module, choose M here: the | ||
95 | module will be called p4-clockmod. | ||
96 | |||
97 | For details, take a look at <file:Documentation/cpu-freq/>. | ||
98 | |||
99 | Unless you are absolutely sure say N. | ||
100 | |||
101 | |||
102 | config X86_SPEEDSTEP_LIB | ||
103 | tristate | ||
104 | default X86_P4_CLOCKMOD | ||
105 | |||
106 | endif | ||
107 | |||
108 | endmenu | ||
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c index b9f802e35209..447b351f1f2a 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_64.c | |||
@@ -802,6 +802,8 @@ static struct sysdev_attribute *mce_attributes[] = { | |||
802 | NULL | 802 | NULL |
803 | }; | 803 | }; |
804 | 804 | ||
805 | static cpumask_t mce_device_initialized = CPU_MASK_NONE; | ||
806 | |||
805 | /* Per cpu sysdev init. All of the cpus still share the same ctl bank */ | 807 | /* Per cpu sysdev init. All of the cpus still share the same ctl bank */ |
806 | static __cpuinit int mce_create_device(unsigned int cpu) | 808 | static __cpuinit int mce_create_device(unsigned int cpu) |
807 | { | 809 | { |
@@ -825,6 +827,7 @@ static __cpuinit int mce_create_device(unsigned int cpu) | |||
825 | if (err) | 827 | if (err) |
826 | goto error; | 828 | goto error; |
827 | } | 829 | } |
830 | cpu_set(cpu, mce_device_initialized); | ||
828 | 831 | ||
829 | return 0; | 832 | return 0; |
830 | error: | 833 | error: |
@@ -841,10 +844,14 @@ static void mce_remove_device(unsigned int cpu) | |||
841 | { | 844 | { |
842 | int i; | 845 | int i; |
843 | 846 | ||
847 | if (!cpu_isset(cpu, mce_device_initialized)) | ||
848 | return; | ||
849 | |||
844 | for (i = 0; mce_attributes[i]; i++) | 850 | for (i = 0; mce_attributes[i]; i++) |
845 | sysdev_remove_file(&per_cpu(device_mce,cpu), | 851 | sysdev_remove_file(&per_cpu(device_mce,cpu), |
846 | mce_attributes[i]); | 852 | mce_attributes[i]); |
847 | sysdev_unregister(&per_cpu(device_mce,cpu)); | 853 | sysdev_unregister(&per_cpu(device_mce,cpu)); |
854 | cpu_clear(cpu, mce_device_initialized); | ||
848 | } | 855 | } |
849 | 856 | ||
850 | /* Get notified when a cpu comes on/off. Be hotplug friendly. */ | 857 | /* Get notified when a cpu comes on/off. Be hotplug friendly. */ |
@@ -852,21 +859,18 @@ static int | |||
852 | mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) | 859 | mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) |
853 | { | 860 | { |
854 | unsigned int cpu = (unsigned long)hcpu; | 861 | unsigned int cpu = (unsigned long)hcpu; |
855 | int err = 0; | ||
856 | 862 | ||
857 | switch (action) { | 863 | switch (action) { |
858 | case CPU_UP_PREPARE: | 864 | case CPU_ONLINE: |
859 | case CPU_UP_PREPARE_FROZEN: | 865 | case CPU_ONLINE_FROZEN: |
860 | err = mce_create_device(cpu); | 866 | mce_create_device(cpu); |
861 | break; | 867 | break; |
862 | case CPU_UP_CANCELED: | ||
863 | case CPU_UP_CANCELED_FROZEN: | ||
864 | case CPU_DEAD: | 868 | case CPU_DEAD: |
865 | case CPU_DEAD_FROZEN: | 869 | case CPU_DEAD_FROZEN: |
866 | mce_remove_device(cpu); | 870 | mce_remove_device(cpu); |
867 | break; | 871 | break; |
868 | } | 872 | } |
869 | return err ? NOTIFY_BAD : NOTIFY_OK; | 873 | return NOTIFY_OK; |
870 | } | 874 | } |
871 | 875 | ||
872 | static struct notifier_block mce_cpu_notifier = { | 876 | static struct notifier_block mce_cpu_notifier = { |
diff --git a/arch/x86/kernel/i387_64.c b/arch/x86/kernel/i387_64.c index 56c1f1147109..bfaff28fb134 100644 --- a/arch/x86/kernel/i387_64.c +++ b/arch/x86/kernel/i387_64.c | |||
@@ -92,13 +92,14 @@ int save_i387(struct _fpstate __user *buf) | |||
92 | if (task_thread_info(tsk)->status & TS_USEDFPU) { | 92 | if (task_thread_info(tsk)->status & TS_USEDFPU) { |
93 | err = save_i387_checking((struct i387_fxsave_struct __user *)buf); | 93 | err = save_i387_checking((struct i387_fxsave_struct __user *)buf); |
94 | if (err) return err; | 94 | if (err) return err; |
95 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | ||
95 | stts(); | 96 | stts(); |
96 | } else { | 97 | } else { |
97 | if (__copy_to_user(buf, &tsk->thread.i387.fxsave, | 98 | if (__copy_to_user(buf, &tsk->thread.i387.fxsave, |
98 | sizeof(struct i387_fxsave_struct))) | 99 | sizeof(struct i387_fxsave_struct))) |
99 | return -1; | 100 | return -1; |
100 | } | 101 | } |
101 | return 1; | 102 | return 1; |
102 | } | 103 | } |
103 | 104 | ||
104 | /* | 105 | /* |
diff --git a/arch/x86/lib/delay_32.c b/arch/x86/lib/delay_32.c index 952e7a89c2ac..aad9d95469dc 100644 --- a/arch/x86/lib/delay_32.c +++ b/arch/x86/lib/delay_32.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <linux/preempt.h> | ||
15 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
16 | 17 | ||
17 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
@@ -42,11 +43,13 @@ static void delay_tsc(unsigned long loops) | |||
42 | { | 43 | { |
43 | unsigned long bclock, now; | 44 | unsigned long bclock, now; |
44 | 45 | ||
46 | preempt_disable(); /* TSC's are per-cpu */ | ||
45 | rdtscl(bclock); | 47 | rdtscl(bclock); |
46 | do { | 48 | do { |
47 | rep_nop(); | 49 | rep_nop(); |
48 | rdtscl(now); | 50 | rdtscl(now); |
49 | } while ((now-bclock) < loops); | 51 | } while ((now-bclock) < loops); |
52 | preempt_enable(); | ||
50 | } | 53 | } |
51 | 54 | ||
52 | /* | 55 | /* |
diff --git a/arch/x86/lib/delay_64.c b/arch/x86/lib/delay_64.c index 0ebbfb9e7c7f..45cdd3fbd91c 100644 --- a/arch/x86/lib/delay_64.c +++ b/arch/x86/lib/delay_64.c | |||
@@ -10,7 +10,9 @@ | |||
10 | 10 | ||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/preempt.h> | ||
13 | #include <linux/delay.h> | 14 | #include <linux/delay.h> |
15 | |||
14 | #include <asm/delay.h> | 16 | #include <asm/delay.h> |
15 | #include <asm/msr.h> | 17 | #include <asm/msr.h> |
16 | 18 | ||
@@ -27,14 +29,15 @@ int read_current_timer(unsigned long *timer_value) | |||
27 | void __delay(unsigned long loops) | 29 | void __delay(unsigned long loops) |
28 | { | 30 | { |
29 | unsigned bclock, now; | 31 | unsigned bclock, now; |
30 | 32 | ||
33 | preempt_disable(); /* TSC's are pre-cpu */ | ||
31 | rdtscl(bclock); | 34 | rdtscl(bclock); |
32 | do | 35 | do { |
33 | { | ||
34 | rep_nop(); | 36 | rep_nop(); |
35 | rdtscl(now); | 37 | rdtscl(now); |
36 | } | 38 | } |
37 | while((now-bclock) < loops); | 39 | while ((now-bclock) < loops); |
40 | preempt_enable(); | ||
38 | } | 41 | } |
39 | EXPORT_SYMBOL(__delay); | 42 | EXPORT_SYMBOL(__delay); |
40 | 43 | ||
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile index 7a2ba4583939..e7bff0fbac23 100644 --- a/arch/x86/vdso/Makefile +++ b/arch/x86/vdso/Makefile | |||
@@ -20,7 +20,7 @@ quiet_cmd_syscall = SYSCALL $@ | |||
20 | cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \ | 20 | cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \ |
21 | -Wl,-T,$(filter-out FORCE,$^) -o $@ | 21 | -Wl,-T,$(filter-out FORCE,$^) -o $@ |
22 | 22 | ||
23 | export CPPFLAGS_vdso.lds += -P -C -U$(ARCH) | 23 | export CPPFLAGS_vdso.lds += -P -C |
24 | 24 | ||
25 | vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \ | 25 | vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \ |
26 | $(call ld-option, -Wl$(comma)--hash-style=sysv) \ | 26 | $(call ld-option, -Wl$(comma)--hash-style=sysv) \ |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index ce9dead0f499..087a7028ae84 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -50,6 +50,7 @@ config ACPI_SLEEP | |||
50 | config ACPI_PROCFS | 50 | config ACPI_PROCFS |
51 | bool "Deprecated /proc/acpi files" | 51 | bool "Deprecated /proc/acpi files" |
52 | depends on PROC_FS | 52 | depends on PROC_FS |
53 | default y | ||
53 | ---help--- | 54 | ---help--- |
54 | For backwards compatibility, this option allows | 55 | For backwards compatibility, this option allows |
55 | deprecated /proc/acpi/ files to exist, even when | 56 | deprecated /proc/acpi/ files to exist, even when |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index e03de37a750d..30238f6ff232 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -27,8 +27,10 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
30 | #ifdef CONFIG_ACPI_PROCFS | ||
30 | #include <linux/proc_fs.h> | 31 | #include <linux/proc_fs.h> |
31 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
33 | #endif | ||
32 | #include <linux/power_supply.h> | 34 | #include <linux/power_supply.h> |
33 | #include <acpi/acpi_bus.h> | 35 | #include <acpi/acpi_bus.h> |
34 | #include <acpi/acpi_drivers.h> | 36 | #include <acpi/acpi_drivers.h> |
@@ -49,12 +51,15 @@ MODULE_AUTHOR("Paul Diefenbaugh"); | |||
49 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); | 51 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); |
50 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
51 | 53 | ||
54 | #ifdef CONFIG_ACPI_PROCFS | ||
52 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); | 55 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); |
53 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); | 56 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); |
57 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); | ||
58 | #endif | ||
54 | 59 | ||
55 | static int acpi_ac_add(struct acpi_device *device); | 60 | static int acpi_ac_add(struct acpi_device *device); |
56 | static int acpi_ac_remove(struct acpi_device *device, int type); | 61 | static int acpi_ac_remove(struct acpi_device *device, int type); |
57 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); | 62 | static int acpi_ac_resume(struct acpi_device *device); |
58 | 63 | ||
59 | const static struct acpi_device_id ac_device_ids[] = { | 64 | const static struct acpi_device_id ac_device_ids[] = { |
60 | {"ACPI0003", 0}, | 65 | {"ACPI0003", 0}, |
@@ -69,6 +74,7 @@ static struct acpi_driver acpi_ac_driver = { | |||
69 | .ops = { | 74 | .ops = { |
70 | .add = acpi_ac_add, | 75 | .add = acpi_ac_add, |
71 | .remove = acpi_ac_remove, | 76 | .remove = acpi_ac_remove, |
77 | .resume = acpi_ac_resume, | ||
72 | }, | 78 | }, |
73 | }; | 79 | }; |
74 | 80 | ||
@@ -80,12 +86,15 @@ struct acpi_ac { | |||
80 | 86 | ||
81 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); | 87 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); |
82 | 88 | ||
89 | #ifdef CONFIG_ACPI_PROCFS | ||
83 | static const struct file_operations acpi_ac_fops = { | 90 | static const struct file_operations acpi_ac_fops = { |
84 | .open = acpi_ac_open_fs, | 91 | .open = acpi_ac_open_fs, |
85 | .read = seq_read, | 92 | .read = seq_read, |
86 | .llseek = seq_lseek, | 93 | .llseek = seq_lseek, |
87 | .release = single_release, | 94 | .release = single_release, |
88 | }; | 95 | }; |
96 | #endif | ||
97 | |||
89 | static int get_ac_property(struct power_supply *psy, | 98 | static int get_ac_property(struct power_supply *psy, |
90 | enum power_supply_property psp, | 99 | enum power_supply_property psp, |
91 | union power_supply_propval *val) | 100 | union power_supply_propval *val) |
@@ -127,6 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) | |||
127 | return 0; | 136 | return 0; |
128 | } | 137 | } |
129 | 138 | ||
139 | #ifdef CONFIG_ACPI_PROCFS | ||
130 | /* -------------------------------------------------------------------------- | 140 | /* -------------------------------------------------------------------------- |
131 | FS Interface (/proc) | 141 | FS Interface (/proc) |
132 | -------------------------------------------------------------------------- */ | 142 | -------------------------------------------------------------------------- */ |
@@ -206,6 +216,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device) | |||
206 | 216 | ||
207 | return 0; | 217 | return 0; |
208 | } | 218 | } |
219 | #endif | ||
209 | 220 | ||
210 | /* -------------------------------------------------------------------------- | 221 | /* -------------------------------------------------------------------------- |
211 | Driver Model | 222 | Driver Model |
@@ -264,7 +275,9 @@ static int acpi_ac_add(struct acpi_device *device) | |||
264 | if (result) | 275 | if (result) |
265 | goto end; | 276 | goto end; |
266 | 277 | ||
278 | #ifdef CONFIG_ACPI_PROCFS | ||
267 | result = acpi_ac_add_fs(device); | 279 | result = acpi_ac_add_fs(device); |
280 | #endif | ||
268 | if (result) | 281 | if (result) |
269 | goto end; | 282 | goto end; |
270 | ac->charger.name = acpi_device_bid(device); | 283 | ac->charger.name = acpi_device_bid(device); |
@@ -287,13 +300,30 @@ static int acpi_ac_add(struct acpi_device *device) | |||
287 | 300 | ||
288 | end: | 301 | end: |
289 | if (result) { | 302 | if (result) { |
303 | #ifdef CONFIG_ACPI_PROCFS | ||
290 | acpi_ac_remove_fs(device); | 304 | acpi_ac_remove_fs(device); |
305 | #endif | ||
291 | kfree(ac); | 306 | kfree(ac); |
292 | } | 307 | } |
293 | 308 | ||
294 | return result; | 309 | return result; |
295 | } | 310 | } |
296 | 311 | ||
312 | static int acpi_ac_resume(struct acpi_device *device) | ||
313 | { | ||
314 | struct acpi_ac *ac; | ||
315 | unsigned old_state; | ||
316 | if (!device || !acpi_driver_data(device)) | ||
317 | return -EINVAL; | ||
318 | ac = acpi_driver_data(device); | ||
319 | old_state = ac->state; | ||
320 | if (acpi_ac_get_state(ac)) | ||
321 | return 0; | ||
322 | if (old_state != ac->state) | ||
323 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); | ||
324 | return 0; | ||
325 | } | ||
326 | |||
297 | static int acpi_ac_remove(struct acpi_device *device, int type) | 327 | static int acpi_ac_remove(struct acpi_device *device, int type) |
298 | { | 328 | { |
299 | acpi_status status = AE_OK; | 329 | acpi_status status = AE_OK; |
@@ -309,7 +339,9 @@ static int acpi_ac_remove(struct acpi_device *device, int type) | |||
309 | ACPI_ALL_NOTIFY, acpi_ac_notify); | 339 | ACPI_ALL_NOTIFY, acpi_ac_notify); |
310 | if (ac->charger.dev) | 340 | if (ac->charger.dev) |
311 | power_supply_unregister(&ac->charger); | 341 | power_supply_unregister(&ac->charger); |
342 | #ifdef CONFIG_ACPI_PROCFS | ||
312 | acpi_ac_remove_fs(device); | 343 | acpi_ac_remove_fs(device); |
344 | #endif | ||
313 | 345 | ||
314 | kfree(ac); | 346 | kfree(ac); |
315 | 347 | ||
@@ -323,13 +355,17 @@ static int __init acpi_ac_init(void) | |||
323 | if (acpi_disabled) | 355 | if (acpi_disabled) |
324 | return -ENODEV; | 356 | return -ENODEV; |
325 | 357 | ||
358 | #ifdef CONFIG_ACPI_PROCFS | ||
326 | acpi_ac_dir = acpi_lock_ac_dir(); | 359 | acpi_ac_dir = acpi_lock_ac_dir(); |
327 | if (!acpi_ac_dir) | 360 | if (!acpi_ac_dir) |
328 | return -ENODEV; | 361 | return -ENODEV; |
362 | #endif | ||
329 | 363 | ||
330 | result = acpi_bus_register_driver(&acpi_ac_driver); | 364 | result = acpi_bus_register_driver(&acpi_ac_driver); |
331 | if (result < 0) { | 365 | if (result < 0) { |
366 | #ifdef CONFIG_ACPI_PROCFS | ||
332 | acpi_unlock_ac_dir(acpi_ac_dir); | 367 | acpi_unlock_ac_dir(acpi_ac_dir); |
368 | #endif | ||
333 | return -ENODEV; | 369 | return -ENODEV; |
334 | } | 370 | } |
335 | 371 | ||
@@ -341,7 +377,9 @@ static void __exit acpi_ac_exit(void) | |||
341 | 377 | ||
342 | acpi_bus_unregister_driver(&acpi_ac_driver); | 378 | acpi_bus_unregister_driver(&acpi_ac_driver); |
343 | 379 | ||
380 | #ifdef CONFIG_ACPI_PROCFS | ||
344 | acpi_unlock_ac_dir(acpi_ac_dir); | 381 | acpi_unlock_ac_dir(acpi_ac_dir); |
382 | #endif | ||
345 | 383 | ||
346 | return; | 384 | return; |
347 | } | 385 | } |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index c2ce0ad21693..192c244f6190 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -132,7 +132,7 @@ static int acpi_battery_technology(struct acpi_battery *battery) | |||
132 | return POWER_SUPPLY_TECHNOLOGY_UNKNOWN; | 132 | return POWER_SUPPLY_TECHNOLOGY_UNKNOWN; |
133 | } | 133 | } |
134 | 134 | ||
135 | static int acpi_battery_update(struct acpi_battery *battery); | 135 | static int acpi_battery_get_state(struct acpi_battery *battery); |
136 | 136 | ||
137 | static int acpi_battery_get_property(struct power_supply *psy, | 137 | static int acpi_battery_get_property(struct power_supply *psy, |
138 | enum power_supply_property psp, | 138 | enum power_supply_property psp, |
@@ -140,10 +140,11 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
140 | { | 140 | { |
141 | struct acpi_battery *battery = to_acpi_battery(psy); | 141 | struct acpi_battery *battery = to_acpi_battery(psy); |
142 | 142 | ||
143 | if ((!acpi_battery_present(battery)) && | 143 | if (acpi_battery_present(battery)) { |
144 | psp != POWER_SUPPLY_PROP_PRESENT) | 144 | /* run battery update only if it is present */ |
145 | acpi_battery_get_state(battery); | ||
146 | } else if (psp != POWER_SUPPLY_PROP_PRESENT) | ||
145 | return -ENODEV; | 147 | return -ENODEV; |
146 | acpi_battery_update(battery); | ||
147 | switch (psp) { | 148 | switch (psp) { |
148 | case POWER_SUPPLY_PROP_STATUS: | 149 | case POWER_SUPPLY_PROP_STATUS: |
149 | if (battery->state & 0x01) | 150 | if (battery->state & 0x01) |
@@ -457,6 +458,7 @@ static void sysfs_remove_battery(struct acpi_battery *battery) | |||
457 | return; | 458 | return; |
458 | device_remove_file(battery->bat.dev, &alarm_attr); | 459 | device_remove_file(battery->bat.dev, &alarm_attr); |
459 | power_supply_unregister(&battery->bat); | 460 | power_supply_unregister(&battery->bat); |
461 | battery->bat.dev = NULL; | ||
460 | } | 462 | } |
461 | 463 | ||
462 | static int acpi_battery_update(struct acpi_battery *battery) | 464 | static int acpi_battery_update(struct acpi_battery *battery) |
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index a736ef7bdee4..9e8c20c6a0b7 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c | |||
@@ -591,9 +591,12 @@ static int __init toshiba_acpi_init(void) | |||
591 | NULL, | 591 | NULL, |
592 | &toshiba_backlight_data); | 592 | &toshiba_backlight_data); |
593 | if (IS_ERR(toshiba_backlight_device)) { | 593 | if (IS_ERR(toshiba_backlight_device)) { |
594 | int ret = PTR_ERR(toshiba_backlight_device); | ||
595 | |||
594 | printk(KERN_ERR "Could not register toshiba backlight device\n"); | 596 | printk(KERN_ERR "Could not register toshiba backlight device\n"); |
595 | toshiba_backlight_device = NULL; | 597 | toshiba_backlight_device = NULL; |
596 | toshiba_acpi_exit(); | 598 | toshiba_acpi_exit(); |
599 | return ret; | ||
597 | } | 600 | } |
598 | toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; | 601 | toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; |
599 | 602 | ||
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 6332acad078c..b4c0888aedc3 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | #include <net/sock.h> | 30 | #include <net/sock.h> |
31 | #include <linux/net.h> | ||
31 | 32 | ||
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
33 | #include <asm/system.h> | 34 | #include <asm/system.h> |
@@ -126,7 +127,7 @@ static void sock_shutdown(struct nbd_device *lo, int lock) | |||
126 | if (lo->sock) { | 127 | if (lo->sock) { |
127 | printk(KERN_WARNING "%s: shutting down socket\n", | 128 | printk(KERN_WARNING "%s: shutting down socket\n", |
128 | lo->disk->disk_name); | 129 | lo->disk->disk_name); |
129 | lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN); | 130 | kernel_sock_shutdown(lo->sock, SHUT_RDWR); |
130 | lo->sock = NULL; | 131 | lo->sock = NULL; |
131 | } | 132 | } |
132 | if (lock) | 133 | if (lock) |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index ceffa6034e20..e7fe6ca97dd8 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -488,13 +488,11 @@ static int pf_atapi(struct pf_unit *pf, char *cmd, int dlen, char *buf, char *fu | |||
488 | return r; | 488 | return r; |
489 | } | 489 | } |
490 | 490 | ||
491 | #define DBMSG(msg) ((verbose>1)?(msg):NULL) | ||
492 | |||
493 | static void pf_lock(struct pf_unit *pf, int func) | 491 | static void pf_lock(struct pf_unit *pf, int func) |
494 | { | 492 | { |
495 | char lo_cmd[12] = { ATAPI_LOCK, pf->lun << 5, 0, 0, func, 0, 0, 0, 0, 0, 0, 0 }; | 493 | char lo_cmd[12] = { ATAPI_LOCK, pf->lun << 5, 0, 0, func, 0, 0, 0, 0, 0, 0, 0 }; |
496 | 494 | ||
497 | pf_atapi(pf, lo_cmd, 0, pf_scratch, func ? "unlock" : "lock"); | 495 | pf_atapi(pf, lo_cmd, 0, pf_scratch, func ? "lock" : "unlock"); |
498 | } | 496 | } |
499 | 497 | ||
500 | static void pf_eject(struct pf_unit *pf) | 498 | static void pf_eject(struct pf_unit *pf) |
@@ -555,7 +553,7 @@ static void pf_mode_sense(struct pf_unit *pf) | |||
555 | { ATAPI_MODE_SENSE, pf->lun << 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0 }; | 553 | { ATAPI_MODE_SENSE, pf->lun << 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0 }; |
556 | char buf[8]; | 554 | char buf[8]; |
557 | 555 | ||
558 | pf_atapi(pf, ms_cmd, 8, buf, DBMSG("mode sense")); | 556 | pf_atapi(pf, ms_cmd, 8, buf, "mode sense"); |
559 | pf->media_status = PF_RW; | 557 | pf->media_status = PF_RW; |
560 | if (buf[3] & 0x80) | 558 | if (buf[3] & 0x80) |
561 | pf->media_status = PF_RO; | 559 | pf->media_status = PF_RO; |
@@ -591,7 +589,7 @@ static void pf_get_capacity(struct pf_unit *pf) | |||
591 | char buf[8]; | 589 | char buf[8]; |
592 | int bs; | 590 | int bs; |
593 | 591 | ||
594 | if (pf_atapi(pf, rc_cmd, 8, buf, DBMSG("get capacity"))) { | 592 | if (pf_atapi(pf, rc_cmd, 8, buf, "get capacity")) { |
595 | pf->media_status = PF_NM; | 593 | pf->media_status = PF_NM; |
596 | return; | 594 | return; |
597 | } | 595 | } |
@@ -804,13 +802,18 @@ static int pf_next_buf(void) | |||
804 | pf_buf += 512; | 802 | pf_buf += 512; |
805 | pf_block++; | 803 | pf_block++; |
806 | if (!pf_run) | 804 | if (!pf_run) |
807 | return 0; | ||
808 | if (!pf_count) | ||
809 | return 1; | 805 | return 1; |
810 | spin_lock_irqsave(&pf_spin_lock, saved_flags); | 806 | if (!pf_count) { |
811 | pf_end_request(1); | 807 | spin_lock_irqsave(&pf_spin_lock, saved_flags); |
812 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | 808 | pf_end_request(1); |
813 | return 1; | 809 | pf_req = elv_next_request(pf_queue); |
810 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | ||
811 | if (!pf_req) | ||
812 | return 1; | ||
813 | pf_count = pf_req->current_nr_sectors; | ||
814 | pf_buf = pf_req->buffer; | ||
815 | } | ||
816 | return 0; | ||
814 | } | 817 | } |
815 | 818 | ||
816 | static inline void next_request(int success) | 819 | static inline void next_request(int success) |
diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 47f8ac6cce57..82f4eecc8699 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c | |||
@@ -189,6 +189,18 @@ static int ramdisk_set_page_dirty(struct page *page) | |||
189 | return 0; | 189 | return 0; |
190 | } | 190 | } |
191 | 191 | ||
192 | /* | ||
193 | * releasepage is called by pagevec_strip/try_to_release_page if | ||
194 | * buffers_heads_over_limit is true. Without a releasepage function | ||
195 | * try_to_free_buffers is called instead. That can unset the dirty | ||
196 | * bit of our ram disk pages, which will be eventually freed, even | ||
197 | * if the page is still in use. | ||
198 | */ | ||
199 | static int ramdisk_releasepage(struct page *page, gfp_t dummy) | ||
200 | { | ||
201 | return 0; | ||
202 | } | ||
203 | |||
192 | static const struct address_space_operations ramdisk_aops = { | 204 | static const struct address_space_operations ramdisk_aops = { |
193 | .readpage = ramdisk_readpage, | 205 | .readpage = ramdisk_readpage, |
194 | .prepare_write = ramdisk_prepare_write, | 206 | .prepare_write = ramdisk_prepare_write, |
@@ -196,6 +208,7 @@ static const struct address_space_operations ramdisk_aops = { | |||
196 | .writepage = ramdisk_writepage, | 208 | .writepage = ramdisk_writepage, |
197 | .set_page_dirty = ramdisk_set_page_dirty, | 209 | .set_page_dirty = ramdisk_set_page_dirty, |
198 | .writepages = ramdisk_writepages, | 210 | .writepages = ramdisk_writepages, |
211 | .releasepage = ramdisk_releasepage, | ||
199 | }; | 212 | }; |
200 | 213 | ||
201 | static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector, | 214 | static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector, |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index cc5d77797def..02518da6a386 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -47,7 +47,7 @@ | |||
47 | /* #define ATR_CSUM */ | 47 | /* #define ATR_CSUM */ |
48 | 48 | ||
49 | #ifdef PCMCIA_DEBUG | 49 | #ifdef PCMCIA_DEBUG |
50 | #define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle)) | 50 | #define reader_to_dev(x) (&handle_to_dev(x->p_dev)) |
51 | static int pc_debug = PCMCIA_DEBUG; | 51 | static int pc_debug = PCMCIA_DEBUG; |
52 | module_param(pc_debug, int, 0600); | 52 | module_param(pc_debug, int, 0600); |
53 | #define DEBUGP(n, rdr, x, args...) do { \ | 53 | #define DEBUGP(n, rdr, x, args...) do { \ |
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index a0b9c8728d56..5f291bf739a6 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -41,7 +41,7 @@ | |||
41 | 41 | ||
42 | 42 | ||
43 | #ifdef PCMCIA_DEBUG | 43 | #ifdef PCMCIA_DEBUG |
44 | #define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle)) | 44 | #define reader_to_dev(x) (&handle_to_dev(x->p_dev)) |
45 | static int pc_debug = PCMCIA_DEBUG; | 45 | static int pc_debug = PCMCIA_DEBUG; |
46 | module_param(pc_debug, int, 0600); | 46 | module_param(pc_debug, int, 0600); |
47 | #define DEBUGP(n, rdr, x, args...) do { \ | 47 | #define DEBUGP(n, rdr, x, args...) do { \ |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 1756b1f7cb72..5fee05661823 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -1494,7 +1494,7 @@ __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr, | |||
1494 | seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK; | 1494 | seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK; |
1495 | seq += keyptr->count; | 1495 | seq += keyptr->count; |
1496 | 1496 | ||
1497 | seq += ktime_get_real().tv64; | 1497 | seq += ktime_to_ns(ktime_get_real()); |
1498 | 1498 | ||
1499 | return seq; | 1499 | return seq; |
1500 | } | 1500 | } |
@@ -1556,7 +1556,7 @@ __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, | |||
1556 | * overlaps less than one time per MSL (2 minutes). | 1556 | * overlaps less than one time per MSL (2 minutes). |
1557 | * Choosing a clock of 64 ns period is OK. (period of 274 s) | 1557 | * Choosing a clock of 64 ns period is OK. (period of 274 s) |
1558 | */ | 1558 | */ |
1559 | seq += ktime_get_real().tv64 >> 6; | 1559 | seq += ktime_to_ns(ktime_get_real()) >> 6; |
1560 | #if 0 | 1560 | #if 0 |
1561 | printk("init_seq(%lx, %lx, %d, %d) = %d\n", | 1561 | printk("init_seq(%lx, %lx, %d, %d) = %d\n", |
1562 | saddr, daddr, sport, dport, seq); | 1562 | saddr, daddr, sport, dport, seq); |
@@ -1616,7 +1616,7 @@ u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, | |||
1616 | seq = half_md4_transform(hash, keyptr->secret); | 1616 | seq = half_md4_transform(hash, keyptr->secret); |
1617 | seq |= ((u64)keyptr->count) << (32 - HASH_BITS); | 1617 | seq |= ((u64)keyptr->count) << (32 - HASH_BITS); |
1618 | 1618 | ||
1619 | seq += ktime_get_real().tv64; | 1619 | seq += ktime_to_ns(ktime_get_real()); |
1620 | seq &= (1ull << 48) - 1; | 1620 | seq &= (1ull << 48) - 1; |
1621 | #if 0 | 1621 | #if 0 |
1622 | printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n", | 1622 | printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n", |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index ec6b65ec69ea..0c66b802736a 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -918,6 +918,31 @@ static const struct file_operations rtc_proc_fops = { | |||
918 | }; | 918 | }; |
919 | #endif | 919 | #endif |
920 | 920 | ||
921 | static resource_size_t rtc_size; | ||
922 | |||
923 | static struct resource * __init rtc_request_region(resource_size_t size) | ||
924 | { | ||
925 | struct resource *r; | ||
926 | |||
927 | if (RTC_IOMAPPED) | ||
928 | r = request_region(RTC_PORT(0), size, "rtc"); | ||
929 | else | ||
930 | r = request_mem_region(RTC_PORT(0), size, "rtc"); | ||
931 | |||
932 | if (r) | ||
933 | rtc_size = size; | ||
934 | |||
935 | return r; | ||
936 | } | ||
937 | |||
938 | static void rtc_release_region(void) | ||
939 | { | ||
940 | if (RTC_IOMAPPED) | ||
941 | release_region(RTC_PORT(0), rtc_size); | ||
942 | else | ||
943 | release_mem_region(RTC_PORT(0), rtc_size); | ||
944 | } | ||
945 | |||
921 | static int __init rtc_init(void) | 946 | static int __init rtc_init(void) |
922 | { | 947 | { |
923 | #ifdef CONFIG_PROC_FS | 948 | #ifdef CONFIG_PROC_FS |
@@ -968,10 +993,17 @@ found: | |||
968 | } | 993 | } |
969 | no_irq: | 994 | no_irq: |
970 | #else | 995 | #else |
971 | if (RTC_IOMAPPED) | 996 | r = rtc_request_region(RTC_IO_EXTENT); |
972 | r = request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); | 997 | |
973 | else | 998 | /* |
974 | r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); | 999 | * If we've already requested a smaller range (for example, because |
1000 | * PNPBIOS or ACPI told us how the device is configured), the request | ||
1001 | * above might fail because it's too big. | ||
1002 | * | ||
1003 | * If so, request just the range we actually use. | ||
1004 | */ | ||
1005 | if (!r) | ||
1006 | r = rtc_request_region(RTC_IO_EXTENT_USED); | ||
975 | if (!r) { | 1007 | if (!r) { |
976 | #ifdef RTC_IRQ | 1008 | #ifdef RTC_IRQ |
977 | rtc_has_irq = 0; | 1009 | rtc_has_irq = 0; |
@@ -992,10 +1024,7 @@ no_irq: | |||
992 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ | 1024 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ |
993 | rtc_has_irq = 0; | 1025 | rtc_has_irq = 0; |
994 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); | 1026 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); |
995 | if (RTC_IOMAPPED) | 1027 | rtc_release_region(); |
996 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
997 | else | ||
998 | release_mem_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
999 | return -EIO; | 1028 | return -EIO; |
1000 | } | 1029 | } |
1001 | hpet_rtc_timer_init(); | 1030 | hpet_rtc_timer_init(); |
@@ -1009,7 +1038,7 @@ no_irq: | |||
1009 | free_irq(RTC_IRQ, NULL); | 1038 | free_irq(RTC_IRQ, NULL); |
1010 | rtc_has_irq = 0; | 1039 | rtc_has_irq = 0; |
1011 | #endif | 1040 | #endif |
1012 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | 1041 | rtc_release_region(); |
1013 | return -ENODEV; | 1042 | return -ENODEV; |
1014 | } | 1043 | } |
1015 | 1044 | ||
@@ -1091,10 +1120,7 @@ static void __exit rtc_exit (void) | |||
1091 | if (rtc_has_irq) | 1120 | if (rtc_has_irq) |
1092 | free_irq (rtc_irq, &rtc_port); | 1121 | free_irq (rtc_irq, &rtc_port); |
1093 | #else | 1122 | #else |
1094 | if (RTC_IOMAPPED) | 1123 | rtc_release_region(); |
1095 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
1096 | else | ||
1097 | release_mem_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
1098 | #ifdef RTC_IRQ | 1124 | #ifdef RTC_IRQ |
1099 | if (rtc_has_irq) | 1125 | if (rtc_has_irq) |
1100 | free_irq (RTC_IRQ, NULL); | 1126 | free_irq (RTC_IRQ, NULL); |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 82489923af09..d59b2f417306 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -182,10 +182,9 @@ static void dma_client_chan_alloc(struct dma_client *client) | |||
182 | /* we are done once this client rejects | 182 | /* we are done once this client rejects |
183 | * an available resource | 183 | * an available resource |
184 | */ | 184 | */ |
185 | if (ack == DMA_ACK) { | 185 | if (ack == DMA_ACK) |
186 | dma_chan_get(chan); | 186 | dma_chan_get(chan); |
187 | kref_get(&device->refcount); | 187 | else if (ack == DMA_NAK) |
188 | } else if (ack == DMA_NAK) | ||
189 | return; | 188 | return; |
190 | } | 189 | } |
191 | } | 190 | } |
@@ -272,11 +271,8 @@ static void dma_clients_notify_removed(struct dma_chan *chan) | |||
272 | /* client was holding resources for this channel so | 271 | /* client was holding resources for this channel so |
273 | * free it | 272 | * free it |
274 | */ | 273 | */ |
275 | if (ack == DMA_ACK) { | 274 | if (ack == DMA_ACK) |
276 | dma_chan_put(chan); | 275 | dma_chan_put(chan); |
277 | kref_put(&chan->device->refcount, | ||
278 | dma_async_device_cleanup); | ||
279 | } | ||
280 | } | 276 | } |
281 | 277 | ||
282 | mutex_unlock(&dma_list_mutex); | 278 | mutex_unlock(&dma_list_mutex); |
@@ -316,11 +312,8 @@ void dma_async_client_unregister(struct dma_client *client) | |||
316 | ack = client->event_callback(client, chan, | 312 | ack = client->event_callback(client, chan, |
317 | DMA_RESOURCE_REMOVED); | 313 | DMA_RESOURCE_REMOVED); |
318 | 314 | ||
319 | if (ack == DMA_ACK) { | 315 | if (ack == DMA_ACK) |
320 | dma_chan_put(chan); | 316 | dma_chan_put(chan); |
321 | kref_put(&chan->device->refcount, | ||
322 | dma_async_device_cleanup); | ||
323 | } | ||
324 | } | 317 | } |
325 | 318 | ||
326 | list_del(&client->global_node); | 319 | list_del(&client->global_node); |
@@ -397,6 +390,8 @@ int dma_async_device_register(struct dma_device *device) | |||
397 | goto err_out; | 390 | goto err_out; |
398 | } | 391 | } |
399 | 392 | ||
393 | /* One for the channel, one of the class device */ | ||
394 | kref_get(&device->refcount); | ||
400 | kref_get(&device->refcount); | 395 | kref_get(&device->refcount); |
401 | kref_init(&chan->refcount); | 396 | kref_init(&chan->refcount); |
402 | chan->slow_ref = 0; | 397 | chan->slow_ref = 0; |
diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c index f204c39fb412..16e0fd8facfb 100644 --- a/drivers/dma/ioat.c +++ b/drivers/dma/ioat.c | |||
@@ -39,10 +39,14 @@ MODULE_LICENSE("GPL"); | |||
39 | MODULE_AUTHOR("Intel Corporation"); | 39 | MODULE_AUTHOR("Intel Corporation"); |
40 | 40 | ||
41 | static struct pci_device_id ioat_pci_tbl[] = { | 41 | static struct pci_device_id ioat_pci_tbl[] = { |
42 | /* I/OAT v1 platforms */ | ||
42 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT) }, | 43 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT) }, |
43 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB) }, | 44 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB) }, |
44 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SCNB) }, | 45 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SCNB) }, |
45 | { PCI_DEVICE(PCI_VENDOR_ID_UNISYS, PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR) }, | 46 | { PCI_DEVICE(PCI_VENDOR_ID_UNISYS, PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR) }, |
47 | |||
48 | /* I/OAT v2 platforms */ | ||
49 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SNB) }, | ||
46 | { 0, } | 50 | { 0, } |
47 | }; | 51 | }; |
48 | 52 | ||
@@ -74,10 +78,17 @@ static int ioat_setup_functionality(struct pci_dev *pdev, void __iomem *iobase) | |||
74 | if (device->dma && ioat_dca_enabled) | 78 | if (device->dma && ioat_dca_enabled) |
75 | device->dca = ioat_dca_init(pdev, iobase); | 79 | device->dca = ioat_dca_init(pdev, iobase); |
76 | break; | 80 | break; |
81 | case IOAT_VER_2_0: | ||
82 | device->dma = ioat_dma_probe(pdev, iobase); | ||
83 | if (device->dma && ioat_dca_enabled) | ||
84 | device->dca = ioat2_dca_init(pdev, iobase); | ||
85 | break; | ||
77 | default: | 86 | default: |
78 | err = -ENODEV; | 87 | err = -ENODEV; |
79 | break; | 88 | break; |
80 | } | 89 | } |
90 | if (!device->dma) | ||
91 | err = -ENODEV; | ||
81 | return err; | 92 | return err; |
82 | } | 93 | } |
83 | 94 | ||
diff --git a/drivers/dma/ioat_dca.c b/drivers/dma/ioat_dca.c index ba985715b803..0fa8a98051a8 100644 --- a/drivers/dma/ioat_dca.c +++ b/drivers/dma/ioat_dca.c | |||
@@ -261,3 +261,167 @@ struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase) | |||
261 | return dca; | 261 | return dca; |
262 | } | 262 | } |
263 | 263 | ||
264 | |||
265 | static int ioat2_dca_add_requester(struct dca_provider *dca, struct device *dev) | ||
266 | { | ||
267 | struct ioat_dca_priv *ioatdca = dca_priv(dca); | ||
268 | struct pci_dev *pdev; | ||
269 | int i; | ||
270 | u16 id; | ||
271 | u16 global_req_table; | ||
272 | |||
273 | /* This implementation only supports PCI-Express */ | ||
274 | if (dev->bus != &pci_bus_type) | ||
275 | return -ENODEV; | ||
276 | pdev = to_pci_dev(dev); | ||
277 | id = dcaid_from_pcidev(pdev); | ||
278 | |||
279 | if (ioatdca->requester_count == ioatdca->max_requesters) | ||
280 | return -ENODEV; | ||
281 | |||
282 | for (i = 0; i < ioatdca->max_requesters; i++) { | ||
283 | if (ioatdca->req_slots[i].pdev == NULL) { | ||
284 | /* found an empty slot */ | ||
285 | ioatdca->requester_count++; | ||
286 | ioatdca->req_slots[i].pdev = pdev; | ||
287 | ioatdca->req_slots[i].rid = id; | ||
288 | global_req_table = | ||
289 | readw(ioatdca->dca_base + IOAT_DCA_GREQID_OFFSET); | ||
290 | writel(id | IOAT_DCA_GREQID_VALID, | ||
291 | ioatdca->iobase + global_req_table + (i * 4)); | ||
292 | return i; | ||
293 | } | ||
294 | } | ||
295 | /* Error, ioatdma->requester_count is out of whack */ | ||
296 | return -EFAULT; | ||
297 | } | ||
298 | |||
299 | static int ioat2_dca_remove_requester(struct dca_provider *dca, | ||
300 | struct device *dev) | ||
301 | { | ||
302 | struct ioat_dca_priv *ioatdca = dca_priv(dca); | ||
303 | struct pci_dev *pdev; | ||
304 | int i; | ||
305 | u16 global_req_table; | ||
306 | |||
307 | /* This implementation only supports PCI-Express */ | ||
308 | if (dev->bus != &pci_bus_type) | ||
309 | return -ENODEV; | ||
310 | pdev = to_pci_dev(dev); | ||
311 | |||
312 | for (i = 0; i < ioatdca->max_requesters; i++) { | ||
313 | if (ioatdca->req_slots[i].pdev == pdev) { | ||
314 | global_req_table = | ||
315 | readw(ioatdca->dca_base + IOAT_DCA_GREQID_OFFSET); | ||
316 | writel(0, ioatdca->iobase + global_req_table + (i * 4)); | ||
317 | ioatdca->req_slots[i].pdev = NULL; | ||
318 | ioatdca->req_slots[i].rid = 0; | ||
319 | ioatdca->requester_count--; | ||
320 | return i; | ||
321 | } | ||
322 | } | ||
323 | return -ENODEV; | ||
324 | } | ||
325 | |||
326 | static u8 ioat2_dca_get_tag(struct dca_provider *dca, int cpu) | ||
327 | { | ||
328 | u8 tag; | ||
329 | |||
330 | tag = ioat_dca_get_tag(dca, cpu); | ||
331 | tag = (~tag) & 0x1F; | ||
332 | return tag; | ||
333 | } | ||
334 | |||
335 | static struct dca_ops ioat2_dca_ops = { | ||
336 | .add_requester = ioat2_dca_add_requester, | ||
337 | .remove_requester = ioat2_dca_remove_requester, | ||
338 | .get_tag = ioat2_dca_get_tag, | ||
339 | }; | ||
340 | |||
341 | static int ioat2_dca_count_dca_slots(void *iobase, u16 dca_offset) | ||
342 | { | ||
343 | int slots = 0; | ||
344 | u32 req; | ||
345 | u16 global_req_table; | ||
346 | |||
347 | global_req_table = readw(iobase + dca_offset + IOAT_DCA_GREQID_OFFSET); | ||
348 | if (global_req_table == 0) | ||
349 | return 0; | ||
350 | do { | ||
351 | req = readl(iobase + global_req_table + (slots * sizeof(u32))); | ||
352 | slots++; | ||
353 | } while ((req & IOAT_DCA_GREQID_LASTID) == 0); | ||
354 | |||
355 | return slots; | ||
356 | } | ||
357 | |||
358 | struct dca_provider *ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase) | ||
359 | { | ||
360 | struct dca_provider *dca; | ||
361 | struct ioat_dca_priv *ioatdca; | ||
362 | int slots; | ||
363 | int i; | ||
364 | int err; | ||
365 | u32 tag_map; | ||
366 | u16 dca_offset; | ||
367 | u16 csi_fsb_control; | ||
368 | u16 pcie_control; | ||
369 | u8 bit; | ||
370 | |||
371 | if (!system_has_dca_enabled(pdev)) | ||
372 | return NULL; | ||
373 | |||
374 | dca_offset = readw(iobase + IOAT_DCAOFFSET_OFFSET); | ||
375 | if (dca_offset == 0) | ||
376 | return NULL; | ||
377 | |||
378 | slots = ioat2_dca_count_dca_slots(iobase, dca_offset); | ||
379 | if (slots == 0) | ||
380 | return NULL; | ||
381 | |||
382 | dca = alloc_dca_provider(&ioat2_dca_ops, | ||
383 | sizeof(*ioatdca) | ||
384 | + (sizeof(struct ioat_dca_slot) * slots)); | ||
385 | if (!dca) | ||
386 | return NULL; | ||
387 | |||
388 | ioatdca = dca_priv(dca); | ||
389 | ioatdca->iobase = iobase; | ||
390 | ioatdca->dca_base = iobase + dca_offset; | ||
391 | ioatdca->max_requesters = slots; | ||
392 | |||
393 | /* some bios might not know to turn these on */ | ||
394 | csi_fsb_control = readw(ioatdca->dca_base + IOAT_FSB_CAP_ENABLE_OFFSET); | ||
395 | if ((csi_fsb_control & IOAT_FSB_CAP_ENABLE_PREFETCH) == 0) { | ||
396 | csi_fsb_control |= IOAT_FSB_CAP_ENABLE_PREFETCH; | ||
397 | writew(csi_fsb_control, | ||
398 | ioatdca->dca_base + IOAT_FSB_CAP_ENABLE_OFFSET); | ||
399 | } | ||
400 | pcie_control = readw(ioatdca->dca_base + IOAT_PCI_CAP_ENABLE_OFFSET); | ||
401 | if ((pcie_control & IOAT_PCI_CAP_ENABLE_MEMWR) == 0) { | ||
402 | pcie_control |= IOAT_PCI_CAP_ENABLE_MEMWR; | ||
403 | writew(pcie_control, | ||
404 | ioatdca->dca_base + IOAT_PCI_CAP_ENABLE_OFFSET); | ||
405 | } | ||
406 | |||
407 | |||
408 | /* TODO version, compatibility and configuration checks */ | ||
409 | |||
410 | /* copy out the APIC to DCA tag map */ | ||
411 | tag_map = readl(ioatdca->dca_base + IOAT_APICID_TAG_MAP_OFFSET); | ||
412 | for (i = 0; i < 5; i++) { | ||
413 | bit = (tag_map >> (4 * i)) & 0x0f; | ||
414 | if (bit < 8) | ||
415 | ioatdca->tag_map[i] = bit | DCA_TAG_MAP_VALID; | ||
416 | else | ||
417 | ioatdca->tag_map[i] = 0; | ||
418 | } | ||
419 | |||
420 | err = register_dca_provider(dca, &pdev->dev); | ||
421 | if (err) { | ||
422 | free_dca_provider(dca); | ||
423 | return NULL; | ||
424 | } | ||
425 | |||
426 | return dca; | ||
427 | } | ||
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index 7e4a785c2dff..c1c2dcc6fc2e 100644 --- a/drivers/dma/ioat_dma.c +++ b/drivers/dma/ioat_dma.c | |||
@@ -36,18 +36,24 @@ | |||
36 | #include "ioatdma_registers.h" | 36 | #include "ioatdma_registers.h" |
37 | #include "ioatdma_hw.h" | 37 | #include "ioatdma_hw.h" |
38 | 38 | ||
39 | #define INITIAL_IOAT_DESC_COUNT 128 | ||
40 | |||
41 | #define to_ioat_chan(chan) container_of(chan, struct ioat_dma_chan, common) | 39 | #define to_ioat_chan(chan) container_of(chan, struct ioat_dma_chan, common) |
42 | #define to_ioatdma_device(dev) container_of(dev, struct ioatdma_device, common) | 40 | #define to_ioatdma_device(dev) container_of(dev, struct ioatdma_device, common) |
43 | #define to_ioat_desc(lh) container_of(lh, struct ioat_desc_sw, node) | 41 | #define to_ioat_desc(lh) container_of(lh, struct ioat_desc_sw, node) |
44 | #define tx_to_ioat_desc(tx) container_of(tx, struct ioat_desc_sw, async_tx) | 42 | #define tx_to_ioat_desc(tx) container_of(tx, struct ioat_desc_sw, async_tx) |
45 | 43 | ||
44 | static int ioat_pending_level = 4; | ||
45 | module_param(ioat_pending_level, int, 0644); | ||
46 | MODULE_PARM_DESC(ioat_pending_level, | ||
47 | "high-water mark for pushing ioat descriptors (default: 4)"); | ||
48 | |||
46 | /* internal functions */ | 49 | /* internal functions */ |
47 | static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan); | 50 | static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan); |
48 | static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan); | 51 | static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan); |
52 | |||
53 | static struct ioat_desc_sw * | ||
54 | ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan); | ||
49 | static struct ioat_desc_sw * | 55 | static struct ioat_desc_sw * |
50 | ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan); | 56 | ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan); |
51 | 57 | ||
52 | static inline struct ioat_dma_chan *ioat_lookup_chan_by_index( | 58 | static inline struct ioat_dma_chan *ioat_lookup_chan_by_index( |
53 | struct ioatdma_device *device, | 59 | struct ioatdma_device *device, |
@@ -130,6 +136,12 @@ static int ioat_dma_enumerate_channels(struct ioatdma_device *device) | |||
130 | ioat_chan->device = device; | 136 | ioat_chan->device = device; |
131 | ioat_chan->reg_base = device->reg_base + (0x80 * (i + 1)); | 137 | ioat_chan->reg_base = device->reg_base + (0x80 * (i + 1)); |
132 | ioat_chan->xfercap = xfercap; | 138 | ioat_chan->xfercap = xfercap; |
139 | ioat_chan->desccount = 0; | ||
140 | if (ioat_chan->device->version != IOAT_VER_1_2) { | ||
141 | writel(IOAT_DCACTRL_CMPL_WRITE_ENABLE | ||
142 | | IOAT_DMA_DCA_ANY_CPU, | ||
143 | ioat_chan->reg_base + IOAT_DCACTRL_OFFSET); | ||
144 | } | ||
133 | spin_lock_init(&ioat_chan->cleanup_lock); | 145 | spin_lock_init(&ioat_chan->cleanup_lock); |
134 | spin_lock_init(&ioat_chan->desc_lock); | 146 | spin_lock_init(&ioat_chan->desc_lock); |
135 | INIT_LIST_HEAD(&ioat_chan->free_desc); | 147 | INIT_LIST_HEAD(&ioat_chan->free_desc); |
@@ -161,13 +173,17 @@ static void ioat_set_dest(dma_addr_t addr, | |||
161 | tx_to_ioat_desc(tx)->dst = addr; | 173 | tx_to_ioat_desc(tx)->dst = addr; |
162 | } | 174 | } |
163 | 175 | ||
164 | static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx) | 176 | static inline void __ioat1_dma_memcpy_issue_pending( |
177 | struct ioat_dma_chan *ioat_chan); | ||
178 | static inline void __ioat2_dma_memcpy_issue_pending( | ||
179 | struct ioat_dma_chan *ioat_chan); | ||
180 | |||
181 | static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx) | ||
165 | { | 182 | { |
166 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan); | 183 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan); |
167 | struct ioat_desc_sw *first = tx_to_ioat_desc(tx); | 184 | struct ioat_desc_sw *first = tx_to_ioat_desc(tx); |
168 | struct ioat_desc_sw *prev, *new; | 185 | struct ioat_desc_sw *prev, *new; |
169 | struct ioat_dma_descriptor *hw; | 186 | struct ioat_dma_descriptor *hw; |
170 | int append = 0; | ||
171 | dma_cookie_t cookie; | 187 | dma_cookie_t cookie; |
172 | LIST_HEAD(new_chain); | 188 | LIST_HEAD(new_chain); |
173 | u32 copy; | 189 | u32 copy; |
@@ -209,7 +225,7 @@ static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx) | |||
209 | list_add_tail(&new->node, &new_chain); | 225 | list_add_tail(&new->node, &new_chain); |
210 | desc_count++; | 226 | desc_count++; |
211 | prev = new; | 227 | prev = new; |
212 | } while (len && (new = ioat_dma_get_next_descriptor(ioat_chan))); | 228 | } while (len && (new = ioat1_dma_get_next_descriptor(ioat_chan))); |
213 | 229 | ||
214 | hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; | 230 | hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; |
215 | if (new->async_tx.callback) { | 231 | if (new->async_tx.callback) { |
@@ -246,20 +262,98 @@ static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx) | |||
246 | first->async_tx.phys; | 262 | first->async_tx.phys; |
247 | __list_splice(&new_chain, ioat_chan->used_desc.prev); | 263 | __list_splice(&new_chain, ioat_chan->used_desc.prev); |
248 | 264 | ||
265 | ioat_chan->dmacount += desc_count; | ||
249 | ioat_chan->pending += desc_count; | 266 | ioat_chan->pending += desc_count; |
250 | if (ioat_chan->pending >= 4) { | 267 | if (ioat_chan->pending >= ioat_pending_level) |
251 | append = 1; | 268 | __ioat1_dma_memcpy_issue_pending(ioat_chan); |
252 | ioat_chan->pending = 0; | ||
253 | } | ||
254 | spin_unlock_bh(&ioat_chan->desc_lock); | 269 | spin_unlock_bh(&ioat_chan->desc_lock); |
255 | 270 | ||
256 | if (append) | 271 | return cookie; |
257 | writeb(IOAT_CHANCMD_APPEND, | 272 | } |
258 | ioat_chan->reg_base + IOAT_CHANCMD_OFFSET); | 273 | |
274 | static dma_cookie_t ioat2_tx_submit(struct dma_async_tx_descriptor *tx) | ||
275 | { | ||
276 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan); | ||
277 | struct ioat_desc_sw *first = tx_to_ioat_desc(tx); | ||
278 | struct ioat_desc_sw *new; | ||
279 | struct ioat_dma_descriptor *hw; | ||
280 | dma_cookie_t cookie; | ||
281 | u32 copy; | ||
282 | size_t len; | ||
283 | dma_addr_t src, dst; | ||
284 | int orig_ack; | ||
285 | unsigned int desc_count = 0; | ||
286 | |||
287 | /* src and dest and len are stored in the initial descriptor */ | ||
288 | len = first->len; | ||
289 | src = first->src; | ||
290 | dst = first->dst; | ||
291 | orig_ack = first->async_tx.ack; | ||
292 | new = first; | ||
293 | |||
294 | /* ioat_chan->desc_lock is still in force in version 2 path */ | ||
295 | |||
296 | do { | ||
297 | copy = min((u32) len, ioat_chan->xfercap); | ||
298 | |||
299 | new->async_tx.ack = 1; | ||
300 | |||
301 | hw = new->hw; | ||
302 | hw->size = copy; | ||
303 | hw->ctl = 0; | ||
304 | hw->src_addr = src; | ||
305 | hw->dst_addr = dst; | ||
306 | |||
307 | len -= copy; | ||
308 | dst += copy; | ||
309 | src += copy; | ||
310 | desc_count++; | ||
311 | } while (len && (new = ioat2_dma_get_next_descriptor(ioat_chan))); | ||
312 | |||
313 | hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; | ||
314 | if (new->async_tx.callback) { | ||
315 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; | ||
316 | if (first != new) { | ||
317 | /* move callback into to last desc */ | ||
318 | new->async_tx.callback = first->async_tx.callback; | ||
319 | new->async_tx.callback_param | ||
320 | = first->async_tx.callback_param; | ||
321 | first->async_tx.callback = NULL; | ||
322 | first->async_tx.callback_param = NULL; | ||
323 | } | ||
324 | } | ||
325 | |||
326 | new->tx_cnt = desc_count; | ||
327 | new->async_tx.ack = orig_ack; /* client is in control of this ack */ | ||
328 | |||
329 | /* store the original values for use in later cleanup */ | ||
330 | if (new != first) { | ||
331 | new->src = first->src; | ||
332 | new->dst = first->dst; | ||
333 | new->len = first->len; | ||
334 | } | ||
335 | |||
336 | /* cookie incr and addition to used_list must be atomic */ | ||
337 | cookie = ioat_chan->common.cookie; | ||
338 | cookie++; | ||
339 | if (cookie < 0) | ||
340 | cookie = 1; | ||
341 | ioat_chan->common.cookie = new->async_tx.cookie = cookie; | ||
342 | |||
343 | ioat_chan->dmacount += desc_count; | ||
344 | ioat_chan->pending += desc_count; | ||
345 | if (ioat_chan->pending >= ioat_pending_level) | ||
346 | __ioat2_dma_memcpy_issue_pending(ioat_chan); | ||
347 | spin_unlock_bh(&ioat_chan->desc_lock); | ||
259 | 348 | ||
260 | return cookie; | 349 | return cookie; |
261 | } | 350 | } |
262 | 351 | ||
352 | /** | ||
353 | * ioat_dma_alloc_descriptor - allocate and return a sw and hw descriptor pair | ||
354 | * @ioat_chan: the channel supplying the memory pool for the descriptors | ||
355 | * @flags: allocation flags | ||
356 | */ | ||
263 | static struct ioat_desc_sw *ioat_dma_alloc_descriptor( | 357 | static struct ioat_desc_sw *ioat_dma_alloc_descriptor( |
264 | struct ioat_dma_chan *ioat_chan, | 358 | struct ioat_dma_chan *ioat_chan, |
265 | gfp_t flags) | 359 | gfp_t flags) |
@@ -284,15 +378,57 @@ static struct ioat_desc_sw *ioat_dma_alloc_descriptor( | |||
284 | dma_async_tx_descriptor_init(&desc_sw->async_tx, &ioat_chan->common); | 378 | dma_async_tx_descriptor_init(&desc_sw->async_tx, &ioat_chan->common); |
285 | desc_sw->async_tx.tx_set_src = ioat_set_src; | 379 | desc_sw->async_tx.tx_set_src = ioat_set_src; |
286 | desc_sw->async_tx.tx_set_dest = ioat_set_dest; | 380 | desc_sw->async_tx.tx_set_dest = ioat_set_dest; |
287 | desc_sw->async_tx.tx_submit = ioat_tx_submit; | 381 | switch (ioat_chan->device->version) { |
382 | case IOAT_VER_1_2: | ||
383 | desc_sw->async_tx.tx_submit = ioat1_tx_submit; | ||
384 | break; | ||
385 | case IOAT_VER_2_0: | ||
386 | desc_sw->async_tx.tx_submit = ioat2_tx_submit; | ||
387 | break; | ||
388 | } | ||
288 | INIT_LIST_HEAD(&desc_sw->async_tx.tx_list); | 389 | INIT_LIST_HEAD(&desc_sw->async_tx.tx_list); |
390 | |||
289 | desc_sw->hw = desc; | 391 | desc_sw->hw = desc; |
290 | desc_sw->async_tx.phys = phys; | 392 | desc_sw->async_tx.phys = phys; |
291 | 393 | ||
292 | return desc_sw; | 394 | return desc_sw; |
293 | } | 395 | } |
294 | 396 | ||
295 | /* returns the actual number of allocated descriptors */ | 397 | static int ioat_initial_desc_count = 256; |
398 | module_param(ioat_initial_desc_count, int, 0644); | ||
399 | MODULE_PARM_DESC(ioat_initial_desc_count, | ||
400 | "initial descriptors per channel (default: 256)"); | ||
401 | |||
402 | /** | ||
403 | * ioat2_dma_massage_chan_desc - link the descriptors into a circle | ||
404 | * @ioat_chan: the channel to be massaged | ||
405 | */ | ||
406 | static void ioat2_dma_massage_chan_desc(struct ioat_dma_chan *ioat_chan) | ||
407 | { | ||
408 | struct ioat_desc_sw *desc, *_desc; | ||
409 | |||
410 | /* setup used_desc */ | ||
411 | ioat_chan->used_desc.next = ioat_chan->free_desc.next; | ||
412 | ioat_chan->used_desc.prev = NULL; | ||
413 | |||
414 | /* pull free_desc out of the circle so that every node is a hw | ||
415 | * descriptor, but leave it pointing to the list | ||
416 | */ | ||
417 | ioat_chan->free_desc.prev->next = ioat_chan->free_desc.next; | ||
418 | ioat_chan->free_desc.next->prev = ioat_chan->free_desc.prev; | ||
419 | |||
420 | /* circle link the hw descriptors */ | ||
421 | desc = to_ioat_desc(ioat_chan->free_desc.next); | ||
422 | desc->hw->next = to_ioat_desc(desc->node.next)->async_tx.phys; | ||
423 | list_for_each_entry_safe(desc, _desc, ioat_chan->free_desc.next, node) { | ||
424 | desc->hw->next = to_ioat_desc(desc->node.next)->async_tx.phys; | ||
425 | } | ||
426 | } | ||
427 | |||
428 | /** | ||
429 | * ioat_dma_alloc_chan_resources - returns the number of allocated descriptors | ||
430 | * @chan: the channel to be filled out | ||
431 | */ | ||
296 | static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) | 432 | static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) |
297 | { | 433 | { |
298 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); | 434 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); |
@@ -304,7 +440,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) | |||
304 | 440 | ||
305 | /* have we already been set up? */ | 441 | /* have we already been set up? */ |
306 | if (!list_empty(&ioat_chan->free_desc)) | 442 | if (!list_empty(&ioat_chan->free_desc)) |
307 | return INITIAL_IOAT_DESC_COUNT; | 443 | return ioat_chan->desccount; |
308 | 444 | ||
309 | /* Setup register to interrupt and write completion status on error */ | 445 | /* Setup register to interrupt and write completion status on error */ |
310 | chanctrl = IOAT_CHANCTRL_ERR_INT_EN | | 446 | chanctrl = IOAT_CHANCTRL_ERR_INT_EN | |
@@ -320,7 +456,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) | |||
320 | } | 456 | } |
321 | 457 | ||
322 | /* Allocate descriptors */ | 458 | /* Allocate descriptors */ |
323 | for (i = 0; i < INITIAL_IOAT_DESC_COUNT; i++) { | 459 | for (i = 0; i < ioat_initial_desc_count; i++) { |
324 | desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL); | 460 | desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL); |
325 | if (!desc) { | 461 | if (!desc) { |
326 | dev_err(&ioat_chan->device->pdev->dev, | 462 | dev_err(&ioat_chan->device->pdev->dev, |
@@ -330,7 +466,10 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) | |||
330 | list_add_tail(&desc->node, &tmp_list); | 466 | list_add_tail(&desc->node, &tmp_list); |
331 | } | 467 | } |
332 | spin_lock_bh(&ioat_chan->desc_lock); | 468 | spin_lock_bh(&ioat_chan->desc_lock); |
469 | ioat_chan->desccount = i; | ||
333 | list_splice(&tmp_list, &ioat_chan->free_desc); | 470 | list_splice(&tmp_list, &ioat_chan->free_desc); |
471 | if (ioat_chan->device->version != IOAT_VER_1_2) | ||
472 | ioat2_dma_massage_chan_desc(ioat_chan); | ||
334 | spin_unlock_bh(&ioat_chan->desc_lock); | 473 | spin_unlock_bh(&ioat_chan->desc_lock); |
335 | 474 | ||
336 | /* allocate a completion writeback area */ | 475 | /* allocate a completion writeback area */ |
@@ -347,10 +486,14 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) | |||
347 | ioat_chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); | 486 | ioat_chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); |
348 | 487 | ||
349 | tasklet_enable(&ioat_chan->cleanup_task); | 488 | tasklet_enable(&ioat_chan->cleanup_task); |
350 | ioat_dma_start_null_desc(ioat_chan); | 489 | ioat_dma_start_null_desc(ioat_chan); /* give chain to dma device */ |
351 | return i; | 490 | return ioat_chan->desccount; |
352 | } | 491 | } |
353 | 492 | ||
493 | /** | ||
494 | * ioat_dma_free_chan_resources - release all the descriptors | ||
495 | * @chan: the channel to be cleaned | ||
496 | */ | ||
354 | static void ioat_dma_free_chan_resources(struct dma_chan *chan) | 497 | static void ioat_dma_free_chan_resources(struct dma_chan *chan) |
355 | { | 498 | { |
356 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); | 499 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); |
@@ -364,22 +507,45 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
364 | /* Delay 100ms after reset to allow internal DMA logic to quiesce | 507 | /* Delay 100ms after reset to allow internal DMA logic to quiesce |
365 | * before removing DMA descriptor resources. | 508 | * before removing DMA descriptor resources. |
366 | */ | 509 | */ |
367 | writeb(IOAT_CHANCMD_RESET, ioat_chan->reg_base + IOAT_CHANCMD_OFFSET); | 510 | writeb(IOAT_CHANCMD_RESET, |
511 | ioat_chan->reg_base | ||
512 | + IOAT_CHANCMD_OFFSET(ioat_chan->device->version)); | ||
368 | mdelay(100); | 513 | mdelay(100); |
369 | 514 | ||
370 | spin_lock_bh(&ioat_chan->desc_lock); | 515 | spin_lock_bh(&ioat_chan->desc_lock); |
371 | list_for_each_entry_safe(desc, _desc, &ioat_chan->used_desc, node) { | 516 | switch (ioat_chan->device->version) { |
372 | in_use_descs++; | 517 | case IOAT_VER_1_2: |
373 | list_del(&desc->node); | 518 | list_for_each_entry_safe(desc, _desc, |
374 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, | 519 | &ioat_chan->used_desc, node) { |
375 | desc->async_tx.phys); | 520 | in_use_descs++; |
376 | kfree(desc); | 521 | list_del(&desc->node); |
377 | } | 522 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, |
378 | list_for_each_entry_safe(desc, _desc, &ioat_chan->free_desc, node) { | 523 | desc->async_tx.phys); |
379 | list_del(&desc->node); | 524 | kfree(desc); |
525 | } | ||
526 | list_for_each_entry_safe(desc, _desc, | ||
527 | &ioat_chan->free_desc, node) { | ||
528 | list_del(&desc->node); | ||
529 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, | ||
530 | desc->async_tx.phys); | ||
531 | kfree(desc); | ||
532 | } | ||
533 | break; | ||
534 | case IOAT_VER_2_0: | ||
535 | list_for_each_entry_safe(desc, _desc, | ||
536 | ioat_chan->free_desc.next, node) { | ||
537 | list_del(&desc->node); | ||
538 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, | ||
539 | desc->async_tx.phys); | ||
540 | kfree(desc); | ||
541 | } | ||
542 | desc = to_ioat_desc(ioat_chan->free_desc.next); | ||
380 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, | 543 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, |
381 | desc->async_tx.phys); | 544 | desc->async_tx.phys); |
382 | kfree(desc); | 545 | kfree(desc); |
546 | INIT_LIST_HEAD(&ioat_chan->free_desc); | ||
547 | INIT_LIST_HEAD(&ioat_chan->used_desc); | ||
548 | break; | ||
383 | } | 549 | } |
384 | spin_unlock_bh(&ioat_chan->desc_lock); | 550 | spin_unlock_bh(&ioat_chan->desc_lock); |
385 | 551 | ||
@@ -395,6 +561,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
395 | 561 | ||
396 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; | 562 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; |
397 | ioat_chan->pending = 0; | 563 | ioat_chan->pending = 0; |
564 | ioat_chan->dmacount = 0; | ||
398 | } | 565 | } |
399 | 566 | ||
400 | /** | 567 | /** |
@@ -406,7 +573,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
406 | * has run out. | 573 | * has run out. |
407 | */ | 574 | */ |
408 | static struct ioat_desc_sw * | 575 | static struct ioat_desc_sw * |
409 | ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) | 576 | ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) |
410 | { | 577 | { |
411 | struct ioat_desc_sw *new = NULL; | 578 | struct ioat_desc_sw *new = NULL; |
412 | 579 | ||
@@ -425,7 +592,82 @@ ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) | |||
425 | return new; | 592 | return new; |
426 | } | 593 | } |
427 | 594 | ||
428 | static struct dma_async_tx_descriptor *ioat_dma_prep_memcpy( | 595 | static struct ioat_desc_sw * |
596 | ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) | ||
597 | { | ||
598 | struct ioat_desc_sw *new = NULL; | ||
599 | |||
600 | /* | ||
601 | * used.prev points to where to start processing | ||
602 | * used.next points to next free descriptor | ||
603 | * if used.prev == NULL, there are none waiting to be processed | ||
604 | * if used.next == used.prev.prev, there is only one free descriptor, | ||
605 | * and we need to use it to as a noop descriptor before | ||
606 | * linking in a new set of descriptors, since the device | ||
607 | * has probably already read the pointer to it | ||
608 | */ | ||
609 | if (ioat_chan->used_desc.prev && | ||
610 | ioat_chan->used_desc.next == ioat_chan->used_desc.prev->prev) { | ||
611 | |||
612 | struct ioat_desc_sw *desc = NULL; | ||
613 | struct ioat_desc_sw *noop_desc = NULL; | ||
614 | int i; | ||
615 | |||
616 | /* set up the noop descriptor */ | ||
617 | noop_desc = to_ioat_desc(ioat_chan->used_desc.next); | ||
618 | noop_desc->hw->size = 0; | ||
619 | noop_desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL; | ||
620 | noop_desc->hw->src_addr = 0; | ||
621 | noop_desc->hw->dst_addr = 0; | ||
622 | |||
623 | ioat_chan->used_desc.next = ioat_chan->used_desc.next->next; | ||
624 | ioat_chan->pending++; | ||
625 | ioat_chan->dmacount++; | ||
626 | |||
627 | /* get a few more descriptors */ | ||
628 | for (i = 16; i; i--) { | ||
629 | desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_ATOMIC); | ||
630 | BUG_ON(!desc); | ||
631 | list_add_tail(&desc->node, ioat_chan->used_desc.next); | ||
632 | |||
633 | desc->hw->next | ||
634 | = to_ioat_desc(desc->node.next)->async_tx.phys; | ||
635 | to_ioat_desc(desc->node.prev)->hw->next | ||
636 | = desc->async_tx.phys; | ||
637 | ioat_chan->desccount++; | ||
638 | } | ||
639 | |||
640 | ioat_chan->used_desc.next = noop_desc->node.next; | ||
641 | } | ||
642 | new = to_ioat_desc(ioat_chan->used_desc.next); | ||
643 | prefetch(new); | ||
644 | ioat_chan->used_desc.next = new->node.next; | ||
645 | |||
646 | if (ioat_chan->used_desc.prev == NULL) | ||
647 | ioat_chan->used_desc.prev = &new->node; | ||
648 | |||
649 | prefetch(new->hw); | ||
650 | return new; | ||
651 | } | ||
652 | |||
653 | static struct ioat_desc_sw *ioat_dma_get_next_descriptor( | ||
654 | struct ioat_dma_chan *ioat_chan) | ||
655 | { | ||
656 | if (!ioat_chan) | ||
657 | return NULL; | ||
658 | |||
659 | switch (ioat_chan->device->version) { | ||
660 | case IOAT_VER_1_2: | ||
661 | return ioat1_dma_get_next_descriptor(ioat_chan); | ||
662 | break; | ||
663 | case IOAT_VER_2_0: | ||
664 | return ioat2_dma_get_next_descriptor(ioat_chan); | ||
665 | break; | ||
666 | } | ||
667 | return NULL; | ||
668 | } | ||
669 | |||
670 | static struct dma_async_tx_descriptor *ioat1_dma_prep_memcpy( | ||
429 | struct dma_chan *chan, | 671 | struct dma_chan *chan, |
430 | size_t len, | 672 | size_t len, |
431 | int int_en) | 673 | int int_en) |
@@ -441,19 +683,62 @@ static struct dma_async_tx_descriptor *ioat_dma_prep_memcpy( | |||
441 | return new ? &new->async_tx : NULL; | 683 | return new ? &new->async_tx : NULL; |
442 | } | 684 | } |
443 | 685 | ||
686 | static struct dma_async_tx_descriptor *ioat2_dma_prep_memcpy( | ||
687 | struct dma_chan *chan, | ||
688 | size_t len, | ||
689 | int int_en) | ||
690 | { | ||
691 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); | ||
692 | struct ioat_desc_sw *new; | ||
693 | |||
694 | spin_lock_bh(&ioat_chan->desc_lock); | ||
695 | new = ioat2_dma_get_next_descriptor(ioat_chan); | ||
696 | new->len = len; | ||
697 | |||
698 | /* leave ioat_chan->desc_lock set in version 2 path */ | ||
699 | return new ? &new->async_tx : NULL; | ||
700 | } | ||
701 | |||
702 | |||
444 | /** | 703 | /** |
445 | * ioat_dma_memcpy_issue_pending - push potentially unrecognized appended | 704 | * ioat_dma_memcpy_issue_pending - push potentially unrecognized appended |
446 | * descriptors to hw | 705 | * descriptors to hw |
447 | * @chan: DMA channel handle | 706 | * @chan: DMA channel handle |
448 | */ | 707 | */ |
449 | static void ioat_dma_memcpy_issue_pending(struct dma_chan *chan) | 708 | static inline void __ioat1_dma_memcpy_issue_pending( |
709 | struct ioat_dma_chan *ioat_chan) | ||
710 | { | ||
711 | ioat_chan->pending = 0; | ||
712 | writeb(IOAT_CHANCMD_APPEND, ioat_chan->reg_base + IOAT1_CHANCMD_OFFSET); | ||
713 | } | ||
714 | |||
715 | static void ioat1_dma_memcpy_issue_pending(struct dma_chan *chan) | ||
450 | { | 716 | { |
451 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); | 717 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); |
452 | 718 | ||
453 | if (ioat_chan->pending != 0) { | 719 | if (ioat_chan->pending != 0) { |
454 | ioat_chan->pending = 0; | 720 | spin_lock_bh(&ioat_chan->desc_lock); |
455 | writeb(IOAT_CHANCMD_APPEND, | 721 | __ioat1_dma_memcpy_issue_pending(ioat_chan); |
456 | ioat_chan->reg_base + IOAT_CHANCMD_OFFSET); | 722 | spin_unlock_bh(&ioat_chan->desc_lock); |
723 | } | ||
724 | } | ||
725 | |||
726 | static inline void __ioat2_dma_memcpy_issue_pending( | ||
727 | struct ioat_dma_chan *ioat_chan) | ||
728 | { | ||
729 | ioat_chan->pending = 0; | ||
730 | writew(ioat_chan->dmacount, | ||
731 | ioat_chan->reg_base + IOAT_CHAN_DMACOUNT_OFFSET); | ||
732 | } | ||
733 | |||
734 | static void ioat2_dma_memcpy_issue_pending(struct dma_chan *chan) | ||
735 | { | ||
736 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); | ||
737 | |||
738 | if (ioat_chan->pending != 0) { | ||
739 | spin_lock_bh(&ioat_chan->desc_lock); | ||
740 | __ioat2_dma_memcpy_issue_pending(ioat_chan); | ||
741 | spin_unlock_bh(&ioat_chan->desc_lock); | ||
457 | } | 742 | } |
458 | } | 743 | } |
459 | 744 | ||
@@ -465,11 +750,17 @@ static void ioat_dma_cleanup_tasklet(unsigned long data) | |||
465 | chan->reg_base + IOAT_CHANCTRL_OFFSET); | 750 | chan->reg_base + IOAT_CHANCTRL_OFFSET); |
466 | } | 751 | } |
467 | 752 | ||
753 | /** | ||
754 | * ioat_dma_memcpy_cleanup - cleanup up finished descriptors | ||
755 | * @chan: ioat channel to be cleaned up | ||
756 | */ | ||
468 | static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan) | 757 | static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan) |
469 | { | 758 | { |
470 | unsigned long phys_complete; | 759 | unsigned long phys_complete; |
471 | struct ioat_desc_sw *desc, *_desc; | 760 | struct ioat_desc_sw *desc, *_desc; |
472 | dma_cookie_t cookie = 0; | 761 | dma_cookie_t cookie = 0; |
762 | unsigned long desc_phys; | ||
763 | struct ioat_desc_sw *latest_desc; | ||
473 | 764 | ||
474 | prefetch(ioat_chan->completion_virt); | 765 | prefetch(ioat_chan->completion_virt); |
475 | 766 | ||
@@ -507,56 +798,115 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan) | |||
507 | 798 | ||
508 | cookie = 0; | 799 | cookie = 0; |
509 | spin_lock_bh(&ioat_chan->desc_lock); | 800 | spin_lock_bh(&ioat_chan->desc_lock); |
510 | list_for_each_entry_safe(desc, _desc, &ioat_chan->used_desc, node) { | 801 | switch (ioat_chan->device->version) { |
511 | 802 | case IOAT_VER_1_2: | |
512 | /* | 803 | list_for_each_entry_safe(desc, _desc, |
513 | * Incoming DMA requests may use multiple descriptors, due to | 804 | &ioat_chan->used_desc, node) { |
514 | * exceeding xfercap, perhaps. If so, only the last one will | ||
515 | * have a cookie, and require unmapping. | ||
516 | */ | ||
517 | if (desc->async_tx.cookie) { | ||
518 | cookie = desc->async_tx.cookie; | ||
519 | 805 | ||
520 | /* | 806 | /* |
521 | * yes we are unmapping both _page and _single alloc'd | 807 | * Incoming DMA requests may use multiple descriptors, |
522 | * regions with unmap_page. Is this *really* that bad? | 808 | * due to exceeding xfercap, perhaps. If so, only the |
809 | * last one will have a cookie, and require unmapping. | ||
523 | */ | 810 | */ |
524 | pci_unmap_page(ioat_chan->device->pdev, | 811 | if (desc->async_tx.cookie) { |
525 | pci_unmap_addr(desc, dst), | 812 | cookie = desc->async_tx.cookie; |
526 | pci_unmap_len(desc, len), | 813 | |
527 | PCI_DMA_FROMDEVICE); | 814 | /* |
528 | pci_unmap_page(ioat_chan->device->pdev, | 815 | * yes we are unmapping both _page and _single |
529 | pci_unmap_addr(desc, src), | 816 | * alloc'd regions with unmap_page. Is this |
530 | pci_unmap_len(desc, len), | 817 | * *really* that bad? |
531 | PCI_DMA_TODEVICE); | 818 | */ |
532 | if (desc->async_tx.callback) { | 819 | pci_unmap_page(ioat_chan->device->pdev, |
533 | desc->async_tx.callback( | 820 | pci_unmap_addr(desc, dst), |
534 | desc->async_tx.callback_param); | 821 | pci_unmap_len(desc, len), |
535 | desc->async_tx.callback = NULL; | 822 | PCI_DMA_FROMDEVICE); |
823 | pci_unmap_page(ioat_chan->device->pdev, | ||
824 | pci_unmap_addr(desc, src), | ||
825 | pci_unmap_len(desc, len), | ||
826 | PCI_DMA_TODEVICE); | ||
827 | |||
828 | if (desc->async_tx.callback) { | ||
829 | desc->async_tx.callback(desc->async_tx.callback_param); | ||
830 | desc->async_tx.callback = NULL; | ||
831 | } | ||
536 | } | 832 | } |
537 | } | ||
538 | 833 | ||
539 | if (desc->async_tx.phys != phys_complete) { | 834 | if (desc->async_tx.phys != phys_complete) { |
540 | /* | 835 | /* |
541 | * a completed entry, but not the last, so cleanup | 836 | * a completed entry, but not the last, so clean |
542 | * if the client is done with the descriptor | 837 | * up if the client is done with the descriptor |
543 | */ | 838 | */ |
544 | if (desc->async_tx.ack) { | 839 | if (desc->async_tx.ack) { |
545 | list_del(&desc->node); | 840 | list_del(&desc->node); |
546 | list_add_tail(&desc->node, | 841 | list_add_tail(&desc->node, |
547 | &ioat_chan->free_desc); | 842 | &ioat_chan->free_desc); |
548 | } else | 843 | } else |
844 | desc->async_tx.cookie = 0; | ||
845 | } else { | ||
846 | /* | ||
847 | * last used desc. Do not remove, so we can | ||
848 | * append from it, but don't look at it next | ||
849 | * time, either | ||
850 | */ | ||
549 | desc->async_tx.cookie = 0; | 851 | desc->async_tx.cookie = 0; |
550 | } else { | ||
551 | /* | ||
552 | * last used desc. Do not remove, so we can append from | ||
553 | * it, but don't look at it next time, either | ||
554 | */ | ||
555 | desc->async_tx.cookie = 0; | ||
556 | 852 | ||
557 | /* TODO check status bits? */ | 853 | /* TODO check status bits? */ |
854 | break; | ||
855 | } | ||
856 | } | ||
857 | break; | ||
858 | case IOAT_VER_2_0: | ||
859 | /* has some other thread has already cleaned up? */ | ||
860 | if (ioat_chan->used_desc.prev == NULL) | ||
558 | break; | 861 | break; |
862 | |||
863 | /* work backwards to find latest finished desc */ | ||
864 | desc = to_ioat_desc(ioat_chan->used_desc.next); | ||
865 | latest_desc = NULL; | ||
866 | do { | ||
867 | desc = to_ioat_desc(desc->node.prev); | ||
868 | desc_phys = (unsigned long)desc->async_tx.phys | ||
869 | & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR; | ||
870 | if (desc_phys == phys_complete) { | ||
871 | latest_desc = desc; | ||
872 | break; | ||
873 | } | ||
874 | } while (&desc->node != ioat_chan->used_desc.prev); | ||
875 | |||
876 | if (latest_desc != NULL) { | ||
877 | |||
878 | /* work forwards to clear finished descriptors */ | ||
879 | for (desc = to_ioat_desc(ioat_chan->used_desc.prev); | ||
880 | &desc->node != latest_desc->node.next && | ||
881 | &desc->node != ioat_chan->used_desc.next; | ||
882 | desc = to_ioat_desc(desc->node.next)) { | ||
883 | if (desc->async_tx.cookie) { | ||
884 | cookie = desc->async_tx.cookie; | ||
885 | desc->async_tx.cookie = 0; | ||
886 | |||
887 | pci_unmap_page(ioat_chan->device->pdev, | ||
888 | pci_unmap_addr(desc, dst), | ||
889 | pci_unmap_len(desc, len), | ||
890 | PCI_DMA_FROMDEVICE); | ||
891 | pci_unmap_page(ioat_chan->device->pdev, | ||
892 | pci_unmap_addr(desc, src), | ||
893 | pci_unmap_len(desc, len), | ||
894 | PCI_DMA_TODEVICE); | ||
895 | |||
896 | if (desc->async_tx.callback) { | ||
897 | desc->async_tx.callback(desc->async_tx.callback_param); | ||
898 | desc->async_tx.callback = NULL; | ||
899 | } | ||
900 | } | ||
901 | } | ||
902 | |||
903 | /* move used.prev up beyond those that are finished */ | ||
904 | if (&desc->node == ioat_chan->used_desc.next) | ||
905 | ioat_chan->used_desc.prev = NULL; | ||
906 | else | ||
907 | ioat_chan->used_desc.prev = &desc->node; | ||
559 | } | 908 | } |
909 | break; | ||
560 | } | 910 | } |
561 | 911 | ||
562 | spin_unlock_bh(&ioat_chan->desc_lock); | 912 | spin_unlock_bh(&ioat_chan->desc_lock); |
@@ -621,8 +971,6 @@ static enum dma_status ioat_dma_is_complete(struct dma_chan *chan, | |||
621 | return dma_async_is_complete(cookie, last_complete, last_used); | 971 | return dma_async_is_complete(cookie, last_complete, last_used); |
622 | } | 972 | } |
623 | 973 | ||
624 | /* PCI API */ | ||
625 | |||
626 | static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) | 974 | static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) |
627 | { | 975 | { |
628 | struct ioat_desc_sw *desc; | 976 | struct ioat_desc_sw *desc; |
@@ -633,21 +981,34 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) | |||
633 | desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL | 981 | desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL |
634 | | IOAT_DMA_DESCRIPTOR_CTL_INT_GN | 982 | | IOAT_DMA_DESCRIPTOR_CTL_INT_GN |
635 | | IOAT_DMA_DESCRIPTOR_CTL_CP_STS; | 983 | | IOAT_DMA_DESCRIPTOR_CTL_CP_STS; |
636 | desc->hw->next = 0; | ||
637 | desc->hw->size = 0; | 984 | desc->hw->size = 0; |
638 | desc->hw->src_addr = 0; | 985 | desc->hw->src_addr = 0; |
639 | desc->hw->dst_addr = 0; | 986 | desc->hw->dst_addr = 0; |
640 | desc->async_tx.ack = 1; | 987 | desc->async_tx.ack = 1; |
641 | 988 | switch (ioat_chan->device->version) { | |
642 | list_add_tail(&desc->node, &ioat_chan->used_desc); | 989 | case IOAT_VER_1_2: |
990 | desc->hw->next = 0; | ||
991 | list_add_tail(&desc->node, &ioat_chan->used_desc); | ||
992 | |||
993 | writel(((u64) desc->async_tx.phys) & 0x00000000FFFFFFFF, | ||
994 | ioat_chan->reg_base + IOAT1_CHAINADDR_OFFSET_LOW); | ||
995 | writel(((u64) desc->async_tx.phys) >> 32, | ||
996 | ioat_chan->reg_base + IOAT1_CHAINADDR_OFFSET_HIGH); | ||
997 | |||
998 | writeb(IOAT_CHANCMD_START, ioat_chan->reg_base | ||
999 | + IOAT_CHANCMD_OFFSET(ioat_chan->device->version)); | ||
1000 | break; | ||
1001 | case IOAT_VER_2_0: | ||
1002 | writel(((u64) desc->async_tx.phys) & 0x00000000FFFFFFFF, | ||
1003 | ioat_chan->reg_base + IOAT2_CHAINADDR_OFFSET_LOW); | ||
1004 | writel(((u64) desc->async_tx.phys) >> 32, | ||
1005 | ioat_chan->reg_base + IOAT2_CHAINADDR_OFFSET_HIGH); | ||
1006 | |||
1007 | ioat_chan->dmacount++; | ||
1008 | __ioat2_dma_memcpy_issue_pending(ioat_chan); | ||
1009 | break; | ||
1010 | } | ||
643 | spin_unlock_bh(&ioat_chan->desc_lock); | 1011 | spin_unlock_bh(&ioat_chan->desc_lock); |
644 | |||
645 | writel(((u64) desc->async_tx.phys) & 0x00000000FFFFFFFF, | ||
646 | ioat_chan->reg_base + IOAT_CHAINADDR_OFFSET_LOW); | ||
647 | writel(((u64) desc->async_tx.phys) >> 32, | ||
648 | ioat_chan->reg_base + IOAT_CHAINADDR_OFFSET_HIGH); | ||
649 | |||
650 | writeb(IOAT_CHANCMD_START, ioat_chan->reg_base + IOAT_CHANCMD_OFFSET); | ||
651 | } | 1012 | } |
652 | 1013 | ||
653 | /* | 1014 | /* |
@@ -693,14 +1054,14 @@ static int ioat_dma_self_test(struct ioatdma_device *device) | |||
693 | dma_chan = container_of(device->common.channels.next, | 1054 | dma_chan = container_of(device->common.channels.next, |
694 | struct dma_chan, | 1055 | struct dma_chan, |
695 | device_node); | 1056 | device_node); |
696 | if (ioat_dma_alloc_chan_resources(dma_chan) < 1) { | 1057 | if (device->common.device_alloc_chan_resources(dma_chan) < 1) { |
697 | dev_err(&device->pdev->dev, | 1058 | dev_err(&device->pdev->dev, |
698 | "selftest cannot allocate chan resource\n"); | 1059 | "selftest cannot allocate chan resource\n"); |
699 | err = -ENODEV; | 1060 | err = -ENODEV; |
700 | goto out; | 1061 | goto out; |
701 | } | 1062 | } |
702 | 1063 | ||
703 | tx = ioat_dma_prep_memcpy(dma_chan, IOAT_TEST_SIZE, 0); | 1064 | tx = device->common.device_prep_dma_memcpy(dma_chan, IOAT_TEST_SIZE, 0); |
704 | if (!tx) { | 1065 | if (!tx) { |
705 | dev_err(&device->pdev->dev, | 1066 | dev_err(&device->pdev->dev, |
706 | "Self-test prep failed, disabling\n"); | 1067 | "Self-test prep failed, disabling\n"); |
@@ -710,24 +1071,25 @@ static int ioat_dma_self_test(struct ioatdma_device *device) | |||
710 | 1071 | ||
711 | async_tx_ack(tx); | 1072 | async_tx_ack(tx); |
712 | addr = dma_map_single(dma_chan->device->dev, src, IOAT_TEST_SIZE, | 1073 | addr = dma_map_single(dma_chan->device->dev, src, IOAT_TEST_SIZE, |
713 | DMA_TO_DEVICE); | 1074 | DMA_TO_DEVICE); |
714 | ioat_set_src(addr, tx, 0); | 1075 | tx->tx_set_src(addr, tx, 0); |
715 | addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, | 1076 | addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, |
716 | DMA_FROM_DEVICE); | 1077 | DMA_FROM_DEVICE); |
717 | ioat_set_dest(addr, tx, 0); | 1078 | tx->tx_set_dest(addr, tx, 0); |
718 | tx->callback = ioat_dma_test_callback; | 1079 | tx->callback = ioat_dma_test_callback; |
719 | tx->callback_param = (void *)0x8086; | 1080 | tx->callback_param = (void *)0x8086; |
720 | cookie = ioat_tx_submit(tx); | 1081 | cookie = tx->tx_submit(tx); |
721 | if (cookie < 0) { | 1082 | if (cookie < 0) { |
722 | dev_err(&device->pdev->dev, | 1083 | dev_err(&device->pdev->dev, |
723 | "Self-test setup failed, disabling\n"); | 1084 | "Self-test setup failed, disabling\n"); |
724 | err = -ENODEV; | 1085 | err = -ENODEV; |
725 | goto free_resources; | 1086 | goto free_resources; |
726 | } | 1087 | } |
727 | ioat_dma_memcpy_issue_pending(dma_chan); | 1088 | device->common.device_issue_pending(dma_chan); |
728 | msleep(1); | 1089 | msleep(1); |
729 | 1090 | ||
730 | if (ioat_dma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { | 1091 | if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL) |
1092 | != DMA_SUCCESS) { | ||
731 | dev_err(&device->pdev->dev, | 1093 | dev_err(&device->pdev->dev, |
732 | "Self-test copy timed out, disabling\n"); | 1094 | "Self-test copy timed out, disabling\n"); |
733 | err = -ENODEV; | 1095 | err = -ENODEV; |
@@ -741,7 +1103,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device) | |||
741 | } | 1103 | } |
742 | 1104 | ||
743 | free_resources: | 1105 | free_resources: |
744 | ioat_dma_free_chan_resources(dma_chan); | 1106 | device->common.device_free_chan_resources(dma_chan); |
745 | out: | 1107 | out: |
746 | kfree(src); | 1108 | kfree(src); |
747 | kfree(dest); | 1109 | kfree(dest); |
@@ -941,16 +1303,28 @@ struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev, | |||
941 | INIT_LIST_HEAD(&device->common.channels); | 1303 | INIT_LIST_HEAD(&device->common.channels); |
942 | ioat_dma_enumerate_channels(device); | 1304 | ioat_dma_enumerate_channels(device); |
943 | 1305 | ||
944 | dma_cap_set(DMA_MEMCPY, device->common.cap_mask); | ||
945 | device->common.device_alloc_chan_resources = | 1306 | device->common.device_alloc_chan_resources = |
946 | ioat_dma_alloc_chan_resources; | 1307 | ioat_dma_alloc_chan_resources; |
947 | device->common.device_free_chan_resources = | 1308 | device->common.device_free_chan_resources = |
948 | ioat_dma_free_chan_resources; | 1309 | ioat_dma_free_chan_resources; |
949 | device->common.device_prep_dma_memcpy = ioat_dma_prep_memcpy; | 1310 | device->common.dev = &pdev->dev; |
1311 | |||
1312 | dma_cap_set(DMA_MEMCPY, device->common.cap_mask); | ||
950 | device->common.device_is_tx_complete = ioat_dma_is_complete; | 1313 | device->common.device_is_tx_complete = ioat_dma_is_complete; |
951 | device->common.device_issue_pending = ioat_dma_memcpy_issue_pending; | ||
952 | device->common.device_dependency_added = ioat_dma_dependency_added; | 1314 | device->common.device_dependency_added = ioat_dma_dependency_added; |
953 | device->common.dev = &pdev->dev; | 1315 | switch (device->version) { |
1316 | case IOAT_VER_1_2: | ||
1317 | device->common.device_prep_dma_memcpy = ioat1_dma_prep_memcpy; | ||
1318 | device->common.device_issue_pending = | ||
1319 | ioat1_dma_memcpy_issue_pending; | ||
1320 | break; | ||
1321 | case IOAT_VER_2_0: | ||
1322 | device->common.device_prep_dma_memcpy = ioat2_dma_prep_memcpy; | ||
1323 | device->common.device_issue_pending = | ||
1324 | ioat2_dma_memcpy_issue_pending; | ||
1325 | break; | ||
1326 | } | ||
1327 | |||
954 | dev_err(&device->pdev->dev, | 1328 | dev_err(&device->pdev->dev, |
955 | "Intel(R) I/OAT DMA Engine found," | 1329 | "Intel(R) I/OAT DMA Engine found," |
956 | " %d channels, device version 0x%02x, driver version %s\n", | 1330 | " %d channels, device version 0x%02x, driver version %s\n", |
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h index 5f9881e7b0ed..b668234ef654 100644 --- a/drivers/dma/ioatdma.h +++ b/drivers/dma/ioatdma.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved. | 2 | * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of the GNU General Public License as published by the Free | 5 | * under the terms of the GNU General Public License as published by the Free |
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/cache.h> | 28 | #include <linux/cache.h> |
29 | #include <linux/pci_ids.h> | 29 | #include <linux/pci_ids.h> |
30 | 30 | ||
31 | #define IOAT_DMA_VERSION "1.26" | 31 | #define IOAT_DMA_VERSION "2.04" |
32 | 32 | ||
33 | enum ioat_interrupt { | 33 | enum ioat_interrupt { |
34 | none = 0, | 34 | none = 0, |
@@ -39,6 +39,8 @@ enum ioat_interrupt { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | #define IOAT_LOW_COMPLETION_MASK 0xffffffc0 | 41 | #define IOAT_LOW_COMPLETION_MASK 0xffffffc0 |
42 | #define IOAT_DMA_DCA_ANY_CPU ~0 | ||
43 | |||
42 | 44 | ||
43 | /** | 45 | /** |
44 | * struct ioatdma_device - internal representation of a IOAT device | 46 | * struct ioatdma_device - internal representation of a IOAT device |
@@ -47,6 +49,9 @@ enum ioat_interrupt { | |||
47 | * @dma_pool: for allocating DMA descriptors | 49 | * @dma_pool: for allocating DMA descriptors |
48 | * @common: embedded struct dma_device | 50 | * @common: embedded struct dma_device |
49 | * @version: version of ioatdma device | 51 | * @version: version of ioatdma device |
52 | * @irq_mode: which style irq to use | ||
53 | * @msix_entries: irq handlers | ||
54 | * @idx: per channel data | ||
50 | */ | 55 | */ |
51 | 56 | ||
52 | struct ioatdma_device { | 57 | struct ioatdma_device { |
@@ -63,23 +68,7 @@ struct ioatdma_device { | |||
63 | 68 | ||
64 | /** | 69 | /** |
65 | * struct ioat_dma_chan - internal representation of a DMA channel | 70 | * struct ioat_dma_chan - internal representation of a DMA channel |
66 | * @device: | ||
67 | * @reg_base: | ||
68 | * @sw_in_use: | ||
69 | * @completion: | ||
70 | * @completion_low: | ||
71 | * @completion_high: | ||
72 | * @completed_cookie: last cookie seen completed on cleanup | ||
73 | * @cookie: value of last cookie given to client | ||
74 | * @last_completion: | ||
75 | * @xfercap: | ||
76 | * @desc_lock: | ||
77 | * @free_desc: | ||
78 | * @used_desc: | ||
79 | * @resource: | ||
80 | * @device_node: | ||
81 | */ | 71 | */ |
82 | |||
83 | struct ioat_dma_chan { | 72 | struct ioat_dma_chan { |
84 | 73 | ||
85 | void __iomem *reg_base; | 74 | void __iomem *reg_base; |
@@ -95,6 +84,8 @@ struct ioat_dma_chan { | |||
95 | struct list_head used_desc; | 84 | struct list_head used_desc; |
96 | 85 | ||
97 | int pending; | 86 | int pending; |
87 | int dmacount; | ||
88 | int desccount; | ||
98 | 89 | ||
99 | struct ioatdma_device *device; | 90 | struct ioatdma_device *device; |
100 | struct dma_chan common; | 91 | struct dma_chan common; |
@@ -134,12 +125,13 @@ struct ioat_desc_sw { | |||
134 | struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev, | 125 | struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev, |
135 | void __iomem *iobase); | 126 | void __iomem *iobase); |
136 | void ioat_dma_remove(struct ioatdma_device *device); | 127 | void ioat_dma_remove(struct ioatdma_device *device); |
137 | struct dca_provider *ioat_dca_init(struct pci_dev *pdev, | 128 | struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase); |
138 | void __iomem *iobase); | 129 | struct dca_provider *ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase); |
139 | #else | 130 | #else |
140 | #define ioat_dma_probe(pdev, iobase) NULL | 131 | #define ioat_dma_probe(pdev, iobase) NULL |
141 | #define ioat_dma_remove(device) do { } while (0) | 132 | #define ioat_dma_remove(device) do { } while (0) |
142 | #define ioat_dca_init(pdev, iobase) NULL | 133 | #define ioat_dca_init(pdev, iobase) NULL |
134 | #define ioat2_dca_init(pdev, iobase) NULL | ||
143 | #endif | 135 | #endif |
144 | 136 | ||
145 | #endif /* IOATDMA_H */ | 137 | #endif /* IOATDMA_H */ |
diff --git a/drivers/dma/ioatdma_hw.h b/drivers/dma/ioatdma_hw.h index 9e7434e1551f..dd470fa91d86 100644 --- a/drivers/dma/ioatdma_hw.h +++ b/drivers/dma/ioatdma_hw.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved. | 2 | * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of the GNU General Public License as published by the Free | 5 | * under the terms of the GNU General Public License as published by the Free |
@@ -22,12 +22,19 @@ | |||
22 | #define _IOAT_HW_H_ | 22 | #define _IOAT_HW_H_ |
23 | 23 | ||
24 | /* PCI Configuration Space Values */ | 24 | /* PCI Configuration Space Values */ |
25 | #define IOAT_PCI_VID 0x8086 | 25 | #define IOAT_PCI_VID 0x8086 |
26 | #define IOAT_PCI_DID 0x1A38 | 26 | |
27 | #define IOAT_PCI_RID 0x00 | 27 | /* CB device ID's */ |
28 | #define IOAT_PCI_SVID 0x8086 | 28 | #define IOAT_PCI_DID_5000 0x1A38 |
29 | #define IOAT_PCI_SID 0x8086 | 29 | #define IOAT_PCI_DID_CNB 0x360B |
30 | #define IOAT_VER_1_2 0x12 /* Version 1.2 */ | 30 | #define IOAT_PCI_DID_SCNB 0x65FF |
31 | #define IOAT_PCI_DID_SNB 0x402F | ||
32 | |||
33 | #define IOAT_PCI_RID 0x00 | ||
34 | #define IOAT_PCI_SVID 0x8086 | ||
35 | #define IOAT_PCI_SID 0x8086 | ||
36 | #define IOAT_VER_1_2 0x12 /* Version 1.2 */ | ||
37 | #define IOAT_VER_2_0 0x20 /* Version 2.0 */ | ||
31 | 38 | ||
32 | struct ioat_dma_descriptor { | 39 | struct ioat_dma_descriptor { |
33 | uint32_t size; | 40 | uint32_t size; |
@@ -47,6 +54,16 @@ struct ioat_dma_descriptor { | |||
47 | #define IOAT_DMA_DESCRIPTOR_CTL_CP_STS 0x00000008 | 54 | #define IOAT_DMA_DESCRIPTOR_CTL_CP_STS 0x00000008 |
48 | #define IOAT_DMA_DESCRIPTOR_CTL_FRAME 0x00000010 | 55 | #define IOAT_DMA_DESCRIPTOR_CTL_FRAME 0x00000010 |
49 | #define IOAT_DMA_DESCRIPTOR_NUL 0x00000020 | 56 | #define IOAT_DMA_DESCRIPTOR_NUL 0x00000020 |
50 | #define IOAT_DMA_DESCRIPTOR_OPCODE 0xFF000000 | 57 | #define IOAT_DMA_DESCRIPTOR_CTL_SP_BRK 0x00000040 |
58 | #define IOAT_DMA_DESCRIPTOR_CTL_DP_BRK 0x00000080 | ||
59 | #define IOAT_DMA_DESCRIPTOR_CTL_BNDL 0x00000100 | ||
60 | #define IOAT_DMA_DESCRIPTOR_CTL_DCA 0x00000200 | ||
61 | #define IOAT_DMA_DESCRIPTOR_CTL_BUFHINT 0x00000400 | ||
62 | |||
63 | #define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_CONTEXT 0xFF000000 | ||
64 | #define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_DMA 0x00000000 | ||
65 | |||
66 | #define IOAT_DMA_DESCRIPTOR_CTL_CONTEXT_DCA 0x00000001 | ||
67 | #define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_MASK 0xFF000000 | ||
51 | 68 | ||
52 | #endif | 69 | #endif |
diff --git a/drivers/dma/ioatdma_registers.h b/drivers/dma/ioatdma_registers.h index baaab5ea146a..9832d7ebd931 100644 --- a/drivers/dma/ioatdma_registers.h +++ b/drivers/dma/ioatdma_registers.h | |||
@@ -42,26 +42,25 @@ | |||
42 | #define IOAT_INTRCTRL_MASTER_INT_EN 0x01 /* Master Interrupt Enable */ | 42 | #define IOAT_INTRCTRL_MASTER_INT_EN 0x01 /* Master Interrupt Enable */ |
43 | #define IOAT_INTRCTRL_INT_STATUS 0x02 /* ATTNSTATUS -or- Channel Int */ | 43 | #define IOAT_INTRCTRL_INT_STATUS 0x02 /* ATTNSTATUS -or- Channel Int */ |
44 | #define IOAT_INTRCTRL_INT 0x04 /* INT_STATUS -and- MASTER_INT_EN */ | 44 | #define IOAT_INTRCTRL_INT 0x04 /* INT_STATUS -and- MASTER_INT_EN */ |
45 | #define IOAT_INTRCTRL_MSIX_VECTOR_CONTROL 0x08 /* Enable all MSI-X vectors */ | 45 | #define IOAT_INTRCTRL_MSIX_VECTOR_CONTROL 0x08 /* Enable all MSI-X vectors */ |
46 | 46 | ||
47 | #define IOAT_ATTNSTATUS_OFFSET 0x04 /* Each bit is a channel */ | 47 | #define IOAT_ATTNSTATUS_OFFSET 0x04 /* Each bit is a channel */ |
48 | 48 | ||
49 | #define IOAT_VER_OFFSET 0x08 /* 8-bit */ | 49 | #define IOAT_VER_OFFSET 0x08 /* 8-bit */ |
50 | #define IOAT_VER_MAJOR_MASK 0xF0 | 50 | #define IOAT_VER_MAJOR_MASK 0xF0 |
51 | #define IOAT_VER_MINOR_MASK 0x0F | 51 | #define IOAT_VER_MINOR_MASK 0x0F |
52 | #define GET_IOAT_VER_MAJOR(x) ((x) & IOAT_VER_MAJOR_MASK) | 52 | #define GET_IOAT_VER_MAJOR(x) (((x) & IOAT_VER_MAJOR_MASK) >> 4) |
53 | #define GET_IOAT_VER_MINOR(x) ((x) & IOAT_VER_MINOR_MASK) | 53 | #define GET_IOAT_VER_MINOR(x) ((x) & IOAT_VER_MINOR_MASK) |
54 | 54 | ||
55 | #define IOAT_PERPORTOFFSET_OFFSET 0x0A /* 16-bit */ | 55 | #define IOAT_PERPORTOFFSET_OFFSET 0x0A /* 16-bit */ |
56 | 56 | ||
57 | #define IOAT_INTRDELAY_OFFSET 0x0C /* 16-bit */ | 57 | #define IOAT_INTRDELAY_OFFSET 0x0C /* 16-bit */ |
58 | #define IOAT_INTRDELAY_INT_DELAY_MASK 0x3FFF /* Interrupt Delay Time */ | 58 | #define IOAT_INTRDELAY_INT_DELAY_MASK 0x3FFF /* Interrupt Delay Time */ |
59 | #define IOAT_INTRDELAY_COALESE_SUPPORT 0x8000 /* Interrupt Coalesing Supported */ | 59 | #define IOAT_INTRDELAY_COALESE_SUPPORT 0x8000 /* Interrupt Coalescing Supported */ |
60 | 60 | ||
61 | #define IOAT_DEVICE_STATUS_OFFSET 0x0E /* 16-bit */ | 61 | #define IOAT_DEVICE_STATUS_OFFSET 0x0E /* 16-bit */ |
62 | #define IOAT_DEVICE_STATUS_DEGRADED_MODE 0x0001 | 62 | #define IOAT_DEVICE_STATUS_DEGRADED_MODE 0x0001 |
63 | 63 | ||
64 | |||
65 | #define IOAT_CHANNEL_MMIO_SIZE 0x80 /* Each Channel MMIO space is this size */ | 64 | #define IOAT_CHANNEL_MMIO_SIZE 0x80 /* Each Channel MMIO space is this size */ |
66 | 65 | ||
67 | /* DMA Channel Registers */ | 66 | /* DMA Channel Registers */ |
@@ -74,25 +73,101 @@ | |||
74 | #define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004 | 73 | #define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004 |
75 | #define IOAT_CHANCTRL_INT_DISABLE 0x0001 | 74 | #define IOAT_CHANCTRL_INT_DISABLE 0x0001 |
76 | 75 | ||
77 | #define IOAT_DMA_COMP_OFFSET 0x02 /* 16-bit DMA channel compatability */ | 76 | #define IOAT_DMA_COMP_OFFSET 0x02 /* 16-bit DMA channel compatibility */ |
78 | #define IOAT_DMA_COMP_V1 0x0001 /* Compatability with DMA version 1 */ | 77 | #define IOAT_DMA_COMP_V1 0x0001 /* Compatibility with DMA version 1 */ |
79 | 78 | #define IOAT_DMA_COMP_V2 0x0002 /* Compatibility with DMA version 2 */ | |
80 | #define IOAT_CHANSTS_OFFSET 0x04 /* 64-bit Channel Status Register */ | 79 | |
81 | #define IOAT_CHANSTS_OFFSET_LOW 0x04 | 80 | |
82 | #define IOAT_CHANSTS_OFFSET_HIGH 0x08 | 81 | #define IOAT1_CHANSTS_OFFSET 0x04 /* 64-bit Channel Status Register */ |
83 | #define IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR 0xFFFFFFFFFFFFFFC0UL | 82 | #define IOAT2_CHANSTS_OFFSET 0x08 /* 64-bit Channel Status Register */ |
83 | #define IOAT_CHANSTS_OFFSET(ver) ((ver) < IOAT_VER_2_0 \ | ||
84 | ? IOAT1_CHANSTS_OFFSET : IOAT2_CHANSTS_OFFSET) | ||
85 | #define IOAT1_CHANSTS_OFFSET_LOW 0x04 | ||
86 | #define IOAT2_CHANSTS_OFFSET_LOW 0x08 | ||
87 | #define IOAT_CHANSTS_OFFSET_LOW(ver) ((ver) < IOAT_VER_2_0 \ | ||
88 | ? IOAT1_CHANSTS_OFFSET_LOW : IOAT2_CHANSTS_OFFSET_LOW) | ||
89 | #define IOAT1_CHANSTS_OFFSET_HIGH 0x08 | ||
90 | #define IOAT2_CHANSTS_OFFSET_HIGH 0x0C | ||
91 | #define IOAT_CHANSTS_OFFSET_HIGH(ver) ((ver) < IOAT_VER_2_0 \ | ||
92 | ? IOAT1_CHANSTS_OFFSET_HIGH : IOAT2_CHANSTS_OFFSET_HIGH) | ||
93 | #define IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR ~0x3F | ||
84 | #define IOAT_CHANSTS_SOFT_ERR 0x0000000000000010 | 94 | #define IOAT_CHANSTS_SOFT_ERR 0x0000000000000010 |
95 | #define IOAT_CHANSTS_UNAFFILIATED_ERR 0x0000000000000008 | ||
85 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS 0x0000000000000007 | 96 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS 0x0000000000000007 |
86 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_ACTIVE 0x0 | 97 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_ACTIVE 0x0 |
87 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_DONE 0x1 | 98 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_DONE 0x1 |
88 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_SUSPENDED 0x2 | 99 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_SUSPENDED 0x2 |
89 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED 0x3 | 100 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED 0x3 |
90 | 101 | ||
91 | #define IOAT_CHAINADDR_OFFSET 0x0C /* 64-bit Descriptor Chain Address Register */ | ||
92 | #define IOAT_CHAINADDR_OFFSET_LOW 0x0C | ||
93 | #define IOAT_CHAINADDR_OFFSET_HIGH 0x10 | ||
94 | 102 | ||
95 | #define IOAT_CHANCMD_OFFSET 0x14 /* 8-bit DMA Channel Command Register */ | 103 | |
104 | #define IOAT_CHAN_DMACOUNT_OFFSET 0x06 /* 16-bit DMA Count register */ | ||
105 | |||
106 | #define IOAT_DCACTRL_OFFSET 0x30 /* 32 bit Direct Cache Access Control Register */ | ||
107 | #define IOAT_DCACTRL_CMPL_WRITE_ENABLE 0x10000 | ||
108 | #define IOAT_DCACTRL_TARGET_CPU_MASK 0xFFFF /* APIC ID */ | ||
109 | |||
110 | /* CB DCA Memory Space Registers */ | ||
111 | #define IOAT_DCAOFFSET_OFFSET 0x14 | ||
112 | /* CB_BAR + IOAT_DCAOFFSET value */ | ||
113 | #define IOAT_DCA_VER_OFFSET 0x00 | ||
114 | #define IOAT_DCA_VER_MAJOR_MASK 0xF0 | ||
115 | #define IOAT_DCA_VER_MINOR_MASK 0x0F | ||
116 | |||
117 | #define IOAT_DCA_COMP_OFFSET 0x02 | ||
118 | #define IOAT_DCA_COMP_V1 0x1 | ||
119 | |||
120 | #define IOAT_FSB_CAPABILITY_OFFSET 0x04 | ||
121 | #define IOAT_FSB_CAPABILITY_PREFETCH 0x1 | ||
122 | |||
123 | #define IOAT_PCI_CAPABILITY_OFFSET 0x06 | ||
124 | #define IOAT_PCI_CAPABILITY_MEMWR 0x1 | ||
125 | |||
126 | #define IOAT_FSB_CAP_ENABLE_OFFSET 0x08 | ||
127 | #define IOAT_FSB_CAP_ENABLE_PREFETCH 0x1 | ||
128 | |||
129 | #define IOAT_PCI_CAP_ENABLE_OFFSET 0x0A | ||
130 | #define IOAT_PCI_CAP_ENABLE_MEMWR 0x1 | ||
131 | |||
132 | #define IOAT_APICID_TAG_MAP_OFFSET 0x0C | ||
133 | #define IOAT_APICID_TAG_MAP_TAG0 0x0000000F | ||
134 | #define IOAT_APICID_TAG_MAP_TAG0_SHIFT 0 | ||
135 | #define IOAT_APICID_TAG_MAP_TAG1 0x000000F0 | ||
136 | #define IOAT_APICID_TAG_MAP_TAG1_SHIFT 4 | ||
137 | #define IOAT_APICID_TAG_MAP_TAG2 0x00000F00 | ||
138 | #define IOAT_APICID_TAG_MAP_TAG2_SHIFT 8 | ||
139 | #define IOAT_APICID_TAG_MAP_TAG3 0x0000F000 | ||
140 | #define IOAT_APICID_TAG_MAP_TAG3_SHIFT 12 | ||
141 | #define IOAT_APICID_TAG_MAP_TAG4 0x000F0000 | ||
142 | #define IOAT_APICID_TAG_MAP_TAG4_SHIFT 16 | ||
143 | #define IOAT_APICID_TAG_CB2_VALID 0x8080808080 | ||
144 | |||
145 | #define IOAT_DCA_GREQID_OFFSET 0x10 | ||
146 | #define IOAT_DCA_GREQID_SIZE 0x04 | ||
147 | #define IOAT_DCA_GREQID_MASK 0xFFFF | ||
148 | #define IOAT_DCA_GREQID_IGNOREFUN 0x10000000 | ||
149 | #define IOAT_DCA_GREQID_VALID 0x20000000 | ||
150 | #define IOAT_DCA_GREQID_LASTID 0x80000000 | ||
151 | |||
152 | |||
153 | |||
154 | #define IOAT1_CHAINADDR_OFFSET 0x0C /* 64-bit Descriptor Chain Address Register */ | ||
155 | #define IOAT2_CHAINADDR_OFFSET 0x10 /* 64-bit Descriptor Chain Address Register */ | ||
156 | #define IOAT_CHAINADDR_OFFSET(ver) ((ver) < IOAT_VER_2_0 \ | ||
157 | ? IOAT1_CHAINADDR_OFFSET : IOAT2_CHAINADDR_OFFSET) | ||
158 | #define IOAT1_CHAINADDR_OFFSET_LOW 0x0C | ||
159 | #define IOAT2_CHAINADDR_OFFSET_LOW 0x10 | ||
160 | #define IOAT_CHAINADDR_OFFSET_LOW(ver) ((ver) < IOAT_VER_2_0 \ | ||
161 | ? IOAT1_CHAINADDR_OFFSET_LOW : IOAT2_CHAINADDR_OFFSET_LOW) | ||
162 | #define IOAT1_CHAINADDR_OFFSET_HIGH 0x10 | ||
163 | #define IOAT2_CHAINADDR_OFFSET_HIGH 0x14 | ||
164 | #define IOAT_CHAINADDR_OFFSET_HIGH(ver) ((ver) < IOAT_VER_2_0 \ | ||
165 | ? IOAT1_CHAINADDR_OFFSET_HIGH : IOAT2_CHAINADDR_OFFSET_HIGH) | ||
166 | |||
167 | #define IOAT1_CHANCMD_OFFSET 0x14 /* 8-bit DMA Channel Command Register */ | ||
168 | #define IOAT2_CHANCMD_OFFSET 0x04 /* 8-bit DMA Channel Command Register */ | ||
169 | #define IOAT_CHANCMD_OFFSET(ver) ((ver) < IOAT_VER_2_0 \ | ||
170 | ? IOAT1_CHANCMD_OFFSET : IOAT2_CHANCMD_OFFSET) | ||
96 | #define IOAT_CHANCMD_RESET 0x20 | 171 | #define IOAT_CHANCMD_RESET 0x20 |
97 | #define IOAT_CHANCMD_RESUME 0x10 | 172 | #define IOAT_CHANCMD_RESUME 0x10 |
98 | #define IOAT_CHANCMD_ABORT 0x08 | 173 | #define IOAT_CHANCMD_ABORT 0x08 |
@@ -124,6 +199,7 @@ | |||
124 | #define IOAT_CHANERR_COMPLETION_ADDR_ERR 0x1000 | 199 | #define IOAT_CHANERR_COMPLETION_ADDR_ERR 0x1000 |
125 | #define IOAT_CHANERR_INT_CONFIGURATION_ERR 0x2000 | 200 | #define IOAT_CHANERR_INT_CONFIGURATION_ERR 0x2000 |
126 | #define IOAT_CHANERR_SOFT_ERR 0x4000 | 201 | #define IOAT_CHANERR_SOFT_ERR 0x4000 |
202 | #define IOAT_CHANERR_UNAFFILIATED_ERR 0x8000 | ||
127 | 203 | ||
128 | #define IOAT_CHANERR_MASK_OFFSET 0x2C /* 32-bit Channel Error Register */ | 204 | #define IOAT_CHANERR_MASK_OFFSET 0x2C /* 32-bit Channel Error Register */ |
129 | 205 | ||
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c index 96f7e63e3996..a1f24c42d5ff 100644 --- a/drivers/edac/i5000_edac.c +++ b/drivers/edac/i5000_edac.c | |||
@@ -1462,7 +1462,7 @@ MODULE_DEVICE_TABLE(pci, i5000_pci_tbl); | |||
1462 | * | 1462 | * |
1463 | */ | 1463 | */ |
1464 | static struct pci_driver i5000_driver = { | 1464 | static struct pci_driver i5000_driver = { |
1465 | .name = __stringify(KBUILD_BASENAME), | 1465 | .name = KBUILD_BASENAME, |
1466 | .probe = i5000_init_one, | 1466 | .probe = i5000_init_one, |
1467 | .remove = __devexit_p(i5000_remove_one), | 1467 | .remove = __devexit_p(i5000_remove_one), |
1468 | .id_table = i5000_pci_tbl, | 1468 | .id_table = i5000_pci_tbl, |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 700a1657554f..a0445bea9f75 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -216,6 +216,16 @@ config SENSORS_DS1621 | |||
216 | This driver can also be built as a module. If so, the module | 216 | This driver can also be built as a module. If so, the module |
217 | will be called ds1621. | 217 | will be called ds1621. |
218 | 218 | ||
219 | config SENSORS_I5K_AMB | ||
220 | tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets" | ||
221 | depends on PCI && EXPERIMENTAL | ||
222 | help | ||
223 | If you say yes here you get support for FB-DIMM AMB temperature | ||
224 | monitoring chips on systems with the Intel 5000 series chipset. | ||
225 | |||
226 | This driver can also be built as a module. If so, the module | ||
227 | will be called i5k_amb. | ||
228 | |||
219 | config SENSORS_F71805F | 229 | config SENSORS_F71805F |
220 | tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG" | 230 | tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG" |
221 | depends on EXPERIMENTAL | 231 | depends on EXPERIMENTAL |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 6da3eef94306..55595f6e1aa6 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -38,6 +38,7 @@ obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o | |||
38 | obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o | 38 | obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o |
39 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o | 39 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o |
40 | obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o | 40 | obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o |
41 | obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o | ||
41 | obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o | 42 | obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o |
42 | obj-$(CONFIG_SENSORS_IT87) += it87.o | 43 | obj-$(CONFIG_SENSORS_IT87) += it87.o |
43 | obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o | 44 | obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o |
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index cb2331bfd9d5..d9f04ce90327 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
@@ -503,7 +503,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
503 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, | 503 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, |
504 | { NULL, 0, 0, 0, 0, 0 } } | 504 | { NULL, 0, 0, 0, 0, 0 } } |
505 | }, | 505 | }, |
506 | { 0x001A, "unknown", { | 506 | { 0x001A, "Abit IP35 Pro", { |
507 | { "CPU Core", 0, 0, 10, 1, 0 }, | 507 | { "CPU Core", 0, 0, 10, 1, 0 }, |
508 | { "DDR2", 1, 0, 20, 1, 0 }, | 508 | { "DDR2", 1, 0, 20, 1, 0 }, |
509 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 509 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -530,6 +530,60 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
530 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 530 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
531 | { NULL, 0, 0, 0, 0, 0 } } | 531 | { NULL, 0, 0, 0, 0, 0 } } |
532 | }, | 532 | }, |
533 | { 0x001B, "unknown", { | ||
534 | { "CPU Core", 0, 0, 10, 1, 0 }, | ||
535 | { "DDR3", 1, 0, 20, 1, 0 }, | ||
536 | { "DDR3 VTT", 2, 0, 10, 1, 0 }, | ||
537 | { "CPU VTT", 3, 0, 10, 1, 0 }, | ||
538 | { "MCH 1.25V", 4, 0, 10, 1, 0 }, | ||
539 | { "ICHIO 1.5V", 5, 0, 10, 1, 0 }, | ||
540 | { "ICH 1.05V", 6, 0, 10, 1, 0 }, | ||
541 | { "ATX +12V (24-Pin)", 7, 0, 60, 1, 0 }, | ||
542 | { "ATX +12V (8-pin)", 8, 0, 60, 1, 0 }, | ||
543 | { "ATX +5V", 9, 0, 30, 1, 0 }, | ||
544 | { "+3.3V", 10, 0, 20, 1, 0 }, | ||
545 | { "5VSB", 11, 0, 30, 1, 0 }, | ||
546 | { "CPU", 24, 1, 1, 1, 0 }, | ||
547 | { "System", 25, 1, 1, 1, 0 }, | ||
548 | { "PWM Phase1", 26, 1, 1, 1, 0 }, | ||
549 | { "PWM Phase2", 27, 1, 1, 1, 0 }, | ||
550 | { "PWM Phase3", 28, 1, 1, 1, 0 }, | ||
551 | { "PWM Phase4", 29, 1, 1, 1, 0 }, | ||
552 | { "PWM Phase5", 30, 1, 1, 1, 0 }, | ||
553 | { "CPU Fan", 32, 2, 60, 1, 0 }, | ||
554 | { "SYS Fan", 34, 2, 60, 1, 0 }, | ||
555 | { "AUX1 Fan", 33, 2, 60, 1, 0 }, | ||
556 | { "AUX2 Fan", 35, 2, 60, 1, 0 }, | ||
557 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | ||
558 | { NULL, 0, 0, 0, 0, 0 } } | ||
559 | }, | ||
560 | { 0x001C, "unknown", { | ||
561 | { "CPU Core", 0, 0, 10, 1, 0 }, | ||
562 | { "DDR2", 1, 0, 20, 1, 0 }, | ||
563 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | ||
564 | { "CPU VTT", 3, 0, 10, 1, 0 }, | ||
565 | { "MCH 1.25V", 4, 0, 10, 1, 0 }, | ||
566 | { "ICHIO 1.5V", 5, 0, 10, 1, 0 }, | ||
567 | { "ICH 1.05V", 6, 0, 10, 1, 0 }, | ||
568 | { "ATX +12V (24-Pin)", 7, 0, 60, 1, 0 }, | ||
569 | { "ATX +12V (8-pin)", 8, 0, 60, 1, 0 }, | ||
570 | { "ATX +5V", 9, 0, 30, 1, 0 }, | ||
571 | { "+3.3V", 10, 0, 20, 1, 0 }, | ||
572 | { "5VSB", 11, 0, 30, 1, 0 }, | ||
573 | { "CPU", 24, 1, 1, 1, 0 }, | ||
574 | { "System", 25, 1, 1, 1, 0 }, | ||
575 | { "PWM Phase1", 26, 1, 1, 1, 0 }, | ||
576 | { "PWM Phase2", 27, 1, 1, 1, 0 }, | ||
577 | { "PWM Phase3", 28, 1, 1, 1, 0 }, | ||
578 | { "PWM Phase4", 29, 1, 1, 1, 0 }, | ||
579 | { "PWM Phase5", 30, 1, 1, 1, 0 }, | ||
580 | { "CPU Fan", 32, 2, 60, 1, 0 }, | ||
581 | { "SYS Fan", 34, 2, 60, 1, 0 }, | ||
582 | { "AUX1 Fan", 33, 2, 60, 1, 0 }, | ||
583 | { "AUX2 Fan", 35, 2, 60, 1, 0 }, | ||
584 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | ||
585 | { NULL, 0, 0, 0, 0, 0 } } | ||
586 | }, | ||
533 | { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } | 587 | { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } |
534 | }; | 588 | }; |
535 | 589 | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 1001d2e122a2..86c66c345f8b 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -80,7 +80,7 @@ | |||
80 | /* | 80 | /* |
81 | * Temperature sensors keys (sp78 - 2 bytes). | 81 | * Temperature sensors keys (sp78 - 2 bytes). |
82 | */ | 82 | */ |
83 | static const char* temperature_sensors_sets[][13] = { | 83 | static const char* temperature_sensors_sets[][36] = { |
84 | /* Set 0: Macbook Pro */ | 84 | /* Set 0: Macbook Pro */ |
85 | { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", | 85 | { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", |
86 | "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, | 86 | "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, |
@@ -88,7 +88,13 @@ static const char* temperature_sensors_sets[][13] = { | |||
88 | { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", | 88 | { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", |
89 | "Th1H", "Ts0P", NULL }, | 89 | "Th1H", "Ts0P", NULL }, |
90 | /* Set 2: Macmini set */ | 90 | /* Set 2: Macmini set */ |
91 | { "TC0D", "TC0P", NULL } | 91 | { "TC0D", "TC0P", NULL }, |
92 | /* Set 3: Mac Pro (2 x Quad-Core) */ | ||
93 | { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P", | ||
94 | "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P", | ||
95 | "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", | ||
96 | "TM1P", "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", | ||
97 | "TM9S", "TN0H", "TS0C", NULL }, | ||
92 | }; | 98 | }; |
93 | 99 | ||
94 | /* List of keys used to read/write fan speeds */ | 100 | /* List of keys used to read/write fan speeds */ |
@@ -990,14 +996,18 @@ static struct attribute *fan##offset##_attributes[] = { \ | |||
990 | 996 | ||
991 | /* | 997 | /* |
992 | * Create the needed functions for each fan using the macro defined above | 998 | * Create the needed functions for each fan using the macro defined above |
993 | * (2 fans are supported) | 999 | * (4 fans are supported) |
994 | */ | 1000 | */ |
995 | sysfs_fan_speeds_offset(1); | 1001 | sysfs_fan_speeds_offset(1); |
996 | sysfs_fan_speeds_offset(2); | 1002 | sysfs_fan_speeds_offset(2); |
1003 | sysfs_fan_speeds_offset(3); | ||
1004 | sysfs_fan_speeds_offset(4); | ||
997 | 1005 | ||
998 | static const struct attribute_group fan_attribute_groups[] = { | 1006 | static const struct attribute_group fan_attribute_groups[] = { |
999 | { .attrs = fan1_attributes }, | 1007 | { .attrs = fan1_attributes }, |
1000 | { .attrs = fan2_attributes } | 1008 | { .attrs = fan2_attributes }, |
1009 | { .attrs = fan3_attributes }, | ||
1010 | { .attrs = fan4_attributes }, | ||
1001 | }; | 1011 | }; |
1002 | 1012 | ||
1003 | /* | 1013 | /* |
@@ -1027,6 +1037,52 @@ static SENSOR_DEVICE_ATTR(temp11_input, S_IRUGO, | |||
1027 | applesmc_show_temperature, NULL, 10); | 1037 | applesmc_show_temperature, NULL, 10); |
1028 | static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO, | 1038 | static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO, |
1029 | applesmc_show_temperature, NULL, 11); | 1039 | applesmc_show_temperature, NULL, 11); |
1040 | static SENSOR_DEVICE_ATTR(temp13_input, S_IRUGO, | ||
1041 | applesmc_show_temperature, NULL, 12); | ||
1042 | static SENSOR_DEVICE_ATTR(temp14_input, S_IRUGO, | ||
1043 | applesmc_show_temperature, NULL, 13); | ||
1044 | static SENSOR_DEVICE_ATTR(temp15_input, S_IRUGO, | ||
1045 | applesmc_show_temperature, NULL, 14); | ||
1046 | static SENSOR_DEVICE_ATTR(temp16_input, S_IRUGO, | ||
1047 | applesmc_show_temperature, NULL, 15); | ||
1048 | static SENSOR_DEVICE_ATTR(temp17_input, S_IRUGO, | ||
1049 | applesmc_show_temperature, NULL, 16); | ||
1050 | static SENSOR_DEVICE_ATTR(temp18_input, S_IRUGO, | ||
1051 | applesmc_show_temperature, NULL, 17); | ||
1052 | static SENSOR_DEVICE_ATTR(temp19_input, S_IRUGO, | ||
1053 | applesmc_show_temperature, NULL, 18); | ||
1054 | static SENSOR_DEVICE_ATTR(temp20_input, S_IRUGO, | ||
1055 | applesmc_show_temperature, NULL, 19); | ||
1056 | static SENSOR_DEVICE_ATTR(temp21_input, S_IRUGO, | ||
1057 | applesmc_show_temperature, NULL, 20); | ||
1058 | static SENSOR_DEVICE_ATTR(temp22_input, S_IRUGO, | ||
1059 | applesmc_show_temperature, NULL, 21); | ||
1060 | static SENSOR_DEVICE_ATTR(temp23_input, S_IRUGO, | ||
1061 | applesmc_show_temperature, NULL, 22); | ||
1062 | static SENSOR_DEVICE_ATTR(temp24_input, S_IRUGO, | ||
1063 | applesmc_show_temperature, NULL, 23); | ||
1064 | static SENSOR_DEVICE_ATTR(temp25_input, S_IRUGO, | ||
1065 | applesmc_show_temperature, NULL, 24); | ||
1066 | static SENSOR_DEVICE_ATTR(temp26_input, S_IRUGO, | ||
1067 | applesmc_show_temperature, NULL, 25); | ||
1068 | static SENSOR_DEVICE_ATTR(temp27_input, S_IRUGO, | ||
1069 | applesmc_show_temperature, NULL, 26); | ||
1070 | static SENSOR_DEVICE_ATTR(temp28_input, S_IRUGO, | ||
1071 | applesmc_show_temperature, NULL, 27); | ||
1072 | static SENSOR_DEVICE_ATTR(temp29_input, S_IRUGO, | ||
1073 | applesmc_show_temperature, NULL, 28); | ||
1074 | static SENSOR_DEVICE_ATTR(temp30_input, S_IRUGO, | ||
1075 | applesmc_show_temperature, NULL, 29); | ||
1076 | static SENSOR_DEVICE_ATTR(temp31_input, S_IRUGO, | ||
1077 | applesmc_show_temperature, NULL, 30); | ||
1078 | static SENSOR_DEVICE_ATTR(temp32_input, S_IRUGO, | ||
1079 | applesmc_show_temperature, NULL, 31); | ||
1080 | static SENSOR_DEVICE_ATTR(temp33_input, S_IRUGO, | ||
1081 | applesmc_show_temperature, NULL, 32); | ||
1082 | static SENSOR_DEVICE_ATTR(temp34_input, S_IRUGO, | ||
1083 | applesmc_show_temperature, NULL, 33); | ||
1084 | static SENSOR_DEVICE_ATTR(temp35_input, S_IRUGO, | ||
1085 | applesmc_show_temperature, NULL, 34); | ||
1030 | 1086 | ||
1031 | static struct attribute *temperature_attributes[] = { | 1087 | static struct attribute *temperature_attributes[] = { |
1032 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 1088 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
@@ -1041,6 +1097,29 @@ static struct attribute *temperature_attributes[] = { | |||
1041 | &sensor_dev_attr_temp10_input.dev_attr.attr, | 1097 | &sensor_dev_attr_temp10_input.dev_attr.attr, |
1042 | &sensor_dev_attr_temp11_input.dev_attr.attr, | 1098 | &sensor_dev_attr_temp11_input.dev_attr.attr, |
1043 | &sensor_dev_attr_temp12_input.dev_attr.attr, | 1099 | &sensor_dev_attr_temp12_input.dev_attr.attr, |
1100 | &sensor_dev_attr_temp13_input.dev_attr.attr, | ||
1101 | &sensor_dev_attr_temp14_input.dev_attr.attr, | ||
1102 | &sensor_dev_attr_temp15_input.dev_attr.attr, | ||
1103 | &sensor_dev_attr_temp16_input.dev_attr.attr, | ||
1104 | &sensor_dev_attr_temp17_input.dev_attr.attr, | ||
1105 | &sensor_dev_attr_temp18_input.dev_attr.attr, | ||
1106 | &sensor_dev_attr_temp19_input.dev_attr.attr, | ||
1107 | &sensor_dev_attr_temp20_input.dev_attr.attr, | ||
1108 | &sensor_dev_attr_temp21_input.dev_attr.attr, | ||
1109 | &sensor_dev_attr_temp22_input.dev_attr.attr, | ||
1110 | &sensor_dev_attr_temp23_input.dev_attr.attr, | ||
1111 | &sensor_dev_attr_temp24_input.dev_attr.attr, | ||
1112 | &sensor_dev_attr_temp25_input.dev_attr.attr, | ||
1113 | &sensor_dev_attr_temp26_input.dev_attr.attr, | ||
1114 | &sensor_dev_attr_temp27_input.dev_attr.attr, | ||
1115 | &sensor_dev_attr_temp28_input.dev_attr.attr, | ||
1116 | &sensor_dev_attr_temp29_input.dev_attr.attr, | ||
1117 | &sensor_dev_attr_temp30_input.dev_attr.attr, | ||
1118 | &sensor_dev_attr_temp31_input.dev_attr.attr, | ||
1119 | &sensor_dev_attr_temp32_input.dev_attr.attr, | ||
1120 | &sensor_dev_attr_temp33_input.dev_attr.attr, | ||
1121 | &sensor_dev_attr_temp34_input.dev_attr.attr, | ||
1122 | &sensor_dev_attr_temp35_input.dev_attr.attr, | ||
1044 | NULL | 1123 | NULL |
1045 | }; | 1124 | }; |
1046 | 1125 | ||
@@ -1137,6 +1216,8 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = { | |||
1137 | { .accelerometer = 1, .light = 0, .temperature_set = 1 }, | 1216 | { .accelerometer = 1, .light = 0, .temperature_set = 1 }, |
1138 | /* MacMini: temperature set 2 */ | 1217 | /* MacMini: temperature set 2 */ |
1139 | { .accelerometer = 0, .light = 0, .temperature_set = 2 }, | 1218 | { .accelerometer = 0, .light = 0, .temperature_set = 2 }, |
1219 | /* MacPro: temperature set 3 */ | ||
1220 | { .accelerometer = 0, .light = 0, .temperature_set = 3 }, | ||
1140 | }; | 1221 | }; |
1141 | 1222 | ||
1142 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". | 1223 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". |
@@ -1154,6 +1235,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { | |||
1154 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1235 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
1155 | DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, | 1236 | DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, |
1156 | (void*)&applesmc_dmi_data[2]}, | 1237 | (void*)&applesmc_dmi_data[2]}, |
1238 | { applesmc_dmi_match, "Apple MacPro2", { | ||
1239 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | ||
1240 | DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, | ||
1241 | (void*)&applesmc_dmi_data[3]}, | ||
1157 | { .ident = NULL } | 1242 | { .ident = NULL } |
1158 | }; | 1243 | }; |
1159 | 1244 | ||
@@ -1204,9 +1289,19 @@ static int __init applesmc_init(void) | |||
1204 | 1289 | ||
1205 | switch (count) { | 1290 | switch (count) { |
1206 | default: | 1291 | default: |
1207 | printk(KERN_WARNING "applesmc: More than 2 fans found," | 1292 | printk(KERN_WARNING "applesmc: More than 4 fans found," |
1208 | " but at most 2 fans are supported" | 1293 | " but at most 4 fans are supported" |
1209 | " by the driver.\n"); | 1294 | " by the driver.\n"); |
1295 | case 4: | ||
1296 | ret = sysfs_create_group(&pdev->dev.kobj, | ||
1297 | &fan_attribute_groups[3]); | ||
1298 | if (ret) | ||
1299 | goto out_key_enumeration; | ||
1300 | case 3: | ||
1301 | ret = sysfs_create_group(&pdev->dev.kobj, | ||
1302 | &fan_attribute_groups[2]); | ||
1303 | if (ret) | ||
1304 | goto out_key_enumeration; | ||
1210 | case 2: | 1305 | case 2: |
1211 | ret = sysfs_create_group(&pdev->dev.kobj, | 1306 | ret = sysfs_create_group(&pdev->dev.kobj, |
1212 | &fan_attribute_groups[1]); | 1307 | &fan_attribute_groups[1]); |
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 13a041326a04..6892f76fc18a 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/i2c.h> | 34 | #include <linux/i2c.h> |
35 | #include <linux/err.h> | 35 | #include <linux/err.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/f75375s.h> | ||
37 | 38 | ||
38 | /* Addresses to scan */ | 39 | /* Addresses to scan */ |
39 | static unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; | 40 | static unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; |
@@ -86,7 +87,7 @@ I2C_CLIENT_INSMOD_2(f75373, f75375); | |||
86 | 87 | ||
87 | struct f75375_data { | 88 | struct f75375_data { |
88 | unsigned short addr; | 89 | unsigned short addr; |
89 | struct i2c_client client; | 90 | struct i2c_client *client; |
90 | struct device *hwmon_dev; | 91 | struct device *hwmon_dev; |
91 | 92 | ||
92 | const char *name; | 93 | const char *name; |
@@ -116,15 +117,25 @@ struct f75375_data { | |||
116 | static int f75375_attach_adapter(struct i2c_adapter *adapter); | 117 | static int f75375_attach_adapter(struct i2c_adapter *adapter); |
117 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); | 118 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); |
118 | static int f75375_detach_client(struct i2c_client *client); | 119 | static int f75375_detach_client(struct i2c_client *client); |
120 | static int f75375_probe(struct i2c_client *client); | ||
121 | static int f75375_remove(struct i2c_client *client); | ||
119 | 122 | ||
120 | static struct i2c_driver f75375_driver = { | 123 | static struct i2c_driver f75375_legacy_driver = { |
121 | .driver = { | 124 | .driver = { |
122 | .name = "f75375", | 125 | .name = "f75375_legacy", |
123 | }, | 126 | }, |
124 | .attach_adapter = f75375_attach_adapter, | 127 | .attach_adapter = f75375_attach_adapter, |
125 | .detach_client = f75375_detach_client, | 128 | .detach_client = f75375_detach_client, |
126 | }; | 129 | }; |
127 | 130 | ||
131 | static struct i2c_driver f75375_driver = { | ||
132 | .driver = { | ||
133 | .name = "f75375", | ||
134 | }, | ||
135 | .probe = f75375_probe, | ||
136 | .remove = f75375_remove, | ||
137 | }; | ||
138 | |||
128 | static inline int f75375_read8(struct i2c_client *client, u8 reg) | 139 | static inline int f75375_read8(struct i2c_client *client, u8 reg) |
129 | { | 140 | { |
130 | return i2c_smbus_read_byte_data(client, reg); | 141 | return i2c_smbus_read_byte_data(client, reg); |
@@ -276,19 +287,14 @@ static ssize_t show_pwm_enable(struct device *dev, struct device_attribute | |||
276 | return sprintf(buf, "%d\n", data->pwm_enable[nr]); | 287 | return sprintf(buf, "%d\n", data->pwm_enable[nr]); |
277 | } | 288 | } |
278 | 289 | ||
279 | static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, | 290 | static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) |
280 | const char *buf, size_t count) | ||
281 | { | 291 | { |
282 | int nr = to_sensor_dev_attr(attr)->index; | ||
283 | struct i2c_client *client = to_i2c_client(dev); | ||
284 | struct f75375_data *data = i2c_get_clientdata(client); | 292 | struct f75375_data *data = i2c_get_clientdata(client); |
285 | int val = simple_strtoul(buf, NULL, 10); | ||
286 | u8 fanmode; | 293 | u8 fanmode; |
287 | 294 | ||
288 | if (val < 0 || val > 4) | 295 | if (val < 0 || val > 4) |
289 | return -EINVAL; | 296 | return -EINVAL; |
290 | 297 | ||
291 | mutex_lock(&data->update_lock); | ||
292 | fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); | 298 | fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); |
293 | fanmode = ~(3 << FAN_CTRL_MODE(nr)); | 299 | fanmode = ~(3 << FAN_CTRL_MODE(nr)); |
294 | 300 | ||
@@ -310,8 +316,22 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, | |||
310 | } | 316 | } |
311 | f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); | 317 | f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); |
312 | data->pwm_enable[nr] = val; | 318 | data->pwm_enable[nr] = val; |
319 | return 0; | ||
320 | } | ||
321 | |||
322 | static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, | ||
323 | const char *buf, size_t count) | ||
324 | { | ||
325 | int nr = to_sensor_dev_attr(attr)->index; | ||
326 | struct i2c_client *client = to_i2c_client(dev); | ||
327 | struct f75375_data *data = i2c_get_clientdata(client); | ||
328 | int val = simple_strtoul(buf, NULL, 10); | ||
329 | int err = 0; | ||
330 | |||
331 | mutex_lock(&data->update_lock); | ||
332 | err = set_pwm_enable_direct(client, nr, val); | ||
313 | mutex_unlock(&data->update_lock); | 333 | mutex_unlock(&data->update_lock); |
314 | return count; | 334 | return err ? err : count; |
315 | } | 335 | } |
316 | 336 | ||
317 | static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr, | 337 | static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr, |
@@ -323,7 +343,7 @@ static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr, | |||
323 | int val = simple_strtoul(buf, NULL, 10); | 343 | int val = simple_strtoul(buf, NULL, 10); |
324 | u8 conf = 0; | 344 | u8 conf = 0; |
325 | 345 | ||
326 | if (val != 0 || val != 1 || data->kind == f75373) | 346 | if (!(val == 0 || val == 1)) |
327 | return -EINVAL; | 347 | return -EINVAL; |
328 | 348 | ||
329 | mutex_lock(&data->update_lock); | 349 | mutex_lock(&data->update_lock); |
@@ -529,13 +549,13 @@ static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO|S_IWUSR, | |||
529 | show_pwm, set_pwm, 0); | 549 | show_pwm, set_pwm, 0); |
530 | static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR, | 550 | static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR, |
531 | show_pwm_enable, set_pwm_enable, 0); | 551 | show_pwm_enable, set_pwm_enable, 0); |
532 | static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO|S_IWUSR, | 552 | static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO, |
533 | show_pwm_mode, set_pwm_mode, 0); | 553 | show_pwm_mode, set_pwm_mode, 0); |
534 | static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, | 554 | static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, |
535 | show_pwm, set_pwm, 1); | 555 | show_pwm, set_pwm, 1); |
536 | static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR, | 556 | static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR, |
537 | show_pwm_enable, set_pwm_enable, 1); | 557 | show_pwm_enable, set_pwm_enable, 1); |
538 | static SENSOR_DEVICE_ATTR(pwm2_mode, S_IRUGO|S_IWUSR, | 558 | static SENSOR_DEVICE_ATTR(pwm2_mode, S_IRUGO, |
539 | show_pwm_mode, set_pwm_mode, 1); | 559 | show_pwm_mode, set_pwm_mode, 1); |
540 | 560 | ||
541 | static struct attribute *f75375_attributes[] = { | 561 | static struct attribute *f75375_attributes[] = { |
@@ -580,12 +600,9 @@ static const struct attribute_group f75375_group = { | |||
580 | 600 | ||
581 | static int f75375_detach_client(struct i2c_client *client) | 601 | static int f75375_detach_client(struct i2c_client *client) |
582 | { | 602 | { |
583 | struct f75375_data *data = i2c_get_clientdata(client); | ||
584 | int err; | 603 | int err; |
585 | 604 | ||
586 | hwmon_device_unregister(data->hwmon_dev); | 605 | f75375_remove(client); |
587 | sysfs_remove_group(&client->dev.kobj, &f75375_group); | ||
588 | |||
589 | err = i2c_detach_client(client); | 606 | err = i2c_detach_client(client); |
590 | if (err) { | 607 | if (err) { |
591 | dev_err(&client->dev, | 608 | dev_err(&client->dev, |
@@ -593,7 +610,91 @@ static int f75375_detach_client(struct i2c_client *client) | |||
593 | "client not detached.\n"); | 610 | "client not detached.\n"); |
594 | return err; | 611 | return err; |
595 | } | 612 | } |
613 | kfree(client); | ||
614 | return 0; | ||
615 | } | ||
616 | |||
617 | static void f75375_init(struct i2c_client *client, struct f75375_data *data, | ||
618 | struct f75375s_platform_data *f75375s_pdata) | ||
619 | { | ||
620 | int nr; | ||
621 | set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]); | ||
622 | set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]); | ||
623 | for (nr = 0; nr < 2; nr++) { | ||
624 | data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255); | ||
625 | f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), | ||
626 | data->pwm[nr]); | ||
627 | } | ||
628 | |||
629 | } | ||
630 | |||
631 | static int f75375_probe(struct i2c_client *client) | ||
632 | { | ||
633 | struct f75375_data *data = i2c_get_clientdata(client); | ||
634 | struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data; | ||
635 | int err; | ||
636 | |||
637 | if (!i2c_check_functionality(client->adapter, | ||
638 | I2C_FUNC_SMBUS_BYTE_DATA)) | ||
639 | return -EIO; | ||
640 | if (!(data = kzalloc(sizeof(struct f75375_data), GFP_KERNEL))) | ||
641 | return -ENOMEM; | ||
642 | |||
643 | i2c_set_clientdata(client, data); | ||
644 | data->client = client; | ||
645 | mutex_init(&data->update_lock); | ||
646 | |||
647 | if (strcmp(client->name, "f75375") == 0) | ||
648 | data->kind = f75375; | ||
649 | else if (strcmp(client->name, "f75373") == 0) | ||
650 | data->kind = f75373; | ||
651 | else { | ||
652 | dev_err(&client->dev, "Unsupported device: %s\n", client->name); | ||
653 | return -ENODEV; | ||
654 | } | ||
655 | |||
656 | if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) | ||
657 | goto exit_free; | ||
658 | |||
659 | if (data->kind == f75375) { | ||
660 | err = sysfs_chmod_file(&client->dev.kobj, | ||
661 | &sensor_dev_attr_pwm1_mode.dev_attr.attr, | ||
662 | S_IRUGO | S_IWUSR); | ||
663 | if (err) | ||
664 | goto exit_remove; | ||
665 | err = sysfs_chmod_file(&client->dev.kobj, | ||
666 | &sensor_dev_attr_pwm2_mode.dev_attr.attr, | ||
667 | S_IRUGO | S_IWUSR); | ||
668 | if (err) | ||
669 | goto exit_remove; | ||
670 | } | ||
671 | |||
672 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
673 | if (IS_ERR(data->hwmon_dev)) { | ||
674 | err = PTR_ERR(data->hwmon_dev); | ||
675 | goto exit_remove; | ||
676 | } | ||
677 | |||
678 | if (f75375s_pdata != NULL) | ||
679 | f75375_init(client, data, f75375s_pdata); | ||
680 | |||
681 | return 0; | ||
682 | |||
683 | exit_remove: | ||
684 | sysfs_remove_group(&client->dev.kobj, &f75375_group); | ||
685 | exit_free: | ||
596 | kfree(data); | 686 | kfree(data); |
687 | i2c_set_clientdata(client, NULL); | ||
688 | return err; | ||
689 | } | ||
690 | |||
691 | static int f75375_remove(struct i2c_client *client) | ||
692 | { | ||
693 | struct f75375_data *data = i2c_get_clientdata(client); | ||
694 | hwmon_device_unregister(data->hwmon_dev); | ||
695 | sysfs_remove_group(&client->dev.kobj, &f75375_group); | ||
696 | kfree(data); | ||
697 | i2c_set_clientdata(client, NULL); | ||
597 | return 0; | 698 | return 0; |
598 | } | 699 | } |
599 | 700 | ||
@@ -608,20 +709,17 @@ static int f75375_attach_adapter(struct i2c_adapter *adapter) | |||
608 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind) | 709 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind) |
609 | { | 710 | { |
610 | struct i2c_client *client; | 711 | struct i2c_client *client; |
611 | struct f75375_data *data; | ||
612 | u8 version = 0; | 712 | u8 version = 0; |
613 | int err = 0; | 713 | int err = 0; |
614 | const char *name = ""; | 714 | const char *name = ""; |
615 | 715 | ||
616 | if (!(data = kzalloc(sizeof(struct f75375_data), GFP_KERNEL))) { | 716 | if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) { |
617 | err = -ENOMEM; | 717 | err = -ENOMEM; |
618 | goto exit; | 718 | goto exit; |
619 | } | 719 | } |
620 | client = &data->client; | ||
621 | i2c_set_clientdata(client, data); | ||
622 | client->addr = address; | 720 | client->addr = address; |
623 | client->adapter = adapter; | 721 | client->adapter = adapter; |
624 | client->driver = &f75375_driver; | 722 | client->driver = &f75375_legacy_driver; |
625 | 723 | ||
626 | if (kind < 0) { | 724 | if (kind < 0) { |
627 | u16 vendid = f75375_read16(client, F75375_REG_VENDOR); | 725 | u16 vendid = f75375_read16(client, F75375_REG_VENDOR); |
@@ -644,42 +742,42 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind) | |||
644 | } else if (kind == f75373) { | 742 | } else if (kind == f75373) { |
645 | name = "f75373"; | 743 | name = "f75373"; |
646 | } | 744 | } |
647 | |||
648 | dev_info(&adapter->dev, "found %s version: %02X\n", name, version); | 745 | dev_info(&adapter->dev, "found %s version: %02X\n", name, version); |
649 | strlcpy(client->name, name, I2C_NAME_SIZE); | 746 | strlcpy(client->name, name, I2C_NAME_SIZE); |
650 | data->kind = kind; | 747 | |
651 | mutex_init(&data->update_lock); | ||
652 | if ((err = i2c_attach_client(client))) | 748 | if ((err = i2c_attach_client(client))) |
653 | goto exit_free; | 749 | goto exit_free; |
654 | 750 | ||
655 | if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) | 751 | if ((err = f75375_probe(client)) < 0) |
656 | goto exit_detach; | 752 | goto exit_detach; |
657 | 753 | ||
658 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
659 | if (IS_ERR(data->hwmon_dev)) { | ||
660 | err = PTR_ERR(data->hwmon_dev); | ||
661 | goto exit_remove; | ||
662 | } | ||
663 | |||
664 | return 0; | 754 | return 0; |
665 | 755 | ||
666 | exit_remove: | ||
667 | sysfs_remove_group(&client->dev.kobj, &f75375_group); | ||
668 | exit_detach: | 756 | exit_detach: |
669 | i2c_detach_client(client); | 757 | i2c_detach_client(client); |
670 | exit_free: | 758 | exit_free: |
671 | kfree(data); | 759 | kfree(client); |
672 | exit: | 760 | exit: |
673 | return err; | 761 | return err; |
674 | } | 762 | } |
675 | 763 | ||
676 | static int __init sensors_f75375_init(void) | 764 | static int __init sensors_f75375_init(void) |
677 | { | 765 | { |
678 | return i2c_add_driver(&f75375_driver); | 766 | int status; |
767 | status = i2c_add_driver(&f75375_driver); | ||
768 | if (status) | ||
769 | return status; | ||
770 | |||
771 | status = i2c_add_driver(&f75375_legacy_driver); | ||
772 | if (status) | ||
773 | i2c_del_driver(&f75375_driver); | ||
774 | |||
775 | return status; | ||
679 | } | 776 | } |
680 | 777 | ||
681 | static void __exit sensors_f75375_exit(void) | 778 | static void __exit sensors_f75375_exit(void) |
682 | { | 779 | { |
780 | i2c_del_driver(&f75375_legacy_driver); | ||
683 | i2c_del_driver(&f75375_driver); | 781 | i2c_del_driver(&f75375_driver); |
684 | } | 782 | } |
685 | 783 | ||
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c new file mode 100644 index 000000000000..6ac5c6f53585 --- /dev/null +++ b/drivers/hwmon/i5k_amb.c | |||
@@ -0,0 +1,552 @@ | |||
1 | /* | ||
2 | * A hwmon driver for the Intel 5000 series chipset FB-DIMM AMB | ||
3 | * temperature sensors | ||
4 | * Copyright (C) 2007 IBM | ||
5 | * | ||
6 | * Author: Darrick J. Wong <djwong@us.ibm.com> | ||
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 as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/jiffies.h> | ||
25 | #include <linux/hwmon.h> | ||
26 | #include <linux/hwmon-sysfs.h> | ||
27 | #include <linux/err.h> | ||
28 | #include <linux/mutex.h> | ||
29 | #include <linux/delay.h> | ||
30 | #include <linux/log2.h> | ||
31 | #include <linux/pci.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | |||
34 | #define DRVNAME "i5k_amb" | ||
35 | |||
36 | #define I5K_REG_AMB_BASE_ADDR 0x48 | ||
37 | #define I5K_REG_AMB_LEN_ADDR 0x50 | ||
38 | #define I5K_REG_CHAN0_PRESENCE_ADDR 0x64 | ||
39 | #define I5K_REG_CHAN1_PRESENCE_ADDR 0x66 | ||
40 | |||
41 | #define AMB_REG_TEMP_MIN_ADDR 0x80 | ||
42 | #define AMB_REG_TEMP_MID_ADDR 0x81 | ||
43 | #define AMB_REG_TEMP_MAX_ADDR 0x82 | ||
44 | #define AMB_REG_TEMP_STATUS_ADDR 0x84 | ||
45 | #define AMB_REG_TEMP_ADDR 0x85 | ||
46 | |||
47 | #define AMB_CONFIG_SIZE 2048 | ||
48 | #define AMB_FUNC_3_OFFSET 768 | ||
49 | |||
50 | static unsigned long amb_reg_temp_status(unsigned int amb) | ||
51 | { | ||
52 | return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_STATUS_ADDR + | ||
53 | AMB_CONFIG_SIZE * amb; | ||
54 | } | ||
55 | |||
56 | static unsigned long amb_reg_temp_min(unsigned int amb) | ||
57 | { | ||
58 | return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MIN_ADDR + | ||
59 | AMB_CONFIG_SIZE * amb; | ||
60 | } | ||
61 | |||
62 | static unsigned long amb_reg_temp_mid(unsigned int amb) | ||
63 | { | ||
64 | return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MID_ADDR + | ||
65 | AMB_CONFIG_SIZE * amb; | ||
66 | } | ||
67 | |||
68 | static unsigned long amb_reg_temp_max(unsigned int amb) | ||
69 | { | ||
70 | return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MAX_ADDR + | ||
71 | AMB_CONFIG_SIZE * amb; | ||
72 | } | ||
73 | |||
74 | static unsigned long amb_reg_temp(unsigned int amb) | ||
75 | { | ||
76 | return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_ADDR + | ||
77 | AMB_CONFIG_SIZE * amb; | ||
78 | } | ||
79 | |||
80 | #define MAX_MEM_CHANNELS 4 | ||
81 | #define MAX_AMBS_PER_CHANNEL 16 | ||
82 | #define MAX_AMBS (MAX_MEM_CHANNELS * \ | ||
83 | MAX_AMBS_PER_CHANNEL) | ||
84 | /* | ||
85 | * Ugly hack: For some reason the highest bit is set if there | ||
86 | * are _any_ DIMMs in the channel. Attempting to read from | ||
87 | * this "high-order" AMB results in a memory bus error, so | ||
88 | * for now we'll just ignore that top bit, even though that | ||
89 | * might prevent us from seeing the 16th DIMM in the channel. | ||
90 | */ | ||
91 | #define REAL_MAX_AMBS_PER_CHANNEL 15 | ||
92 | #define KNOBS_PER_AMB 5 | ||
93 | |||
94 | static unsigned long amb_num_from_reg(unsigned int byte_num, unsigned int bit) | ||
95 | { | ||
96 | return byte_num * MAX_AMBS_PER_CHANNEL + bit; | ||
97 | } | ||
98 | |||
99 | #define AMB_SYSFS_NAME_LEN 16 | ||
100 | struct i5k_device_attribute { | ||
101 | struct sensor_device_attribute s_attr; | ||
102 | char name[AMB_SYSFS_NAME_LEN]; | ||
103 | }; | ||
104 | |||
105 | struct i5k_amb_data { | ||
106 | struct device *hwmon_dev; | ||
107 | |||
108 | unsigned long amb_base; | ||
109 | unsigned long amb_len; | ||
110 | u16 amb_present[MAX_MEM_CHANNELS]; | ||
111 | void __iomem *amb_mmio; | ||
112 | struct i5k_device_attribute *attrs; | ||
113 | unsigned int num_attrs; | ||
114 | }; | ||
115 | |||
116 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, | ||
117 | char *buf) | ||
118 | { | ||
119 | return sprintf(buf, "%s\n", DRVNAME); | ||
120 | } | ||
121 | |||
122 | |||
123 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | ||
124 | |||
125 | static struct platform_device *amb_pdev; | ||
126 | |||
127 | static u8 amb_read_byte(struct i5k_amb_data *data, unsigned long offset) | ||
128 | { | ||
129 | return ioread8(data->amb_mmio + offset); | ||
130 | } | ||
131 | |||
132 | static void amb_write_byte(struct i5k_amb_data *data, unsigned long offset, | ||
133 | u8 val) | ||
134 | { | ||
135 | iowrite8(val, data->amb_mmio + offset); | ||
136 | } | ||
137 | |||
138 | static ssize_t show_amb_alarm(struct device *dev, | ||
139 | struct device_attribute *devattr, | ||
140 | char *buf) | ||
141 | { | ||
142 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
143 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
144 | |||
145 | if (!(amb_read_byte(data, amb_reg_temp_status(attr->index)) & 0x20) && | ||
146 | (amb_read_byte(data, amb_reg_temp_status(attr->index)) & 0x8)) | ||
147 | return sprintf(buf, "1\n"); | ||
148 | else | ||
149 | return sprintf(buf, "0\n"); | ||
150 | } | ||
151 | |||
152 | static ssize_t store_amb_min(struct device *dev, | ||
153 | struct device_attribute *devattr, | ||
154 | const char *buf, | ||
155 | size_t count) | ||
156 | { | ||
157 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
158 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
159 | unsigned long temp = simple_strtoul(buf, NULL, 10) / 500; | ||
160 | |||
161 | if (temp > 255) | ||
162 | temp = 255; | ||
163 | |||
164 | amb_write_byte(data, amb_reg_temp_min(attr->index), temp); | ||
165 | return count; | ||
166 | } | ||
167 | |||
168 | static ssize_t store_amb_mid(struct device *dev, | ||
169 | struct device_attribute *devattr, | ||
170 | const char *buf, | ||
171 | size_t count) | ||
172 | { | ||
173 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
174 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
175 | unsigned long temp = simple_strtoul(buf, NULL, 10) / 500; | ||
176 | |||
177 | if (temp > 255) | ||
178 | temp = 255; | ||
179 | |||
180 | amb_write_byte(data, amb_reg_temp_mid(attr->index), temp); | ||
181 | return count; | ||
182 | } | ||
183 | |||
184 | static ssize_t store_amb_max(struct device *dev, | ||
185 | struct device_attribute *devattr, | ||
186 | const char *buf, | ||
187 | size_t count) | ||
188 | { | ||
189 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
190 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
191 | unsigned long temp = simple_strtoul(buf, NULL, 10) / 500; | ||
192 | |||
193 | if (temp > 255) | ||
194 | temp = 255; | ||
195 | |||
196 | amb_write_byte(data, amb_reg_temp_max(attr->index), temp); | ||
197 | return count; | ||
198 | } | ||
199 | |||
200 | static ssize_t show_amb_min(struct device *dev, | ||
201 | struct device_attribute *devattr, | ||
202 | char *buf) | ||
203 | { | ||
204 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
205 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
206 | return sprintf(buf, "%d\n", | ||
207 | 500 * amb_read_byte(data, amb_reg_temp_min(attr->index))); | ||
208 | } | ||
209 | |||
210 | static ssize_t show_amb_mid(struct device *dev, | ||
211 | struct device_attribute *devattr, | ||
212 | char *buf) | ||
213 | { | ||
214 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
215 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
216 | return sprintf(buf, "%d\n", | ||
217 | 500 * amb_read_byte(data, amb_reg_temp_mid(attr->index))); | ||
218 | } | ||
219 | |||
220 | static ssize_t show_amb_max(struct device *dev, | ||
221 | struct device_attribute *devattr, | ||
222 | char *buf) | ||
223 | { | ||
224 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
225 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
226 | return sprintf(buf, "%d\n", | ||
227 | 500 * amb_read_byte(data, amb_reg_temp_max(attr->index))); | ||
228 | } | ||
229 | |||
230 | static ssize_t show_amb_temp(struct device *dev, | ||
231 | struct device_attribute *devattr, | ||
232 | char *buf) | ||
233 | { | ||
234 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
235 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
236 | return sprintf(buf, "%d\n", | ||
237 | 500 * amb_read_byte(data, amb_reg_temp(attr->index))); | ||
238 | } | ||
239 | |||
240 | static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | ||
241 | { | ||
242 | int i, j, k, d = 0; | ||
243 | u16 c; | ||
244 | int res = 0; | ||
245 | int num_ambs = 0; | ||
246 | struct i5k_amb_data *data = platform_get_drvdata(pdev); | ||
247 | |||
248 | /* Count the number of AMBs found */ | ||
249 | /* ignore the high-order bit, see "Ugly hack" comment above */ | ||
250 | for (i = 0; i < MAX_MEM_CHANNELS; i++) | ||
251 | num_ambs += hweight16(data->amb_present[i] & 0x7fff); | ||
252 | |||
253 | /* Set up sysfs stuff */ | ||
254 | data->attrs = kzalloc(sizeof(*data->attrs) * num_ambs * KNOBS_PER_AMB, | ||
255 | GFP_KERNEL); | ||
256 | if (!data->attrs) | ||
257 | return -ENOMEM; | ||
258 | data->num_attrs = 0; | ||
259 | |||
260 | for (i = 0; i < MAX_MEM_CHANNELS; i++) { | ||
261 | c = data->amb_present[i]; | ||
262 | for (j = 0; j < REAL_MAX_AMBS_PER_CHANNEL; j++, c >>= 1) { | ||
263 | struct i5k_device_attribute *iattr; | ||
264 | |||
265 | k = amb_num_from_reg(i, j); | ||
266 | if (!(c & 0x1)) | ||
267 | continue; | ||
268 | d++; | ||
269 | |||
270 | /* Temperature sysfs knob */ | ||
271 | iattr = data->attrs + data->num_attrs; | ||
272 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | ||
273 | "temp%d_input", d); | ||
274 | iattr->s_attr.dev_attr.attr.name = iattr->name; | ||
275 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; | ||
276 | iattr->s_attr.dev_attr.show = show_amb_temp; | ||
277 | iattr->s_attr.index = k; | ||
278 | res = device_create_file(&pdev->dev, | ||
279 | &iattr->s_attr.dev_attr); | ||
280 | if (res) | ||
281 | goto exit_remove; | ||
282 | data->num_attrs++; | ||
283 | |||
284 | /* Temperature min sysfs knob */ | ||
285 | iattr = data->attrs + data->num_attrs; | ||
286 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | ||
287 | "temp%d_min", d); | ||
288 | iattr->s_attr.dev_attr.attr.name = iattr->name; | ||
289 | iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO; | ||
290 | iattr->s_attr.dev_attr.show = show_amb_min; | ||
291 | iattr->s_attr.dev_attr.store = store_amb_min; | ||
292 | iattr->s_attr.index = k; | ||
293 | res = device_create_file(&pdev->dev, | ||
294 | &iattr->s_attr.dev_attr); | ||
295 | if (res) | ||
296 | goto exit_remove; | ||
297 | data->num_attrs++; | ||
298 | |||
299 | /* Temperature mid sysfs knob */ | ||
300 | iattr = data->attrs + data->num_attrs; | ||
301 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | ||
302 | "temp%d_mid", d); | ||
303 | iattr->s_attr.dev_attr.attr.name = iattr->name; | ||
304 | iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO; | ||
305 | iattr->s_attr.dev_attr.show = show_amb_mid; | ||
306 | iattr->s_attr.dev_attr.store = store_amb_mid; | ||
307 | iattr->s_attr.index = k; | ||
308 | res = device_create_file(&pdev->dev, | ||
309 | &iattr->s_attr.dev_attr); | ||
310 | if (res) | ||
311 | goto exit_remove; | ||
312 | data->num_attrs++; | ||
313 | |||
314 | /* Temperature max sysfs knob */ | ||
315 | iattr = data->attrs + data->num_attrs; | ||
316 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | ||
317 | "temp%d_max", d); | ||
318 | iattr->s_attr.dev_attr.attr.name = iattr->name; | ||
319 | iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO; | ||
320 | iattr->s_attr.dev_attr.show = show_amb_max; | ||
321 | iattr->s_attr.dev_attr.store = store_amb_max; | ||
322 | iattr->s_attr.index = k; | ||
323 | res = device_create_file(&pdev->dev, | ||
324 | &iattr->s_attr.dev_attr); | ||
325 | if (res) | ||
326 | goto exit_remove; | ||
327 | data->num_attrs++; | ||
328 | |||
329 | /* Temperature alarm sysfs knob */ | ||
330 | iattr = data->attrs + data->num_attrs; | ||
331 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | ||
332 | "temp%d_alarm", d); | ||
333 | iattr->s_attr.dev_attr.attr.name = iattr->name; | ||
334 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; | ||
335 | iattr->s_attr.dev_attr.show = show_amb_alarm; | ||
336 | iattr->s_attr.index = k; | ||
337 | res = device_create_file(&pdev->dev, | ||
338 | &iattr->s_attr.dev_attr); | ||
339 | if (res) | ||
340 | goto exit_remove; | ||
341 | data->num_attrs++; | ||
342 | } | ||
343 | } | ||
344 | |||
345 | res = device_create_file(&pdev->dev, &dev_attr_name); | ||
346 | if (res) | ||
347 | goto exit_remove; | ||
348 | |||
349 | data->hwmon_dev = hwmon_device_register(&pdev->dev); | ||
350 | if (IS_ERR(data->hwmon_dev)) { | ||
351 | res = PTR_ERR(data->hwmon_dev); | ||
352 | goto exit_remove; | ||
353 | } | ||
354 | |||
355 | return res; | ||
356 | |||
357 | exit_remove: | ||
358 | device_remove_file(&pdev->dev, &dev_attr_name); | ||
359 | for (i = 0; i < data->num_attrs; i++) | ||
360 | device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr); | ||
361 | kfree(data->attrs); | ||
362 | |||
363 | return res; | ||
364 | } | ||
365 | |||
366 | static int __devinit i5k_amb_add(void) | ||
367 | { | ||
368 | int res = -ENODEV; | ||
369 | |||
370 | /* only ever going to be one of these */ | ||
371 | amb_pdev = platform_device_alloc(DRVNAME, 0); | ||
372 | if (!amb_pdev) | ||
373 | return -ENOMEM; | ||
374 | |||
375 | res = platform_device_add(amb_pdev); | ||
376 | if (res) | ||
377 | goto err; | ||
378 | return 0; | ||
379 | |||
380 | err: | ||
381 | platform_device_put(amb_pdev); | ||
382 | return res; | ||
383 | } | ||
384 | |||
385 | static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data) | ||
386 | { | ||
387 | struct pci_dev *pcidev; | ||
388 | u32 val32; | ||
389 | int res = -ENODEV; | ||
390 | |||
391 | /* Find AMB register memory space */ | ||
392 | pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, | ||
393 | PCI_DEVICE_ID_INTEL_5000_ERR, | ||
394 | NULL); | ||
395 | if (!pcidev) | ||
396 | return -ENODEV; | ||
397 | |||
398 | if (pci_read_config_dword(pcidev, I5K_REG_AMB_BASE_ADDR, &val32)) | ||
399 | goto out; | ||
400 | data->amb_base = val32; | ||
401 | |||
402 | if (pci_read_config_dword(pcidev, I5K_REG_AMB_LEN_ADDR, &val32)) | ||
403 | goto out; | ||
404 | data->amb_len = val32; | ||
405 | |||
406 | /* Is it big enough? */ | ||
407 | if (data->amb_len < AMB_CONFIG_SIZE * MAX_AMBS) { | ||
408 | dev_err(&pcidev->dev, "AMB region too small!\n"); | ||
409 | goto out; | ||
410 | } | ||
411 | |||
412 | res = 0; | ||
413 | out: | ||
414 | pci_dev_put(pcidev); | ||
415 | return res; | ||
416 | } | ||
417 | |||
418 | static int __devinit i5k_channel_probe(u16 *amb_present, unsigned long dev_id) | ||
419 | { | ||
420 | struct pci_dev *pcidev; | ||
421 | u16 val16; | ||
422 | int res = -ENODEV; | ||
423 | |||
424 | /* Copy the DIMM presence map for these two channels */ | ||
425 | pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, dev_id, NULL); | ||
426 | if (!pcidev) | ||
427 | return -ENODEV; | ||
428 | |||
429 | if (pci_read_config_word(pcidev, I5K_REG_CHAN0_PRESENCE_ADDR, &val16)) | ||
430 | goto out; | ||
431 | amb_present[0] = val16; | ||
432 | |||
433 | if (pci_read_config_word(pcidev, I5K_REG_CHAN1_PRESENCE_ADDR, &val16)) | ||
434 | goto out; | ||
435 | amb_present[1] = val16; | ||
436 | |||
437 | res = 0; | ||
438 | |||
439 | out: | ||
440 | pci_dev_put(pcidev); | ||
441 | return res; | ||
442 | } | ||
443 | |||
444 | static int __devinit i5k_amb_probe(struct platform_device *pdev) | ||
445 | { | ||
446 | struct i5k_amb_data *data; | ||
447 | struct resource *reso; | ||
448 | int res = -ENODEV; | ||
449 | |||
450 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
451 | if (!data) | ||
452 | return -ENOMEM; | ||
453 | |||
454 | /* Figure out where the AMB registers live */ | ||
455 | res = i5k_find_amb_registers(data); | ||
456 | if (res) | ||
457 | goto err; | ||
458 | |||
459 | /* Copy the DIMM presence map for the first two channels */ | ||
460 | res = i5k_channel_probe(&data->amb_present[0], | ||
461 | PCI_DEVICE_ID_INTEL_5000_FBD0); | ||
462 | if (res) | ||
463 | goto err; | ||
464 | |||
465 | /* Copy the DIMM presence map for the optional second two channels */ | ||
466 | i5k_channel_probe(&data->amb_present[2], | ||
467 | PCI_DEVICE_ID_INTEL_5000_FBD1); | ||
468 | |||
469 | /* Set up resource regions */ | ||
470 | reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME); | ||
471 | if (!reso) { | ||
472 | res = -EBUSY; | ||
473 | goto err; | ||
474 | } | ||
475 | |||
476 | data->amb_mmio = ioremap_nocache(data->amb_base, data->amb_len); | ||
477 | if (!data->amb_mmio) { | ||
478 | res = -EBUSY; | ||
479 | goto err_map_failed; | ||
480 | } | ||
481 | |||
482 | platform_set_drvdata(pdev, data); | ||
483 | |||
484 | res = i5k_amb_hwmon_init(pdev); | ||
485 | if (res) | ||
486 | goto err_init_failed; | ||
487 | |||
488 | return res; | ||
489 | |||
490 | err_init_failed: | ||
491 | iounmap(data->amb_mmio); | ||
492 | platform_set_drvdata(pdev, NULL); | ||
493 | err_map_failed: | ||
494 | release_mem_region(data->amb_base, data->amb_len); | ||
495 | err: | ||
496 | kfree(data); | ||
497 | return res; | ||
498 | } | ||
499 | |||
500 | static int __devexit i5k_amb_remove(struct platform_device *pdev) | ||
501 | { | ||
502 | int i; | ||
503 | struct i5k_amb_data *data = platform_get_drvdata(pdev); | ||
504 | |||
505 | hwmon_device_unregister(data->hwmon_dev); | ||
506 | device_remove_file(&pdev->dev, &dev_attr_name); | ||
507 | for (i = 0; i < data->num_attrs; i++) | ||
508 | device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr); | ||
509 | kfree(data->attrs); | ||
510 | iounmap(data->amb_mmio); | ||
511 | release_mem_region(data->amb_base, data->amb_len); | ||
512 | platform_set_drvdata(pdev, NULL); | ||
513 | kfree(data); | ||
514 | return 0; | ||
515 | } | ||
516 | |||
517 | static struct platform_driver i5k_amb_driver = { | ||
518 | .driver = { | ||
519 | .owner = THIS_MODULE, | ||
520 | .name = DRVNAME, | ||
521 | }, | ||
522 | .probe = i5k_amb_probe, | ||
523 | .remove = __devexit_p(i5k_amb_remove), | ||
524 | }; | ||
525 | |||
526 | static int __init i5k_amb_init(void) | ||
527 | { | ||
528 | int res; | ||
529 | |||
530 | res = platform_driver_register(&i5k_amb_driver); | ||
531 | if (res) | ||
532 | return res; | ||
533 | |||
534 | res = i5k_amb_add(); | ||
535 | if (res) | ||
536 | platform_driver_unregister(&i5k_amb_driver); | ||
537 | |||
538 | return res; | ||
539 | } | ||
540 | |||
541 | static void __exit i5k_amb_exit(void) | ||
542 | { | ||
543 | platform_device_unregister(amb_pdev); | ||
544 | platform_driver_unregister(&i5k_amb_driver); | ||
545 | } | ||
546 | |||
547 | MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>"); | ||
548 | MODULE_DESCRIPTION("Intel 5000 chipset FB-DIMM AMB temperature sensor"); | ||
549 | MODULE_LICENSE("GPL"); | ||
550 | |||
551 | module_init(i5k_amb_init); | ||
552 | module_exit(i5k_amb_exit); | ||
diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c index c462824ffccf..9c9cdb0685e4 100644 --- a/drivers/hwmon/ibmpex.c +++ b/drivers/hwmon/ibmpex.c | |||
@@ -140,10 +140,10 @@ static int ibmpex_send_message(struct ibmpex_bmc_data *data) | |||
140 | 140 | ||
141 | return 0; | 141 | return 0; |
142 | out1: | 142 | out1: |
143 | printk(KERN_ERR "%s: request_settime=%x\n", __FUNCTION__, err); | 143 | dev_err(data->bmc_device, "request_settime=%x\n", err); |
144 | return err; | 144 | return err; |
145 | out: | 145 | out: |
146 | printk(KERN_ERR "%s: validate_addr=%x\n", __FUNCTION__, err); | 146 | dev_err(data->bmc_device, "validate_addr=%x\n", err); |
147 | return err; | 147 | return err; |
148 | } | 148 | } |
149 | 149 | ||
@@ -161,14 +161,14 @@ static int ibmpex_ver_check(struct ibmpex_bmc_data *data) | |||
161 | data->sensor_major = data->rx_msg_data[0]; | 161 | data->sensor_major = data->rx_msg_data[0]; |
162 | data->sensor_minor = data->rx_msg_data[1]; | 162 | data->sensor_minor = data->rx_msg_data[1]; |
163 | 163 | ||
164 | printk(KERN_INFO DRVNAME ": Found BMC with sensor interface " | 164 | dev_info(data->bmc_device, "Found BMC with sensor interface " |
165 | "v%d.%d %d-%02d-%02d on interface %d\n", | 165 | "v%d.%d %d-%02d-%02d on interface %d\n", |
166 | data->sensor_major, | 166 | data->sensor_major, |
167 | data->sensor_minor, | 167 | data->sensor_minor, |
168 | extract_value(data->rx_msg_data, 2), | 168 | extract_value(data->rx_msg_data, 2), |
169 | data->rx_msg_data[4], | 169 | data->rx_msg_data[4], |
170 | data->rx_msg_data[5], | 170 | data->rx_msg_data[5], |
171 | data->interface); | 171 | data->interface); |
172 | 172 | ||
173 | return 0; | 173 | return 0; |
174 | } | 174 | } |
@@ -212,8 +212,8 @@ static int ibmpex_query_sensor_data(struct ibmpex_bmc_data *data, int sensor) | |||
212 | wait_for_completion(&data->read_complete); | 212 | wait_for_completion(&data->read_complete); |
213 | 213 | ||
214 | if (data->rx_result || data->rx_msg_len < 26) { | 214 | if (data->rx_result || data->rx_msg_len < 26) { |
215 | printk(KERN_ERR "Error reading sensor %d, please check.\n", | 215 | dev_err(data->bmc_device, "Error reading sensor %d.\n", |
216 | sensor); | 216 | sensor); |
217 | return -ENOENT; | 217 | return -ENOENT; |
218 | } | 218 | } |
219 | 219 | ||
@@ -456,8 +456,7 @@ static void ibmpex_register_bmc(int iface, struct device *dev) | |||
456 | 456 | ||
457 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 457 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
458 | if (!data) { | 458 | if (!data) { |
459 | printk(KERN_ERR DRVNAME ": Insufficient memory for BMC " | 459 | dev_err(dev, "Insufficient memory for BMC interface.\n"); |
460 | "interface %d.\n", data->interface); | ||
461 | return; | 460 | return; |
462 | } | 461 | } |
463 | 462 | ||
@@ -471,9 +470,8 @@ static void ibmpex_register_bmc(int iface, struct device *dev) | |||
471 | err = ipmi_create_user(data->interface, &driver_data.ipmi_hndlrs, | 470 | err = ipmi_create_user(data->interface, &driver_data.ipmi_hndlrs, |
472 | data, &data->user); | 471 | data, &data->user); |
473 | if (err < 0) { | 472 | if (err < 0) { |
474 | printk(KERN_ERR DRVNAME ": Error, unable to register user with " | 473 | dev_err(dev, "Unable to register user with IPMI " |
475 | "ipmi interface %d\n", | 474 | "interface %d\n", data->interface); |
476 | data->interface); | ||
477 | goto out; | 475 | goto out; |
478 | } | 476 | } |
479 | 477 | ||
@@ -495,9 +493,9 @@ static void ibmpex_register_bmc(int iface, struct device *dev) | |||
495 | data->hwmon_dev = hwmon_device_register(data->bmc_device); | 493 | data->hwmon_dev = hwmon_device_register(data->bmc_device); |
496 | 494 | ||
497 | if (IS_ERR(data->hwmon_dev)) { | 495 | if (IS_ERR(data->hwmon_dev)) { |
498 | printk(KERN_ERR DRVNAME ": Error, unable to register hwmon " | 496 | dev_err(data->bmc_device, "Unable to register hwmon " |
499 | "class device for interface %d\n", | 497 | "device for IPMI interface %d\n", |
500 | data->interface); | 498 | data->interface); |
501 | goto out_user; | 499 | goto out_user; |
502 | } | 500 | } |
503 | 501 | ||
@@ -508,7 +506,7 @@ static void ibmpex_register_bmc(int iface, struct device *dev) | |||
508 | /* Now go find all the sensors */ | 506 | /* Now go find all the sensors */ |
509 | err = ibmpex_find_sensors(data); | 507 | err = ibmpex_find_sensors(data); |
510 | if (err) { | 508 | if (err) { |
511 | printk(KERN_ERR "Error %d allocating memory\n", err); | 509 | dev_err(data->bmc_device, "Error %d finding sensors\n", err); |
512 | goto out_register; | 510 | goto out_register; |
513 | } | 511 | } |
514 | 512 | ||
@@ -561,10 +559,10 @@ static void ibmpex_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) | |||
561 | struct ibmpex_bmc_data *data = (struct ibmpex_bmc_data *)user_msg_data; | 559 | struct ibmpex_bmc_data *data = (struct ibmpex_bmc_data *)user_msg_data; |
562 | 560 | ||
563 | if (msg->msgid != data->tx_msgid) { | 561 | if (msg->msgid != data->tx_msgid) { |
564 | printk(KERN_ERR "Received msgid (%02x) and transmitted " | 562 | dev_err(data->bmc_device, "Mismatch between received msgid " |
565 | "msgid (%02x) mismatch!\n", | 563 | "(%02x) and transmitted msgid (%02x)!\n", |
566 | (int)msg->msgid, | 564 | (int)msg->msgid, |
567 | (int)data->tx_msgid); | 565 | (int)data->tx_msgid); |
568 | ipmi_free_recv_msg(msg); | 566 | ipmi_free_recv_msg(msg); |
569 | return; | 567 | return; |
570 | } | 568 | } |
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index dd366889ce9b..d435f003292d 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c | |||
@@ -31,14 +31,15 @@ | |||
31 | #include <linux/err.h> | 31 | #include <linux/err.h> |
32 | #include <linux/sysfs.h> | 32 | #include <linux/sysfs.h> |
33 | #include <linux/hwmon.h> | 33 | #include <linux/hwmon.h> |
34 | #include <linux/mutex.h> | ||
34 | #include <linux/spi/spi.h> | 35 | #include <linux/spi/spi.h> |
35 | #include <asm/semaphore.h> | 36 | |
36 | 37 | ||
37 | #define DRVNAME "lm70" | 38 | #define DRVNAME "lm70" |
38 | 39 | ||
39 | struct lm70 { | 40 | struct lm70 { |
40 | struct device *hwmon_dev; | 41 | struct device *hwmon_dev; |
41 | struct semaphore sem; | 42 | struct mutex lock; |
42 | }; | 43 | }; |
43 | 44 | ||
44 | /* sysfs hook function */ | 45 | /* sysfs hook function */ |
@@ -51,7 +52,7 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
51 | s16 raw=0; | 52 | s16 raw=0; |
52 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); | 53 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); |
53 | 54 | ||
54 | if (down_interruptible(&p_lm70->sem)) | 55 | if (mutex_lock_interruptible(&p_lm70->lock)) |
55 | return -ERESTARTSYS; | 56 | return -ERESTARTSYS; |
56 | 57 | ||
57 | /* | 58 | /* |
@@ -83,7 +84,7 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
83 | val = ((int)raw/32) * 250; | 84 | val = ((int)raw/32) * 250; |
84 | status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ | 85 | status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ |
85 | out: | 86 | out: |
86 | up(&p_lm70->sem); | 87 | mutex_unlock(&p_lm70->lock); |
87 | return status; | 88 | return status; |
88 | } | 89 | } |
89 | 90 | ||
@@ -112,7 +113,7 @@ static int __devinit lm70_probe(struct spi_device *spi) | |||
112 | if (!p_lm70) | 113 | if (!p_lm70) |
113 | return -ENOMEM; | 114 | return -ENOMEM; |
114 | 115 | ||
115 | init_MUTEX(&p_lm70->sem); | 116 | mutex_init(&p_lm70->lock); |
116 | 117 | ||
117 | /* sysfs hook */ | 118 | /* sysfs hook */ |
118 | p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); | 119 | p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 7e2d9787babc..a276806f3d53 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -435,6 +435,22 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
435 | } | 435 | } |
436 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 436 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
437 | 437 | ||
438 | static ssize_t show_alarm(struct device *dev, struct device_attribute *da, | ||
439 | char *buf) | ||
440 | { | ||
441 | struct sis5595_data *data = sis5595_update_device(dev); | ||
442 | int nr = to_sensor_dev_attr(da)->index; | ||
443 | return sprintf(buf, "%u\n", (data->alarms >> nr) & 1); | ||
444 | } | ||
445 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
446 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
447 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2); | ||
448 | static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
449 | static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 15); | ||
450 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6); | ||
451 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7); | ||
452 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 15); | ||
453 | |||
438 | static ssize_t show_name(struct device *dev, struct device_attribute *attr, | 454 | static ssize_t show_name(struct device *dev, struct device_attribute *attr, |
439 | char *buf) | 455 | char *buf) |
440 | { | 456 | { |
@@ -447,22 +463,28 @@ static struct attribute *sis5595_attributes[] = { | |||
447 | &sensor_dev_attr_in0_input.dev_attr.attr, | 463 | &sensor_dev_attr_in0_input.dev_attr.attr, |
448 | &sensor_dev_attr_in0_min.dev_attr.attr, | 464 | &sensor_dev_attr_in0_min.dev_attr.attr, |
449 | &sensor_dev_attr_in0_max.dev_attr.attr, | 465 | &sensor_dev_attr_in0_max.dev_attr.attr, |
466 | &sensor_dev_attr_in0_alarm.dev_attr.attr, | ||
450 | &sensor_dev_attr_in1_input.dev_attr.attr, | 467 | &sensor_dev_attr_in1_input.dev_attr.attr, |
451 | &sensor_dev_attr_in1_min.dev_attr.attr, | 468 | &sensor_dev_attr_in1_min.dev_attr.attr, |
452 | &sensor_dev_attr_in1_max.dev_attr.attr, | 469 | &sensor_dev_attr_in1_max.dev_attr.attr, |
470 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
453 | &sensor_dev_attr_in2_input.dev_attr.attr, | 471 | &sensor_dev_attr_in2_input.dev_attr.attr, |
454 | &sensor_dev_attr_in2_min.dev_attr.attr, | 472 | &sensor_dev_attr_in2_min.dev_attr.attr, |
455 | &sensor_dev_attr_in2_max.dev_attr.attr, | 473 | &sensor_dev_attr_in2_max.dev_attr.attr, |
474 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
456 | &sensor_dev_attr_in3_input.dev_attr.attr, | 475 | &sensor_dev_attr_in3_input.dev_attr.attr, |
457 | &sensor_dev_attr_in3_min.dev_attr.attr, | 476 | &sensor_dev_attr_in3_min.dev_attr.attr, |
458 | &sensor_dev_attr_in3_max.dev_attr.attr, | 477 | &sensor_dev_attr_in3_max.dev_attr.attr, |
478 | &sensor_dev_attr_in3_alarm.dev_attr.attr, | ||
459 | 479 | ||
460 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 480 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
461 | &sensor_dev_attr_fan1_min.dev_attr.attr, | 481 | &sensor_dev_attr_fan1_min.dev_attr.attr, |
462 | &sensor_dev_attr_fan1_div.dev_attr.attr, | 482 | &sensor_dev_attr_fan1_div.dev_attr.attr, |
483 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
463 | &sensor_dev_attr_fan2_input.dev_attr.attr, | 484 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
464 | &sensor_dev_attr_fan2_min.dev_attr.attr, | 485 | &sensor_dev_attr_fan2_min.dev_attr.attr, |
465 | &sensor_dev_attr_fan2_div.dev_attr.attr, | 486 | &sensor_dev_attr_fan2_div.dev_attr.attr, |
487 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
466 | 488 | ||
467 | &dev_attr_alarms.attr, | 489 | &dev_attr_alarms.attr, |
468 | &dev_attr_name.attr, | 490 | &dev_attr_name.attr, |
@@ -473,19 +495,28 @@ static const struct attribute_group sis5595_group = { | |||
473 | .attrs = sis5595_attributes, | 495 | .attrs = sis5595_attributes, |
474 | }; | 496 | }; |
475 | 497 | ||
476 | static struct attribute *sis5595_attributes_opt[] = { | 498 | static struct attribute *sis5595_attributes_in4[] = { |
477 | &sensor_dev_attr_in4_input.dev_attr.attr, | 499 | &sensor_dev_attr_in4_input.dev_attr.attr, |
478 | &sensor_dev_attr_in4_min.dev_attr.attr, | 500 | &sensor_dev_attr_in4_min.dev_attr.attr, |
479 | &sensor_dev_attr_in4_max.dev_attr.attr, | 501 | &sensor_dev_attr_in4_max.dev_attr.attr, |
502 | &sensor_dev_attr_in4_alarm.dev_attr.attr, | ||
503 | NULL | ||
504 | }; | ||
505 | |||
506 | static const struct attribute_group sis5595_group_in4 = { | ||
507 | .attrs = sis5595_attributes_in4, | ||
508 | }; | ||
480 | 509 | ||
510 | static struct attribute *sis5595_attributes_temp1[] = { | ||
481 | &dev_attr_temp1_input.attr, | 511 | &dev_attr_temp1_input.attr, |
482 | &dev_attr_temp1_max.attr, | 512 | &dev_attr_temp1_max.attr, |
483 | &dev_attr_temp1_max_hyst.attr, | 513 | &dev_attr_temp1_max_hyst.attr, |
514 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
484 | NULL | 515 | NULL |
485 | }; | 516 | }; |
486 | 517 | ||
487 | static const struct attribute_group sis5595_group_opt = { | 518 | static const struct attribute_group sis5595_group_temp1 = { |
488 | .attrs = sis5595_attributes_opt, | 519 | .attrs = sis5595_attributes_temp1, |
489 | }; | 520 | }; |
490 | 521 | ||
491 | /* This is called when the module is loaded */ | 522 | /* This is called when the module is loaded */ |
@@ -540,20 +571,12 @@ static int __devinit sis5595_probe(struct platform_device *pdev) | |||
540 | if ((err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group))) | 571 | if ((err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group))) |
541 | goto exit_free; | 572 | goto exit_free; |
542 | if (data->maxins == 4) { | 573 | if (data->maxins == 4) { |
543 | if ((err = device_create_file(&pdev->dev, | 574 | if ((err = sysfs_create_group(&pdev->dev.kobj, |
544 | &sensor_dev_attr_in4_input.dev_attr)) | 575 | &sis5595_group_in4))) |
545 | || (err = device_create_file(&pdev->dev, | ||
546 | &sensor_dev_attr_in4_min.dev_attr)) | ||
547 | || (err = device_create_file(&pdev->dev, | ||
548 | &sensor_dev_attr_in4_max.dev_attr))) | ||
549 | goto exit_remove_files; | 576 | goto exit_remove_files; |
550 | } else { | 577 | } else { |
551 | if ((err = device_create_file(&pdev->dev, | 578 | if ((err = sysfs_create_group(&pdev->dev.kobj, |
552 | &dev_attr_temp1_input)) | 579 | &sis5595_group_temp1))) |
553 | || (err = device_create_file(&pdev->dev, | ||
554 | &dev_attr_temp1_max)) | ||
555 | || (err = device_create_file(&pdev->dev, | ||
556 | &dev_attr_temp1_max_hyst))) | ||
557 | goto exit_remove_files; | 580 | goto exit_remove_files; |
558 | } | 581 | } |
559 | 582 | ||
@@ -567,7 +590,8 @@ static int __devinit sis5595_probe(struct platform_device *pdev) | |||
567 | 590 | ||
568 | exit_remove_files: | 591 | exit_remove_files: |
569 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); | 592 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); |
570 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_opt); | 593 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4); |
594 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1); | ||
571 | exit_free: | 595 | exit_free: |
572 | kfree(data); | 596 | kfree(data); |
573 | exit_release: | 597 | exit_release: |
@@ -582,7 +606,8 @@ static int __devexit sis5595_remove(struct platform_device *pdev) | |||
582 | 606 | ||
583 | hwmon_device_unregister(data->hwmon_dev); | 607 | hwmon_device_unregister(data->hwmon_dev); |
584 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); | 608 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); |
585 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_opt); | 609 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4); |
610 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1); | ||
586 | 611 | ||
587 | release_region(data->addr, SIS5595_EXTENT); | 612 | release_region(data->addr, SIS5595_EXTENT); |
588 | platform_set_drvdata(pdev, NULL); | 613 | platform_set_drvdata(pdev, NULL); |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 20ae425a1980..879d0a6544cc 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -170,20 +170,16 @@ superio_exit(void) | |||
170 | #define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \ | 170 | #define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \ |
171 | (0x550 + (nr) - 7)) | 171 | (0x550 + (nr) - 7)) |
172 | 172 | ||
173 | #define W83781D_REG_FAN_MIN(nr) (0x3a + (nr)) | 173 | /* nr:0-2 for fans:1-3 */ |
174 | #define W83781D_REG_FAN(nr) (0x27 + (nr)) | 174 | #define W83627HF_REG_FAN_MIN(nr) (0x3b + (nr)) |
175 | 175 | #define W83627HF_REG_FAN(nr) (0x28 + (nr)) | |
176 | #define W83781D_REG_TEMP2_CONFIG 0x152 | 176 | |
177 | #define W83781D_REG_TEMP3_CONFIG 0x252 | 177 | #define W83627HF_REG_TEMP2_CONFIG 0x152 |
178 | #define W83781D_REG_TEMP(nr) ((nr == 3) ? (0x0250) : \ | 178 | #define W83627HF_REG_TEMP3_CONFIG 0x252 |
179 | ((nr == 2) ? (0x0150) : \ | 179 | /* these are zero-based, unlike config constants above */ |
180 | (0x27))) | 180 | static const u16 w83627hf_reg_temp[] = { 0x27, 0x150, 0x250 }; |
181 | #define W83781D_REG_TEMP_HYST(nr) ((nr == 3) ? (0x253) : \ | 181 | static const u16 w83627hf_reg_temp_hyst[] = { 0x3A, 0x153, 0x253 }; |
182 | ((nr == 2) ? (0x153) : \ | 182 | static const u16 w83627hf_reg_temp_over[] = { 0x39, 0x155, 0x255 }; |
183 | (0x3A))) | ||
184 | #define W83781D_REG_TEMP_OVER(nr) ((nr == 3) ? (0x255) : \ | ||
185 | ((nr == 2) ? (0x155) : \ | ||
186 | (0x39))) | ||
187 | 183 | ||
188 | #define W83781D_REG_BANK 0x4E | 184 | #define W83781D_REG_BANK 0x4E |
189 | 185 | ||
@@ -360,12 +356,9 @@ struct w83627hf_data { | |||
360 | u8 in_min[9]; /* Register value */ | 356 | u8 in_min[9]; /* Register value */ |
361 | u8 fan[3]; /* Register value */ | 357 | u8 fan[3]; /* Register value */ |
362 | u8 fan_min[3]; /* Register value */ | 358 | u8 fan_min[3]; /* Register value */ |
363 | u8 temp; | 359 | u16 temp[3]; /* Register value */ |
364 | u8 temp_max; /* Register value */ | 360 | u16 temp_max[3]; /* Register value */ |
365 | u8 temp_max_hyst; /* Register value */ | 361 | u16 temp_max_hyst[3]; /* Register value */ |
366 | u16 temp_add[2]; /* Register value */ | ||
367 | u16 temp_max_add[2]; /* Register value */ | ||
368 | u16 temp_max_hyst_add[2]; /* Register value */ | ||
369 | u8 fan_div[3]; /* Register encoding, shifted right */ | 362 | u8 fan_div[3]; /* Register encoding, shifted right */ |
370 | u8 vid; /* Register encoding, combined */ | 363 | u8 vid; /* Register encoding, combined */ |
371 | u32 alarms; /* Register encoding, combined */ | 364 | u32 alarms; /* Register encoding, combined */ |
@@ -590,7 +583,7 @@ store_fan_min(struct device *dev, struct device_attribute *devattr, | |||
590 | 583 | ||
591 | mutex_lock(&data->update_lock); | 584 | mutex_lock(&data->update_lock); |
592 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); | 585 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); |
593 | w83627hf_write_value(data, W83781D_REG_FAN_MIN(nr+1), | 586 | w83627hf_write_value(data, W83627HF_REG_FAN_MIN(nr), |
594 | data->fan_min[nr]); | 587 | data->fan_min[nr]); |
595 | 588 | ||
596 | mutex_unlock(&data->update_lock); | 589 | mutex_unlock(&data->update_lock); |
@@ -611,12 +604,10 @@ show_temp(struct device *dev, struct device_attribute *devattr, char *buf) | |||
611 | { | 604 | { |
612 | int nr = to_sensor_dev_attr(devattr)->index; | 605 | int nr = to_sensor_dev_attr(devattr)->index; |
613 | struct w83627hf_data *data = w83627hf_update_device(dev); | 606 | struct w83627hf_data *data = w83627hf_update_device(dev); |
614 | if (nr >= 2) { /* TEMP2 and TEMP3 */ | 607 | |
615 | return sprintf(buf, "%ld\n", | 608 | u16 tmp = data->temp[nr]; |
616 | (long)LM75_TEMP_FROM_REG(data->temp_add[nr-2])); | 609 | return sprintf(buf, "%ld\n", (nr) ? (long) LM75_TEMP_FROM_REG(tmp) |
617 | } else { /* TEMP1 */ | 610 | : (long) TEMP_FROM_REG(tmp)); |
618 | return sprintf(buf, "%ld\n", (long)TEMP_FROM_REG(data->temp)); | ||
619 | } | ||
620 | } | 611 | } |
621 | 612 | ||
622 | static ssize_t | 613 | static ssize_t |
@@ -625,13 +616,10 @@ show_temp_max(struct device *dev, struct device_attribute *devattr, | |||
625 | { | 616 | { |
626 | int nr = to_sensor_dev_attr(devattr)->index; | 617 | int nr = to_sensor_dev_attr(devattr)->index; |
627 | struct w83627hf_data *data = w83627hf_update_device(dev); | 618 | struct w83627hf_data *data = w83627hf_update_device(dev); |
628 | if (nr >= 2) { /* TEMP2 and TEMP3 */ | 619 | |
629 | return sprintf(buf, "%ld\n", | 620 | u16 tmp = data->temp_max[nr]; |
630 | (long)LM75_TEMP_FROM_REG(data->temp_max_add[nr-2])); | 621 | return sprintf(buf, "%ld\n", (nr) ? (long) LM75_TEMP_FROM_REG(tmp) |
631 | } else { /* TEMP1 */ | 622 | : (long) TEMP_FROM_REG(tmp)); |
632 | return sprintf(buf, "%ld\n", | ||
633 | (long)TEMP_FROM_REG(data->temp_max)); | ||
634 | } | ||
635 | } | 623 | } |
636 | 624 | ||
637 | static ssize_t | 625 | static ssize_t |
@@ -640,13 +628,10 @@ show_temp_max_hyst(struct device *dev, struct device_attribute *devattr, | |||
640 | { | 628 | { |
641 | int nr = to_sensor_dev_attr(devattr)->index; | 629 | int nr = to_sensor_dev_attr(devattr)->index; |
642 | struct w83627hf_data *data = w83627hf_update_device(dev); | 630 | struct w83627hf_data *data = w83627hf_update_device(dev); |
643 | if (nr >= 2) { /* TEMP2 and TEMP3 */ | 631 | |
644 | return sprintf(buf, "%ld\n", | 632 | u16 tmp = data->temp_max_hyst[nr]; |
645 | (long)LM75_TEMP_FROM_REG(data->temp_max_hyst_add[nr-2])); | 633 | return sprintf(buf, "%ld\n", (nr) ? (long) LM75_TEMP_FROM_REG(tmp) |
646 | } else { /* TEMP1 */ | 634 | : (long) TEMP_FROM_REG(tmp)); |
647 | return sprintf(buf, "%ld\n", | ||
648 | (long)TEMP_FROM_REG(data->temp_max_hyst)); | ||
649 | } | ||
650 | } | 635 | } |
651 | 636 | ||
652 | static ssize_t | 637 | static ssize_t |
@@ -656,18 +641,11 @@ store_temp_max(struct device *dev, struct device_attribute *devattr, | |||
656 | int nr = to_sensor_dev_attr(devattr)->index; | 641 | int nr = to_sensor_dev_attr(devattr)->index; |
657 | struct w83627hf_data *data = dev_get_drvdata(dev); | 642 | struct w83627hf_data *data = dev_get_drvdata(dev); |
658 | long val = simple_strtol(buf, NULL, 10); | 643 | long val = simple_strtol(buf, NULL, 10); |
644 | u16 tmp = (nr) ? LM75_TEMP_TO_REG(val) : TEMP_TO_REG(val); | ||
659 | 645 | ||
660 | mutex_lock(&data->update_lock); | 646 | mutex_lock(&data->update_lock); |
661 | 647 | data->temp_max[nr] = tmp; | |
662 | if (nr >= 2) { /* TEMP2 and TEMP3 */ | 648 | w83627hf_write_value(data, w83627hf_reg_temp_over[nr], tmp); |
663 | data->temp_max_add[nr-2] = LM75_TEMP_TO_REG(val); | ||
664 | w83627hf_write_value(data, W83781D_REG_TEMP_OVER(nr), | ||
665 | data->temp_max_add[nr-2]); | ||
666 | } else { /* TEMP1 */ | ||
667 | data->temp_max = TEMP_TO_REG(val); | ||
668 | w83627hf_write_value(data, W83781D_REG_TEMP_OVER(nr), | ||
669 | data->temp_max); | ||
670 | } | ||
671 | mutex_unlock(&data->update_lock); | 649 | mutex_unlock(&data->update_lock); |
672 | return count; | 650 | return count; |
673 | } | 651 | } |
@@ -679,29 +657,22 @@ store_temp_max_hyst(struct device *dev, struct device_attribute *devattr, | |||
679 | int nr = to_sensor_dev_attr(devattr)->index; | 657 | int nr = to_sensor_dev_attr(devattr)->index; |
680 | struct w83627hf_data *data = dev_get_drvdata(dev); | 658 | struct w83627hf_data *data = dev_get_drvdata(dev); |
681 | long val = simple_strtol(buf, NULL, 10); | 659 | long val = simple_strtol(buf, NULL, 10); |
660 | u16 tmp = (nr) ? LM75_TEMP_TO_REG(val) : TEMP_TO_REG(val); | ||
682 | 661 | ||
683 | mutex_lock(&data->update_lock); | 662 | mutex_lock(&data->update_lock); |
684 | 663 | data->temp_max_hyst[nr] = tmp; | |
685 | if (nr >= 2) { /* TEMP2 and TEMP3 */ | 664 | w83627hf_write_value(data, w83627hf_reg_temp_hyst[nr], tmp); |
686 | data->temp_max_hyst_add[nr-2] = LM75_TEMP_TO_REG(val); | ||
687 | w83627hf_write_value(data, W83781D_REG_TEMP_HYST(nr), | ||
688 | data->temp_max_hyst_add[nr-2]); | ||
689 | } else { /* TEMP1 */ | ||
690 | data->temp_max_hyst = TEMP_TO_REG(val); | ||
691 | w83627hf_write_value(data, W83781D_REG_TEMP_HYST(nr), | ||
692 | data->temp_max_hyst); | ||
693 | } | ||
694 | mutex_unlock(&data->update_lock); | 665 | mutex_unlock(&data->update_lock); |
695 | return count; | 666 | return count; |
696 | } | 667 | } |
697 | 668 | ||
698 | #define sysfs_temp_decl(offset) \ | 669 | #define sysfs_temp_decl(offset) \ |
699 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ | 670 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ |
700 | show_temp, NULL, offset); \ | 671 | show_temp, NULL, offset - 1); \ |
701 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO|S_IWUSR, \ | 672 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO|S_IWUSR, \ |
702 | show_temp_max, store_temp_max, offset); \ | 673 | show_temp_max, store_temp_max, offset - 1); \ |
703 | static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO|S_IWUSR, \ | 674 | static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO|S_IWUSR, \ |
704 | show_temp_max_hyst, store_temp_max_hyst, offset); | 675 | show_temp_max_hyst, store_temp_max_hyst, offset - 1); |
705 | 676 | ||
706 | sysfs_temp_decl(1); | 677 | sysfs_temp_decl(1); |
707 | sysfs_temp_decl(2); | 678 | sysfs_temp_decl(2); |
@@ -844,7 +815,7 @@ store_fan_div(struct device *dev, struct device_attribute *devattr, | |||
844 | 815 | ||
845 | /* Restore fan_min */ | 816 | /* Restore fan_min */ |
846 | data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); | 817 | data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); |
847 | w83627hf_write_value(data, W83781D_REG_FAN_MIN(nr+1), data->fan_min[nr]); | 818 | w83627hf_write_value(data, W83627HF_REG_FAN_MIN(nr), data->fan_min[nr]); |
848 | 819 | ||
849 | mutex_unlock(&data->update_lock); | 820 | mutex_unlock(&data->update_lock); |
850 | return count; | 821 | return count; |
@@ -1170,7 +1141,7 @@ static int __devinit w83627hf_probe(struct platform_device *pdev) | |||
1170 | struct w83627hf_sio_data *sio_data = dev->platform_data; | 1141 | struct w83627hf_sio_data *sio_data = dev->platform_data; |
1171 | struct w83627hf_data *data; | 1142 | struct w83627hf_data *data; |
1172 | struct resource *res; | 1143 | struct resource *res; |
1173 | int err; | 1144 | int err, i; |
1174 | 1145 | ||
1175 | static const char *names[] = { | 1146 | static const char *names[] = { |
1176 | "w83627hf", | 1147 | "w83627hf", |
@@ -1204,9 +1175,9 @@ static int __devinit w83627hf_probe(struct platform_device *pdev) | |||
1204 | w83627hf_init_device(pdev); | 1175 | w83627hf_init_device(pdev); |
1205 | 1176 | ||
1206 | /* A few vars need to be filled upon startup */ | 1177 | /* A few vars need to be filled upon startup */ |
1207 | data->fan_min[0] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(1)); | 1178 | for (i = 0; i <= 2; i++) |
1208 | data->fan_min[1] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(2)); | 1179 | data->fan_min[i] = w83627hf_read_value( |
1209 | data->fan_min[2] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(3)); | 1180 | data, W83627HF_REG_FAN_MIN(i)); |
1210 | w83627hf_update_fan_div(data); | 1181 | w83627hf_update_fan_div(data); |
1211 | 1182 | ||
1212 | /* Register common device attributes */ | 1183 | /* Register common device attributes */ |
@@ -1514,23 +1485,23 @@ static void __devinit w83627hf_init_device(struct platform_device *pdev) | |||
1514 | 1485 | ||
1515 | if(init) { | 1486 | if(init) { |
1516 | /* Enable temp2 */ | 1487 | /* Enable temp2 */ |
1517 | tmp = w83627hf_read_value(data, W83781D_REG_TEMP2_CONFIG); | 1488 | tmp = w83627hf_read_value(data, W83627HF_REG_TEMP2_CONFIG); |
1518 | if (tmp & 0x01) { | 1489 | if (tmp & 0x01) { |
1519 | dev_warn(&pdev->dev, "Enabling temp2, readings " | 1490 | dev_warn(&pdev->dev, "Enabling temp2, readings " |
1520 | "might not make sense\n"); | 1491 | "might not make sense\n"); |
1521 | w83627hf_write_value(data, W83781D_REG_TEMP2_CONFIG, | 1492 | w83627hf_write_value(data, W83627HF_REG_TEMP2_CONFIG, |
1522 | tmp & 0xfe); | 1493 | tmp & 0xfe); |
1523 | } | 1494 | } |
1524 | 1495 | ||
1525 | /* Enable temp3 */ | 1496 | /* Enable temp3 */ |
1526 | if (type != w83697hf) { | 1497 | if (type != w83697hf) { |
1527 | tmp = w83627hf_read_value(data, | 1498 | tmp = w83627hf_read_value(data, |
1528 | W83781D_REG_TEMP3_CONFIG); | 1499 | W83627HF_REG_TEMP3_CONFIG); |
1529 | if (tmp & 0x01) { | 1500 | if (tmp & 0x01) { |
1530 | dev_warn(&pdev->dev, "Enabling temp3, " | 1501 | dev_warn(&pdev->dev, "Enabling temp3, " |
1531 | "readings might not make sense\n"); | 1502 | "readings might not make sense\n"); |
1532 | w83627hf_write_value(data, | 1503 | w83627hf_write_value(data, |
1533 | W83781D_REG_TEMP3_CONFIG, tmp & 0xfe); | 1504 | W83627HF_REG_TEMP3_CONFIG, tmp & 0xfe); |
1534 | } | 1505 | } |
1535 | } | 1506 | } |
1536 | } | 1507 | } |
@@ -1563,7 +1534,7 @@ static void w83627hf_update_fan_div(struct w83627hf_data *data) | |||
1563 | static struct w83627hf_data *w83627hf_update_device(struct device *dev) | 1534 | static struct w83627hf_data *w83627hf_update_device(struct device *dev) |
1564 | { | 1535 | { |
1565 | struct w83627hf_data *data = dev_get_drvdata(dev); | 1536 | struct w83627hf_data *data = dev_get_drvdata(dev); |
1566 | int i; | 1537 | int i, num_temps = (data->type == w83697hf) ? 2 : 3; |
1567 | 1538 | ||
1568 | mutex_lock(&data->update_lock); | 1539 | mutex_lock(&data->update_lock); |
1569 | 1540 | ||
@@ -1584,12 +1555,12 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev) | |||
1584 | w83627hf_read_value(data, | 1555 | w83627hf_read_value(data, |
1585 | W83781D_REG_IN_MAX(i)); | 1556 | W83781D_REG_IN_MAX(i)); |
1586 | } | 1557 | } |
1587 | for (i = 1; i <= 3; i++) { | 1558 | for (i = 0; i <= 2; i++) { |
1588 | data->fan[i - 1] = | 1559 | data->fan[i] = |
1589 | w83627hf_read_value(data, W83781D_REG_FAN(i)); | 1560 | w83627hf_read_value(data, W83627HF_REG_FAN(i)); |
1590 | data->fan_min[i - 1] = | 1561 | data->fan_min[i] = |
1591 | w83627hf_read_value(data, | 1562 | w83627hf_read_value(data, |
1592 | W83781D_REG_FAN_MIN(i)); | 1563 | W83627HF_REG_FAN_MIN(i)); |
1593 | } | 1564 | } |
1594 | for (i = 0; i <= 2; i++) { | 1565 | for (i = 0; i <= 2; i++) { |
1595 | u8 tmp = w83627hf_read_value(data, | 1566 | u8 tmp = w83627hf_read_value(data, |
@@ -1616,25 +1587,13 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev) | |||
1616 | break; | 1587 | break; |
1617 | } | 1588 | } |
1618 | } | 1589 | } |
1619 | 1590 | for (i = 0; i < num_temps; i++) { | |
1620 | data->temp = w83627hf_read_value(data, W83781D_REG_TEMP(1)); | 1591 | data->temp[i] = w83627hf_read_value( |
1621 | data->temp_max = | 1592 | data, w83627hf_reg_temp[i]); |
1622 | w83627hf_read_value(data, W83781D_REG_TEMP_OVER(1)); | 1593 | data->temp_max[i] = w83627hf_read_value( |
1623 | data->temp_max_hyst = | 1594 | data, w83627hf_reg_temp_over[i]); |
1624 | w83627hf_read_value(data, W83781D_REG_TEMP_HYST(1)); | 1595 | data->temp_max_hyst[i] = w83627hf_read_value( |
1625 | data->temp_add[0] = | 1596 | data, w83627hf_reg_temp_hyst[i]); |
1626 | w83627hf_read_value(data, W83781D_REG_TEMP(2)); | ||
1627 | data->temp_max_add[0] = | ||
1628 | w83627hf_read_value(data, W83781D_REG_TEMP_OVER(2)); | ||
1629 | data->temp_max_hyst_add[0] = | ||
1630 | w83627hf_read_value(data, W83781D_REG_TEMP_HYST(2)); | ||
1631 | if (data->type != w83697hf) { | ||
1632 | data->temp_add[1] = | ||
1633 | w83627hf_read_value(data, W83781D_REG_TEMP(3)); | ||
1634 | data->temp_max_add[1] = | ||
1635 | w83627hf_read_value(data, W83781D_REG_TEMP_OVER(3)); | ||
1636 | data->temp_max_hyst_add[1] = | ||
1637 | w83627hf_read_value(data, W83781D_REG_TEMP_HYST(3)); | ||
1638 | } | 1597 | } |
1639 | 1598 | ||
1640 | w83627hf_update_fan_div(data); | 1599 | w83627hf_update_fan_div(data); |
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index a6a1edfe7614..e0fa7520400d 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
@@ -1122,12 +1122,13 @@ w83781d_create_files(struct device *dev, int kind, int is_isa) | |||
1122 | &sensor_dev_attr_temp3_beep.dev_attr))) | 1122 | &sensor_dev_attr_temp3_beep.dev_attr))) |
1123 | return err; | 1123 | return err; |
1124 | 1124 | ||
1125 | if (kind != w83781d) | 1125 | if (kind != w83781d) { |
1126 | err = sysfs_chmod_file(&dev->kobj, | 1126 | err = sysfs_chmod_file(&dev->kobj, |
1127 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | 1127 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, |
1128 | S_IRUGO | S_IWUSR); | 1128 | S_IRUGO | S_IWUSR); |
1129 | if (err) | 1129 | if (err) |
1130 | return err; | 1130 | return err; |
1131 | } | ||
1131 | } | 1132 | } |
1132 | 1133 | ||
1133 | if (kind != w83781d && kind != as99127f) { | 1134 | if (kind != w83781d && kind != as99127f) { |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index d1e8df187222..e445fe6e4ba9 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -203,10 +203,6 @@ config BLK_DEV_IDECD | |||
203 | CD-ROM drive, you can say N to all other CD-ROM options, but be sure | 203 | CD-ROM drive, you can say N to all other CD-ROM options, but be sure |
204 | to say Y or M to "ISO 9660 CD-ROM file system support". | 204 | to say Y or M to "ISO 9660 CD-ROM file system support". |
205 | 205 | ||
206 | Note that older versions of LILO (LInux LOader) cannot properly deal | ||
207 | with IDE/ATAPI CD-ROMs, so install LILO 16 or higher, available from | ||
208 | <http://lilo.go.dyndns.org/>. | ||
209 | |||
210 | To compile this driver as a module, choose M here: the | 206 | To compile this driver as a module, choose M here: the |
211 | module will be called ide-cd. | 207 | module will be called ide-cd. |
212 | 208 | ||
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index e196aefa2070..7f5bc2ee6c7e 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
@@ -748,8 +748,7 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
748 | hold = ATA_DMA2_HOLD; | 748 | hold = ATA_DMA2_HOLD; |
749 | break; | 749 | break; |
750 | default: | 750 | default: |
751 | BUG(); | 751 | return; |
752 | break; | ||
753 | } | 752 | } |
754 | 753 | ||
755 | if (speed >= XFER_UDMA_0) | 754 | if (speed >= XFER_UDMA_0) |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 755011827afa..db22d1ff4e55 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -885,7 +885,6 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
885 | return do_rw_taskfile(drive, args); | 885 | return do_rw_taskfile(drive, args); |
886 | } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) { | 886 | } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) { |
887 | u8 *args = rq->buffer; | 887 | u8 *args = rq->buffer; |
888 | u8 sel; | ||
889 | 888 | ||
890 | if (!args) | 889 | if (!args) |
891 | goto done; | 890 | goto done; |
@@ -903,10 +902,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
903 | hwif->OUTB(args[3], IDE_SECTOR_REG); | 902 | hwif->OUTB(args[3], IDE_SECTOR_REG); |
904 | hwif->OUTB(args[4], IDE_LCYL_REG); | 903 | hwif->OUTB(args[4], IDE_LCYL_REG); |
905 | hwif->OUTB(args[5], IDE_HCYL_REG); | 904 | hwif->OUTB(args[5], IDE_HCYL_REG); |
906 | sel = (args[6] & ~0x10); | 905 | hwif->OUTB((args[6] & 0xEF)|drive->select.all, IDE_SELECT_REG); |
907 | if (drive->select.b.unit) | ||
908 | sel |= 0x10; | ||
909 | hwif->OUTB(sel, IDE_SELECT_REG); | ||
910 | ide_cmd(drive, args[0], args[2], &drive_cmd_intr); | 906 | ide_cmd(drive, args[0], args[2], &drive_cmd_intr); |
911 | return ide_started; | 907 | return ide_started; |
912 | } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) { | 908 | } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) { |
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index af86433baede..1609b8604f56 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -514,6 +514,7 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat) | |||
514 | if (drive->addressing == 1) { | 514 | if (drive->addressing == 1) { |
515 | __u64 sectors = 0; | 515 | __u64 sectors = 0; |
516 | u32 low = 0, high = 0; | 516 | u32 low = 0, high = 0; |
517 | hwif->OUTB(drive->ctl&~0x80, IDE_CONTROL_REG); | ||
517 | low = ide_read_24(drive); | 518 | low = ide_read_24(drive); |
518 | hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG); | 519 | hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG); |
519 | high = ide_read_24(drive); | 520 | high = ide_read_24(drive); |
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index ea0143ef5fe5..51fca441c294 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cmd64x.c Version 1.50 May 10, 2007 | 2 | * linux/drivers/ide/pci/cmd64x.c Version 1.51 Nov 8, 2007 |
3 | * | 3 | * |
4 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. | 4 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. |
5 | * Due to massive hardware bugs, UltraDMA is only supported | 5 | * Due to massive hardware bugs, UltraDMA is only supported |
@@ -339,7 +339,8 @@ static int cmd648_ide_dma_end (ide_drive_t *drive) | |||
339 | u8 mrdmode = inb(hwif->dma_master + 0x01); | 339 | u8 mrdmode = inb(hwif->dma_master + 0x01); |
340 | 340 | ||
341 | /* clear the interrupt bit */ | 341 | /* clear the interrupt bit */ |
342 | outb(mrdmode | irq_mask, hwif->dma_master + 0x01); | 342 | outb((mrdmode & ~(MRDMODE_INTR_CH0 | MRDMODE_INTR_CH1)) | irq_mask, |
343 | hwif->dma_master + 0x01); | ||
343 | 344 | ||
344 | return err; | 345 | return err; |
345 | } | 346 | } |
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index 599408952bd4..547690395eee 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c | |||
@@ -117,8 +117,7 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
117 | case XFER_MW_DMA_1: timings = 0x00012121; break; | 117 | case XFER_MW_DMA_1: timings = 0x00012121; break; |
118 | case XFER_MW_DMA_2: timings = 0x00002020; break; | 118 | case XFER_MW_DMA_2: timings = 0x00002020; break; |
119 | default: | 119 | default: |
120 | BUG(); | 120 | return; |
121 | break; | ||
122 | } | 121 | } |
123 | basereg = CS5530_BASEREG(drive->hwif); | 122 | basereg = CS5530_BASEREG(drive->hwif); |
124 | reg = inl(basereg + 4); /* get drive0 config register */ | 123 | reg = inl(basereg + 4); /* get drive0 config register */ |
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 5c9975435319..99b7d763b6c7 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -653,8 +653,7 @@ static const struct ide_port_info it821x_chipsets[] __devinitdata = { | |||
653 | 653 | ||
654 | static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 654 | static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
655 | { | 655 | { |
656 | ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]); | 656 | return ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]); |
657 | return 0; | ||
658 | } | 657 | } |
659 | 658 | ||
660 | static const struct pci_device_id it821x_pci_tbl[] = { | 659 | static const struct pci_device_id it821x_pci_tbl[] = { |
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index bdf64d997708..0083eaf89c77 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c | |||
@@ -139,8 +139,7 @@ static const struct ide_port_info jmicron_chipset __devinitdata = { | |||
139 | 139 | ||
140 | static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 140 | static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
141 | { | 141 | { |
142 | ide_setup_pci_device(dev, &jmicron_chipset); | 142 | return ide_setup_pci_device(dev, &jmicron_chipset); |
143 | return 0; | ||
144 | } | 143 | } |
145 | 144 | ||
146 | /* All JMB PATA controllers have and will continue to have the same | 145 | /* All JMB PATA controllers have and will continue to have the same |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 0a7b3202066d..707d5ff66b03 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -186,8 +186,7 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
186 | } | 186 | } |
187 | break; | 187 | break; |
188 | default: | 188 | default: |
189 | BUG(); | 189 | return; |
190 | break; | ||
191 | } | 190 | } |
192 | 191 | ||
193 | if (unit == 0) { /* are we configuring drive0? */ | 192 | if (unit == 0) { /* are we configuring drive0? */ |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 6b7bb53acefd..f6e2ab3dd166 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -356,7 +356,6 @@ static void sis_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
356 | sis_program_timings(drive, speed); | 356 | sis_program_timings(drive, speed); |
357 | break; | 357 | break; |
358 | default: | 358 | default: |
359 | BUG(); | ||
360 | break; | 359 | break; |
361 | } | 360 | } |
362 | } | 361 | } |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 816b5311dad6..5afdfef7264c 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1138,6 +1138,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1138 | hwif->drives[0].autotune = IDE_TUNE_AUTO; | 1138 | hwif->drives[0].autotune = IDE_TUNE_AUTO; |
1139 | hwif->drives[1].autotune = IDE_TUNE_AUTO; | 1139 | hwif->drives[1].autotune = IDE_TUNE_AUTO; |
1140 | hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | | 1140 | hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | |
1141 | IDE_HFLAG_PIO_NO_DOWNGRADE | | ||
1141 | IDE_HFLAG_POST_SET_MODE; | 1142 | IDE_HFLAG_POST_SET_MODE; |
1142 | hwif->pio_mask = ATA_PIO4; | 1143 | hwif->pio_mask = ATA_PIO4; |
1143 | hwif->set_pio_mode = pmac_ide_set_pio_mode; | 1144 | hwif->set_pio_mode = pmac_ide_set_pio_mode; |
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 02d14bf85ab2..25fd09053220 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -7,11 +7,6 @@ | |||
7 | * May be copied or modified under the terms of the GNU General Public License | 7 | * May be copied or modified under the terms of the GNU General Public License |
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* | ||
11 | * This module provides support for automatic detection and | ||
12 | * configuration of all PCI IDE interfaces present in a system. | ||
13 | */ | ||
14 | |||
15 | #include <linux/module.h> | 10 | #include <linux/module.h> |
16 | #include <linux/types.h> | 11 | #include <linux/types.h> |
17 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index f0c777589374..b5436ca92e68 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -1000,6 +1000,7 @@ static int iwch_query_device(struct ib_device *ibdev, | |||
1000 | props->max_sge = dev->attr.max_sge_per_wr; | 1000 | props->max_sge = dev->attr.max_sge_per_wr; |
1001 | props->max_sge_rd = 1; | 1001 | props->max_sge_rd = 1; |
1002 | props->max_qp_rd_atom = dev->attr.max_rdma_reads_per_qp; | 1002 | props->max_qp_rd_atom = dev->attr.max_rdma_reads_per_qp; |
1003 | props->max_qp_init_rd_atom = dev->attr.max_rdma_reads_per_qp; | ||
1003 | props->max_cq = dev->attr.max_cqs; | 1004 | props->max_cq = dev->attr.max_cqs; |
1004 | props->max_cqe = dev->attr.max_cqes_per_cq; | 1005 | props->max_cqe = dev->attr.max_cqes_per_cq; |
1005 | props->max_mr = dev->attr.max_mem_regs; | 1006 | props->max_mr = dev->attr.max_mem_regs; |
diff --git a/drivers/infiniband/hw/ehca/ehca_av.c b/drivers/infiniband/hw/ehca/ehca_av.c index 97d108634c58..453eb995c1d4 100644 --- a/drivers/infiniband/hw/ehca/ehca_av.c +++ b/drivers/infiniband/hw/ehca/ehca_av.c | |||
@@ -50,6 +50,38 @@ | |||
50 | 50 | ||
51 | static struct kmem_cache *av_cache; | 51 | static struct kmem_cache *av_cache; |
52 | 52 | ||
53 | int ehca_calc_ipd(struct ehca_shca *shca, int port, | ||
54 | enum ib_rate path_rate, u32 *ipd) | ||
55 | { | ||
56 | int path = ib_rate_to_mult(path_rate); | ||
57 | int link, ret; | ||
58 | struct ib_port_attr pa; | ||
59 | |||
60 | if (path_rate == IB_RATE_PORT_CURRENT) { | ||
61 | *ipd = 0; | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | if (unlikely(path < 0)) { | ||
66 | ehca_err(&shca->ib_device, "Invalid static rate! path_rate=%x", | ||
67 | path_rate); | ||
68 | return -EINVAL; | ||
69 | } | ||
70 | |||
71 | ret = ehca_query_port(&shca->ib_device, port, &pa); | ||
72 | if (unlikely(ret < 0)) { | ||
73 | ehca_err(&shca->ib_device, "Failed to query port ret=%i", ret); | ||
74 | return ret; | ||
75 | } | ||
76 | |||
77 | link = ib_width_enum_to_int(pa.active_width) * pa.active_speed; | ||
78 | |||
79 | /* IPD = round((link / path) - 1) */ | ||
80 | *ipd = ((link + (path >> 1)) / path) - 1; | ||
81 | |||
82 | return 0; | ||
83 | } | ||
84 | |||
53 | struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) | 85 | struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) |
54 | { | 86 | { |
55 | int ret; | 87 | int ret; |
@@ -69,15 +101,13 @@ struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) | |||
69 | av->av.slid_path_bits = ah_attr->src_path_bits; | 101 | av->av.slid_path_bits = ah_attr->src_path_bits; |
70 | 102 | ||
71 | if (ehca_static_rate < 0) { | 103 | if (ehca_static_rate < 0) { |
72 | int ah_mult = ib_rate_to_mult(ah_attr->static_rate); | 104 | u32 ipd; |
73 | int ehca_mult = | 105 | if (ehca_calc_ipd(shca, ah_attr->port_num, |
74 | ib_rate_to_mult(shca->sport[ah_attr->port_num].rate ); | 106 | ah_attr->static_rate, &ipd)) { |
75 | 107 | ret = -EINVAL; | |
76 | if (ah_mult >= ehca_mult) | 108 | goto create_ah_exit1; |
77 | av->av.ipd = 0; | 109 | } |
78 | else | 110 | av->av.ipd = ipd; |
79 | av->av.ipd = (ah_mult > 0) ? | ||
80 | ((ehca_mult - 1) / ah_mult) : 0; | ||
81 | } else | 111 | } else |
82 | av->av.ipd = ehca_static_rate; | 112 | av->av.ipd = ehca_static_rate; |
83 | 113 | ||
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 2d660ae189e5..87f12d4312a7 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
@@ -95,7 +95,6 @@ struct ehca_sma_attr { | |||
95 | struct ehca_sport { | 95 | struct ehca_sport { |
96 | struct ib_cq *ibcq_aqp1; | 96 | struct ib_cq *ibcq_aqp1; |
97 | struct ib_qp *ibqp_aqp1; | 97 | struct ib_qp *ibqp_aqp1; |
98 | enum ib_rate rate; | ||
99 | enum ib_port_state port_state; | 98 | enum ib_port_state port_state; |
100 | struct ehca_sma_attr saved_attr; | 99 | struct ehca_sma_attr saved_attr; |
101 | }; | 100 | }; |
diff --git a/drivers/infiniband/hw/ehca/ehca_hca.c b/drivers/infiniband/hw/ehca/ehca_hca.c index 15806d140461..5bd7b591987e 100644 --- a/drivers/infiniband/hw/ehca/ehca_hca.c +++ b/drivers/infiniband/hw/ehca/ehca_hca.c | |||
@@ -151,7 +151,6 @@ int ehca_query_port(struct ib_device *ibdev, | |||
151 | } | 151 | } |
152 | 152 | ||
153 | memset(props, 0, sizeof(struct ib_port_attr)); | 153 | memset(props, 0, sizeof(struct ib_port_attr)); |
154 | props->state = rblock->state; | ||
155 | 154 | ||
156 | switch (rblock->max_mtu) { | 155 | switch (rblock->max_mtu) { |
157 | case 0x1: | 156 | case 0x1: |
@@ -188,11 +187,20 @@ int ehca_query_port(struct ib_device *ibdev, | |||
188 | props->subnet_timeout = rblock->subnet_timeout; | 187 | props->subnet_timeout = rblock->subnet_timeout; |
189 | props->init_type_reply = rblock->init_type_reply; | 188 | props->init_type_reply = rblock->init_type_reply; |
190 | 189 | ||
191 | props->active_width = IB_WIDTH_12X; | 190 | if (rblock->state && rblock->phys_width) { |
192 | props->active_speed = 0x1; | 191 | props->phys_state = rblock->phys_pstate; |
193 | 192 | props->state = rblock->phys_state; | |
194 | /* at the moment (logical) link state is always LINK_UP */ | 193 | props->active_width = rblock->phys_width; |
195 | props->phys_state = 0x5; | 194 | props->active_speed = rblock->phys_speed; |
195 | } else { | ||
196 | /* old firmware releases don't report physical | ||
197 | * port info, so use default values | ||
198 | */ | ||
199 | props->phys_state = 5; | ||
200 | props->state = rblock->state; | ||
201 | props->active_width = IB_WIDTH_12X; | ||
202 | props->active_speed = 0x1; | ||
203 | } | ||
196 | 204 | ||
197 | query_port1: | 205 | query_port1: |
198 | ehca_free_fw_ctrlblock(rblock); | 206 | ehca_free_fw_ctrlblock(rblock); |
diff --git a/drivers/infiniband/hw/ehca/ehca_iverbs.h b/drivers/infiniband/hw/ehca/ehca_iverbs.h index dce503bb7d6b..5485799cdc8d 100644 --- a/drivers/infiniband/hw/ehca/ehca_iverbs.h +++ b/drivers/infiniband/hw/ehca/ehca_iverbs.h | |||
@@ -189,6 +189,9 @@ int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma); | |||
189 | 189 | ||
190 | void ehca_poll_eqs(unsigned long data); | 190 | void ehca_poll_eqs(unsigned long data); |
191 | 191 | ||
192 | int ehca_calc_ipd(struct ehca_shca *shca, int port, | ||
193 | enum ib_rate path_rate, u32 *ipd); | ||
194 | |||
192 | #ifdef CONFIG_PPC_64K_PAGES | 195 | #ifdef CONFIG_PPC_64K_PAGES |
193 | void *ehca_alloc_fw_ctrlblock(gfp_t flags); | 196 | void *ehca_alloc_fw_ctrlblock(gfp_t flags); |
194 | void ehca_free_fw_ctrlblock(void *ptr); | 197 | void ehca_free_fw_ctrlblock(void *ptr); |
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index c6cd38c5321f..90d4334179bf 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
@@ -327,9 +327,6 @@ static int ehca_sense_attributes(struct ehca_shca *shca) | |||
327 | shca->hw_level = ehca_hw_level; | 327 | shca->hw_level = ehca_hw_level; |
328 | ehca_gen_dbg(" ... hardware level=%x", shca->hw_level); | 328 | ehca_gen_dbg(" ... hardware level=%x", shca->hw_level); |
329 | 329 | ||
330 | shca->sport[0].rate = IB_RATE_30_GBPS; | ||
331 | shca->sport[1].rate = IB_RATE_30_GBPS; | ||
332 | |||
333 | shca->hca_cap = rblock->hca_cap_indicators; | 330 | shca->hca_cap = rblock->hca_cap_indicators; |
334 | ehca_gen_dbg(" ... HCA capabilities:"); | 331 | ehca_gen_dbg(" ... HCA capabilities:"); |
335 | for (i = 0; i < ARRAY_SIZE(hca_cap_descr); i++) | 332 | for (i = 0; i < ARRAY_SIZE(hca_cap_descr); i++) |
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c index de182648b282..2e3e6547cb78 100644 --- a/drivers/infiniband/hw/ehca/ehca_qp.c +++ b/drivers/infiniband/hw/ehca/ehca_qp.c | |||
@@ -1196,10 +1196,6 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1196 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_QKEY, 1); | 1196 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_QKEY, 1); |
1197 | } | 1197 | } |
1198 | if (attr_mask & IB_QP_AV) { | 1198 | if (attr_mask & IB_QP_AV) { |
1199 | int ah_mult = ib_rate_to_mult(attr->ah_attr.static_rate); | ||
1200 | int ehca_mult = ib_rate_to_mult(shca->sport[my_qp-> | ||
1201 | init_attr.port_num].rate); | ||
1202 | |||
1203 | mqpcb->dlid = attr->ah_attr.dlid; | 1199 | mqpcb->dlid = attr->ah_attr.dlid; |
1204 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_DLID, 1); | 1200 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_DLID, 1); |
1205 | mqpcb->source_path_bits = attr->ah_attr.src_path_bits; | 1201 | mqpcb->source_path_bits = attr->ah_attr.src_path_bits; |
@@ -1207,11 +1203,12 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1207 | mqpcb->service_level = attr->ah_attr.sl; | 1203 | mqpcb->service_level = attr->ah_attr.sl; |
1208 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1); | 1204 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1); |
1209 | 1205 | ||
1210 | if (ah_mult < ehca_mult) | 1206 | if (ehca_calc_ipd(shca, my_qp->init_attr.port_num, |
1211 | mqpcb->max_static_rate = (ah_mult > 0) ? | 1207 | attr->ah_attr.static_rate, |
1212 | ((ehca_mult - 1) / ah_mult) : 0; | 1208 | &mqpcb->max_static_rate)) { |
1213 | else | 1209 | ret = -EINVAL; |
1214 | mqpcb->max_static_rate = 0; | 1210 | goto modify_qp_exit2; |
1211 | } | ||
1215 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_MAX_STATIC_RATE, 1); | 1212 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_MAX_STATIC_RATE, 1); |
1216 | 1213 | ||
1217 | /* | 1214 | /* |
@@ -1280,10 +1277,6 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1280 | (MQPCB_MASK_RDMA_ATOMIC_OUTST_DEST_QP, 1); | 1277 | (MQPCB_MASK_RDMA_ATOMIC_OUTST_DEST_QP, 1); |
1281 | } | 1278 | } |
1282 | if (attr_mask & IB_QP_ALT_PATH) { | 1279 | if (attr_mask & IB_QP_ALT_PATH) { |
1283 | int ah_mult = ib_rate_to_mult(attr->alt_ah_attr.static_rate); | ||
1284 | int ehca_mult = ib_rate_to_mult( | ||
1285 | shca->sport[my_qp->init_attr.port_num].rate); | ||
1286 | |||
1287 | if (attr->alt_port_num < 1 | 1280 | if (attr->alt_port_num < 1 |
1288 | || attr->alt_port_num > shca->num_ports) { | 1281 | || attr->alt_port_num > shca->num_ports) { |
1289 | ret = -EINVAL; | 1282 | ret = -EINVAL; |
@@ -1309,10 +1302,12 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1309 | mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits; | 1302 | mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits; |
1310 | mqpcb->service_level_al = attr->alt_ah_attr.sl; | 1303 | mqpcb->service_level_al = attr->alt_ah_attr.sl; |
1311 | 1304 | ||
1312 | if (ah_mult > 0 && ah_mult < ehca_mult) | 1305 | if (ehca_calc_ipd(shca, my_qp->init_attr.port_num, |
1313 | mqpcb->max_static_rate_al = (ehca_mult - 1) / ah_mult; | 1306 | attr->alt_ah_attr.static_rate, |
1314 | else | 1307 | &mqpcb->max_static_rate_al)) { |
1315 | mqpcb->max_static_rate_al = 0; | 1308 | ret = -EINVAL; |
1309 | goto modify_qp_exit2; | ||
1310 | } | ||
1316 | 1311 | ||
1317 | /* OpenIB doesn't support alternate retry counts - copy them */ | 1312 | /* OpenIB doesn't support alternate retry counts - copy them */ |
1318 | mqpcb->retry_count_al = mqpcb->retry_count; | 1313 | mqpcb->retry_count_al = mqpcb->retry_count; |
diff --git a/drivers/infiniband/hw/ehca/hipz_hw.h b/drivers/infiniband/hw/ehca/hipz_hw.h index d9739e554515..485b8400359e 100644 --- a/drivers/infiniband/hw/ehca/hipz_hw.h +++ b/drivers/infiniband/hw/ehca/hipz_hw.h | |||
@@ -402,7 +402,11 @@ struct hipz_query_port { | |||
402 | u64 max_msg_sz; | 402 | u64 max_msg_sz; |
403 | u32 max_mtu; | 403 | u32 max_mtu; |
404 | u32 vl_cap; | 404 | u32 vl_cap; |
405 | u8 reserved2[1900]; | 405 | u32 phys_pstate; |
406 | u32 phys_state; | ||
407 | u32 phys_speed; | ||
408 | u32 phys_width; | ||
409 | u8 reserved2[1884]; | ||
406 | u64 guid_entries[255]; | 410 | u64 guid_entries[255]; |
407 | } __attribute__ ((packed)); | 411 | } __attribute__ ((packed)); |
408 | 412 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c b/drivers/infiniband/hw/ipath/ipath_cq.c index 645ed71fd797..08d8ae148cd0 100644 --- a/drivers/infiniband/hw/ipath/ipath_cq.c +++ b/drivers/infiniband/hw/ipath/ipath_cq.c | |||
@@ -404,7 +404,7 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) | |||
404 | 404 | ||
405 | ret = ib_copy_to_udata(udata, &offset, sizeof(offset)); | 405 | ret = ib_copy_to_udata(udata, &offset, sizeof(offset)); |
406 | if (ret) | 406 | if (ret) |
407 | goto bail; | 407 | goto bail_free; |
408 | } | 408 | } |
409 | 409 | ||
410 | spin_lock_irq(&cq->lock); | 410 | spin_lock_irq(&cq->lock); |
@@ -424,10 +424,8 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) | |||
424 | else | 424 | else |
425 | n = head - tail; | 425 | n = head - tail; |
426 | if (unlikely((u32)cqe < n)) { | 426 | if (unlikely((u32)cqe < n)) { |
427 | spin_unlock_irq(&cq->lock); | ||
428 | vfree(wc); | ||
429 | ret = -EOVERFLOW; | 427 | ret = -EOVERFLOW; |
430 | goto bail; | 428 | goto bail_unlock; |
431 | } | 429 | } |
432 | for (n = 0; tail != head; n++) { | 430 | for (n = 0; tail != head; n++) { |
433 | if (cq->ip) | 431 | if (cq->ip) |
@@ -459,7 +457,12 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) | |||
459 | } | 457 | } |
460 | 458 | ||
461 | ret = 0; | 459 | ret = 0; |
460 | goto bail; | ||
462 | 461 | ||
462 | bail_unlock: | ||
463 | spin_unlock_irq(&cq->lock); | ||
464 | bail_free: | ||
465 | vfree(wc); | ||
463 | bail: | 466 | bail: |
464 | return ret; | 467 | return ret; |
465 | } | 468 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c index 5c29b2bfea17..120a61b03bc4 100644 --- a/drivers/infiniband/hw/ipath/ipath_rc.c +++ b/drivers/infiniband/hw/ipath/ipath_rc.c | |||
@@ -959,8 +959,9 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode, | |||
959 | /* If this is a partial ACK, reset the retransmit timer. */ | 959 | /* If this is a partial ACK, reset the retransmit timer. */ |
960 | if (qp->s_last != qp->s_tail) { | 960 | if (qp->s_last != qp->s_tail) { |
961 | spin_lock(&dev->pending_lock); | 961 | spin_lock(&dev->pending_lock); |
962 | list_add_tail(&qp->timerwait, | 962 | if (list_empty(&qp->timerwait)) |
963 | &dev->pending[dev->pending_index]); | 963 | list_add_tail(&qp->timerwait, |
964 | &dev->pending[dev->pending_index]); | ||
964 | spin_unlock(&dev->pending_lock); | 965 | spin_unlock(&dev->pending_lock); |
965 | /* | 966 | /* |
966 | * If we get a partial ACK for a resent operation, | 967 | * If we get a partial ACK for a resent operation, |
diff --git a/drivers/isdn/sc/card.h b/drivers/isdn/sc/card.h index 5992f63c383e..0120bcf88311 100644 --- a/drivers/isdn/sc/card.h +++ b/drivers/isdn/sc/card.h | |||
@@ -109,7 +109,7 @@ void memcpy_fromshmem(int card, void *dest, const void *src, size_t n); | |||
109 | int get_card_from_id(int driver); | 109 | int get_card_from_id(int driver); |
110 | int indicate_status(int card, int event, ulong Channel, char *Data); | 110 | int indicate_status(int card, int event, ulong Channel, char *Data); |
111 | irqreturn_t interrupt_handler(int interrupt, void *cardptr); | 111 | irqreturn_t interrupt_handler(int interrupt, void *cardptr); |
112 | int sndpkt(int devId, int channel, struct sk_buff *data); | 112 | int sndpkt(int devId, int channel, int ack, struct sk_buff *data); |
113 | void rcvpkt(int card, RspMessage *rcvmsg); | 113 | void rcvpkt(int card, RspMessage *rcvmsg); |
114 | int command(isdn_ctrl *cmd); | 114 | int command(isdn_ctrl *cmd); |
115 | int reset(int card); | 115 | int reset(int card); |
diff --git a/drivers/isdn/sc/packet.c b/drivers/isdn/sc/packet.c index 92016a2608e9..5ff6ae868440 100644 --- a/drivers/isdn/sc/packet.c +++ b/drivers/isdn/sc/packet.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include "message.h" | 20 | #include "message.h" |
21 | #include "card.h" | 21 | #include "card.h" |
22 | 22 | ||
23 | int sndpkt(int devId, int channel, struct sk_buff *data) | 23 | int sndpkt(int devId, int channel, int ack, struct sk_buff *data) |
24 | { | 24 | { |
25 | LLData ReqLnkWrite; | 25 | LLData ReqLnkWrite; |
26 | int status; | 26 | int status; |
diff --git a/drivers/isdn/sc/shmem.c b/drivers/isdn/sc/shmem.c index e0331e0094f1..712220cef139 100644 --- a/drivers/isdn/sc/shmem.c +++ b/drivers/isdn/sc/shmem.c | |||
@@ -50,7 +50,7 @@ void memcpy_toshmem(int card, void *dest, const void *src, size_t n) | |||
50 | 50 | ||
51 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, | 51 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, |
52 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | 52 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); |
53 | memcpy_toio(sc_adapter[card]->rambase + dest_rem, src, n); | 53 | memcpy_toio((void __iomem *)(sc_adapter[card]->rambase + dest_rem), src, n); |
54 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 54 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
55 | pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename, | 55 | pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename, |
56 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); | 56 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); |
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 729f1cd93606..7a6eead63a6b 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -494,6 +494,7 @@ static void init_vmcb(struct vmcb *vmcb) | |||
494 | */ | 494 | */ |
495 | /* (1ULL << INTERCEPT_SELECTIVE_CR0) | */ | 495 | /* (1ULL << INTERCEPT_SELECTIVE_CR0) | */ |
496 | (1ULL << INTERCEPT_CPUID) | | 496 | (1ULL << INTERCEPT_CPUID) | |
497 | (1ULL << INTERCEPT_INVD) | | ||
497 | (1ULL << INTERCEPT_HLT) | | 498 | (1ULL << INTERCEPT_HLT) | |
498 | (1ULL << INTERCEPT_INVLPGA) | | 499 | (1ULL << INTERCEPT_INVLPGA) | |
499 | (1ULL << INTERCEPT_IOIO_PROT) | | 500 | (1ULL << INTERCEPT_IOIO_PROT) | |
@@ -507,6 +508,7 @@ static void init_vmcb(struct vmcb *vmcb) | |||
507 | (1ULL << INTERCEPT_STGI) | | 508 | (1ULL << INTERCEPT_STGI) | |
508 | (1ULL << INTERCEPT_CLGI) | | 509 | (1ULL << INTERCEPT_CLGI) | |
509 | (1ULL << INTERCEPT_SKINIT) | | 510 | (1ULL << INTERCEPT_SKINIT) | |
511 | (1ULL << INTERCEPT_WBINVD) | | ||
510 | (1ULL << INTERCEPT_MONITOR) | | 512 | (1ULL << INTERCEPT_MONITOR) | |
511 | (1ULL << INTERCEPT_MWAIT); | 513 | (1ULL << INTERCEPT_MWAIT); |
512 | 514 | ||
@@ -561,6 +563,12 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu) | |||
561 | struct vcpu_svm *svm = to_svm(vcpu); | 563 | struct vcpu_svm *svm = to_svm(vcpu); |
562 | 564 | ||
563 | init_vmcb(svm->vmcb); | 565 | init_vmcb(svm->vmcb); |
566 | |||
567 | if (vcpu->vcpu_id != 0) { | ||
568 | svm->vmcb->save.rip = 0; | ||
569 | svm->vmcb->save.cs.base = svm->vcpu.sipi_vector << 12; | ||
570 | svm->vmcb->save.cs.selector = svm->vcpu.sipi_vector << 8; | ||
571 | } | ||
564 | } | 572 | } |
565 | 573 | ||
566 | static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) | 574 | static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) |
@@ -1241,6 +1249,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm, | |||
1241 | [SVM_EXIT_VINTR] = interrupt_window_interception, | 1249 | [SVM_EXIT_VINTR] = interrupt_window_interception, |
1242 | /* [SVM_EXIT_CR0_SEL_WRITE] = emulate_on_interception, */ | 1250 | /* [SVM_EXIT_CR0_SEL_WRITE] = emulate_on_interception, */ |
1243 | [SVM_EXIT_CPUID] = cpuid_interception, | 1251 | [SVM_EXIT_CPUID] = cpuid_interception, |
1252 | [SVM_EXIT_INVD] = emulate_on_interception, | ||
1244 | [SVM_EXIT_HLT] = halt_interception, | 1253 | [SVM_EXIT_HLT] = halt_interception, |
1245 | [SVM_EXIT_INVLPG] = emulate_on_interception, | 1254 | [SVM_EXIT_INVLPG] = emulate_on_interception, |
1246 | [SVM_EXIT_INVLPGA] = invalid_op_interception, | 1255 | [SVM_EXIT_INVLPGA] = invalid_op_interception, |
@@ -1255,6 +1264,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm, | |||
1255 | [SVM_EXIT_STGI] = invalid_op_interception, | 1264 | [SVM_EXIT_STGI] = invalid_op_interception, |
1256 | [SVM_EXIT_CLGI] = invalid_op_interception, | 1265 | [SVM_EXIT_CLGI] = invalid_op_interception, |
1257 | [SVM_EXIT_SKINIT] = invalid_op_interception, | 1266 | [SVM_EXIT_SKINIT] = invalid_op_interception, |
1267 | [SVM_EXIT_WBINVD] = emulate_on_interception, | ||
1258 | [SVM_EXIT_MONITOR] = invalid_op_interception, | 1268 | [SVM_EXIT_MONITOR] = invalid_op_interception, |
1259 | [SVM_EXIT_MWAIT] = invalid_op_interception, | 1269 | [SVM_EXIT_MWAIT] = invalid_op_interception, |
1260 | }; | 1270 | }; |
@@ -1579,10 +1589,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1579 | #endif | 1589 | #endif |
1580 | : "cc", "memory" ); | 1590 | : "cc", "memory" ); |
1581 | 1591 | ||
1582 | local_irq_disable(); | ||
1583 | |||
1584 | stgi(); | ||
1585 | |||
1586 | if ((svm->vmcb->save.dr7 & 0xff)) | 1592 | if ((svm->vmcb->save.dr7 & 0xff)) |
1587 | load_db_regs(svm->host_db_regs); | 1593 | load_db_regs(svm->host_db_regs); |
1588 | 1594 | ||
@@ -1599,6 +1605,10 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1599 | 1605 | ||
1600 | reload_tss(vcpu); | 1606 | reload_tss(vcpu); |
1601 | 1607 | ||
1608 | local_irq_disable(); | ||
1609 | |||
1610 | stgi(); | ||
1611 | |||
1602 | svm->next_rip = 0; | 1612 | svm->next_rip = 0; |
1603 | } | 1613 | } |
1604 | 1614 | ||
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index a6ace302e0cd..33b181451557 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c | |||
@@ -167,7 +167,7 @@ static u8 opcode_table[256] = { | |||
167 | static u16 twobyte_table[256] = { | 167 | static u16 twobyte_table[256] = { |
168 | /* 0x00 - 0x0F */ | 168 | /* 0x00 - 0x0F */ |
169 | 0, SrcMem | ModRM | DstReg, 0, 0, 0, 0, ImplicitOps, 0, | 169 | 0, SrcMem | ModRM | DstReg, 0, 0, 0, 0, ImplicitOps, 0, |
170 | 0, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0, | 170 | ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0, |
171 | /* 0x10 - 0x1F */ | 171 | /* 0x10 - 0x1F */ |
172 | 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0, | 172 | 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0, |
173 | /* 0x20 - 0x2F */ | 173 | /* 0x20 - 0x2F */ |
@@ -980,17 +980,6 @@ done_prefixes: | |||
980 | goto cannot_emulate; | 980 | goto cannot_emulate; |
981 | dst.val = (s32) src.val; | 981 | dst.val = (s32) src.val; |
982 | break; | 982 | break; |
983 | case 0x6a: /* push imm8 */ | ||
984 | src.val = 0L; | ||
985 | src.val = insn_fetch(s8, 1, _eip); | ||
986 | push: | ||
987 | dst.type = OP_MEM; | ||
988 | dst.bytes = op_bytes; | ||
989 | dst.val = src.val; | ||
990 | register_address_increment(_regs[VCPU_REGS_RSP], -op_bytes); | ||
991 | dst.ptr = (void *) register_address(ctxt->ss_base, | ||
992 | _regs[VCPU_REGS_RSP]); | ||
993 | break; | ||
994 | case 0x80 ... 0x83: /* Grp1 */ | 983 | case 0x80 ... 0x83: /* Grp1 */ |
995 | switch (modrm_reg) { | 984 | switch (modrm_reg) { |
996 | case 0: | 985 | case 0: |
@@ -1243,6 +1232,17 @@ special_insn: | |||
1243 | register_address_increment(_regs[VCPU_REGS_RSP], op_bytes); | 1232 | register_address_increment(_regs[VCPU_REGS_RSP], op_bytes); |
1244 | no_wb = 1; /* Disable writeback. */ | 1233 | no_wb = 1; /* Disable writeback. */ |
1245 | break; | 1234 | break; |
1235 | case 0x6a: /* push imm8 */ | ||
1236 | src.val = 0L; | ||
1237 | src.val = insn_fetch(s8, 1, _eip); | ||
1238 | push: | ||
1239 | dst.type = OP_MEM; | ||
1240 | dst.bytes = op_bytes; | ||
1241 | dst.val = src.val; | ||
1242 | register_address_increment(_regs[VCPU_REGS_RSP], -op_bytes); | ||
1243 | dst.ptr = (void *) register_address(ctxt->ss_base, | ||
1244 | _regs[VCPU_REGS_RSP]); | ||
1245 | break; | ||
1246 | case 0x6c: /* insb */ | 1246 | case 0x6c: /* insb */ |
1247 | case 0x6d: /* insw/insd */ | 1247 | case 0x6d: /* insw/insd */ |
1248 | if (kvm_emulate_pio_string(ctxt->vcpu, NULL, | 1248 | if (kvm_emulate_pio_string(ctxt->vcpu, NULL, |
@@ -1532,6 +1532,8 @@ twobyte_special_insn: | |||
1532 | case 0x06: | 1532 | case 0x06: |
1533 | emulate_clts(ctxt->vcpu); | 1533 | emulate_clts(ctxt->vcpu); |
1534 | break; | 1534 | break; |
1535 | case 0x08: /* invd */ | ||
1536 | break; | ||
1535 | case 0x09: /* wbinvd */ | 1537 | case 0x09: /* wbinvd */ |
1536 | break; | 1538 | break; |
1537 | case 0x0d: /* GrpP (prefetch) */ | 1539 | case 0x0d: /* GrpP (prefetch) */ |
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 8904f72f97c6..66f38722253a 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
@@ -200,7 +200,8 @@ static struct virtqueue *lg_find_vq(struct virtio_device *vdev, | |||
200 | 200 | ||
201 | /* Figure out how many pages the ring will take, and map that memory */ | 201 | /* Figure out how many pages the ring will take, and map that memory */ |
202 | lvq->pages = lguest_map((unsigned long)lvq->config.pfn << PAGE_SHIFT, | 202 | lvq->pages = lguest_map((unsigned long)lvq->config.pfn << PAGE_SHIFT, |
203 | DIV_ROUND_UP(vring_size(lvq->config.num), | 203 | DIV_ROUND_UP(vring_size(lvq->config.num, |
204 | PAGE_SIZE), | ||
204 | PAGE_SIZE)); | 205 | PAGE_SIZE)); |
205 | if (!lvq->pages) { | 206 | if (!lvq->pages) { |
206 | err = -ENOMEM; | 207 | err = -ENOMEM; |
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c index 9d716fa42cad..3b92a61ba8d2 100644 --- a/drivers/lguest/lguest_user.c +++ b/drivers/lguest/lguest_user.c | |||
@@ -184,7 +184,7 @@ static int initialize(struct file *file, const unsigned long __user *input) | |||
184 | free_regs: | 184 | free_regs: |
185 | free_page(lg->regs_page); | 185 | free_page(lg->regs_page); |
186 | release_guest: | 186 | release_guest: |
187 | memset(lg, 0, sizeof(*lg)); | 187 | kfree(lg); |
188 | unlock: | 188 | unlock: |
189 | mutex_unlock(&lguest_lock); | 189 | mutex_unlock(&lguest_lock); |
190 | return err; | 190 | return err; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 1cfc984cc7b7..a5aad8cad843 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -688,7 +688,8 @@ ops_run_prexor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
688 | } | 688 | } |
689 | 689 | ||
690 | static struct dma_async_tx_descriptor * | 690 | static struct dma_async_tx_descriptor * |
691 | ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | 691 | ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx, |
692 | unsigned long pending) | ||
692 | { | 693 | { |
693 | int disks = sh->disks; | 694 | int disks = sh->disks; |
694 | int pd_idx = sh->pd_idx, i; | 695 | int pd_idx = sh->pd_idx, i; |
@@ -696,7 +697,7 @@ ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
696 | /* check if prexor is active which means only process blocks | 697 | /* check if prexor is active which means only process blocks |
697 | * that are part of a read-modify-write (Wantprexor) | 698 | * that are part of a read-modify-write (Wantprexor) |
698 | */ | 699 | */ |
699 | int prexor = test_bit(STRIPE_OP_PREXOR, &sh->ops.pending); | 700 | int prexor = test_bit(STRIPE_OP_PREXOR, &pending); |
700 | 701 | ||
701 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 702 | pr_debug("%s: stripe %llu\n", __FUNCTION__, |
702 | (unsigned long long)sh->sector); | 703 | (unsigned long long)sh->sector); |
@@ -773,7 +774,8 @@ static void ops_complete_write(void *stripe_head_ref) | |||
773 | } | 774 | } |
774 | 775 | ||
775 | static void | 776 | static void |
776 | ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | 777 | ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx, |
778 | unsigned long pending) | ||
777 | { | 779 | { |
778 | /* kernel stack size limits the total number of disks */ | 780 | /* kernel stack size limits the total number of disks */ |
779 | int disks = sh->disks; | 781 | int disks = sh->disks; |
@@ -781,7 +783,7 @@ ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
781 | 783 | ||
782 | int count = 0, pd_idx = sh->pd_idx, i; | 784 | int count = 0, pd_idx = sh->pd_idx, i; |
783 | struct page *xor_dest; | 785 | struct page *xor_dest; |
784 | int prexor = test_bit(STRIPE_OP_PREXOR, &sh->ops.pending); | 786 | int prexor = test_bit(STRIPE_OP_PREXOR, &pending); |
785 | unsigned long flags; | 787 | unsigned long flags; |
786 | dma_async_tx_callback callback; | 788 | dma_async_tx_callback callback; |
787 | 789 | ||
@@ -808,7 +810,7 @@ ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
808 | } | 810 | } |
809 | 811 | ||
810 | /* check whether this postxor is part of a write */ | 812 | /* check whether this postxor is part of a write */ |
811 | callback = test_bit(STRIPE_OP_BIODRAIN, &sh->ops.pending) ? | 813 | callback = test_bit(STRIPE_OP_BIODRAIN, &pending) ? |
812 | ops_complete_write : ops_complete_postxor; | 814 | ops_complete_write : ops_complete_postxor; |
813 | 815 | ||
814 | /* 1/ if we prexor'd then the dest is reused as a source | 816 | /* 1/ if we prexor'd then the dest is reused as a source |
@@ -896,12 +898,12 @@ static void raid5_run_ops(struct stripe_head *sh, unsigned long pending) | |||
896 | tx = ops_run_prexor(sh, tx); | 898 | tx = ops_run_prexor(sh, tx); |
897 | 899 | ||
898 | if (test_bit(STRIPE_OP_BIODRAIN, &pending)) { | 900 | if (test_bit(STRIPE_OP_BIODRAIN, &pending)) { |
899 | tx = ops_run_biodrain(sh, tx); | 901 | tx = ops_run_biodrain(sh, tx, pending); |
900 | overlap_clear++; | 902 | overlap_clear++; |
901 | } | 903 | } |
902 | 904 | ||
903 | if (test_bit(STRIPE_OP_POSTXOR, &pending)) | 905 | if (test_bit(STRIPE_OP_POSTXOR, &pending)) |
904 | ops_run_postxor(sh, tx); | 906 | ops_run_postxor(sh, tx, pending); |
905 | 907 | ||
906 | if (test_bit(STRIPE_OP_CHECK, &pending)) | 908 | if (test_bit(STRIPE_OP_CHECK, &pending)) |
907 | ops_run_check(sh); | 909 | ops_run_check(sh); |
diff --git a/drivers/misc/ioc4.c b/drivers/misc/ioc4.c index 6a5a05d1f392..05172d2613d6 100644 --- a/drivers/misc/ioc4.c +++ b/drivers/misc/ioc4.c | |||
@@ -244,10 +244,11 @@ ioc4_variant(struct ioc4_driver_data *idd) | |||
244 | idd->idd_pdev->bus->number == pdev->bus->number && | 244 | idd->idd_pdev->bus->number == pdev->bus->number && |
245 | 3 == PCI_SLOT(pdev->devfn)) | 245 | 3 == PCI_SLOT(pdev->devfn)) |
246 | found = 1; | 246 | found = 1; |
247 | pci_dev_put(pdev); | ||
248 | } while (pdev && !found); | 247 | } while (pdev && !found); |
249 | if (NULL != pdev) | 248 | if (NULL != pdev) { |
249 | pci_dev_put(pdev); | ||
250 | return IOC4_VARIANT_IO9; | 250 | return IOC4_VARIANT_IO9; |
251 | } | ||
251 | 252 | ||
252 | /* IO10: Look for a Vitesse VSC 7174 at the same bus and slot 3. */ | 253 | /* IO10: Look for a Vitesse VSC 7174 at the same bus and slot 3. */ |
253 | pdev = NULL; | 254 | pdev = NULL; |
@@ -258,10 +259,11 @@ ioc4_variant(struct ioc4_driver_data *idd) | |||
258 | idd->idd_pdev->bus->number == pdev->bus->number && | 259 | idd->idd_pdev->bus->number == pdev->bus->number && |
259 | 3 == PCI_SLOT(pdev->devfn)) | 260 | 3 == PCI_SLOT(pdev->devfn)) |
260 | found = 1; | 261 | found = 1; |
261 | pci_dev_put(pdev); | ||
262 | } while (pdev && !found); | 262 | } while (pdev && !found); |
263 | if (NULL != pdev) | 263 | if (NULL != pdev) { |
264 | pci_dev_put(pdev); | ||
264 | return IOC4_VARIANT_IO10; | 265 | return IOC4_VARIANT_IO10; |
266 | } | ||
265 | 267 | ||
266 | /* PCI-RT: No SCSI/SATA controller will be present */ | 268 | /* PCI-RT: No SCSI/SATA controller will be present */ |
267 | return IOC4_VARIANT_PCI_RT; | 269 | return IOC4_VARIANT_PCI_RT; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index bf8890ebbc4c..e8d69b0adf90 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -366,8 +366,7 @@ config MAC89x0 | |||
366 | read the Ethernet-HOWTO, available from | 366 | read the Ethernet-HOWTO, available from |
367 | <http://www.tldp.org/docs.html#howto>. | 367 | <http://www.tldp.org/docs.html#howto>. |
368 | 368 | ||
369 | To compile this driver as a module, choose M here and read | 369 | To compile this driver as a module, choose M here. This module will |
370 | <file:Documentation/networking/net-modules.txt>. This module will | ||
371 | be called mac89x0. | 370 | be called mac89x0. |
372 | 371 | ||
373 | config MACSONIC | 372 | config MACSONIC |
@@ -380,8 +379,7 @@ config MACSONIC | |||
380 | one of these say Y and read the Ethernet-HOWTO, available from | 379 | one of these say Y and read the Ethernet-HOWTO, available from |
381 | <http://www.tldp.org/docs.html#howto>. | 380 | <http://www.tldp.org/docs.html#howto>. |
382 | 381 | ||
383 | To compile this driver as a module, choose M here and read | 382 | To compile this driver as a module, choose M here. This module will |
384 | <file:Documentation/networking/net-modules.txt>. This module will | ||
385 | be called macsonic. | 383 | be called macsonic. |
386 | 384 | ||
387 | config MACMACE | 385 | config MACMACE |
@@ -619,8 +617,7 @@ config EL1 | |||
619 | have problems. Some people suggest to ping ("man ping") a nearby | 617 | have problems. Some people suggest to ping ("man ping") a nearby |
620 | machine every minute ("man cron") when using this card. | 618 | machine every minute ("man cron") when using this card. |
621 | 619 | ||
622 | To compile this driver as a module, choose M here and read | 620 | To compile this driver as a module, choose M here. The module |
623 | <file:Documentation/networking/net-modules.txt>. The module | ||
624 | will be called 3c501. | 621 | will be called 3c501. |
625 | 622 | ||
626 | config EL2 | 623 | config EL2 |
@@ -632,8 +629,7 @@ config EL2 | |||
632 | the Ethernet-HOWTO, available from | 629 | the Ethernet-HOWTO, available from |
633 | <http://www.tldp.org/docs.html#howto>. | 630 | <http://www.tldp.org/docs.html#howto>. |
634 | 631 | ||
635 | To compile this driver as a module, choose M here and read | 632 | To compile this driver as a module, choose M here. The module |
636 | <file:Documentation/networking/net-modules.txt>. The module | ||
637 | will be called 3c503. | 633 | will be called 3c503. |
638 | 634 | ||
639 | config ELPLUS | 635 | config ELPLUS |
@@ -645,8 +641,7 @@ config ELPLUS | |||
645 | this type, say Y and read the Ethernet-HOWTO, available from | 641 | this type, say Y and read the Ethernet-HOWTO, available from |
646 | <http://www.tldp.org/docs.html#howto>. | 642 | <http://www.tldp.org/docs.html#howto>. |
647 | 643 | ||
648 | To compile this driver as a module, choose M here and read | 644 | To compile this driver as a module, choose M here. The module |
649 | <file:Documentation/networking/net-modules.txt>. The module | ||
650 | will be called 3c505. | 645 | will be called 3c505. |
651 | 646 | ||
652 | config EL16 | 647 | config EL16 |
@@ -657,8 +652,7 @@ config EL16 | |||
657 | the Ethernet-HOWTO, available from | 652 | the Ethernet-HOWTO, available from |
658 | <http://www.tldp.org/docs.html#howto>. | 653 | <http://www.tldp.org/docs.html#howto>. |
659 | 654 | ||
660 | To compile this driver as a module, choose M here and read | 655 | To compile this driver as a module, choose M here. The module |
661 | <file:Documentation/networking/net-modules.txt>. The module | ||
662 | will be called 3c507. | 656 | will be called 3c507. |
663 | 657 | ||
664 | config EL3 | 658 | config EL3 |
@@ -673,8 +667,7 @@ config EL3 | |||
673 | setup disk to disable Plug & Play mode, and to select the default | 667 | setup disk to disable Plug & Play mode, and to select the default |
674 | media type. | 668 | media type. |
675 | 669 | ||
676 | To compile this driver as a module, choose M here and read | 670 | To compile this driver as a module, choose M here. The module |
677 | <file:Documentation/networking/net-modules.txt>. The module | ||
678 | will be called 3c509. | 671 | will be called 3c509. |
679 | 672 | ||
680 | config 3C515 | 673 | config 3C515 |
@@ -685,8 +678,7 @@ config 3C515 | |||
685 | network card, say Y and read the Ethernet-HOWTO, available from | 678 | network card, say Y and read the Ethernet-HOWTO, available from |
686 | <http://www.tldp.org/docs.html#howto>. | 679 | <http://www.tldp.org/docs.html#howto>. |
687 | 680 | ||
688 | To compile this driver as a module, choose M here and read | 681 | To compile this driver as a module, choose M here. The module |
689 | <file:Documentation/networking/net-modules.txt>. The module | ||
690 | will be called 3c515. | 682 | will be called 3c515. |
691 | 683 | ||
692 | config ELMC | 684 | config ELMC |
@@ -697,8 +689,7 @@ config ELMC | |||
697 | the Ethernet-HOWTO, available from | 689 | the Ethernet-HOWTO, available from |
698 | <http://www.tldp.org/docs.html#howto>. | 690 | <http://www.tldp.org/docs.html#howto>. |
699 | 691 | ||
700 | To compile this driver as a module, choose M here and read | 692 | To compile this driver as a module, choose M here. The module |
701 | <file:Documentation/networking/net-modules.txt>. The module | ||
702 | will be called 3c523. | 693 | will be called 3c523. |
703 | 694 | ||
704 | config ELMC_II | 695 | config ELMC_II |
@@ -709,8 +700,7 @@ config ELMC_II | |||
709 | the Ethernet-HOWTO, available from | 700 | the Ethernet-HOWTO, available from |
710 | <http://www.tldp.org/docs.html#howto>. | 701 | <http://www.tldp.org/docs.html#howto>. |
711 | 702 | ||
712 | To compile this driver as a module, choose M here and read | 703 | To compile this driver as a module, choose M here. The module |
713 | <file:Documentation/networking/net-modules.txt>. The module | ||
714 | will be called 3c527. | 704 | will be called 3c527. |
715 | 705 | ||
716 | config VORTEX | 706 | config VORTEX |
@@ -733,8 +723,7 @@ config VORTEX | |||
733 | <file:Documentation/networking/vortex.txt> and in the comments at | 723 | <file:Documentation/networking/vortex.txt> and in the comments at |
734 | the beginning of <file:drivers/net/3c59x.c>. | 724 | the beginning of <file:drivers/net/3c59x.c>. |
735 | 725 | ||
736 | To compile this support as a module, choose M here and read | 726 | To compile this support as a module, choose M here. |
737 | <file:Documentation/networking/net-modules.txt>. | ||
738 | 727 | ||
739 | config TYPHOON | 728 | config TYPHOON |
740 | tristate "3cr990 series \"Typhoon\" support" | 729 | tristate "3cr990 series \"Typhoon\" support" |
@@ -751,8 +740,7 @@ config TYPHOON | |||
751 | the Ethernet-HOWTO, available from | 740 | the Ethernet-HOWTO, available from |
752 | <http://www.tldp.org/docs.html#howto>. | 741 | <http://www.tldp.org/docs.html#howto>. |
753 | 742 | ||
754 | To compile this driver as a module, choose M here and read | 743 | To compile this driver as a module, choose M here. The module |
755 | <file:Documentation/networking/net-modules.txt>. The module | ||
756 | will be called typhoon. | 744 | will be called typhoon. |
757 | 745 | ||
758 | config LANCE | 746 | config LANCE |
@@ -789,8 +777,7 @@ config WD80x3 | |||
789 | the Ethernet-HOWTO, available from | 777 | the Ethernet-HOWTO, available from |
790 | <http://www.tldp.org/docs.html#howto>. | 778 | <http://www.tldp.org/docs.html#howto>. |
791 | 779 | ||
792 | To compile this driver as a module, choose M here and read | 780 | To compile this driver as a module, choose M here. The module |
793 | <file:Documentation/networking/net-modules.txt>. The module | ||
794 | will be called wd. | 781 | will be called wd. |
795 | 782 | ||
796 | config ULTRAMCA | 783 | config ULTRAMCA |
@@ -802,8 +789,7 @@ config ULTRAMCA | |||
802 | an MCA based system (PS/2), say Y and read the Ethernet-HOWTO, | 789 | an MCA based system (PS/2), say Y and read the Ethernet-HOWTO, |
803 | available from <http://www.tldp.org/docs.html#howto>. | 790 | available from <http://www.tldp.org/docs.html#howto>. |
804 | 791 | ||
805 | To compile this driver as a module, choose M here and read | 792 | To compile this driver as a module, choose M here. The module |
806 | <file:Documentation/networking/net-modules.txt>. The module | ||
807 | will be called smc-mca. | 793 | will be called smc-mca. |
808 | 794 | ||
809 | config ULTRA | 795 | config ULTRA |
@@ -822,8 +808,7 @@ config ULTRA | |||
822 | this but keep it in mind if you have such a SCSI card and have | 808 | this but keep it in mind if you have such a SCSI card and have |
823 | problems. | 809 | problems. |
824 | 810 | ||
825 | To compile this driver as a module, choose M here and read | 811 | To compile this driver as a module, choose M here. The module |
826 | <file:Documentation/networking/net-modules.txt>. The module | ||
827 | will be called smc-ultra. | 812 | will be called smc-ultra. |
828 | 813 | ||
829 | config ULTRA32 | 814 | config ULTRA32 |
@@ -835,8 +820,7 @@ config ULTRA32 | |||
835 | the Ethernet-HOWTO, available from | 820 | the Ethernet-HOWTO, available from |
836 | <http://www.tldp.org/docs.html#howto>. | 821 | <http://www.tldp.org/docs.html#howto>. |
837 | 822 | ||
838 | To compile this driver as a module, choose M here and read | 823 | To compile this driver as a module, choose M here. The module |
839 | <file:Documentation/networking/net-modules.txt>. The module | ||
840 | will be called smc-ultra32. | 824 | will be called smc-ultra32. |
841 | 825 | ||
842 | config BFIN_MAC | 826 | config BFIN_MAC |
@@ -897,8 +881,7 @@ config SMC9194 | |||
897 | <file:Documentation/networking/smc9.txt> and the Ethernet-HOWTO, | 881 | <file:Documentation/networking/smc9.txt> and the Ethernet-HOWTO, |
898 | available from <http://www.tldp.org/docs.html#howto>. | 882 | available from <http://www.tldp.org/docs.html#howto>. |
899 | 883 | ||
900 | To compile this driver as a module, choose M here and read | 884 | To compile this driver as a module, choose M here. The module |
901 | <file:Documentation/networking/net-modules.txt>. The module | ||
902 | will be called smc9194. | 885 | will be called smc9194. |
903 | 886 | ||
904 | config SMC91X | 887 | config SMC91X |
@@ -916,8 +899,7 @@ config SMC91X | |||
916 | This driver is also available as a module ( = code which can be | 899 | This driver is also available as a module ( = code which can be |
917 | inserted in and removed from the running kernel whenever you want). | 900 | inserted in and removed from the running kernel whenever you want). |
918 | The module will be called smc91x. If you want to compile it as a | 901 | The module will be called smc91x. If you want to compile it as a |
919 | module, say M here and read <file:Documentation/kbuild/modules.txt> | 902 | module, say M here and read <file:Documentation/kbuild/modules.txt>. |
920 | as well as <file:Documentation/networking/net-modules.txt>. | ||
921 | 903 | ||
922 | config NET_NETX | 904 | config NET_NETX |
923 | tristate "NetX Ethernet support" | 905 | tristate "NetX Ethernet support" |
@@ -926,8 +908,7 @@ config NET_NETX | |||
926 | help | 908 | help |
927 | This is support for the Hilscher netX builtin Ethernet ports | 909 | This is support for the Hilscher netX builtin Ethernet ports |
928 | 910 | ||
929 | To compile this driver as a module, choose M here and read | 911 | To compile this driver as a module, choose M here. The module |
930 | <file:Documentation/networking/net-modules.txt>. The module | ||
931 | will be called netx-eth. | 912 | will be called netx-eth. |
932 | 913 | ||
933 | config DM9000 | 914 | config DM9000 |
@@ -938,9 +919,8 @@ config DM9000 | |||
938 | ---help--- | 919 | ---help--- |
939 | Support for DM9000 chipset. | 920 | Support for DM9000 chipset. |
940 | 921 | ||
941 | To compile this driver as a module, choose M here and read | 922 | To compile this driver as a module, choose M here. The module |
942 | <file:Documentation/networking/net-modules.txt>. The module will be | 923 | will be called dm9000. |
943 | called dm9000. | ||
944 | 924 | ||
945 | config SMC911X | 925 | config SMC911X |
946 | tristate "SMSC LAN911[5678] support" | 926 | tristate "SMSC LAN911[5678] support" |
@@ -980,8 +960,7 @@ config NI5010 | |||
980 | <http://www.tldp.org/docs.html#howto>. Note that this is still | 960 | <http://www.tldp.org/docs.html#howto>. Note that this is still |
981 | experimental code. | 961 | experimental code. |
982 | 962 | ||
983 | To compile this driver as a module, choose M here and read | 963 | To compile this driver as a module, choose M here. The module |
984 | <file:Documentation/networking/net-modules.txt>. The module | ||
985 | will be called ni5010. | 964 | will be called ni5010. |
986 | 965 | ||
987 | config NI52 | 966 | config NI52 |
@@ -992,8 +971,7 @@ config NI52 | |||
992 | the Ethernet-HOWTO, available from | 971 | the Ethernet-HOWTO, available from |
993 | <http://www.tldp.org/docs.html#howto>. | 972 | <http://www.tldp.org/docs.html#howto>. |
994 | 973 | ||
995 | To compile this driver as a module, choose M here and read | 974 | To compile this driver as a module, choose M here. The module |
996 | <file:Documentation/networking/net-modules.txt>. The module | ||
997 | will be called ni52. | 975 | will be called ni52. |
998 | 976 | ||
999 | config NI65 | 977 | config NI65 |
@@ -1004,8 +982,7 @@ config NI65 | |||
1004 | the Ethernet-HOWTO, available from | 982 | the Ethernet-HOWTO, available from |
1005 | <http://www.tldp.org/docs.html#howto>. | 983 | <http://www.tldp.org/docs.html#howto>. |
1006 | 984 | ||
1007 | To compile this driver as a module, choose M here and read | 985 | To compile this driver as a module, choose M here. The module |
1008 | <file:Documentation/networking/net-modules.txt>. The module | ||
1009 | will be called ni65. | 986 | will be called ni65. |
1010 | 987 | ||
1011 | source "drivers/net/tulip/Kconfig" | 988 | source "drivers/net/tulip/Kconfig" |
@@ -1019,8 +996,7 @@ config AT1700 | |||
1019 | the Ethernet-HOWTO, available from | 996 | the Ethernet-HOWTO, available from |
1020 | <http://www.tldp.org/docs.html#howto>. | 997 | <http://www.tldp.org/docs.html#howto>. |
1021 | 998 | ||
1022 | To compile this driver as a module, choose M here and read | 999 | To compile this driver as a module, choose M here. The module |
1023 | <file:Documentation/networking/net-modules.txt>. The module | ||
1024 | will be called at1700. | 1000 | will be called at1700. |
1025 | 1001 | ||
1026 | config DEPCA | 1002 | config DEPCA |
@@ -1033,8 +1009,7 @@ config DEPCA | |||
1033 | <http://www.tldp.org/docs.html#howto> as well as | 1009 | <http://www.tldp.org/docs.html#howto> as well as |
1034 | <file:drivers/net/depca.c>. | 1010 | <file:drivers/net/depca.c>. |
1035 | 1011 | ||
1036 | To compile this driver as a module, choose M here and read | 1012 | To compile this driver as a module, choose M here. The module |
1037 | <file:Documentation/networking/net-modules.txt>. The module | ||
1038 | will be called depca. | 1013 | will be called depca. |
1039 | 1014 | ||
1040 | config HP100 | 1015 | config HP100 |
@@ -1045,8 +1020,7 @@ config HP100 | |||
1045 | the Ethernet-HOWTO, available from | 1020 | the Ethernet-HOWTO, available from |
1046 | <http://www.tldp.org/docs.html#howto>. | 1021 | <http://www.tldp.org/docs.html#howto>. |
1047 | 1022 | ||
1048 | To compile this driver as a module, choose M here and read | 1023 | To compile this driver as a module, choose M here. The module |
1049 | <file:Documentation/networking/net-modules.txt>. The module | ||
1050 | will be called hp100. | 1024 | will be called hp100. |
1051 | 1025 | ||
1052 | config NET_ISA | 1026 | config NET_ISA |
@@ -1075,8 +1049,7 @@ config E2100 | |||
1075 | the Ethernet-HOWTO, available from | 1049 | the Ethernet-HOWTO, available from |
1076 | <http://www.tldp.org/docs.html#howto>. | 1050 | <http://www.tldp.org/docs.html#howto>. |
1077 | 1051 | ||
1078 | To compile this driver as a module, choose M here and read | 1052 | To compile this driver as a module, choose M here. The module |
1079 | <file:Documentation/networking/net-modules.txt>. The module | ||
1080 | will be called e2100. | 1053 | will be called e2100. |
1081 | 1054 | ||
1082 | config EWRK3 | 1055 | config EWRK3 |
@@ -1090,8 +1063,7 @@ config EWRK3 | |||
1090 | well as the Ethernet-HOWTO, available from | 1063 | well as the Ethernet-HOWTO, available from |
1091 | <http://www.tldp.org/docs.html#howto>. | 1064 | <http://www.tldp.org/docs.html#howto>. |
1092 | 1065 | ||
1093 | To compile this driver as a module, choose M here and read | 1066 | To compile this driver as a module, choose M here. The module |
1094 | <file:Documentation/networking/net-modules.txt>. The module | ||
1095 | will be called ewrk3. | 1067 | will be called ewrk3. |
1096 | 1068 | ||
1097 | config EEXPRESS | 1069 | config EEXPRESS |
@@ -1105,8 +1077,7 @@ config EEXPRESS | |||
1105 | because the driver was very unreliable. We now have a new driver | 1077 | because the driver was very unreliable. We now have a new driver |
1106 | that should do better. | 1078 | that should do better. |
1107 | 1079 | ||
1108 | To compile this driver as a module, choose M here and read | 1080 | To compile this driver as a module, choose M here. The module |
1109 | <file:Documentation/networking/net-modules.txt>. The module | ||
1110 | will be called eexpress. | 1081 | will be called eexpress. |
1111 | 1082 | ||
1112 | config EEXPRESS_PRO | 1083 | config EEXPRESS_PRO |
@@ -1119,8 +1090,7 @@ config EEXPRESS_PRO | |||
1119 | driver. Please read the Ethernet-HOWTO, available from | 1090 | driver. Please read the Ethernet-HOWTO, available from |
1120 | <http://www.tldp.org/docs.html#howto>. | 1091 | <http://www.tldp.org/docs.html#howto>. |
1121 | 1092 | ||
1122 | To compile this driver as a module, choose M here and read | 1093 | To compile this driver as a module, choose M here. The module |
1123 | <file:Documentation/networking/net-modules.txt>. The module | ||
1124 | will be called eepro. | 1094 | will be called eepro. |
1125 | 1095 | ||
1126 | config HPLAN_PLUS | 1096 | config HPLAN_PLUS |
@@ -1132,8 +1102,7 @@ config HPLAN_PLUS | |||
1132 | the Ethernet-HOWTO, available from | 1102 | the Ethernet-HOWTO, available from |
1133 | <http://www.tldp.org/docs.html#howto>. | 1103 | <http://www.tldp.org/docs.html#howto>. |
1134 | 1104 | ||
1135 | To compile this driver as a module, choose M here and read | 1105 | To compile this driver as a module, choose M here. The module |
1136 | <file:Documentation/networking/net-modules.txt>. The module | ||
1137 | will be called hp-plus. | 1106 | will be called hp-plus. |
1138 | 1107 | ||
1139 | config HPLAN | 1108 | config HPLAN |
@@ -1145,8 +1114,7 @@ config HPLAN | |||
1145 | the Ethernet-HOWTO, available from | 1114 | the Ethernet-HOWTO, available from |
1146 | <http://www.tldp.org/docs.html#howto>. | 1115 | <http://www.tldp.org/docs.html#howto>. |
1147 | 1116 | ||
1148 | To compile this driver as a module, choose M here and read | 1117 | To compile this driver as a module, choose M here. The module |
1149 | <file:Documentation/networking/net-modules.txt>. The module | ||
1150 | will be called hp. | 1118 | will be called hp. |
1151 | 1119 | ||
1152 | config LP486E | 1120 | config LP486E |
@@ -1165,8 +1133,7 @@ config ETH16I | |||
1165 | the Ethernet-HOWTO, available from | 1133 | the Ethernet-HOWTO, available from |
1166 | <http://www.tldp.org/docs.html#howto>. | 1134 | <http://www.tldp.org/docs.html#howto>. |
1167 | 1135 | ||
1168 | To compile this driver as a module, choose M here and read | 1136 | To compile this driver as a module, choose M here. The module |
1169 | <file:Documentation/networking/net-modules.txt>. The module | ||
1170 | will be called eth16i. | 1137 | will be called eth16i. |
1171 | 1138 | ||
1172 | config NE2000 | 1139 | config NE2000 |
@@ -1186,8 +1153,7 @@ config NE2000 | |||
1186 | laptops), say N here and Y to "NE/2 (ne2000 MCA version) support", | 1153 | laptops), say N here and Y to "NE/2 (ne2000 MCA version) support", |
1187 | below. | 1154 | below. |
1188 | 1155 | ||
1189 | To compile this driver as a module, choose M here and read | 1156 | To compile this driver as a module, choose M here. The module |
1190 | <file:Documentation/networking/net-modules.txt>. The module | ||
1191 | will be called ne. | 1157 | will be called ne. |
1192 | 1158 | ||
1193 | config ZNET | 1159 | config ZNET |
@@ -1208,8 +1174,7 @@ config SEEQ8005 | |||
1208 | is for you, read the Ethernet-HOWTO, available from | 1174 | is for you, read the Ethernet-HOWTO, available from |
1209 | <http://www.tldp.org/docs.html#howto>. | 1175 | <http://www.tldp.org/docs.html#howto>. |
1210 | 1176 | ||
1211 | To compile this driver as a module, choose M here and read | 1177 | To compile this driver as a module, choose M here. The module |
1212 | <file:Documentation/networking/net-modules.txt>. The module | ||
1213 | will be called seeq8005. | 1178 | will be called seeq8005. |
1214 | 1179 | ||
1215 | config NE2_MCA | 1180 | config NE2_MCA |
@@ -1221,8 +1186,7 @@ config NE2_MCA | |||
1221 | the Ethernet-HOWTO, available from | 1186 | the Ethernet-HOWTO, available from |
1222 | <http://www.tldp.org/docs.html#howto>. | 1187 | <http://www.tldp.org/docs.html#howto>. |
1223 | 1188 | ||
1224 | To compile this driver as a module, choose M here and read | 1189 | To compile this driver as a module, choose M here. The module |
1225 | <file:Documentation/networking/net-modules.txt>. The module | ||
1226 | will be called ne2. | 1190 | will be called ne2. |
1227 | 1191 | ||
1228 | config IBMLANA | 1192 | config IBMLANA |
@@ -1233,8 +1197,7 @@ config IBMLANA | |||
1233 | CONFIG_MCA to use this driver. It is both available as an in-kernel | 1197 | CONFIG_MCA to use this driver. It is both available as an in-kernel |
1234 | driver and as a module. | 1198 | driver and as a module. |
1235 | 1199 | ||
1236 | To compile this driver as a module, choose M here and read | 1200 | To compile this driver as a module, choose M here. The only |
1237 | <file:Documentation/networking/net-modules.txt>. The only | ||
1238 | currently supported card is the IBM LAN Adapter/A for Ethernet. It | 1201 | currently supported card is the IBM LAN Adapter/A for Ethernet. It |
1239 | will both support 16K and 32K memory windows, however a 32K window | 1202 | will both support 16K and 32K memory windows, however a 32K window |
1240 | gives a better security against packet losses. Usage of multiple | 1203 | gives a better security against packet losses. Usage of multiple |
@@ -1248,8 +1211,7 @@ config IBMVETH | |||
1248 | This driver supports virtual ethernet adapters on newer IBM iSeries | 1211 | This driver supports virtual ethernet adapters on newer IBM iSeries |
1249 | and pSeries systems. | 1212 | and pSeries systems. |
1250 | 1213 | ||
1251 | To compile this driver as a module, choose M here and read | 1214 | To compile this driver as a module, choose M here. The module will |
1252 | <file:Documentation/networking/net-modules.txt>. The module will | ||
1253 | be called ibmveth. | 1215 | be called ibmveth. |
1254 | 1216 | ||
1255 | source "drivers/net/ibm_emac/Kconfig" | 1217 | source "drivers/net/ibm_emac/Kconfig" |
@@ -1279,8 +1241,7 @@ config PCNET32 | |||
1279 | answer Y here and read the Ethernet-HOWTO, available from | 1241 | answer Y here and read the Ethernet-HOWTO, available from |
1280 | <http://www.tldp.org/docs.html#howto>. | 1242 | <http://www.tldp.org/docs.html#howto>. |
1281 | 1243 | ||
1282 | To compile this driver as a module, choose M here and read | 1244 | To compile this driver as a module, choose M here. The module |
1283 | <file:Documentation/networking/net-modules.txt>. The module | ||
1284 | will be called pcnet32. | 1245 | will be called pcnet32. |
1285 | 1246 | ||
1286 | config PCNET32_NAPI | 1247 | config PCNET32_NAPI |
@@ -1307,8 +1268,7 @@ config AMD8111_ETH | |||
1307 | answer Y here and read the Ethernet-HOWTO, available from | 1268 | answer Y here and read the Ethernet-HOWTO, available from |
1308 | <http://www.tldp.org/docs.html#howto>. | 1269 | <http://www.tldp.org/docs.html#howto>. |
1309 | 1270 | ||
1310 | To compile this driver as a module, choose M here and read | 1271 | To compile this driver as a module, choose M here. The module |
1311 | <file:Documentation/networking/net-modules.txt>. The module | ||
1312 | will be called amd8111e. | 1272 | will be called amd8111e. |
1313 | 1273 | ||
1314 | config AMD8111E_NAPI | 1274 | config AMD8111E_NAPI |
@@ -1362,8 +1322,7 @@ config AC3200 | |||
1362 | the Ethernet-HOWTO, available from | 1322 | the Ethernet-HOWTO, available from |
1363 | <http://www.tldp.org/docs.html#howto>. | 1323 | <http://www.tldp.org/docs.html#howto>. |
1364 | 1324 | ||
1365 | To compile this driver as a module, choose M here and read | 1325 | To compile this driver as a module, choose M here. The module |
1366 | <file:Documentation/networking/net-modules.txt>. The module | ||
1367 | will be called ac3200. | 1326 | will be called ac3200. |
1368 | 1327 | ||
1369 | config APRICOT | 1328 | config APRICOT |
@@ -1374,9 +1333,8 @@ config APRICOT | |||
1374 | read the Ethernet-HOWTO, available from | 1333 | read the Ethernet-HOWTO, available from |
1375 | <http://www.tldp.org/docs.html#howto>. | 1334 | <http://www.tldp.org/docs.html#howto>. |
1376 | 1335 | ||
1377 | To compile this driver as a module, choose M here and read | 1336 | To compile this driver as a module, choose M here. The module |
1378 | <file:Documentation/networking/net-modules.txt>. The module will be | 1337 | will be called apricot. |
1379 | called apricot. | ||
1380 | 1338 | ||
1381 | config B44 | 1339 | config B44 |
1382 | tristate "Broadcom 440x/47xx ethernet support" | 1340 | tristate "Broadcom 440x/47xx ethernet support" |
@@ -1388,9 +1346,8 @@ config B44 | |||
1388 | or M and read the Ethernet-HOWTO, available from | 1346 | or M and read the Ethernet-HOWTO, available from |
1389 | <http://www.tldp.org/docs.html#howto>. | 1347 | <http://www.tldp.org/docs.html#howto>. |
1390 | 1348 | ||
1391 | To compile this driver as a module, choose M here and read | 1349 | To compile this driver as a module, choose M here. The module |
1392 | <file:Documentation/networking/net-modules.txt>. The module will be | 1350 | will be called b44. |
1393 | called b44. | ||
1394 | 1351 | ||
1395 | # Auto-select SSB PCI-HOST support, if possible | 1352 | # Auto-select SSB PCI-HOST support, if possible |
1396 | config B44_PCI_AUTOSELECT | 1353 | config B44_PCI_AUTOSELECT |
@@ -1419,9 +1376,8 @@ config FORCEDETH | |||
1419 | read the Ethernet-HOWTO, available from | 1376 | read the Ethernet-HOWTO, available from |
1420 | <http://www.tldp.org/docs.html#howto>. | 1377 | <http://www.tldp.org/docs.html#howto>. |
1421 | 1378 | ||
1422 | To compile this driver as a module, choose M here and read | 1379 | To compile this driver as a module, choose M here. The module |
1423 | <file:Documentation/networking/net-modules.txt>. The module will be | 1380 | will be called forcedeth. |
1424 | called forcedeth. | ||
1425 | 1381 | ||
1426 | config FORCEDETH_NAPI | 1382 | config FORCEDETH_NAPI |
1427 | bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" | 1383 | bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" |
@@ -1447,9 +1403,8 @@ config CS89x0 | |||
1447 | <http://www.tldp.org/docs.html#howto> as well as | 1403 | <http://www.tldp.org/docs.html#howto> as well as |
1448 | <file:Documentation/networking/cs89x0.txt>. | 1404 | <file:Documentation/networking/cs89x0.txt>. |
1449 | 1405 | ||
1450 | To compile this driver as a module, choose M here and read | 1406 | To compile this driver as a module, choose M here. The module |
1451 | <file:Documentation/networking/net-modules.txt>. The module will be | 1407 | will be called cs89x0. |
1452 | called cs89x0. | ||
1453 | 1408 | ||
1454 | config TC35815 | 1409 | config TC35815 |
1455 | tristate "TOSHIBA TC35815 Ethernet support" | 1410 | tristate "TOSHIBA TC35815 Ethernet support" |
@@ -1465,8 +1420,7 @@ config EEPRO100 | |||
1465 | card, say Y and read the Ethernet-HOWTO, available from | 1420 | card, say Y and read the Ethernet-HOWTO, available from |
1466 | <http://www.tldp.org/docs.html#howto>. | 1421 | <http://www.tldp.org/docs.html#howto>. |
1467 | 1422 | ||
1468 | To compile this driver as a module, choose M here and read | 1423 | To compile this driver as a module, choose M here. The module |
1469 | <file:Documentation/networking/net-modules.txt>. The module | ||
1470 | will be called eepro100. | 1424 | will be called eepro100. |
1471 | 1425 | ||
1472 | 1426 | ||
@@ -1493,8 +1447,7 @@ config E100 | |||
1493 | More specific information on configuring the driver is in | 1447 | More specific information on configuring the driver is in |
1494 | <file:Documentation/networking/e100.txt>. | 1448 | <file:Documentation/networking/e100.txt>. |
1495 | 1449 | ||
1496 | To compile this driver as a module, choose M here and read | 1450 | To compile this driver as a module, choose M here. The module |
1497 | <file:Documentation/networking/net-modules.txt>. The module | ||
1498 | will be called e100. | 1451 | will be called e100. |
1499 | 1452 | ||
1500 | config LNE390 | 1453 | config LNE390 |
@@ -1506,8 +1459,7 @@ config LNE390 | |||
1506 | the Ethernet-HOWTO, available from | 1459 | the Ethernet-HOWTO, available from |
1507 | <http://www.tldp.org/docs.html#howto>. | 1460 | <http://www.tldp.org/docs.html#howto>. |
1508 | 1461 | ||
1509 | To compile this driver as a module, choose M here and read | 1462 | To compile this driver as a module, choose M here. The module |
1510 | <file:Documentation/networking/net-modules.txt>. The module | ||
1511 | will be called lne390. | 1463 | will be called lne390. |
1512 | 1464 | ||
1513 | config FEALNX | 1465 | config FEALNX |
@@ -1547,8 +1499,7 @@ config NE2K_PCI | |||
1547 | NetVin NV5000SC Via 86C926 SureCom NE34 Winbond | 1499 | NetVin NV5000SC Via 86C926 SureCom NE34 Winbond |
1548 | Holtek HT80232 Holtek HT80229 | 1500 | Holtek HT80232 Holtek HT80229 |
1549 | 1501 | ||
1550 | To compile this driver as a module, choose M here and read | 1502 | To compile this driver as a module, choose M here. The module |
1551 | <file:Documentation/networking/net-modules.txt>. The module | ||
1552 | will be called ne2k-pci. | 1503 | will be called ne2k-pci. |
1553 | 1504 | ||
1554 | config NE3210 | 1505 | config NE3210 |
@@ -1561,8 +1512,7 @@ config NE3210 | |||
1561 | <http://www.tldp.org/docs.html#howto>. Note that this driver | 1512 | <http://www.tldp.org/docs.html#howto>. Note that this driver |
1562 | will NOT WORK for NE3200 cards as they are completely different. | 1513 | will NOT WORK for NE3200 cards as they are completely different. |
1563 | 1514 | ||
1564 | To compile this driver as a module, choose M here and read | 1515 | To compile this driver as a module, choose M here. The module |
1565 | <file:Documentation/networking/net-modules.txt>. The module | ||
1566 | will be called ne3210. | 1516 | will be called ne3210. |
1567 | 1517 | ||
1568 | config ES3210 | 1518 | config ES3210 |
@@ -1574,8 +1524,7 @@ config ES3210 | |||
1574 | the Ethernet-HOWTO, available from | 1524 | the Ethernet-HOWTO, available from |
1575 | <http://www.tldp.org/docs.html#howto>. | 1525 | <http://www.tldp.org/docs.html#howto>. |
1576 | 1526 | ||
1577 | To compile this driver as a module, choose M here and read | 1527 | To compile this driver as a module, choose M here. The module |
1578 | <file:Documentation/networking/net-modules.txt>. The module | ||
1579 | will be called es3210. | 1528 | will be called es3210. |
1580 | 1529 | ||
1581 | config 8139CP | 1530 | config 8139CP |
@@ -1705,8 +1654,7 @@ config TLAN | |||
1705 | Compaq NetFlex and Olicom cards. Please read the file | 1654 | Compaq NetFlex and Olicom cards. Please read the file |
1706 | <file:Documentation/networking/tlan.txt> for more details. | 1655 | <file:Documentation/networking/tlan.txt> for more details. |
1707 | 1656 | ||
1708 | To compile this driver as a module, choose M here and read | 1657 | To compile this driver as a module, choose M here. The module |
1709 | <file:Documentation/networking/net-modules.txt>. The module | ||
1710 | will be called tlan. | 1658 | will be called tlan. |
1711 | 1659 | ||
1712 | Please email feedback to <torben.mathiasen@compaq.com>. | 1660 | Please email feedback to <torben.mathiasen@compaq.com>. |
@@ -1996,8 +1944,7 @@ config E1000 | |||
1996 | More specific information on configuring the driver is in | 1944 | More specific information on configuring the driver is in |
1997 | <file:Documentation/networking/e1000.txt>. | 1945 | <file:Documentation/networking/e1000.txt>. |
1998 | 1946 | ||
1999 | To compile this driver as a module, choose M here and read | 1947 | To compile this driver as a module, choose M here. The module |
2000 | <file:Documentation/networking/net-modules.txt>. The module | ||
2001 | will be called e1000. | 1948 | will be called e1000. |
2002 | 1949 | ||
2003 | config E1000_NAPI | 1950 | config E1000_NAPI |
@@ -2042,8 +1989,7 @@ config E1000E | |||
2042 | More specific information on configuring the driver is in | 1989 | More specific information on configuring the driver is in |
2043 | <file:Documentation/networking/e1000e.txt>. | 1990 | <file:Documentation/networking/e1000e.txt>. |
2044 | 1991 | ||
2045 | To compile this driver as a module, choose M here and read | 1992 | To compile this driver as a module, choose M here. The module |
2046 | <file:Documentation/networking/net-modules.txt>. The module | ||
2047 | will be called e1000e. | 1993 | will be called e1000e. |
2048 | 1994 | ||
2049 | source "drivers/net/ixp2000/Kconfig" | 1995 | source "drivers/net/ixp2000/Kconfig" |
@@ -2076,8 +2022,7 @@ config HAMACHI | |||
2076 | the Ethernet-HOWTO, available from | 2022 | the Ethernet-HOWTO, available from |
2077 | <http://www.tldp.org/docs.html#howto>. | 2023 | <http://www.tldp.org/docs.html#howto>. |
2078 | 2024 | ||
2079 | To compile this driver as a module, choose M here and read | 2025 | To compile this driver as a module, choose M here. The module will be |
2080 | <file:Documentation/networking/net-modules.txt>. The module will be | ||
2081 | called hamachi. | 2026 | called hamachi. |
2082 | 2027 | ||
2083 | config YELLOWFIN | 2028 | config YELLOWFIN |
@@ -2526,8 +2471,7 @@ config IXGBE | |||
2526 | More specific information on configuring the driver is in | 2471 | More specific information on configuring the driver is in |
2527 | <file:Documentation/networking/ixgbe.txt>. | 2472 | <file:Documentation/networking/ixgbe.txt>. |
2528 | 2473 | ||
2529 | To compile this driver as a module, choose M here and read | 2474 | To compile this driver as a module, choose M here. The module |
2530 | <file:Documentation/networking/net-modules.txt>. The module | ||
2531 | will be called ixgbe. | 2475 | will be called ixgbe. |
2532 | 2476 | ||
2533 | config IXGB | 2477 | config IXGB |
@@ -2549,8 +2493,7 @@ config IXGB | |||
2549 | More specific information on configuring the driver is in | 2493 | More specific information on configuring the driver is in |
2550 | <file:Documentation/networking/ixgb.txt>. | 2494 | <file:Documentation/networking/ixgb.txt>. |
2551 | 2495 | ||
2552 | To compile this driver as a module, choose M here and read | 2496 | To compile this driver as a module, choose M here. The module |
2553 | <file:Documentation/networking/net-modules.txt>. The module | ||
2554 | will be called ixgb. | 2497 | will be called ixgb. |
2555 | 2498 | ||
2556 | config IXGB_NAPI | 2499 | config IXGB_NAPI |
@@ -2603,8 +2546,7 @@ config MYRI10GE | |||
2603 | 2546 | ||
2604 | <http://www.myri.com/scs/download-Myri10GE.html> | 2547 | <http://www.myri.com/scs/download-Myri10GE.html> |
2605 | 2548 | ||
2606 | To compile this driver as a module, choose M here and read | 2549 | To compile this driver as a module, choose M here. The module |
2607 | <file:Documentation/networking/net-modules.txt>. The module | ||
2608 | will be called myri10ge. | 2550 | will be called myri10ge. |
2609 | 2551 | ||
2610 | config NETXEN_NIC | 2552 | config NETXEN_NIC |
@@ -2828,10 +2770,9 @@ config PLIP | |||
2828 | with the PLIP support in Linux versions 1.0.x. This option enlarges | 2770 | with the PLIP support in Linux versions 1.0.x. This option enlarges |
2829 | your kernel by about 8 KB. | 2771 | your kernel by about 8 KB. |
2830 | 2772 | ||
2831 | To compile this driver as a module, choose M here and read | 2773 | To compile this driver as a module, choose M here. The module |
2832 | <file:Documentation/networking/net-modules.txt>. The module will be | 2774 | will be called plip. If unsure, say Y or M, in case you buy |
2833 | called plip. If unsure, say Y or M, in case you buy a laptop | 2775 | a laptop later. |
2834 | later. | ||
2835 | 2776 | ||
2836 | config PPP | 2777 | config PPP |
2837 | tristate "PPP (point-to-point protocol) support" | 2778 | tristate "PPP (point-to-point protocol) support" |
@@ -2861,8 +2802,7 @@ config PPP | |||
2861 | If you said Y to "Version information on all symbols" above, then | 2802 | If you said Y to "Version information on all symbols" above, then |
2862 | you cannot compile the PPP driver into the kernel; you can then only | 2803 | you cannot compile the PPP driver into the kernel; you can then only |
2863 | compile it as a module. To compile this driver as a module, choose M | 2804 | compile it as a module. To compile this driver as a module, choose M |
2864 | here and read <file:Documentation/networking/net-modules.txt>. | 2805 | here. The module will be called ppp_generic. |
2865 | The module will be called ppp_generic. | ||
2866 | 2806 | ||
2867 | config PPP_MULTILINK | 2807 | config PPP_MULTILINK |
2868 | bool "PPP multilink support (EXPERIMENTAL)" | 2808 | bool "PPP multilink support (EXPERIMENTAL)" |
@@ -3023,9 +2963,8 @@ config SLIP | |||
3023 | <http://www.bart.nl/~patrickr/term-howto/Term-HOWTO.html>). SLIP | 2963 | <http://www.bart.nl/~patrickr/term-howto/Term-HOWTO.html>). SLIP |
3024 | support will enlarge your kernel by about 4 KB. If unsure, say N. | 2964 | support will enlarge your kernel by about 4 KB. If unsure, say N. |
3025 | 2965 | ||
3026 | To compile this driver as a module, choose M here and read | 2966 | To compile this driver as a module, choose M here. The module |
3027 | <file:Documentation/networking/net-modules.txt>. The module will be | 2967 | will be called slip. |
3028 | called slip. | ||
3029 | 2968 | ||
3030 | config SLIP_COMPRESSED | 2969 | config SLIP_COMPRESSED |
3031 | bool "CSLIP compressed headers" | 2970 | bool "CSLIP compressed headers" |
diff --git a/drivers/net/arcnet/Kconfig b/drivers/net/arcnet/Kconfig index 4030274fe788..3b2f7f115464 100644 --- a/drivers/net/arcnet/Kconfig +++ b/drivers/net/arcnet/Kconfig | |||
@@ -19,8 +19,7 @@ menuconfig ARCNET | |||
19 | from <http://www.tldp.org/docs.html#howto>(even though ARCnet | 19 | from <http://www.tldp.org/docs.html#howto>(even though ARCnet |
20 | is not really Ethernet). | 20 | is not really Ethernet). |
21 | 21 | ||
22 | To compile this driver as a module, choose M here and read | 22 | To compile this driver as a module, choose M here. The module will |
23 | <file:Documentation/networking/net-modules.txt>. The module will | ||
24 | be called arcnet. | 23 | be called arcnet. |
25 | 24 | ||
26 | if ARCNET | 25 | if ARCNET |
@@ -81,8 +80,7 @@ config ARCNET_COM90xx | |||
81 | have always used the old ARCnet driver without knowing what type of | 80 | have always used the old ARCnet driver without knowing what type of |
82 | card you had, this is probably the one for you. | 81 | card you had, this is probably the one for you. |
83 | 82 | ||
84 | To compile this driver as a module, choose M here and read | 83 | To compile this driver as a module, choose M here. The module will |
85 | <file:Documentation/networking/net-modules.txt>. The module will | ||
86 | be called com90xx. | 84 | be called com90xx. |
87 | 85 | ||
88 | config ARCNET_COM90xxIO | 86 | config ARCNET_COM90xxIO |
@@ -93,8 +91,7 @@ config ARCNET_COM90xxIO | |||
93 | the normal driver. Only use it if your card doesn't support shared | 91 | the normal driver. Only use it if your card doesn't support shared |
94 | memory. | 92 | memory. |
95 | 93 | ||
96 | To compile this driver as a module, choose M here and read | 94 | To compile this driver as a module, choose M here. The module will |
97 | <file:Documentation/networking/net-modules.txt>. The module will | ||
98 | be called com90io. | 95 | be called com90io. |
99 | 96 | ||
100 | config ARCNET_RIM_I | 97 | config ARCNET_RIM_I |
@@ -105,8 +102,7 @@ config ARCNET_RIM_I | |||
105 | driver is completely untested, so if you have one of these cards, | 102 | driver is completely untested, so if you have one of these cards, |
106 | please mail <dwmw2@infradead.org>, especially if it works! | 103 | please mail <dwmw2@infradead.org>, especially if it works! |
107 | 104 | ||
108 | To compile this driver as a module, choose M here and read | 105 | To compile this driver as a module, choose M here. The module will |
109 | <file:Documentation/networking/net-modules.txt>. The module will | ||
110 | be called arc-rimi. | 106 | be called arc-rimi. |
111 | 107 | ||
112 | config ARCNET_COM20020 | 108 | config ARCNET_COM20020 |
@@ -116,8 +112,7 @@ config ARCNET_COM20020 | |||
116 | things as promiscuous mode, so packet sniffing is possible, and | 112 | things as promiscuous mode, so packet sniffing is possible, and |
117 | extra diagnostic information. | 113 | extra diagnostic information. |
118 | 114 | ||
119 | To compile this driver as a module, choose M here and read | 115 | To compile this driver as a module, choose M here. The module will |
120 | <file:Documentation/networking/net-modules.txt>. The module will | ||
121 | be called com20020. | 116 | be called com20020. |
122 | 117 | ||
123 | config ARCNET_COM20020_ISA | 118 | config ARCNET_COM20020_ISA |
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c index 7f016f3d5bf0..91a6590d107b 100644 --- a/drivers/net/arm/ep93xx_eth.c +++ b/drivers/net/arm/ep93xx_eth.c | |||
@@ -417,7 +417,7 @@ static irqreturn_t ep93xx_irq(int irq, void *dev_id) | |||
417 | 417 | ||
418 | if (status & REG_INTSTS_RX) { | 418 | if (status & REG_INTSTS_RX) { |
419 | spin_lock(&ep->rx_lock); | 419 | spin_lock(&ep->rx_lock); |
420 | if (likely(__netif_rx_schedule_prep(dev, &ep->napi))) { | 420 | if (likely(netif_rx_schedule_prep(dev, &ep->napi))) { |
421 | wrl(ep, REG_INTEN, REG_INTEN_TX); | 421 | wrl(ep, REG_INTEN, REG_INTEN_TX); |
422 | __netif_rx_schedule(dev, &ep->napi); | 422 | __netif_rx_schedule(dev, &ep->napi); |
423 | } | 423 | } |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index a198404a3e36..423298c84a1d 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1847,9 +1847,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1847 | */ | 1847 | */ |
1848 | void bond_destroy(struct bonding *bond) | 1848 | void bond_destroy(struct bonding *bond) |
1849 | { | 1849 | { |
1850 | unregister_netdevice(bond->dev); | ||
1851 | bond_deinit(bond->dev); | 1850 | bond_deinit(bond->dev); |
1852 | bond_destroy_sysfs_entry(bond); | 1851 | bond_destroy_sysfs_entry(bond); |
1852 | unregister_netdevice(bond->dev); | ||
1853 | } | 1853 | } |
1854 | 1854 | ||
1855 | /* | 1855 | /* |
@@ -4475,8 +4475,8 @@ static void bond_free_all(void) | |||
4475 | bond_mc_list_destroy(bond); | 4475 | bond_mc_list_destroy(bond); |
4476 | /* Release the bonded slaves */ | 4476 | /* Release the bonded slaves */ |
4477 | bond_release_all(bond_dev); | 4477 | bond_release_all(bond_dev); |
4478 | unregister_netdevice(bond_dev); | ||
4479 | bond_deinit(bond_dev); | 4478 | bond_deinit(bond_dev); |
4479 | unregister_netdevice(bond_dev); | ||
4480 | } | 4480 | } |
4481 | 4481 | ||
4482 | #ifdef CONFIG_PROC_FS | 4482 | #ifdef CONFIG_PROC_FS |
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index edd6828f0a78..917b7b46f1a7 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -250,6 +250,7 @@ | |||
250 | #include <asm/system.h> | 250 | #include <asm/system.h> |
251 | #include <asm/ethernet.h> | 251 | #include <asm/ethernet.h> |
252 | #include <asm/cache.h> | 252 | #include <asm/cache.h> |
253 | #include <asm/arch/io_interface_mux.h> | ||
253 | 254 | ||
254 | //#define ETHDEBUG | 255 | //#define ETHDEBUG |
255 | #define D(x) | 256 | #define D(x) |
@@ -279,6 +280,9 @@ struct net_local { | |||
279 | * by this lock as well. | 280 | * by this lock as well. |
280 | */ | 281 | */ |
281 | spinlock_t lock; | 282 | spinlock_t lock; |
283 | |||
284 | spinlock_t led_lock; /* Protect LED state */ | ||
285 | spinlock_t transceiver_lock; /* Protect transceiver state. */ | ||
282 | }; | 286 | }; |
283 | 287 | ||
284 | typedef struct etrax_eth_descr | 288 | typedef struct etrax_eth_descr |
@@ -295,8 +299,6 @@ struct transceiver_ops | |||
295 | void (*check_duplex)(struct net_device* dev); | 299 | void (*check_duplex)(struct net_device* dev); |
296 | }; | 300 | }; |
297 | 301 | ||
298 | struct transceiver_ops* transceiver; | ||
299 | |||
300 | /* Duplex settings */ | 302 | /* Duplex settings */ |
301 | enum duplex | 303 | enum duplex |
302 | { | 304 | { |
@@ -307,7 +309,7 @@ enum duplex | |||
307 | 309 | ||
308 | /* Dma descriptors etc. */ | 310 | /* Dma descriptors etc. */ |
309 | 311 | ||
310 | #define MAX_MEDIA_DATA_SIZE 1518 | 312 | #define MAX_MEDIA_DATA_SIZE 1522 |
311 | 313 | ||
312 | #define MIN_PACKET_LEN 46 | 314 | #define MIN_PACKET_LEN 46 |
313 | #define ETHER_HEAD_LEN 14 | 315 | #define ETHER_HEAD_LEN 14 |
@@ -332,8 +334,8 @@ enum duplex | |||
332 | 334 | ||
333 | /*Intel LXT972A specific*/ | 335 | /*Intel LXT972A specific*/ |
334 | #define MDIO_INT_STATUS_REG_2 0x0011 | 336 | #define MDIO_INT_STATUS_REG_2 0x0011 |
335 | #define MDIO_INT_FULL_DUPLEX_IND ( 1 << 9 ) | 337 | #define MDIO_INT_FULL_DUPLEX_IND (1 << 9) |
336 | #define MDIO_INT_SPEED ( 1 << 14 ) | 338 | #define MDIO_INT_SPEED (1 << 14) |
337 | 339 | ||
338 | /* Network flash constants */ | 340 | /* Network flash constants */ |
339 | #define NET_FLASH_TIME (HZ/50) /* 20 ms */ | 341 | #define NET_FLASH_TIME (HZ/50) /* 20 ms */ |
@@ -344,8 +346,8 @@ enum duplex | |||
344 | #define NO_NETWORK_ACTIVITY 0 | 346 | #define NO_NETWORK_ACTIVITY 0 |
345 | #define NETWORK_ACTIVITY 1 | 347 | #define NETWORK_ACTIVITY 1 |
346 | 348 | ||
347 | #define NBR_OF_RX_DESC 64 | 349 | #define NBR_OF_RX_DESC 32 |
348 | #define NBR_OF_TX_DESC 256 | 350 | #define NBR_OF_TX_DESC 16 |
349 | 351 | ||
350 | /* Large packets are sent directly to upper layers while small packets are */ | 352 | /* Large packets are sent directly to upper layers while small packets are */ |
351 | /* copied (to reduce memory waste). The following constant decides the breakpoint */ | 353 | /* copied (to reduce memory waste). The following constant decides the breakpoint */ |
@@ -367,7 +369,6 @@ enum duplex | |||
367 | static etrax_eth_descr *myNextRxDesc; /* Points to the next descriptor to | 369 | static etrax_eth_descr *myNextRxDesc; /* Points to the next descriptor to |
368 | to be processed */ | 370 | to be processed */ |
369 | static etrax_eth_descr *myLastRxDesc; /* The last processed descriptor */ | 371 | static etrax_eth_descr *myLastRxDesc; /* The last processed descriptor */ |
370 | static etrax_eth_descr *myPrevRxDesc; /* The descriptor right before myNextRxDesc */ | ||
371 | 372 | ||
372 | static etrax_eth_descr RxDescList[NBR_OF_RX_DESC] __attribute__ ((aligned(32))); | 373 | static etrax_eth_descr RxDescList[NBR_OF_RX_DESC] __attribute__ ((aligned(32))); |
373 | 374 | ||
@@ -377,7 +378,6 @@ static etrax_eth_descr* myNextTxDesc; /* Next descriptor to use */ | |||
377 | static etrax_eth_descr TxDescList[NBR_OF_TX_DESC] __attribute__ ((aligned(32))); | 378 | static etrax_eth_descr TxDescList[NBR_OF_TX_DESC] __attribute__ ((aligned(32))); |
378 | 379 | ||
379 | static unsigned int network_rec_config_shadow = 0; | 380 | static unsigned int network_rec_config_shadow = 0; |
380 | static unsigned int mdio_phy_addr; /* Transciever address */ | ||
381 | 381 | ||
382 | static unsigned int network_tr_ctrl_shadow = 0; | 382 | static unsigned int network_tr_ctrl_shadow = 0; |
383 | 383 | ||
@@ -411,7 +411,7 @@ static int e100_set_config(struct net_device* dev, struct ifmap* map); | |||
411 | static void e100_tx_timeout(struct net_device *dev); | 411 | static void e100_tx_timeout(struct net_device *dev); |
412 | static struct net_device_stats *e100_get_stats(struct net_device *dev); | 412 | static struct net_device_stats *e100_get_stats(struct net_device *dev); |
413 | static void set_multicast_list(struct net_device *dev); | 413 | static void set_multicast_list(struct net_device *dev); |
414 | static void e100_hardware_send_packet(char *buf, int length); | 414 | static void e100_hardware_send_packet(struct net_local* np, char *buf, int length); |
415 | static void update_rx_stats(struct net_device_stats *); | 415 | static void update_rx_stats(struct net_device_stats *); |
416 | static void update_tx_stats(struct net_device_stats *); | 416 | static void update_tx_stats(struct net_device_stats *); |
417 | static int e100_probe_transceiver(struct net_device* dev); | 417 | static int e100_probe_transceiver(struct net_device* dev); |
@@ -434,7 +434,10 @@ static void e100_clear_network_leds(unsigned long dummy); | |||
434 | static void e100_set_network_leds(int active); | 434 | static void e100_set_network_leds(int active); |
435 | 435 | ||
436 | static const struct ethtool_ops e100_ethtool_ops; | 436 | static const struct ethtool_ops e100_ethtool_ops; |
437 | 437 | #if defined(CONFIG_ETRAX_NO_PHY) | |
438 | static void dummy_check_speed(struct net_device* dev); | ||
439 | static void dummy_check_duplex(struct net_device* dev); | ||
440 | #else | ||
438 | static void broadcom_check_speed(struct net_device* dev); | 441 | static void broadcom_check_speed(struct net_device* dev); |
439 | static void broadcom_check_duplex(struct net_device* dev); | 442 | static void broadcom_check_duplex(struct net_device* dev); |
440 | static void tdk_check_speed(struct net_device* dev); | 443 | static void tdk_check_speed(struct net_device* dev); |
@@ -443,16 +446,28 @@ static void intel_check_speed(struct net_device* dev); | |||
443 | static void intel_check_duplex(struct net_device* dev); | 446 | static void intel_check_duplex(struct net_device* dev); |
444 | static void generic_check_speed(struct net_device* dev); | 447 | static void generic_check_speed(struct net_device* dev); |
445 | static void generic_check_duplex(struct net_device* dev); | 448 | static void generic_check_duplex(struct net_device* dev); |
449 | #endif | ||
450 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
451 | static void e100_netpoll(struct net_device* dev); | ||
452 | #endif | ||
453 | |||
454 | static int autoneg_normal = 1; | ||
446 | 455 | ||
447 | struct transceiver_ops transceivers[] = | 456 | struct transceiver_ops transceivers[] = |
448 | { | 457 | { |
458 | #if defined(CONFIG_ETRAX_NO_PHY) | ||
459 | {0x0000, dummy_check_speed, dummy_check_duplex} /* Dummy */ | ||
460 | #else | ||
449 | {0x1018, broadcom_check_speed, broadcom_check_duplex}, /* Broadcom */ | 461 | {0x1018, broadcom_check_speed, broadcom_check_duplex}, /* Broadcom */ |
450 | {0xC039, tdk_check_speed, tdk_check_duplex}, /* TDK 2120 */ | 462 | {0xC039, tdk_check_speed, tdk_check_duplex}, /* TDK 2120 */ |
451 | {0x039C, tdk_check_speed, tdk_check_duplex}, /* TDK 2120C */ | 463 | {0x039C, tdk_check_speed, tdk_check_duplex}, /* TDK 2120C */ |
452 | {0x04de, intel_check_speed, intel_check_duplex}, /* Intel LXT972A*/ | 464 | {0x04de, intel_check_speed, intel_check_duplex}, /* Intel LXT972A*/ |
453 | {0x0000, generic_check_speed, generic_check_duplex} /* Generic, must be last */ | 465 | {0x0000, generic_check_speed, generic_check_duplex} /* Generic, must be last */ |
466 | #endif | ||
454 | }; | 467 | }; |
455 | 468 | ||
469 | struct transceiver_ops* transceiver = &transceivers[0]; | ||
470 | |||
456 | #define tx_done(dev) (*R_DMA_CH0_CMD == 0) | 471 | #define tx_done(dev) (*R_DMA_CH0_CMD == 0) |
457 | 472 | ||
458 | /* | 473 | /* |
@@ -471,14 +486,22 @@ etrax_ethernet_init(void) | |||
471 | int i, err; | 486 | int i, err; |
472 | 487 | ||
473 | printk(KERN_INFO | 488 | printk(KERN_INFO |
474 | "ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2003 Axis Communications AB\n"); | 489 | "ETRAX 100LX 10/100MBit ethernet v2.0 (c) 1998-2007 Axis Communications AB\n"); |
475 | 490 | ||
476 | dev = alloc_etherdev(sizeof(struct net_local)); | 491 | if (cris_request_io_interface(if_eth, cardname)) { |
477 | np = dev->priv; | 492 | printk(KERN_CRIT "etrax_ethernet_init failed to get IO interface\n"); |
493 | return -EBUSY; | ||
494 | } | ||
478 | 495 | ||
496 | dev = alloc_etherdev(sizeof(struct net_local)); | ||
479 | if (!dev) | 497 | if (!dev) |
480 | return -ENOMEM; | 498 | return -ENOMEM; |
481 | 499 | ||
500 | np = netdev_priv(dev); | ||
501 | |||
502 | /* we do our own locking */ | ||
503 | dev->features |= NETIF_F_LLTX; | ||
504 | |||
482 | dev->base_addr = (unsigned int)R_NETWORK_SA_0; /* just to have something to show */ | 505 | dev->base_addr = (unsigned int)R_NETWORK_SA_0; /* just to have something to show */ |
483 | 506 | ||
484 | /* now setup our etrax specific stuff */ | 507 | /* now setup our etrax specific stuff */ |
@@ -498,14 +521,22 @@ etrax_ethernet_init(void) | |||
498 | dev->do_ioctl = e100_ioctl; | 521 | dev->do_ioctl = e100_ioctl; |
499 | dev->set_config = e100_set_config; | 522 | dev->set_config = e100_set_config; |
500 | dev->tx_timeout = e100_tx_timeout; | 523 | dev->tx_timeout = e100_tx_timeout; |
524 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
525 | dev->poll_controller = e100_netpoll; | ||
526 | #endif | ||
527 | |||
528 | spin_lock_init(&np->lock); | ||
529 | spin_lock_init(&np->led_lock); | ||
530 | spin_lock_init(&np->transceiver_lock); | ||
501 | 531 | ||
502 | /* Initialise the list of Etrax DMA-descriptors */ | 532 | /* Initialise the list of Etrax DMA-descriptors */ |
503 | 533 | ||
504 | /* Initialise receive descriptors */ | 534 | /* Initialise receive descriptors */ |
505 | 535 | ||
506 | for (i = 0; i < NBR_OF_RX_DESC; i++) { | 536 | for (i = 0; i < NBR_OF_RX_DESC; i++) { |
507 | /* Allocate two extra cachelines to make sure that buffer used by DMA | 537 | /* Allocate two extra cachelines to make sure that buffer used |
508 | * does not share cacheline with any other data (to avoid cache bug) | 538 | * by DMA does not share cacheline with any other data (to |
539 | * avoid cache bug) | ||
509 | */ | 540 | */ |
510 | RxDescList[i].skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES); | 541 | RxDescList[i].skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES); |
511 | if (!RxDescList[i].skb) | 542 | if (!RxDescList[i].skb) |
@@ -541,7 +572,6 @@ etrax_ethernet_init(void) | |||
541 | 572 | ||
542 | myNextRxDesc = &RxDescList[0]; | 573 | myNextRxDesc = &RxDescList[0]; |
543 | myLastRxDesc = &RxDescList[NBR_OF_RX_DESC - 1]; | 574 | myLastRxDesc = &RxDescList[NBR_OF_RX_DESC - 1]; |
544 | myPrevRxDesc = &RxDescList[NBR_OF_RX_DESC - 1]; | ||
545 | myFirstTxDesc = &TxDescList[0]; | 575 | myFirstTxDesc = &TxDescList[0]; |
546 | myNextTxDesc = &TxDescList[0]; | 576 | myNextTxDesc = &TxDescList[0]; |
547 | myLastTxDesc = &TxDescList[NBR_OF_TX_DESC - 1]; | 577 | myLastTxDesc = &TxDescList[NBR_OF_TX_DESC - 1]; |
@@ -562,10 +592,11 @@ etrax_ethernet_init(void) | |||
562 | current_speed = 10; | 592 | current_speed = 10; |
563 | current_speed_selection = 0; /* Auto */ | 593 | current_speed_selection = 0; /* Auto */ |
564 | speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; | 594 | speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; |
565 | duplex_timer.data = (unsigned long)dev; | 595 | speed_timer.data = (unsigned long)dev; |
566 | speed_timer.function = e100_check_speed; | 596 | speed_timer.function = e100_check_speed; |
567 | 597 | ||
568 | clear_led_timer.function = e100_clear_network_leds; | 598 | clear_led_timer.function = e100_clear_network_leds; |
599 | clear_led_timer.data = (unsigned long)dev; | ||
569 | 600 | ||
570 | full_duplex = 0; | 601 | full_duplex = 0; |
571 | current_duplex = autoneg; | 602 | current_duplex = autoneg; |
@@ -574,7 +605,6 @@ etrax_ethernet_init(void) | |||
574 | duplex_timer.function = e100_check_duplex; | 605 | duplex_timer.function = e100_check_duplex; |
575 | 606 | ||
576 | /* Initialize mii interface */ | 607 | /* Initialize mii interface */ |
577 | np->mii_if.phy_id = mdio_phy_addr; | ||
578 | np->mii_if.phy_id_mask = 0x1f; | 608 | np->mii_if.phy_id_mask = 0x1f; |
579 | np->mii_if.reg_num_mask = 0x1f; | 609 | np->mii_if.reg_num_mask = 0x1f; |
580 | np->mii_if.dev = dev; | 610 | np->mii_if.dev = dev; |
@@ -585,6 +615,9 @@ etrax_ethernet_init(void) | |||
585 | /* unwanted addresses are matched */ | 615 | /* unwanted addresses are matched */ |
586 | *R_NETWORK_GA_0 = 0x00000000; | 616 | *R_NETWORK_GA_0 = 0x00000000; |
587 | *R_NETWORK_GA_1 = 0x00000000; | 617 | *R_NETWORK_GA_1 = 0x00000000; |
618 | |||
619 | /* Initialize next time the led can flash */ | ||
620 | led_next_time = jiffies; | ||
588 | return 0; | 621 | return 0; |
589 | } | 622 | } |
590 | 623 | ||
@@ -595,9 +628,9 @@ etrax_ethernet_init(void) | |||
595 | static int | 628 | static int |
596 | e100_set_mac_address(struct net_device *dev, void *p) | 629 | e100_set_mac_address(struct net_device *dev, void *p) |
597 | { | 630 | { |
598 | struct net_local *np = (struct net_local *)dev->priv; | 631 | struct net_local *np = netdev_priv(dev); |
599 | struct sockaddr *addr = p; | 632 | struct sockaddr *addr = p; |
600 | int i; | 633 | DECLARE_MAC_BUF(mac); |
601 | 634 | ||
602 | spin_lock(&np->lock); /* preemption protection */ | 635 | spin_lock(&np->lock); /* preemption protection */ |
603 | 636 | ||
@@ -686,6 +719,25 @@ e100_open(struct net_device *dev) | |||
686 | goto grace_exit2; | 719 | goto grace_exit2; |
687 | } | 720 | } |
688 | 721 | ||
722 | /* | ||
723 | * Always allocate the DMA channels after the IRQ, | ||
724 | * and clean up on failure. | ||
725 | */ | ||
726 | |||
727 | if (cris_request_dma(NETWORK_TX_DMA_NBR, | ||
728 | cardname, | ||
729 | DMA_VERBOSE_ON_ERROR, | ||
730 | dma_eth)) { | ||
731 | goto grace_exit3; | ||
732 | } | ||
733 | |||
734 | if (cris_request_dma(NETWORK_RX_DMA_NBR, | ||
735 | cardname, | ||
736 | DMA_VERBOSE_ON_ERROR, | ||
737 | dma_eth)) { | ||
738 | goto grace_exit4; | ||
739 | } | ||
740 | |||
689 | /* give the HW an idea of what MAC address we want */ | 741 | /* give the HW an idea of what MAC address we want */ |
690 | 742 | ||
691 | *R_NETWORK_SA_0 = dev->dev_addr[0] | (dev->dev_addr[1] << 8) | | 743 | *R_NETWORK_SA_0 = dev->dev_addr[0] | (dev->dev_addr[1] << 8) | |
@@ -700,6 +752,7 @@ e100_open(struct net_device *dev) | |||
700 | 752 | ||
701 | *R_NETWORK_REC_CONFIG = 0xd; /* broadcast rec, individ. rec, ma0 enabled */ | 753 | *R_NETWORK_REC_CONFIG = 0xd; /* broadcast rec, individ. rec, ma0 enabled */ |
702 | #else | 754 | #else |
755 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, max_size, size1522); | ||
703 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, broadcast, receive); | 756 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, broadcast, receive); |
704 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, ma0, enable); | 757 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, ma0, enable); |
705 | SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex); | 758 | SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex); |
@@ -719,8 +772,7 @@ e100_open(struct net_device *dev) | |||
719 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, crc, enable); | 772 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, crc, enable); |
720 | *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; | 773 | *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; |
721 | 774 | ||
722 | save_flags(flags); | 775 | local_irq_save(flags); |
723 | cli(); | ||
724 | 776 | ||
725 | /* enable the irq's for ethernet DMA */ | 777 | /* enable the irq's for ethernet DMA */ |
726 | 778 | ||
@@ -752,12 +804,13 @@ e100_open(struct net_device *dev) | |||
752 | 804 | ||
753 | *R_DMA_CH0_FIRST = 0; | 805 | *R_DMA_CH0_FIRST = 0; |
754 | *R_DMA_CH0_DESCR = virt_to_phys(myLastTxDesc); | 806 | *R_DMA_CH0_DESCR = virt_to_phys(myLastTxDesc); |
807 | netif_start_queue(dev); | ||
755 | 808 | ||
756 | restore_flags(flags); | 809 | local_irq_restore(flags); |
757 | 810 | ||
758 | /* Probe for transceiver */ | 811 | /* Probe for transceiver */ |
759 | if (e100_probe_transceiver(dev)) | 812 | if (e100_probe_transceiver(dev)) |
760 | goto grace_exit3; | 813 | goto grace_exit5; |
761 | 814 | ||
762 | /* Start duplex/speed timers */ | 815 | /* Start duplex/speed timers */ |
763 | add_timer(&speed_timer); | 816 | add_timer(&speed_timer); |
@@ -766,10 +819,14 @@ e100_open(struct net_device *dev) | |||
766 | /* We are now ready to accept transmit requeusts from | 819 | /* We are now ready to accept transmit requeusts from |
767 | * the queueing layer of the networking. | 820 | * the queueing layer of the networking. |
768 | */ | 821 | */ |
769 | netif_start_queue(dev); | 822 | netif_carrier_on(dev); |
770 | 823 | ||
771 | return 0; | 824 | return 0; |
772 | 825 | ||
826 | grace_exit5: | ||
827 | cris_free_dma(NETWORK_RX_DMA_NBR, cardname); | ||
828 | grace_exit4: | ||
829 | cris_free_dma(NETWORK_TX_DMA_NBR, cardname); | ||
773 | grace_exit3: | 830 | grace_exit3: |
774 | free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev); | 831 | free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev); |
775 | grace_exit2: | 832 | grace_exit2: |
@@ -780,12 +837,20 @@ grace_exit0: | |||
780 | return -EAGAIN; | 837 | return -EAGAIN; |
781 | } | 838 | } |
782 | 839 | ||
783 | 840 | #if defined(CONFIG_ETRAX_NO_PHY) | |
841 | static void | ||
842 | dummy_check_speed(struct net_device* dev) | ||
843 | { | ||
844 | current_speed = 100; | ||
845 | } | ||
846 | #else | ||
784 | static void | 847 | static void |
785 | generic_check_speed(struct net_device* dev) | 848 | generic_check_speed(struct net_device* dev) |
786 | { | 849 | { |
787 | unsigned long data; | 850 | unsigned long data; |
788 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE); | 851 | struct net_local *np = netdev_priv(dev); |
852 | |||
853 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE); | ||
789 | if ((data & ADVERTISE_100FULL) || | 854 | if ((data & ADVERTISE_100FULL) || |
790 | (data & ADVERTISE_100HALF)) | 855 | (data & ADVERTISE_100HALF)) |
791 | current_speed = 100; | 856 | current_speed = 100; |
@@ -797,7 +862,10 @@ static void | |||
797 | tdk_check_speed(struct net_device* dev) | 862 | tdk_check_speed(struct net_device* dev) |
798 | { | 863 | { |
799 | unsigned long data; | 864 | unsigned long data; |
800 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_TDK_DIAGNOSTIC_REG); | 865 | struct net_local *np = netdev_priv(dev); |
866 | |||
867 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
868 | MDIO_TDK_DIAGNOSTIC_REG); | ||
801 | current_speed = (data & MDIO_TDK_DIAGNOSTIC_RATE ? 100 : 10); | 869 | current_speed = (data & MDIO_TDK_DIAGNOSTIC_RATE ? 100 : 10); |
802 | } | 870 | } |
803 | 871 | ||
@@ -805,7 +873,10 @@ static void | |||
805 | broadcom_check_speed(struct net_device* dev) | 873 | broadcom_check_speed(struct net_device* dev) |
806 | { | 874 | { |
807 | unsigned long data; | 875 | unsigned long data; |
808 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_AUX_CTRL_STATUS_REG); | 876 | struct net_local *np = netdev_priv(dev); |
877 | |||
878 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
879 | MDIO_AUX_CTRL_STATUS_REG); | ||
809 | current_speed = (data & MDIO_BC_SPEED ? 100 : 10); | 880 | current_speed = (data & MDIO_BC_SPEED ? 100 : 10); |
810 | } | 881 | } |
811 | 882 | ||
@@ -813,46 +884,62 @@ static void | |||
813 | intel_check_speed(struct net_device* dev) | 884 | intel_check_speed(struct net_device* dev) |
814 | { | 885 | { |
815 | unsigned long data; | 886 | unsigned long data; |
816 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_INT_STATUS_REG_2); | 887 | struct net_local *np = netdev_priv(dev); |
888 | |||
889 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
890 | MDIO_INT_STATUS_REG_2); | ||
817 | current_speed = (data & MDIO_INT_SPEED ? 100 : 10); | 891 | current_speed = (data & MDIO_INT_SPEED ? 100 : 10); |
818 | } | 892 | } |
819 | 893 | #endif | |
820 | static void | 894 | static void |
821 | e100_check_speed(unsigned long priv) | 895 | e100_check_speed(unsigned long priv) |
822 | { | 896 | { |
823 | struct net_device* dev = (struct net_device*)priv; | 897 | struct net_device* dev = (struct net_device*)priv; |
898 | struct net_local *np = netdev_priv(dev); | ||
824 | static int led_initiated = 0; | 899 | static int led_initiated = 0; |
825 | unsigned long data; | 900 | unsigned long data; |
826 | int old_speed = current_speed; | 901 | int old_speed = current_speed; |
827 | 902 | ||
828 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMSR); | 903 | spin_lock(&np->transceiver_lock); |
904 | |||
905 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMSR); | ||
829 | if (!(data & BMSR_LSTATUS)) { | 906 | if (!(data & BMSR_LSTATUS)) { |
830 | current_speed = 0; | 907 | current_speed = 0; |
831 | } else { | 908 | } else { |
832 | transceiver->check_speed(dev); | 909 | transceiver->check_speed(dev); |
833 | } | 910 | } |
834 | 911 | ||
912 | spin_lock(&np->led_lock); | ||
835 | if ((old_speed != current_speed) || !led_initiated) { | 913 | if ((old_speed != current_speed) || !led_initiated) { |
836 | led_initiated = 1; | 914 | led_initiated = 1; |
837 | e100_set_network_leds(NO_NETWORK_ACTIVITY); | 915 | e100_set_network_leds(NO_NETWORK_ACTIVITY); |
916 | if (current_speed) | ||
917 | netif_carrier_on(dev); | ||
918 | else | ||
919 | netif_carrier_off(dev); | ||
838 | } | 920 | } |
921 | spin_unlock(&np->led_lock); | ||
839 | 922 | ||
840 | /* Reinitialize the timer. */ | 923 | /* Reinitialize the timer. */ |
841 | speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; | 924 | speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; |
842 | add_timer(&speed_timer); | 925 | add_timer(&speed_timer); |
926 | |||
927 | spin_unlock(&np->transceiver_lock); | ||
843 | } | 928 | } |
844 | 929 | ||
845 | static void | 930 | static void |
846 | e100_negotiate(struct net_device* dev) | 931 | e100_negotiate(struct net_device* dev) |
847 | { | 932 | { |
848 | unsigned short data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE); | 933 | struct net_local *np = netdev_priv(dev); |
934 | unsigned short data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
935 | MII_ADVERTISE); | ||
849 | 936 | ||
850 | /* Discard old speed and duplex settings */ | 937 | /* Discard old speed and duplex settings */ |
851 | data &= ~(ADVERTISE_100HALF | ADVERTISE_100FULL | | 938 | data &= ~(ADVERTISE_100HALF | ADVERTISE_100FULL | |
852 | ADVERTISE_10HALF | ADVERTISE_10FULL); | 939 | ADVERTISE_10HALF | ADVERTISE_10FULL); |
853 | 940 | ||
854 | switch (current_speed_selection) { | 941 | switch (current_speed_selection) { |
855 | case 10 : | 942 | case 10: |
856 | if (current_duplex == full) | 943 | if (current_duplex == full) |
857 | data |= ADVERTISE_10FULL; | 944 | data |= ADVERTISE_10FULL; |
858 | else if (current_duplex == half) | 945 | else if (current_duplex == half) |
@@ -861,7 +948,7 @@ e100_negotiate(struct net_device* dev) | |||
861 | data |= ADVERTISE_10HALF | ADVERTISE_10FULL; | 948 | data |= ADVERTISE_10HALF | ADVERTISE_10FULL; |
862 | break; | 949 | break; |
863 | 950 | ||
864 | case 100 : | 951 | case 100: |
865 | if (current_duplex == full) | 952 | if (current_duplex == full) |
866 | data |= ADVERTISE_100FULL; | 953 | data |= ADVERTISE_100FULL; |
867 | else if (current_duplex == half) | 954 | else if (current_duplex == half) |
@@ -870,7 +957,7 @@ e100_negotiate(struct net_device* dev) | |||
870 | data |= ADVERTISE_100HALF | ADVERTISE_100FULL; | 957 | data |= ADVERTISE_100HALF | ADVERTISE_100FULL; |
871 | break; | 958 | break; |
872 | 959 | ||
873 | case 0 : /* Auto */ | 960 | case 0: /* Auto */ |
874 | if (current_duplex == full) | 961 | if (current_duplex == full) |
875 | data |= ADVERTISE_100FULL | ADVERTISE_10FULL; | 962 | data |= ADVERTISE_100FULL | ADVERTISE_10FULL; |
876 | else if (current_duplex == half) | 963 | else if (current_duplex == half) |
@@ -880,35 +967,44 @@ e100_negotiate(struct net_device* dev) | |||
880 | ADVERTISE_100HALF | ADVERTISE_100FULL; | 967 | ADVERTISE_100HALF | ADVERTISE_100FULL; |
881 | break; | 968 | break; |
882 | 969 | ||
883 | default : /* assume autoneg speed and duplex */ | 970 | default: /* assume autoneg speed and duplex */ |
884 | data |= ADVERTISE_10HALF | ADVERTISE_10FULL | | 971 | data |= ADVERTISE_10HALF | ADVERTISE_10FULL | |
885 | ADVERTISE_100HALF | ADVERTISE_100FULL; | 972 | ADVERTISE_100HALF | ADVERTISE_100FULL; |
973 | break; | ||
886 | } | 974 | } |
887 | 975 | ||
888 | e100_set_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE, data); | 976 | e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE, data); |
889 | 977 | ||
890 | /* Renegotiate with link partner */ | 978 | /* Renegotiate with link partner */ |
891 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMCR); | 979 | if (autoneg_normal) { |
980 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR); | ||
892 | data |= BMCR_ANENABLE | BMCR_ANRESTART; | 981 | data |= BMCR_ANENABLE | BMCR_ANRESTART; |
893 | 982 | } | |
894 | e100_set_mdio_reg(dev, mdio_phy_addr, MII_BMCR, data); | 983 | e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR, data); |
895 | } | 984 | } |
896 | 985 | ||
897 | static void | 986 | static void |
898 | e100_set_speed(struct net_device* dev, unsigned long speed) | 987 | e100_set_speed(struct net_device* dev, unsigned long speed) |
899 | { | 988 | { |
989 | struct net_local *np = netdev_priv(dev); | ||
990 | |||
991 | spin_lock(&np->transceiver_lock); | ||
900 | if (speed != current_speed_selection) { | 992 | if (speed != current_speed_selection) { |
901 | current_speed_selection = speed; | 993 | current_speed_selection = speed; |
902 | e100_negotiate(dev); | 994 | e100_negotiate(dev); |
903 | } | 995 | } |
996 | spin_unlock(&np->transceiver_lock); | ||
904 | } | 997 | } |
905 | 998 | ||
906 | static void | 999 | static void |
907 | e100_check_duplex(unsigned long priv) | 1000 | e100_check_duplex(unsigned long priv) |
908 | { | 1001 | { |
909 | struct net_device *dev = (struct net_device *)priv; | 1002 | struct net_device *dev = (struct net_device *)priv; |
910 | struct net_local *np = (struct net_local *)dev->priv; | 1003 | struct net_local *np = netdev_priv(dev); |
911 | int old_duplex = full_duplex; | 1004 | int old_duplex; |
1005 | |||
1006 | spin_lock(&np->transceiver_lock); | ||
1007 | old_duplex = full_duplex; | ||
912 | transceiver->check_duplex(dev); | 1008 | transceiver->check_duplex(dev); |
913 | if (old_duplex != full_duplex) { | 1009 | if (old_duplex != full_duplex) { |
914 | /* Duplex changed */ | 1010 | /* Duplex changed */ |
@@ -920,13 +1016,22 @@ e100_check_duplex(unsigned long priv) | |||
920 | duplex_timer.expires = jiffies + NET_DUPLEX_CHECK_INTERVAL; | 1016 | duplex_timer.expires = jiffies + NET_DUPLEX_CHECK_INTERVAL; |
921 | add_timer(&duplex_timer); | 1017 | add_timer(&duplex_timer); |
922 | np->mii_if.full_duplex = full_duplex; | 1018 | np->mii_if.full_duplex = full_duplex; |
1019 | spin_unlock(&np->transceiver_lock); | ||
923 | } | 1020 | } |
924 | 1021 | #if defined(CONFIG_ETRAX_NO_PHY) | |
1022 | static void | ||
1023 | dummy_check_duplex(struct net_device* dev) | ||
1024 | { | ||
1025 | full_duplex = 1; | ||
1026 | } | ||
1027 | #else | ||
925 | static void | 1028 | static void |
926 | generic_check_duplex(struct net_device* dev) | 1029 | generic_check_duplex(struct net_device* dev) |
927 | { | 1030 | { |
928 | unsigned long data; | 1031 | unsigned long data; |
929 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE); | 1032 | struct net_local *np = netdev_priv(dev); |
1033 | |||
1034 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE); | ||
930 | if ((data & ADVERTISE_10FULL) || | 1035 | if ((data & ADVERTISE_10FULL) || |
931 | (data & ADVERTISE_100FULL)) | 1036 | (data & ADVERTISE_100FULL)) |
932 | full_duplex = 1; | 1037 | full_duplex = 1; |
@@ -938,7 +1043,10 @@ static void | |||
938 | tdk_check_duplex(struct net_device* dev) | 1043 | tdk_check_duplex(struct net_device* dev) |
939 | { | 1044 | { |
940 | unsigned long data; | 1045 | unsigned long data; |
941 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_TDK_DIAGNOSTIC_REG); | 1046 | struct net_local *np = netdev_priv(dev); |
1047 | |||
1048 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
1049 | MDIO_TDK_DIAGNOSTIC_REG); | ||
942 | full_duplex = (data & MDIO_TDK_DIAGNOSTIC_DPLX) ? 1 : 0; | 1050 | full_duplex = (data & MDIO_TDK_DIAGNOSTIC_DPLX) ? 1 : 0; |
943 | } | 1051 | } |
944 | 1052 | ||
@@ -946,7 +1054,10 @@ static void | |||
946 | broadcom_check_duplex(struct net_device* dev) | 1054 | broadcom_check_duplex(struct net_device* dev) |
947 | { | 1055 | { |
948 | unsigned long data; | 1056 | unsigned long data; |
949 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_AUX_CTRL_STATUS_REG); | 1057 | struct net_local *np = netdev_priv(dev); |
1058 | |||
1059 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
1060 | MDIO_AUX_CTRL_STATUS_REG); | ||
950 | full_duplex = (data & MDIO_BC_FULL_DUPLEX_IND) ? 1 : 0; | 1061 | full_duplex = (data & MDIO_BC_FULL_DUPLEX_IND) ? 1 : 0; |
951 | } | 1062 | } |
952 | 1063 | ||
@@ -954,38 +1065,55 @@ static void | |||
954 | intel_check_duplex(struct net_device* dev) | 1065 | intel_check_duplex(struct net_device* dev) |
955 | { | 1066 | { |
956 | unsigned long data; | 1067 | unsigned long data; |
957 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_INT_STATUS_REG_2); | 1068 | struct net_local *np = netdev_priv(dev); |
1069 | |||
1070 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
1071 | MDIO_INT_STATUS_REG_2); | ||
958 | full_duplex = (data & MDIO_INT_FULL_DUPLEX_IND) ? 1 : 0; | 1072 | full_duplex = (data & MDIO_INT_FULL_DUPLEX_IND) ? 1 : 0; |
959 | } | 1073 | } |
960 | 1074 | #endif | |
961 | static void | 1075 | static void |
962 | e100_set_duplex(struct net_device* dev, enum duplex new_duplex) | 1076 | e100_set_duplex(struct net_device* dev, enum duplex new_duplex) |
963 | { | 1077 | { |
1078 | struct net_local *np = netdev_priv(dev); | ||
1079 | |||
1080 | spin_lock(&np->transceiver_lock); | ||
964 | if (new_duplex != current_duplex) { | 1081 | if (new_duplex != current_duplex) { |
965 | current_duplex = new_duplex; | 1082 | current_duplex = new_duplex; |
966 | e100_negotiate(dev); | 1083 | e100_negotiate(dev); |
967 | } | 1084 | } |
1085 | spin_unlock(&np->transceiver_lock); | ||
968 | } | 1086 | } |
969 | 1087 | ||
970 | static int | 1088 | static int |
971 | e100_probe_transceiver(struct net_device* dev) | 1089 | e100_probe_transceiver(struct net_device* dev) |
972 | { | 1090 | { |
1091 | int ret = 0; | ||
1092 | |||
1093 | #if !defined(CONFIG_ETRAX_NO_PHY) | ||
973 | unsigned int phyid_high; | 1094 | unsigned int phyid_high; |
974 | unsigned int phyid_low; | 1095 | unsigned int phyid_low; |
975 | unsigned int oui; | 1096 | unsigned int oui; |
976 | struct transceiver_ops* ops = NULL; | 1097 | struct transceiver_ops* ops = NULL; |
1098 | struct net_local *np = netdev_priv(dev); | ||
1099 | |||
1100 | spin_lock(&np->transceiver_lock); | ||
977 | 1101 | ||
978 | /* Probe MDIO physical address */ | 1102 | /* Probe MDIO physical address */ |
979 | for (mdio_phy_addr = 0; mdio_phy_addr <= 31; mdio_phy_addr++) { | 1103 | for (np->mii_if.phy_id = 0; np->mii_if.phy_id <= 31; |
980 | if (e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMSR) != 0xffff) | 1104 | np->mii_if.phy_id++) { |
1105 | if (e100_get_mdio_reg(dev, | ||
1106 | np->mii_if.phy_id, MII_BMSR) != 0xffff) | ||
981 | break; | 1107 | break; |
982 | } | 1108 | } |
983 | if (mdio_phy_addr == 32) | 1109 | if (np->mii_if.phy_id == 32) { |
984 | return -ENODEV; | 1110 | ret = -ENODEV; |
1111 | goto out; | ||
1112 | } | ||
985 | 1113 | ||
986 | /* Get manufacturer */ | 1114 | /* Get manufacturer */ |
987 | phyid_high = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID1); | 1115 | phyid_high = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_PHYSID1); |
988 | phyid_low = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID2); | 1116 | phyid_low = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_PHYSID2); |
989 | oui = (phyid_high << 6) | (phyid_low >> 10); | 1117 | oui = (phyid_high << 6) | (phyid_low >> 10); |
990 | 1118 | ||
991 | for (ops = &transceivers[0]; ops->oui; ops++) { | 1119 | for (ops = &transceivers[0]; ops->oui; ops++) { |
@@ -993,8 +1121,10 @@ e100_probe_transceiver(struct net_device* dev) | |||
993 | break; | 1121 | break; |
994 | } | 1122 | } |
995 | transceiver = ops; | 1123 | transceiver = ops; |
996 | 1124 | out: | |
997 | return 0; | 1125 | spin_unlock(&np->transceiver_lock); |
1126 | #endif | ||
1127 | return ret; | ||
998 | } | 1128 | } |
999 | 1129 | ||
1000 | static int | 1130 | static int |
@@ -1088,13 +1218,14 @@ e100_receive_mdio_bit() | |||
1088 | static void | 1218 | static void |
1089 | e100_reset_transceiver(struct net_device* dev) | 1219 | e100_reset_transceiver(struct net_device* dev) |
1090 | { | 1220 | { |
1221 | struct net_local *np = netdev_priv(dev); | ||
1091 | unsigned short cmd; | 1222 | unsigned short cmd; |
1092 | unsigned short data; | 1223 | unsigned short data; |
1093 | int bitCounter; | 1224 | int bitCounter; |
1094 | 1225 | ||
1095 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMCR); | 1226 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR); |
1096 | 1227 | ||
1097 | cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (mdio_phy_addr << 7) | (MII_BMCR << 2); | 1228 | cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (np->mii_if.phy_id << 7) | (MII_BMCR << 2); |
1098 | 1229 | ||
1099 | e100_send_mdio_cmd(cmd, 1); | 1230 | e100_send_mdio_cmd(cmd, 1); |
1100 | 1231 | ||
@@ -1112,7 +1243,7 @@ e100_reset_transceiver(struct net_device* dev) | |||
1112 | static void | 1243 | static void |
1113 | e100_tx_timeout(struct net_device *dev) | 1244 | e100_tx_timeout(struct net_device *dev) |
1114 | { | 1245 | { |
1115 | struct net_local *np = (struct net_local *)dev->priv; | 1246 | struct net_local *np = netdev_priv(dev); |
1116 | unsigned long flags; | 1247 | unsigned long flags; |
1117 | 1248 | ||
1118 | spin_lock_irqsave(&np->lock, flags); | 1249 | spin_lock_irqsave(&np->lock, flags); |
@@ -1134,8 +1265,7 @@ e100_tx_timeout(struct net_device *dev) | |||
1134 | e100_reset_transceiver(dev); | 1265 | e100_reset_transceiver(dev); |
1135 | 1266 | ||
1136 | /* and get rid of the packets that never got an interrupt */ | 1267 | /* and get rid of the packets that never got an interrupt */ |
1137 | while (myFirstTxDesc != myNextTxDesc) | 1268 | while (myFirstTxDesc != myNextTxDesc) { |
1138 | { | ||
1139 | dev_kfree_skb(myFirstTxDesc->skb); | 1269 | dev_kfree_skb(myFirstTxDesc->skb); |
1140 | myFirstTxDesc->skb = 0; | 1270 | myFirstTxDesc->skb = 0; |
1141 | myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next); | 1271 | myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next); |
@@ -1161,7 +1291,7 @@ e100_tx_timeout(struct net_device *dev) | |||
1161 | static int | 1291 | static int |
1162 | e100_send_packet(struct sk_buff *skb, struct net_device *dev) | 1292 | e100_send_packet(struct sk_buff *skb, struct net_device *dev) |
1163 | { | 1293 | { |
1164 | struct net_local *np = (struct net_local *)dev->priv; | 1294 | struct net_local *np = netdev_priv(dev); |
1165 | unsigned char *buf = skb->data; | 1295 | unsigned char *buf = skb->data; |
1166 | unsigned long flags; | 1296 | unsigned long flags; |
1167 | 1297 | ||
@@ -1174,7 +1304,7 @@ e100_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1174 | 1304 | ||
1175 | dev->trans_start = jiffies; | 1305 | dev->trans_start = jiffies; |
1176 | 1306 | ||
1177 | e100_hardware_send_packet(buf, skb->len); | 1307 | e100_hardware_send_packet(np, buf, skb->len); |
1178 | 1308 | ||
1179 | myNextTxDesc = phys_to_virt(myNextTxDesc->descr.next); | 1309 | myNextTxDesc = phys_to_virt(myNextTxDesc->descr.next); |
1180 | 1310 | ||
@@ -1197,13 +1327,15 @@ static irqreturn_t | |||
1197 | e100rxtx_interrupt(int irq, void *dev_id) | 1327 | e100rxtx_interrupt(int irq, void *dev_id) |
1198 | { | 1328 | { |
1199 | struct net_device *dev = (struct net_device *)dev_id; | 1329 | struct net_device *dev = (struct net_device *)dev_id; |
1200 | struct net_local *np = (struct net_local *)dev->priv; | 1330 | struct net_local *np = netdev_priv(dev); |
1201 | unsigned long irqbits = *R_IRQ_MASK2_RD; | 1331 | unsigned long irqbits; |
1202 | 1332 | ||
1203 | /* Disable RX/TX IRQs to avoid reentrancy */ | 1333 | /* |
1204 | *R_IRQ_MASK2_CLR = | 1334 | * Note that both rx and tx interrupts are blocked at this point, |
1205 | IO_STATE(R_IRQ_MASK2_CLR, dma0_eop, clr) | | 1335 | * regardless of which got us here. |
1206 | IO_STATE(R_IRQ_MASK2_CLR, dma1_eop, clr); | 1336 | */ |
1337 | |||
1338 | irqbits = *R_IRQ_MASK2_RD; | ||
1207 | 1339 | ||
1208 | /* Handle received packets */ | 1340 | /* Handle received packets */ |
1209 | if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma1_eop, active)) { | 1341 | if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma1_eop, active)) { |
@@ -1219,7 +1351,7 @@ e100rxtx_interrupt(int irq, void *dev_id) | |||
1219 | * allocate a new buffer to put a packet in. | 1351 | * allocate a new buffer to put a packet in. |
1220 | */ | 1352 | */ |
1221 | e100_rx(dev); | 1353 | e100_rx(dev); |
1222 | ((struct net_local *)dev->priv)->stats.rx_packets++; | 1354 | np->stats.rx_packets++; |
1223 | /* restart/continue on the channel, for safety */ | 1355 | /* restart/continue on the channel, for safety */ |
1224 | *R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, restart); | 1356 | *R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, restart); |
1225 | /* clear dma channel 1 eop/descr irq bits */ | 1357 | /* clear dma channel 1 eop/descr irq bits */ |
@@ -1233,9 +1365,8 @@ e100rxtx_interrupt(int irq, void *dev_id) | |||
1233 | } | 1365 | } |
1234 | 1366 | ||
1235 | /* Report any packets that have been sent */ | 1367 | /* Report any packets that have been sent */ |
1236 | while (myFirstTxDesc != phys_to_virt(*R_DMA_CH0_FIRST) && | 1368 | while (virt_to_phys(myFirstTxDesc) != *R_DMA_CH0_FIRST && |
1237 | myFirstTxDesc != myNextTxDesc) | 1369 | (netif_queue_stopped(dev) || myFirstTxDesc != myNextTxDesc)) { |
1238 | { | ||
1239 | np->stats.tx_bytes += myFirstTxDesc->skb->len; | 1370 | np->stats.tx_bytes += myFirstTxDesc->skb->len; |
1240 | np->stats.tx_packets++; | 1371 | np->stats.tx_packets++; |
1241 | 1372 | ||
@@ -1244,19 +1375,15 @@ e100rxtx_interrupt(int irq, void *dev_id) | |||
1244 | dev_kfree_skb_irq(myFirstTxDesc->skb); | 1375 | dev_kfree_skb_irq(myFirstTxDesc->skb); |
1245 | myFirstTxDesc->skb = 0; | 1376 | myFirstTxDesc->skb = 0; |
1246 | myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next); | 1377 | myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next); |
1378 | /* Wake up queue. */ | ||
1379 | netif_wake_queue(dev); | ||
1247 | } | 1380 | } |
1248 | 1381 | ||
1249 | if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma0_eop, active)) { | 1382 | if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma0_eop, active)) { |
1250 | /* acknowledge the eop interrupt and wake up queue */ | 1383 | /* acknowledge the eop interrupt. */ |
1251 | *R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do); | 1384 | *R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do); |
1252 | netif_wake_queue(dev); | ||
1253 | } | 1385 | } |
1254 | 1386 | ||
1255 | /* Enable RX/TX IRQs again */ | ||
1256 | *R_IRQ_MASK2_SET = | ||
1257 | IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set) | | ||
1258 | IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set); | ||
1259 | |||
1260 | return IRQ_HANDLED; | 1387 | return IRQ_HANDLED; |
1261 | } | 1388 | } |
1262 | 1389 | ||
@@ -1264,7 +1391,7 @@ static irqreturn_t | |||
1264 | e100nw_interrupt(int irq, void *dev_id) | 1391 | e100nw_interrupt(int irq, void *dev_id) |
1265 | { | 1392 | { |
1266 | struct net_device *dev = (struct net_device *)dev_id; | 1393 | struct net_device *dev = (struct net_device *)dev_id; |
1267 | struct net_local *np = (struct net_local *)dev->priv; | 1394 | struct net_local *np = netdev_priv(dev); |
1268 | unsigned long irqbits = *R_IRQ_MASK0_RD; | 1395 | unsigned long irqbits = *R_IRQ_MASK0_RD; |
1269 | 1396 | ||
1270 | /* check for underrun irq */ | 1397 | /* check for underrun irq */ |
@@ -1286,7 +1413,6 @@ e100nw_interrupt(int irq, void *dev_id) | |||
1286 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr); | 1413 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr); |
1287 | *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; | 1414 | *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; |
1288 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop); | 1415 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop); |
1289 | *R_NETWORK_TR_CTRL = IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr); | ||
1290 | np->stats.tx_errors++; | 1416 | np->stats.tx_errors++; |
1291 | D(printk("ethernet excessive collisions!\n")); | 1417 | D(printk("ethernet excessive collisions!\n")); |
1292 | } | 1418 | } |
@@ -1299,12 +1425,13 @@ e100_rx(struct net_device *dev) | |||
1299 | { | 1425 | { |
1300 | struct sk_buff *skb; | 1426 | struct sk_buff *skb; |
1301 | int length = 0; | 1427 | int length = 0; |
1302 | struct net_local *np = (struct net_local *)dev->priv; | 1428 | struct net_local *np = netdev_priv(dev); |
1303 | unsigned char *skb_data_ptr; | 1429 | unsigned char *skb_data_ptr; |
1304 | #ifdef ETHDEBUG | 1430 | #ifdef ETHDEBUG |
1305 | int i; | 1431 | int i; |
1306 | #endif | 1432 | #endif |
1307 | 1433 | etrax_eth_descr *prevRxDesc; /* The descriptor right before myNextRxDesc */ | |
1434 | spin_lock(&np->led_lock); | ||
1308 | if (!led_active && time_after(jiffies, led_next_time)) { | 1435 | if (!led_active && time_after(jiffies, led_next_time)) { |
1309 | /* light the network leds depending on the current speed. */ | 1436 | /* light the network leds depending on the current speed. */ |
1310 | e100_set_network_leds(NETWORK_ACTIVITY); | 1437 | e100_set_network_leds(NETWORK_ACTIVITY); |
@@ -1314,9 +1441,10 @@ e100_rx(struct net_device *dev) | |||
1314 | led_active = 1; | 1441 | led_active = 1; |
1315 | mod_timer(&clear_led_timer, jiffies + HZ/10); | 1442 | mod_timer(&clear_led_timer, jiffies + HZ/10); |
1316 | } | 1443 | } |
1444 | spin_unlock(&np->led_lock); | ||
1317 | 1445 | ||
1318 | length = myNextRxDesc->descr.hw_len - 4; | 1446 | length = myNextRxDesc->descr.hw_len - 4; |
1319 | ((struct net_local *)dev->priv)->stats.rx_bytes += length; | 1447 | np->stats.rx_bytes += length; |
1320 | 1448 | ||
1321 | #ifdef ETHDEBUG | 1449 | #ifdef ETHDEBUG |
1322 | printk("Got a packet of length %d:\n", length); | 1450 | printk("Got a packet of length %d:\n", length); |
@@ -1336,7 +1464,7 @@ e100_rx(struct net_device *dev) | |||
1336 | if (!skb) { | 1464 | if (!skb) { |
1337 | np->stats.rx_errors++; | 1465 | np->stats.rx_errors++; |
1338 | printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); | 1466 | printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); |
1339 | return; | 1467 | goto update_nextrxdesc; |
1340 | } | 1468 | } |
1341 | 1469 | ||
1342 | skb_put(skb, length - ETHER_HEAD_LEN); /* allocate room for the packet body */ | 1470 | skb_put(skb, length - ETHER_HEAD_LEN); /* allocate room for the packet body */ |
@@ -1354,15 +1482,15 @@ e100_rx(struct net_device *dev) | |||
1354 | else { | 1482 | else { |
1355 | /* Large packet, send directly to upper layers and allocate new | 1483 | /* Large packet, send directly to upper layers and allocate new |
1356 | * memory (aligned to cache line boundary to avoid bug). | 1484 | * memory (aligned to cache line boundary to avoid bug). |
1357 | * Before sending the skb to upper layers we must make sure that | 1485 | * Before sending the skb to upper layers we must make sure |
1358 | * skb->data points to the aligned start of the packet. | 1486 | * that skb->data points to the aligned start of the packet. |
1359 | */ | 1487 | */ |
1360 | int align; | 1488 | int align; |
1361 | struct sk_buff *new_skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES); | 1489 | struct sk_buff *new_skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES); |
1362 | if (!new_skb) { | 1490 | if (!new_skb) { |
1363 | np->stats.rx_errors++; | 1491 | np->stats.rx_errors++; |
1364 | printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); | 1492 | printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); |
1365 | return; | 1493 | goto update_nextrxdesc; |
1366 | } | 1494 | } |
1367 | skb = myNextRxDesc->skb; | 1495 | skb = myNextRxDesc->skb; |
1368 | align = (int)phys_to_virt(myNextRxDesc->descr.buf) - (int)skb->data; | 1496 | align = (int)phys_to_virt(myNextRxDesc->descr.buf) - (int)skb->data; |
@@ -1377,9 +1505,10 @@ e100_rx(struct net_device *dev) | |||
1377 | /* Send the packet to the upper layers */ | 1505 | /* Send the packet to the upper layers */ |
1378 | netif_rx(skb); | 1506 | netif_rx(skb); |
1379 | 1507 | ||
1508 | update_nextrxdesc: | ||
1380 | /* Prepare for next packet */ | 1509 | /* Prepare for next packet */ |
1381 | myNextRxDesc->descr.status = 0; | 1510 | myNextRxDesc->descr.status = 0; |
1382 | myPrevRxDesc = myNextRxDesc; | 1511 | prevRxDesc = myNextRxDesc; |
1383 | myNextRxDesc = phys_to_virt(myNextRxDesc->descr.next); | 1512 | myNextRxDesc = phys_to_virt(myNextRxDesc->descr.next); |
1384 | 1513 | ||
1385 | rx_queue_len++; | 1514 | rx_queue_len++; |
@@ -1387,9 +1516,9 @@ e100_rx(struct net_device *dev) | |||
1387 | /* Check if descriptors should be returned */ | 1516 | /* Check if descriptors should be returned */ |
1388 | if (rx_queue_len == RX_QUEUE_THRESHOLD) { | 1517 | if (rx_queue_len == RX_QUEUE_THRESHOLD) { |
1389 | flush_etrax_cache(); | 1518 | flush_etrax_cache(); |
1390 | myPrevRxDesc->descr.ctrl |= d_eol; | 1519 | prevRxDesc->descr.ctrl |= d_eol; |
1391 | myLastRxDesc->descr.ctrl &= ~d_eol; | 1520 | myLastRxDesc->descr.ctrl &= ~d_eol; |
1392 | myLastRxDesc = myPrevRxDesc; | 1521 | myLastRxDesc = prevRxDesc; |
1393 | rx_queue_len = 0; | 1522 | rx_queue_len = 0; |
1394 | } | 1523 | } |
1395 | } | 1524 | } |
@@ -1398,7 +1527,7 @@ e100_rx(struct net_device *dev) | |||
1398 | static int | 1527 | static int |
1399 | e100_close(struct net_device *dev) | 1528 | e100_close(struct net_device *dev) |
1400 | { | 1529 | { |
1401 | struct net_local *np = (struct net_local *)dev->priv; | 1530 | struct net_local *np = netdev_priv(dev); |
1402 | 1531 | ||
1403 | printk(KERN_INFO "Closing %s.\n", dev->name); | 1532 | printk(KERN_INFO "Closing %s.\n", dev->name); |
1404 | 1533 | ||
@@ -1426,6 +1555,9 @@ e100_close(struct net_device *dev) | |||
1426 | free_irq(NETWORK_DMA_TX_IRQ_NBR, (void *)dev); | 1555 | free_irq(NETWORK_DMA_TX_IRQ_NBR, (void *)dev); |
1427 | free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev); | 1556 | free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev); |
1428 | 1557 | ||
1558 | cris_free_dma(NETWORK_TX_DMA_NBR, cardname); | ||
1559 | cris_free_dma(NETWORK_RX_DMA_NBR, cardname); | ||
1560 | |||
1429 | /* Update the statistics here. */ | 1561 | /* Update the statistics here. */ |
1430 | 1562 | ||
1431 | update_rx_stats(&np->stats); | 1563 | update_rx_stats(&np->stats); |
@@ -1443,18 +1575,11 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1443 | { | 1575 | { |
1444 | struct mii_ioctl_data *data = if_mii(ifr); | 1576 | struct mii_ioctl_data *data = if_mii(ifr); |
1445 | struct net_local *np = netdev_priv(dev); | 1577 | struct net_local *np = netdev_priv(dev); |
1578 | int rc = 0; | ||
1579 | int old_autoneg; | ||
1446 | 1580 | ||
1447 | spin_lock(&np->lock); /* Preempt protection */ | 1581 | spin_lock(&np->lock); /* Preempt protection */ |
1448 | switch (cmd) { | 1582 | switch (cmd) { |
1449 | case SIOCGMIIPHY: /* Get PHY address */ | ||
1450 | data->phy_id = mdio_phy_addr; | ||
1451 | break; | ||
1452 | case SIOCGMIIREG: /* Read MII register */ | ||
1453 | data->val_out = e100_get_mdio_reg(dev, mdio_phy_addr, data->reg_num); | ||
1454 | break; | ||
1455 | case SIOCSMIIREG: /* Write MII register */ | ||
1456 | e100_set_mdio_reg(dev, mdio_phy_addr, data->reg_num, data->val_in); | ||
1457 | break; | ||
1458 | /* The ioctls below should be considered obsolete but are */ | 1583 | /* The ioctls below should be considered obsolete but are */ |
1459 | /* still present for compatability with old scripts/apps */ | 1584 | /* still present for compatability with old scripts/apps */ |
1460 | case SET_ETH_SPEED_10: /* 10 Mbps */ | 1585 | case SET_ETH_SPEED_10: /* 10 Mbps */ |
@@ -1463,60 +1588,47 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1463 | case SET_ETH_SPEED_100: /* 100 Mbps */ | 1588 | case SET_ETH_SPEED_100: /* 100 Mbps */ |
1464 | e100_set_speed(dev, 100); | 1589 | e100_set_speed(dev, 100); |
1465 | break; | 1590 | break; |
1466 | case SET_ETH_SPEED_AUTO: /* Auto negotiate speed */ | 1591 | case SET_ETH_SPEED_AUTO: /* Auto-negotiate speed */ |
1467 | e100_set_speed(dev, 0); | 1592 | e100_set_speed(dev, 0); |
1468 | break; | 1593 | break; |
1469 | case SET_ETH_DUPLEX_HALF: /* Half duplex. */ | 1594 | case SET_ETH_DUPLEX_HALF: /* Half duplex */ |
1470 | e100_set_duplex(dev, half); | 1595 | e100_set_duplex(dev, half); |
1471 | break; | 1596 | break; |
1472 | case SET_ETH_DUPLEX_FULL: /* Full duplex. */ | 1597 | case SET_ETH_DUPLEX_FULL: /* Full duplex */ |
1473 | e100_set_duplex(dev, full); | 1598 | e100_set_duplex(dev, full); |
1474 | break; | 1599 | break; |
1475 | case SET_ETH_DUPLEX_AUTO: /* Autonegotiate duplex*/ | 1600 | case SET_ETH_DUPLEX_AUTO: /* Auto-negotiate duplex */ |
1476 | e100_set_duplex(dev, autoneg); | 1601 | e100_set_duplex(dev, autoneg); |
1477 | break; | 1602 | break; |
1603 | case SET_ETH_AUTONEG: | ||
1604 | old_autoneg = autoneg_normal; | ||
1605 | autoneg_normal = *(int*)data; | ||
1606 | if (autoneg_normal != old_autoneg) | ||
1607 | e100_negotiate(dev); | ||
1608 | break; | ||
1478 | default: | 1609 | default: |
1479 | return -EINVAL; | 1610 | rc = generic_mii_ioctl(&np->mii_if, if_mii(ifr), |
1611 | cmd, NULL); | ||
1612 | break; | ||
1480 | } | 1613 | } |
1481 | spin_unlock(&np->lock); | 1614 | spin_unlock(&np->lock); |
1482 | return 0; | 1615 | return rc; |
1483 | } | 1616 | } |
1484 | 1617 | ||
1485 | static int e100_set_settings(struct net_device *dev, | 1618 | static int e100_get_settings(struct net_device *dev, |
1486 | struct ethtool_cmd *ecmd) | 1619 | struct ethtool_cmd *cmd) |
1487 | { | 1620 | { |
1488 | ecmd->supported = SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII | | 1621 | struct net_local *np = netdev_priv(dev); |
1489 | SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | | 1622 | int err; |
1490 | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full; | ||
1491 | ecmd->port = PORT_TP; | ||
1492 | ecmd->transceiver = XCVR_EXTERNAL; | ||
1493 | ecmd->phy_address = mdio_phy_addr; | ||
1494 | ecmd->speed = current_speed; | ||
1495 | ecmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; | ||
1496 | ecmd->advertising = ADVERTISED_TP; | ||
1497 | 1623 | ||
1498 | if (current_duplex == autoneg && current_speed_selection == 0) | 1624 | spin_lock_irq(&np->lock); |
1499 | ecmd->advertising |= ADVERTISED_Autoneg; | 1625 | err = mii_ethtool_gset(&np->mii_if, cmd); |
1500 | else { | 1626 | spin_unlock_irq(&np->lock); |
1501 | ecmd->advertising |= | ||
1502 | ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | ||
1503 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; | ||
1504 | if (current_speed_selection == 10) | ||
1505 | ecmd->advertising &= ~(ADVERTISED_100baseT_Half | | ||
1506 | ADVERTISED_100baseT_Full); | ||
1507 | else if (current_speed_selection == 100) | ||
1508 | ecmd->advertising &= ~(ADVERTISED_10baseT_Half | | ||
1509 | ADVERTISED_10baseT_Full); | ||
1510 | if (current_duplex == half) | ||
1511 | ecmd->advertising &= ~(ADVERTISED_10baseT_Full | | ||
1512 | ADVERTISED_100baseT_Full); | ||
1513 | else if (current_duplex == full) | ||
1514 | ecmd->advertising &= ~(ADVERTISED_10baseT_Half | | ||
1515 | ADVERTISED_100baseT_Half); | ||
1516 | } | ||
1517 | 1627 | ||
1518 | ecmd->autoneg = AUTONEG_ENABLE; | 1628 | /* The PHY may support 1000baseT, but the Etrax100 does not. */ |
1519 | return 0; | 1629 | cmd->supported &= ~(SUPPORTED_1000baseT_Half |
1630 | | SUPPORTED_1000baseT_Full); | ||
1631 | return err; | ||
1520 | } | 1632 | } |
1521 | 1633 | ||
1522 | static int e100_set_settings(struct net_device *dev, | 1634 | static int e100_set_settings(struct net_device *dev, |
@@ -1560,7 +1672,8 @@ static const struct ethtool_ops e100_ethtool_ops = { | |||
1560 | static int | 1672 | static int |
1561 | e100_set_config(struct net_device *dev, struct ifmap *map) | 1673 | e100_set_config(struct net_device *dev, struct ifmap *map) |
1562 | { | 1674 | { |
1563 | struct net_local *np = (struct net_local *)dev->priv; | 1675 | struct net_local *np = netdev_priv(dev); |
1676 | |||
1564 | spin_lock(&np->lock); /* Preempt protection */ | 1677 | spin_lock(&np->lock); /* Preempt protection */ |
1565 | 1678 | ||
1566 | switch(map->port) { | 1679 | switch(map->port) { |
@@ -1612,7 +1725,6 @@ update_tx_stats(struct net_device_stats *es) | |||
1612 | es->collisions += | 1725 | es->collisions += |
1613 | IO_EXTRACT(R_TR_COUNTERS, single_col, r) + | 1726 | IO_EXTRACT(R_TR_COUNTERS, single_col, r) + |
1614 | IO_EXTRACT(R_TR_COUNTERS, multiple_col, r); | 1727 | IO_EXTRACT(R_TR_COUNTERS, multiple_col, r); |
1615 | es->tx_errors += IO_EXTRACT(R_TR_COUNTERS, deferred, r); | ||
1616 | } | 1728 | } |
1617 | 1729 | ||
1618 | /* | 1730 | /* |
@@ -1622,8 +1734,9 @@ update_tx_stats(struct net_device_stats *es) | |||
1622 | static struct net_device_stats * | 1734 | static struct net_device_stats * |
1623 | e100_get_stats(struct net_device *dev) | 1735 | e100_get_stats(struct net_device *dev) |
1624 | { | 1736 | { |
1625 | struct net_local *lp = (struct net_local *)dev->priv; | 1737 | struct net_local *lp = netdev_priv(dev); |
1626 | unsigned long flags; | 1738 | unsigned long flags; |
1739 | |||
1627 | spin_lock_irqsave(&lp->lock, flags); | 1740 | spin_lock_irqsave(&lp->lock, flags); |
1628 | 1741 | ||
1629 | update_rx_stats(&lp->stats); | 1742 | update_rx_stats(&lp->stats); |
@@ -1643,13 +1756,13 @@ e100_get_stats(struct net_device *dev) | |||
1643 | static void | 1756 | static void |
1644 | set_multicast_list(struct net_device *dev) | 1757 | set_multicast_list(struct net_device *dev) |
1645 | { | 1758 | { |
1646 | struct net_local *lp = (struct net_local *)dev->priv; | 1759 | struct net_local *lp = netdev_priv(dev); |
1647 | int num_addr = dev->mc_count; | 1760 | int num_addr = dev->mc_count; |
1648 | unsigned long int lo_bits; | 1761 | unsigned long int lo_bits; |
1649 | unsigned long int hi_bits; | 1762 | unsigned long int hi_bits; |
1763 | |||
1650 | spin_lock(&lp->lock); | 1764 | spin_lock(&lp->lock); |
1651 | if (dev->flags & IFF_PROMISC) | 1765 | if (dev->flags & IFF_PROMISC) { |
1652 | { | ||
1653 | /* promiscuous mode */ | 1766 | /* promiscuous mode */ |
1654 | lo_bits = 0xfffffffful; | 1767 | lo_bits = 0xfffffffful; |
1655 | hi_bits = 0xfffffffful; | 1768 | hi_bits = 0xfffffffful; |
@@ -1679,9 +1792,10 @@ set_multicast_list(struct net_device *dev) | |||
1679 | struct dev_mc_list *dmi = dev->mc_list; | 1792 | struct dev_mc_list *dmi = dev->mc_list; |
1680 | int i; | 1793 | int i; |
1681 | char *baddr; | 1794 | char *baddr; |
1795 | |||
1682 | lo_bits = 0x00000000ul; | 1796 | lo_bits = 0x00000000ul; |
1683 | hi_bits = 0x00000000ul; | 1797 | hi_bits = 0x00000000ul; |
1684 | for (i=0; i<num_addr; i++) { | 1798 | for (i = 0; i < num_addr; i++) { |
1685 | /* Calculate the hash index for the GA registers */ | 1799 | /* Calculate the hash index for the GA registers */ |
1686 | 1800 | ||
1687 | hash_ix = 0; | 1801 | hash_ix = 0; |
@@ -1708,8 +1822,7 @@ set_multicast_list(struct net_device *dev) | |||
1708 | 1822 | ||
1709 | if (hash_ix >= 32) { | 1823 | if (hash_ix >= 32) { |
1710 | hi_bits |= (1 << (hash_ix-32)); | 1824 | hi_bits |= (1 << (hash_ix-32)); |
1711 | } | 1825 | } else { |
1712 | else { | ||
1713 | lo_bits |= (1 << hash_ix); | 1826 | lo_bits |= (1 << hash_ix); |
1714 | } | 1827 | } |
1715 | dmi = dmi->next; | 1828 | dmi = dmi->next; |
@@ -1724,10 +1837,11 @@ set_multicast_list(struct net_device *dev) | |||
1724 | } | 1837 | } |
1725 | 1838 | ||
1726 | void | 1839 | void |
1727 | e100_hardware_send_packet(char *buf, int length) | 1840 | e100_hardware_send_packet(struct net_local *np, char *buf, int length) |
1728 | { | 1841 | { |
1729 | D(printk("e100 send pack, buf 0x%x len %d\n", buf, length)); | 1842 | D(printk("e100 send pack, buf 0x%x len %d\n", buf, length)); |
1730 | 1843 | ||
1844 | spin_lock(&np->led_lock); | ||
1731 | if (!led_active && time_after(jiffies, led_next_time)) { | 1845 | if (!led_active && time_after(jiffies, led_next_time)) { |
1732 | /* light the network leds depending on the current speed. */ | 1846 | /* light the network leds depending on the current speed. */ |
1733 | e100_set_network_leds(NETWORK_ACTIVITY); | 1847 | e100_set_network_leds(NETWORK_ACTIVITY); |
@@ -1737,6 +1851,7 @@ e100_hardware_send_packet(char *buf, int length) | |||
1737 | led_active = 1; | 1851 | led_active = 1; |
1738 | mod_timer(&clear_led_timer, jiffies + HZ/10); | 1852 | mod_timer(&clear_led_timer, jiffies + HZ/10); |
1739 | } | 1853 | } |
1854 | spin_unlock(&np->led_lock); | ||
1740 | 1855 | ||
1741 | /* configure the tx dma descriptor */ | 1856 | /* configure the tx dma descriptor */ |
1742 | myNextTxDesc->descr.sw_len = length; | 1857 | myNextTxDesc->descr.sw_len = length; |
@@ -1754,6 +1869,11 @@ e100_hardware_send_packet(char *buf, int length) | |||
1754 | static void | 1869 | static void |
1755 | e100_clear_network_leds(unsigned long dummy) | 1870 | e100_clear_network_leds(unsigned long dummy) |
1756 | { | 1871 | { |
1872 | struct net_device *dev = (struct net_device *)dummy; | ||
1873 | struct net_local *np = netdev_priv(dev); | ||
1874 | |||
1875 | spin_lock(&np->led_lock); | ||
1876 | |||
1757 | if (led_active && time_after(jiffies, led_next_time)) { | 1877 | if (led_active && time_after(jiffies, led_next_time)) { |
1758 | e100_set_network_leds(NO_NETWORK_ACTIVITY); | 1878 | e100_set_network_leds(NO_NETWORK_ACTIVITY); |
1759 | 1879 | ||
@@ -1761,6 +1881,8 @@ e100_clear_network_leds(unsigned long dummy) | |||
1761 | led_next_time = jiffies + NET_FLASH_PAUSE; | 1881 | led_next_time = jiffies + NET_FLASH_PAUSE; |
1762 | led_active = 0; | 1882 | led_active = 0; |
1763 | } | 1883 | } |
1884 | |||
1885 | spin_unlock(&np->led_lock); | ||
1764 | } | 1886 | } |
1765 | 1887 | ||
1766 | static void | 1888 | static void |
@@ -1781,19 +1903,25 @@ e100_set_network_leds(int active) | |||
1781 | #else | 1903 | #else |
1782 | LED_NETWORK_SET(LED_OFF); | 1904 | LED_NETWORK_SET(LED_OFF); |
1783 | #endif | 1905 | #endif |
1784 | } | 1906 | } else if (light_leds) { |
1785 | else if (light_leds) { | ||
1786 | if (current_speed == 10) { | 1907 | if (current_speed == 10) { |
1787 | LED_NETWORK_SET(LED_ORANGE); | 1908 | LED_NETWORK_SET(LED_ORANGE); |
1788 | } else { | 1909 | } else { |
1789 | LED_NETWORK_SET(LED_GREEN); | 1910 | LED_NETWORK_SET(LED_GREEN); |
1790 | } | 1911 | } |
1791 | } | 1912 | } else { |
1792 | else { | ||
1793 | LED_NETWORK_SET(LED_OFF); | 1913 | LED_NETWORK_SET(LED_OFF); |
1794 | } | 1914 | } |
1795 | } | 1915 | } |
1796 | 1916 | ||
1917 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1918 | static void | ||
1919 | e100_netpoll(struct net_device* netdev) | ||
1920 | { | ||
1921 | e100rxtx_interrupt(NETWORK_DMA_TX_IRQ_NBR, netdev, NULL); | ||
1922 | } | ||
1923 | #endif | ||
1924 | |||
1797 | static int | 1925 | static int |
1798 | etrax_init_module(void) | 1926 | etrax_init_module(void) |
1799 | { | 1927 | { |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 72deff0d4d90..cf39473ef90a 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -4804,6 +4804,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4804 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | 4804 | spin_unlock_irqrestore(&adapter->stats_lock, flags); |
4805 | return -EIO; | 4805 | return -EIO; |
4806 | } | 4806 | } |
4807 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | ||
4807 | if (adapter->hw.media_type == e1000_media_type_copper) { | 4808 | if (adapter->hw.media_type == e1000_media_type_copper) { |
4808 | switch (data->reg_num) { | 4809 | switch (data->reg_num) { |
4809 | case PHY_CTRL: | 4810 | case PHY_CTRL: |
@@ -4824,12 +4825,8 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4824 | DUPLEX_HALF; | 4825 | DUPLEX_HALF; |
4825 | retval = e1000_set_spd_dplx(adapter, | 4826 | retval = e1000_set_spd_dplx(adapter, |
4826 | spddplx); | 4827 | spddplx); |
4827 | if (retval) { | 4828 | if (retval) |
4828 | spin_unlock_irqrestore( | ||
4829 | &adapter->stats_lock, | ||
4830 | flags); | ||
4831 | return retval; | 4829 | return retval; |
4832 | } | ||
4833 | } | 4830 | } |
4834 | if (netif_running(adapter->netdev)) | 4831 | if (netif_running(adapter->netdev)) |
4835 | e1000_reinit_locked(adapter); | 4832 | e1000_reinit_locked(adapter); |
@@ -4838,11 +4835,8 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4838 | break; | 4835 | break; |
4839 | case M88E1000_PHY_SPEC_CTRL: | 4836 | case M88E1000_PHY_SPEC_CTRL: |
4840 | case M88E1000_EXT_PHY_SPEC_CTRL: | 4837 | case M88E1000_EXT_PHY_SPEC_CTRL: |
4841 | if (e1000_phy_reset(&adapter->hw)) { | 4838 | if (e1000_phy_reset(&adapter->hw)) |
4842 | spin_unlock_irqrestore( | ||
4843 | &adapter->stats_lock, flags); | ||
4844 | return -EIO; | 4839 | return -EIO; |
4845 | } | ||
4846 | break; | 4840 | break; |
4847 | } | 4841 | } |
4848 | } else { | 4842 | } else { |
@@ -4857,7 +4851,6 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4857 | break; | 4851 | break; |
4858 | } | 4852 | } |
4859 | } | 4853 | } |
4860 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | ||
4861 | break; | 4854 | break; |
4862 | default: | 4855 | default: |
4863 | return -EOPNOTSUPP; | 4856 | return -EOPNOTSUPP; |
diff --git a/drivers/net/fs_enet/Kconfig b/drivers/net/fs_enet/Kconfig index 2765e49e07df..562ea68ed99b 100644 --- a/drivers/net/fs_enet/Kconfig +++ b/drivers/net/fs_enet/Kconfig | |||
@@ -2,6 +2,7 @@ config FS_ENET | |||
2 | tristate "Freescale Ethernet Driver" | 2 | tristate "Freescale Ethernet Driver" |
3 | depends on CPM1 || CPM2 | 3 | depends on CPM1 || CPM2 |
4 | select MII | 4 | select MII |
5 | select PHYLIB | ||
5 | 6 | ||
6 | config FS_ENET_HAS_SCC | 7 | config FS_ENET_HAS_SCC |
7 | bool "Chip has an SCC usable for ethernet" | 8 | bool "Chip has an SCC usable for ethernet" |
@@ -11,11 +12,19 @@ config FS_ENET_HAS_SCC | |||
11 | config FS_ENET_HAS_FCC | 12 | config FS_ENET_HAS_FCC |
12 | bool "Chip has an FCC usable for ethernet" | 13 | bool "Chip has an FCC usable for ethernet" |
13 | depends on FS_ENET && CPM2 | 14 | depends on FS_ENET && CPM2 |
14 | select MDIO_BITBANG | ||
15 | default y | 15 | default y |
16 | 16 | ||
17 | config FS_ENET_HAS_FEC | 17 | config FS_ENET_HAS_FEC |
18 | bool "Chip has an FEC usable for ethernet" | 18 | bool "Chip has an FEC usable for ethernet" |
19 | depends on FS_ENET && CPM1 | 19 | depends on FS_ENET && CPM1 |
20 | select FS_ENET_MDIO_FEC | ||
20 | default y | 21 | default y |
21 | 22 | ||
23 | config FS_ENET_MDIO_FEC | ||
24 | tristate "MDIO driver for FEC" | ||
25 | depends on FS_ENET && CPM1 | ||
26 | |||
27 | config FS_ENET_MDIO_FCC | ||
28 | tristate "MDIO driver for FCC" | ||
29 | depends on FS_ENET && CPM2 | ||
30 | select MDIO_BITBANG | ||
diff --git a/drivers/net/fs_enet/Makefile b/drivers/net/fs_enet/Makefile index 02d4dc18ba69..1ffbe0756a0c 100644 --- a/drivers/net/fs_enet/Makefile +++ b/drivers/net/fs_enet/Makefile | |||
@@ -4,7 +4,16 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_FS_ENET) += fs_enet.o | 5 | obj-$(CONFIG_FS_ENET) += fs_enet.o |
6 | 6 | ||
7 | obj-$(CONFIG_8xx) += mac-fec.o mac-scc.o mii-fec.o | 7 | fs_enet-$(CONFIG_FS_ENET_HAS_SCC) += mac-scc.o |
8 | obj-$(CONFIG_CPM2) += mac-fcc.o mii-bitbang.o | 8 | fs_enet-$(CONFIG_FS_ENET_HAS_FEC) += mac-fec.o |
9 | fs_enet-$(CONFIG_FS_ENET_HAS_FCC) += mac-fcc.o | ||
9 | 10 | ||
10 | fs_enet-objs := fs_enet-main.o | 11 | ifeq ($(CONFIG_PPC_CPM_NEW_BINDING),y) |
12 | obj-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o | ||
13 | obj-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o | ||
14 | else | ||
15 | fs_enet-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o | ||
16 | fs_enet-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o | ||
17 | endif | ||
18 | |||
19 | fs_enet-objs := fs_enet-main.o $(fs_enet-m) | ||
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 45f30a2974b8..662b8d16803c 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -284,7 +284,7 @@ static __net_exit void loopback_net_exit(struct net *net) | |||
284 | unregister_netdev(dev); | 284 | unregister_netdev(dev); |
285 | } | 285 | } |
286 | 286 | ||
287 | static struct pernet_operations loopback_net_ops = { | 287 | static struct pernet_operations __net_initdata loopback_net_ops = { |
288 | .init = loopback_net_init, | 288 | .init = loopback_net_init, |
289 | .exit = loopback_net_exit, | 289 | .exit = loopback_net_exit, |
290 | }; | 290 | }; |
diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c index f8d63d39f592..b226e019bc8b 100644 --- a/drivers/net/mlx4/alloc.c +++ b/drivers/net/mlx4/alloc.c | |||
@@ -171,9 +171,10 @@ void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf) | |||
171 | buf->u.direct.map); | 171 | buf->u.direct.map); |
172 | else { | 172 | else { |
173 | for (i = 0; i < buf->nbufs; ++i) | 173 | for (i = 0; i < buf->nbufs; ++i) |
174 | dma_free_coherent(&dev->pdev->dev, PAGE_SIZE, | 174 | if (buf->u.page_list[i].buf) |
175 | buf->u.page_list[i].buf, | 175 | dma_free_coherent(&dev->pdev->dev, PAGE_SIZE, |
176 | buf->u.page_list[i].map); | 176 | buf->u.page_list[i].buf, |
177 | buf->u.page_list[i].map); | ||
177 | kfree(buf->u.page_list); | 178 | kfree(buf->u.page_list); |
178 | } | 179 | } |
179 | } | 180 | } |
diff --git a/drivers/net/mlx4/qp.c b/drivers/net/mlx4/qp.c index cc4b1be18219..42b47639c81c 100644 --- a/drivers/net/mlx4/qp.c +++ b/drivers/net/mlx4/qp.c | |||
@@ -240,7 +240,7 @@ void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp) | |||
240 | mlx4_table_put(dev, &qp_table->auxc_table, qp->qpn); | 240 | mlx4_table_put(dev, &qp_table->auxc_table, qp->qpn); |
241 | mlx4_table_put(dev, &qp_table->qp_table, qp->qpn); | 241 | mlx4_table_put(dev, &qp_table->qp_table, qp->qpn); |
242 | 242 | ||
243 | if (qp->qpn < dev->caps.sqp_start + 8) | 243 | if (qp->qpn >= dev->caps.sqp_start + 8) |
244 | mlx4_bitmap_free(&qp_table->bitmap, qp->qpn); | 244 | mlx4_bitmap_free(&qp_table->bitmap, qp->qpn); |
245 | } | 245 | } |
246 | EXPORT_SYMBOL_GPL(mlx4_qp_free); | 246 | EXPORT_SYMBOL_GPL(mlx4_qp_free); |
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c index 8d29319cc5cb..656a260fc956 100644 --- a/drivers/net/myri_sbus.c +++ b/drivers/net/myri_sbus.c | |||
@@ -134,7 +134,7 @@ static int myri_do_handshake(struct myri_eth *mp) | |||
134 | 134 | ||
135 | myri_disable_irq(mp->lregs, cregs); | 135 | myri_disable_irq(mp->lregs, cregs); |
136 | 136 | ||
137 | while (tick++ <= 25) { | 137 | while (tick++ < 25) { |
138 | u32 softstate; | 138 | u32 softstate; |
139 | 139 | ||
140 | /* Wake it up. */ | 140 | /* Wake it up. */ |
diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c index eb0aff787dfd..5267e031daa0 100644 --- a/drivers/net/netx-eth.c +++ b/drivers/net/netx-eth.c | |||
@@ -128,8 +128,8 @@ netx_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
128 | FIFO_PTR_FRAMELEN(len)); | 128 | FIFO_PTR_FRAMELEN(len)); |
129 | 129 | ||
130 | ndev->trans_start = jiffies; | 130 | ndev->trans_start = jiffies; |
131 | dev->stats.tx_packets++; | 131 | ndev->stats.tx_packets++; |
132 | dev->stats.tx_bytes += skb->len; | 132 | ndev->stats.tx_bytes += skb->len; |
133 | 133 | ||
134 | netif_stop_queue(ndev); | 134 | netif_stop_queue(ndev); |
135 | spin_unlock_irq(&priv->lock); | 135 | spin_unlock_irq(&priv->lock); |
@@ -155,7 +155,7 @@ static void netx_eth_receive(struct net_device *ndev) | |||
155 | if (unlikely(skb == NULL)) { | 155 | if (unlikely(skb == NULL)) { |
156 | printk(KERN_NOTICE "%s: Low memory, packet dropped.\n", | 156 | printk(KERN_NOTICE "%s: Low memory, packet dropped.\n", |
157 | ndev->name); | 157 | ndev->name); |
158 | dev->stats.rx_dropped++; | 158 | ndev->stats.rx_dropped++; |
159 | return; | 159 | return; |
160 | } | 160 | } |
161 | 161 | ||
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 8d278c87ba48..f023d5b67e6e 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -160,7 +160,7 @@ ppp_asynctty_open(struct tty_struct *tty) | |||
160 | 160 | ||
161 | err = -ENOMEM; | 161 | err = -ENOMEM; |
162 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 162 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
163 | if (ap == 0) | 163 | if (!ap) |
164 | goto out; | 164 | goto out; |
165 | 165 | ||
166 | /* initialize the asyncppp structure */ | 166 | /* initialize the asyncppp structure */ |
@@ -215,7 +215,7 @@ ppp_asynctty_close(struct tty_struct *tty) | |||
215 | ap = tty->disc_data; | 215 | ap = tty->disc_data; |
216 | tty->disc_data = NULL; | 216 | tty->disc_data = NULL; |
217 | write_unlock_irq(&disc_data_lock); | 217 | write_unlock_irq(&disc_data_lock); |
218 | if (ap == 0) | 218 | if (!ap) |
219 | return; | 219 | return; |
220 | 220 | ||
221 | /* | 221 | /* |
@@ -230,10 +230,10 @@ ppp_asynctty_close(struct tty_struct *tty) | |||
230 | tasklet_kill(&ap->tsk); | 230 | tasklet_kill(&ap->tsk); |
231 | 231 | ||
232 | ppp_unregister_channel(&ap->chan); | 232 | ppp_unregister_channel(&ap->chan); |
233 | if (ap->rpkt != 0) | 233 | if (ap->rpkt) |
234 | kfree_skb(ap->rpkt); | 234 | kfree_skb(ap->rpkt); |
235 | skb_queue_purge(&ap->rqueue); | 235 | skb_queue_purge(&ap->rqueue); |
236 | if (ap->tpkt != 0) | 236 | if (ap->tpkt) |
237 | kfree_skb(ap->tpkt); | 237 | kfree_skb(ap->tpkt); |
238 | kfree(ap); | 238 | kfree(ap); |
239 | } | 239 | } |
@@ -285,13 +285,13 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, | |||
285 | int err, val; | 285 | int err, val; |
286 | int __user *p = (int __user *)arg; | 286 | int __user *p = (int __user *)arg; |
287 | 287 | ||
288 | if (ap == 0) | 288 | if (!ap) |
289 | return -ENXIO; | 289 | return -ENXIO; |
290 | err = -EFAULT; | 290 | err = -EFAULT; |
291 | switch (cmd) { | 291 | switch (cmd) { |
292 | case PPPIOCGCHAN: | 292 | case PPPIOCGCHAN: |
293 | err = -ENXIO; | 293 | err = -ENXIO; |
294 | if (ap == 0) | 294 | if (!ap) |
295 | break; | 295 | break; |
296 | err = -EFAULT; | 296 | err = -EFAULT; |
297 | if (put_user(ppp_channel_index(&ap->chan), p)) | 297 | if (put_user(ppp_channel_index(&ap->chan), p)) |
@@ -301,7 +301,7 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, | |||
301 | 301 | ||
302 | case PPPIOCGUNIT: | 302 | case PPPIOCGUNIT: |
303 | err = -ENXIO; | 303 | err = -ENXIO; |
304 | if (ap == 0) | 304 | if (!ap) |
305 | break; | 305 | break; |
306 | err = -EFAULT; | 306 | err = -EFAULT; |
307 | if (put_user(ppp_unit_number(&ap->chan), p)) | 307 | if (put_user(ppp_unit_number(&ap->chan), p)) |
@@ -350,7 +350,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
350 | struct asyncppp *ap = ap_get(tty); | 350 | struct asyncppp *ap = ap_get(tty); |
351 | unsigned long flags; | 351 | unsigned long flags; |
352 | 352 | ||
353 | if (ap == 0) | 353 | if (!ap) |
354 | return; | 354 | return; |
355 | spin_lock_irqsave(&ap->recv_lock, flags); | 355 | spin_lock_irqsave(&ap->recv_lock, flags); |
356 | ppp_async_input(ap, buf, cflags, count); | 356 | ppp_async_input(ap, buf, cflags, count); |
@@ -369,7 +369,7 @@ ppp_asynctty_wakeup(struct tty_struct *tty) | |||
369 | struct asyncppp *ap = ap_get(tty); | 369 | struct asyncppp *ap = ap_get(tty); |
370 | 370 | ||
371 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 371 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
372 | if (ap == 0) | 372 | if (!ap) |
373 | return; | 373 | return; |
374 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); | 374 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); |
375 | tasklet_schedule(&ap->tsk); | 375 | tasklet_schedule(&ap->tsk); |
@@ -684,7 +684,7 @@ ppp_async_push(struct asyncppp *ap) | |||
684 | tty_stuffed = 1; | 684 | tty_stuffed = 1; |
685 | continue; | 685 | continue; |
686 | } | 686 | } |
687 | if (ap->optr >= ap->olim && ap->tpkt != 0) { | 687 | if (ap->optr >= ap->olim && ap->tpkt) { |
688 | if (ppp_async_encode(ap)) { | 688 | if (ppp_async_encode(ap)) { |
689 | /* finished processing ap->tpkt */ | 689 | /* finished processing ap->tpkt */ |
690 | clear_bit(XMIT_FULL, &ap->xmit_flags); | 690 | clear_bit(XMIT_FULL, &ap->xmit_flags); |
@@ -704,7 +704,7 @@ ppp_async_push(struct asyncppp *ap) | |||
704 | clear_bit(XMIT_BUSY, &ap->xmit_flags); | 704 | clear_bit(XMIT_BUSY, &ap->xmit_flags); |
705 | /* any more work to do? if not, exit the loop */ | 705 | /* any more work to do? if not, exit the loop */ |
706 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) | 706 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) |
707 | || (!tty_stuffed && ap->tpkt != 0))) | 707 | || (!tty_stuffed && ap->tpkt))) |
708 | break; | 708 | break; |
709 | /* more work to do, see if we can do it now */ | 709 | /* more work to do, see if we can do it now */ |
710 | if (test_and_set_bit(XMIT_BUSY, &ap->xmit_flags)) | 710 | if (test_and_set_bit(XMIT_BUSY, &ap->xmit_flags)) |
@@ -715,7 +715,7 @@ ppp_async_push(struct asyncppp *ap) | |||
715 | 715 | ||
716 | flush: | 716 | flush: |
717 | clear_bit(XMIT_BUSY, &ap->xmit_flags); | 717 | clear_bit(XMIT_BUSY, &ap->xmit_flags); |
718 | if (ap->tpkt != 0) { | 718 | if (ap->tpkt) { |
719 | kfree_skb(ap->tpkt); | 719 | kfree_skb(ap->tpkt); |
720 | ap->tpkt = NULL; | 720 | ap->tpkt = NULL; |
721 | clear_bit(XMIT_FULL, &ap->xmit_flags); | 721 | clear_bit(XMIT_FULL, &ap->xmit_flags); |
@@ -848,7 +848,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
848 | s = 0; | 848 | s = 0; |
849 | for (i = 0; i < count; ++i) { | 849 | for (i = 0; i < count; ++i) { |
850 | c = buf[i]; | 850 | c = buf[i]; |
851 | if (flags != 0 && flags[i] != 0) | 851 | if (flags && flags[i] != 0) |
852 | continue; | 852 | continue; |
853 | s |= (c & 0x80)? SC_RCV_B7_1: SC_RCV_B7_0; | 853 | s |= (c & 0x80)? SC_RCV_B7_1: SC_RCV_B7_0; |
854 | c = ((c >> 4) ^ c) & 0xf; | 854 | c = ((c >> 4) ^ c) & 0xf; |
@@ -865,7 +865,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
865 | n = scan_ordinary(ap, buf, count); | 865 | n = scan_ordinary(ap, buf, count); |
866 | 866 | ||
867 | f = 0; | 867 | f = 0; |
868 | if (flags != 0 && (ap->state & SC_TOSS) == 0) { | 868 | if (flags && (ap->state & SC_TOSS) == 0) { |
869 | /* check the flags to see if any char had an error */ | 869 | /* check the flags to see if any char had an error */ |
870 | for (j = 0; j < n; ++j) | 870 | for (j = 0; j < n; ++j) |
871 | if ((f = flags[j]) != 0) | 871 | if ((f = flags[j]) != 0) |
@@ -878,9 +878,9 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
878 | } else if (n > 0 && (ap->state & SC_TOSS) == 0) { | 878 | } else if (n > 0 && (ap->state & SC_TOSS) == 0) { |
879 | /* stuff the chars in the skb */ | 879 | /* stuff the chars in the skb */ |
880 | skb = ap->rpkt; | 880 | skb = ap->rpkt; |
881 | if (skb == 0) { | 881 | if (!skb) { |
882 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); | 882 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); |
883 | if (skb == 0) | 883 | if (!skb) |
884 | goto nomem; | 884 | goto nomem; |
885 | ap->rpkt = skb; | 885 | ap->rpkt = skb; |
886 | } | 886 | } |
@@ -927,7 +927,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
927 | ++n; | 927 | ++n; |
928 | 928 | ||
929 | buf += n; | 929 | buf += n; |
930 | if (flags != 0) | 930 | if (flags) |
931 | flags += n; | 931 | flags += n; |
932 | count -= n; | 932 | count -= n; |
933 | } | 933 | } |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 4b49d0e8c7eb..4f690378bb77 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -367,7 +367,7 @@ static int ppp_release(struct inode *inode, struct file *file) | |||
367 | struct ppp_file *pf = file->private_data; | 367 | struct ppp_file *pf = file->private_data; |
368 | struct ppp *ppp; | 368 | struct ppp *ppp; |
369 | 369 | ||
370 | if (pf != 0) { | 370 | if (pf) { |
371 | file->private_data = NULL; | 371 | file->private_data = NULL; |
372 | if (pf->kind == INTERFACE) { | 372 | if (pf->kind == INTERFACE) { |
373 | ppp = PF_TO_PPP(pf); | 373 | ppp = PF_TO_PPP(pf); |
@@ -398,7 +398,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf, | |||
398 | 398 | ||
399 | ret = count; | 399 | ret = count; |
400 | 400 | ||
401 | if (pf == 0) | 401 | if (!pf) |
402 | return -ENXIO; | 402 | return -ENXIO; |
403 | add_wait_queue(&pf->rwait, &wait); | 403 | add_wait_queue(&pf->rwait, &wait); |
404 | for (;;) { | 404 | for (;;) { |
@@ -431,7 +431,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf, | |||
431 | set_current_state(TASK_RUNNING); | 431 | set_current_state(TASK_RUNNING); |
432 | remove_wait_queue(&pf->rwait, &wait); | 432 | remove_wait_queue(&pf->rwait, &wait); |
433 | 433 | ||
434 | if (skb == 0) | 434 | if (!skb) |
435 | goto out; | 435 | goto out; |
436 | 436 | ||
437 | ret = -EOVERFLOW; | 437 | ret = -EOVERFLOW; |
@@ -455,11 +455,11 @@ static ssize_t ppp_write(struct file *file, const char __user *buf, | |||
455 | struct sk_buff *skb; | 455 | struct sk_buff *skb; |
456 | ssize_t ret; | 456 | ssize_t ret; |
457 | 457 | ||
458 | if (pf == 0) | 458 | if (!pf) |
459 | return -ENXIO; | 459 | return -ENXIO; |
460 | ret = -ENOMEM; | 460 | ret = -ENOMEM; |
461 | skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); | 461 | skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); |
462 | if (skb == 0) | 462 | if (!skb) |
463 | goto out; | 463 | goto out; |
464 | skb_reserve(skb, pf->hdrlen); | 464 | skb_reserve(skb, pf->hdrlen); |
465 | ret = -EFAULT; | 465 | ret = -EFAULT; |
@@ -491,11 +491,11 @@ static unsigned int ppp_poll(struct file *file, poll_table *wait) | |||
491 | struct ppp_file *pf = file->private_data; | 491 | struct ppp_file *pf = file->private_data; |
492 | unsigned int mask; | 492 | unsigned int mask; |
493 | 493 | ||
494 | if (pf == 0) | 494 | if (!pf) |
495 | return 0; | 495 | return 0; |
496 | poll_wait(file, &pf->rwait, wait); | 496 | poll_wait(file, &pf->rwait, wait); |
497 | mask = POLLOUT | POLLWRNORM; | 497 | mask = POLLOUT | POLLWRNORM; |
498 | if (skb_peek(&pf->rq) != 0) | 498 | if (skb_peek(&pf->rq)) |
499 | mask |= POLLIN | POLLRDNORM; | 499 | mask |= POLLIN | POLLRDNORM; |
500 | if (pf->dead) | 500 | if (pf->dead) |
501 | mask |= POLLHUP; | 501 | mask |= POLLHUP; |
@@ -559,7 +559,7 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
559 | void __user *argp = (void __user *)arg; | 559 | void __user *argp = (void __user *)arg; |
560 | int __user *p = argp; | 560 | int __user *p = argp; |
561 | 561 | ||
562 | if (pf == 0) | 562 | if (!pf) |
563 | return ppp_unattached_ioctl(pf, file, cmd, arg); | 563 | return ppp_unattached_ioctl(pf, file, cmd, arg); |
564 | 564 | ||
565 | if (cmd == PPPIOCDETACH) { | 565 | if (cmd == PPPIOCDETACH) { |
@@ -689,13 +689,13 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
689 | val &= 0xffff; | 689 | val &= 0xffff; |
690 | } | 690 | } |
691 | vj = slhc_init(val2+1, val+1); | 691 | vj = slhc_init(val2+1, val+1); |
692 | if (vj == 0) { | 692 | if (!vj) { |
693 | printk(KERN_ERR "PPP: no memory (VJ compressor)\n"); | 693 | printk(KERN_ERR "PPP: no memory (VJ compressor)\n"); |
694 | err = -ENOMEM; | 694 | err = -ENOMEM; |
695 | break; | 695 | break; |
696 | } | 696 | } |
697 | ppp_lock(ppp); | 697 | ppp_lock(ppp); |
698 | if (ppp->vj != 0) | 698 | if (ppp->vj) |
699 | slhc_free(ppp->vj); | 699 | slhc_free(ppp->vj); |
700 | ppp->vj = vj; | 700 | ppp->vj = vj; |
701 | ppp_unlock(ppp); | 701 | ppp_unlock(ppp); |
@@ -786,7 +786,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file, | |||
786 | if (get_user(unit, p)) | 786 | if (get_user(unit, p)) |
787 | break; | 787 | break; |
788 | ppp = ppp_create_interface(unit, &err); | 788 | ppp = ppp_create_interface(unit, &err); |
789 | if (ppp == 0) | 789 | if (!ppp) |
790 | break; | 790 | break; |
791 | file->private_data = &ppp->file; | 791 | file->private_data = &ppp->file; |
792 | ppp->owner = file; | 792 | ppp->owner = file; |
@@ -803,7 +803,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file, | |||
803 | mutex_lock(&all_ppp_mutex); | 803 | mutex_lock(&all_ppp_mutex); |
804 | err = -ENXIO; | 804 | err = -ENXIO; |
805 | ppp = ppp_find_unit(unit); | 805 | ppp = ppp_find_unit(unit); |
806 | if (ppp != 0) { | 806 | if (ppp) { |
807 | atomic_inc(&ppp->file.refcnt); | 807 | atomic_inc(&ppp->file.refcnt); |
808 | file->private_data = &ppp->file; | 808 | file->private_data = &ppp->file; |
809 | err = 0; | 809 | err = 0; |
@@ -817,7 +817,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file, | |||
817 | spin_lock_bh(&all_channels_lock); | 817 | spin_lock_bh(&all_channels_lock); |
818 | err = -ENXIO; | 818 | err = -ENXIO; |
819 | chan = ppp_find_channel(unit); | 819 | chan = ppp_find_channel(unit); |
820 | if (chan != 0) { | 820 | if (chan) { |
821 | atomic_inc(&chan->file.refcnt); | 821 | atomic_inc(&chan->file.refcnt); |
822 | file->private_data = &chan->file; | 822 | file->private_data = &chan->file; |
823 | err = 0; | 823 | err = 0; |
@@ -946,9 +946,9 @@ ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
946 | 946 | ||
947 | case SIOCGPPPCSTATS: | 947 | case SIOCGPPPCSTATS: |
948 | memset(&cstats, 0, sizeof(cstats)); | 948 | memset(&cstats, 0, sizeof(cstats)); |
949 | if (ppp->xc_state != 0) | 949 | if (ppp->xc_state) |
950 | ppp->xcomp->comp_stat(ppp->xc_state, &cstats.c); | 950 | ppp->xcomp->comp_stat(ppp->xc_state, &cstats.c); |
951 | if (ppp->rc_state != 0) | 951 | if (ppp->rc_state) |
952 | ppp->rcomp->decomp_stat(ppp->rc_state, &cstats.d); | 952 | ppp->rcomp->decomp_stat(ppp->rc_state, &cstats.d); |
953 | if (copy_to_user(addr, &cstats, sizeof(cstats))) | 953 | if (copy_to_user(addr, &cstats, sizeof(cstats))) |
954 | break; | 954 | break; |
@@ -993,14 +993,14 @@ ppp_xmit_process(struct ppp *ppp) | |||
993 | struct sk_buff *skb; | 993 | struct sk_buff *skb; |
994 | 994 | ||
995 | ppp_xmit_lock(ppp); | 995 | ppp_xmit_lock(ppp); |
996 | if (ppp->dev != 0) { | 996 | if (ppp->dev) { |
997 | ppp_push(ppp); | 997 | ppp_push(ppp); |
998 | while (ppp->xmit_pending == 0 | 998 | while (!ppp->xmit_pending |
999 | && (skb = skb_dequeue(&ppp->file.xq)) != 0) | 999 | && (skb = skb_dequeue(&ppp->file.xq))) |
1000 | ppp_send_frame(ppp, skb); | 1000 | ppp_send_frame(ppp, skb); |
1001 | /* If there's no work left to do, tell the core net | 1001 | /* If there's no work left to do, tell the core net |
1002 | code that we can accept some more. */ | 1002 | code that we can accept some more. */ |
1003 | if (ppp->xmit_pending == 0 && skb_peek(&ppp->file.xq) == 0) | 1003 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) |
1004 | netif_wake_queue(ppp->dev); | 1004 | netif_wake_queue(ppp->dev); |
1005 | } | 1005 | } |
1006 | ppp_xmit_unlock(ppp); | 1006 | ppp_xmit_unlock(ppp); |
@@ -1100,12 +1100,12 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1100 | 1100 | ||
1101 | switch (proto) { | 1101 | switch (proto) { |
1102 | case PPP_IP: | 1102 | case PPP_IP: |
1103 | if (ppp->vj == 0 || (ppp->flags & SC_COMP_TCP) == 0) | 1103 | if (!ppp->vj || (ppp->flags & SC_COMP_TCP) == 0) |
1104 | break; | 1104 | break; |
1105 | /* try to do VJ TCP header compression */ | 1105 | /* try to do VJ TCP header compression */ |
1106 | new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2, | 1106 | new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2, |
1107 | GFP_ATOMIC); | 1107 | GFP_ATOMIC); |
1108 | if (new_skb == 0) { | 1108 | if (!new_skb) { |
1109 | printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n"); | 1109 | printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n"); |
1110 | goto drop; | 1110 | goto drop; |
1111 | } | 1111 | } |
@@ -1140,7 +1140,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | /* try to do packet compression */ | 1142 | /* try to do packet compression */ |
1143 | if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0 | 1143 | if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state |
1144 | && proto != PPP_LCP && proto != PPP_CCP) { | 1144 | && proto != PPP_LCP && proto != PPP_CCP) { |
1145 | if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { | 1145 | if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { |
1146 | if (net_ratelimit()) | 1146 | if (net_ratelimit()) |
@@ -1185,7 +1185,7 @@ ppp_push(struct ppp *ppp) | |||
1185 | struct channel *pch; | 1185 | struct channel *pch; |
1186 | struct sk_buff *skb = ppp->xmit_pending; | 1186 | struct sk_buff *skb = ppp->xmit_pending; |
1187 | 1187 | ||
1188 | if (skb == 0) | 1188 | if (!skb) |
1189 | return; | 1189 | return; |
1190 | 1190 | ||
1191 | list = &ppp->channels; | 1191 | list = &ppp->channels; |
@@ -1355,7 +1355,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1355 | if (flen == len && nfree == 0) | 1355 | if (flen == len && nfree == 0) |
1356 | bits |= E; | 1356 | bits |= E; |
1357 | frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC); | 1357 | frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC); |
1358 | if (frag == 0) | 1358 | if (!frag) |
1359 | goto noskb; | 1359 | goto noskb; |
1360 | q = skb_put(frag, flen + hdrlen); | 1360 | q = skb_put(frag, flen + hdrlen); |
1361 | 1361 | ||
@@ -1425,7 +1425,7 @@ ppp_channel_push(struct channel *pch) | |||
1425 | struct ppp *ppp; | 1425 | struct ppp *ppp; |
1426 | 1426 | ||
1427 | spin_lock_bh(&pch->downl); | 1427 | spin_lock_bh(&pch->downl); |
1428 | if (pch->chan != 0) { | 1428 | if (pch->chan) { |
1429 | while (!skb_queue_empty(&pch->file.xq)) { | 1429 | while (!skb_queue_empty(&pch->file.xq)) { |
1430 | skb = skb_dequeue(&pch->file.xq); | 1430 | skb = skb_dequeue(&pch->file.xq); |
1431 | if (!pch->chan->ops->start_xmit(pch->chan, skb)) { | 1431 | if (!pch->chan->ops->start_xmit(pch->chan, skb)) { |
@@ -1443,7 +1443,7 @@ ppp_channel_push(struct channel *pch) | |||
1443 | if (skb_queue_empty(&pch->file.xq)) { | 1443 | if (skb_queue_empty(&pch->file.xq)) { |
1444 | read_lock_bh(&pch->upl); | 1444 | read_lock_bh(&pch->upl); |
1445 | ppp = pch->ppp; | 1445 | ppp = pch->ppp; |
1446 | if (ppp != 0) | 1446 | if (ppp) |
1447 | ppp_xmit_process(ppp); | 1447 | ppp_xmit_process(ppp); |
1448 | read_unlock_bh(&pch->upl); | 1448 | read_unlock_bh(&pch->upl); |
1449 | } | 1449 | } |
@@ -1462,7 +1462,7 @@ ppp_do_recv(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | |||
1462 | { | 1462 | { |
1463 | ppp_recv_lock(ppp); | 1463 | ppp_recv_lock(ppp); |
1464 | /* ppp->dev == 0 means interface is closing down */ | 1464 | /* ppp->dev == 0 means interface is closing down */ |
1465 | if (ppp->dev != 0) | 1465 | if (ppp->dev) |
1466 | ppp_receive_frame(ppp, skb, pch); | 1466 | ppp_receive_frame(ppp, skb, pch); |
1467 | else | 1467 | else |
1468 | kfree_skb(skb); | 1468 | kfree_skb(skb); |
@@ -1475,19 +1475,19 @@ ppp_input(struct ppp_channel *chan, struct sk_buff *skb) | |||
1475 | struct channel *pch = chan->ppp; | 1475 | struct channel *pch = chan->ppp; |
1476 | int proto; | 1476 | int proto; |
1477 | 1477 | ||
1478 | if (pch == 0 || skb->len == 0) { | 1478 | if (!pch || skb->len == 0) { |
1479 | kfree_skb(skb); | 1479 | kfree_skb(skb); |
1480 | return; | 1480 | return; |
1481 | } | 1481 | } |
1482 | 1482 | ||
1483 | proto = PPP_PROTO(skb); | 1483 | proto = PPP_PROTO(skb); |
1484 | read_lock_bh(&pch->upl); | 1484 | read_lock_bh(&pch->upl); |
1485 | if (pch->ppp == 0 || proto >= 0xc000 || proto == PPP_CCPFRAG) { | 1485 | if (!pch->ppp || proto >= 0xc000 || proto == PPP_CCPFRAG) { |
1486 | /* put it on the channel queue */ | 1486 | /* put it on the channel queue */ |
1487 | skb_queue_tail(&pch->file.rq, skb); | 1487 | skb_queue_tail(&pch->file.rq, skb); |
1488 | /* drop old frames if queue too long */ | 1488 | /* drop old frames if queue too long */ |
1489 | while (pch->file.rq.qlen > PPP_MAX_RQLEN | 1489 | while (pch->file.rq.qlen > PPP_MAX_RQLEN |
1490 | && (skb = skb_dequeue(&pch->file.rq)) != 0) | 1490 | && (skb = skb_dequeue(&pch->file.rq))) |
1491 | kfree_skb(skb); | 1491 | kfree_skb(skb); |
1492 | wake_up_interruptible(&pch->file.rwait); | 1492 | wake_up_interruptible(&pch->file.rwait); |
1493 | } else { | 1493 | } else { |
@@ -1503,13 +1503,13 @@ ppp_input_error(struct ppp_channel *chan, int code) | |||
1503 | struct channel *pch = chan->ppp; | 1503 | struct channel *pch = chan->ppp; |
1504 | struct sk_buff *skb; | 1504 | struct sk_buff *skb; |
1505 | 1505 | ||
1506 | if (pch == 0) | 1506 | if (!pch) |
1507 | return; | 1507 | return; |
1508 | 1508 | ||
1509 | read_lock_bh(&pch->upl); | 1509 | read_lock_bh(&pch->upl); |
1510 | if (pch->ppp != 0) { | 1510 | if (pch->ppp) { |
1511 | skb = alloc_skb(0, GFP_ATOMIC); | 1511 | skb = alloc_skb(0, GFP_ATOMIC); |
1512 | if (skb != 0) { | 1512 | if (skb) { |
1513 | skb->len = 0; /* probably unnecessary */ | 1513 | skb->len = 0; /* probably unnecessary */ |
1514 | skb->cb[0] = code; | 1514 | skb->cb[0] = code; |
1515 | ppp_do_recv(pch->ppp, skb, pch); | 1515 | ppp_do_recv(pch->ppp, skb, pch); |
@@ -1548,7 +1548,7 @@ static void | |||
1548 | ppp_receive_error(struct ppp *ppp) | 1548 | ppp_receive_error(struct ppp *ppp) |
1549 | { | 1549 | { |
1550 | ++ppp->stats.rx_errors; | 1550 | ++ppp->stats.rx_errors; |
1551 | if (ppp->vj != 0) | 1551 | if (ppp->vj) |
1552 | slhc_toss(ppp->vj); | 1552 | slhc_toss(ppp->vj); |
1553 | } | 1553 | } |
1554 | 1554 | ||
@@ -1563,7 +1563,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1563 | * Note that some decompressors need to see uncompressed frames | 1563 | * Note that some decompressors need to see uncompressed frames |
1564 | * that come in as well as compressed frames. | 1564 | * that come in as well as compressed frames. |
1565 | */ | 1565 | */ |
1566 | if (ppp->rc_state != 0 && (ppp->rstate & SC_DECOMP_RUN) | 1566 | if (ppp->rc_state && (ppp->rstate & SC_DECOMP_RUN) |
1567 | && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) | 1567 | && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) |
1568 | skb = ppp_decompress_frame(ppp, skb); | 1568 | skb = ppp_decompress_frame(ppp, skb); |
1569 | 1569 | ||
@@ -1574,13 +1574,13 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1574 | switch (proto) { | 1574 | switch (proto) { |
1575 | case PPP_VJC_COMP: | 1575 | case PPP_VJC_COMP: |
1576 | /* decompress VJ compressed packets */ | 1576 | /* decompress VJ compressed packets */ |
1577 | if (ppp->vj == 0 || (ppp->flags & SC_REJ_COMP_TCP)) | 1577 | if (!ppp->vj || (ppp->flags & SC_REJ_COMP_TCP)) |
1578 | goto err; | 1578 | goto err; |
1579 | 1579 | ||
1580 | if (skb_tailroom(skb) < 124 || skb_cloned(skb)) { | 1580 | if (skb_tailroom(skb) < 124 || skb_cloned(skb)) { |
1581 | /* copy to a new sk_buff with more tailroom */ | 1581 | /* copy to a new sk_buff with more tailroom */ |
1582 | ns = dev_alloc_skb(skb->len + 128); | 1582 | ns = dev_alloc_skb(skb->len + 128); |
1583 | if (ns == 0) { | 1583 | if (!ns) { |
1584 | printk(KERN_ERR"PPP: no memory (VJ decomp)\n"); | 1584 | printk(KERN_ERR"PPP: no memory (VJ decomp)\n"); |
1585 | goto err; | 1585 | goto err; |
1586 | } | 1586 | } |
@@ -1606,7 +1606,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1606 | break; | 1606 | break; |
1607 | 1607 | ||
1608 | case PPP_VJC_UNCOMP: | 1608 | case PPP_VJC_UNCOMP: |
1609 | if (ppp->vj == 0 || (ppp->flags & SC_REJ_COMP_TCP)) | 1609 | if (!ppp->vj || (ppp->flags & SC_REJ_COMP_TCP)) |
1610 | goto err; | 1610 | goto err; |
1611 | 1611 | ||
1612 | /* Until we fix the decompressor need to make sure | 1612 | /* Until we fix the decompressor need to make sure |
@@ -1636,7 +1636,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1636 | skb_queue_tail(&ppp->file.rq, skb); | 1636 | skb_queue_tail(&ppp->file.rq, skb); |
1637 | /* limit queue length by dropping old frames */ | 1637 | /* limit queue length by dropping old frames */ |
1638 | while (ppp->file.rq.qlen > PPP_MAX_RQLEN | 1638 | while (ppp->file.rq.qlen > PPP_MAX_RQLEN |
1639 | && (skb = skb_dequeue(&ppp->file.rq)) != 0) | 1639 | && (skb = skb_dequeue(&ppp->file.rq))) |
1640 | kfree_skb(skb); | 1640 | kfree_skb(skb); |
1641 | /* wake up any process polling or blocking on read */ | 1641 | /* wake up any process polling or blocking on read */ |
1642 | wake_up_interruptible(&ppp->file.rwait); | 1642 | wake_up_interruptible(&ppp->file.rwait); |
@@ -1718,7 +1718,7 @@ ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1718 | } | 1718 | } |
1719 | 1719 | ||
1720 | ns = dev_alloc_skb(obuff_size); | 1720 | ns = dev_alloc_skb(obuff_size); |
1721 | if (ns == 0) { | 1721 | if (!ns) { |
1722 | printk(KERN_ERR "ppp_decompress_frame: no memory\n"); | 1722 | printk(KERN_ERR "ppp_decompress_frame: no memory\n"); |
1723 | goto err; | 1723 | goto err; |
1724 | } | 1724 | } |
@@ -1836,7 +1836,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | |||
1836 | ppp->minseq = ppp->mrq.next->sequence; | 1836 | ppp->minseq = ppp->mrq.next->sequence; |
1837 | 1837 | ||
1838 | /* Pull completed packets off the queue and receive them. */ | 1838 | /* Pull completed packets off the queue and receive them. */ |
1839 | while ((skb = ppp_mp_reconstruct(ppp)) != 0) | 1839 | while ((skb = ppp_mp_reconstruct(ppp))) |
1840 | ppp_receive_nonmp_frame(ppp, skb); | 1840 | ppp_receive_nonmp_frame(ppp, skb); |
1841 | 1841 | ||
1842 | return; | 1842 | return; |
@@ -2002,7 +2002,7 @@ ppp_register_channel(struct ppp_channel *chan) | |||
2002 | struct channel *pch; | 2002 | struct channel *pch; |
2003 | 2003 | ||
2004 | pch = kzalloc(sizeof(struct channel), GFP_KERNEL); | 2004 | pch = kzalloc(sizeof(struct channel), GFP_KERNEL); |
2005 | if (pch == 0) | 2005 | if (!pch) |
2006 | return -ENOMEM; | 2006 | return -ENOMEM; |
2007 | pch->ppp = NULL; | 2007 | pch->ppp = NULL; |
2008 | pch->chan = chan; | 2008 | pch->chan = chan; |
@@ -2030,7 +2030,7 @@ int ppp_channel_index(struct ppp_channel *chan) | |||
2030 | { | 2030 | { |
2031 | struct channel *pch = chan->ppp; | 2031 | struct channel *pch = chan->ppp; |
2032 | 2032 | ||
2033 | if (pch != 0) | 2033 | if (pch) |
2034 | return pch->file.index; | 2034 | return pch->file.index; |
2035 | return -1; | 2035 | return -1; |
2036 | } | 2036 | } |
@@ -2043,9 +2043,9 @@ int ppp_unit_number(struct ppp_channel *chan) | |||
2043 | struct channel *pch = chan->ppp; | 2043 | struct channel *pch = chan->ppp; |
2044 | int unit = -1; | 2044 | int unit = -1; |
2045 | 2045 | ||
2046 | if (pch != 0) { | 2046 | if (pch) { |
2047 | read_lock_bh(&pch->upl); | 2047 | read_lock_bh(&pch->upl); |
2048 | if (pch->ppp != 0) | 2048 | if (pch->ppp) |
2049 | unit = pch->ppp->file.index; | 2049 | unit = pch->ppp->file.index; |
2050 | read_unlock_bh(&pch->upl); | 2050 | read_unlock_bh(&pch->upl); |
2051 | } | 2051 | } |
@@ -2061,7 +2061,7 @@ ppp_unregister_channel(struct ppp_channel *chan) | |||
2061 | { | 2061 | { |
2062 | struct channel *pch = chan->ppp; | 2062 | struct channel *pch = chan->ppp; |
2063 | 2063 | ||
2064 | if (pch == 0) | 2064 | if (!pch) |
2065 | return; /* should never happen */ | 2065 | return; /* should never happen */ |
2066 | chan->ppp = NULL; | 2066 | chan->ppp = NULL; |
2067 | 2067 | ||
@@ -2093,7 +2093,7 @@ ppp_output_wakeup(struct ppp_channel *chan) | |||
2093 | { | 2093 | { |
2094 | struct channel *pch = chan->ppp; | 2094 | struct channel *pch = chan->ppp; |
2095 | 2095 | ||
2096 | if (pch == 0) | 2096 | if (!pch) |
2097 | return; | 2097 | return; |
2098 | ppp_channel_push(pch); | 2098 | ppp_channel_push(pch); |
2099 | } | 2099 | } |
@@ -2124,18 +2124,18 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) | |||
2124 | 2124 | ||
2125 | cp = find_compressor(ccp_option[0]); | 2125 | cp = find_compressor(ccp_option[0]); |
2126 | #ifdef CONFIG_KMOD | 2126 | #ifdef CONFIG_KMOD |
2127 | if (cp == 0) { | 2127 | if (!cp) { |
2128 | request_module("ppp-compress-%d", ccp_option[0]); | 2128 | request_module("ppp-compress-%d", ccp_option[0]); |
2129 | cp = find_compressor(ccp_option[0]); | 2129 | cp = find_compressor(ccp_option[0]); |
2130 | } | 2130 | } |
2131 | #endif /* CONFIG_KMOD */ | 2131 | #endif /* CONFIG_KMOD */ |
2132 | if (cp == 0) | 2132 | if (!cp) |
2133 | goto out; | 2133 | goto out; |
2134 | 2134 | ||
2135 | err = -ENOBUFS; | 2135 | err = -ENOBUFS; |
2136 | if (data.transmit) { | 2136 | if (data.transmit) { |
2137 | state = cp->comp_alloc(ccp_option, data.length); | 2137 | state = cp->comp_alloc(ccp_option, data.length); |
2138 | if (state != 0) { | 2138 | if (state) { |
2139 | ppp_xmit_lock(ppp); | 2139 | ppp_xmit_lock(ppp); |
2140 | ppp->xstate &= ~SC_COMP_RUN; | 2140 | ppp->xstate &= ~SC_COMP_RUN; |
2141 | ocomp = ppp->xcomp; | 2141 | ocomp = ppp->xcomp; |
@@ -2143,7 +2143,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) | |||
2143 | ppp->xcomp = cp; | 2143 | ppp->xcomp = cp; |
2144 | ppp->xc_state = state; | 2144 | ppp->xc_state = state; |
2145 | ppp_xmit_unlock(ppp); | 2145 | ppp_xmit_unlock(ppp); |
2146 | if (ostate != 0) { | 2146 | if (ostate) { |
2147 | ocomp->comp_free(ostate); | 2147 | ocomp->comp_free(ostate); |
2148 | module_put(ocomp->owner); | 2148 | module_put(ocomp->owner); |
2149 | } | 2149 | } |
@@ -2153,7 +2153,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) | |||
2153 | 2153 | ||
2154 | } else { | 2154 | } else { |
2155 | state = cp->decomp_alloc(ccp_option, data.length); | 2155 | state = cp->decomp_alloc(ccp_option, data.length); |
2156 | if (state != 0) { | 2156 | if (state) { |
2157 | ppp_recv_lock(ppp); | 2157 | ppp_recv_lock(ppp); |
2158 | ppp->rstate &= ~SC_DECOMP_RUN; | 2158 | ppp->rstate &= ~SC_DECOMP_RUN; |
2159 | ocomp = ppp->rcomp; | 2159 | ocomp = ppp->rcomp; |
@@ -2161,7 +2161,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) | |||
2161 | ppp->rcomp = cp; | 2161 | ppp->rcomp = cp; |
2162 | ppp->rc_state = state; | 2162 | ppp->rc_state = state; |
2163 | ppp_recv_unlock(ppp); | 2163 | ppp_recv_unlock(ppp); |
2164 | if (ostate != 0) { | 2164 | if (ostate) { |
2165 | ocomp->decomp_free(ostate); | 2165 | ocomp->decomp_free(ostate); |
2166 | module_put(ocomp->owner); | 2166 | module_put(ocomp->owner); |
2167 | } | 2167 | } |
@@ -2228,7 +2228,7 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound) | |||
2228 | break; | 2228 | break; |
2229 | if (inbound) { | 2229 | if (inbound) { |
2230 | /* we will start receiving compressed packets */ | 2230 | /* we will start receiving compressed packets */ |
2231 | if (ppp->rc_state == 0) | 2231 | if (!ppp->rc_state) |
2232 | break; | 2232 | break; |
2233 | if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len, | 2233 | if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len, |
2234 | ppp->file.index, 0, ppp->mru, ppp->debug)) { | 2234 | ppp->file.index, 0, ppp->mru, ppp->debug)) { |
@@ -2237,7 +2237,7 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound) | |||
2237 | } | 2237 | } |
2238 | } else { | 2238 | } else { |
2239 | /* we will soon start sending compressed packets */ | 2239 | /* we will soon start sending compressed packets */ |
2240 | if (ppp->xc_state == 0) | 2240 | if (!ppp->xc_state) |
2241 | break; | 2241 | break; |
2242 | if (ppp->xcomp->comp_init(ppp->xc_state, dp, len, | 2242 | if (ppp->xcomp->comp_init(ppp->xc_state, dp, len, |
2243 | ppp->file.index, 0, ppp->debug)) | 2243 | ppp->file.index, 0, ppp->debug)) |
@@ -2320,11 +2320,11 @@ ppp_register_compressor(struct compressor *cp) | |||
2320 | int ret; | 2320 | int ret; |
2321 | spin_lock(&compressor_list_lock); | 2321 | spin_lock(&compressor_list_lock); |
2322 | ret = -EEXIST; | 2322 | ret = -EEXIST; |
2323 | if (find_comp_entry(cp->compress_proto) != 0) | 2323 | if (find_comp_entry(cp->compress_proto)) |
2324 | goto out; | 2324 | goto out; |
2325 | ret = -ENOMEM; | 2325 | ret = -ENOMEM; |
2326 | ce = kmalloc(sizeof(struct compressor_entry), GFP_ATOMIC); | 2326 | ce = kmalloc(sizeof(struct compressor_entry), GFP_ATOMIC); |
2327 | if (ce == 0) | 2327 | if (!ce) |
2328 | goto out; | 2328 | goto out; |
2329 | ret = 0; | 2329 | ret = 0; |
2330 | ce->comp = cp; | 2330 | ce->comp = cp; |
@@ -2342,7 +2342,7 @@ ppp_unregister_compressor(struct compressor *cp) | |||
2342 | 2342 | ||
2343 | spin_lock(&compressor_list_lock); | 2343 | spin_lock(&compressor_list_lock); |
2344 | ce = find_comp_entry(cp->compress_proto); | 2344 | ce = find_comp_entry(cp->compress_proto); |
2345 | if (ce != 0 && ce->comp == cp) { | 2345 | if (ce && ce->comp == cp) { |
2346 | list_del(&ce->list); | 2346 | list_del(&ce->list); |
2347 | kfree(ce); | 2347 | kfree(ce); |
2348 | } | 2348 | } |
@@ -2358,7 +2358,7 @@ find_compressor(int type) | |||
2358 | 2358 | ||
2359 | spin_lock(&compressor_list_lock); | 2359 | spin_lock(&compressor_list_lock); |
2360 | ce = find_comp_entry(type); | 2360 | ce = find_comp_entry(type); |
2361 | if (ce != 0) { | 2361 | if (ce) { |
2362 | cp = ce->comp; | 2362 | cp = ce->comp; |
2363 | if (!try_module_get(cp->owner)) | 2363 | if (!try_module_get(cp->owner)) |
2364 | cp = NULL; | 2364 | cp = NULL; |
@@ -2383,7 +2383,7 @@ ppp_get_stats(struct ppp *ppp, struct ppp_stats *st) | |||
2383 | st->p.ppp_opackets = ppp->stats.tx_packets; | 2383 | st->p.ppp_opackets = ppp->stats.tx_packets; |
2384 | st->p.ppp_oerrors = ppp->stats.tx_errors; | 2384 | st->p.ppp_oerrors = ppp->stats.tx_errors; |
2385 | st->p.ppp_obytes = ppp->stats.tx_bytes; | 2385 | st->p.ppp_obytes = ppp->stats.tx_bytes; |
2386 | if (vj == 0) | 2386 | if (!vj) |
2387 | return; | 2387 | return; |
2388 | st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed; | 2388 | st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed; |
2389 | st->vj.vjs_compressed = vj->sls_o_compressed; | 2389 | st->vj.vjs_compressed = vj->sls_o_compressed; |
@@ -2604,11 +2604,11 @@ ppp_connect_channel(struct channel *pch, int unit) | |||
2604 | 2604 | ||
2605 | mutex_lock(&all_ppp_mutex); | 2605 | mutex_lock(&all_ppp_mutex); |
2606 | ppp = ppp_find_unit(unit); | 2606 | ppp = ppp_find_unit(unit); |
2607 | if (ppp == 0) | 2607 | if (!ppp) |
2608 | goto out; | 2608 | goto out; |
2609 | write_lock_bh(&pch->upl); | 2609 | write_lock_bh(&pch->upl); |
2610 | ret = -EINVAL; | 2610 | ret = -EINVAL; |
2611 | if (pch->ppp != 0) | 2611 | if (pch->ppp) |
2612 | goto outl; | 2612 | goto outl; |
2613 | 2613 | ||
2614 | ppp_lock(ppp); | 2614 | ppp_lock(ppp); |
@@ -2644,7 +2644,7 @@ ppp_disconnect_channel(struct channel *pch) | |||
2644 | ppp = pch->ppp; | 2644 | ppp = pch->ppp; |
2645 | pch->ppp = NULL; | 2645 | pch->ppp = NULL; |
2646 | write_unlock_bh(&pch->upl); | 2646 | write_unlock_bh(&pch->upl); |
2647 | if (ppp != 0) { | 2647 | if (ppp) { |
2648 | /* remove it from the ppp unit's list */ | 2648 | /* remove it from the ppp unit's list */ |
2649 | ppp_lock(ppp); | 2649 | ppp_lock(ppp); |
2650 | list_del(&pch->clist); | 2650 | list_del(&pch->clist); |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index 00e2fb48b4ae..f0c6a1926a02 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -209,7 +209,7 @@ ppp_sync_open(struct tty_struct *tty) | |||
209 | 209 | ||
210 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 210 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
211 | err = -ENOMEM; | 211 | err = -ENOMEM; |
212 | if (ap == 0) | 212 | if (!ap) |
213 | goto out; | 213 | goto out; |
214 | 214 | ||
215 | /* initialize the syncppp structure */ | 215 | /* initialize the syncppp structure */ |
@@ -262,7 +262,7 @@ ppp_sync_close(struct tty_struct *tty) | |||
262 | ap = tty->disc_data; | 262 | ap = tty->disc_data; |
263 | tty->disc_data = NULL; | 263 | tty->disc_data = NULL; |
264 | write_unlock_irq(&disc_data_lock); | 264 | write_unlock_irq(&disc_data_lock); |
265 | if (ap == 0) | 265 | if (!ap) |
266 | return; | 266 | return; |
267 | 267 | ||
268 | /* | 268 | /* |
@@ -278,7 +278,7 @@ ppp_sync_close(struct tty_struct *tty) | |||
278 | 278 | ||
279 | ppp_unregister_channel(&ap->chan); | 279 | ppp_unregister_channel(&ap->chan); |
280 | skb_queue_purge(&ap->rqueue); | 280 | skb_queue_purge(&ap->rqueue); |
281 | if (ap->tpkt != 0) | 281 | if (ap->tpkt) |
282 | kfree_skb(ap->tpkt); | 282 | kfree_skb(ap->tpkt); |
283 | kfree(ap); | 283 | kfree(ap); |
284 | } | 284 | } |
@@ -325,13 +325,13 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, | |||
325 | int __user *p = (int __user *)arg; | 325 | int __user *p = (int __user *)arg; |
326 | int err, val; | 326 | int err, val; |
327 | 327 | ||
328 | if (ap == 0) | 328 | if (!ap) |
329 | return -ENXIO; | 329 | return -ENXIO; |
330 | err = -EFAULT; | 330 | err = -EFAULT; |
331 | switch (cmd) { | 331 | switch (cmd) { |
332 | case PPPIOCGCHAN: | 332 | case PPPIOCGCHAN: |
333 | err = -ENXIO; | 333 | err = -ENXIO; |
334 | if (ap == 0) | 334 | if (!ap) |
335 | break; | 335 | break; |
336 | err = -EFAULT; | 336 | err = -EFAULT; |
337 | if (put_user(ppp_channel_index(&ap->chan), p)) | 337 | if (put_user(ppp_channel_index(&ap->chan), p)) |
@@ -341,7 +341,7 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, | |||
341 | 341 | ||
342 | case PPPIOCGUNIT: | 342 | case PPPIOCGUNIT: |
343 | err = -ENXIO; | 343 | err = -ENXIO; |
344 | if (ap == 0) | 344 | if (!ap) |
345 | break; | 345 | break; |
346 | err = -EFAULT; | 346 | err = -EFAULT; |
347 | if (put_user(ppp_unit_number(&ap->chan), p)) | 347 | if (put_user(ppp_unit_number(&ap->chan), p)) |
@@ -390,7 +390,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | |||
390 | struct syncppp *ap = sp_get(tty); | 390 | struct syncppp *ap = sp_get(tty); |
391 | unsigned long flags; | 391 | unsigned long flags; |
392 | 392 | ||
393 | if (ap == 0) | 393 | if (!ap) |
394 | return; | 394 | return; |
395 | spin_lock_irqsave(&ap->recv_lock, flags); | 395 | spin_lock_irqsave(&ap->recv_lock, flags); |
396 | ppp_sync_input(ap, buf, cflags, count); | 396 | ppp_sync_input(ap, buf, cflags, count); |
@@ -409,7 +409,7 @@ ppp_sync_wakeup(struct tty_struct *tty) | |||
409 | struct syncppp *ap = sp_get(tty); | 409 | struct syncppp *ap = sp_get(tty); |
410 | 410 | ||
411 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 411 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
412 | if (ap == 0) | 412 | if (!ap) |
413 | return; | 413 | return; |
414 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); | 414 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); |
415 | tasklet_schedule(&ap->tsk); | 415 | tasklet_schedule(&ap->tsk); |
@@ -651,7 +651,7 @@ ppp_sync_push(struct syncppp *ap) | |||
651 | for (;;) { | 651 | for (;;) { |
652 | if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags)) | 652 | if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags)) |
653 | tty_stuffed = 0; | 653 | tty_stuffed = 0; |
654 | if (!tty_stuffed && ap->tpkt != 0) { | 654 | if (!tty_stuffed && ap->tpkt) { |
655 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 655 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
656 | sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len); | 656 | sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len); |
657 | if (sent < 0) | 657 | if (sent < 0) |
@@ -669,7 +669,7 @@ ppp_sync_push(struct syncppp *ap) | |||
669 | /* haven't made any progress */ | 669 | /* haven't made any progress */ |
670 | spin_unlock_bh(&ap->xmit_lock); | 670 | spin_unlock_bh(&ap->xmit_lock); |
671 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) | 671 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) |
672 | || (!tty_stuffed && ap->tpkt != 0))) | 672 | || (!tty_stuffed && ap->tpkt))) |
673 | break; | 673 | break; |
674 | if (!spin_trylock_bh(&ap->xmit_lock)) | 674 | if (!spin_trylock_bh(&ap->xmit_lock)) |
675 | break; | 675 | break; |
@@ -677,7 +677,7 @@ ppp_sync_push(struct syncppp *ap) | |||
677 | return done; | 677 | return done; |
678 | 678 | ||
679 | flush: | 679 | flush: |
680 | if (ap->tpkt != 0) { | 680 | if (ap->tpkt) { |
681 | kfree_skb(ap->tpkt); | 681 | kfree_skb(ap->tpkt); |
682 | ap->tpkt = NULL; | 682 | ap->tpkt = NULL; |
683 | clear_bit(XMIT_FULL, &ap->xmit_flags); | 683 | clear_bit(XMIT_FULL, &ap->xmit_flags); |
@@ -732,7 +732,8 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf, | |||
732 | ppp_print_buffer ("receive buffer", buf, count); | 732 | ppp_print_buffer ("receive buffer", buf, count); |
733 | 733 | ||
734 | /* stuff the chars in the skb */ | 734 | /* stuff the chars in the skb */ |
735 | if ((skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2)) == 0) { | 735 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); |
736 | if (!skb) { | ||
736 | printk(KERN_ERR "PPPsync: no memory (input pkt)\n"); | 737 | printk(KERN_ERR "PPPsync: no memory (input pkt)\n"); |
737 | goto err; | 738 | goto err; |
738 | } | 739 | } |
@@ -740,7 +741,7 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf, | |||
740 | if (buf[0] != PPP_ALLSTATIONS) | 741 | if (buf[0] != PPP_ALLSTATIONS) |
741 | skb_reserve(skb, 2 + (buf[0] & 1)); | 742 | skb_reserve(skb, 2 + (buf[0] & 1)); |
742 | 743 | ||
743 | if (flags != 0 && *flags) { | 744 | if (flags && *flags) { |
744 | /* error flag set, ignore frame */ | 745 | /* error flag set, ignore frame */ |
745 | goto err; | 746 | goto err; |
746 | } else if (count > skb_tailroom(skb)) { | 747 | } else if (count > skb_tailroom(skb)) { |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index b8c0e7b4ca1c..632666706247 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -84,7 +84,7 @@ | |||
84 | #include "s2io.h" | 84 | #include "s2io.h" |
85 | #include "s2io-regs.h" | 85 | #include "s2io-regs.h" |
86 | 86 | ||
87 | #define DRV_VERSION "2.0.26.5" | 87 | #define DRV_VERSION "2.0.26.6" |
88 | 88 | ||
89 | /* S2io Driver name & version. */ | 89 | /* S2io Driver name & version. */ |
90 | static char s2io_driver_name[] = "Neterion"; | 90 | static char s2io_driver_name[] = "Neterion"; |
@@ -3775,6 +3775,40 @@ static int __devinit s2io_test_msi(struct s2io_nic *sp) | |||
3775 | 3775 | ||
3776 | return err; | 3776 | return err; |
3777 | } | 3777 | } |
3778 | |||
3779 | static void remove_msix_isr(struct s2io_nic *sp) | ||
3780 | { | ||
3781 | int i; | ||
3782 | u16 msi_control; | ||
3783 | |||
3784 | for (i = 0; i < MAX_REQUESTED_MSI_X; i++) { | ||
3785 | if (sp->s2io_entries[i].in_use == | ||
3786 | MSIX_REGISTERED_SUCCESS) { | ||
3787 | int vector = sp->entries[i].vector; | ||
3788 | void *arg = sp->s2io_entries[i].arg; | ||
3789 | free_irq(vector, arg); | ||
3790 | } | ||
3791 | } | ||
3792 | |||
3793 | kfree(sp->entries); | ||
3794 | kfree(sp->s2io_entries); | ||
3795 | sp->entries = NULL; | ||
3796 | sp->s2io_entries = NULL; | ||
3797 | |||
3798 | pci_read_config_word(sp->pdev, 0x42, &msi_control); | ||
3799 | msi_control &= 0xFFFE; /* Disable MSI */ | ||
3800 | pci_write_config_word(sp->pdev, 0x42, msi_control); | ||
3801 | |||
3802 | pci_disable_msix(sp->pdev); | ||
3803 | } | ||
3804 | |||
3805 | static void remove_inta_isr(struct s2io_nic *sp) | ||
3806 | { | ||
3807 | struct net_device *dev = sp->dev; | ||
3808 | |||
3809 | free_irq(sp->pdev->irq, dev); | ||
3810 | } | ||
3811 | |||
3778 | /* ********************************************************* * | 3812 | /* ********************************************************* * |
3779 | * Functions defined below concern the OS part of the driver * | 3813 | * Functions defined below concern the OS part of the driver * |
3780 | * ********************************************************* */ | 3814 | * ********************************************************* */ |
@@ -3809,28 +3843,9 @@ static int s2io_open(struct net_device *dev) | |||
3809 | int ret = s2io_enable_msi_x(sp); | 3843 | int ret = s2io_enable_msi_x(sp); |
3810 | 3844 | ||
3811 | if (!ret) { | 3845 | if (!ret) { |
3812 | u16 msi_control; | ||
3813 | |||
3814 | ret = s2io_test_msi(sp); | 3846 | ret = s2io_test_msi(sp); |
3815 | |||
3816 | /* rollback MSI-X, will re-enable during add_isr() */ | 3847 | /* rollback MSI-X, will re-enable during add_isr() */ |
3817 | kfree(sp->entries); | 3848 | remove_msix_isr(sp); |
3818 | sp->mac_control.stats_info->sw_stat.mem_freed += | ||
3819 | (MAX_REQUESTED_MSI_X * | ||
3820 | sizeof(struct msix_entry)); | ||
3821 | kfree(sp->s2io_entries); | ||
3822 | sp->mac_control.stats_info->sw_stat.mem_freed += | ||
3823 | (MAX_REQUESTED_MSI_X * | ||
3824 | sizeof(struct s2io_msix_entry)); | ||
3825 | sp->entries = NULL; | ||
3826 | sp->s2io_entries = NULL; | ||
3827 | |||
3828 | pci_read_config_word(sp->pdev, 0x42, &msi_control); | ||
3829 | msi_control &= 0xFFFE; /* Disable MSI */ | ||
3830 | pci_write_config_word(sp->pdev, 0x42, msi_control); | ||
3831 | |||
3832 | pci_disable_msix(sp->pdev); | ||
3833 | |||
3834 | } | 3849 | } |
3835 | if (ret) { | 3850 | if (ret) { |
3836 | 3851 | ||
@@ -6719,15 +6734,22 @@ static int s2io_add_isr(struct s2io_nic * sp) | |||
6719 | } | 6734 | } |
6720 | } | 6735 | } |
6721 | if (err) { | 6736 | if (err) { |
6737 | remove_msix_isr(sp); | ||
6722 | DBG_PRINT(ERR_DBG,"%s:MSI-X-%d registration " | 6738 | DBG_PRINT(ERR_DBG,"%s:MSI-X-%d registration " |
6723 | "failed\n", dev->name, i); | 6739 | "failed\n", dev->name, i); |
6724 | DBG_PRINT(ERR_DBG, "Returned: %d\n", err); | 6740 | DBG_PRINT(ERR_DBG, "%s: defaulting to INTA\n", |
6725 | return -1; | 6741 | dev->name); |
6742 | sp->config.intr_type = INTA; | ||
6743 | break; | ||
6726 | } | 6744 | } |
6727 | sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS; | 6745 | sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS; |
6728 | } | 6746 | } |
6729 | printk("MSI-X-TX %d entries enabled\n",msix_tx_cnt); | 6747 | if (!err) { |
6730 | printk("MSI-X-RX %d entries enabled\n",msix_rx_cnt); | 6748 | printk(KERN_INFO "MSI-X-TX %d entries enabled\n", |
6749 | msix_tx_cnt); | ||
6750 | printk(KERN_INFO "MSI-X-RX %d entries enabled\n", | ||
6751 | msix_rx_cnt); | ||
6752 | } | ||
6731 | } | 6753 | } |
6732 | if (sp->config.intr_type == INTA) { | 6754 | if (sp->config.intr_type == INTA) { |
6733 | err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED, | 6755 | err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED, |
@@ -6742,40 +6764,10 @@ static int s2io_add_isr(struct s2io_nic * sp) | |||
6742 | } | 6764 | } |
6743 | static void s2io_rem_isr(struct s2io_nic * sp) | 6765 | static void s2io_rem_isr(struct s2io_nic * sp) |
6744 | { | 6766 | { |
6745 | struct net_device *dev = sp->dev; | 6767 | if (sp->config.intr_type == MSI_X) |
6746 | struct swStat *stats = &sp->mac_control.stats_info->sw_stat; | 6768 | remove_msix_isr(sp); |
6747 | 6769 | else | |
6748 | if (sp->config.intr_type == MSI_X) { | 6770 | remove_inta_isr(sp); |
6749 | int i; | ||
6750 | u16 msi_control; | ||
6751 | |||
6752 | for (i=1; (sp->s2io_entries[i].in_use == | ||
6753 | MSIX_REGISTERED_SUCCESS); i++) { | ||
6754 | int vector = sp->entries[i].vector; | ||
6755 | void *arg = sp->s2io_entries[i].arg; | ||
6756 | |||
6757 | synchronize_irq(vector); | ||
6758 | free_irq(vector, arg); | ||
6759 | } | ||
6760 | |||
6761 | kfree(sp->entries); | ||
6762 | stats->mem_freed += | ||
6763 | (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); | ||
6764 | kfree(sp->s2io_entries); | ||
6765 | stats->mem_freed += | ||
6766 | (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); | ||
6767 | sp->entries = NULL; | ||
6768 | sp->s2io_entries = NULL; | ||
6769 | |||
6770 | pci_read_config_word(sp->pdev, 0x42, &msi_control); | ||
6771 | msi_control &= 0xFFFE; /* Disable MSI */ | ||
6772 | pci_write_config_word(sp->pdev, 0x42, msi_control); | ||
6773 | |||
6774 | pci_disable_msix(sp->pdev); | ||
6775 | } else { | ||
6776 | synchronize_irq(sp->pdev->irq); | ||
6777 | free_irq(sp->pdev->irq, dev); | ||
6778 | } | ||
6779 | } | 6771 | } |
6780 | 6772 | ||
6781 | static void do_s2io_card_down(struct s2io_nic * sp, int do_io) | 6773 | static void do_s2io_card_down(struct s2io_nic * sp, int do_io) |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 53b8344a68ef..f6fedcc32de1 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -2333,10 +2333,10 @@ static int gem_close(struct net_device *dev) | |||
2333 | { | 2333 | { |
2334 | struct gem *gp = dev->priv; | 2334 | struct gem *gp = dev->priv; |
2335 | 2335 | ||
2336 | napi_disable(&gp->napi); | ||
2337 | |||
2338 | mutex_lock(&gp->pm_mutex); | 2336 | mutex_lock(&gp->pm_mutex); |
2339 | 2337 | ||
2338 | napi_disable(&gp->napi); | ||
2339 | |||
2340 | gp->opened = 0; | 2340 | gp->opened = 0; |
2341 | if (!gp->asleep) | 2341 | if (!gp->asleep) |
2342 | gem_do_stop(dev, 0); | 2342 | gem_do_stop(dev, 0); |
@@ -2355,8 +2355,6 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2355 | 2355 | ||
2356 | mutex_lock(&gp->pm_mutex); | 2356 | mutex_lock(&gp->pm_mutex); |
2357 | 2357 | ||
2358 | napi_disable(&gp->napi); | ||
2359 | |||
2360 | printk(KERN_INFO "%s: suspending, WakeOnLan %s\n", | 2358 | printk(KERN_INFO "%s: suspending, WakeOnLan %s\n", |
2361 | dev->name, | 2359 | dev->name, |
2362 | (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled"); | 2360 | (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled"); |
@@ -2370,6 +2368,8 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2370 | 2368 | ||
2371 | /* If the driver is opened, we stop the MAC */ | 2369 | /* If the driver is opened, we stop the MAC */ |
2372 | if (gp->opened) { | 2370 | if (gp->opened) { |
2371 | napi_disable(&gp->napi); | ||
2372 | |||
2373 | /* Stop traffic, mark us closed */ | 2373 | /* Stop traffic, mark us closed */ |
2374 | netif_device_detach(dev); | 2374 | netif_device_detach(dev); |
2375 | 2375 | ||
@@ -2460,6 +2460,7 @@ static int gem_resume(struct pci_dev *pdev) | |||
2460 | /* Re-attach net device */ | 2460 | /* Re-attach net device */ |
2461 | netif_device_attach(dev); | 2461 | netif_device_attach(dev); |
2462 | 2462 | ||
2463 | napi_enable(&gp->napi); | ||
2463 | } | 2464 | } |
2464 | 2465 | ||
2465 | spin_lock_irqsave(&gp->lock, flags); | 2466 | spin_lock_irqsave(&gp->lock, flags); |
@@ -2479,8 +2480,6 @@ static int gem_resume(struct pci_dev *pdev) | |||
2479 | spin_unlock(&gp->tx_lock); | 2480 | spin_unlock(&gp->tx_lock); |
2480 | spin_unlock_irqrestore(&gp->lock, flags); | 2481 | spin_unlock_irqrestore(&gp->lock, flags); |
2481 | 2482 | ||
2482 | napi_enable(&gp->napi); | ||
2483 | |||
2484 | mutex_unlock(&gp->pm_mutex); | 2483 | mutex_unlock(&gp->pm_mutex); |
2485 | 2484 | ||
2486 | return 0; | 2485 | return 0; |
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index 4e1b84e6d66a..21230c97b2a0 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c | |||
@@ -2168,10 +2168,10 @@ bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | |||
2168 | { | 2168 | { |
2169 | struct bdx_priv *priv = netdev->priv; | 2169 | struct bdx_priv *priv = netdev->priv; |
2170 | 2170 | ||
2171 | strncat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); | 2171 | strlcat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); |
2172 | strncat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); | 2172 | strlcat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); |
2173 | strncat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | 2173 | strlcat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
2174 | strncat(drvinfo->bus_info, pci_name(priv->pdev), | 2174 | strlcat(drvinfo->bus_info, pci_name(priv->pdev), |
2175 | sizeof(drvinfo->bus_info)); | 2175 | sizeof(drvinfo->bus_info)); |
2176 | 2176 | ||
2177 | drvinfo->n_stats = ((priv->stats_flag) ? | 2177 | drvinfo->n_stats = ((priv->stats_flag) ? |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index cad519910767..4942f7d18937 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -64,8 +64,8 @@ | |||
64 | 64 | ||
65 | #define DRV_MODULE_NAME "tg3" | 65 | #define DRV_MODULE_NAME "tg3" |
66 | #define PFX DRV_MODULE_NAME ": " | 66 | #define PFX DRV_MODULE_NAME ": " |
67 | #define DRV_MODULE_VERSION "3.85" | 67 | #define DRV_MODULE_VERSION "3.86" |
68 | #define DRV_MODULE_RELDATE "October 18, 2007" | 68 | #define DRV_MODULE_RELDATE "November 9, 2007" |
69 | 69 | ||
70 | #define TG3_DEF_MAC_MODE 0 | 70 | #define TG3_DEF_MAC_MODE 0 |
71 | #define TG3_DEF_RX_MODE 0 | 71 | #define TG3_DEF_RX_MODE 0 |
@@ -1106,6 +1106,24 @@ static int tg3_phy_reset(struct tg3 *tp) | |||
1106 | if (err) | 1106 | if (err) |
1107 | return err; | 1107 | return err; |
1108 | 1108 | ||
1109 | if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { | ||
1110 | u32 val; | ||
1111 | |||
1112 | val = tr32(TG3_CPMU_LSPD_1000MB_CLK); | ||
1113 | if ((val & CPMU_LSPD_1000MB_MACCLK_MASK) == | ||
1114 | CPMU_LSPD_1000MB_MACCLK_12_5) { | ||
1115 | val &= ~CPMU_LSPD_1000MB_MACCLK_MASK; | ||
1116 | udelay(40); | ||
1117 | tw32_f(TG3_CPMU_LSPD_1000MB_CLK, val); | ||
1118 | } | ||
1119 | |||
1120 | /* Disable GPHY autopowerdown. */ | ||
1121 | tg3_writephy(tp, MII_TG3_MISC_SHDW, | ||
1122 | MII_TG3_MISC_SHDW_WREN | | ||
1123 | MII_TG3_MISC_SHDW_APD_SEL | | ||
1124 | MII_TG3_MISC_SHDW_APD_WKTM_84MS); | ||
1125 | } | ||
1126 | |||
1109 | out: | 1127 | out: |
1110 | if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) { | 1128 | if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) { |
1111 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); | 1129 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); |
@@ -1297,6 +1315,8 @@ static void tg3_nvram_unlock(struct tg3 *); | |||
1297 | 1315 | ||
1298 | static void tg3_power_down_phy(struct tg3 *tp) | 1316 | static void tg3_power_down_phy(struct tg3 *tp) |
1299 | { | 1317 | { |
1318 | u32 val; | ||
1319 | |||
1300 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { | 1320 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { |
1301 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { | 1321 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { |
1302 | u32 sg_dig_ctrl = tr32(SG_DIG_CTRL); | 1322 | u32 sg_dig_ctrl = tr32(SG_DIG_CTRL); |
@@ -1311,8 +1331,6 @@ static void tg3_power_down_phy(struct tg3 *tp) | |||
1311 | } | 1331 | } |
1312 | 1332 | ||
1313 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 1333 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
1314 | u32 val; | ||
1315 | |||
1316 | tg3_bmcr_reset(tp); | 1334 | tg3_bmcr_reset(tp); |
1317 | val = tr32(GRC_MISC_CFG); | 1335 | val = tr32(GRC_MISC_CFG); |
1318 | tw32_f(GRC_MISC_CFG, val | GRC_MISC_CFG_EPHY_IDDQ); | 1336 | tw32_f(GRC_MISC_CFG, val | GRC_MISC_CFG_EPHY_IDDQ); |
@@ -1332,6 +1350,14 @@ static void tg3_power_down_phy(struct tg3 *tp) | |||
1332 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && | 1350 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && |
1333 | (tp->tg3_flags2 & TG3_FLG2_MII_SERDES))) | 1351 | (tp->tg3_flags2 & TG3_FLG2_MII_SERDES))) |
1334 | return; | 1352 | return; |
1353 | |||
1354 | if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { | ||
1355 | val = tr32(TG3_CPMU_LSPD_1000MB_CLK); | ||
1356 | val &= ~CPMU_LSPD_1000MB_MACCLK_MASK; | ||
1357 | val |= CPMU_LSPD_1000MB_MACCLK_12_5; | ||
1358 | tw32_f(TG3_CPMU_LSPD_1000MB_CLK, val); | ||
1359 | } | ||
1360 | |||
1335 | tg3_writephy(tp, MII_BMCR, BMCR_PDOWN); | 1361 | tg3_writephy(tp, MII_BMCR, BMCR_PDOWN); |
1336 | } | 1362 | } |
1337 | 1363 | ||
@@ -3126,6 +3152,23 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset) | |||
3126 | err = tg3_setup_copper_phy(tp, force_reset); | 3152 | err = tg3_setup_copper_phy(tp, force_reset); |
3127 | } | 3153 | } |
3128 | 3154 | ||
3155 | if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 || | ||
3156 | tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) { | ||
3157 | u32 val, scale; | ||
3158 | |||
3159 | val = tr32(TG3_CPMU_CLCK_STAT) & CPMU_CLCK_STAT_MAC_CLCK_MASK; | ||
3160 | if (val == CPMU_CLCK_STAT_MAC_CLCK_62_5) | ||
3161 | scale = 65; | ||
3162 | else if (val == CPMU_CLCK_STAT_MAC_CLCK_6_25) | ||
3163 | scale = 6; | ||
3164 | else | ||
3165 | scale = 12; | ||
3166 | |||
3167 | val = tr32(GRC_MISC_CFG) & ~GRC_MISC_CFG_PRESCALAR_MASK; | ||
3168 | val |= (scale << GRC_MISC_CFG_PRESCALAR_SHIFT); | ||
3169 | tw32(GRC_MISC_CFG, val); | ||
3170 | } | ||
3171 | |||
3129 | if (tp->link_config.active_speed == SPEED_1000 && | 3172 | if (tp->link_config.active_speed == SPEED_1000 && |
3130 | tp->link_config.active_duplex == DUPLEX_HALF) | 3173 | tp->link_config.active_duplex == DUPLEX_HALF) |
3131 | tw32(MAC_TX_LENGTHS, | 3174 | tw32(MAC_TX_LENGTHS, |
@@ -5054,12 +5097,15 @@ static void tg3_restore_pci_state(struct tg3 *tp) | |||
5054 | 5097 | ||
5055 | pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd); | 5098 | pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd); |
5056 | 5099 | ||
5057 | if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) { | 5100 | if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) |
5101 | pcie_set_readrq(tp->pdev, 4096); | ||
5102 | else { | ||
5058 | pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE, | 5103 | pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE, |
5059 | tp->pci_cacheline_sz); | 5104 | tp->pci_cacheline_sz); |
5060 | pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER, | 5105 | pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER, |
5061 | tp->pci_lat_timer); | 5106 | tp->pci_lat_timer); |
5062 | } | 5107 | } |
5108 | |||
5063 | /* Make sure PCI-X relaxed ordering bit is clear. */ | 5109 | /* Make sure PCI-X relaxed ordering bit is clear. */ |
5064 | if (tp->pcix_cap) { | 5110 | if (tp->pcix_cap) { |
5065 | u16 pcix_cmd; | 5111 | u16 pcix_cmd; |
@@ -6343,10 +6389,26 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
6343 | 6389 | ||
6344 | tg3_write_sig_legacy(tp, RESET_KIND_INIT); | 6390 | tg3_write_sig_legacy(tp, RESET_KIND_INIT); |
6345 | 6391 | ||
6346 | if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0) { | 6392 | if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 || |
6393 | tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) { | ||
6347 | val = tr32(TG3_CPMU_CTRL); | 6394 | val = tr32(TG3_CPMU_CTRL); |
6348 | val &= ~(CPMU_CTRL_LINK_AWARE_MODE | CPMU_CTRL_LINK_IDLE_MODE); | 6395 | val &= ~(CPMU_CTRL_LINK_AWARE_MODE | CPMU_CTRL_LINK_IDLE_MODE); |
6349 | tw32(TG3_CPMU_CTRL, val); | 6396 | tw32(TG3_CPMU_CTRL, val); |
6397 | |||
6398 | val = tr32(TG3_CPMU_LSPD_10MB_CLK); | ||
6399 | val &= ~CPMU_LSPD_10MB_MACCLK_MASK; | ||
6400 | val |= CPMU_LSPD_10MB_MACCLK_6_25; | ||
6401 | tw32(TG3_CPMU_LSPD_10MB_CLK, val); | ||
6402 | |||
6403 | val = tr32(TG3_CPMU_LNK_AWARE_PWRMD); | ||
6404 | val &= ~CPMU_LNK_AWARE_MACCLK_MASK; | ||
6405 | val |= CPMU_LNK_AWARE_MACCLK_6_25; | ||
6406 | tw32(TG3_CPMU_LNK_AWARE_PWRMD, val); | ||
6407 | |||
6408 | val = tr32(TG3_CPMU_HST_ACC); | ||
6409 | val &= ~CPMU_HST_ACC_MACCLK_MASK; | ||
6410 | val |= CPMU_HST_ACC_MACCLK_6_25; | ||
6411 | tw32(TG3_CPMU_HST_ACC, val); | ||
6350 | } | 6412 | } |
6351 | 6413 | ||
6352 | /* This works around an issue with Athlon chipsets on | 6414 | /* This works around an issue with Athlon chipsets on |
@@ -8267,7 +8329,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
8267 | SUPPORTED_100baseT_Full | | 8329 | SUPPORTED_100baseT_Full | |
8268 | SUPPORTED_10baseT_Half | | 8330 | SUPPORTED_10baseT_Half | |
8269 | SUPPORTED_10baseT_Full | | 8331 | SUPPORTED_10baseT_Full | |
8270 | SUPPORTED_MII); | 8332 | SUPPORTED_TP); |
8271 | cmd->port = PORT_TP; | 8333 | cmd->port = PORT_TP; |
8272 | } else { | 8334 | } else { |
8273 | cmd->supported |= SUPPORTED_FIBRE; | 8335 | cmd->supported |= SUPPORTED_FIBRE; |
@@ -8664,7 +8726,9 @@ static void tg3_get_ethtool_stats (struct net_device *dev, | |||
8664 | } | 8726 | } |
8665 | 8727 | ||
8666 | #define NVRAM_TEST_SIZE 0x100 | 8728 | #define NVRAM_TEST_SIZE 0x100 |
8667 | #define NVRAM_SELFBOOT_FORMAT1_SIZE 0x14 | 8729 | #define NVRAM_SELFBOOT_FORMAT1_0_SIZE 0x14 |
8730 | #define NVRAM_SELFBOOT_FORMAT1_2_SIZE 0x18 | ||
8731 | #define NVRAM_SELFBOOT_FORMAT1_3_SIZE 0x1c | ||
8668 | #define NVRAM_SELFBOOT_HW_SIZE 0x20 | 8732 | #define NVRAM_SELFBOOT_HW_SIZE 0x20 |
8669 | #define NVRAM_SELFBOOT_DATA_SIZE 0x1c | 8733 | #define NVRAM_SELFBOOT_DATA_SIZE 0x1c |
8670 | 8734 | ||
@@ -8679,9 +8743,22 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8679 | if (magic == TG3_EEPROM_MAGIC) | 8743 | if (magic == TG3_EEPROM_MAGIC) |
8680 | size = NVRAM_TEST_SIZE; | 8744 | size = NVRAM_TEST_SIZE; |
8681 | else if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) { | 8745 | else if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) { |
8682 | if ((magic & 0xe00000) == 0x200000) | 8746 | if ((magic & TG3_EEPROM_SB_FORMAT_MASK) == |
8683 | size = NVRAM_SELFBOOT_FORMAT1_SIZE; | 8747 | TG3_EEPROM_SB_FORMAT_1) { |
8684 | else | 8748 | switch (magic & TG3_EEPROM_SB_REVISION_MASK) { |
8749 | case TG3_EEPROM_SB_REVISION_0: | ||
8750 | size = NVRAM_SELFBOOT_FORMAT1_0_SIZE; | ||
8751 | break; | ||
8752 | case TG3_EEPROM_SB_REVISION_2: | ||
8753 | size = NVRAM_SELFBOOT_FORMAT1_2_SIZE; | ||
8754 | break; | ||
8755 | case TG3_EEPROM_SB_REVISION_3: | ||
8756 | size = NVRAM_SELFBOOT_FORMAT1_3_SIZE; | ||
8757 | break; | ||
8758 | default: | ||
8759 | return 0; | ||
8760 | } | ||
8761 | } else | ||
8685 | return 0; | 8762 | return 0; |
8686 | } else if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW) | 8763 | } else if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW) |
8687 | size = NVRAM_SELFBOOT_HW_SIZE; | 8764 | size = NVRAM_SELFBOOT_HW_SIZE; |
@@ -8708,8 +8785,17 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8708 | TG3_EEPROM_MAGIC_FW) { | 8785 | TG3_EEPROM_MAGIC_FW) { |
8709 | u8 *buf8 = (u8 *) buf, csum8 = 0; | 8786 | u8 *buf8 = (u8 *) buf, csum8 = 0; |
8710 | 8787 | ||
8711 | for (i = 0; i < size; i++) | 8788 | if ((cpu_to_be32(buf[0]) & TG3_EEPROM_SB_REVISION_MASK) == |
8712 | csum8 += buf8[i]; | 8789 | TG3_EEPROM_SB_REVISION_2) { |
8790 | /* For rev 2, the csum doesn't include the MBA. */ | ||
8791 | for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++) | ||
8792 | csum8 += buf8[i]; | ||
8793 | for (i = TG3_EEPROM_SB_F1R2_MBA_OFF + 4; i < size; i++) | ||
8794 | csum8 += buf8[i]; | ||
8795 | } else { | ||
8796 | for (i = 0; i < size; i++) | ||
8797 | csum8 += buf8[i]; | ||
8798 | } | ||
8713 | 8799 | ||
8714 | if (csum8 == 0) { | 8800 | if (csum8 == 0) { |
8715 | err = 0; | 8801 | err = 0; |
@@ -9293,7 +9379,7 @@ static int tg3_test_loopback(struct tg3 *tp) | |||
9293 | if (err) | 9379 | if (err) |
9294 | return TG3_LOOPBACK_FAILED; | 9380 | return TG3_LOOPBACK_FAILED; |
9295 | 9381 | ||
9296 | if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) { | 9382 | if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { |
9297 | int i; | 9383 | int i; |
9298 | u32 status; | 9384 | u32 status; |
9299 | 9385 | ||
@@ -9310,17 +9396,17 @@ static int tg3_test_loopback(struct tg3 *tp) | |||
9310 | if (status != CPMU_MUTEX_GNT_DRIVER) | 9396 | if (status != CPMU_MUTEX_GNT_DRIVER) |
9311 | return TG3_LOOPBACK_FAILED; | 9397 | return TG3_LOOPBACK_FAILED; |
9312 | 9398 | ||
9313 | cpmuctrl = tr32(TG3_CPMU_CTRL); | ||
9314 | |||
9315 | /* Turn off power management based on link speed. */ | 9399 | /* Turn off power management based on link speed. */ |
9400 | cpmuctrl = tr32(TG3_CPMU_CTRL); | ||
9316 | tw32(TG3_CPMU_CTRL, | 9401 | tw32(TG3_CPMU_CTRL, |
9317 | cpmuctrl & ~CPMU_CTRL_LINK_SPEED_MODE); | 9402 | cpmuctrl & ~(CPMU_CTRL_LINK_SPEED_MODE | |
9403 | CPMU_CTRL_LINK_AWARE_MODE)); | ||
9318 | } | 9404 | } |
9319 | 9405 | ||
9320 | if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK)) | 9406 | if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK)) |
9321 | err |= TG3_MAC_LOOPBACK_FAILED; | 9407 | err |= TG3_MAC_LOOPBACK_FAILED; |
9322 | 9408 | ||
9323 | if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) { | 9409 | if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { |
9324 | tw32(TG3_CPMU_CTRL, cpmuctrl); | 9410 | tw32(TG3_CPMU_CTRL, cpmuctrl); |
9325 | 9411 | ||
9326 | /* Release the mutex */ | 9412 | /* Release the mutex */ |
@@ -10541,6 +10627,10 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
10541 | tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) | 10627 | tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) |
10542 | tp->led_ctrl = LED_CTRL_MODE_PHY_2; | 10628 | tp->led_ctrl = LED_CTRL_MODE_PHY_2; |
10543 | 10629 | ||
10630 | if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 || | ||
10631 | tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) | ||
10632 | tp->led_ctrl = LED_CTRL_MODE_MAC; | ||
10633 | |||
10544 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) { | 10634 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) { |
10545 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | 10635 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; |
10546 | if ((tp->pdev->subsystem_vendor == | 10636 | if ((tp->pdev->subsystem_vendor == |
@@ -10859,7 +10949,7 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp) | |||
10859 | } | 10949 | } |
10860 | 10950 | ||
10861 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || | 10951 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || |
10862 | (tp->tg3_flags & TG3_FLG3_ENABLE_APE)) | 10952 | (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)) |
10863 | return; | 10953 | return; |
10864 | 10954 | ||
10865 | for (offset = TG3_NVM_DIR_START; | 10955 | for (offset = TG3_NVM_DIR_START; |
@@ -11127,6 +11217,9 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
11127 | pcie_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_EXP); | 11217 | pcie_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_EXP); |
11128 | if (pcie_cap != 0) { | 11218 | if (pcie_cap != 0) { |
11129 | tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; | 11219 | tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; |
11220 | |||
11221 | pcie_set_readrq(tp->pdev, 4096); | ||
11222 | |||
11130 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 11223 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
11131 | u16 lnkctl; | 11224 | u16 lnkctl; |
11132 | 11225 | ||
@@ -11307,9 +11400,16 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
11307 | } | 11400 | } |
11308 | 11401 | ||
11309 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || | 11402 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || |
11310 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) | 11403 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) { |
11311 | tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT; | 11404 | tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT; |
11312 | 11405 | ||
11406 | if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 || | ||
11407 | tp->pci_chip_rev_id == CHIPREV_ID_5784_A1 || | ||
11408 | tp->pci_chip_rev_id == CHIPREV_ID_5761_A0 || | ||
11409 | tp->pci_chip_rev_id == CHIPREV_ID_5761_A1) | ||
11410 | tp->tg3_flags3 |= TG3_FLG3_5761_5784_AX_FIXES; | ||
11411 | } | ||
11412 | |||
11313 | /* Set up tp->grc_local_ctrl before calling tg3_set_power_state(). | 11413 | /* Set up tp->grc_local_ctrl before calling tg3_set_power_state(). |
11314 | * GPIO1 driven high will bring 5700's external PHY out of reset. | 11414 | * GPIO1 driven high will bring 5700's external PHY out of reset. |
11315 | * It is also used as eeprom write protect on LOMs. | 11415 | * It is also used as eeprom write protect on LOMs. |
@@ -12464,6 +12564,28 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
12464 | goto err_out_iounmap; | 12564 | goto err_out_iounmap; |
12465 | } | 12565 | } |
12466 | 12566 | ||
12567 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) { | ||
12568 | if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { | ||
12569 | printk(KERN_ERR PFX "Cannot find proper PCI device " | ||
12570 | "base address for APE, aborting.\n"); | ||
12571 | err = -ENODEV; | ||
12572 | goto err_out_iounmap; | ||
12573 | } | ||
12574 | |||
12575 | tg3reg_base = pci_resource_start(pdev, 2); | ||
12576 | tg3reg_len = pci_resource_len(pdev, 2); | ||
12577 | |||
12578 | tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len); | ||
12579 | if (tp->aperegs == 0UL) { | ||
12580 | printk(KERN_ERR PFX "Cannot map APE registers, " | ||
12581 | "aborting.\n"); | ||
12582 | err = -ENOMEM; | ||
12583 | goto err_out_iounmap; | ||
12584 | } | ||
12585 | |||
12586 | tg3_ape_lock_init(tp); | ||
12587 | } | ||
12588 | |||
12467 | /* | 12589 | /* |
12468 | * Reset chip in case UNDI or EFI driver did not shutdown | 12590 | * Reset chip in case UNDI or EFI driver did not shutdown |
12469 | * DMA self test will enable WDMAC and we'll see (spurious) | 12591 | * DMA self test will enable WDMAC and we'll see (spurious) |
@@ -12478,7 +12600,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
12478 | err = tg3_test_dma(tp); | 12600 | err = tg3_test_dma(tp); |
12479 | if (err) { | 12601 | if (err) { |
12480 | printk(KERN_ERR PFX "DMA engine test failed, aborting.\n"); | 12602 | printk(KERN_ERR PFX "DMA engine test failed, aborting.\n"); |
12481 | goto err_out_iounmap; | 12603 | goto err_out_apeunmap; |
12482 | } | 12604 | } |
12483 | 12605 | ||
12484 | /* Tigon3 can do ipv4 only... and some chips have buggy | 12606 | /* Tigon3 can do ipv4 only... and some chips have buggy |
@@ -12501,28 +12623,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
12501 | 12623 | ||
12502 | tg3_init_coal(tp); | 12624 | tg3_init_coal(tp); |
12503 | 12625 | ||
12504 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) { | ||
12505 | if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { | ||
12506 | printk(KERN_ERR PFX "Cannot find proper PCI device " | ||
12507 | "base address for APE, aborting.\n"); | ||
12508 | err = -ENODEV; | ||
12509 | goto err_out_iounmap; | ||
12510 | } | ||
12511 | |||
12512 | tg3reg_base = pci_resource_start(pdev, 2); | ||
12513 | tg3reg_len = pci_resource_len(pdev, 2); | ||
12514 | |||
12515 | tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len); | ||
12516 | if (tp->aperegs == 0UL) { | ||
12517 | printk(KERN_ERR PFX "Cannot map APE registers, " | ||
12518 | "aborting.\n"); | ||
12519 | err = -ENOMEM; | ||
12520 | goto err_out_iounmap; | ||
12521 | } | ||
12522 | |||
12523 | tg3_ape_lock_init(tp); | ||
12524 | } | ||
12525 | |||
12526 | pci_set_drvdata(pdev, dev); | 12626 | pci_set_drvdata(pdev, dev); |
12527 | 12627 | ||
12528 | err = register_netdev(dev); | 12628 | err = register_netdev(dev); |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 1d5b2a3dd29d..da18fb220712 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -109,6 +109,9 @@ | |||
109 | #define CHIPREV_ID_5714_A2 0x9002 | 109 | #define CHIPREV_ID_5714_A2 0x9002 |
110 | #define CHIPREV_ID_5906_A1 0xc001 | 110 | #define CHIPREV_ID_5906_A1 0xc001 |
111 | #define CHIPREV_ID_5784_A0 0x5784000 | 111 | #define CHIPREV_ID_5784_A0 0x5784000 |
112 | #define CHIPREV_ID_5784_A1 0x5784001 | ||
113 | #define CHIPREV_ID_5761_A0 0x5761000 | ||
114 | #define CHIPREV_ID_5761_A1 0x5761001 | ||
112 | #define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) | 115 | #define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) |
113 | #define ASIC_REV_5700 0x07 | 116 | #define ASIC_REV_5700 0x07 |
114 | #define ASIC_REV_5701 0x00 | 117 | #define ASIC_REV_5701 0x00 |
@@ -856,7 +859,31 @@ | |||
856 | #define CPMU_CTRL_LINK_IDLE_MODE 0x00000200 | 859 | #define CPMU_CTRL_LINK_IDLE_MODE 0x00000200 |
857 | #define CPMU_CTRL_LINK_AWARE_MODE 0x00000400 | 860 | #define CPMU_CTRL_LINK_AWARE_MODE 0x00000400 |
858 | #define CPMU_CTRL_LINK_SPEED_MODE 0x00004000 | 861 | #define CPMU_CTRL_LINK_SPEED_MODE 0x00004000 |
859 | /* 0x3604 --> 0x365c unused */ | 862 | #define TG3_CPMU_LSPD_10MB_CLK 0x00003604 |
863 | #define CPMU_LSPD_10MB_MACCLK_MASK 0x001f0000 | ||
864 | #define CPMU_LSPD_10MB_MACCLK_6_25 0x00130000 | ||
865 | /* 0x3608 --> 0x360c unused */ | ||
866 | |||
867 | #define TG3_CPMU_LSPD_1000MB_CLK 0x0000360c | ||
868 | #define CPMU_LSPD_1000MB_MACCLK_62_5 0x00000000 | ||
869 | #define CPMU_LSPD_1000MB_MACCLK_12_5 0x00110000 | ||
870 | #define CPMU_LSPD_1000MB_MACCLK_MASK 0x001f0000 | ||
871 | #define TG3_CPMU_LNK_AWARE_PWRMD 0x00003610 | ||
872 | #define CPMU_LNK_AWARE_MACCLK_MASK 0x001f0000 | ||
873 | #define CPMU_LNK_AWARE_MACCLK_6_25 0x00130000 | ||
874 | /* 0x3614 --> 0x361c unused */ | ||
875 | |||
876 | #define TG3_CPMU_HST_ACC 0x0000361c | ||
877 | #define CPMU_HST_ACC_MACCLK_MASK 0x001f0000 | ||
878 | #define CPMU_HST_ACC_MACCLK_6_25 0x00130000 | ||
879 | /* 0x3620 --> 0x3630 unused */ | ||
880 | |||
881 | #define TG3_CPMU_CLCK_STAT 0x00003630 | ||
882 | #define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000 | ||
883 | #define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 | ||
884 | #define CPMU_CLCK_STAT_MAC_CLCK_12_5 0x00110000 | ||
885 | #define CPMU_CLCK_STAT_MAC_CLCK_6_25 0x00130000 | ||
886 | /* 0x3634 --> 0x365c unused */ | ||
860 | 887 | ||
861 | #define TG3_CPMU_MUTEX_REQ 0x0000365c | 888 | #define TG3_CPMU_MUTEX_REQ 0x0000365c |
862 | #define CPMU_MUTEX_REQ_DRIVER 0x00001000 | 889 | #define CPMU_MUTEX_REQ_DRIVER 0x00001000 |
@@ -1537,6 +1564,12 @@ | |||
1537 | #define TG3_EEPROM_MAGIC 0x669955aa | 1564 | #define TG3_EEPROM_MAGIC 0x669955aa |
1538 | #define TG3_EEPROM_MAGIC_FW 0xa5000000 | 1565 | #define TG3_EEPROM_MAGIC_FW 0xa5000000 |
1539 | #define TG3_EEPROM_MAGIC_FW_MSK 0xff000000 | 1566 | #define TG3_EEPROM_MAGIC_FW_MSK 0xff000000 |
1567 | #define TG3_EEPROM_SB_FORMAT_MASK 0x00e00000 | ||
1568 | #define TG3_EEPROM_SB_FORMAT_1 0x00200000 | ||
1569 | #define TG3_EEPROM_SB_REVISION_MASK 0x001f0000 | ||
1570 | #define TG3_EEPROM_SB_REVISION_0 0x00000000 | ||
1571 | #define TG3_EEPROM_SB_REVISION_2 0x00020000 | ||
1572 | #define TG3_EEPROM_SB_REVISION_3 0x00030000 | ||
1540 | #define TG3_EEPROM_MAGIC_HW 0xabcd | 1573 | #define TG3_EEPROM_MAGIC_HW 0xabcd |
1541 | #define TG3_EEPROM_MAGIC_HW_MSK 0xffff | 1574 | #define TG3_EEPROM_MAGIC_HW_MSK 0xffff |
1542 | 1575 | ||
@@ -1691,6 +1724,12 @@ | |||
1691 | #define MII_TG3_ISTAT 0x1a /* IRQ status register */ | 1724 | #define MII_TG3_ISTAT 0x1a /* IRQ status register */ |
1692 | #define MII_TG3_IMASK 0x1b /* IRQ mask register */ | 1725 | #define MII_TG3_IMASK 0x1b /* IRQ mask register */ |
1693 | 1726 | ||
1727 | #define MII_TG3_MISC_SHDW 0x1c | ||
1728 | #define MII_TG3_MISC_SHDW_WREN 0x8000 | ||
1729 | #define MII_TG3_MISC_SHDW_APD_SEL 0x2800 | ||
1730 | |||
1731 | #define MII_TG3_MISC_SHDW_APD_WKTM_84MS 0x0001 | ||
1732 | |||
1694 | /* ISTAT/IMASK event bits */ | 1733 | /* ISTAT/IMASK event bits */ |
1695 | #define MII_TG3_INT_LINKCHG 0x0002 | 1734 | #define MII_TG3_INT_LINKCHG 0x0002 |
1696 | #define MII_TG3_INT_SPEEDCHG 0x0004 | 1735 | #define MII_TG3_INT_SPEEDCHG 0x0004 |
@@ -1747,6 +1786,8 @@ | |||
1747 | /* APE convenience enumerations. */ | 1786 | /* APE convenience enumerations. */ |
1748 | #define TG3_APE_LOCK_MEM 4 | 1787 | #define TG3_APE_LOCK_MEM 4 |
1749 | 1788 | ||
1789 | #define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10 | ||
1790 | |||
1750 | 1791 | ||
1751 | /* There are two ways to manage the TX descriptors on the tigon3. | 1792 | /* There are two ways to manage the TX descriptors on the tigon3. |
1752 | * Either the descriptors are in host DMA'able memory, or they | 1793 | * Either the descriptors are in host DMA'able memory, or they |
@@ -2352,6 +2393,7 @@ struct tg3 { | |||
2352 | u32 tg3_flags3; | 2393 | u32 tg3_flags3; |
2353 | #define TG3_FLG3_NO_NVRAM_ADDR_TRANS 0x00000001 | 2394 | #define TG3_FLG3_NO_NVRAM_ADDR_TRANS 0x00000001 |
2354 | #define TG3_FLG3_ENABLE_APE 0x00000002 | 2395 | #define TG3_FLG3_ENABLE_APE 0x00000002 |
2396 | #define TG3_FLG3_5761_5784_AX_FIXES 0x00000004 | ||
2355 | 2397 | ||
2356 | struct timer_list timer; | 2398 | struct timer_list timer; |
2357 | u16 timer_counter; | 2399 | u16 timer_counter; |
diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig index 49d7a290dbbc..20ac1503021e 100644 --- a/drivers/net/tulip/Kconfig +++ b/drivers/net/tulip/Kconfig | |||
@@ -24,8 +24,7 @@ config DE2104X | |||
24 | will say Y here.) Do read the Ethernet-HOWTO, available from | 24 | will say Y here.) Do read the Ethernet-HOWTO, available from |
25 | <http://www.tldp.org/docs.html#howto>. | 25 | <http://www.tldp.org/docs.html#howto>. |
26 | 26 | ||
27 | To compile this driver as a module, choose M here and read | 27 | To compile this driver as a module, choose M here. The module will |
28 | <file:Documentation/networking/net-modules.txt>. The module will | ||
29 | be called de2104x. | 28 | be called de2104x. |
30 | 29 | ||
31 | config TULIP | 30 | config TULIP |
@@ -42,8 +41,7 @@ config TULIP | |||
42 | will say Y here.) Do read the Ethernet-HOWTO, available from | 41 | will say Y here.) Do read the Ethernet-HOWTO, available from |
43 | <http://www.tldp.org/docs.html#howto>. | 42 | <http://www.tldp.org/docs.html#howto>. |
44 | 43 | ||
45 | To compile this driver as a module, choose M here and read | 44 | To compile this driver as a module, choose M here. The module will |
46 | <file:Documentation/networking/net-modules.txt>. The module will | ||
47 | be called tulip. | 45 | be called tulip. |
48 | 46 | ||
49 | config TULIP_MWI | 47 | config TULIP_MWI |
@@ -104,8 +102,7 @@ config DE4X5 | |||
104 | information is contained in | 102 | information is contained in |
105 | <file:Documentation/networking/de4x5.txt>. | 103 | <file:Documentation/networking/de4x5.txt>. |
106 | 104 | ||
107 | To compile this driver as a module, choose M here and read | 105 | To compile this driver as a module, choose M here. The module will |
108 | <file:Documentation/networking/net-modules.txt>. The module will | ||
109 | be called de4x5. | 106 | be called de4x5. |
110 | 107 | ||
111 | config WINBOND_840 | 108 | config WINBOND_840 |
@@ -129,8 +126,7 @@ config DM9102 | |||
129 | (Ethernet) card, say Y. Some information is contained in the file | 126 | (Ethernet) card, say Y. Some information is contained in the file |
130 | <file:Documentation/networking/dmfe.txt>. | 127 | <file:Documentation/networking/dmfe.txt>. |
131 | 128 | ||
132 | To compile this driver as a module, choose M here and read | 129 | To compile this driver as a module, choose M here. The module will |
133 | <file:Documentation/networking/net-modules.txt>. The module will | ||
134 | be called dmfe. | 130 | be called dmfe. |
135 | 131 | ||
136 | config ULI526X | 132 | config ULI526X |
@@ -141,8 +137,7 @@ config ULI526X | |||
141 | This driver is for ULi M5261/M5263 10/100M Ethernet Controller | 137 | This driver is for ULi M5261/M5263 10/100M Ethernet Controller |
142 | (<http://www.uli.com.tw/>). | 138 | (<http://www.uli.com.tw/>). |
143 | 139 | ||
144 | To compile this driver as a module, choose M here and read | 140 | To compile this driver as a module, choose M here. The module will |
145 | <file:Documentation/networking/net-modules.txt>. The module will | ||
146 | be called uli526x. | 141 | be called uli526x. |
147 | 142 | ||
148 | config PCMCIA_XIRCOM | 143 | config PCMCIA_XIRCOM |
@@ -154,8 +149,7 @@ config PCMCIA_XIRCOM | |||
154 | as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and | 149 | as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and |
155 | ASIX. | 150 | ASIX. |
156 | 151 | ||
157 | To compile this driver as a module, choose M here and read | 152 | To compile this driver as a module, choose M here. The module will |
158 | <file:Documentation/networking/net-modules.txt>. The module will | ||
159 | be called xircom_cb. If unsure, say N. | 153 | be called xircom_cb. If unsure, say N. |
160 | 154 | ||
161 | config PCMCIA_XIRTULIP | 155 | config PCMCIA_XIRTULIP |
@@ -168,8 +162,7 @@ config PCMCIA_XIRTULIP | |||
168 | as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and | 162 | as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and |
169 | ASIX. | 163 | ASIX. |
170 | 164 | ||
171 | To compile this driver as a module, choose M here and read | 165 | To compile this driver as a module, choose M here. The module will |
172 | <file:Documentation/networking/net-modules.txt>. The module will | ||
173 | be called xircom_tulip_cb. If unsure, say N. | 166 | be called xircom_tulip_cb. If unsure, say N. |
174 | 167 | ||
175 | endif # NET_TULIP | 168 | endif # NET_TULIP |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index e396c9d2af8d..a75be57fb209 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -146,6 +146,7 @@ static void try_fill_recv(struct virtnet_info *vi) | |||
146 | struct scatterlist sg[1+MAX_SKB_FRAGS]; | 146 | struct scatterlist sg[1+MAX_SKB_FRAGS]; |
147 | int num, err; | 147 | int num, err; |
148 | 148 | ||
149 | sg_init_table(sg, 1+MAX_SKB_FRAGS); | ||
149 | for (;;) { | 150 | for (;;) { |
150 | skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN); | 151 | skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN); |
151 | if (unlikely(!skb)) | 152 | if (unlikely(!skb)) |
@@ -231,6 +232,8 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
231 | const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest; | 232 | const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest; |
232 | DECLARE_MAC_BUF(mac); | 233 | DECLARE_MAC_BUF(mac); |
233 | 234 | ||
235 | sg_init_table(sg, 1+MAX_SKB_FRAGS); | ||
236 | |||
234 | pr_debug("%s: xmit %p %s\n", dev->name, skb, print_mac(mac, dest)); | 237 | pr_debug("%s: xmit %p %s\n", dev->name, skb, print_mac(mac, dest)); |
235 | 238 | ||
236 | free_old_xmit_skbs(vi); | 239 | free_old_xmit_skbs(vi); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 4f22a7174caf..ee752f1e21dd 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -4850,7 +4850,7 @@ static irqreturn_t iwl_isr(int irq, void *data) | |||
4850 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { | 4850 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { |
4851 | /* Hardware disappeared */ | 4851 | /* Hardware disappeared */ |
4852 | IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta); | 4852 | IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta); |
4853 | goto none; | 4853 | goto unplugged; |
4854 | } | 4854 | } |
4855 | 4855 | ||
4856 | IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", | 4856 | IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", |
@@ -4858,6 +4858,7 @@ static irqreturn_t iwl_isr(int irq, void *data) | |||
4858 | 4858 | ||
4859 | /* iwl_irq_tasklet() will service interrupts and re-enable them */ | 4859 | /* iwl_irq_tasklet() will service interrupts and re-enable them */ |
4860 | tasklet_schedule(&priv->irq_tasklet); | 4860 | tasklet_schedule(&priv->irq_tasklet); |
4861 | unplugged: | ||
4861 | spin_unlock(&priv->lock); | 4862 | spin_unlock(&priv->lock); |
4862 | 4863 | ||
4863 | return IRQ_HANDLED; | 4864 | return IRQ_HANDLED; |
@@ -8354,6 +8355,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8354 | } | 8355 | } |
8355 | SET_IEEE80211_DEV(hw, &pdev->dev); | 8356 | SET_IEEE80211_DEV(hw, &pdev->dev); |
8356 | 8357 | ||
8358 | hw->rate_control_algorithm = "iwl-3945-rs"; | ||
8359 | |||
8357 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); | 8360 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); |
8358 | priv = hw->priv; | 8361 | priv = hw->priv; |
8359 | priv->hw = hw; | 8362 | priv->hw = hw; |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index d60adcb9bd4a..6757c6c1b25a 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -8955,6 +8955,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8955 | } | 8955 | } |
8956 | SET_IEEE80211_DEV(hw, &pdev->dev); | 8956 | SET_IEEE80211_DEV(hw, &pdev->dev); |
8957 | 8957 | ||
8958 | hw->rate_control_algorithm = "iwl-4965-rs"; | ||
8959 | |||
8958 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); | 8960 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); |
8959 | priv = hw->priv; | 8961 | priv = hw->priv; |
8960 | priv->hw = hw; | 8962 | priv->hw = hw; |
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c index a83c3db7d18f..c93d3d2640ab 100644 --- a/drivers/oprofile/cpu_buffer.c +++ b/drivers/oprofile/cpu_buffer.c | |||
@@ -64,6 +64,8 @@ int alloc_cpu_buffers(void) | |||
64 | b->head_pos = 0; | 64 | b->head_pos = 0; |
65 | b->sample_received = 0; | 65 | b->sample_received = 0; |
66 | b->sample_lost_overflow = 0; | 66 | b->sample_lost_overflow = 0; |
67 | b->backtrace_aborted = 0; | ||
68 | b->sample_invalid_eip = 0; | ||
67 | b->cpu = i; | 69 | b->cpu = i; |
68 | INIT_DELAYED_WORK(&b->work, wq_sync_buffer); | 70 | INIT_DELAYED_WORK(&b->work, wq_sync_buffer); |
69 | } | 71 | } |
@@ -175,6 +177,11 @@ static int log_sample(struct oprofile_cpu_buffer * cpu_buf, unsigned long pc, | |||
175 | 177 | ||
176 | cpu_buf->sample_received++; | 178 | cpu_buf->sample_received++; |
177 | 179 | ||
180 | if (pc == ESCAPE_CODE) { | ||
181 | cpu_buf->sample_invalid_eip++; | ||
182 | return 0; | ||
183 | } | ||
184 | |||
178 | if (nr_available_slots(cpu_buf) < 3) { | 185 | if (nr_available_slots(cpu_buf) < 3) { |
179 | cpu_buf->sample_lost_overflow++; | 186 | cpu_buf->sample_lost_overflow++; |
180 | return 0; | 187 | return 0; |
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h index 49900d9e3235..c66c025abe75 100644 --- a/drivers/oprofile/cpu_buffer.h +++ b/drivers/oprofile/cpu_buffer.h | |||
@@ -42,6 +42,7 @@ struct oprofile_cpu_buffer { | |||
42 | unsigned long sample_received; | 42 | unsigned long sample_received; |
43 | unsigned long sample_lost_overflow; | 43 | unsigned long sample_lost_overflow; |
44 | unsigned long backtrace_aborted; | 44 | unsigned long backtrace_aborted; |
45 | unsigned long sample_invalid_eip; | ||
45 | int cpu; | 46 | int cpu; |
46 | struct delayed_work work; | 47 | struct delayed_work work; |
47 | } ____cacheline_aligned; | 48 | } ____cacheline_aligned; |
diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c index f0acb661c253..d1f6d776e9e4 100644 --- a/drivers/oprofile/oprofile_stats.c +++ b/drivers/oprofile/oprofile_stats.c | |||
@@ -26,6 +26,8 @@ void oprofile_reset_stats(void) | |||
26 | cpu_buf = &cpu_buffer[i]; | 26 | cpu_buf = &cpu_buffer[i]; |
27 | cpu_buf->sample_received = 0; | 27 | cpu_buf->sample_received = 0; |
28 | cpu_buf->sample_lost_overflow = 0; | 28 | cpu_buf->sample_lost_overflow = 0; |
29 | cpu_buf->backtrace_aborted = 0; | ||
30 | cpu_buf->sample_invalid_eip = 0; | ||
29 | } | 31 | } |
30 | 32 | ||
31 | atomic_set(&oprofile_stats.sample_lost_no_mm, 0); | 33 | atomic_set(&oprofile_stats.sample_lost_no_mm, 0); |
@@ -61,6 +63,8 @@ void oprofile_create_stats_files(struct super_block * sb, struct dentry * root) | |||
61 | &cpu_buf->sample_lost_overflow); | 63 | &cpu_buf->sample_lost_overflow); |
62 | oprofilefs_create_ro_ulong(sb, cpudir, "backtrace_aborted", | 64 | oprofilefs_create_ro_ulong(sb, cpudir, "backtrace_aborted", |
63 | &cpu_buf->backtrace_aborted); | 65 | &cpu_buf->backtrace_aborted); |
66 | oprofilefs_create_ro_ulong(sb, cpudir, "sample_invalid_eip", | ||
67 | &cpu_buf->sample_invalid_eip); | ||
64 | } | 68 | } |
65 | 69 | ||
66 | oprofilefs_create_ro_atomic(sb, dir, "sample_lost_no_mm", | 70 | oprofilefs_create_ro_atomic(sb, dir, "sample_lost_no_mm", |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index cbde770eb121..e5cdc0294aaa 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -36,7 +36,9 @@ config RTC_HCTOSYS_DEVICE | |||
36 | help | 36 | help |
37 | The RTC device that will be used to (re)initialize the system | 37 | The RTC device that will be used to (re)initialize the system |
38 | clock, usually rtc0. Initialization is done when the system | 38 | clock, usually rtc0. Initialization is done when the system |
39 | starts up, and when it resumes from a low power state. | 39 | starts up, and when it resumes from a low power state. This |
40 | device should record time in UTC, since the kernel won't do | ||
41 | timezone correction. | ||
40 | 42 | ||
41 | The driver for this RTC device must be loaded before late_initcall | 43 | The driver for this RTC device must be loaded before late_initcall |
42 | functions run, so it must usually be statically linked. | 44 | functions run, so it must usually be statically linked. |
@@ -133,8 +135,8 @@ config RTC_DRV_DS1307 | |||
133 | 135 | ||
134 | The first seven registers on these chips hold an RTC, and other | 136 | The first seven registers on these chips hold an RTC, and other |
135 | registers may add features such as NVRAM, a trickle charger for | 137 | registers may add features such as NVRAM, a trickle charger for |
136 | the RTC/NVRAM backup power, and alarms. This driver may not | 138 | the RTC/NVRAM backup power, and alarms. NVRAM is visible in |
137 | expose all those available chip features. | 139 | sysfs, but other chip features may not be available. |
138 | 140 | ||
139 | This driver can also be built as a module. If so, the module | 141 | This driver can also be built as a module. If so, the module |
140 | will be called rtc-ds1307. | 142 | will be called rtc-ds1307. |
diff --git a/drivers/rtc/hctosys.c b/drivers/rtc/hctosys.c index 178527252c6a..33c0e98243ee 100644 --- a/drivers/rtc/hctosys.c +++ b/drivers/rtc/hctosys.c | |||
@@ -47,8 +47,8 @@ static int __init rtc_hctosys(void) | |||
47 | do_settimeofday(&tv); | 47 | do_settimeofday(&tv); |
48 | 48 | ||
49 | dev_info(rtc->dev.parent, | 49 | dev_info(rtc->dev.parent, |
50 | "setting the system clock to " | 50 | "setting system clock to " |
51 | "%d-%02d-%02d %02d:%02d:%02d (%u)\n", | 51 | "%d-%02d-%02d %02d:%02d:%02d UTC (%u)\n", |
52 | tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, | 52 | tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, |
53 | tm.tm_hour, tm.tm_min, tm.tm_sec, | 53 | tm.tm_hour, tm.tm_min, tm.tm_sec, |
54 | (unsigned int) tv.tv_sec); | 54 | (unsigned int) tv.tv_sec); |
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index db6f3f0d8982..bc1c7fe94ad3 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
@@ -89,6 +89,7 @@ enum ds_type { | |||
89 | 89 | ||
90 | struct ds1307 { | 90 | struct ds1307 { |
91 | u8 reg_addr; | 91 | u8 reg_addr; |
92 | bool has_nvram; | ||
92 | u8 regs[8]; | 93 | u8 regs[8]; |
93 | enum ds_type type; | 94 | enum ds_type type; |
94 | struct i2c_msg msg[2]; | 95 | struct i2c_msg msg[2]; |
@@ -242,6 +243,87 @@ static const struct rtc_class_ops ds13xx_rtc_ops = { | |||
242 | .set_time = ds1307_set_time, | 243 | .set_time = ds1307_set_time, |
243 | }; | 244 | }; |
244 | 245 | ||
246 | /*----------------------------------------------------------------------*/ | ||
247 | |||
248 | #define NVRAM_SIZE 56 | ||
249 | |||
250 | static ssize_t | ||
251 | ds1307_nvram_read(struct kobject *kobj, struct bin_attribute *attr, | ||
252 | char *buf, loff_t off, size_t count) | ||
253 | { | ||
254 | struct i2c_client *client; | ||
255 | struct ds1307 *ds1307; | ||
256 | struct i2c_msg msg[2]; | ||
257 | int result; | ||
258 | |||
259 | client = to_i2c_client(container_of(kobj, struct device, kobj)); | ||
260 | ds1307 = i2c_get_clientdata(client); | ||
261 | |||
262 | if (unlikely(off >= NVRAM_SIZE)) | ||
263 | return 0; | ||
264 | if ((off + count) > NVRAM_SIZE) | ||
265 | count = NVRAM_SIZE - off; | ||
266 | if (unlikely(!count)) | ||
267 | return count; | ||
268 | |||
269 | msg[0].addr = client->addr; | ||
270 | msg[0].flags = 0; | ||
271 | msg[0].len = 1; | ||
272 | msg[0].buf = buf; | ||
273 | |||
274 | buf[0] = 8 + off; | ||
275 | |||
276 | msg[1].addr = client->addr; | ||
277 | msg[1].flags = I2C_M_RD; | ||
278 | msg[1].len = count; | ||
279 | msg[1].buf = buf; | ||
280 | |||
281 | result = i2c_transfer(to_i2c_adapter(client->dev.parent), msg, 2); | ||
282 | if (result != 2) { | ||
283 | dev_err(&client->dev, "%s error %d\n", "nvram read", result); | ||
284 | return -EIO; | ||
285 | } | ||
286 | return count; | ||
287 | } | ||
288 | |||
289 | static ssize_t | ||
290 | ds1307_nvram_write(struct kobject *kobj, struct bin_attribute *attr, | ||
291 | char *buf, loff_t off, size_t count) | ||
292 | { | ||
293 | struct i2c_client *client; | ||
294 | u8 buffer[NVRAM_SIZE + 1]; | ||
295 | int ret; | ||
296 | |||
297 | client = to_i2c_client(container_of(kobj, struct device, kobj)); | ||
298 | |||
299 | if (unlikely(off >= NVRAM_SIZE)) | ||
300 | return -EFBIG; | ||
301 | if ((off + count) > NVRAM_SIZE) | ||
302 | count = NVRAM_SIZE - off; | ||
303 | if (unlikely(!count)) | ||
304 | return count; | ||
305 | |||
306 | buffer[0] = 8 + off; | ||
307 | memcpy(buffer + 1, buf, count); | ||
308 | |||
309 | ret = i2c_master_send(client, buffer, count + 1); | ||
310 | return (ret < 0) ? ret : (ret - 1); | ||
311 | } | ||
312 | |||
313 | static struct bin_attribute nvram = { | ||
314 | .attr = { | ||
315 | .name = "nvram", | ||
316 | .mode = S_IRUGO | S_IWUSR, | ||
317 | .owner = THIS_MODULE, | ||
318 | }, | ||
319 | |||
320 | .read = ds1307_nvram_read, | ||
321 | .write = ds1307_nvram_write, | ||
322 | .size = NVRAM_SIZE, | ||
323 | }; | ||
324 | |||
325 | /*----------------------------------------------------------------------*/ | ||
326 | |||
245 | static struct i2c_driver ds1307_driver; | 327 | static struct i2c_driver ds1307_driver; |
246 | 328 | ||
247 | static int __devinit ds1307_probe(struct i2c_client *client) | 329 | static int __devinit ds1307_probe(struct i2c_client *client) |
@@ -413,6 +495,14 @@ read_rtc: | |||
413 | goto exit_free; | 495 | goto exit_free; |
414 | } | 496 | } |
415 | 497 | ||
498 | if (chip->nvram56) { | ||
499 | err = sysfs_create_bin_file(&client->dev.kobj, &nvram); | ||
500 | if (err == 0) { | ||
501 | ds1307->has_nvram = true; | ||
502 | dev_info(&client->dev, "56 bytes nvram\n"); | ||
503 | } | ||
504 | } | ||
505 | |||
416 | return 0; | 506 | return 0; |
417 | 507 | ||
418 | exit_bad: | 508 | exit_bad: |
@@ -432,6 +522,9 @@ static int __devexit ds1307_remove(struct i2c_client *client) | |||
432 | { | 522 | { |
433 | struct ds1307 *ds1307 = i2c_get_clientdata(client); | 523 | struct ds1307 *ds1307 = i2c_get_clientdata(client); |
434 | 524 | ||
525 | if (ds1307->has_nvram) | ||
526 | sysfs_remove_bin_file(&client->dev.kobj, &nvram); | ||
527 | |||
435 | rtc_device_unregister(ds1307->rtc); | 528 | rtc_device_unregister(ds1307->rtc); |
436 | kfree(ds1307); | 529 | kfree(ds1307); |
437 | return 0; | 530 | return 0; |
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index bb53c09bad16..d9e848dcd450 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c | |||
@@ -291,7 +291,7 @@ static ssize_t ds1553_nvram_write(struct kobject *kobj, | |||
291 | static struct bin_attribute ds1553_nvram_attr = { | 291 | static struct bin_attribute ds1553_nvram_attr = { |
292 | .attr = { | 292 | .attr = { |
293 | .name = "nvram", | 293 | .name = "nvram", |
294 | .mode = S_IRUGO | S_IWUGO, | 294 | .mode = S_IRUGO | S_IWUSR, |
295 | }, | 295 | }, |
296 | .size = RTC_OFFSET, | 296 | .size = RTC_OFFSET, |
297 | .read = ds1553_nvram_read, | 297 | .read = ds1553_nvram_read, |
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index c535b78698e2..2e73f0b183b2 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c | |||
@@ -160,10 +160,13 @@ static ssize_t ds1742_nvram_write(struct kobject *kobj, | |||
160 | static struct bin_attribute ds1742_nvram_attr = { | 160 | static struct bin_attribute ds1742_nvram_attr = { |
161 | .attr = { | 161 | .attr = { |
162 | .name = "nvram", | 162 | .name = "nvram", |
163 | .mode = S_IRUGO | S_IWUGO, | 163 | .mode = S_IRUGO | S_IWUSR, |
164 | }, | 164 | }, |
165 | .read = ds1742_nvram_read, | 165 | .read = ds1742_nvram_read, |
166 | .write = ds1742_nvram_write, | 166 | .write = ds1742_nvram_write, |
167 | /* REVISIT: size in sysfs won't match actual size... if it's | ||
168 | * not a constant, each RTC should have its own attribute. | ||
169 | */ | ||
167 | }; | 170 | }; |
168 | 171 | ||
169 | static int __devinit ds1742_rtc_probe(struct platform_device *pdev) | 172 | static int __devinit ds1742_rtc_probe(struct platform_device *pdev) |
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index 2bad1637330a..cd0bbc0e8038 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c | |||
@@ -353,11 +353,12 @@ static ssize_t m48t59_nvram_write(struct kobject *kobj, | |||
353 | static struct bin_attribute m48t59_nvram_attr = { | 353 | static struct bin_attribute m48t59_nvram_attr = { |
354 | .attr = { | 354 | .attr = { |
355 | .name = "nvram", | 355 | .name = "nvram", |
356 | .mode = S_IRUGO | S_IWUGO, | 356 | .mode = S_IRUGO | S_IWUSR, |
357 | .owner = THIS_MODULE, | 357 | .owner = THIS_MODULE, |
358 | }, | 358 | }, |
359 | .read = m48t59_nvram_read, | 359 | .read = m48t59_nvram_read, |
360 | .write = m48t59_nvram_write, | 360 | .write = m48t59_nvram_write, |
361 | .size = M48T59_NVRAM_SIZE, | ||
361 | }; | 362 | }; |
362 | 363 | ||
363 | static int __devinit m48t59_rtc_probe(struct platform_device *pdev) | 364 | static int __devinit m48t59_rtc_probe(struct platform_device *pdev) |
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c index 8288b6b2bf2b..a265da7c6ff8 100644 --- a/drivers/rtc/rtc-stk17ta8.c +++ b/drivers/rtc/rtc-stk17ta8.c | |||
@@ -291,7 +291,7 @@ static ssize_t stk17ta8_nvram_write(struct kobject *kobj, | |||
291 | static struct bin_attribute stk17ta8_nvram_attr = { | 291 | static struct bin_attribute stk17ta8_nvram_attr = { |
292 | .attr = { | 292 | .attr = { |
293 | .name = "nvram", | 293 | .name = "nvram", |
294 | .mode = S_IRUGO | S_IWUGO, | 294 | .mode = S_IRUGO | S_IWUSR, |
295 | .owner = THIS_MODULE, | 295 | .owner = THIS_MODULE, |
296 | }, | 296 | }, |
297 | .size = RTC_OFFSET, | 297 | .size = RTC_OFFSET, |
diff --git a/drivers/scsi/aic94xx/aic94xx_sds.c b/drivers/scsi/aic94xx/aic94xx_sds.c index 5b0932f61473..06509bff71f7 100644 --- a/drivers/scsi/aic94xx/aic94xx_sds.c +++ b/drivers/scsi/aic94xx/aic94xx_sds.c | |||
@@ -377,7 +377,7 @@ out: | |||
377 | 377 | ||
378 | #define FLASH_RESET 0xF0 | 378 | #define FLASH_RESET 0xF0 |
379 | 379 | ||
380 | #define FLASH_SIZE 0x200000 | 380 | #define ASD_FLASH_SIZE 0x200000 |
381 | #define FLASH_DIR_COOKIE "*** ADAPTEC FLASH DIRECTORY *** " | 381 | #define FLASH_DIR_COOKIE "*** ADAPTEC FLASH DIRECTORY *** " |
382 | #define FLASH_NEXT_ENTRY_OFFS 0x2000 | 382 | #define FLASH_NEXT_ENTRY_OFFS 0x2000 |
383 | #define FLASH_MAX_DIR_ENTRIES 32 | 383 | #define FLASH_MAX_DIR_ENTRIES 32 |
@@ -609,7 +609,7 @@ static int asd_find_flash_dir(struct asd_ha_struct *asd_ha, | |||
609 | struct asd_flash_dir *flash_dir) | 609 | struct asd_flash_dir *flash_dir) |
610 | { | 610 | { |
611 | u32 v; | 611 | u32 v; |
612 | for (v = 0; v < FLASH_SIZE; v += FLASH_NEXT_ENTRY_OFFS) { | 612 | for (v = 0; v < ASD_FLASH_SIZE; v += FLASH_NEXT_ENTRY_OFFS) { |
613 | asd_read_flash_seg(asd_ha, flash_dir, v, | 613 | asd_read_flash_seg(asd_ha, flash_dir, v, |
614 | sizeof(FLASH_DIR_COOKIE)-1); | 614 | sizeof(FLASH_DIR_COOKIE)-1); |
615 | if (memcmp(flash_dir->cookie, FLASH_DIR_COOKIE, | 615 | if (memcmp(flash_dir->cookie, FLASH_DIR_COOKIE, |
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index 926f58a674a1..1de098e75497 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
@@ -69,6 +69,8 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
69 | { "CTL3001", 0 }, | 69 | { "CTL3001", 0 }, |
70 | /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */ | 70 | /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */ |
71 | { "CTL3011", 0 }, | 71 | { "CTL3011", 0 }, |
72 | /* Davicom ISA 33.6K Modem */ | ||
73 | { "DAV0336", 0 }, | ||
72 | /* Creative */ | 74 | /* Creative */ |
73 | /* Creative Modem Blaster Flash56 DI5601-1 */ | 75 | /* Creative Modem Blaster Flash56 DI5601-1 */ |
74 | { "DMB1032", 0 }, | 76 | { "DMB1032", 0 }, |
@@ -345,6 +347,11 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
345 | /* Fujitsu Wacom Tablet PC devices */ | 347 | /* Fujitsu Wacom Tablet PC devices */ |
346 | { "FUJ02E5", 0 }, | 348 | { "FUJ02E5", 0 }, |
347 | { "FUJ02E6", 0 }, | 349 | { "FUJ02E6", 0 }, |
350 | /* | ||
351 | * LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in | ||
352 | * disguise) | ||
353 | */ | ||
354 | { "LTS0001", 0 }, | ||
348 | /* Rockwell's (PORALiNK) 33600 INT PNP */ | 355 | /* Rockwell's (PORALiNK) 33600 INT PNP */ |
349 | { "WCI0003", 0 }, | 356 | { "WCI0003", 0 }, |
350 | /* Unkown PnP modems */ | 357 | /* Unkown PnP modems */ |
@@ -432,7 +439,8 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) | |||
432 | } | 439 | } |
433 | 440 | ||
434 | memset(&port, 0, sizeof(struct uart_port)); | 441 | memset(&port, 0, sizeof(struct uart_port)); |
435 | port.irq = pnp_irq(dev, 0); | 442 | if (pnp_irq_valid(dev, 0)) |
443 | port.irq = pnp_irq(dev, 0); | ||
436 | if (pnp_port_valid(dev, 0)) { | 444 | if (pnp_port_valid(dev, 0)) { |
437 | port.iobase = pnp_port_start(dev, 0); | 445 | port.iobase = pnp_port_start(dev, 0); |
438 | port.iotype = UPIO_PORT; | 446 | port.iotype = UPIO_PORT; |
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 4d6b3c56d20e..111da57f5334 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -204,8 +204,6 @@ static u_int atmel_get_mctrl(struct uart_port *port) | |||
204 | */ | 204 | */ |
205 | static void atmel_stop_tx(struct uart_port *port) | 205 | static void atmel_stop_tx(struct uart_port *port) |
206 | { | 206 | { |
207 | struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; | ||
208 | |||
209 | UART_PUT_IDR(port, ATMEL_US_TXRDY); | 207 | UART_PUT_IDR(port, ATMEL_US_TXRDY); |
210 | } | 208 | } |
211 | 209 | ||
@@ -214,8 +212,6 @@ static void atmel_stop_tx(struct uart_port *port) | |||
214 | */ | 212 | */ |
215 | static void atmel_start_tx(struct uart_port *port) | 213 | static void atmel_start_tx(struct uart_port *port) |
216 | { | 214 | { |
217 | struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; | ||
218 | |||
219 | UART_PUT_IER(port, ATMEL_US_TXRDY); | 215 | UART_PUT_IER(port, ATMEL_US_TXRDY); |
220 | } | 216 | } |
221 | 217 | ||
@@ -224,8 +220,6 @@ static void atmel_start_tx(struct uart_port *port) | |||
224 | */ | 220 | */ |
225 | static void atmel_stop_rx(struct uart_port *port) | 221 | static void atmel_stop_rx(struct uart_port *port) |
226 | { | 222 | { |
227 | struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; | ||
228 | |||
229 | UART_PUT_IDR(port, ATMEL_US_RXRDY); | 223 | UART_PUT_IDR(port, ATMEL_US_RXRDY); |
230 | } | 224 | } |
231 | 225 | ||
@@ -409,7 +403,6 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id) | |||
409 | */ | 403 | */ |
410 | static int atmel_startup(struct uart_port *port) | 404 | static int atmel_startup(struct uart_port *port) |
411 | { | 405 | { |
412 | struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; | ||
413 | int retval; | 406 | int retval; |
414 | 407 | ||
415 | /* | 408 | /* |
@@ -456,8 +449,6 @@ static int atmel_startup(struct uart_port *port) | |||
456 | */ | 449 | */ |
457 | static void atmel_shutdown(struct uart_port *port) | 450 | static void atmel_shutdown(struct uart_port *port) |
458 | { | 451 | { |
459 | struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; | ||
460 | |||
461 | /* | 452 | /* |
462 | * Disable all interrupts, port and break condition. | 453 | * Disable all interrupts, port and break condition. |
463 | */ | 454 | */ |
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index f523cdf4b02b..a4e23cf47906 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -1,426 +1,10 @@ | |||
1 | /* $Id: serial.c,v 1.25 2004/09/29 10:33:49 starvik Exp $ | 1 | /* |
2 | * | ||
3 | * Serial port driver for the ETRAX 100LX chip | 2 | * Serial port driver for the ETRAX 100LX chip |
4 | * | 3 | * |
5 | * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Axis Communications AB | 4 | * Copyright (C) 1998-2007 Axis Communications AB |
6 | * | 5 | * |
7 | * Many, many authors. Based once upon a time on serial.c for 16x50. | 6 | * Many, many authors. Based once upon a time on serial.c for 16x50. |
8 | * | 7 | * |
9 | * $Log: serial.c,v $ | ||
10 | * Revision 1.25 2004/09/29 10:33:49 starvik | ||
11 | * Resolved a dealock when printing debug from kernel. | ||
12 | * | ||
13 | * Revision 1.24 2004/08/27 23:25:59 johana | ||
14 | * rs_set_termios() must call change_speed() if c_iflag has changed or | ||
15 | * automatic XOFF handling will be enabled and transmitter will stop | ||
16 | * if 0x13 is received. | ||
17 | * | ||
18 | * Revision 1.23 2004/08/24 06:57:13 starvik | ||
19 | * More whitespace cleanup | ||
20 | * | ||
21 | * Revision 1.22 2004/08/24 06:12:20 starvik | ||
22 | * Whitespace cleanup | ||
23 | * | ||
24 | * Revision 1.20 2004/05/24 12:00:20 starvik | ||
25 | * Big merge of stuff from Linux 2.4 (e.g. manual mode for the serial port). | ||
26 | * | ||
27 | * Revision 1.19 2004/05/17 13:12:15 starvik | ||
28 | * Kernel console hook | ||
29 | * Big merge from Linux 2.4 still pending. | ||
30 | * | ||
31 | * Revision 1.18 2003/10/28 07:18:30 starvik | ||
32 | * Compiles with debug info | ||
33 | * | ||
34 | * Revision 1.17 2003/07/04 08:27:37 starvik | ||
35 | * Merge of Linux 2.5.74 | ||
36 | * | ||
37 | * Revision 1.16 2003/06/13 10:05:19 johana | ||
38 | * Help the user to avoid trouble by: | ||
39 | * Forcing mixed mode for status/control lines if not all pins are used. | ||
40 | * | ||
41 | * Revision 1.15 2003/06/13 09:43:01 johana | ||
42 | * Merged in the following changes from os/linux/arch/cris/drivers/serial.c | ||
43 | * + some minor changes to reduce diff. | ||
44 | * | ||
45 | * Revision 1.49 2003/05/30 11:31:54 johana | ||
46 | * Merged in change-branch--serial9bit that adds CMSPAR support for sticky | ||
47 | * parity (mark/space) | ||
48 | * | ||
49 | * Revision 1.48 2003/05/30 11:03:57 johana | ||
50 | * Implemented rs_send_xchar() by disabling the DMA and writing manually. | ||
51 | * Added e100_disable_txdma_channel() and e100_enable_txdma_channel(). | ||
52 | * Fixed rs_throttle() and rs_unthrottle() to properly call rs_send_xchar | ||
53 | * instead of setting info->x_char and check the CRTSCTS flag before | ||
54 | * controlling the rts pin. | ||
55 | * | ||
56 | * Revision 1.14 2003/04/09 08:12:44 pkj | ||
57 | * Corrected typo changes made upstream. | ||
58 | * | ||
59 | * Revision 1.13 2003/04/09 05:20:47 starvik | ||
60 | * Merge of Linux 2.5.67 | ||
61 | * | ||
62 | * Revision 1.11 2003/01/22 06:48:37 starvik | ||
63 | * Fixed warnings issued by GCC 3.2.1 | ||
64 | * | ||
65 | * Revision 1.9 2002/12/13 09:07:47 starvik | ||
66 | * Alert user that RX_TIMEOUT_TICKS==0 doesn't work | ||
67 | * | ||
68 | * Revision 1.8 2002/12/11 13:13:57 starvik | ||
69 | * Added arch/ to v10 specific includes | ||
70 | * Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer) | ||
71 | * | ||
72 | * Revision 1.7 2002/12/06 07:13:57 starvik | ||
73 | * Corrected work queue stuff | ||
74 | * Removed CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST | ||
75 | * | ||
76 | * Revision 1.6 2002/11/21 07:17:46 starvik | ||
77 | * Change static inline to extern inline where otherwise outlined with gcc-3.2 | ||
78 | * | ||
79 | * Revision 1.5 2002/11/14 15:59:49 starvik | ||
80 | * Linux 2.5 port of the latest serial driver from 2.4. The work queue stuff | ||
81 | * probably doesn't work yet. | ||
82 | * | ||
83 | * Revision 1.42 2002/11/05 09:08:47 johana | ||
84 | * Better implementation of rs_stop() and rs_start() that uses the XOFF | ||
85 | * register to start/stop transmission. | ||
86 | * change_speed() also initilises XOFF register correctly so that | ||
87 | * auto_xoff is enabled when IXON flag is set by user. | ||
88 | * This gives fast XOFF response times. | ||
89 | * | ||
90 | * Revision 1.41 2002/11/04 18:40:57 johana | ||
91 | * Implemented rs_stop() and rs_start(). | ||
92 | * Simple tests using hwtestserial indicates that this should be enough | ||
93 | * to make it work. | ||
94 | * | ||
95 | * Revision 1.40 2002/10/14 05:33:18 starvik | ||
96 | * RS-485 uses fast timers even if SERIAL_FAST_TIMER is disabled | ||
97 | * | ||
98 | * Revision 1.39 2002/09/30 21:00:57 johana | ||
99 | * Support for CONFIG_ETRAX_SERx_DTR_RI_DSR_CD_MIXED where the status and | ||
100 | * control pins can be mixed between PA and PB. | ||
101 | * If no serial port uses MIXED old solution is used | ||
102 | * (saves a few bytes and cycles). | ||
103 | * control_pins struct uses masks instead of bit numbers. | ||
104 | * Corrected dummy values and polarity in line_info() so | ||
105 | * /proc/tty/driver/serial is now correct. | ||
106 | * (the E100_xxx_GET() macros is really active low - perhaps not obvious) | ||
107 | * | ||
108 | * Revision 1.38 2002/08/23 11:01:36 starvik | ||
109 | * Check that serial port is enabled in all interrupt handlers to avoid | ||
110 | * restarts of DMA channels not assigned to serial ports | ||
111 | * | ||
112 | * Revision 1.37 2002/08/13 13:02:37 bjornw | ||
113 | * Removed some warnings because of unused code | ||
114 | * | ||
115 | * Revision 1.36 2002/08/08 12:50:01 starvik | ||
116 | * Serial interrupt is shared with synchronous serial port driver | ||
117 | * | ||
118 | * Revision 1.35 2002/06/03 10:40:49 starvik | ||
119 | * Increased RS-485 RTS toggle timer to 2 characters | ||
120 | * | ||
121 | * Revision 1.34 2002/05/28 18:59:36 johana | ||
122 | * Whitespace and comment fixing to be more like etrax100ser.c 1.71. | ||
123 | * | ||
124 | * Revision 1.33 2002/05/28 17:55:43 johana | ||
125 | * RS-485 uses FAST_TIMER if enabled, and starts a short (one char time) | ||
126 | * timer from tranismit_chars (interrupt context). | ||
127 | * The timer toggles RTS in interrupt context when expired giving minimum | ||
128 | * latencies. | ||
129 | * | ||
130 | * Revision 1.32 2002/05/22 13:58:00 johana | ||
131 | * Renamed rs_write() to raw_write() and made it inline. | ||
132 | * New rs_write() handles RS-485 if configured and enabled | ||
133 | * (moved code from e100_write_rs485()). | ||
134 | * RS-485 ioctl's uses copy_from_user() instead of verify_area(). | ||
135 | * | ||
136 | * Revision 1.31 2002/04/22 11:20:03 johana | ||
137 | * Updated copyright years. | ||
138 | * | ||
139 | * Revision 1.30 2002/04/22 09:39:12 johana | ||
140 | * RS-485 support compiles. | ||
141 | * | ||
142 | * Revision 1.29 2002/01/14 16:10:01 pkj | ||
143 | * Allocate the receive buffers dynamically. The static 4kB buffer was | ||
144 | * too small for the peaks. This means that we can get rid of the extra | ||
145 | * buffer and the copying to it. It also means we require less memory | ||
146 | * under normal operations, but can use more when needed (there is a | ||
147 | * cap at 64kB for safety reasons). If there is no memory available | ||
148 | * we panic(), and die a horrible death... | ||
149 | * | ||
150 | * Revision 1.28 2001/12/18 15:04:53 johana | ||
151 | * Cleaned up write_rs485() - now it works correctly without padding extra | ||
152 | * char. | ||
153 | * Added sane default initialisation of rs485. | ||
154 | * Added #ifdef around dummy variables. | ||
155 | * | ||
156 | * Revision 1.27 2001/11/29 17:00:41 pkj | ||
157 | * 2kB seems to be too small a buffer when using 921600 bps, | ||
158 | * so increase it to 4kB (this was already done for the elinux | ||
159 | * version of the serial driver). | ||
160 | * | ||
161 | * Revision 1.26 2001/11/19 14:20:41 pkj | ||
162 | * Minor changes to comments and unused code. | ||
163 | * | ||
164 | * Revision 1.25 2001/11/12 20:03:43 pkj | ||
165 | * Fixed compiler warnings. | ||
166 | * | ||
167 | * Revision 1.24 2001/11/12 15:10:05 pkj | ||
168 | * Total redesign of the receiving part of the serial driver. | ||
169 | * Uses eight chained descriptors to write to a 4kB buffer. | ||
170 | * This data is then serialised into a 2kB buffer. From there it | ||
171 | * is copied into the TTY's flip buffers when they become available. | ||
172 | * A lot of copying, and the sizes of the buffers might need to be | ||
173 | * tweaked, but all in all it should work better than the previous | ||
174 | * version, without the need to modify the TTY code in any way. | ||
175 | * Also note that erroneous bytes are now correctly marked in the | ||
176 | * flag buffers (instead of always marking the first byte). | ||
177 | * | ||
178 | * Revision 1.23 2001/10/30 17:53:26 pkj | ||
179 | * * Set info->uses_dma to 0 when a port is closed. | ||
180 | * * Mark the timer1 interrupt as a fast one (SA_INTERRUPT). | ||
181 | * * Call start_flush_timer() in start_receive() if | ||
182 | * CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST is defined. | ||
183 | * | ||
184 | * Revision 1.22 2001/10/30 17:44:03 pkj | ||
185 | * Use %lu for received and transmitted counters in line_info(). | ||
186 | * | ||
187 | * Revision 1.21 2001/10/30 17:40:34 pkj | ||
188 | * Clean-up. The only change to functionality is that | ||
189 | * CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS(=5) is used instead of | ||
190 | * MAX_FLUSH_TIME(=8). | ||
191 | * | ||
192 | * Revision 1.20 2001/10/30 15:24:49 johana | ||
193 | * Added char_time stuff from 2.0 driver. | ||
194 | * | ||
195 | * Revision 1.19 2001/10/30 15:23:03 johana | ||
196 | * Merged with 1.13.2 branch + fixed indentation | ||
197 | * and changed CONFIG_ETRAX100_XYS to CONFIG_ETRAX_XYZ | ||
198 | * | ||
199 | * Revision 1.18 2001/09/24 09:27:22 pkj | ||
200 | * Completed ext_baud_table[] in cflag_to_baud() and cflag_to_etrax_baud(). | ||
201 | * | ||
202 | * Revision 1.17 2001/08/24 11:32:49 ronny | ||
203 | * More fixes for the CONFIG_ETRAX_SERIAL_PORT0 define. | ||
204 | * | ||
205 | * Revision 1.16 2001/08/24 07:56:22 ronny | ||
206 | * Added config ifdefs around ser0 irq requests. | ||
207 | * | ||
208 | * Revision 1.15 2001/08/16 09:10:31 bjarne | ||
209 | * serial.c - corrected the initialization of rs_table, the wrong defines | ||
210 | * where used. | ||
211 | * Corrected a test in timed_flush_handler. | ||
212 | * Changed configured to enabled. | ||
213 | * serial.h - Changed configured to enabled. | ||
214 | * | ||
215 | * Revision 1.14 2001/08/15 07:31:23 bjarne | ||
216 | * Introduced two new members to the e100_serial struct. | ||
217 | * configured - Will be set to 1 if the port has been configured in .config | ||
218 | * uses_dma - Should be set to 1 if the port uses DMA. Currently it is set | ||
219 | * to 1 | ||
220 | * when a port is opened. This is used to limit the DMA interrupt | ||
221 | * routines to only manipulate DMA channels actually used by the | ||
222 | * serial driver. | ||
223 | * | ||
224 | * Revision 1.13.2.2 2001/10/17 13:57:13 starvik | ||
225 | * Receiver was broken by the break fixes | ||
226 | * | ||
227 | * Revision 1.13.2.1 2001/07/20 13:57:39 ronny | ||
228 | * Merge with new stuff from etrax100ser.c. Works but haven't checked stuff | ||
229 | * like break handling. | ||
230 | * | ||
231 | * Revision 1.13 2001/05/09 12:40:31 johana | ||
232 | * Use DMA_NBR and IRQ_NBR defines from dma.h and irq.h | ||
233 | * | ||
234 | * Revision 1.12 2001/04/19 12:23:07 bjornw | ||
235 | * CONFIG_RS485 -> CONFIG_ETRAX_RS485 | ||
236 | * | ||
237 | * Revision 1.11 2001/04/05 14:29:48 markusl | ||
238 | * Updated according to review remarks i.e. | ||
239 | * -Use correct types in port structure to avoid compiler warnings | ||
240 | * -Try to use IO_* macros whenever possible | ||
241 | * -Open should never return -EBUSY | ||
242 | * | ||
243 | * Revision 1.10 2001/03/05 13:14:07 bjornw | ||
244 | * Another spelling fix | ||
245 | * | ||
246 | * Revision 1.9 2001/02/23 13:46:38 bjornw | ||
247 | * Spellling check | ||
248 | * | ||
249 | * Revision 1.8 2001/01/23 14:56:35 markusl | ||
250 | * Made use of ser1 optional | ||
251 | * Needed by USB | ||
252 | * | ||
253 | * Revision 1.7 2001/01/19 16:14:48 perf | ||
254 | * Added kernel options for serial ports 234. | ||
255 | * Changed option names from CONFIG_ETRAX100_XYZ to CONFIG_ETRAX_XYZ. | ||
256 | * | ||
257 | * Revision 1.6 2000/11/22 16:36:09 bjornw | ||
258 | * Please marketing by using the correct case when spelling Etrax. | ||
259 | * | ||
260 | * Revision 1.5 2000/11/21 16:43:37 bjornw | ||
261 | * Fixed so it compiles under CONFIG_SVINTO_SIM | ||
262 | * | ||
263 | * Revision 1.4 2000/11/15 17:34:12 bjornw | ||
264 | * Added a timeout timer for flushing input channels. The interrupt-based | ||
265 | * fast flush system should be easy to merge with this later (works the same | ||
266 | * way, only with an irq instead of a system timer_list) | ||
267 | * | ||
268 | * Revision 1.3 2000/11/13 17:19:57 bjornw | ||
269 | * * Incredibly, this almost complete rewrite of serial.c worked (at least | ||
270 | * for output) the first time. | ||
271 | * | ||
272 | * Items worth noticing: | ||
273 | * | ||
274 | * No Etrax100 port 1 workarounds (does only compile on 2.4 anyway now) | ||
275 | * RS485 is not ported (why can't it be done in userspace as on x86 ?) | ||
276 | * Statistics done through async_icount - if any more stats are needed, | ||
277 | * that's the place to put them or in an arch-dep version of it. | ||
278 | * timeout_interrupt and the other fast timeout stuff not ported yet | ||
279 | * There be dragons in this 3k+ line driver | ||
280 | * | ||
281 | * Revision 1.2 2000/11/10 16:50:28 bjornw | ||
282 | * First shot at a 2.4 port, does not compile totally yet | ||
283 | * | ||
284 | * Revision 1.1 2000/11/10 16:47:32 bjornw | ||
285 | * Added verbatim copy of rev 1.49 etrax100ser.c from elinux | ||
286 | * | ||
287 | * Revision 1.49 2000/10/30 15:47:14 tobiasa | ||
288 | * Changed version number. | ||
289 | * | ||
290 | * Revision 1.48 2000/10/25 11:02:43 johana | ||
291 | * Changed %ul to %lu in printf's | ||
292 | * | ||
293 | * Revision 1.47 2000/10/18 15:06:53 pkj | ||
294 | * Compile correctly with CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST and | ||
295 | * CONFIG_ETRAX_SERIAL_PROC_ENTRY together. | ||
296 | * Some clean-up of the /proc/serial file. | ||
297 | * | ||
298 | * Revision 1.46 2000/10/16 12:59:40 johana | ||
299 | * Added CONFIG_ETRAX_SERIAL_PROC_ENTRY for statistics and debug info. | ||
300 | * | ||
301 | * Revision 1.45 2000/10/13 17:10:59 pkj | ||
302 | * Do not flush DMAs while flipping TTY buffers. | ||
303 | * | ||
304 | * Revision 1.44 2000/10/13 16:34:29 pkj | ||
305 | * Added a delay in ser_interrupt() for 2.3ms when an error is detected. | ||
306 | * We do not know why this delay is required yet, but without it the | ||
307 | * irmaflash program does not work (this was the program that needed | ||
308 | * the ser_interrupt() to be needed in the first place). This should not | ||
309 | * affect normal use of the serial ports. | ||
310 | * | ||
311 | * Revision 1.43 2000/10/13 16:30:44 pkj | ||
312 | * New version of the fast flush of serial buffers code. This time | ||
313 | * it is localized to the serial driver and uses a fast timer to | ||
314 | * do the work. | ||
315 | * | ||
316 | * Revision 1.42 2000/10/13 14:54:26 bennyo | ||
317 | * Fix for switching RTS when using rs485 | ||
318 | * | ||
319 | * Revision 1.41 2000/10/12 11:43:44 pkj | ||
320 | * Cleaned up a number of comments. | ||
321 | * | ||
322 | * Revision 1.40 2000/10/10 11:58:39 johana | ||
323 | * Made RS485 support generic for all ports. | ||
324 | * Toggle rts in interrupt if no delay wanted. | ||
325 | * WARNING: No true transmitter empty check?? | ||
326 | * Set d_wait bit when sending data so interrupt is delayed until | ||
327 | * fifo flushed. (Fix tcdrain() problem) | ||
328 | * | ||
329 | * Revision 1.39 2000/10/04 16:08:02 bjornw | ||
330 | * * Use virt_to_phys etc. for DMA addresses | ||
331 | * * Removed CONFIG_FLUSH_DMA_FAST hacks | ||
332 | * * Indentation fix | ||
333 | * | ||
334 | * Revision 1.38 2000/10/02 12:27:10 mattias | ||
335 | * * added variable used when using fast flush on serial dma. | ||
336 | * (CONFIG_FLUSH_DMA_FAST) | ||
337 | * | ||
338 | * Revision 1.37 2000/09/27 09:44:24 pkj | ||
339 | * Uncomment definition of SERIAL_HANDLE_EARLY_ERRORS. | ||
340 | * | ||
341 | * Revision 1.36 2000/09/20 13:12:52 johana | ||
342 | * Support for CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS: | ||
343 | * Number of timer ticks between flush of receive fifo (1 tick = 10ms). | ||
344 | * Try 0-3 for low latency applications. Approx 5 for high load | ||
345 | * applications (e.g. PPP). Maybe this should be more adaptive some day... | ||
346 | * | ||
347 | * Revision 1.35 2000/09/20 10:36:08 johana | ||
348 | * Typo in get_lsr_info() | ||
349 | * | ||
350 | * Revision 1.34 2000/09/20 10:29:59 johana | ||
351 | * Let rs_chars_in_buffer() check fifo content as well. | ||
352 | * get_lsr_info() might work now (not tested). | ||
353 | * Easier to change the port to debug. | ||
354 | * | ||
355 | * Revision 1.33 2000/09/13 07:52:11 torbjore | ||
356 | * Support RS485 | ||
357 | * | ||
358 | * Revision 1.32 2000/08/31 14:45:37 bjornw | ||
359 | * After sending a break we need to reset the transmit DMA channel | ||
360 | * | ||
361 | * Revision 1.31 2000/06/21 12:13:29 johana | ||
362 | * Fixed wait for all chars sent when closing port. | ||
363 | * (Used to always take 1 second!) | ||
364 | * Added shadows for directions of status/ctrl signals. | ||
365 | * | ||
366 | * Revision 1.30 2000/05/29 16:27:55 bjornw | ||
367 | * Simulator ifdef moved a bit | ||
368 | * | ||
369 | * Revision 1.29 2000/05/09 09:40:30 mattias | ||
370 | * * Added description of dma registers used in timeout_interrupt | ||
371 | * * Removed old code | ||
372 | * | ||
373 | * Revision 1.28 2000/05/08 16:38:58 mattias | ||
374 | * * Bugfix for flushing fifo in timeout_interrupt | ||
375 | * Problem occurs when bluetooth stack waits for a small number of bytes | ||
376 | * containing an event acknowledging free buffers in bluetooth HW | ||
377 | * As before, data was stuck in fifo until more data came on uart and | ||
378 | * flushed it up to the stack. | ||
379 | * | ||
380 | * Revision 1.27 2000/05/02 09:52:28 jonasd | ||
381 | * Added fix for peculiar etrax behaviour when eop is forced on an empty | ||
382 | * fifo. This is used when flashing the IRMA chip. Disabled by default. | ||
383 | * | ||
384 | * Revision 1.26 2000/03/29 15:32:02 bjornw | ||
385 | * 2.0.34 updates | ||
386 | * | ||
387 | * Revision 1.25 2000/02/16 16:59:36 bjornw | ||
388 | * * Receive DMA directly into the flip-buffer, eliminating an intermediary | ||
389 | * receive buffer and a memcpy. Will avoid some overruns. | ||
390 | * * Error message on debug port if an overrun or flip buffer overrun occurs. | ||
391 | * * Just use the first byte in the flag flip buffer for errors. | ||
392 | * * Check for timeout on the serial ports only each 5/100 s, not 1/100. | ||
393 | * | ||
394 | * Revision 1.24 2000/02/09 18:02:28 bjornw | ||
395 | * * Clear serial errors (overrun, framing, parity) correctly. Before, the | ||
396 | * receiver would get stuck if an error occurred and we did not restart | ||
397 | * the input DMA. | ||
398 | * * Cosmetics (indentation, some code made into inlines) | ||
399 | * * Some more debug options | ||
400 | * * Actually shut down the serial port (DMA irq, DMA reset, receiver stop) | ||
401 | * when the last open is closed. Corresponding fixes in startup(). | ||
402 | * * rs_close() "tx FIFO wait" code moved into right place, bug & -> && fixed | ||
403 | * and make a special case out of port 1 (R_DMA_CHx_STATUS is broken for that) | ||
404 | * * e100_disable_rx/enable_rx just disables/enables the receiver, not RTS | ||
405 | * | ||
406 | * Revision 1.23 2000/01/24 17:46:19 johana | ||
407 | * Wait for flush of DMA/FIFO when closing port. | ||
408 | * | ||
409 | * Revision 1.22 2000/01/20 18:10:23 johana | ||
410 | * Added TIOCMGET ioctl to return modem status. | ||
411 | * Implemented modem status/control that works with the extra signals | ||
412 | * (DTR, DSR, RI,CD) as well. | ||
413 | * 3 different modes supported: | ||
414 | * ser0 on PB (Bundy), ser1 on PB (Lisa) and ser2 on PA (Bundy) | ||
415 | * Fixed DEF_TX value that caused the serial transmitter pin (txd) to go to 0 when | ||
416 | * closing the last filehandle, NASTY!. | ||
417 | * Added break generation, not tested though! | ||
418 | * Use IRQF_SHARED when request_irq() for ser2 and ser3 (shared with) par0 and par1. | ||
419 | * You can't use them at the same time (yet..), but you can hopefully switch | ||
420 | * between ser2/par0, ser3/par1 with the same kernel config. | ||
421 | * Replaced some magic constants with defines | ||
422 | * | ||
423 | * | ||
424 | */ | 8 | */ |
425 | 9 | ||
426 | static char *serial_version = "$Revision: 1.25 $"; | 10 | static char *serial_version = "$Revision: 1.25 $"; |
@@ -446,6 +30,7 @@ static char *serial_version = "$Revision: 1.25 $"; | |||
446 | 30 | ||
447 | #include <asm/io.h> | 31 | #include <asm/io.h> |
448 | #include <asm/irq.h> | 32 | #include <asm/irq.h> |
33 | #include <asm/dma.h> | ||
449 | #include <asm/system.h> | 34 | #include <asm/system.h> |
450 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
451 | 36 | ||
@@ -454,8 +39,9 @@ static char *serial_version = "$Revision: 1.25 $"; | |||
454 | /* non-arch dependent serial structures are in linux/serial.h */ | 39 | /* non-arch dependent serial structures are in linux/serial.h */ |
455 | #include <linux/serial.h> | 40 | #include <linux/serial.h> |
456 | /* while we keep our own stuff (struct e100_serial) in a local .h file */ | 41 | /* while we keep our own stuff (struct e100_serial) in a local .h file */ |
457 | #include "serial.h" | 42 | #include "crisv10.h" |
458 | #include <asm/fasttimer.h> | 43 | #include <asm/fasttimer.h> |
44 | #include <asm/arch/io_interface_mux.h> | ||
459 | 45 | ||
460 | #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER | 46 | #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER |
461 | #ifndef CONFIG_ETRAX_FAST_TIMER | 47 | #ifndef CONFIG_ETRAX_FAST_TIMER |
@@ -504,18 +90,6 @@ struct tty_driver *serial_driver; | |||
504 | from eLinux */ | 90 | from eLinux */ |
505 | #define SERIAL_HANDLE_EARLY_ERRORS | 91 | #define SERIAL_HANDLE_EARLY_ERRORS |
506 | 92 | ||
507 | /* Defined and used in n_tty.c, but we need it here as well */ | ||
508 | #define TTY_THRESHOLD_THROTTLE 128 | ||
509 | |||
510 | /* Due to buffersizes and threshold values, our SERIAL_DESCR_BUF_SIZE | ||
511 | * must not be to high or flow control won't work if we leave it to the tty | ||
512 | * layer so we have our own throttling in flush_to_flip | ||
513 | * TTY_FLIPBUF_SIZE=512, | ||
514 | * TTY_THRESHOLD_THROTTLE/UNTHROTTLE=128 | ||
515 | * BUF_SIZE can't be > 128 | ||
516 | */ | ||
517 | #define CRIS_BUF_SIZE 512 | ||
518 | |||
519 | /* Currently 16 descriptors x 128 bytes = 2048 bytes */ | 93 | /* Currently 16 descriptors x 128 bytes = 2048 bytes */ |
520 | #define SERIAL_DESCR_BUF_SIZE 256 | 94 | #define SERIAL_DESCR_BUF_SIZE 256 |
521 | 95 | ||
@@ -588,13 +162,13 @@ unsigned long timer_data_to_ns(unsigned long timer_data); | |||
588 | static void change_speed(struct e100_serial *info); | 162 | static void change_speed(struct e100_serial *info); |
589 | static void rs_throttle(struct tty_struct * tty); | 163 | static void rs_throttle(struct tty_struct * tty); |
590 | static void rs_wait_until_sent(struct tty_struct *tty, int timeout); | 164 | static void rs_wait_until_sent(struct tty_struct *tty, int timeout); |
591 | static int rs_write(struct tty_struct * tty, int from_user, | 165 | static int rs_write(struct tty_struct *tty, |
592 | const unsigned char *buf, int count); | 166 | const unsigned char *buf, int count); |
593 | #ifdef CONFIG_ETRAX_RS485 | 167 | #ifdef CONFIG_ETRAX_RS485 |
594 | static int e100_write_rs485(struct tty_struct * tty, int from_user, | 168 | static int e100_write_rs485(struct tty_struct *tty, |
595 | const unsigned char *buf, int count); | 169 | const unsigned char *buf, int count); |
596 | #endif | 170 | #endif |
597 | static int get_lsr_info(struct e100_serial * info, unsigned int *value); | 171 | static int get_lsr_info(struct e100_serial *info, unsigned int *value); |
598 | 172 | ||
599 | 173 | ||
600 | #define DEF_BAUD 115200 /* 115.2 kbit/s */ | 174 | #define DEF_BAUD 115200 /* 115.2 kbit/s */ |
@@ -679,20 +253,39 @@ static struct e100_serial rs_table[] = { | |||
679 | .rx_ctrl = DEF_RX, | 253 | .rx_ctrl = DEF_RX, |
680 | .tx_ctrl = DEF_TX, | 254 | .tx_ctrl = DEF_TX, |
681 | .iseteop = 2, | 255 | .iseteop = 2, |
256 | .dma_owner = dma_ser0, | ||
257 | .io_if = if_serial_0, | ||
682 | #ifdef CONFIG_ETRAX_SERIAL_PORT0 | 258 | #ifdef CONFIG_ETRAX_SERIAL_PORT0 |
683 | .enabled = 1, | 259 | .enabled = 1, |
684 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT | 260 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT |
685 | .dma_out_enabled = 1, | 261 | .dma_out_enabled = 1, |
262 | .dma_out_nbr = SER0_TX_DMA_NBR, | ||
263 | .dma_out_irq_nbr = SER0_DMA_TX_IRQ_NBR, | ||
264 | .dma_out_irq_flags = IRQF_DISABLED, | ||
265 | .dma_out_irq_description = "serial 0 dma tr", | ||
686 | #else | 266 | #else |
687 | .dma_out_enabled = 0, | 267 | .dma_out_enabled = 0, |
268 | .dma_out_nbr = UINT_MAX, | ||
269 | .dma_out_irq_nbr = 0, | ||
270 | .dma_out_irq_flags = 0, | ||
271 | .dma_out_irq_description = NULL, | ||
688 | #endif | 272 | #endif |
689 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN | 273 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN |
690 | .dma_in_enabled = 1, | 274 | .dma_in_enabled = 1, |
275 | .dma_in_nbr = SER0_RX_DMA_NBR, | ||
276 | .dma_in_irq_nbr = SER0_DMA_RX_IRQ_NBR, | ||
277 | .dma_in_irq_flags = IRQF_DISABLED, | ||
278 | .dma_in_irq_description = "serial 0 dma rec", | ||
691 | #else | 279 | #else |
692 | .dma_in_enabled = 0 | 280 | .dma_in_enabled = 0, |
281 | .dma_in_nbr = UINT_MAX, | ||
282 | .dma_in_irq_nbr = 0, | ||
283 | .dma_in_irq_flags = 0, | ||
284 | .dma_in_irq_description = NULL, | ||
693 | #endif | 285 | #endif |
694 | #else | 286 | #else |
695 | .enabled = 0, | 287 | .enabled = 0, |
288 | .io_if_description = NULL, | ||
696 | .dma_out_enabled = 0, | 289 | .dma_out_enabled = 0, |
697 | .dma_in_enabled = 0 | 290 | .dma_in_enabled = 0 |
698 | #endif | 291 | #endif |
@@ -714,20 +307,42 @@ static struct e100_serial rs_table[] = { | |||
714 | .rx_ctrl = DEF_RX, | 307 | .rx_ctrl = DEF_RX, |
715 | .tx_ctrl = DEF_TX, | 308 | .tx_ctrl = DEF_TX, |
716 | .iseteop = 3, | 309 | .iseteop = 3, |
310 | .dma_owner = dma_ser1, | ||
311 | .io_if = if_serial_1, | ||
717 | #ifdef CONFIG_ETRAX_SERIAL_PORT1 | 312 | #ifdef CONFIG_ETRAX_SERIAL_PORT1 |
718 | .enabled = 1, | 313 | .enabled = 1, |
314 | .io_if_description = "ser1", | ||
719 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT | 315 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT |
720 | .dma_out_enabled = 1, | 316 | .dma_out_enabled = 1, |
317 | .dma_out_nbr = SER1_TX_DMA_NBR, | ||
318 | .dma_out_irq_nbr = SER1_DMA_TX_IRQ_NBR, | ||
319 | .dma_out_irq_flags = IRQF_DISABLED, | ||
320 | .dma_out_irq_description = "serial 1 dma tr", | ||
721 | #else | 321 | #else |
722 | .dma_out_enabled = 0, | 322 | .dma_out_enabled = 0, |
323 | .dma_out_nbr = UINT_MAX, | ||
324 | .dma_out_irq_nbr = 0, | ||
325 | .dma_out_irq_flags = 0, | ||
326 | .dma_out_irq_description = NULL, | ||
723 | #endif | 327 | #endif |
724 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN | 328 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN |
725 | .dma_in_enabled = 1, | 329 | .dma_in_enabled = 1, |
330 | .dma_in_nbr = SER1_RX_DMA_NBR, | ||
331 | .dma_in_irq_nbr = SER1_DMA_RX_IRQ_NBR, | ||
332 | .dma_in_irq_flags = IRQF_DISABLED, | ||
333 | .dma_in_irq_description = "serial 1 dma rec", | ||
726 | #else | 334 | #else |
727 | .dma_in_enabled = 0 | 335 | .dma_in_enabled = 0, |
336 | .dma_in_enabled = 0, | ||
337 | .dma_in_nbr = UINT_MAX, | ||
338 | .dma_in_irq_nbr = 0, | ||
339 | .dma_in_irq_flags = 0, | ||
340 | .dma_in_irq_description = NULL, | ||
728 | #endif | 341 | #endif |
729 | #else | 342 | #else |
730 | .enabled = 0, | 343 | .enabled = 0, |
344 | .io_if_description = NULL, | ||
345 | .dma_in_irq_nbr = 0, | ||
731 | .dma_out_enabled = 0, | 346 | .dma_out_enabled = 0, |
732 | .dma_in_enabled = 0 | 347 | .dma_in_enabled = 0 |
733 | #endif | 348 | #endif |
@@ -748,20 +363,40 @@ static struct e100_serial rs_table[] = { | |||
748 | .rx_ctrl = DEF_RX, | 363 | .rx_ctrl = DEF_RX, |
749 | .tx_ctrl = DEF_TX, | 364 | .tx_ctrl = DEF_TX, |
750 | .iseteop = 0, | 365 | .iseteop = 0, |
366 | .dma_owner = dma_ser2, | ||
367 | .io_if = if_serial_2, | ||
751 | #ifdef CONFIG_ETRAX_SERIAL_PORT2 | 368 | #ifdef CONFIG_ETRAX_SERIAL_PORT2 |
752 | .enabled = 1, | 369 | .enabled = 1, |
370 | .io_if_description = "ser2", | ||
753 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT | 371 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT |
754 | .dma_out_enabled = 1, | 372 | .dma_out_enabled = 1, |
373 | .dma_out_nbr = SER2_TX_DMA_NBR, | ||
374 | .dma_out_irq_nbr = SER2_DMA_TX_IRQ_NBR, | ||
375 | .dma_out_irq_flags = IRQF_DISABLED, | ||
376 | .dma_out_irq_description = "serial 2 dma tr", | ||
755 | #else | 377 | #else |
756 | .dma_out_enabled = 0, | 378 | .dma_out_enabled = 0, |
379 | .dma_out_nbr = UINT_MAX, | ||
380 | .dma_out_irq_nbr = 0, | ||
381 | .dma_out_irq_flags = 0, | ||
382 | .dma_out_irq_description = NULL, | ||
757 | #endif | 383 | #endif |
758 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN | 384 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN |
759 | .dma_in_enabled = 1, | 385 | .dma_in_enabled = 1, |
386 | .dma_in_nbr = SER2_RX_DMA_NBR, | ||
387 | .dma_in_irq_nbr = SER2_DMA_RX_IRQ_NBR, | ||
388 | .dma_in_irq_flags = IRQF_DISABLED, | ||
389 | .dma_in_irq_description = "serial 2 dma rec", | ||
760 | #else | 390 | #else |
761 | .dma_in_enabled = 0 | 391 | .dma_in_enabled = 0, |
392 | .dma_in_nbr = UINT_MAX, | ||
393 | .dma_in_irq_nbr = 0, | ||
394 | .dma_in_irq_flags = 0, | ||
395 | .dma_in_irq_description = NULL, | ||
762 | #endif | 396 | #endif |
763 | #else | 397 | #else |
764 | .enabled = 0, | 398 | .enabled = 0, |
399 | .io_if_description = NULL, | ||
765 | .dma_out_enabled = 0, | 400 | .dma_out_enabled = 0, |
766 | .dma_in_enabled = 0 | 401 | .dma_in_enabled = 0 |
767 | #endif | 402 | #endif |
@@ -782,20 +417,40 @@ static struct e100_serial rs_table[] = { | |||
782 | .rx_ctrl = DEF_RX, | 417 | .rx_ctrl = DEF_RX, |
783 | .tx_ctrl = DEF_TX, | 418 | .tx_ctrl = DEF_TX, |
784 | .iseteop = 1, | 419 | .iseteop = 1, |
420 | .dma_owner = dma_ser3, | ||
421 | .io_if = if_serial_3, | ||
785 | #ifdef CONFIG_ETRAX_SERIAL_PORT3 | 422 | #ifdef CONFIG_ETRAX_SERIAL_PORT3 |
786 | .enabled = 1, | 423 | .enabled = 1, |
424 | .io_if_description = "ser3", | ||
787 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT | 425 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT |
788 | .dma_out_enabled = 1, | 426 | .dma_out_enabled = 1, |
427 | .dma_out_nbr = SER3_TX_DMA_NBR, | ||
428 | .dma_out_irq_nbr = SER3_DMA_TX_IRQ_NBR, | ||
429 | .dma_out_irq_flags = IRQF_DISABLED, | ||
430 | .dma_out_irq_description = "serial 3 dma tr", | ||
789 | #else | 431 | #else |
790 | .dma_out_enabled = 0, | 432 | .dma_out_enabled = 0, |
433 | .dma_out_nbr = UINT_MAX, | ||
434 | .dma_out_irq_nbr = 0, | ||
435 | .dma_out_irq_flags = 0, | ||
436 | .dma_out_irq_description = NULL, | ||
791 | #endif | 437 | #endif |
792 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN | 438 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN |
793 | .dma_in_enabled = 1, | 439 | .dma_in_enabled = 1, |
440 | .dma_in_nbr = SER3_RX_DMA_NBR, | ||
441 | .dma_in_irq_nbr = SER3_DMA_RX_IRQ_NBR, | ||
442 | .dma_in_irq_flags = IRQF_DISABLED, | ||
443 | .dma_in_irq_description = "serial 3 dma rec", | ||
794 | #else | 444 | #else |
795 | .dma_in_enabled = 0 | 445 | .dma_in_enabled = 0, |
446 | .dma_in_nbr = UINT_MAX, | ||
447 | .dma_in_irq_nbr = 0, | ||
448 | .dma_in_irq_flags = 0, | ||
449 | .dma_in_irq_description = NULL | ||
796 | #endif | 450 | #endif |
797 | #else | 451 | #else |
798 | .enabled = 0, | 452 | .enabled = 0, |
453 | .io_if_description = NULL, | ||
799 | .dma_out_enabled = 0, | 454 | .dma_out_enabled = 0, |
800 | .dma_in_enabled = 0 | 455 | .dma_in_enabled = 0 |
801 | #endif | 456 | #endif |
@@ -1416,12 +1071,11 @@ e100_dtr(struct e100_serial *info, int set) | |||
1416 | { | 1071 | { |
1417 | unsigned long flags; | 1072 | unsigned long flags; |
1418 | 1073 | ||
1419 | save_flags(flags); | 1074 | local_irq_save(flags); |
1420 | cli(); | ||
1421 | *e100_modem_pins[info->line].dtr_shadow &= ~mask; | 1075 | *e100_modem_pins[info->line].dtr_shadow &= ~mask; |
1422 | *e100_modem_pins[info->line].dtr_shadow |= (set ? 0 : mask); | 1076 | *e100_modem_pins[info->line].dtr_shadow |= (set ? 0 : mask); |
1423 | *e100_modem_pins[info->line].dtr_port = *e100_modem_pins[info->line].dtr_shadow; | 1077 | *e100_modem_pins[info->line].dtr_port = *e100_modem_pins[info->line].dtr_shadow; |
1424 | restore_flags(flags); | 1078 | local_irq_restore(flags); |
1425 | } | 1079 | } |
1426 | 1080 | ||
1427 | #ifdef SERIAL_DEBUG_IO | 1081 | #ifdef SERIAL_DEBUG_IO |
@@ -1440,12 +1094,11 @@ e100_rts(struct e100_serial *info, int set) | |||
1440 | { | 1094 | { |
1441 | #ifndef CONFIG_SVINTO_SIM | 1095 | #ifndef CONFIG_SVINTO_SIM |
1442 | unsigned long flags; | 1096 | unsigned long flags; |
1443 | save_flags(flags); | 1097 | local_irq_save(flags); |
1444 | cli(); | ||
1445 | info->rx_ctrl &= ~E100_RTS_MASK; | 1098 | info->rx_ctrl &= ~E100_RTS_MASK; |
1446 | info->rx_ctrl |= (set ? 0 : E100_RTS_MASK); /* RTS is active low */ | 1099 | info->rx_ctrl |= (set ? 0 : E100_RTS_MASK); /* RTS is active low */ |
1447 | info->port[REG_REC_CTRL] = info->rx_ctrl; | 1100 | info->port[REG_REC_CTRL] = info->rx_ctrl; |
1448 | restore_flags(flags); | 1101 | local_irq_restore(flags); |
1449 | #ifdef SERIAL_DEBUG_IO | 1102 | #ifdef SERIAL_DEBUG_IO |
1450 | printk("ser%i rts %i\n", info->line, set); | 1103 | printk("ser%i rts %i\n", info->line, set); |
1451 | #endif | 1104 | #endif |
@@ -1463,12 +1116,11 @@ e100_ri_out(struct e100_serial *info, int set) | |||
1463 | unsigned char mask = e100_modem_pins[info->line].ri_mask; | 1116 | unsigned char mask = e100_modem_pins[info->line].ri_mask; |
1464 | unsigned long flags; | 1117 | unsigned long flags; |
1465 | 1118 | ||
1466 | save_flags(flags); | 1119 | local_irq_save(flags); |
1467 | cli(); | ||
1468 | *e100_modem_pins[info->line].ri_shadow &= ~mask; | 1120 | *e100_modem_pins[info->line].ri_shadow &= ~mask; |
1469 | *e100_modem_pins[info->line].ri_shadow |= (set ? 0 : mask); | 1121 | *e100_modem_pins[info->line].ri_shadow |= (set ? 0 : mask); |
1470 | *e100_modem_pins[info->line].ri_port = *e100_modem_pins[info->line].ri_shadow; | 1122 | *e100_modem_pins[info->line].ri_port = *e100_modem_pins[info->line].ri_shadow; |
1471 | restore_flags(flags); | 1123 | local_irq_restore(flags); |
1472 | } | 1124 | } |
1473 | #endif | 1125 | #endif |
1474 | } | 1126 | } |
@@ -1481,12 +1133,11 @@ e100_cd_out(struct e100_serial *info, int set) | |||
1481 | unsigned char mask = e100_modem_pins[info->line].cd_mask; | 1133 | unsigned char mask = e100_modem_pins[info->line].cd_mask; |
1482 | unsigned long flags; | 1134 | unsigned long flags; |
1483 | 1135 | ||
1484 | save_flags(flags); | 1136 | local_irq_save(flags); |
1485 | cli(); | ||
1486 | *e100_modem_pins[info->line].cd_shadow &= ~mask; | 1137 | *e100_modem_pins[info->line].cd_shadow &= ~mask; |
1487 | *e100_modem_pins[info->line].cd_shadow |= (set ? 0 : mask); | 1138 | *e100_modem_pins[info->line].cd_shadow |= (set ? 0 : mask); |
1488 | *e100_modem_pins[info->line].cd_port = *e100_modem_pins[info->line].cd_shadow; | 1139 | *e100_modem_pins[info->line].cd_port = *e100_modem_pins[info->line].cd_shadow; |
1489 | restore_flags(flags); | 1140 | local_irq_restore(flags); |
1490 | } | 1141 | } |
1491 | #endif | 1142 | #endif |
1492 | } | 1143 | } |
@@ -1560,8 +1211,7 @@ static void e100_disable_txdma_channel(struct e100_serial *info) | |||
1560 | /* Disable output DMA channel for the serial port in question | 1211 | /* Disable output DMA channel for the serial port in question |
1561 | * ( set to something other then serialX) | 1212 | * ( set to something other then serialX) |
1562 | */ | 1213 | */ |
1563 | save_flags(flags); | 1214 | local_irq_save(flags); |
1564 | cli(); | ||
1565 | DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line)); | 1215 | DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line)); |
1566 | if (info->line == 0) { | 1216 | if (info->line == 0) { |
1567 | if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma6)) == | 1217 | if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma6)) == |
@@ -1589,7 +1239,7 @@ static void e100_disable_txdma_channel(struct e100_serial *info) | |||
1589 | } | 1239 | } |
1590 | } | 1240 | } |
1591 | *R_GEN_CONFIG = genconfig_shadow; | 1241 | *R_GEN_CONFIG = genconfig_shadow; |
1592 | restore_flags(flags); | 1242 | local_irq_restore(flags); |
1593 | } | 1243 | } |
1594 | 1244 | ||
1595 | 1245 | ||
@@ -1597,8 +1247,7 @@ static void e100_enable_txdma_channel(struct e100_serial *info) | |||
1597 | { | 1247 | { |
1598 | unsigned long flags; | 1248 | unsigned long flags; |
1599 | 1249 | ||
1600 | save_flags(flags); | 1250 | local_irq_save(flags); |
1601 | cli(); | ||
1602 | DFLOW(DEBUG_LOG(info->line, "enable_txdma_channel %i\n", info->line)); | 1251 | DFLOW(DEBUG_LOG(info->line, "enable_txdma_channel %i\n", info->line)); |
1603 | /* Enable output DMA channel for the serial port in question */ | 1252 | /* Enable output DMA channel for the serial port in question */ |
1604 | if (info->line == 0) { | 1253 | if (info->line == 0) { |
@@ -1615,7 +1264,7 @@ static void e100_enable_txdma_channel(struct e100_serial *info) | |||
1615 | genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, serial3); | 1264 | genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, serial3); |
1616 | } | 1265 | } |
1617 | *R_GEN_CONFIG = genconfig_shadow; | 1266 | *R_GEN_CONFIG = genconfig_shadow; |
1618 | restore_flags(flags); | 1267 | local_irq_restore(flags); |
1619 | } | 1268 | } |
1620 | 1269 | ||
1621 | static void e100_disable_rxdma_channel(struct e100_serial *info) | 1270 | static void e100_disable_rxdma_channel(struct e100_serial *info) |
@@ -1625,8 +1274,7 @@ static void e100_disable_rxdma_channel(struct e100_serial *info) | |||
1625 | /* Disable input DMA channel for the serial port in question | 1274 | /* Disable input DMA channel for the serial port in question |
1626 | * ( set to something other then serialX) | 1275 | * ( set to something other then serialX) |
1627 | */ | 1276 | */ |
1628 | save_flags(flags); | 1277 | local_irq_save(flags); |
1629 | cli(); | ||
1630 | if (info->line == 0) { | 1278 | if (info->line == 0) { |
1631 | if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma7)) == | 1279 | if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma7)) == |
1632 | IO_STATE(R_GEN_CONFIG, dma7, serial0)) { | 1280 | IO_STATE(R_GEN_CONFIG, dma7, serial0)) { |
@@ -1653,7 +1301,7 @@ static void e100_disable_rxdma_channel(struct e100_serial *info) | |||
1653 | } | 1301 | } |
1654 | } | 1302 | } |
1655 | *R_GEN_CONFIG = genconfig_shadow; | 1303 | *R_GEN_CONFIG = genconfig_shadow; |
1656 | restore_flags(flags); | 1304 | local_irq_restore(flags); |
1657 | } | 1305 | } |
1658 | 1306 | ||
1659 | 1307 | ||
@@ -1661,8 +1309,7 @@ static void e100_enable_rxdma_channel(struct e100_serial *info) | |||
1661 | { | 1309 | { |
1662 | unsigned long flags; | 1310 | unsigned long flags; |
1663 | 1311 | ||
1664 | save_flags(flags); | 1312 | local_irq_save(flags); |
1665 | cli(); | ||
1666 | /* Enable input DMA channel for the serial port in question */ | 1313 | /* Enable input DMA channel for the serial port in question */ |
1667 | if (info->line == 0) { | 1314 | if (info->line == 0) { |
1668 | genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma7); | 1315 | genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma7); |
@@ -1678,7 +1325,7 @@ static void e100_enable_rxdma_channel(struct e100_serial *info) | |||
1678 | genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, serial3); | 1325 | genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, serial3); |
1679 | } | 1326 | } |
1680 | *R_GEN_CONFIG = genconfig_shadow; | 1327 | *R_GEN_CONFIG = genconfig_shadow; |
1681 | restore_flags(flags); | 1328 | local_irq_restore(flags); |
1682 | } | 1329 | } |
1683 | 1330 | ||
1684 | #ifdef SERIAL_HANDLE_EARLY_ERRORS | 1331 | #ifdef SERIAL_HANDLE_EARLY_ERRORS |
@@ -1785,7 +1432,7 @@ e100_enable_rs485(struct tty_struct *tty,struct rs485_control *r) | |||
1785 | } | 1432 | } |
1786 | 1433 | ||
1787 | static int | 1434 | static int |
1788 | e100_write_rs485(struct tty_struct *tty, int from_user, | 1435 | e100_write_rs485(struct tty_struct *tty, |
1789 | const unsigned char *buf, int count) | 1436 | const unsigned char *buf, int count) |
1790 | { | 1437 | { |
1791 | struct e100_serial * info = (struct e100_serial *)tty->driver_data; | 1438 | struct e100_serial * info = (struct e100_serial *)tty->driver_data; |
@@ -1798,7 +1445,7 @@ e100_write_rs485(struct tty_struct *tty, int from_user, | |||
1798 | */ | 1445 | */ |
1799 | info->rs485.enabled = 1; | 1446 | info->rs485.enabled = 1; |
1800 | /* rs_write now deals with RS485 if enabled */ | 1447 | /* rs_write now deals with RS485 if enabled */ |
1801 | count = rs_write(tty, from_user, buf, count); | 1448 | count = rs_write(tty, buf, count); |
1802 | info->rs485.enabled = old_enabled; | 1449 | info->rs485.enabled = old_enabled; |
1803 | return count; | 1450 | return count; |
1804 | } | 1451 | } |
@@ -1836,7 +1483,7 @@ rs_stop(struct tty_struct *tty) | |||
1836 | unsigned long flags; | 1483 | unsigned long flags; |
1837 | unsigned long xoff; | 1484 | unsigned long xoff; |
1838 | 1485 | ||
1839 | save_flags(flags); cli(); | 1486 | local_irq_save(flags); |
1840 | DFLOW(DEBUG_LOG(info->line, "XOFF rs_stop xmit %i\n", | 1487 | DFLOW(DEBUG_LOG(info->line, "XOFF rs_stop xmit %i\n", |
1841 | CIRC_CNT(info->xmit.head, | 1488 | CIRC_CNT(info->xmit.head, |
1842 | info->xmit.tail,SERIAL_XMIT_SIZE))); | 1489 | info->xmit.tail,SERIAL_XMIT_SIZE))); |
@@ -1848,7 +1495,7 @@ rs_stop(struct tty_struct *tty) | |||
1848 | } | 1495 | } |
1849 | 1496 | ||
1850 | *((unsigned long *)&info->port[REG_XOFF]) = xoff; | 1497 | *((unsigned long *)&info->port[REG_XOFF]) = xoff; |
1851 | restore_flags(flags); | 1498 | local_irq_restore(flags); |
1852 | } | 1499 | } |
1853 | } | 1500 | } |
1854 | 1501 | ||
@@ -1860,7 +1507,7 @@ rs_start(struct tty_struct *tty) | |||
1860 | unsigned long flags; | 1507 | unsigned long flags; |
1861 | unsigned long xoff; | 1508 | unsigned long xoff; |
1862 | 1509 | ||
1863 | save_flags(flags); cli(); | 1510 | local_irq_save(flags); |
1864 | DFLOW(DEBUG_LOG(info->line, "XOFF rs_start xmit %i\n", | 1511 | DFLOW(DEBUG_LOG(info->line, "XOFF rs_start xmit %i\n", |
1865 | CIRC_CNT(info->xmit.head, | 1512 | CIRC_CNT(info->xmit.head, |
1866 | info->xmit.tail,SERIAL_XMIT_SIZE))); | 1513 | info->xmit.tail,SERIAL_XMIT_SIZE))); |
@@ -1875,7 +1522,7 @@ rs_start(struct tty_struct *tty) | |||
1875 | info->xmit.head != info->xmit.tail && info->xmit.buf) | 1522 | info->xmit.head != info->xmit.tail && info->xmit.buf) |
1876 | e100_enable_serial_tx_ready_irq(info); | 1523 | e100_enable_serial_tx_ready_irq(info); |
1877 | 1524 | ||
1878 | restore_flags(flags); | 1525 | local_irq_restore(flags); |
1879 | } | 1526 | } |
1880 | } | 1527 | } |
1881 | 1528 | ||
@@ -2055,8 +1702,7 @@ static int serial_fast_timer_expired = 0; | |||
2055 | static void flush_timeout_function(unsigned long data); | 1702 | static void flush_timeout_function(unsigned long data); |
2056 | #define START_FLUSH_FAST_TIMER_TIME(info, string, usec) {\ | 1703 | #define START_FLUSH_FAST_TIMER_TIME(info, string, usec) {\ |
2057 | unsigned long timer_flags; \ | 1704 | unsigned long timer_flags; \ |
2058 | save_flags(timer_flags); \ | 1705 | local_irq_save(timer_flags); \ |
2059 | cli(); \ | ||
2060 | if (fast_timers[info->line].function == NULL) { \ | 1706 | if (fast_timers[info->line].function == NULL) { \ |
2061 | serial_fast_timer_started++; \ | 1707 | serial_fast_timer_started++; \ |
2062 | TIMERD(DEBUG_LOG(info->line, "start_timer %i ", info->line)); \ | 1708 | TIMERD(DEBUG_LOG(info->line, "start_timer %i ", info->line)); \ |
@@ -2070,7 +1716,7 @@ static void flush_timeout_function(unsigned long data); | |||
2070 | else { \ | 1716 | else { \ |
2071 | TIMERD(DEBUG_LOG(info->line, "timer %i already running\n", info->line)); \ | 1717 | TIMERD(DEBUG_LOG(info->line, "timer %i already running\n", info->line)); \ |
2072 | } \ | 1718 | } \ |
2073 | restore_flags(timer_flags); \ | 1719 | local_irq_restore(timer_flags); \ |
2074 | } | 1720 | } |
2075 | #define START_FLUSH_FAST_TIMER(info, string) START_FLUSH_FAST_TIMER_TIME(info, string, info->flush_time_usec) | 1721 | #define START_FLUSH_FAST_TIMER(info, string) START_FLUSH_FAST_TIMER_TIME(info, string, info->flush_time_usec) |
2076 | 1722 | ||
@@ -2099,8 +1745,7 @@ append_recv_buffer(struct e100_serial *info, struct etrax_recv_buffer *buffer) | |||
2099 | { | 1745 | { |
2100 | unsigned long flags; | 1746 | unsigned long flags; |
2101 | 1747 | ||
2102 | save_flags(flags); | 1748 | local_irq_save(flags); |
2103 | cli(); | ||
2104 | 1749 | ||
2105 | if (!info->first_recv_buffer) | 1750 | if (!info->first_recv_buffer) |
2106 | info->first_recv_buffer = buffer; | 1751 | info->first_recv_buffer = buffer; |
@@ -2113,7 +1758,7 @@ append_recv_buffer(struct e100_serial *info, struct etrax_recv_buffer *buffer) | |||
2113 | if (info->recv_cnt > info->max_recv_cnt) | 1758 | if (info->recv_cnt > info->max_recv_cnt) |
2114 | info->max_recv_cnt = info->recv_cnt; | 1759 | info->max_recv_cnt = info->recv_cnt; |
2115 | 1760 | ||
2116 | restore_flags(flags); | 1761 | local_irq_restore(flags); |
2117 | } | 1762 | } |
2118 | 1763 | ||
2119 | static int | 1764 | static int |
@@ -2133,11 +1778,7 @@ add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char fl | |||
2133 | info->icount.rx++; | 1778 | info->icount.rx++; |
2134 | } else { | 1779 | } else { |
2135 | struct tty_struct *tty = info->tty; | 1780 | struct tty_struct *tty = info->tty; |
2136 | *tty->flip.char_buf_ptr = data; | 1781 | tty_insert_flip_char(tty, data, flag); |
2137 | *tty->flip.flag_buf_ptr = flag; | ||
2138 | tty->flip.flag_buf_ptr++; | ||
2139 | tty->flip.char_buf_ptr++; | ||
2140 | tty->flip.count++; | ||
2141 | info->icount.rx++; | 1782 | info->icount.rx++; |
2142 | } | 1783 | } |
2143 | 1784 | ||
@@ -2322,7 +1963,6 @@ start_receive(struct e100_serial *info) | |||
2322 | */ | 1963 | */ |
2323 | return; | 1964 | return; |
2324 | #endif | 1965 | #endif |
2325 | info->tty->flip.count = 0; | ||
2326 | if (info->uses_dma_in) { | 1966 | if (info->uses_dma_in) { |
2327 | /* reset the input dma channel to be sure it works */ | 1967 | /* reset the input dma channel to be sure it works */ |
2328 | 1968 | ||
@@ -2484,32 +2124,20 @@ static void flush_to_flip_buffer(struct e100_serial *info) | |||
2484 | { | 2124 | { |
2485 | struct tty_struct *tty; | 2125 | struct tty_struct *tty; |
2486 | struct etrax_recv_buffer *buffer; | 2126 | struct etrax_recv_buffer *buffer; |
2487 | unsigned int length; | ||
2488 | unsigned long flags; | 2127 | unsigned long flags; |
2489 | int max_flip_size; | ||
2490 | |||
2491 | if (!info->first_recv_buffer) | ||
2492 | return; | ||
2493 | 2128 | ||
2494 | save_flags(flags); | 2129 | local_irq_save(flags); |
2495 | cli(); | 2130 | tty = info->tty; |
2496 | 2131 | ||
2497 | if (!(tty = info->tty)) { | 2132 | if (!tty) { |
2498 | restore_flags(flags); | 2133 | local_irq_restore(flags); |
2499 | return; | 2134 | return; |
2500 | } | 2135 | } |
2501 | 2136 | ||
2502 | while ((buffer = info->first_recv_buffer) != NULL) { | 2137 | while ((buffer = info->first_recv_buffer) != NULL) { |
2503 | unsigned int count = buffer->length; | 2138 | unsigned int count = buffer->length; |
2504 | 2139 | ||
2505 | count = tty_buffer_request_room(tty, count); | 2140 | tty_insert_flip_string(tty, buffer->buffer, count); |
2506 | if (count == 0) /* Throttle ?? */ | ||
2507 | break; | ||
2508 | |||
2509 | if (count > 1) | ||
2510 | tty_insert_flip_strings(tty, buffer->buffer, count - 1); | ||
2511 | tty_insert_flip_char(tty, buffer->buffer[count-1], buffer->error); | ||
2512 | |||
2513 | info->recv_cnt -= count; | 2141 | info->recv_cnt -= count; |
2514 | 2142 | ||
2515 | if (count == buffer->length) { | 2143 | if (count == buffer->length) { |
@@ -2525,18 +2153,9 @@ static void flush_to_flip_buffer(struct e100_serial *info) | |||
2525 | if (!info->first_recv_buffer) | 2153 | if (!info->first_recv_buffer) |
2526 | info->last_recv_buffer = NULL; | 2154 | info->last_recv_buffer = NULL; |
2527 | 2155 | ||
2528 | restore_flags(flags); | 2156 | local_irq_restore(flags); |
2529 | |||
2530 | DFLIP( | ||
2531 | if (1) { | ||
2532 | DEBUG_LOG(info->line, "*** rxtot %i\n", info->icount.rx); | ||
2533 | DEBUG_LOG(info->line, "ldisc %lu\n", tty->ldisc.chars_in_buffer(tty)); | ||
2534 | DEBUG_LOG(info->line, "room %lu\n", tty->ldisc.receive_room(tty)); | ||
2535 | } | ||
2536 | 2157 | ||
2537 | ); | 2158 | /* This includes a check for low-latency */ |
2538 | |||
2539 | /* this includes a check for low-latency */ | ||
2540 | tty_flip_buffer_push(tty); | 2159 | tty_flip_buffer_push(tty); |
2541 | } | 2160 | } |
2542 | 2161 | ||
@@ -2679,21 +2298,7 @@ struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info) | |||
2679 | printk("!NO TTY!\n"); | 2298 | printk("!NO TTY!\n"); |
2680 | return info; | 2299 | return info; |
2681 | } | 2300 | } |
2682 | if (tty->flip.count >= CRIS_BUF_SIZE - TTY_THRESHOLD_THROTTLE) { | 2301 | |
2683 | /* check TTY_THROTTLED first so it indicates our state */ | ||
2684 | if (!test_and_set_bit(TTY_THROTTLED, &tty->flags)) { | ||
2685 | DFLOW(DEBUG_LOG(info->line, "rs_throttle flip.count: %i\n", tty->flip.count)); | ||
2686 | rs_throttle(tty); | ||
2687 | } | ||
2688 | } | ||
2689 | if (tty->flip.count >= CRIS_BUF_SIZE) { | ||
2690 | DEBUG_LOG(info->line, "force FLIP! %i\n", tty->flip.count); | ||
2691 | tty->flip.work.func((void *) tty); | ||
2692 | if (tty->flip.count >= CRIS_BUF_SIZE) { | ||
2693 | DEBUG_LOG(info->line, "FLIP FULL! %i\n", tty->flip.count); | ||
2694 | return info; /* if TTY_DONT_FLIP is set */ | ||
2695 | } | ||
2696 | } | ||
2697 | /* Read data and status at the same time */ | 2302 | /* Read data and status at the same time */ |
2698 | data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); | 2303 | data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); |
2699 | more_data: | 2304 | more_data: |
@@ -2746,27 +2351,26 @@ more_data: | |||
2746 | DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt); | 2351 | DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt); |
2747 | info->errorcode = ERRCODE_INSERT_BREAK; | 2352 | info->errorcode = ERRCODE_INSERT_BREAK; |
2748 | } else { | 2353 | } else { |
2354 | unsigned char data = IO_EXTRACT(R_SERIAL0_READ, | ||
2355 | data_in, data_read); | ||
2356 | char flag = TTY_NORMAL; | ||
2749 | if (info->errorcode == ERRCODE_INSERT_BREAK) { | 2357 | if (info->errorcode == ERRCODE_INSERT_BREAK) { |
2750 | info->icount.brk++; | 2358 | struct tty_struct *tty = info->tty; |
2751 | *tty->flip.char_buf_ptr = 0; | 2359 | tty_insert_flip_char(tty, 0, flag); |
2752 | *tty->flip.flag_buf_ptr = TTY_BREAK; | ||
2753 | tty->flip.flag_buf_ptr++; | ||
2754 | tty->flip.char_buf_ptr++; | ||
2755 | tty->flip.count++; | ||
2756 | info->icount.rx++; | 2360 | info->icount.rx++; |
2757 | } | 2361 | } |
2758 | *tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read); | ||
2759 | 2362 | ||
2760 | if (data_read & IO_MASK(R_SERIAL0_READ, par_err)) { | 2363 | if (data_read & IO_MASK(R_SERIAL0_READ, par_err)) { |
2761 | info->icount.parity++; | 2364 | info->icount.parity++; |
2762 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 2365 | flag = TTY_PARITY; |
2763 | } else if (data_read & IO_MASK(R_SERIAL0_READ, overrun)) { | 2366 | } else if (data_read & IO_MASK(R_SERIAL0_READ, overrun)) { |
2764 | info->icount.overrun++; | 2367 | info->icount.overrun++; |
2765 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | 2368 | flag = TTY_OVERRUN; |
2766 | } else if (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) { | 2369 | } else if (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) { |
2767 | info->icount.frame++; | 2370 | info->icount.frame++; |
2768 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 2371 | flag = TTY_FRAME; |
2769 | } | 2372 | } |
2373 | tty_insert_flip_char(tty, data, flag); | ||
2770 | info->errorcode = 0; | 2374 | info->errorcode = 0; |
2771 | } | 2375 | } |
2772 | info->break_detected_cnt = 0; | 2376 | info->break_detected_cnt = 0; |
@@ -2782,16 +2386,14 @@ more_data: | |||
2782 | log_int(rdpc(), 0, 0); | 2386 | log_int(rdpc(), 0, 0); |
2783 | } | 2387 | } |
2784 | ); | 2388 | ); |
2785 | *tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read); | 2389 | tty_insert_flip_char(tty, |
2786 | *tty->flip.flag_buf_ptr = 0; | 2390 | IO_EXTRACT(R_SERIAL0_READ, data_in, data_read), |
2391 | TTY_NORMAL); | ||
2787 | } else { | 2392 | } else { |
2788 | DEBUG_LOG(info->line, "ser_rx int but no data_avail %08lX\n", data_read); | 2393 | DEBUG_LOG(info->line, "ser_rx int but no data_avail %08lX\n", data_read); |
2789 | } | 2394 | } |
2790 | 2395 | ||
2791 | 2396 | ||
2792 | tty->flip.flag_buf_ptr++; | ||
2793 | tty->flip.char_buf_ptr++; | ||
2794 | tty->flip.count++; | ||
2795 | info->icount.rx++; | 2397 | info->icount.rx++; |
2796 | data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); | 2398 | data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); |
2797 | if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) { | 2399 | if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) { |
@@ -2929,7 +2531,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2929 | if (info->x_char) { | 2531 | if (info->x_char) { |
2930 | unsigned char rstat; | 2532 | unsigned char rstat; |
2931 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char)); | 2533 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char)); |
2932 | save_flags(flags); cli(); | 2534 | local_irq_save(flags); |
2933 | rstat = info->port[REG_STATUS]; | 2535 | rstat = info->port[REG_STATUS]; |
2934 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); | 2536 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); |
2935 | 2537 | ||
@@ -2938,7 +2540,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2938 | info->x_char = 0; | 2540 | info->x_char = 0; |
2939 | /* We must enable since it is disabled in ser_interrupt */ | 2541 | /* We must enable since it is disabled in ser_interrupt */ |
2940 | e100_enable_serial_tx_ready_irq(info); | 2542 | e100_enable_serial_tx_ready_irq(info); |
2941 | restore_flags(flags); | 2543 | local_irq_restore(flags); |
2942 | return; | 2544 | return; |
2943 | } | 2545 | } |
2944 | if (info->uses_dma_out) { | 2546 | if (info->uses_dma_out) { |
@@ -2946,7 +2548,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2946 | int i; | 2548 | int i; |
2947 | /* We only use normal tx interrupt when sending x_char */ | 2549 | /* We only use normal tx interrupt when sending x_char */ |
2948 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0)); | 2550 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0)); |
2949 | save_flags(flags); cli(); | 2551 | local_irq_save(flags); |
2950 | rstat = info->port[REG_STATUS]; | 2552 | rstat = info->port[REG_STATUS]; |
2951 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); | 2553 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); |
2952 | e100_disable_serial_tx_ready_irq(info); | 2554 | e100_disable_serial_tx_ready_irq(info); |
@@ -2959,7 +2561,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2959 | nop(); | 2561 | nop(); |
2960 | 2562 | ||
2961 | *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, continue); | 2563 | *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, continue); |
2962 | restore_flags(flags); | 2564 | local_irq_restore(flags); |
2963 | return; | 2565 | return; |
2964 | } | 2566 | } |
2965 | /* Normal char-by-char interrupt */ | 2567 | /* Normal char-by-char interrupt */ |
@@ -2973,7 +2575,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2973 | } | 2575 | } |
2974 | DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail])); | 2576 | DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail])); |
2975 | /* Send a byte, rs485 timing is critical so turn of ints */ | 2577 | /* Send a byte, rs485 timing is critical so turn of ints */ |
2976 | save_flags(flags); cli(); | 2578 | local_irq_save(flags); |
2977 | info->port[REG_TR_DATA] = info->xmit.buf[info->xmit.tail]; | 2579 | info->port[REG_TR_DATA] = info->xmit.buf[info->xmit.tail]; |
2978 | info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); | 2580 | info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); |
2979 | info->icount.tx++; | 2581 | info->icount.tx++; |
@@ -2997,7 +2599,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2997 | /* We must enable since it is disabled in ser_interrupt */ | 2599 | /* We must enable since it is disabled in ser_interrupt */ |
2998 | e100_enable_serial_tx_ready_irq(info); | 2600 | e100_enable_serial_tx_ready_irq(info); |
2999 | } | 2601 | } |
3000 | restore_flags(flags); | 2602 | local_irq_restore(flags); |
3001 | 2603 | ||
3002 | if (CIRC_CNT(info->xmit.head, | 2604 | if (CIRC_CNT(info->xmit.head, |
3003 | info->xmit.tail, | 2605 | info->xmit.tail, |
@@ -3022,7 +2624,7 @@ ser_interrupt(int irq, void *dev_id) | |||
3022 | int handled = 0; | 2624 | int handled = 0; |
3023 | static volatile unsigned long reentered_ready_mask = 0; | 2625 | static volatile unsigned long reentered_ready_mask = 0; |
3024 | 2626 | ||
3025 | save_flags(flags); cli(); | 2627 | local_irq_save(flags); |
3026 | irq_mask1_rd = *R_IRQ_MASK1_RD; | 2628 | irq_mask1_rd = *R_IRQ_MASK1_RD; |
3027 | /* First handle all rx interrupts with ints disabled */ | 2629 | /* First handle all rx interrupts with ints disabled */ |
3028 | info = rs_table; | 2630 | info = rs_table; |
@@ -3067,7 +2669,7 @@ ser_interrupt(int irq, void *dev_id) | |||
3067 | /* Unblock the serial interrupt */ | 2669 | /* Unblock the serial interrupt */ |
3068 | *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set); | 2670 | *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set); |
3069 | 2671 | ||
3070 | sti(); | 2672 | local_irq_enable(); |
3071 | ready_mask = (1 << (8+1+2*0)); /* ser0 tr_ready */ | 2673 | ready_mask = (1 << (8+1+2*0)); /* ser0 tr_ready */ |
3072 | info = rs_table; | 2674 | info = rs_table; |
3073 | for (i = 0; i < NR_PORTS; i++) { | 2675 | for (i = 0; i < NR_PORTS; i++) { |
@@ -3080,11 +2682,11 @@ ser_interrupt(int irq, void *dev_id) | |||
3080 | ready_mask <<= 2; | 2682 | ready_mask <<= 2; |
3081 | } | 2683 | } |
3082 | /* handle_ser_tx_interrupt enables tr_ready interrupts */ | 2684 | /* handle_ser_tx_interrupt enables tr_ready interrupts */ |
3083 | cli(); | 2685 | local_irq_disable(); |
3084 | /* Handle reentered TX interrupt */ | 2686 | /* Handle reentered TX interrupt */ |
3085 | irq_mask1_rd = reentered_ready_mask; | 2687 | irq_mask1_rd = reentered_ready_mask; |
3086 | } | 2688 | } |
3087 | cli(); | 2689 | local_irq_disable(); |
3088 | tx_started = 0; | 2690 | tx_started = 0; |
3089 | } else { | 2691 | } else { |
3090 | unsigned long ready_mask; | 2692 | unsigned long ready_mask; |
@@ -3100,7 +2702,7 @@ ser_interrupt(int irq, void *dev_id) | |||
3100 | } | 2702 | } |
3101 | } | 2703 | } |
3102 | 2704 | ||
3103 | restore_flags(flags); | 2705 | local_irq_restore(flags); |
3104 | return IRQ_RETVAL(handled); | 2706 | return IRQ_RETVAL(handled); |
3105 | } /* ser_interrupt */ | 2707 | } /* ser_interrupt */ |
3106 | #endif | 2708 | #endif |
@@ -3121,11 +2723,13 @@ ser_interrupt(int irq, void *dev_id) | |||
3121 | * them using rs_sched_event(), and they get done here. | 2723 | * them using rs_sched_event(), and they get done here. |
3122 | */ | 2724 | */ |
3123 | static void | 2725 | static void |
3124 | do_softint(void *private_) | 2726 | do_softint(struct work_struct *work) |
3125 | { | 2727 | { |
3126 | struct e100_serial *info = (struct e100_serial *) private_; | 2728 | struct e100_serial *info; |
3127 | struct tty_struct *tty; | 2729 | struct tty_struct *tty; |
3128 | 2730 | ||
2731 | info = container_of(work, struct e100_serial, work); | ||
2732 | |||
3129 | tty = info->tty; | 2733 | tty = info->tty; |
3130 | if (!tty) | 2734 | if (!tty) |
3131 | return; | 2735 | return; |
@@ -3145,13 +2749,12 @@ startup(struct e100_serial * info) | |||
3145 | if (!xmit_page) | 2749 | if (!xmit_page) |
3146 | return -ENOMEM; | 2750 | return -ENOMEM; |
3147 | 2751 | ||
3148 | save_flags(flags); | 2752 | local_irq_save(flags); |
3149 | cli(); | ||
3150 | 2753 | ||
3151 | /* if it was already initialized, skip this */ | 2754 | /* if it was already initialized, skip this */ |
3152 | 2755 | ||
3153 | if (info->flags & ASYNC_INITIALIZED) { | 2756 | if (info->flags & ASYNC_INITIALIZED) { |
3154 | restore_flags(flags); | 2757 | local_irq_restore(flags); |
3155 | free_page(xmit_page); | 2758 | free_page(xmit_page); |
3156 | return 0; | 2759 | return 0; |
3157 | } | 2760 | } |
@@ -3277,7 +2880,7 @@ startup(struct e100_serial * info) | |||
3277 | 2880 | ||
3278 | info->flags |= ASYNC_INITIALIZED; | 2881 | info->flags |= ASYNC_INITIALIZED; |
3279 | 2882 | ||
3280 | restore_flags(flags); | 2883 | local_irq_restore(flags); |
3281 | return 0; | 2884 | return 0; |
3282 | } | 2885 | } |
3283 | 2886 | ||
@@ -3328,8 +2931,7 @@ shutdown(struct e100_serial * info) | |||
3328 | info->irq); | 2931 | info->irq); |
3329 | #endif | 2932 | #endif |
3330 | 2933 | ||
3331 | save_flags(flags); | 2934 | local_irq_save(flags); |
3332 | cli(); /* Disable interrupts */ | ||
3333 | 2935 | ||
3334 | if (info->xmit.buf) { | 2936 | if (info->xmit.buf) { |
3335 | free_page((unsigned long)info->xmit.buf); | 2937 | free_page((unsigned long)info->xmit.buf); |
@@ -3353,7 +2955,7 @@ shutdown(struct e100_serial * info) | |||
3353 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2955 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
3354 | 2956 | ||
3355 | info->flags &= ~ASYNC_INITIALIZED; | 2957 | info->flags &= ~ASYNC_INITIALIZED; |
3356 | restore_flags(flags); | 2958 | local_irq_restore(flags); |
3357 | } | 2959 | } |
3358 | 2960 | ||
3359 | 2961 | ||
@@ -3411,7 +3013,6 @@ change_speed(struct e100_serial *info) | |||
3411 | DBAUD(printk("using external baudrate: %lu\n", CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8)); | 3013 | DBAUD(printk("using external baudrate: %lu\n", CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8)); |
3412 | info->baud = CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8; | 3014 | info->baud = CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8; |
3413 | } | 3015 | } |
3414 | } | ||
3415 | #endif | 3016 | #endif |
3416 | else | 3017 | else |
3417 | { | 3018 | { |
@@ -3445,8 +3046,7 @@ change_speed(struct e100_serial *info) | |||
3445 | 3046 | ||
3446 | #ifndef CONFIG_SVINTO_SIM | 3047 | #ifndef CONFIG_SVINTO_SIM |
3447 | /* start with default settings and then fill in changes */ | 3048 | /* start with default settings and then fill in changes */ |
3448 | save_flags(flags); | 3049 | local_irq_save(flags); |
3449 | cli(); | ||
3450 | /* 8 bit, no/even parity */ | 3050 | /* 8 bit, no/even parity */ |
3451 | info->rx_ctrl &= ~(IO_MASK(R_SERIAL0_REC_CTRL, rec_bitnr) | | 3051 | info->rx_ctrl &= ~(IO_MASK(R_SERIAL0_REC_CTRL, rec_bitnr) | |
3452 | IO_MASK(R_SERIAL0_REC_CTRL, rec_par_en) | | 3052 | IO_MASK(R_SERIAL0_REC_CTRL, rec_par_en) | |
@@ -3510,7 +3110,7 @@ change_speed(struct e100_serial *info) | |||
3510 | } | 3110 | } |
3511 | 3111 | ||
3512 | *((unsigned long *)&info->port[REG_XOFF]) = xoff; | 3112 | *((unsigned long *)&info->port[REG_XOFF]) = xoff; |
3513 | restore_flags(flags); | 3113 | local_irq_restore(flags); |
3514 | #endif /* !CONFIG_SVINTO_SIM */ | 3114 | #endif /* !CONFIG_SVINTO_SIM */ |
3515 | 3115 | ||
3516 | update_char_time(info); | 3116 | update_char_time(info); |
@@ -3538,13 +3138,12 @@ rs_flush_chars(struct tty_struct *tty) | |||
3538 | 3138 | ||
3539 | /* this protection might not exactly be necessary here */ | 3139 | /* this protection might not exactly be necessary here */ |
3540 | 3140 | ||
3541 | save_flags(flags); | 3141 | local_irq_save(flags); |
3542 | cli(); | ||
3543 | start_transmit(info); | 3142 | start_transmit(info); |
3544 | restore_flags(flags); | 3143 | local_irq_restore(flags); |
3545 | } | 3144 | } |
3546 | 3145 | ||
3547 | static int rs_raw_write(struct tty_struct * tty, int from_user, | 3146 | static int rs_raw_write(struct tty_struct *tty, |
3548 | const unsigned char *buf, int count) | 3147 | const unsigned char *buf, int count) |
3549 | { | 3148 | { |
3550 | int c, ret = 0; | 3149 | int c, ret = 0; |
@@ -3567,53 +3166,19 @@ static int rs_raw_write(struct tty_struct * tty, int from_user, | |||
3567 | SIMCOUT(buf, count); | 3166 | SIMCOUT(buf, count); |
3568 | return count; | 3167 | return count; |
3569 | #endif | 3168 | #endif |
3570 | save_flags(flags); | 3169 | local_save_flags(flags); |
3571 | DFLOW(DEBUG_LOG(info->line, "write count %i ", count)); | 3170 | DFLOW(DEBUG_LOG(info->line, "write count %i ", count)); |
3572 | DFLOW(DEBUG_LOG(info->line, "ldisc %i\n", tty->ldisc.chars_in_buffer(tty))); | 3171 | DFLOW(DEBUG_LOG(info->line, "ldisc %i\n", tty->ldisc.chars_in_buffer(tty))); |
3573 | 3172 | ||
3574 | 3173 | ||
3575 | /* the cli/restore_flags pairs below are needed because the | 3174 | /* The local_irq_disable/restore_flags pairs below are needed |
3576 | * DMA interrupt handler moves the info->xmit values. the memcpy | 3175 | * because the DMA interrupt handler moves the info->xmit values. |
3577 | * needs to be in the critical region unfortunately, because we | 3176 | * the memcpy needs to be in the critical region unfortunately, |
3578 | * need to read xmit values, memcpy, write xmit values in one | 3177 | * because we need to read xmit values, memcpy, write xmit values |
3579 | * atomic operation... this could perhaps be avoided by more clever | 3178 | * in one atomic operation... this could perhaps be avoided by |
3580 | * design. | 3179 | * more clever design. |
3581 | */ | 3180 | */ |
3582 | if (from_user) { | 3181 | local_irq_disable(); |
3583 | mutex_lock(&tmp_buf_mutex); | ||
3584 | while (1) { | ||
3585 | int c1; | ||
3586 | c = CIRC_SPACE_TO_END(info->xmit.head, | ||
3587 | info->xmit.tail, | ||
3588 | SERIAL_XMIT_SIZE); | ||
3589 | if (count < c) | ||
3590 | c = count; | ||
3591 | if (c <= 0) | ||
3592 | break; | ||
3593 | |||
3594 | c -= copy_from_user(tmp_buf, buf, c); | ||
3595 | if (!c) { | ||
3596 | if (!ret) | ||
3597 | ret = -EFAULT; | ||
3598 | break; | ||
3599 | } | ||
3600 | cli(); | ||
3601 | c1 = CIRC_SPACE_TO_END(info->xmit.head, | ||
3602 | info->xmit.tail, | ||
3603 | SERIAL_XMIT_SIZE); | ||
3604 | if (c1 < c) | ||
3605 | c = c1; | ||
3606 | memcpy(info->xmit.buf + info->xmit.head, tmp_buf, c); | ||
3607 | info->xmit.head = ((info->xmit.head + c) & | ||
3608 | (SERIAL_XMIT_SIZE-1)); | ||
3609 | restore_flags(flags); | ||
3610 | buf += c; | ||
3611 | count -= c; | ||
3612 | ret += c; | ||
3613 | } | ||
3614 | mutex_unlock(&tmp_buf_mutex); | ||
3615 | } else { | ||
3616 | cli(); | ||
3617 | while (count) { | 3182 | while (count) { |
3618 | c = CIRC_SPACE_TO_END(info->xmit.head, | 3183 | c = CIRC_SPACE_TO_END(info->xmit.head, |
3619 | info->xmit.tail, | 3184 | info->xmit.tail, |
@@ -3631,8 +3196,7 @@ static int rs_raw_write(struct tty_struct * tty, int from_user, | |||
3631 | count -= c; | 3196 | count -= c; |
3632 | ret += c; | 3197 | ret += c; |
3633 | } | 3198 | } |
3634 | restore_flags(flags); | 3199 | local_irq_restore(flags); |
3635 | } | ||
3636 | 3200 | ||
3637 | /* enable transmitter if not running, unless the tty is stopped | 3201 | /* enable transmitter if not running, unless the tty is stopped |
3638 | * this does not need IRQ protection since if tr_running == 0 | 3202 | * this does not need IRQ protection since if tr_running == 0 |
@@ -3651,7 +3215,7 @@ static int rs_raw_write(struct tty_struct * tty, int from_user, | |||
3651 | } /* raw_raw_write() */ | 3215 | } /* raw_raw_write() */ |
3652 | 3216 | ||
3653 | static int | 3217 | static int |
3654 | rs_write(struct tty_struct * tty, int from_user, | 3218 | rs_write(struct tty_struct *tty, |
3655 | const unsigned char *buf, int count) | 3219 | const unsigned char *buf, int count) |
3656 | { | 3220 | { |
3657 | #if defined(CONFIG_ETRAX_RS485) | 3221 | #if defined(CONFIG_ETRAX_RS485) |
@@ -3678,7 +3242,7 @@ rs_write(struct tty_struct * tty, int from_user, | |||
3678 | } | 3242 | } |
3679 | #endif /* CONFIG_ETRAX_RS485 */ | 3243 | #endif /* CONFIG_ETRAX_RS485 */ |
3680 | 3244 | ||
3681 | count = rs_raw_write(tty, from_user, buf, count); | 3245 | count = rs_raw_write(tty, buf, count); |
3682 | 3246 | ||
3683 | #if defined(CONFIG_ETRAX_RS485) | 3247 | #if defined(CONFIG_ETRAX_RS485) |
3684 | if (info->rs485.enabled) | 3248 | if (info->rs485.enabled) |
@@ -3746,10 +3310,9 @@ rs_flush_buffer(struct tty_struct *tty) | |||
3746 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | 3310 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
3747 | unsigned long flags; | 3311 | unsigned long flags; |
3748 | 3312 | ||
3749 | save_flags(flags); | 3313 | local_irq_save(flags); |
3750 | cli(); | ||
3751 | info->xmit.head = info->xmit.tail = 0; | 3314 | info->xmit.head = info->xmit.tail = 0; |
3752 | restore_flags(flags); | 3315 | local_irq_restore(flags); |
3753 | 3316 | ||
3754 | tty_wakeup(tty); | 3317 | tty_wakeup(tty); |
3755 | } | 3318 | } |
@@ -3767,7 +3330,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch) | |||
3767 | { | 3330 | { |
3768 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | 3331 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
3769 | unsigned long flags; | 3332 | unsigned long flags; |
3770 | save_flags(flags); cli(); | 3333 | local_irq_save(flags); |
3771 | if (info->uses_dma_out) { | 3334 | if (info->uses_dma_out) { |
3772 | /* Put the DMA on hold and disable the channel */ | 3335 | /* Put the DMA on hold and disable the channel */ |
3773 | *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, hold); | 3336 | *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, hold); |
@@ -3784,7 +3347,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch) | |||
3784 | DFLOW(DEBUG_LOG(info->line, "rs_send_xchar 0x%02X\n", ch)); | 3347 | DFLOW(DEBUG_LOG(info->line, "rs_send_xchar 0x%02X\n", ch)); |
3785 | info->x_char = ch; | 3348 | info->x_char = ch; |
3786 | e100_enable_serial_tx_ready_irq(info); | 3349 | e100_enable_serial_tx_ready_irq(info); |
3787 | restore_flags(flags); | 3350 | local_irq_restore(flags); |
3788 | } | 3351 | } |
3789 | 3352 | ||
3790 | /* | 3353 | /* |
@@ -3996,21 +3559,61 @@ char *get_control_state_str(int MLines, char *s) | |||
3996 | } | 3559 | } |
3997 | #endif | 3560 | #endif |
3998 | 3561 | ||
3562 | static void | ||
3563 | rs_break(struct tty_struct *tty, int break_state) | ||
3564 | { | ||
3565 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | ||
3566 | unsigned long flags; | ||
3567 | |||
3568 | if (!info->port) | ||
3569 | return; | ||
3570 | |||
3571 | local_irq_save(flags); | ||
3572 | if (break_state == -1) { | ||
3573 | /* Go to manual mode and set the txd pin to 0 */ | ||
3574 | /* Clear bit 7 (txd) and 6 (tr_enable) */ | ||
3575 | info->tx_ctrl &= 0x3F; | ||
3576 | } else { | ||
3577 | /* Set bit 7 (txd) and 6 (tr_enable) */ | ||
3578 | info->tx_ctrl |= (0x80 | 0x40); | ||
3579 | } | ||
3580 | info->port[REG_TR_CTRL] = info->tx_ctrl; | ||
3581 | local_irq_restore(flags); | ||
3582 | } | ||
3583 | |||
3999 | static int | 3584 | static int |
4000 | get_modem_info(struct e100_serial * info, unsigned int *value) | 3585 | rs_tiocmset(struct tty_struct *tty, struct file *file, |
3586 | unsigned int set, unsigned int clear) | ||
4001 | { | 3587 | { |
4002 | unsigned int result; | 3588 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
4003 | /* Polarity isn't verified */ | ||
4004 | #if 0 /*def SERIAL_DEBUG_IO */ | ||
4005 | 3589 | ||
4006 | printk("get_modem_info: RTS: %i DTR: %i CD: %i RI: %i DSR: %i CTS: %i\n", | 3590 | if (clear & TIOCM_RTS) |
4007 | E100_RTS_GET(info), | 3591 | e100_rts(info, 0); |
4008 | E100_DTR_GET(info), | 3592 | if (clear & TIOCM_DTR) |
4009 | E100_CD_GET(info), | 3593 | e100_dtr(info, 0); |
4010 | E100_RI_GET(info), | 3594 | /* Handle FEMALE behaviour */ |
4011 | E100_DSR_GET(info), | 3595 | if (clear & TIOCM_RI) |
4012 | E100_CTS_GET(info)); | 3596 | e100_ri_out(info, 0); |
4013 | #endif | 3597 | if (clear & TIOCM_CD) |
3598 | e100_cd_out(info, 0); | ||
3599 | |||
3600 | if (set & TIOCM_RTS) | ||
3601 | e100_rts(info, 1); | ||
3602 | if (set & TIOCM_DTR) | ||
3603 | e100_dtr(info, 1); | ||
3604 | /* Handle FEMALE behaviour */ | ||
3605 | if (set & TIOCM_RI) | ||
3606 | e100_ri_out(info, 1); | ||
3607 | if (set & TIOCM_CD) | ||
3608 | e100_cd_out(info, 1); | ||
3609 | return 0; | ||
3610 | } | ||
3611 | |||
3612 | static int | ||
3613 | rs_tiocmget(struct tty_struct *tty, struct file *file) | ||
3614 | { | ||
3615 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | ||
3616 | unsigned int result; | ||
4014 | 3617 | ||
4015 | result = | 3618 | result = |
4016 | (!E100_RTS_GET(info) ? TIOCM_RTS : 0) | 3619 | (!E100_RTS_GET(info) ? TIOCM_RTS : 0) |
@@ -4021,95 +3624,20 @@ get_modem_info(struct e100_serial * info, unsigned int *value) | |||
4021 | | (!E100_CTS_GET(info) ? TIOCM_CTS : 0); | 3624 | | (!E100_CTS_GET(info) ? TIOCM_CTS : 0); |
4022 | 3625 | ||
4023 | #ifdef SERIAL_DEBUG_IO | 3626 | #ifdef SERIAL_DEBUG_IO |
4024 | printk("e100ser: modem state: %i 0x%08X\n", result, result); | 3627 | printk(KERN_DEBUG "ser%i: modem state: %i 0x%08X\n", |
3628 | info->line, result, result); | ||
4025 | { | 3629 | { |
4026 | char s[100]; | 3630 | char s[100]; |
4027 | 3631 | ||
4028 | get_control_state_str(result, s); | 3632 | get_control_state_str(result, s); |
4029 | printk("state: %s\n", s); | 3633 | printk(KERN_DEBUG "state: %s\n", s); |
4030 | } | 3634 | } |
4031 | #endif | 3635 | #endif |
4032 | if (copy_to_user(value, &result, sizeof(int))) | 3636 | return result; |
4033 | return -EFAULT; | ||
4034 | return 0; | ||
4035 | } | ||
4036 | 3637 | ||
4037 | |||
4038 | static int | ||
4039 | set_modem_info(struct e100_serial * info, unsigned int cmd, | ||
4040 | unsigned int *value) | ||
4041 | { | ||
4042 | unsigned int arg; | ||
4043 | |||
4044 | if (copy_from_user(&arg, value, sizeof(int))) | ||
4045 | return -EFAULT; | ||
4046 | |||
4047 | switch (cmd) { | ||
4048 | case TIOCMBIS: | ||
4049 | if (arg & TIOCM_RTS) { | ||
4050 | e100_rts(info, 1); | ||
4051 | } | ||
4052 | if (arg & TIOCM_DTR) { | ||
4053 | e100_dtr(info, 1); | ||
4054 | } | ||
4055 | /* Handle FEMALE behaviour */ | ||
4056 | if (arg & TIOCM_RI) { | ||
4057 | e100_ri_out(info, 1); | ||
4058 | } | ||
4059 | if (arg & TIOCM_CD) { | ||
4060 | e100_cd_out(info, 1); | ||
4061 | } | ||
4062 | break; | ||
4063 | case TIOCMBIC: | ||
4064 | if (arg & TIOCM_RTS) { | ||
4065 | e100_rts(info, 0); | ||
4066 | } | ||
4067 | if (arg & TIOCM_DTR) { | ||
4068 | e100_dtr(info, 0); | ||
4069 | } | ||
4070 | /* Handle FEMALE behaviour */ | ||
4071 | if (arg & TIOCM_RI) { | ||
4072 | e100_ri_out(info, 0); | ||
4073 | } | ||
4074 | if (arg & TIOCM_CD) { | ||
4075 | e100_cd_out(info, 0); | ||
4076 | } | ||
4077 | break; | ||
4078 | case TIOCMSET: | ||
4079 | e100_rts(info, arg & TIOCM_RTS); | ||
4080 | e100_dtr(info, arg & TIOCM_DTR); | ||
4081 | /* Handle FEMALE behaviour */ | ||
4082 | e100_ri_out(info, arg & TIOCM_RI); | ||
4083 | e100_cd_out(info, arg & TIOCM_CD); | ||
4084 | break; | ||
4085 | default: | ||
4086 | return -EINVAL; | ||
4087 | } | ||
4088 | return 0; | ||
4089 | } | 3638 | } |
4090 | 3639 | ||
4091 | 3640 | ||
4092 | static void | ||
4093 | rs_break(struct tty_struct *tty, int break_state) | ||
4094 | { | ||
4095 | struct e100_serial * info = (struct e100_serial *)tty->driver_data; | ||
4096 | unsigned long flags; | ||
4097 | |||
4098 | if (!info->port) | ||
4099 | return; | ||
4100 | |||
4101 | save_flags(flags); | ||
4102 | cli(); | ||
4103 | if (break_state == -1) { | ||
4104 | /* Go to manual mode and set the txd pin to 0 */ | ||
4105 | info->tx_ctrl &= 0x3F; /* Clear bit 7 (txd) and 6 (tr_enable) */ | ||
4106 | } else { | ||
4107 | info->tx_ctrl |= (0x80 | 0x40); /* Set bit 7 (txd) and 6 (tr_enable) */ | ||
4108 | } | ||
4109 | info->port[REG_TR_CTRL] = info->tx_ctrl; | ||
4110 | restore_flags(flags); | ||
4111 | } | ||
4112 | |||
4113 | static int | 3641 | static int |
4114 | rs_ioctl(struct tty_struct *tty, struct file * file, | 3642 | rs_ioctl(struct tty_struct *tty, struct file * file, |
4115 | unsigned int cmd, unsigned long arg) | 3643 | unsigned int cmd, unsigned long arg) |
@@ -4124,49 +3652,45 @@ rs_ioctl(struct tty_struct *tty, struct file * file, | |||
4124 | } | 3652 | } |
4125 | 3653 | ||
4126 | switch (cmd) { | 3654 | switch (cmd) { |
4127 | case TIOCMGET: | 3655 | case TIOCGSERIAL: |
4128 | return get_modem_info(info, (unsigned int *) arg); | 3656 | return get_serial_info(info, |
4129 | case TIOCMBIS: | 3657 | (struct serial_struct *) arg); |
4130 | case TIOCMBIC: | 3658 | case TIOCSSERIAL: |
4131 | case TIOCMSET: | 3659 | return set_serial_info(info, |
4132 | return set_modem_info(info, cmd, (unsigned int *) arg); | 3660 | (struct serial_struct *) arg); |
4133 | case TIOCGSERIAL: | 3661 | case TIOCSERGETLSR: /* Get line status register */ |
4134 | return get_serial_info(info, | 3662 | return get_lsr_info(info, (unsigned int *) arg); |
4135 | (struct serial_struct *) arg); | 3663 | |
4136 | case TIOCSSERIAL: | 3664 | case TIOCSERGSTRUCT: |
4137 | return set_serial_info(info, | 3665 | if (copy_to_user((struct e100_serial *) arg, |
4138 | (struct serial_struct *) arg); | 3666 | info, sizeof(struct e100_serial))) |
4139 | case TIOCSERGETLSR: /* Get line status register */ | 3667 | return -EFAULT; |
4140 | return get_lsr_info(info, (unsigned int *) arg); | 3668 | return 0; |
4141 | |||
4142 | case TIOCSERGSTRUCT: | ||
4143 | if (copy_to_user((struct e100_serial *) arg, | ||
4144 | info, sizeof(struct e100_serial))) | ||
4145 | return -EFAULT; | ||
4146 | return 0; | ||
4147 | 3669 | ||
4148 | #if defined(CONFIG_ETRAX_RS485) | 3670 | #if defined(CONFIG_ETRAX_RS485) |
4149 | case TIOCSERSETRS485: | 3671 | case TIOCSERSETRS485: |
4150 | { | 3672 | { |
4151 | struct rs485_control rs485ctrl; | 3673 | struct rs485_control rs485ctrl; |
4152 | if (copy_from_user(&rs485ctrl, (struct rs485_control*)arg, sizeof(rs485ctrl))) | 3674 | if (copy_from_user(&rs485ctrl, (struct rs485_control *)arg, |
4153 | return -EFAULT; | 3675 | sizeof(rs485ctrl))) |
3676 | return -EFAULT; | ||
4154 | 3677 | ||
4155 | return e100_enable_rs485(tty, &rs485ctrl); | 3678 | return e100_enable_rs485(tty, &rs485ctrl); |
4156 | } | 3679 | } |
4157 | 3680 | ||
4158 | case TIOCSERWRRS485: | 3681 | case TIOCSERWRRS485: |
4159 | { | 3682 | { |
4160 | struct rs485_write rs485wr; | 3683 | struct rs485_write rs485wr; |
4161 | if (copy_from_user(&rs485wr, (struct rs485_write*)arg, sizeof(rs485wr))) | 3684 | if (copy_from_user(&rs485wr, (struct rs485_write *)arg, |
4162 | return -EFAULT; | 3685 | sizeof(rs485wr))) |
3686 | return -EFAULT; | ||
4163 | 3687 | ||
4164 | return e100_write_rs485(tty, 1, rs485wr.outc, rs485wr.outc_size); | 3688 | return e100_write_rs485(tty, rs485wr.outc, rs485wr.outc_size); |
4165 | } | 3689 | } |
4166 | #endif | 3690 | #endif |
4167 | 3691 | ||
4168 | default: | 3692 | default: |
4169 | return -ENOIOCTLCMD; | 3693 | return -ENOIOCTLCMD; |
4170 | } | 3694 | } |
4171 | return 0; | 3695 | return 0; |
4172 | } | 3696 | } |
@@ -4191,46 +3715,6 @@ rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
4191 | 3715 | ||
4192 | } | 3716 | } |
4193 | 3717 | ||
4194 | /* In debugport.c - register a console write function that uses the normal | ||
4195 | * serial driver | ||
4196 | */ | ||
4197 | typedef int (*debugport_write_function)(int i, const char *buf, unsigned int len); | ||
4198 | |||
4199 | extern debugport_write_function debug_write_function; | ||
4200 | |||
4201 | static int rs_debug_write_function(int i, const char *buf, unsigned int len) | ||
4202 | { | ||
4203 | int cnt; | ||
4204 | int written = 0; | ||
4205 | struct tty_struct *tty; | ||
4206 | static int recurse_cnt = 0; | ||
4207 | |||
4208 | tty = rs_table[i].tty; | ||
4209 | if (tty) { | ||
4210 | unsigned long flags; | ||
4211 | if (recurse_cnt > 5) /* We skip this debug output */ | ||
4212 | return 1; | ||
4213 | |||
4214 | local_irq_save(flags); | ||
4215 | recurse_cnt++; | ||
4216 | local_irq_restore(flags); | ||
4217 | do { | ||
4218 | cnt = rs_write(tty, 0, buf + written, len); | ||
4219 | if (cnt >= 0) { | ||
4220 | written += cnt; | ||
4221 | buf += cnt; | ||
4222 | len -= cnt; | ||
4223 | } else | ||
4224 | len = cnt; | ||
4225 | } while(len > 0); | ||
4226 | local_irq_save(flags); | ||
4227 | recurse_cnt--; | ||
4228 | local_irq_restore(flags); | ||
4229 | return 1; | ||
4230 | } | ||
4231 | return 0; | ||
4232 | } | ||
4233 | |||
4234 | /* | 3718 | /* |
4235 | * ------------------------------------------------------------ | 3719 | * ------------------------------------------------------------ |
4236 | * rs_close() | 3720 | * rs_close() |
@@ -4252,11 +3736,10 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
4252 | 3736 | ||
4253 | /* interrupts are disabled for this entire function */ | 3737 | /* interrupts are disabled for this entire function */ |
4254 | 3738 | ||
4255 | save_flags(flags); | 3739 | local_irq_save(flags); |
4256 | cli(); | ||
4257 | 3740 | ||
4258 | if (tty_hung_up_p(filp)) { | 3741 | if (tty_hung_up_p(filp)) { |
4259 | restore_flags(flags); | 3742 | local_irq_restore(flags); |
4260 | return; | 3743 | return; |
4261 | } | 3744 | } |
4262 | 3745 | ||
@@ -4283,7 +3766,7 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
4283 | info->count = 0; | 3766 | info->count = 0; |
4284 | } | 3767 | } |
4285 | if (info->count) { | 3768 | if (info->count) { |
4286 | restore_flags(flags); | 3769 | local_irq_restore(flags); |
4287 | return; | 3770 | return; |
4288 | } | 3771 | } |
4289 | info->flags |= ASYNC_CLOSING; | 3772 | info->flags |= ASYNC_CLOSING; |
@@ -4337,7 +3820,7 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
4337 | } | 3820 | } |
4338 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 3821 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
4339 | wake_up_interruptible(&info->close_wait); | 3822 | wake_up_interruptible(&info->close_wait); |
4340 | restore_flags(flags); | 3823 | local_irq_restore(flags); |
4341 | 3824 | ||
4342 | /* port closed */ | 3825 | /* port closed */ |
4343 | 3826 | ||
@@ -4359,6 +3842,28 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
4359 | #endif | 3842 | #endif |
4360 | } | 3843 | } |
4361 | #endif | 3844 | #endif |
3845 | |||
3846 | /* | ||
3847 | * Release any allocated DMA irq's. | ||
3848 | */ | ||
3849 | if (info->dma_in_enabled) { | ||
3850 | free_irq(info->dma_in_irq_nbr, info); | ||
3851 | cris_free_dma(info->dma_in_nbr, info->dma_in_irq_description); | ||
3852 | info->uses_dma_in = 0; | ||
3853 | #ifdef SERIAL_DEBUG_OPEN | ||
3854 | printk(KERN_DEBUG "DMA irq '%s' freed\n", | ||
3855 | info->dma_in_irq_description); | ||
3856 | #endif | ||
3857 | } | ||
3858 | if (info->dma_out_enabled) { | ||
3859 | free_irq(info->dma_out_irq_nbr, info); | ||
3860 | cris_free_dma(info->dma_out_nbr, info->dma_out_irq_description); | ||
3861 | info->uses_dma_out = 0; | ||
3862 | #ifdef SERIAL_DEBUG_OPEN | ||
3863 | printk(KERN_DEBUG "DMA irq '%s' freed\n", | ||
3864 | info->dma_out_irq_description); | ||
3865 | #endif | ||
3866 | } | ||
4362 | } | 3867 | } |
4363 | 3868 | ||
4364 | /* | 3869 | /* |
@@ -4433,8 +3938,8 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
4433 | */ | 3938 | */ |
4434 | if (tty_hung_up_p(filp) || | 3939 | if (tty_hung_up_p(filp) || |
4435 | (info->flags & ASYNC_CLOSING)) { | 3940 | (info->flags & ASYNC_CLOSING)) { |
4436 | if (info->flags & ASYNC_CLOSING) | 3941 | wait_event_interruptible(info->close_wait, |
4437 | interruptible_sleep_on(&info->close_wait); | 3942 | !(info->flags & ASYNC_CLOSING)); |
4438 | #ifdef SERIAL_DO_RESTART | 3943 | #ifdef SERIAL_DO_RESTART |
4439 | if (info->flags & ASYNC_HUP_NOTIFY) | 3944 | if (info->flags & ASYNC_HUP_NOTIFY) |
4440 | return -EAGAIN; | 3945 | return -EAGAIN; |
@@ -4472,21 +3977,19 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
4472 | printk("block_til_ready before block: ttyS%d, count = %d\n", | 3977 | printk("block_til_ready before block: ttyS%d, count = %d\n", |
4473 | info->line, info->count); | 3978 | info->line, info->count); |
4474 | #endif | 3979 | #endif |
4475 | save_flags(flags); | 3980 | local_irq_save(flags); |
4476 | cli(); | ||
4477 | if (!tty_hung_up_p(filp)) { | 3981 | if (!tty_hung_up_p(filp)) { |
4478 | extra_count++; | 3982 | extra_count++; |
4479 | info->count--; | 3983 | info->count--; |
4480 | } | 3984 | } |
4481 | restore_flags(flags); | 3985 | local_irq_restore(flags); |
4482 | info->blocked_open++; | 3986 | info->blocked_open++; |
4483 | while (1) { | 3987 | while (1) { |
4484 | save_flags(flags); | 3988 | local_irq_save(flags); |
4485 | cli(); | ||
4486 | /* assert RTS and DTR */ | 3989 | /* assert RTS and DTR */ |
4487 | e100_rts(info, 1); | 3990 | e100_rts(info, 1); |
4488 | e100_dtr(info, 1); | 3991 | e100_dtr(info, 1); |
4489 | restore_flags(flags); | 3992 | local_irq_restore(flags); |
4490 | set_current_state(TASK_INTERRUPTIBLE); | 3993 | set_current_state(TASK_INTERRUPTIBLE); |
4491 | if (tty_hung_up_p(filp) || | 3994 | if (tty_hung_up_p(filp) || |
4492 | !(info->flags & ASYNC_INITIALIZED)) { | 3995 | !(info->flags & ASYNC_INITIALIZED)) { |
@@ -4528,6 +4031,19 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
4528 | return 0; | 4031 | return 0; |
4529 | } | 4032 | } |
4530 | 4033 | ||
4034 | static void | ||
4035 | deinit_port(struct e100_serial *info) | ||
4036 | { | ||
4037 | if (info->dma_out_enabled) { | ||
4038 | cris_free_dma(info->dma_out_nbr, info->dma_out_irq_description); | ||
4039 | free_irq(info->dma_out_irq_nbr, info); | ||
4040 | } | ||
4041 | if (info->dma_in_enabled) { | ||
4042 | cris_free_dma(info->dma_in_nbr, info->dma_in_irq_description); | ||
4043 | free_irq(info->dma_in_irq_nbr, info); | ||
4044 | } | ||
4045 | } | ||
4046 | |||
4531 | /* | 4047 | /* |
4532 | * This routine is called whenever a serial port is opened. | 4048 | * This routine is called whenever a serial port is opened. |
4533 | * It performs the serial-specific initialization for the tty structure. | 4049 | * It performs the serial-specific initialization for the tty structure. |
@@ -4538,9 +4054,9 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4538 | struct e100_serial *info; | 4054 | struct e100_serial *info; |
4539 | int retval, line; | 4055 | int retval, line; |
4540 | unsigned long page; | 4056 | unsigned long page; |
4057 | int allocated_resources = 0; | ||
4541 | 4058 | ||
4542 | /* find which port we want to open */ | 4059 | /* find which port we want to open */ |
4543 | |||
4544 | line = tty->index; | 4060 | line = tty->index; |
4545 | 4061 | ||
4546 | if (line < 0 || line >= NR_PORTS) | 4062 | if (line < 0 || line >= NR_PORTS) |
@@ -4580,8 +4096,8 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4580 | */ | 4096 | */ |
4581 | if (tty_hung_up_p(filp) || | 4097 | if (tty_hung_up_p(filp) || |
4582 | (info->flags & ASYNC_CLOSING)) { | 4098 | (info->flags & ASYNC_CLOSING)) { |
4583 | if (info->flags & ASYNC_CLOSING) | 4099 | wait_event_interruptible(info->close_wait, |
4584 | interruptible_sleep_on(&info->close_wait); | 4100 | !(info->flags & ASYNC_CLOSING)); |
4585 | #ifdef SERIAL_DO_RESTART | 4101 | #ifdef SERIAL_DO_RESTART |
4586 | return ((info->flags & ASYNC_HUP_NOTIFY) ? | 4102 | return ((info->flags & ASYNC_HUP_NOTIFY) ? |
4587 | -EAGAIN : -ERESTARTSYS); | 4103 | -EAGAIN : -ERESTARTSYS); |
@@ -4591,12 +4107,85 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4591 | } | 4107 | } |
4592 | 4108 | ||
4593 | /* | 4109 | /* |
4110 | * If DMA is enabled try to allocate the irq's. | ||
4111 | */ | ||
4112 | if (info->count == 1) { | ||
4113 | allocated_resources = 1; | ||
4114 | if (info->dma_in_enabled) { | ||
4115 | if (request_irq(info->dma_in_irq_nbr, | ||
4116 | rec_interrupt, | ||
4117 | info->dma_in_irq_flags, | ||
4118 | info->dma_in_irq_description, | ||
4119 | info)) { | ||
4120 | printk(KERN_WARNING "DMA irq '%s' busy; " | ||
4121 | "falling back to non-DMA mode\n", | ||
4122 | info->dma_in_irq_description); | ||
4123 | /* Make sure we never try to use DMA in */ | ||
4124 | /* for the port again. */ | ||
4125 | info->dma_in_enabled = 0; | ||
4126 | } else if (cris_request_dma(info->dma_in_nbr, | ||
4127 | info->dma_in_irq_description, | ||
4128 | DMA_VERBOSE_ON_ERROR, | ||
4129 | info->dma_owner)) { | ||
4130 | free_irq(info->dma_in_irq_nbr, info); | ||
4131 | printk(KERN_WARNING "DMA '%s' busy; " | ||
4132 | "falling back to non-DMA mode\n", | ||
4133 | info->dma_in_irq_description); | ||
4134 | /* Make sure we never try to use DMA in */ | ||
4135 | /* for the port again. */ | ||
4136 | info->dma_in_enabled = 0; | ||
4137 | } | ||
4138 | #ifdef SERIAL_DEBUG_OPEN | ||
4139 | else | ||
4140 | printk(KERN_DEBUG "DMA irq '%s' allocated\n", | ||
4141 | info->dma_in_irq_description); | ||
4142 | #endif | ||
4143 | } | ||
4144 | if (info->dma_out_enabled) { | ||
4145 | if (request_irq(info->dma_out_irq_nbr, | ||
4146 | tr_interrupt, | ||
4147 | info->dma_out_irq_flags, | ||
4148 | info->dma_out_irq_description, | ||
4149 | info)) { | ||
4150 | printk(KERN_WARNING "DMA irq '%s' busy; " | ||
4151 | "falling back to non-DMA mode\n", | ||
4152 | info->dma_out_irq_description); | ||
4153 | /* Make sure we never try to use DMA out */ | ||
4154 | /* for the port again. */ | ||
4155 | info->dma_out_enabled = 0; | ||
4156 | } else if (cris_request_dma(info->dma_out_nbr, | ||
4157 | info->dma_out_irq_description, | ||
4158 | DMA_VERBOSE_ON_ERROR, | ||
4159 | info->dma_owner)) { | ||
4160 | free_irq(info->dma_out_irq_nbr, info); | ||
4161 | printk(KERN_WARNING "DMA '%s' busy; " | ||
4162 | "falling back to non-DMA mode\n", | ||
4163 | info->dma_out_irq_description); | ||
4164 | /* Make sure we never try to use DMA out */ | ||
4165 | /* for the port again. */ | ||
4166 | info->dma_out_enabled = 0; | ||
4167 | } | ||
4168 | #ifdef SERIAL_DEBUG_OPEN | ||
4169 | else | ||
4170 | printk(KERN_DEBUG "DMA irq '%s' allocated\n", | ||
4171 | info->dma_out_irq_description); | ||
4172 | #endif | ||
4173 | } | ||
4174 | } | ||
4175 | |||
4176 | /* | ||
4594 | * Start up the serial port | 4177 | * Start up the serial port |
4595 | */ | 4178 | */ |
4596 | 4179 | ||
4597 | retval = startup(info); | 4180 | retval = startup(info); |
4598 | if (retval) | 4181 | if (retval) { |
4182 | if (allocated_resources) | ||
4183 | deinit_port(info); | ||
4184 | |||
4185 | /* FIXME Decrease count info->count here too? */ | ||
4599 | return retval; | 4186 | return retval; |
4187 | } | ||
4188 | |||
4600 | 4189 | ||
4601 | retval = block_til_ready(tty, filp, info); | 4190 | retval = block_til_ready(tty, filp, info); |
4602 | if (retval) { | 4191 | if (retval) { |
@@ -4604,6 +4193,9 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4604 | printk("rs_open returning after block_til_ready with %d\n", | 4193 | printk("rs_open returning after block_til_ready with %d\n", |
4605 | retval); | 4194 | retval); |
4606 | #endif | 4195 | #endif |
4196 | if (allocated_resources) | ||
4197 | deinit_port(info); | ||
4198 | |||
4607 | return retval; | 4199 | return retval; |
4608 | } | 4200 | } |
4609 | 4201 | ||
@@ -4793,6 +4385,8 @@ static const struct tty_operations rs_ops = { | |||
4793 | .send_xchar = rs_send_xchar, | 4385 | .send_xchar = rs_send_xchar, |
4794 | .wait_until_sent = rs_wait_until_sent, | 4386 | .wait_until_sent = rs_wait_until_sent, |
4795 | .read_proc = rs_read_proc, | 4387 | .read_proc = rs_read_proc, |
4388 | .tiocmget = rs_tiocmget, | ||
4389 | .tiocmset = rs_tiocmset | ||
4796 | }; | 4390 | }; |
4797 | 4391 | ||
4798 | static int __init | 4392 | static int __init |
@@ -4810,9 +4404,27 @@ rs_init(void) | |||
4810 | /* Setup the timed flush handler system */ | 4404 | /* Setup the timed flush handler system */ |
4811 | 4405 | ||
4812 | #if !defined(CONFIG_ETRAX_SERIAL_FAST_TIMER) | 4406 | #if !defined(CONFIG_ETRAX_SERIAL_FAST_TIMER) |
4813 | init_timer(&flush_timer); | 4407 | setup_timer(&flush_timer, timed_flush_handler, 0); |
4814 | flush_timer.function = timed_flush_handler; | 4408 | mod_timer(&flush_timer, jiffies + 5); |
4815 | mod_timer(&flush_timer, jiffies + CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS); | 4409 | #endif |
4410 | |||
4411 | #if defined(CONFIG_ETRAX_RS485) | ||
4412 | #if defined(CONFIG_ETRAX_RS485_ON_PA) | ||
4413 | if (cris_io_interface_allocate_pins(if_ser0, 'a', rs485_pa_bit, | ||
4414 | rs485_pa_bit)) { | ||
4415 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " | ||
4416 | "RS485 pin\n"); | ||
4417 | return -EBUSY; | ||
4418 | } | ||
4419 | #endif | ||
4420 | #if defined(CONFIG_ETRAX_RS485_ON_PORT_G) | ||
4421 | if (cris_io_interface_allocate_pins(if_ser0, 'g', rs485_pa_bit, | ||
4422 | rs485_port_g_bit)) { | ||
4423 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " | ||
4424 | "RS485 pin\n"); | ||
4425 | return -EBUSY; | ||
4426 | } | ||
4427 | #endif | ||
4816 | #endif | 4428 | #endif |
4817 | 4429 | ||
4818 | /* Initialize the tty_driver structure */ | 4430 | /* Initialize the tty_driver structure */ |
@@ -4839,6 +4451,16 @@ rs_init(void) | |||
4839 | /* do some initializing for the separate ports */ | 4451 | /* do some initializing for the separate ports */ |
4840 | 4452 | ||
4841 | for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) { | 4453 | for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) { |
4454 | if (info->enabled) { | ||
4455 | if (cris_request_io_interface(info->io_if, | ||
4456 | info->io_if_description)) { | ||
4457 | printk(KERN_CRIT "ETRAX100LX async serial: " | ||
4458 | "Could not allocate IO pins for " | ||
4459 | "%s, port %d\n", | ||
4460 | info->io_if_description, i); | ||
4461 | info->enabled = 0; | ||
4462 | } | ||
4463 | } | ||
4842 | info->uses_dma_in = 0; | 4464 | info->uses_dma_in = 0; |
4843 | info->uses_dma_out = 0; | 4465 | info->uses_dma_out = 0; |
4844 | info->line = i; | 4466 | info->line = i; |
@@ -4872,7 +4494,7 @@ rs_init(void) | |||
4872 | info->rs485.delay_rts_before_send = 0; | 4494 | info->rs485.delay_rts_before_send = 0; |
4873 | info->rs485.enabled = 0; | 4495 | info->rs485.enabled = 0; |
4874 | #endif | 4496 | #endif |
4875 | INIT_WORK(&info->work, do_softint, info); | 4497 | INIT_WORK(&info->work, do_softint); |
4876 | 4498 | ||
4877 | if (info->enabled) { | 4499 | if (info->enabled) { |
4878 | printk(KERN_INFO "%s%d at 0x%x is a builtin UART with DMA\n", | 4500 | printk(KERN_INFO "%s%d at 0x%x is a builtin UART with DMA\n", |
@@ -4890,64 +4512,17 @@ rs_init(void) | |||
4890 | #endif | 4512 | #endif |
4891 | 4513 | ||
4892 | #ifndef CONFIG_SVINTO_SIM | 4514 | #ifndef CONFIG_SVINTO_SIM |
4515 | #ifndef CONFIG_ETRAX_KGDB | ||
4893 | /* Not needed in simulator. May only complicate stuff. */ | 4516 | /* Not needed in simulator. May only complicate stuff. */ |
4894 | /* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */ | 4517 | /* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */ |
4895 | 4518 | ||
4896 | if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial ", NULL)) | 4519 | if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, |
4897 | panic("irq8"); | 4520 | IRQF_SHARED | IRQF_DISABLED, "serial ", driver)) |
4898 | 4521 | panic("%s: Failed to request irq8", __FUNCTION__); | |
4899 | #ifdef CONFIG_ETRAX_SERIAL_PORT0 | ||
4900 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT | ||
4901 | if (request_irq(SER0_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_DISABLED, "serial 0 dma tr", NULL)) | ||
4902 | panic("irq22"); | ||
4903 | #endif | ||
4904 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN | ||
4905 | if (request_irq(SER0_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_DISABLED, "serial 0 dma rec", NULL)) | ||
4906 | panic("irq23"); | ||
4907 | #endif | ||
4908 | #endif | ||
4909 | |||
4910 | #ifdef CONFIG_ETRAX_SERIAL_PORT1 | ||
4911 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT | ||
4912 | if (request_irq(SER1_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_DISABLED, "serial 1 dma tr", NULL)) | ||
4913 | panic("irq24"); | ||
4914 | #endif | ||
4915 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN | ||
4916 | if (request_irq(SER1_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_DISABLED, "serial 1 dma rec", NULL)) | ||
4917 | panic("irq25"); | ||
4918 | #endif | ||
4919 | #endif | ||
4920 | #ifdef CONFIG_ETRAX_SERIAL_PORT2 | ||
4921 | /* DMA Shared with par0 (and SCSI0 and ATA) */ | ||
4922 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT | ||
4923 | if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 2 dma tr", NULL)) | ||
4924 | panic("irq18"); | ||
4925 | #endif | ||
4926 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN | ||
4927 | if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 2 dma rec", NULL)) | ||
4928 | panic("irq19"); | ||
4929 | #endif | ||
4930 | #endif | ||
4931 | #ifdef CONFIG_ETRAX_SERIAL_PORT3 | ||
4932 | /* DMA Shared with par1 (and SCSI1 and Extern DMA 0) */ | ||
4933 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT | ||
4934 | if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 3 dma tr", NULL)) | ||
4935 | panic("irq20"); | ||
4936 | #endif | ||
4937 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN | ||
4938 | if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 3 dma rec", NULL)) | ||
4939 | panic("irq21"); | ||
4940 | #endif | ||
4941 | #endif | ||
4942 | 4522 | ||
4943 | #ifdef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST | ||
4944 | if (request_irq(TIMER1_IRQ_NBR, timeout_interrupt, IRQF_SHARED | IRQF_DISABLED, | ||
4945 | "fast serial dma timeout", NULL)) { | ||
4946 | printk(KERN_CRIT "err: timer1 irq\n"); | ||
4947 | } | ||
4948 | #endif | 4523 | #endif |
4949 | #endif /* CONFIG_SVINTO_SIM */ | 4524 | #endif /* CONFIG_SVINTO_SIM */ |
4950 | debug_write_function = rs_debug_write_function; | 4525 | |
4951 | return 0; | 4526 | return 0; |
4952 | } | 4527 | } |
4953 | 4528 | ||
diff --git a/drivers/serial/crisv10.h b/drivers/serial/crisv10.h new file mode 100644 index 000000000000..ccd0f32b7372 --- /dev/null +++ b/drivers/serial/crisv10.h | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | * serial.h: Arch-dep definitions for the Etrax100 serial driver. | ||
3 | * | ||
4 | * Copyright (C) 1998-2007 Axis Communications AB | ||
5 | */ | ||
6 | |||
7 | #ifndef _ETRAX_SERIAL_H | ||
8 | #define _ETRAX_SERIAL_H | ||
9 | |||
10 | #include <linux/circ_buf.h> | ||
11 | #include <asm/termios.h> | ||
12 | #include <asm/dma.h> | ||
13 | #include <asm/arch/io_interface_mux.h> | ||
14 | |||
15 | /* Software state per channel */ | ||
16 | |||
17 | #ifdef __KERNEL__ | ||
18 | /* | ||
19 | * This is our internal structure for each serial port's state. | ||
20 | * | ||
21 | * Many fields are paralleled by the structure used by the serial_struct | ||
22 | * structure. | ||
23 | * | ||
24 | * For definitions of the flags field, see tty.h | ||
25 | */ | ||
26 | |||
27 | #define SERIAL_RECV_DESCRIPTORS 8 | ||
28 | |||
29 | struct etrax_recv_buffer { | ||
30 | struct etrax_recv_buffer *next; | ||
31 | unsigned short length; | ||
32 | unsigned char error; | ||
33 | unsigned char pad; | ||
34 | |||
35 | unsigned char buffer[0]; | ||
36 | }; | ||
37 | |||
38 | struct e100_serial { | ||
39 | int baud; | ||
40 | volatile u8 *port; /* R_SERIALx_CTRL */ | ||
41 | u32 irq; /* bitnr in R_IRQ_MASK2 for dmaX_descr */ | ||
42 | |||
43 | /* Output registers */ | ||
44 | volatile u8 *oclrintradr; /* adr to R_DMA_CHx_CLR_INTR */ | ||
45 | volatile u32 *ofirstadr; /* adr to R_DMA_CHx_FIRST */ | ||
46 | volatile u8 *ocmdadr; /* adr to R_DMA_CHx_CMD */ | ||
47 | const volatile u8 *ostatusadr; /* adr to R_DMA_CHx_STATUS */ | ||
48 | |||
49 | /* Input registers */ | ||
50 | volatile u8 *iclrintradr; /* adr to R_DMA_CHx_CLR_INTR */ | ||
51 | volatile u32 *ifirstadr; /* adr to R_DMA_CHx_FIRST */ | ||
52 | volatile u8 *icmdadr; /* adr to R_DMA_CHx_CMD */ | ||
53 | volatile u32 *idescradr; /* adr to R_DMA_CHx_DESCR */ | ||
54 | |||
55 | int flags; /* defined in tty.h */ | ||
56 | |||
57 | u8 rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */ | ||
58 | u8 tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */ | ||
59 | u8 iseteop; /* bit number for R_SET_EOP for the input dma */ | ||
60 | int enabled; /* Set to 1 if the port is enabled in HW config */ | ||
61 | |||
62 | u8 dma_out_enabled; /* Set to 1 if DMA should be used */ | ||
63 | u8 dma_in_enabled; /* Set to 1 if DMA should be used */ | ||
64 | |||
65 | /* end of fields defined in rs_table[] in .c-file */ | ||
66 | int dma_owner; | ||
67 | unsigned int dma_in_nbr; | ||
68 | unsigned int dma_out_nbr; | ||
69 | unsigned int dma_in_irq_nbr; | ||
70 | unsigned int dma_out_irq_nbr; | ||
71 | unsigned long dma_in_irq_flags; | ||
72 | unsigned long dma_out_irq_flags; | ||
73 | char *dma_in_irq_description; | ||
74 | char *dma_out_irq_description; | ||
75 | |||
76 | enum cris_io_interface io_if; | ||
77 | char *io_if_description; | ||
78 | |||
79 | u8 uses_dma_in; /* Set to 1 if DMA is used */ | ||
80 | u8 uses_dma_out; /* Set to 1 if DMA is used */ | ||
81 | u8 forced_eop; /* a fifo eop has been forced */ | ||
82 | int baud_base; /* For special baudrates */ | ||
83 | int custom_divisor; /* For special baudrates */ | ||
84 | struct etrax_dma_descr tr_descr; | ||
85 | struct etrax_dma_descr rec_descr[SERIAL_RECV_DESCRIPTORS]; | ||
86 | int cur_rec_descr; | ||
87 | |||
88 | volatile int tr_running; /* 1 if output is running */ | ||
89 | |||
90 | struct tty_struct *tty; | ||
91 | int read_status_mask; | ||
92 | int ignore_status_mask; | ||
93 | int x_char; /* xon/xoff character */ | ||
94 | int close_delay; | ||
95 | unsigned short closing_wait; | ||
96 | unsigned short closing_wait2; | ||
97 | unsigned long event; | ||
98 | unsigned long last_active; | ||
99 | int line; | ||
100 | int type; /* PORT_ETRAX */ | ||
101 | int count; /* # of fd on device */ | ||
102 | int blocked_open; /* # of blocked opens */ | ||
103 | struct circ_buf xmit; | ||
104 | struct etrax_recv_buffer *first_recv_buffer; | ||
105 | struct etrax_recv_buffer *last_recv_buffer; | ||
106 | unsigned int recv_cnt; | ||
107 | unsigned int max_recv_cnt; | ||
108 | |||
109 | struct work_struct work; | ||
110 | struct async_icount icount; /* error-statistics etc.*/ | ||
111 | struct ktermios normal_termios; | ||
112 | struct ktermios callout_termios; | ||
113 | wait_queue_head_t open_wait; | ||
114 | wait_queue_head_t close_wait; | ||
115 | |||
116 | unsigned long char_time_usec; /* The time for 1 char, in usecs */ | ||
117 | unsigned long flush_time_usec; /* How often we should flush */ | ||
118 | unsigned long last_tx_active_usec; /* Last tx usec in the jiffies */ | ||
119 | unsigned long last_tx_active; /* Last tx time in jiffies */ | ||
120 | unsigned long last_rx_active_usec; /* Last rx usec in the jiffies */ | ||
121 | unsigned long last_rx_active; /* Last rx time in jiffies */ | ||
122 | |||
123 | int break_detected_cnt; | ||
124 | int errorcode; | ||
125 | |||
126 | #ifdef CONFIG_ETRAX_RS485 | ||
127 | struct rs485_control rs485; /* RS-485 support */ | ||
128 | #endif | ||
129 | }; | ||
130 | |||
131 | /* this PORT is not in the standard serial.h. it's not actually used for | ||
132 | * anything since we only have one type of async serial-port anyway in this | ||
133 | * system. | ||
134 | */ | ||
135 | |||
136 | #define PORT_ETRAX 1 | ||
137 | |||
138 | /* | ||
139 | * Events are used to schedule things to happen at timer-interrupt | ||
140 | * time, instead of at rs interrupt time. | ||
141 | */ | ||
142 | #define RS_EVENT_WRITE_WAKEUP 0 | ||
143 | |||
144 | #endif /* __KERNEL__ */ | ||
145 | |||
146 | #endif /* !_ETRAX_SERIAL_H */ | ||
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 89769ce16f88..b31f4431849b 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -457,10 +457,11 @@ done: | |||
457 | EXPORT_SYMBOL_GPL(spi_register_master); | 457 | EXPORT_SYMBOL_GPL(spi_register_master); |
458 | 458 | ||
459 | 459 | ||
460 | static int __unregister(struct device *dev, void *unused) | 460 | static int __unregister(struct device *dev, void *master_dev) |
461 | { | 461 | { |
462 | /* note: before about 2.6.14-rc1 this would corrupt memory: */ | 462 | /* note: before about 2.6.14-rc1 this would corrupt memory: */ |
463 | spi_unregister_device(to_spi_device(dev)); | 463 | if (dev != master_dev) |
464 | spi_unregister_device(to_spi_device(dev)); | ||
464 | return 0; | 465 | return 0; |
465 | } | 466 | } |
466 | 467 | ||
@@ -478,7 +479,8 @@ void spi_unregister_master(struct spi_master *master) | |||
478 | { | 479 | { |
479 | int dummy; | 480 | int dummy; |
480 | 481 | ||
481 | dummy = device_for_each_child(master->dev.parent, NULL, __unregister); | 482 | dummy = device_for_each_child(master->dev.parent, &master->dev, |
483 | __unregister); | ||
482 | device_unregister(&master->dev); | 484 | device_unregister(&master->dev); |
483 | } | 485 | } |
484 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 486 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
diff --git a/drivers/spi/spi_txx9.c b/drivers/spi/spi_txx9.c index cc5094f37dd3..363ac8e68821 100644 --- a/drivers/spi/spi_txx9.c +++ b/drivers/spi/spi_txx9.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/io.h> | ||
27 | #include <asm/gpio.h> | 28 | #include <asm/gpio.h> |
28 | 29 | ||
29 | 30 | ||
@@ -74,7 +75,6 @@ struct txx9spi { | |||
74 | struct list_head queue; | 75 | struct list_head queue; |
75 | wait_queue_head_t waitq; | 76 | wait_queue_head_t waitq; |
76 | void __iomem *membase; | 77 | void __iomem *membase; |
77 | int irq; | ||
78 | int baseclk; | 78 | int baseclk; |
79 | struct clk *clk; | 79 | struct clk *clk; |
80 | u32 max_speed_hz, min_speed_hz; | 80 | u32 max_speed_hz, min_speed_hz; |
@@ -350,12 +350,12 @@ static int __init txx9spi_probe(struct platform_device *dev) | |||
350 | struct resource *res; | 350 | struct resource *res; |
351 | int ret = -ENODEV; | 351 | int ret = -ENODEV; |
352 | u32 mcr; | 352 | u32 mcr; |
353 | int irq; | ||
353 | 354 | ||
354 | master = spi_alloc_master(&dev->dev, sizeof(*c)); | 355 | master = spi_alloc_master(&dev->dev, sizeof(*c)); |
355 | if (!master) | 356 | if (!master) |
356 | return ret; | 357 | return ret; |
357 | c = spi_master_get_devdata(master); | 358 | c = spi_master_get_devdata(master); |
358 | c->irq = -1; | ||
359 | platform_set_drvdata(dev, master); | 359 | platform_set_drvdata(dev, master); |
360 | 360 | ||
361 | INIT_WORK(&c->work, txx9spi_work); | 361 | INIT_WORK(&c->work, txx9spi_work); |
@@ -381,32 +381,36 @@ static int __init txx9spi_probe(struct platform_device *dev) | |||
381 | 381 | ||
382 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | 382 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
383 | if (!res) | 383 | if (!res) |
384 | goto exit; | 384 | goto exit_busy; |
385 | c->membase = ioremap(res->start, res->end - res->start + 1); | 385 | if (!devm_request_mem_region(&dev->dev, |
386 | res->start, res->end - res->start + 1, | ||
387 | "spi_txx9")) | ||
388 | goto exit_busy; | ||
389 | c->membase = devm_ioremap(&dev->dev, | ||
390 | res->start, res->end - res->start + 1); | ||
386 | if (!c->membase) | 391 | if (!c->membase) |
387 | goto exit; | 392 | goto exit_busy; |
388 | 393 | ||
389 | /* enter config mode */ | 394 | /* enter config mode */ |
390 | mcr = txx9spi_rd(c, TXx9_SPMCR); | 395 | mcr = txx9spi_rd(c, TXx9_SPMCR); |
391 | mcr &= ~(TXx9_SPMCR_OPMODE | TXx9_SPMCR_SPSTP | TXx9_SPMCR_BCLR); | 396 | mcr &= ~(TXx9_SPMCR_OPMODE | TXx9_SPMCR_SPSTP | TXx9_SPMCR_BCLR); |
392 | txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, TXx9_SPMCR); | 397 | txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, TXx9_SPMCR); |
393 | 398 | ||
394 | c->irq = platform_get_irq(dev, 0); | 399 | irq = platform_get_irq(dev, 0); |
395 | if (c->irq < 0) | 400 | if (irq < 0) |
396 | goto exit; | 401 | goto exit_busy; |
397 | ret = request_irq(c->irq, txx9spi_interrupt, 0, dev->name, c); | 402 | ret = devm_request_irq(&dev->dev, irq, txx9spi_interrupt, 0, |
398 | if (ret) { | 403 | "spi_txx9", c); |
399 | c->irq = -1; | 404 | if (ret) |
400 | goto exit; | 405 | goto exit; |
401 | } | ||
402 | 406 | ||
403 | c->workqueue = create_singlethread_workqueue(master->dev.parent->bus_id); | 407 | c->workqueue = create_singlethread_workqueue(master->dev.parent->bus_id); |
404 | if (!c->workqueue) | 408 | if (!c->workqueue) |
405 | goto exit; | 409 | goto exit_busy; |
406 | c->last_chipselect = -1; | 410 | c->last_chipselect = -1; |
407 | 411 | ||
408 | dev_info(&dev->dev, "at %#llx, irq %d, %dMHz\n", | 412 | dev_info(&dev->dev, "at %#llx, irq %d, %dMHz\n", |
409 | (unsigned long long)res->start, c->irq, | 413 | (unsigned long long)res->start, irq, |
410 | (c->baseclk + 500000) / 1000000); | 414 | (c->baseclk + 500000) / 1000000); |
411 | 415 | ||
412 | master->bus_num = dev->id; | 416 | master->bus_num = dev->id; |
@@ -418,13 +422,11 @@ static int __init txx9spi_probe(struct platform_device *dev) | |||
418 | if (ret) | 422 | if (ret) |
419 | goto exit; | 423 | goto exit; |
420 | return 0; | 424 | return 0; |
425 | exit_busy: | ||
426 | ret = -EBUSY; | ||
421 | exit: | 427 | exit: |
422 | if (c->workqueue) | 428 | if (c->workqueue) |
423 | destroy_workqueue(c->workqueue); | 429 | destroy_workqueue(c->workqueue); |
424 | if (c->irq >= 0) | ||
425 | free_irq(c->irq, c); | ||
426 | if (c->membase) | ||
427 | iounmap(c->membase); | ||
428 | if (c->clk) { | 430 | if (c->clk) { |
429 | clk_disable(c->clk); | 431 | clk_disable(c->clk); |
430 | clk_put(c->clk); | 432 | clk_put(c->clk); |
@@ -442,8 +444,6 @@ static int __exit txx9spi_remove(struct platform_device *dev) | |||
442 | spi_unregister_master(master); | 444 | spi_unregister_master(master); |
443 | platform_set_drvdata(dev, NULL); | 445 | platform_set_drvdata(dev, NULL); |
444 | destroy_workqueue(c->workqueue); | 446 | destroy_workqueue(c->workqueue); |
445 | free_irq(c->irq, c); | ||
446 | iounmap(c->membase); | ||
447 | clk_disable(c->clk); | 447 | clk_disable(c->clk); |
448 | clk_put(c->clk); | 448 | clk_put(c->clk); |
449 | spi_master_put(master); | 449 | spi_master_put(master); |
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/tle62x0.c index 6da58ca48b33..455991fbe28f 100644 --- a/drivers/spi/tle62x0.c +++ b/drivers/spi/tle62x0.c | |||
@@ -107,8 +107,11 @@ static ssize_t tle62x0_status_show(struct device *dev, | |||
107 | 107 | ||
108 | mutex_lock(&st->lock); | 108 | mutex_lock(&st->lock); |
109 | ret = tle62x0_read(st); | 109 | ret = tle62x0_read(st); |
110 | |||
111 | dev_dbg(dev, "tle62x0_read() returned %d\n", ret); | 110 | dev_dbg(dev, "tle62x0_read() returned %d\n", ret); |
111 | if (ret < 0) { | ||
112 | mutex_unlock(&st->lock); | ||
113 | return ret; | ||
114 | } | ||
112 | 115 | ||
113 | for (ptr = 0; ptr < (st->nr_gpio * 2)/8; ptr += 1) { | 116 | for (ptr = 0; ptr < (st->nr_gpio * 2)/8; ptr += 1) { |
114 | fault <<= 8; | 117 | fault <<= 8; |
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index c12a741b5574..85a20546e827 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c | |||
@@ -440,6 +440,7 @@ static int ssb_devices_register(struct ssb_bus *bus) | |||
440 | break; | 440 | break; |
441 | case SSB_BUSTYPE_PCMCIA: | 441 | case SSB_BUSTYPE_PCMCIA: |
442 | #ifdef CONFIG_SSB_PCMCIAHOST | 442 | #ifdef CONFIG_SSB_PCMCIAHOST |
443 | sdev->irq = bus->host_pcmcia->irq.AssignedIRQ; | ||
443 | dev->parent = &bus->host_pcmcia->dev; | 444 | dev->parent = &bus->host_pcmcia->dev; |
444 | #endif | 445 | #endif |
445 | break; | 446 | break; |
@@ -1147,7 +1148,10 @@ static int __init ssb_modinit(void) | |||
1147 | 1148 | ||
1148 | return err; | 1149 | return err; |
1149 | } | 1150 | } |
1150 | subsys_initcall(ssb_modinit); | 1151 | /* ssb must be initialized after PCI but before the ssb drivers. |
1152 | * That means we must use some initcall between subsys_initcall | ||
1153 | * and device_initcall. */ | ||
1154 | fs_initcall(ssb_modinit); | ||
1151 | 1155 | ||
1152 | static void __exit ssb_modexit(void) | 1156 | static void __exit ssb_modexit(void) |
1153 | { | 1157 | { |
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index b6abee846f02..bb44a76b3eb5 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c | |||
@@ -63,17 +63,17 @@ int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus, | |||
63 | err = pcmcia_access_configuration_register(pdev, ®); | 63 | err = pcmcia_access_configuration_register(pdev, ®); |
64 | if (err != CS_SUCCESS) | 64 | if (err != CS_SUCCESS) |
65 | goto error; | 65 | goto error; |
66 | read_addr |= (reg.Value & 0xF) << 12; | 66 | read_addr |= ((u32)(reg.Value & 0x0F)) << 12; |
67 | reg.Offset = 0x30; | 67 | reg.Offset = 0x30; |
68 | err = pcmcia_access_configuration_register(pdev, ®); | 68 | err = pcmcia_access_configuration_register(pdev, ®); |
69 | if (err != CS_SUCCESS) | 69 | if (err != CS_SUCCESS) |
70 | goto error; | 70 | goto error; |
71 | read_addr |= reg.Value << 16; | 71 | read_addr |= ((u32)reg.Value) << 16; |
72 | reg.Offset = 0x32; | 72 | reg.Offset = 0x32; |
73 | err = pcmcia_access_configuration_register(pdev, ®); | 73 | err = pcmcia_access_configuration_register(pdev, ®); |
74 | if (err != CS_SUCCESS) | 74 | if (err != CS_SUCCESS) |
75 | goto error; | 75 | goto error; |
76 | read_addr |= reg.Value << 24; | 76 | read_addr |= ((u32)reg.Value) << 24; |
77 | 77 | ||
78 | cur_core = (read_addr - SSB_ENUM_BASE) / SSB_CORE_SIZE; | 78 | cur_core = (read_addr - SSB_ENUM_BASE) / SSB_CORE_SIZE; |
79 | if (cur_core == coreidx) | 79 | if (cur_core == coreidx) |
@@ -152,28 +152,29 @@ error: | |||
152 | goto out_unlock; | 152 | goto out_unlock; |
153 | } | 153 | } |
154 | 154 | ||
155 | /* These are the main device register access functions. | 155 | static int select_core_and_segment(struct ssb_device *dev, |
156 | * do_select_core is inline to have the likely hotpath inline. | 156 | u16 *offset) |
157 | * All unlikely codepaths are out-of-line. */ | ||
158 | static inline int do_select_core(struct ssb_bus *bus, | ||
159 | struct ssb_device *dev, | ||
160 | u16 *offset) | ||
161 | { | 157 | { |
158 | struct ssb_bus *bus = dev->bus; | ||
162 | int err; | 159 | int err; |
163 | u8 need_seg = (*offset >= 0x800) ? 1 : 0; | 160 | u8 need_segment; |
161 | |||
162 | if (*offset >= 0x800) { | ||
163 | *offset -= 0x800; | ||
164 | need_segment = 1; | ||
165 | } else | ||
166 | need_segment = 0; | ||
164 | 167 | ||
165 | if (unlikely(dev != bus->mapped_device)) { | 168 | if (unlikely(dev != bus->mapped_device)) { |
166 | err = ssb_pcmcia_switch_core(bus, dev); | 169 | err = ssb_pcmcia_switch_core(bus, dev); |
167 | if (unlikely(err)) | 170 | if (unlikely(err)) |
168 | return err; | 171 | return err; |
169 | } | 172 | } |
170 | if (unlikely(need_seg != bus->mapped_pcmcia_seg)) { | 173 | if (unlikely(need_segment != bus->mapped_pcmcia_seg)) { |
171 | err = ssb_pcmcia_switch_segment(bus, need_seg); | 174 | err = ssb_pcmcia_switch_segment(bus, need_segment); |
172 | if (unlikely(err)) | 175 | if (unlikely(err)) |
173 | return err; | 176 | return err; |
174 | } | 177 | } |
175 | if (need_seg == 1) | ||
176 | *offset -= 0x800; | ||
177 | 178 | ||
178 | return 0; | 179 | return 0; |
179 | } | 180 | } |
@@ -181,32 +182,31 @@ static inline int do_select_core(struct ssb_bus *bus, | |||
181 | static u16 ssb_pcmcia_read16(struct ssb_device *dev, u16 offset) | 182 | static u16 ssb_pcmcia_read16(struct ssb_device *dev, u16 offset) |
182 | { | 183 | { |
183 | struct ssb_bus *bus = dev->bus; | 184 | struct ssb_bus *bus = dev->bus; |
184 | u16 x; | ||
185 | 185 | ||
186 | if (unlikely(do_select_core(bus, dev, &offset))) | 186 | if (unlikely(select_core_and_segment(dev, &offset))) |
187 | return 0xFFFF; | 187 | return 0xFFFF; |
188 | x = readw(bus->mmio + offset); | ||
189 | 188 | ||
190 | return x; | 189 | return readw(bus->mmio + offset); |
191 | } | 190 | } |
192 | 191 | ||
193 | static u32 ssb_pcmcia_read32(struct ssb_device *dev, u16 offset) | 192 | static u32 ssb_pcmcia_read32(struct ssb_device *dev, u16 offset) |
194 | { | 193 | { |
195 | struct ssb_bus *bus = dev->bus; | 194 | struct ssb_bus *bus = dev->bus; |
196 | u32 x; | 195 | u32 lo, hi; |
197 | 196 | ||
198 | if (unlikely(do_select_core(bus, dev, &offset))) | 197 | if (unlikely(select_core_and_segment(dev, &offset))) |
199 | return 0xFFFFFFFF; | 198 | return 0xFFFFFFFF; |
200 | x = readl(bus->mmio + offset); | 199 | lo = readw(bus->mmio + offset); |
200 | hi = readw(bus->mmio + offset + 2); | ||
201 | 201 | ||
202 | return x; | 202 | return (lo | (hi << 16)); |
203 | } | 203 | } |
204 | 204 | ||
205 | static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value) | 205 | static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value) |
206 | { | 206 | { |
207 | struct ssb_bus *bus = dev->bus; | 207 | struct ssb_bus *bus = dev->bus; |
208 | 208 | ||
209 | if (unlikely(do_select_core(bus, dev, &offset))) | 209 | if (unlikely(select_core_and_segment(dev, &offset))) |
210 | return; | 210 | return; |
211 | writew(value, bus->mmio + offset); | 211 | writew(value, bus->mmio + offset); |
212 | } | 212 | } |
@@ -215,12 +215,12 @@ static void ssb_pcmcia_write32(struct ssb_device *dev, u16 offset, u32 value) | |||
215 | { | 215 | { |
216 | struct ssb_bus *bus = dev->bus; | 216 | struct ssb_bus *bus = dev->bus; |
217 | 217 | ||
218 | if (unlikely(do_select_core(bus, dev, &offset))) | 218 | if (unlikely(select_core_and_segment(dev, &offset))) |
219 | return; | 219 | return; |
220 | readw(bus->mmio + offset); | 220 | writeb((value & 0xFF000000) >> 24, bus->mmio + offset + 3); |
221 | writew(value >> 16, bus->mmio + offset + 2); | 221 | writeb((value & 0x00FF0000) >> 16, bus->mmio + offset + 2); |
222 | readw(bus->mmio + offset); | 222 | writeb((value & 0x0000FF00) >> 8, bus->mmio + offset + 1); |
223 | writew(value, bus->mmio + offset); | 223 | writeb((value & 0x000000FF) >> 0, bus->mmio + offset + 0); |
224 | } | 224 | } |
225 | 225 | ||
226 | /* Not "static", as it's used in main.c */ | 226 | /* Not "static", as it's used in main.c */ |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 6bfdba6a213f..1f7ab15df36d 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -1215,20 +1215,18 @@ static int keyspan_chars_in_buffer (struct usb_serial_port *port) | |||
1215 | 1215 | ||
1216 | static int keyspan_open (struct usb_serial_port *port, struct file *filp) | 1216 | static int keyspan_open (struct usb_serial_port *port, struct file *filp) |
1217 | { | 1217 | { |
1218 | struct keyspan_port_private *p_priv; | 1218 | struct keyspan_port_private *p_priv; |
1219 | struct keyspan_serial_private *s_priv; | 1219 | struct keyspan_serial_private *s_priv; |
1220 | struct usb_serial *serial = port->serial; | 1220 | struct usb_serial *serial = port->serial; |
1221 | const struct keyspan_device_details *d_details; | 1221 | const struct keyspan_device_details *d_details; |
1222 | int i, err; | 1222 | int i, err; |
1223 | int baud_rate, device_port; | ||
1224 | struct urb *urb; | 1223 | struct urb *urb; |
1225 | unsigned int cflag; | ||
1226 | 1224 | ||
1227 | s_priv = usb_get_serial_data(serial); | 1225 | s_priv = usb_get_serial_data(serial); |
1228 | p_priv = usb_get_serial_port_data(port); | 1226 | p_priv = usb_get_serial_port_data(port); |
1229 | d_details = p_priv->device_details; | 1227 | d_details = p_priv->device_details; |
1230 | 1228 | ||
1231 | dbg("%s - port%d.", __FUNCTION__, port->number); | 1229 | dbg("%s - port%d.", __FUNCTION__, port->number); |
1232 | 1230 | ||
1233 | /* Set some sane defaults */ | 1231 | /* Set some sane defaults */ |
1234 | p_priv->rts_state = 1; | 1232 | p_priv->rts_state = 1; |
@@ -1249,7 +1247,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) | |||
1249 | urb->dev = serial->dev; | 1247 | urb->dev = serial->dev; |
1250 | 1248 | ||
1251 | /* make sure endpoint data toggle is synchronized with the device */ | 1249 | /* make sure endpoint data toggle is synchronized with the device */ |
1252 | 1250 | ||
1253 | usb_clear_halt(urb->dev, urb->pipe); | 1251 | usb_clear_halt(urb->dev, urb->pipe); |
1254 | 1252 | ||
1255 | if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { | 1253 | if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { |
@@ -1265,30 +1263,6 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) | |||
1265 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ | 1263 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ |
1266 | } | 1264 | } |
1267 | 1265 | ||
1268 | /* get the terminal config for the setup message now so we don't | ||
1269 | * need to send 2 of them */ | ||
1270 | |||
1271 | cflag = port->tty->termios->c_cflag; | ||
1272 | device_port = port->number - port->serial->minor; | ||
1273 | |||
1274 | /* Baud rate calculation takes baud rate as an integer | ||
1275 | so other rates can be generated if desired. */ | ||
1276 | baud_rate = tty_get_baud_rate(port->tty); | ||
1277 | /* If no match or invalid, leave as default */ | ||
1278 | if (baud_rate >= 0 | ||
1279 | && d_details->calculate_baud_rate(baud_rate, d_details->baudclk, | ||
1280 | NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { | ||
1281 | p_priv->baud = baud_rate; | ||
1282 | } | ||
1283 | |||
1284 | /* set CTS/RTS handshake etc. */ | ||
1285 | p_priv->cflag = cflag; | ||
1286 | p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none; | ||
1287 | |||
1288 | keyspan_send_setup(port, 1); | ||
1289 | //mdelay(100); | ||
1290 | //keyspan_set_termios(port, NULL); | ||
1291 | |||
1292 | return (0); | 1266 | return (0); |
1293 | } | 1267 | } |
1294 | 1268 | ||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index cc4b60f899ca..7d86e9eae915 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -503,7 +503,7 @@ config FB_VALKYRIE | |||
503 | 503 | ||
504 | config FB_CT65550 | 504 | config FB_CT65550 |
505 | bool "Chips 65550 display support" | 505 | bool "Chips 65550 display support" |
506 | depends on (FB = y) && PPC32 | 506 | depends on (FB = y) && PPC32 && PCI |
507 | select FB_CFB_FILLRECT | 507 | select FB_CFB_FILLRECT |
508 | select FB_CFB_COPYAREA | 508 | select FB_CFB_COPYAREA |
509 | select FB_CFB_IMAGEBLIT | 509 | select FB_CFB_IMAGEBLIT |
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index b9b572b293d4..2e552d5bbb5d 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
@@ -183,8 +183,8 @@ static struct fb_videomode default_mode_LCD __initdata = { | |||
183 | .vmode = FB_VMODE_NONINTERLACED, | 183 | .vmode = FB_VMODE_NONINTERLACED, |
184 | }; | 184 | }; |
185 | 185 | ||
186 | struct fb_videomode *default_mode = &default_mode_CRT; | 186 | struct fb_videomode *default_mode __initdata = &default_mode_CRT; |
187 | struct fb_var_screeninfo *default_var = &default_var_CRT; | 187 | struct fb_var_screeninfo *default_var __initdata = &default_var_CRT; |
188 | 188 | ||
189 | static int flat_panel_enabled = 0; | 189 | static int flat_panel_enabled = 0; |
190 | 190 | ||
diff --git a/drivers/video/geode/lxfb.h b/drivers/video/geode/lxfb.h index 6c227f9592a5..ca13c48d19b0 100644 --- a/drivers/video/geode/lxfb.h +++ b/drivers/video/geode/lxfb.h | |||
@@ -33,7 +33,7 @@ void lx_set_palette_reg(struct fb_info *, unsigned int, unsigned int, | |||
33 | 33 | ||
34 | #define MSR_LX_GLD_CONFIG 0x48002001 | 34 | #define MSR_LX_GLD_CONFIG 0x48002001 |
35 | #define MSR_LX_GLCP_DOTPLL 0x4c000015 | 35 | #define MSR_LX_GLCP_DOTPLL 0x4c000015 |
36 | #define MSR_LX_DF_PADSEL 0x48000011 | 36 | #define MSR_LX_DF_PADSEL 0x48002011 |
37 | #define MSR_LX_DC_SPARE 0x80000011 | 37 | #define MSR_LX_DC_SPARE 0x80000011 |
38 | #define MSR_LX_DF_GLCONFIG 0x48002001 | 38 | #define MSR_LX_DF_GLCONFIG 0x48002001 |
39 | 39 | ||
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index b3463ddcfd60..75836aa83191 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -727,7 +727,7 @@ static int ps3fb_blank(int blank, struct fb_info *info) | |||
727 | 727 | ||
728 | static int ps3fb_get_vblank(struct fb_vblank *vblank) | 728 | static int ps3fb_get_vblank(struct fb_vblank *vblank) |
729 | { | 729 | { |
730 | memset(vblank, 0, sizeof(&vblank)); | 730 | memset(vblank, 0, sizeof(*vblank)); |
731 | vblank->flags = FB_VBLANK_HAVE_VSYNC; | 731 | vblank->flags = FB_VBLANK_HAVE_VSYNC; |
732 | return 0; | 732 | return 0; |
733 | } | 733 | } |
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c index a5333c190789..b829dc7c5edf 100644 --- a/drivers/video/s1d13xxxfb.c +++ b/drivers/video/s1d13xxxfb.c | |||
@@ -540,7 +540,7 @@ s1d13xxxfb_probe(struct platform_device *pdev) | |||
540 | int ret = 0; | 540 | int ret = 0; |
541 | u8 revision; | 541 | u8 revision; |
542 | 542 | ||
543 | dbg("probe called: device is %p\n", dev); | 543 | dbg("probe called: device is %p\n", pdev); |
544 | 544 | ||
545 | printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); | 545 | printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); |
546 | 546 | ||
@@ -753,8 +753,11 @@ static struct platform_driver s1d13xxxfb_driver = { | |||
753 | static int __init | 753 | static int __init |
754 | s1d13xxxfb_init(void) | 754 | s1d13xxxfb_init(void) |
755 | { | 755 | { |
756 | |||
757 | #ifndef MODULE | ||
756 | if (fb_get_options("s1d13xxxfb", NULL)) | 758 | if (fb_get_options("s1d13xxxfb", NULL)) |
757 | return -ENODEV; | 759 | return -ENODEV; |
760 | #endif | ||
758 | 761 | ||
759 | return platform_driver_register(&s1d13xxxfb_driver); | 762 | return platform_driver_register(&s1d13xxxfb_driver); |
760 | } | 763 | } |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index bc7d23683735..37bd24b8d83b 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -1248,7 +1248,6 @@ sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive, struct fb_info *in | |||
1248 | if(found_mode) { | 1248 | if(found_mode) { |
1249 | ivideo->sisfb_mode_idx = sisfb_validate_mode(ivideo, | 1249 | ivideo->sisfb_mode_idx = sisfb_validate_mode(ivideo, |
1250 | ivideo->sisfb_mode_idx, ivideo->currentvbflags); | 1250 | ivideo->sisfb_mode_idx, ivideo->currentvbflags); |
1251 | ivideo->mode_no = sisbios_mode[ivideo->sisfb_mode_idx].mode_no[ivideo->mni]; | ||
1252 | } else { | 1251 | } else { |
1253 | ivideo->sisfb_mode_idx = -1; | 1252 | ivideo->sisfb_mode_idx = -1; |
1254 | } | 1253 | } |
@@ -1260,6 +1259,8 @@ sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive, struct fb_info *in | |||
1260 | return -EINVAL; | 1259 | return -EINVAL; |
1261 | } | 1260 | } |
1262 | 1261 | ||
1262 | ivideo->mode_no = sisbios_mode[ivideo->sisfb_mode_idx].mode_no[ivideo->mni]; | ||
1263 | |||
1263 | if(sisfb_search_refresh_rate(ivideo, ivideo->refresh_rate, ivideo->sisfb_mode_idx) == 0) { | 1264 | if(sisfb_search_refresh_rate(ivideo, ivideo->refresh_rate, ivideo->sisfb_mode_idx) == 0) { |
1264 | ivideo->rate_idx = sisbios_mode[ivideo->sisfb_mode_idx].rate_idx; | 1265 | ivideo->rate_idx = sisbios_mode[ivideo->sisfb_mode_idx].rate_idx; |
1265 | ivideo->refresh_rate = 60; | 1266 | ivideo->refresh_rate = 60; |
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index b983d262ab78..d1d6c0facd54 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
@@ -926,8 +926,10 @@ static int uvesafb_setpalette(struct uvesafb_pal_entry *entries, int count, | |||
926 | int start, struct fb_info *info) | 926 | int start, struct fb_info *info) |
927 | { | 927 | { |
928 | struct uvesafb_ktask *task; | 928 | struct uvesafb_ktask *task; |
929 | #ifdef CONFIG_X86 | ||
929 | struct uvesafb_par *par = info->par; | 930 | struct uvesafb_par *par = info->par; |
930 | int i = par->mode_idx; | 931 | int i = par->mode_idx; |
932 | #endif | ||
931 | int err = 0; | 933 | int err = 0; |
932 | 934 | ||
933 | /* | 935 | /* |
@@ -1103,11 +1105,11 @@ static int uvesafb_pan_display(struct fb_var_screeninfo *var, | |||
1103 | 1105 | ||
1104 | static int uvesafb_blank(int blank, struct fb_info *info) | 1106 | static int uvesafb_blank(int blank, struct fb_info *info) |
1105 | { | 1107 | { |
1106 | struct uvesafb_par *par = info->par; | ||
1107 | struct uvesafb_ktask *task; | 1108 | struct uvesafb_ktask *task; |
1108 | int err = 1; | 1109 | int err = 1; |
1109 | |||
1110 | #ifdef CONFIG_X86 | 1110 | #ifdef CONFIG_X86 |
1111 | struct uvesafb_par *par = info->par; | ||
1112 | |||
1111 | if (par->vbe_ib.capabilities & VBE_CAP_VGACOMPAT) { | 1113 | if (par->vbe_ib.capabilities & VBE_CAP_VGACOMPAT) { |
1112 | int loop = 10000; | 1114 | int loop = 10000; |
1113 | u8 seq = 0, crtc17 = 0; | 1115 | u8 seq = 0, crtc17 = 0; |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 0e4baca21b8f..1dc04b6684e6 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -53,7 +53,7 @@ struct vring_virtqueue | |||
53 | unsigned int num_added; | 53 | unsigned int num_added; |
54 | 54 | ||
55 | /* Last used index we've seen. */ | 55 | /* Last used index we've seen. */ |
56 | unsigned int last_used_idx; | 56 | u16 last_used_idx; |
57 | 57 | ||
58 | /* How to notify other side. FIXME: commonalize hcalls! */ | 58 | /* How to notify other side. FIXME: commonalize hcalls! */ |
59 | void (*notify)(struct virtqueue *vq); | 59 | void (*notify)(struct virtqueue *vq); |
@@ -277,11 +277,17 @@ struct virtqueue *vring_new_virtqueue(unsigned int num, | |||
277 | struct vring_virtqueue *vq; | 277 | struct vring_virtqueue *vq; |
278 | unsigned int i; | 278 | unsigned int i; |
279 | 279 | ||
280 | /* We assume num is a power of 2. */ | ||
281 | if (num & (num - 1)) { | ||
282 | dev_warn(&vdev->dev, "Bad virtqueue length %u\n", num); | ||
283 | return NULL; | ||
284 | } | ||
285 | |||
280 | vq = kmalloc(sizeof(*vq) + sizeof(void *)*num, GFP_KERNEL); | 286 | vq = kmalloc(sizeof(*vq) + sizeof(void *)*num, GFP_KERNEL); |
281 | if (!vq) | 287 | if (!vq) |
282 | return NULL; | 288 | return NULL; |
283 | 289 | ||
284 | vring_init(&vq->vring, num, pages); | 290 | vring_init(&vq->vring, num, pages, PAGE_SIZE); |
285 | vq->vq.callback = callback; | 291 | vq->vq.callback = callback; |
286 | vq->vq.vdev = vdev; | 292 | vq->vq.vdev = vdev; |
287 | vq->vq.vq_ops = &vring_vq_ops; | 293 | vq->vq.vq_ops = &vring_vq_ops; |
diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c index 299e274d241a..b63b5e044a4c 100644 --- a/drivers/w1/masters/ds2490.c +++ b/drivers/w1/masters/ds2490.c | |||
@@ -233,7 +233,7 @@ static int ds_recv_status_nodump(struct ds_device *dev, struct ds_status *st, | |||
233 | { | 233 | { |
234 | int count, err; | 234 | int count, err; |
235 | 235 | ||
236 | memset(st, 0, sizeof(st)); | 236 | memset(st, 0, sizeof(*st)); |
237 | 237 | ||
238 | count = 0; | 238 | count = 0; |
239 | err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_STATUS]), buf, size, &count, 100); | 239 | err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_STATUS]), buf, size, &count, 100); |
diff --git a/fs/Kconfig b/fs/Kconfig index c75c95406497..429a00228507 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -2007,7 +2007,7 @@ config CIFS_EXPERIMENTAL | |||
2007 | config CIFS_UPCALL | 2007 | config CIFS_UPCALL |
2008 | bool "Kerberos/SPNEGO advanced session setup (EXPERIMENTAL)" | 2008 | bool "Kerberos/SPNEGO advanced session setup (EXPERIMENTAL)" |
2009 | depends on CIFS_EXPERIMENTAL | 2009 | depends on CIFS_EXPERIMENTAL |
2010 | depends on CONNECTOR | 2010 | depends on KEYS |
2011 | help | 2011 | help |
2012 | Enables an upcall mechanism for CIFS which will be used to contact | 2012 | Enables an upcall mechanism for CIFS which will be used to contact |
2013 | userspace helper utilities to provide SPNEGO packaged Kerberos | 2013 | userspace helper utilities to provide SPNEGO packaged Kerberos |
diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h index 130f6c66c5ba..ac7a8b1d6c3a 100644 --- a/fs/bfs/bfs.h +++ b/fs/bfs/bfs.h | |||
@@ -14,8 +14,6 @@ struct bfs_sb_info { | |||
14 | unsigned long si_blocks; | 14 | unsigned long si_blocks; |
15 | unsigned long si_freeb; | 15 | unsigned long si_freeb; |
16 | unsigned long si_freei; | 16 | unsigned long si_freei; |
17 | unsigned long si_lf_ioff; | ||
18 | unsigned long si_lf_sblk; | ||
19 | unsigned long si_lf_eblk; | 17 | unsigned long si_lf_eblk; |
20 | unsigned long si_lasti; | 18 | unsigned long si_lasti; |
21 | unsigned long * si_imap; | 19 | unsigned long * si_imap; |
@@ -39,7 +37,7 @@ static inline struct bfs_sb_info *BFS_SB(struct super_block *sb) | |||
39 | 37 | ||
40 | static inline struct bfs_inode_info *BFS_I(struct inode *inode) | 38 | static inline struct bfs_inode_info *BFS_I(struct inode *inode) |
41 | { | 39 | { |
42 | return list_entry(inode, struct bfs_inode_info, vfs_inode); | 40 | return container_of(inode, struct bfs_inode_info, vfs_inode); |
43 | } | 41 | } |
44 | 42 | ||
45 | 43 | ||
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 097f1497f743..1fd056d0fc3d 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c | |||
@@ -21,29 +21,32 @@ | |||
21 | #define dprintf(x...) | 21 | #define dprintf(x...) |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | static int bfs_add_entry(struct inode * dir, const unsigned char * name, int namelen, int ino); | 24 | static int bfs_add_entry(struct inode *dir, const unsigned char *name, |
25 | static struct buffer_head * bfs_find_entry(struct inode * dir, | 25 | int namelen, int ino); |
26 | const unsigned char * name, int namelen, struct bfs_dirent ** res_dir); | 26 | static struct buffer_head *bfs_find_entry(struct inode *dir, |
27 | const unsigned char *name, int namelen, | ||
28 | struct bfs_dirent **res_dir); | ||
27 | 29 | ||
28 | static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir) | 30 | static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir) |
29 | { | 31 | { |
30 | struct inode * dir = f->f_path.dentry->d_inode; | 32 | struct inode *dir = f->f_path.dentry->d_inode; |
31 | struct buffer_head * bh; | 33 | struct buffer_head *bh; |
32 | struct bfs_dirent * de; | 34 | struct bfs_dirent *de; |
33 | unsigned int offset; | 35 | unsigned int offset; |
34 | int block; | 36 | int block; |
35 | 37 | ||
36 | lock_kernel(); | 38 | lock_kernel(); |
37 | 39 | ||
38 | if (f->f_pos & (BFS_DIRENT_SIZE-1)) { | 40 | if (f->f_pos & (BFS_DIRENT_SIZE - 1)) { |
39 | printf("Bad f_pos=%08lx for %s:%08lx\n", (unsigned long)f->f_pos, | 41 | printf("Bad f_pos=%08lx for %s:%08lx\n", |
40 | dir->i_sb->s_id, dir->i_ino); | 42 | (unsigned long)f->f_pos, |
43 | dir->i_sb->s_id, dir->i_ino); | ||
41 | unlock_kernel(); | 44 | unlock_kernel(); |
42 | return -EBADF; | 45 | return -EBADF; |
43 | } | 46 | } |
44 | 47 | ||
45 | while (f->f_pos < dir->i_size) { | 48 | while (f->f_pos < dir->i_size) { |
46 | offset = f->f_pos & (BFS_BSIZE-1); | 49 | offset = f->f_pos & (BFS_BSIZE - 1); |
47 | block = BFS_I(dir)->i_sblock + (f->f_pos >> BFS_BSIZE_BITS); | 50 | block = BFS_I(dir)->i_sblock + (f->f_pos >> BFS_BSIZE_BITS); |
48 | bh = sb_bread(dir->i_sb, block); | 51 | bh = sb_bread(dir->i_sb, block); |
49 | if (!bh) { | 52 | if (!bh) { |
@@ -54,7 +57,9 @@ static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir) | |||
54 | de = (struct bfs_dirent *)(bh->b_data + offset); | 57 | de = (struct bfs_dirent *)(bh->b_data + offset); |
55 | if (de->ino) { | 58 | if (de->ino) { |
56 | int size = strnlen(de->name, BFS_NAMELEN); | 59 | int size = strnlen(de->name, BFS_NAMELEN); |
57 | if (filldir(dirent, de->name, size, f->f_pos, le16_to_cpu(de->ino), DT_UNKNOWN) < 0) { | 60 | if (filldir(dirent, de->name, size, f->f_pos, |
61 | le16_to_cpu(de->ino), | ||
62 | DT_UNKNOWN) < 0) { | ||
58 | brelse(bh); | 63 | brelse(bh); |
59 | unlock_kernel(); | 64 | unlock_kernel(); |
60 | return 0; | 65 | return 0; |
@@ -62,7 +67,7 @@ static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir) | |||
62 | } | 67 | } |
63 | offset += BFS_DIRENT_SIZE; | 68 | offset += BFS_DIRENT_SIZE; |
64 | f->f_pos += BFS_DIRENT_SIZE; | 69 | f->f_pos += BFS_DIRENT_SIZE; |
65 | } while (offset < BFS_BSIZE && f->f_pos < dir->i_size); | 70 | } while ((offset < BFS_BSIZE) && (f->f_pos < dir->i_size)); |
66 | brelse(bh); | 71 | brelse(bh); |
67 | } | 72 | } |
68 | 73 | ||
@@ -78,13 +83,13 @@ const struct file_operations bfs_dir_operations = { | |||
78 | 83 | ||
79 | extern void dump_imap(const char *, struct super_block *); | 84 | extern void dump_imap(const char *, struct super_block *); |
80 | 85 | ||
81 | static int bfs_create(struct inode * dir, struct dentry * dentry, int mode, | 86 | static int bfs_create(struct inode *dir, struct dentry *dentry, int mode, |
82 | struct nameidata *nd) | 87 | struct nameidata *nd) |
83 | { | 88 | { |
84 | int err; | 89 | int err; |
85 | struct inode * inode; | 90 | struct inode *inode; |
86 | struct super_block * s = dir->i_sb; | 91 | struct super_block *s = dir->i_sb; |
87 | struct bfs_sb_info * info = BFS_SB(s); | 92 | struct bfs_sb_info *info = BFS_SB(s); |
88 | unsigned long ino; | 93 | unsigned long ino; |
89 | 94 | ||
90 | inode = new_inode(s); | 95 | inode = new_inode(s); |
@@ -97,7 +102,7 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode, | |||
97 | iput(inode); | 102 | iput(inode); |
98 | return -ENOSPC; | 103 | return -ENOSPC; |
99 | } | 104 | } |
100 | set_bit(ino, info->si_imap); | 105 | set_bit(ino, info->si_imap); |
101 | info->si_freei--; | 106 | info->si_freei--; |
102 | inode->i_uid = current->fsuid; | 107 | inode->i_uid = current->fsuid; |
103 | inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid; | 108 | inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid; |
@@ -113,9 +118,10 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode, | |||
113 | BFS_I(inode)->i_eblock = 0; | 118 | BFS_I(inode)->i_eblock = 0; |
114 | insert_inode_hash(inode); | 119 | insert_inode_hash(inode); |
115 | mark_inode_dirty(inode); | 120 | mark_inode_dirty(inode); |
116 | dump_imap("create",s); | 121 | dump_imap("create", s); |
117 | 122 | ||
118 | err = bfs_add_entry(dir, dentry->d_name.name, dentry->d_name.len, inode->i_ino); | 123 | err = bfs_add_entry(dir, dentry->d_name.name, dentry->d_name.len, |
124 | inode->i_ino); | ||
119 | if (err) { | 125 | if (err) { |
120 | inode_dec_link_count(inode); | 126 | inode_dec_link_count(inode); |
121 | iput(inode); | 127 | iput(inode); |
@@ -127,11 +133,12 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode, | |||
127 | return 0; | 133 | return 0; |
128 | } | 134 | } |
129 | 135 | ||
130 | static struct dentry * bfs_lookup(struct inode * dir, struct dentry * dentry, struct nameidata *nd) | 136 | static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry, |
137 | struct nameidata *nd) | ||
131 | { | 138 | { |
132 | struct inode * inode = NULL; | 139 | struct inode *inode = NULL; |
133 | struct buffer_head * bh; | 140 | struct buffer_head *bh; |
134 | struct bfs_dirent * de; | 141 | struct bfs_dirent *de; |
135 | 142 | ||
136 | if (dentry->d_name.len > BFS_NAMELEN) | 143 | if (dentry->d_name.len > BFS_NAMELEN) |
137 | return ERR_PTR(-ENAMETOOLONG); | 144 | return ERR_PTR(-ENAMETOOLONG); |
@@ -152,13 +159,15 @@ static struct dentry * bfs_lookup(struct inode * dir, struct dentry * dentry, st | |||
152 | return NULL; | 159 | return NULL; |
153 | } | 160 | } |
154 | 161 | ||
155 | static int bfs_link(struct dentry * old, struct inode * dir, struct dentry * new) | 162 | static int bfs_link(struct dentry *old, struct inode *dir, |
163 | struct dentry *new) | ||
156 | { | 164 | { |
157 | struct inode * inode = old->d_inode; | 165 | struct inode *inode = old->d_inode; |
158 | int err; | 166 | int err; |
159 | 167 | ||
160 | lock_kernel(); | 168 | lock_kernel(); |
161 | err = bfs_add_entry(dir, new->d_name.name, new->d_name.len, inode->i_ino); | 169 | err = bfs_add_entry(dir, new->d_name.name, new->d_name.len, |
170 | inode->i_ino); | ||
162 | if (err) { | 171 | if (err) { |
163 | unlock_kernel(); | 172 | unlock_kernel(); |
164 | return err; | 173 | return err; |
@@ -172,23 +181,23 @@ static int bfs_link(struct dentry * old, struct inode * dir, struct dentry * new | |||
172 | return 0; | 181 | return 0; |
173 | } | 182 | } |
174 | 183 | ||
175 | 184 | static int bfs_unlink(struct inode *dir, struct dentry *dentry) | |
176 | static int bfs_unlink(struct inode * dir, struct dentry * dentry) | ||
177 | { | 185 | { |
178 | int error = -ENOENT; | 186 | int error = -ENOENT; |
179 | struct inode * inode; | 187 | struct inode *inode; |
180 | struct buffer_head * bh; | 188 | struct buffer_head *bh; |
181 | struct bfs_dirent * de; | 189 | struct bfs_dirent *de; |
182 | 190 | ||
183 | inode = dentry->d_inode; | 191 | inode = dentry->d_inode; |
184 | lock_kernel(); | 192 | lock_kernel(); |
185 | bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de); | 193 | bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de); |
186 | if (!bh || le16_to_cpu(de->ino) != inode->i_ino) | 194 | if (!bh || (le16_to_cpu(de->ino) != inode->i_ino)) |
187 | goto out_brelse; | 195 | goto out_brelse; |
188 | 196 | ||
189 | if (!inode->i_nlink) { | 197 | if (!inode->i_nlink) { |
190 | printf("unlinking non-existent file %s:%lu (nlink=%d)\n", inode->i_sb->s_id, | 198 | printf("unlinking non-existent file %s:%lu (nlink=%d)\n", |
191 | inode->i_ino, inode->i_nlink); | 199 | inode->i_sb->s_id, inode->i_ino, |
200 | inode->i_nlink); | ||
192 | inode->i_nlink = 1; | 201 | inode->i_nlink = 1; |
193 | } | 202 | } |
194 | de->ino = 0; | 203 | de->ino = 0; |
@@ -205,12 +214,12 @@ out_brelse: | |||
205 | return error; | 214 | return error; |
206 | } | 215 | } |
207 | 216 | ||
208 | static int bfs_rename(struct inode * old_dir, struct dentry * old_dentry, | 217 | static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
209 | struct inode * new_dir, struct dentry * new_dentry) | 218 | struct inode *new_dir, struct dentry *new_dentry) |
210 | { | 219 | { |
211 | struct inode * old_inode, * new_inode; | 220 | struct inode *old_inode, *new_inode; |
212 | struct buffer_head * old_bh, * new_bh; | 221 | struct buffer_head *old_bh, *new_bh; |
213 | struct bfs_dirent * old_de, * new_de; | 222 | struct bfs_dirent *old_de, *new_de; |
214 | int error = -ENOENT; | 223 | int error = -ENOENT; |
215 | 224 | ||
216 | old_bh = new_bh = NULL; | 225 | old_bh = new_bh = NULL; |
@@ -223,7 +232,7 @@ static int bfs_rename(struct inode * old_dir, struct dentry * old_dentry, | |||
223 | old_dentry->d_name.name, | 232 | old_dentry->d_name.name, |
224 | old_dentry->d_name.len, &old_de); | 233 | old_dentry->d_name.len, &old_de); |
225 | 234 | ||
226 | if (!old_bh || le16_to_cpu(old_de->ino) != old_inode->i_ino) | 235 | if (!old_bh || (le16_to_cpu(old_de->ino) != old_inode->i_ino)) |
227 | goto end_rename; | 236 | goto end_rename; |
228 | 237 | ||
229 | error = -EPERM; | 238 | error = -EPERM; |
@@ -239,7 +248,8 @@ static int bfs_rename(struct inode * old_dir, struct dentry * old_dentry, | |||
239 | if (!new_bh) { | 248 | if (!new_bh) { |
240 | error = bfs_add_entry(new_dir, | 249 | error = bfs_add_entry(new_dir, |
241 | new_dentry->d_name.name, | 250 | new_dentry->d_name.name, |
242 | new_dentry->d_name.len, old_inode->i_ino); | 251 | new_dentry->d_name.len, |
252 | old_inode->i_ino); | ||
243 | if (error) | 253 | if (error) |
244 | goto end_rename; | 254 | goto end_rename; |
245 | } | 255 | } |
@@ -268,11 +278,12 @@ const struct inode_operations bfs_dir_inops = { | |||
268 | .rename = bfs_rename, | 278 | .rename = bfs_rename, |
269 | }; | 279 | }; |
270 | 280 | ||
271 | static int bfs_add_entry(struct inode * dir, const unsigned char * name, int namelen, int ino) | 281 | static int bfs_add_entry(struct inode *dir, const unsigned char *name, |
282 | int namelen, int ino) | ||
272 | { | 283 | { |
273 | struct buffer_head * bh; | 284 | struct buffer_head *bh; |
274 | struct bfs_dirent * de; | 285 | struct bfs_dirent *de; |
275 | int block, sblock, eblock, off, eoff; | 286 | int block, sblock, eblock, off, pos; |
276 | int i; | 287 | int i; |
277 | 288 | ||
278 | dprintf("name=%s, namelen=%d\n", name, namelen); | 289 | dprintf("name=%s, namelen=%d\n", name, namelen); |
@@ -284,27 +295,24 @@ static int bfs_add_entry(struct inode * dir, const unsigned char * name, int nam | |||
284 | 295 | ||
285 | sblock = BFS_I(dir)->i_sblock; | 296 | sblock = BFS_I(dir)->i_sblock; |
286 | eblock = BFS_I(dir)->i_eblock; | 297 | eblock = BFS_I(dir)->i_eblock; |
287 | eoff = dir->i_size % BFS_BSIZE; | 298 | for (block = sblock; block <= eblock; block++) { |
288 | for (block=sblock; block<=eblock; block++) { | ||
289 | bh = sb_bread(dir->i_sb, block); | 299 | bh = sb_bread(dir->i_sb, block); |
290 | if(!bh) | 300 | if (!bh) |
291 | return -ENOSPC; | 301 | return -ENOSPC; |
292 | for (off=0; off<BFS_BSIZE; off+=BFS_DIRENT_SIZE) { | 302 | for (off = 0; off < BFS_BSIZE; off += BFS_DIRENT_SIZE) { |
293 | de = (struct bfs_dirent *)(bh->b_data + off); | 303 | de = (struct bfs_dirent *)(bh->b_data + off); |
294 | if (block==eblock && off>=eoff) { | ||
295 | /* Do not read/interpret the garbage in the end of eblock. */ | ||
296 | de->ino = 0; | ||
297 | } | ||
298 | if (!de->ino) { | 304 | if (!de->ino) { |
299 | if ((block-sblock)*BFS_BSIZE + off >= dir->i_size) { | 305 | pos = (block - sblock) * BFS_BSIZE + off; |
306 | if (pos >= dir->i_size) { | ||
300 | dir->i_size += BFS_DIRENT_SIZE; | 307 | dir->i_size += BFS_DIRENT_SIZE; |
301 | dir->i_ctime = CURRENT_TIME_SEC; | 308 | dir->i_ctime = CURRENT_TIME_SEC; |
302 | } | 309 | } |
303 | dir->i_mtime = CURRENT_TIME_SEC; | 310 | dir->i_mtime = CURRENT_TIME_SEC; |
304 | mark_inode_dirty(dir); | 311 | mark_inode_dirty(dir); |
305 | de->ino = cpu_to_le16((u16)ino); | 312 | de->ino = cpu_to_le16((u16)ino); |
306 | for (i=0; i<BFS_NAMELEN; i++) | 313 | for (i = 0; i < BFS_NAMELEN; i++) |
307 | de->name[i] = (i < namelen) ? name[i] : 0; | 314 | de->name[i] = |
315 | (i < namelen) ? name[i] : 0; | ||
308 | mark_buffer_dirty(bh); | 316 | mark_buffer_dirty(bh); |
309 | brelse(bh); | 317 | brelse(bh); |
310 | return 0; | 318 | return 0; |
@@ -315,25 +323,26 @@ static int bfs_add_entry(struct inode * dir, const unsigned char * name, int nam | |||
315 | return -ENOSPC; | 323 | return -ENOSPC; |
316 | } | 324 | } |
317 | 325 | ||
318 | static inline int bfs_namecmp(int len, const unsigned char * name, const char * buffer) | 326 | static inline int bfs_namecmp(int len, const unsigned char *name, |
327 | const char *buffer) | ||
319 | { | 328 | { |
320 | if (len < BFS_NAMELEN && buffer[len]) | 329 | if ((len < BFS_NAMELEN) && buffer[len]) |
321 | return 0; | 330 | return 0; |
322 | return !memcmp(name, buffer, len); | 331 | return !memcmp(name, buffer, len); |
323 | } | 332 | } |
324 | 333 | ||
325 | static struct buffer_head * bfs_find_entry(struct inode * dir, | 334 | static struct buffer_head *bfs_find_entry(struct inode *dir, |
326 | const unsigned char * name, int namelen, struct bfs_dirent ** res_dir) | 335 | const unsigned char *name, int namelen, |
336 | struct bfs_dirent **res_dir) | ||
327 | { | 337 | { |
328 | unsigned long block, offset; | 338 | unsigned long block = 0, offset = 0; |
329 | struct buffer_head * bh; | 339 | struct buffer_head *bh = NULL; |
330 | struct bfs_dirent * de; | 340 | struct bfs_dirent *de; |
331 | 341 | ||
332 | *res_dir = NULL; | 342 | *res_dir = NULL; |
333 | if (namelen > BFS_NAMELEN) | 343 | if (namelen > BFS_NAMELEN) |
334 | return NULL; | 344 | return NULL; |
335 | bh = NULL; | 345 | |
336 | block = offset = 0; | ||
337 | while (block * BFS_BSIZE + offset < dir->i_size) { | 346 | while (block * BFS_BSIZE + offset < dir->i_size) { |
338 | if (!bh) { | 347 | if (!bh) { |
339 | bh = sb_bread(dir->i_sb, BFS_I(dir)->i_sblock + block); | 348 | bh = sb_bread(dir->i_sb, BFS_I(dir)->i_sblock + block); |
@@ -344,7 +353,8 @@ static struct buffer_head * bfs_find_entry(struct inode * dir, | |||
344 | } | 353 | } |
345 | de = (struct bfs_dirent *)(bh->b_data + offset); | 354 | de = (struct bfs_dirent *)(bh->b_data + offset); |
346 | offset += BFS_DIRENT_SIZE; | 355 | offset += BFS_DIRENT_SIZE; |
347 | if (le16_to_cpu(de->ino) && bfs_namecmp(namelen, name, de->name)) { | 356 | if (le16_to_cpu(de->ino) && |
357 | bfs_namecmp(namelen, name, de->name)) { | ||
348 | *res_dir = de; | 358 | *res_dir = de; |
349 | return bh; | 359 | return bh; |
350 | } | 360 | } |
diff --git a/fs/bfs/file.c b/fs/bfs/file.c index 911b4ccf470f..b11e63e8fbcd 100644 --- a/fs/bfs/file.c +++ b/fs/bfs/file.c | |||
@@ -2,6 +2,11 @@ | |||
2 | * fs/bfs/file.c | 2 | * fs/bfs/file.c |
3 | * BFS file operations. | 3 | * BFS file operations. |
4 | * Copyright (C) 1999,2000 Tigran Aivazian <tigran@veritas.com> | 4 | * Copyright (C) 1999,2000 Tigran Aivazian <tigran@veritas.com> |
5 | * | ||
6 | * Make the file block allocation algorithm understand the size | ||
7 | * of the underlying block device. | ||
8 | * Copyright (C) 2007 Dmitri Vorobiev <dmitri.vorobiev@gmail.com> | ||
9 | * | ||
5 | */ | 10 | */ |
6 | 11 | ||
7 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
@@ -27,7 +32,8 @@ const struct file_operations bfs_file_operations = { | |||
27 | .splice_read = generic_file_splice_read, | 32 | .splice_read = generic_file_splice_read, |
28 | }; | 33 | }; |
29 | 34 | ||
30 | static int bfs_move_block(unsigned long from, unsigned long to, struct super_block *sb) | 35 | static int bfs_move_block(unsigned long from, unsigned long to, |
36 | struct super_block *sb) | ||
31 | { | 37 | { |
32 | struct buffer_head *bh, *new; | 38 | struct buffer_head *bh, *new; |
33 | 39 | ||
@@ -43,21 +49,22 @@ static int bfs_move_block(unsigned long from, unsigned long to, struct super_blo | |||
43 | } | 49 | } |
44 | 50 | ||
45 | static int bfs_move_blocks(struct super_block *sb, unsigned long start, | 51 | static int bfs_move_blocks(struct super_block *sb, unsigned long start, |
46 | unsigned long end, unsigned long where) | 52 | unsigned long end, unsigned long where) |
47 | { | 53 | { |
48 | unsigned long i; | 54 | unsigned long i; |
49 | 55 | ||
50 | dprintf("%08lx-%08lx->%08lx\n", start, end, where); | 56 | dprintf("%08lx-%08lx->%08lx\n", start, end, where); |
51 | for (i = start; i <= end; i++) | 57 | for (i = start; i <= end; i++) |
52 | if(bfs_move_block(i, where + i, sb)) { | 58 | if(bfs_move_block(i, where + i, sb)) { |
53 | dprintf("failed to move block %08lx -> %08lx\n", i, where + i); | 59 | dprintf("failed to move block %08lx -> %08lx\n", i, |
60 | where + i); | ||
54 | return -EIO; | 61 | return -EIO; |
55 | } | 62 | } |
56 | return 0; | 63 | return 0; |
57 | } | 64 | } |
58 | 65 | ||
59 | static int bfs_get_block(struct inode * inode, sector_t block, | 66 | static int bfs_get_block(struct inode *inode, sector_t block, |
60 | struct buffer_head * bh_result, int create) | 67 | struct buffer_head *bh_result, int create) |
61 | { | 68 | { |
62 | unsigned long phys; | 69 | unsigned long phys; |
63 | int err; | 70 | int err; |
@@ -66,9 +73,6 @@ static int bfs_get_block(struct inode * inode, sector_t block, | |||
66 | struct bfs_inode_info *bi = BFS_I(inode); | 73 | struct bfs_inode_info *bi = BFS_I(inode); |
67 | struct buffer_head *sbh = info->si_sbh; | 74 | struct buffer_head *sbh = info->si_sbh; |
68 | 75 | ||
69 | if (block > info->si_blocks) | ||
70 | return -EIO; | ||
71 | |||
72 | phys = bi->i_sblock + block; | 76 | phys = bi->i_sblock + block; |
73 | if (!create) { | 77 | if (!create) { |
74 | if (phys <= bi->i_eblock) { | 78 | if (phys <= bi->i_eblock) { |
@@ -79,21 +83,29 @@ static int bfs_get_block(struct inode * inode, sector_t block, | |||
79 | return 0; | 83 | return 0; |
80 | } | 84 | } |
81 | 85 | ||
82 | /* if the file is not empty and the requested block is within the range | 86 | /* |
83 | of blocks allocated for this file, we can grant it */ | 87 | * If the file is not empty and the requested block is within the |
84 | if (inode->i_size && phys <= bi->i_eblock) { | 88 | * range of blocks allocated for this file, we can grant it. |
89 | */ | ||
90 | if (bi->i_sblock && (phys <= bi->i_eblock)) { | ||
85 | dprintf("c=%d, b=%08lx, phys=%08lx (interim block granted)\n", | 91 | dprintf("c=%d, b=%08lx, phys=%08lx (interim block granted)\n", |
86 | create, (unsigned long)block, phys); | 92 | create, (unsigned long)block, phys); |
87 | map_bh(bh_result, sb, phys); | 93 | map_bh(bh_result, sb, phys); |
88 | return 0; | 94 | return 0; |
89 | } | 95 | } |
90 | 96 | ||
91 | /* the rest has to be protected against itself */ | 97 | /* The file will be extended, so let's see if there is enough space. */ |
98 | if (phys >= info->si_blocks) | ||
99 | return -ENOSPC; | ||
100 | |||
101 | /* The rest has to be protected against itself. */ | ||
92 | lock_kernel(); | 102 | lock_kernel(); |
93 | 103 | ||
94 | /* if the last data block for this file is the last allocated | 104 | /* |
95 | block, we can extend the file trivially, without moving it | 105 | * If the last data block for this file is the last allocated |
96 | anywhere */ | 106 | * block, we can extend the file trivially, without moving it |
107 | * anywhere. | ||
108 | */ | ||
97 | if (bi->i_eblock == info->si_lf_eblk) { | 109 | if (bi->i_eblock == info->si_lf_eblk) { |
98 | dprintf("c=%d, b=%08lx, phys=%08lx (simple extension)\n", | 110 | dprintf("c=%d, b=%08lx, phys=%08lx (simple extension)\n", |
99 | create, (unsigned long)block, phys); | 111 | create, (unsigned long)block, phys); |
@@ -106,13 +118,19 @@ static int bfs_get_block(struct inode * inode, sector_t block, | |||
106 | goto out; | 118 | goto out; |
107 | } | 119 | } |
108 | 120 | ||
109 | /* Ok, we have to move this entire file to the next free block */ | 121 | /* Ok, we have to move this entire file to the next free block. */ |
110 | phys = info->si_lf_eblk + 1; | 122 | phys = info->si_lf_eblk + 1; |
111 | if (bi->i_sblock) { /* if data starts on block 0 then there is no data */ | 123 | if (phys + block >= info->si_blocks) { |
124 | err = -ENOSPC; | ||
125 | goto out; | ||
126 | } | ||
127 | |||
128 | if (bi->i_sblock) { | ||
112 | err = bfs_move_blocks(inode->i_sb, bi->i_sblock, | 129 | err = bfs_move_blocks(inode->i_sb, bi->i_sblock, |
113 | bi->i_eblock, phys); | 130 | bi->i_eblock, phys); |
114 | if (err) { | 131 | if (err) { |
115 | dprintf("failed to move ino=%08lx -> fs corruption\n", inode->i_ino); | 132 | dprintf("failed to move ino=%08lx -> fs corruption\n", |
133 | inode->i_ino); | ||
116 | goto out; | 134 | goto out; |
117 | } | 135 | } |
118 | } else | 136 | } else |
@@ -124,8 +142,10 @@ static int bfs_get_block(struct inode * inode, sector_t block, | |||
124 | phys += block; | 142 | phys += block; |
125 | info->si_lf_eblk = bi->i_eblock = phys; | 143 | info->si_lf_eblk = bi->i_eblock = phys; |
126 | 144 | ||
127 | /* this assumes nothing can write the inode back while we are here | 145 | /* |
128 | * and thus update inode->i_blocks! (XXX)*/ | 146 | * This assumes nothing can write the inode back while we are here |
147 | * and thus update inode->i_blocks! (XXX) | ||
148 | */ | ||
129 | info->si_freeb -= bi->i_eblock - bi->i_sblock + 1 - inode->i_blocks; | 149 | info->si_freeb -= bi->i_eblock - bi->i_sblock + 1 - inode->i_blocks; |
130 | mark_inode_dirty(inode); | 150 | mark_inode_dirty(inode); |
131 | mark_buffer_dirty(sbh); | 151 | mark_buffer_dirty(sbh); |
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 7bd9c2bbe6ee..294c41baef6e 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
@@ -30,25 +30,26 @@ MODULE_LICENSE("GPL"); | |||
30 | #define dprintf(x...) | 30 | #define dprintf(x...) |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | void dump_imap(const char *prefix, struct super_block * s); | 33 | void dump_imap(const char *prefix, struct super_block *s); |
34 | 34 | ||
35 | static void bfs_read_inode(struct inode * inode) | 35 | static void bfs_read_inode(struct inode *inode) |
36 | { | 36 | { |
37 | unsigned long ino = inode->i_ino; | 37 | unsigned long ino = inode->i_ino; |
38 | struct bfs_inode * di; | 38 | struct bfs_inode *di; |
39 | struct buffer_head * bh; | 39 | struct buffer_head *bh; |
40 | int block, off; | 40 | int block, off; |
41 | 41 | ||
42 | if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) { | 42 | if ((ino < BFS_ROOT_INO) || (ino > BFS_SB(inode->i_sb)->si_lasti)) { |
43 | printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino); | 43 | printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino); |
44 | make_bad_inode(inode); | 44 | make_bad_inode(inode); |
45 | return; | 45 | return; |
46 | } | 46 | } |
47 | 47 | ||
48 | block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; | 48 | block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; |
49 | bh = sb_bread(inode->i_sb, block); | 49 | bh = sb_bread(inode->i_sb, block); |
50 | if (!bh) { | 50 | if (!bh) { |
51 | printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino); | 51 | printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, |
52 | ino); | ||
52 | make_bad_inode(inode); | 53 | make_bad_inode(inode); |
53 | return; | 54 | return; |
54 | } | 55 | } |
@@ -56,7 +57,7 @@ static void bfs_read_inode(struct inode * inode) | |||
56 | off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; | 57 | off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; |
57 | di = (struct bfs_inode *)bh->b_data + off; | 58 | di = (struct bfs_inode *)bh->b_data + off; |
58 | 59 | ||
59 | inode->i_mode = 0x0000FFFF & le32_to_cpu(di->i_mode); | 60 | inode->i_mode = 0x0000FFFF & le32_to_cpu(di->i_mode); |
60 | if (le32_to_cpu(di->i_vtype) == BFS_VDIR) { | 61 | if (le32_to_cpu(di->i_vtype) == BFS_VDIR) { |
61 | inode->i_mode |= S_IFDIR; | 62 | inode->i_mode |= S_IFDIR; |
62 | inode->i_op = &bfs_dir_inops; | 63 | inode->i_op = &bfs_dir_inops; |
@@ -70,48 +71,48 @@ static void bfs_read_inode(struct inode * inode) | |||
70 | 71 | ||
71 | BFS_I(inode)->i_sblock = le32_to_cpu(di->i_sblock); | 72 | BFS_I(inode)->i_sblock = le32_to_cpu(di->i_sblock); |
72 | BFS_I(inode)->i_eblock = le32_to_cpu(di->i_eblock); | 73 | BFS_I(inode)->i_eblock = le32_to_cpu(di->i_eblock); |
74 | BFS_I(inode)->i_dsk_ino = le16_to_cpu(di->i_ino); | ||
73 | inode->i_uid = le32_to_cpu(di->i_uid); | 75 | inode->i_uid = le32_to_cpu(di->i_uid); |
74 | inode->i_gid = le32_to_cpu(di->i_gid); | 76 | inode->i_gid = le32_to_cpu(di->i_gid); |
75 | inode->i_nlink = le32_to_cpu(di->i_nlink); | 77 | inode->i_nlink = le32_to_cpu(di->i_nlink); |
76 | inode->i_size = BFS_FILESIZE(di); | 78 | inode->i_size = BFS_FILESIZE(di); |
77 | inode->i_blocks = BFS_FILEBLOCKS(di); | 79 | inode->i_blocks = BFS_FILEBLOCKS(di); |
78 | if (inode->i_size || inode->i_blocks) dprintf("Registered inode with %lld size, %ld blocks\n", inode->i_size, inode->i_blocks); | ||
79 | inode->i_atime.tv_sec = le32_to_cpu(di->i_atime); | 80 | inode->i_atime.tv_sec = le32_to_cpu(di->i_atime); |
80 | inode->i_mtime.tv_sec = le32_to_cpu(di->i_mtime); | 81 | inode->i_mtime.tv_sec = le32_to_cpu(di->i_mtime); |
81 | inode->i_ctime.tv_sec = le32_to_cpu(di->i_ctime); | 82 | inode->i_ctime.tv_sec = le32_to_cpu(di->i_ctime); |
82 | inode->i_atime.tv_nsec = 0; | 83 | inode->i_atime.tv_nsec = 0; |
83 | inode->i_mtime.tv_nsec = 0; | 84 | inode->i_mtime.tv_nsec = 0; |
84 | inode->i_ctime.tv_nsec = 0; | 85 | inode->i_ctime.tv_nsec = 0; |
85 | BFS_I(inode)->i_dsk_ino = le16_to_cpu(di->i_ino); /* can be 0 so we store a copy */ | ||
86 | 86 | ||
87 | brelse(bh); | 87 | brelse(bh); |
88 | } | 88 | } |
89 | 89 | ||
90 | static int bfs_write_inode(struct inode * inode, int unused) | 90 | static int bfs_write_inode(struct inode *inode, int unused) |
91 | { | 91 | { |
92 | unsigned int ino = (u16)inode->i_ino; | 92 | unsigned int ino = (u16)inode->i_ino; |
93 | unsigned long i_sblock; | 93 | unsigned long i_sblock; |
94 | struct bfs_inode * di; | 94 | struct bfs_inode *di; |
95 | struct buffer_head * bh; | 95 | struct buffer_head *bh; |
96 | int block, off; | 96 | int block, off; |
97 | 97 | ||
98 | dprintf("ino=%08x\n", ino); | 98 | dprintf("ino=%08x\n", ino); |
99 | 99 | ||
100 | if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) { | 100 | if ((ino < BFS_ROOT_INO) || (ino > BFS_SB(inode->i_sb)->si_lasti)) { |
101 | printf("Bad inode number %s:%08x\n", inode->i_sb->s_id, ino); | 101 | printf("Bad inode number %s:%08x\n", inode->i_sb->s_id, ino); |
102 | return -EIO; | 102 | return -EIO; |
103 | } | 103 | } |
104 | 104 | ||
105 | lock_kernel(); | 105 | lock_kernel(); |
106 | block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; | 106 | block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; |
107 | bh = sb_bread(inode->i_sb, block); | 107 | bh = sb_bread(inode->i_sb, block); |
108 | if (!bh) { | 108 | if (!bh) { |
109 | printf("Unable to read inode %s:%08x\n", inode->i_sb->s_id, ino); | 109 | printf("Unable to read inode %s:%08x\n", |
110 | inode->i_sb->s_id, ino); | ||
110 | unlock_kernel(); | 111 | unlock_kernel(); |
111 | return -EIO; | 112 | return -EIO; |
112 | } | 113 | } |
113 | 114 | ||
114 | off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK; | 115 | off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; |
115 | di = (struct bfs_inode *)bh->b_data + off; | 116 | di = (struct bfs_inode *)bh->b_data + off; |
116 | 117 | ||
117 | if (ino == BFS_ROOT_INO) | 118 | if (ino == BFS_ROOT_INO) |
@@ -133,27 +134,26 @@ static int bfs_write_inode(struct inode * inode, int unused) | |||
133 | di->i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode->i_size - 1); | 134 | di->i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode->i_size - 1); |
134 | 135 | ||
135 | mark_buffer_dirty(bh); | 136 | mark_buffer_dirty(bh); |
136 | dprintf("Written ino=%d into %d:%d\n",le16_to_cpu(di->i_ino),block,off); | ||
137 | brelse(bh); | 137 | brelse(bh); |
138 | unlock_kernel(); | 138 | unlock_kernel(); |
139 | return 0; | 139 | return 0; |
140 | } | 140 | } |
141 | 141 | ||
142 | static void bfs_delete_inode(struct inode * inode) | 142 | static void bfs_delete_inode(struct inode *inode) |
143 | { | 143 | { |
144 | unsigned long ino = inode->i_ino; | 144 | unsigned long ino = inode->i_ino; |
145 | struct bfs_inode * di; | 145 | struct bfs_inode *di; |
146 | struct buffer_head * bh; | 146 | struct buffer_head *bh; |
147 | int block, off; | 147 | int block, off; |
148 | struct super_block * s = inode->i_sb; | 148 | struct super_block *s = inode->i_sb; |
149 | struct bfs_sb_info * info = BFS_SB(s); | 149 | struct bfs_sb_info *info = BFS_SB(s); |
150 | struct bfs_inode_info * bi = BFS_I(inode); | 150 | struct bfs_inode_info *bi = BFS_I(inode); |
151 | 151 | ||
152 | dprintf("ino=%08lx\n", ino); | 152 | dprintf("ino=%08lx\n", ino); |
153 | 153 | ||
154 | truncate_inode_pages(&inode->i_data, 0); | 154 | truncate_inode_pages(&inode->i_data, 0); |
155 | 155 | ||
156 | if (ino < BFS_ROOT_INO || ino > info->si_lasti) { | 156 | if ((ino < BFS_ROOT_INO) || (ino > info->si_lasti)) { |
157 | printf("invalid ino=%08lx\n", ino); | 157 | printf("invalid ino=%08lx\n", ino); |
158 | return; | 158 | return; |
159 | } | 159 | } |
@@ -162,31 +162,35 @@ static void bfs_delete_inode(struct inode * inode) | |||
162 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; | 162 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; |
163 | lock_kernel(); | 163 | lock_kernel(); |
164 | mark_inode_dirty(inode); | 164 | mark_inode_dirty(inode); |
165 | block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; | 165 | |
166 | block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; | ||
166 | bh = sb_bread(s, block); | 167 | bh = sb_bread(s, block); |
167 | if (!bh) { | 168 | if (!bh) { |
168 | printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino); | 169 | printf("Unable to read inode %s:%08lx\n", |
170 | inode->i_sb->s_id, ino); | ||
169 | unlock_kernel(); | 171 | unlock_kernel(); |
170 | return; | 172 | return; |
171 | } | 173 | } |
172 | off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK; | 174 | off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; |
173 | di = (struct bfs_inode *) bh->b_data + off; | 175 | di = (struct bfs_inode *)bh->b_data + off; |
176 | memset((void *)di, 0, sizeof(struct bfs_inode)); | ||
177 | mark_buffer_dirty(bh); | ||
178 | brelse(bh); | ||
179 | |||
174 | if (bi->i_dsk_ino) { | 180 | if (bi->i_dsk_ino) { |
175 | info->si_freeb += 1 + bi->i_eblock - bi->i_sblock; | 181 | info->si_freeb += BFS_FILEBLOCKS(bi); |
176 | info->si_freei++; | 182 | info->si_freei++; |
177 | clear_bit(ino, info->si_imap); | 183 | clear_bit(ino, info->si_imap); |
178 | dump_imap("delete_inode", s); | 184 | dump_imap("delete_inode", s); |
179 | } | 185 | } |
180 | di->i_ino = 0; | ||
181 | di->i_sblock = 0; | ||
182 | mark_buffer_dirty(bh); | ||
183 | brelse(bh); | ||
184 | 186 | ||
185 | /* if this was the last file, make the previous | 187 | /* |
186 | block "last files last block" even if there is no real file there, | 188 | * If this was the last file, make the previous block |
187 | saves us 1 gap */ | 189 | * "last block of the last file" even if there is no |
188 | if (info->si_lf_eblk == BFS_I(inode)->i_eblock) { | 190 | * real file there, saves us 1 gap. |
189 | info->si_lf_eblk = BFS_I(inode)->i_sblock - 1; | 191 | */ |
192 | if (info->si_lf_eblk == bi->i_eblock) { | ||
193 | info->si_lf_eblk = bi->i_sblock - 1; | ||
190 | mark_buffer_dirty(info->si_sbh); | 194 | mark_buffer_dirty(info->si_sbh); |
191 | } | 195 | } |
192 | unlock_kernel(); | 196 | unlock_kernel(); |
@@ -228,7 +232,7 @@ static void bfs_write_super(struct super_block *s) | |||
228 | unlock_kernel(); | 232 | unlock_kernel(); |
229 | } | 233 | } |
230 | 234 | ||
231 | static struct kmem_cache * bfs_inode_cachep; | 235 | static struct kmem_cache *bfs_inode_cachep; |
232 | 236 | ||
233 | static struct inode *bfs_alloc_inode(struct super_block *sb) | 237 | static struct inode *bfs_alloc_inode(struct super_block *sb) |
234 | { | 238 | { |
@@ -279,7 +283,7 @@ static const struct super_operations bfs_sops = { | |||
279 | .statfs = bfs_statfs, | 283 | .statfs = bfs_statfs, |
280 | }; | 284 | }; |
281 | 285 | ||
282 | void dump_imap(const char *prefix, struct super_block * s) | 286 | void dump_imap(const char *prefix, struct super_block *s) |
283 | { | 287 | { |
284 | #ifdef DEBUG | 288 | #ifdef DEBUG |
285 | int i; | 289 | int i; |
@@ -287,25 +291,26 @@ void dump_imap(const char *prefix, struct super_block * s) | |||
287 | 291 | ||
288 | if (!tmpbuf) | 292 | if (!tmpbuf) |
289 | return; | 293 | return; |
290 | for (i=BFS_SB(s)->si_lasti; i>=0; i--) { | 294 | for (i = BFS_SB(s)->si_lasti; i >= 0; i--) { |
291 | if (i > PAGE_SIZE-100) break; | 295 | if (i > PAGE_SIZE - 100) break; |
292 | if (test_bit(i, BFS_SB(s)->si_imap)) | 296 | if (test_bit(i, BFS_SB(s)->si_imap)) |
293 | strcat(tmpbuf, "1"); | 297 | strcat(tmpbuf, "1"); |
294 | else | 298 | else |
295 | strcat(tmpbuf, "0"); | 299 | strcat(tmpbuf, "0"); |
296 | } | 300 | } |
297 | printk(KERN_ERR "BFS-fs: %s: lasti=%08lx <%s>\n", prefix, BFS_SB(s)->si_lasti, tmpbuf); | 301 | printf("BFS-fs: %s: lasti=%08lx <%s>\n", |
302 | prefix, BFS_SB(s)->si_lasti, tmpbuf); | ||
298 | free_page((unsigned long)tmpbuf); | 303 | free_page((unsigned long)tmpbuf); |
299 | #endif | 304 | #endif |
300 | } | 305 | } |
301 | 306 | ||
302 | static int bfs_fill_super(struct super_block *s, void *data, int silent) | 307 | static int bfs_fill_super(struct super_block *s, void *data, int silent) |
303 | { | 308 | { |
304 | struct buffer_head * bh; | 309 | struct buffer_head *bh; |
305 | struct bfs_super_block * bfs_sb; | 310 | struct bfs_super_block *bfs_sb; |
306 | struct inode * inode; | 311 | struct inode *inode; |
307 | unsigned i, imap_len; | 312 | unsigned i, imap_len; |
308 | struct bfs_sb_info * info; | 313 | struct bfs_sb_info *info; |
309 | 314 | ||
310 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 315 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
311 | if (!info) | 316 | if (!info) |
@@ -329,14 +334,14 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
329 | 334 | ||
330 | s->s_magic = BFS_MAGIC; | 335 | s->s_magic = BFS_MAGIC; |
331 | info->si_sbh = bh; | 336 | info->si_sbh = bh; |
332 | info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE)/sizeof(struct bfs_inode) | 337 | info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE) / |
333 | + BFS_ROOT_INO - 1; | 338 | sizeof(struct bfs_inode) |
334 | 339 | + BFS_ROOT_INO - 1; | |
335 | imap_len = info->si_lasti/8 + 1; | 340 | imap_len = (info->si_lasti / 8) + 1; |
336 | info->si_imap = kzalloc(imap_len, GFP_KERNEL); | 341 | info->si_imap = kzalloc(imap_len, GFP_KERNEL); |
337 | if (!info->si_imap) | 342 | if (!info->si_imap) |
338 | goto out; | 343 | goto out; |
339 | for (i=0; i<BFS_ROOT_INO; i++) | 344 | for (i = 0; i < BFS_ROOT_INO; i++) |
340 | set_bit(i, info->si_imap); | 345 | set_bit(i, info->si_imap); |
341 | 346 | ||
342 | s->s_op = &bfs_sops; | 347 | s->s_op = &bfs_sops; |
@@ -352,16 +357,15 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
352 | goto out; | 357 | goto out; |
353 | } | 358 | } |
354 | 359 | ||
355 | info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1)>>BFS_BSIZE_BITS; /* for statfs(2) */ | 360 | info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1) >> BFS_BSIZE_BITS; |
356 | info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1 - le32_to_cpu(bfs_sb->s_start))>>BFS_BSIZE_BITS; | 361 | info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1 |
362 | - le32_to_cpu(bfs_sb->s_start)) >> BFS_BSIZE_BITS; | ||
357 | info->si_freei = 0; | 363 | info->si_freei = 0; |
358 | info->si_lf_eblk = 0; | 364 | info->si_lf_eblk = 0; |
359 | info->si_lf_sblk = 0; | ||
360 | info->si_lf_ioff = 0; | ||
361 | bh = NULL; | 365 | bh = NULL; |
362 | for (i=BFS_ROOT_INO; i<=info->si_lasti; i++) { | 366 | for (i = BFS_ROOT_INO; i <= info->si_lasti; i++) { |
363 | struct bfs_inode *di; | 367 | struct bfs_inode *di; |
364 | int block = (i - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; | 368 | int block = (i - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; |
365 | int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; | 369 | int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; |
366 | unsigned long sblock, eblock; | 370 | unsigned long sblock, eblock; |
367 | 371 | ||
@@ -384,11 +388,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
384 | 388 | ||
385 | sblock = le32_to_cpu(di->i_sblock); | 389 | sblock = le32_to_cpu(di->i_sblock); |
386 | eblock = le32_to_cpu(di->i_eblock); | 390 | eblock = le32_to_cpu(di->i_eblock); |
387 | if (eblock > info->si_lf_eblk) { | 391 | if (eblock > info->si_lf_eblk) |
388 | info->si_lf_eblk = eblock; | 392 | info->si_lf_eblk = eblock; |
389 | info->si_lf_sblk = sblock; | ||
390 | info->si_lf_ioff = BFS_INO2OFF(i); | ||
391 | } | ||
392 | } | 393 | } |
393 | brelse(bh); | 394 | brelse(bh); |
394 | if (!(s->s_flags & MS_RDONLY)) { | 395 | if (!(s->s_flags & MS_RDONLY)) { |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 3d419163c3d3..64dd22239b21 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,3 +1,7 @@ | |||
1 | Version 1.52 | ||
2 | ------------ | ||
3 | Fix oops on second mount to server when null auth is used. | ||
4 | |||
1 | Version 1.51 | 5 | Version 1.51 |
2 | ------------ | 6 | ------------ |
3 | Fix memory leak in statfs when mounted to very old servers (e.g. | 7 | Fix memory leak in statfs when mounted to very old servers (e.g. |
@@ -12,7 +16,12 @@ leak that causes cifsd not to stop and rmmod to fail to cleanup | |||
12 | cifs_request_buffers pool. Fix problem with POSIX Open/Mkdir on | 16 | cifs_request_buffers pool. Fix problem with POSIX Open/Mkdir on |
13 | bigendian architectures. Fix possible memory corruption when | 17 | bigendian architectures. Fix possible memory corruption when |
14 | EAGAIN returned on kern_recvmsg. Return better error if server | 18 | EAGAIN returned on kern_recvmsg. Return better error if server |
15 | requires packet signing but client has disabled it. | 19 | requires packet signing but client has disabled it. When mounted |
20 | with cifsacl mount option - mode bits are approximated based | ||
21 | on the contents of the ACL of the file or directory. When cifs | ||
22 | mount helper is missing convert make sure that UNC name | ||
23 | has backslash (not forward slash) between ip address of server | ||
24 | and the share name. | ||
16 | 25 | ||
17 | Version 1.50 | 26 | Version 1.50 |
18 | ------------ | 27 | ------------ |
diff --git a/fs/cifs/Makefile b/fs/cifs/Makefile index ff6ba8d823f0..45e42fb97c19 100644 --- a/fs/cifs/Makefile +++ b/fs/cifs/Makefile | |||
@@ -3,4 +3,9 @@ | |||
3 | # | 3 | # |
4 | obj-$(CONFIG_CIFS) += cifs.o | 4 | obj-$(CONFIG_CIFS) += cifs.o |
5 | 5 | ||
6 | cifs-objs := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o link.o misc.o netmisc.o smbdes.o smbencrypt.o transport.o asn1.o md4.o md5.o cifs_unicode.o nterr.o xattr.o cifsencrypt.o fcntl.o readdir.o ioctl.o sess.o export.o cifsacl.o | 6 | cifs-y := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o \ |
7 | link.o misc.o netmisc.o smbdes.o smbencrypt.o transport.o asn1.o \ | ||
8 | md4.o md5.o cifs_unicode.o nterr.o xattr.o cifsencrypt.o fcntl.o \ | ||
9 | readdir.o ioctl.o sess.o export.o cifsacl.o | ||
10 | |||
11 | cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o | ||
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c index 2a01f3ef96a0..bcda2c6b6a04 100644 --- a/fs/cifs/asn1.c +++ b/fs/cifs/asn1.c | |||
@@ -77,8 +77,12 @@ | |||
77 | 77 | ||
78 | #define SPNEGO_OID_LEN 7 | 78 | #define SPNEGO_OID_LEN 7 |
79 | #define NTLMSSP_OID_LEN 10 | 79 | #define NTLMSSP_OID_LEN 10 |
80 | #define KRB5_OID_LEN 7 | ||
81 | #define MSKRB5_OID_LEN 7 | ||
80 | static unsigned long SPNEGO_OID[7] = { 1, 3, 6, 1, 5, 5, 2 }; | 82 | static unsigned long SPNEGO_OID[7] = { 1, 3, 6, 1, 5, 5, 2 }; |
81 | static unsigned long NTLMSSP_OID[10] = { 1, 3, 6, 1, 4, 1, 311, 2, 2, 10 }; | 83 | static unsigned long NTLMSSP_OID[10] = { 1, 3, 6, 1, 4, 1, 311, 2, 2, 10 }; |
84 | static unsigned long KRB5_OID[7] = { 1, 2, 840, 113554, 1, 2, 2 }; | ||
85 | static unsigned long MSKRB5_OID[7] = { 1, 2, 840, 48018, 1, 2, 2 }; | ||
82 | 86 | ||
83 | /* | 87 | /* |
84 | * ASN.1 context. | 88 | * ASN.1 context. |
@@ -457,6 +461,7 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
457 | unsigned long *oid = NULL; | 461 | unsigned long *oid = NULL; |
458 | unsigned int cls, con, tag, oidlen, rc; | 462 | unsigned int cls, con, tag, oidlen, rc; |
459 | int use_ntlmssp = FALSE; | 463 | int use_ntlmssp = FALSE; |
464 | int use_kerberos = FALSE; | ||
460 | 465 | ||
461 | *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/ | 466 | *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/ |
462 | 467 | ||
@@ -545,18 +550,28 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
545 | return 0; | 550 | return 0; |
546 | } | 551 | } |
547 | if ((tag == ASN1_OJI) && (con == ASN1_PRI)) { | 552 | if ((tag == ASN1_OJI) && (con == ASN1_PRI)) { |
548 | rc = asn1_oid_decode(&ctx, end, &oid, &oidlen); | 553 | if (asn1_oid_decode(&ctx, end, &oid, &oidlen)) { |
549 | if (rc) { | 554 | |
550 | cFYI(1, | 555 | cFYI(1, |
551 | ("OID len = %d oid = 0x%lx 0x%lx " | 556 | ("OID len = %d oid = 0x%lx 0x%lx " |
552 | "0x%lx 0x%lx", | 557 | "0x%lx 0x%lx", |
553 | oidlen, *oid, *(oid + 1), | 558 | oidlen, *oid, *(oid + 1), |
554 | *(oid + 2), *(oid + 3))); | 559 | *(oid + 2), *(oid + 3))); |
555 | rc = compare_oid(oid, oidlen, | 560 | |
556 | NTLMSSP_OID, NTLMSSP_OID_LEN); | 561 | if (compare_oid(oid, oidlen, |
557 | kfree(oid); | 562 | MSKRB5_OID, |
558 | if (rc) | 563 | MSKRB5_OID_LEN)) |
564 | use_kerberos = TRUE; | ||
565 | else if (compare_oid(oid, oidlen, | ||
566 | KRB5_OID, | ||
567 | KRB5_OID_LEN)) | ||
568 | use_kerberos = TRUE; | ||
569 | else if (compare_oid(oid, oidlen, | ||
570 | NTLMSSP_OID, | ||
571 | NTLMSSP_OID_LEN)) | ||
559 | use_ntlmssp = TRUE; | 572 | use_ntlmssp = TRUE; |
573 | |||
574 | kfree(oid); | ||
560 | } | 575 | } |
561 | } else { | 576 | } else { |
562 | cFYI(1, ("Should be an oid what is going on?")); | 577 | cFYI(1, ("Should be an oid what is going on?")); |
@@ -609,12 +624,10 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
609 | ctx.pointer)); /* is this UTF-8 or ASCII? */ | 624 | ctx.pointer)); /* is this UTF-8 or ASCII? */ |
610 | } | 625 | } |
611 | 626 | ||
612 | /* if (use_kerberos) | 627 | if (use_kerberos) |
613 | *secType = Kerberos | 628 | *secType = Kerberos; |
614 | else */ | 629 | else if (use_ntlmssp) |
615 | if (use_ntlmssp) { | ||
616 | *secType = NTLMSSP; | 630 | *secType = NTLMSSP; |
617 | } | ||
618 | 631 | ||
619 | return 1; | 632 | return 1; |
620 | } | 633 | } |
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c new file mode 100644 index 000000000000..ad54a3a6e434 --- /dev/null +++ b/fs/cifs/cifs_spnego.c | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | * fs/cifs/cifs_spnego.c -- SPNEGO upcall management for CIFS | ||
3 | * | ||
4 | * Copyright (c) 2007 Red Hat, Inc. | ||
5 | * Author(s): Jeff Layton (jlayton@redhat.com) | ||
6 | * | ||
7 | * This library is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU Lesser General Public License as published | ||
9 | * by the Free Software Foundation; either version 2.1 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This library is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
15 | * the GNU Lesser General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public License | ||
18 | * along with this library; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #include <linux/list.h> | ||
23 | #include <linux/string.h> | ||
24 | #include <keys/user-type.h> | ||
25 | #include <linux/key-type.h> | ||
26 | #include "cifsglob.h" | ||
27 | #include "cifs_spnego.h" | ||
28 | #include "cifs_debug.h" | ||
29 | |||
30 | /* create a new cifs key */ | ||
31 | static int | ||
32 | cifs_spnego_key_instantiate(struct key *key, const void *data, size_t datalen) | ||
33 | { | ||
34 | char *payload; | ||
35 | int ret; | ||
36 | |||
37 | ret = -ENOMEM; | ||
38 | payload = kmalloc(datalen, GFP_KERNEL); | ||
39 | if (!payload) | ||
40 | goto error; | ||
41 | |||
42 | /* attach the data */ | ||
43 | memcpy(payload, data, datalen); | ||
44 | rcu_assign_pointer(key->payload.data, payload); | ||
45 | ret = 0; | ||
46 | |||
47 | error: | ||
48 | return ret; | ||
49 | } | ||
50 | |||
51 | static void | ||
52 | cifs_spnego_key_destroy(struct key *key) | ||
53 | { | ||
54 | kfree(key->payload.data); | ||
55 | } | ||
56 | |||
57 | |||
58 | /* | ||
59 | * keytype for CIFS spnego keys | ||
60 | */ | ||
61 | struct key_type cifs_spnego_key_type = { | ||
62 | .name = "cifs.spnego", | ||
63 | .instantiate = cifs_spnego_key_instantiate, | ||
64 | .match = user_match, | ||
65 | .destroy = cifs_spnego_key_destroy, | ||
66 | .describe = user_describe, | ||
67 | }; | ||
68 | |||
69 | /* get a key struct with a SPNEGO security blob, suitable for session setup */ | ||
70 | struct key * | ||
71 | cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname) | ||
72 | { | ||
73 | struct TCP_Server_Info *server = sesInfo->server; | ||
74 | char *description, *dp; | ||
75 | size_t desc_len; | ||
76 | struct key *spnego_key; | ||
77 | |||
78 | |||
79 | /* version + ;ip{4|6}= + address + ;host=hostname + | ||
80 | ;sec= + ;uid= + NULL */ | ||
81 | desc_len = 4 + 5 + 32 + 1 + 5 + strlen(hostname) + | ||
82 | strlen(";sec=krb5") + 7 + sizeof(uid_t)*2 + 1; | ||
83 | spnego_key = ERR_PTR(-ENOMEM); | ||
84 | description = kzalloc(desc_len, GFP_KERNEL); | ||
85 | if (description == NULL) | ||
86 | goto out; | ||
87 | |||
88 | dp = description; | ||
89 | /* start with version and hostname portion of UNC string */ | ||
90 | spnego_key = ERR_PTR(-EINVAL); | ||
91 | sprintf(dp, "0x%2.2x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION, | ||
92 | hostname); | ||
93 | dp = description + strlen(description); | ||
94 | |||
95 | /* add the server address */ | ||
96 | if (server->addr.sockAddr.sin_family == AF_INET) | ||
97 | sprintf(dp, "ip4=" NIPQUAD_FMT, | ||
98 | NIPQUAD(server->addr.sockAddr.sin_addr)); | ||
99 | else if (server->addr.sockAddr.sin_family == AF_INET6) | ||
100 | sprintf(dp, "ip6=" NIP6_SEQFMT, | ||
101 | NIP6(server->addr.sockAddr6.sin6_addr)); | ||
102 | else | ||
103 | goto out; | ||
104 | |||
105 | dp = description + strlen(description); | ||
106 | |||
107 | /* for now, only sec=krb5 is valid */ | ||
108 | if (server->secType == Kerberos) | ||
109 | sprintf(dp, ";sec=krb5"); | ||
110 | else | ||
111 | goto out; | ||
112 | |||
113 | dp = description + strlen(description); | ||
114 | sprintf(dp, ";uid=0x%x", sesInfo->linux_uid); | ||
115 | |||
116 | cFYI(1, ("key description = %s", description)); | ||
117 | spnego_key = request_key(&cifs_spnego_key_type, description, ""); | ||
118 | |||
119 | if (cifsFYI && !IS_ERR(spnego_key)) { | ||
120 | struct cifs_spnego_msg *msg = spnego_key->payload.data; | ||
121 | cifs_dump_mem("SPNEGO reply blob:", msg->data, | ||
122 | msg->secblob_len + msg->sesskey_len); | ||
123 | } | ||
124 | |||
125 | out: | ||
126 | kfree(description); | ||
127 | return spnego_key; | ||
128 | } | ||
diff --git a/fs/cifs/cifs_spnego.h b/fs/cifs/cifs_spnego.h new file mode 100644 index 000000000000..f443f3b35134 --- /dev/null +++ b/fs/cifs/cifs_spnego.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * fs/cifs/cifs_spnego.h -- SPNEGO upcall management for CIFS | ||
3 | * | ||
4 | * Copyright (c) 2007 Red Hat, Inc. | ||
5 | * Author(s): Jeff Layton (jlayton@redhat.com) | ||
6 | * Steve French (sfrench@us.ibm.com) | ||
7 | * | ||
8 | * This library is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU Lesser General Public License as published | ||
10 | * by the Free Software Foundation; either version 2.1 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This library is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
16 | * the GNU Lesser General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public License | ||
19 | * along with this library; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef _CIFS_SPNEGO_H | ||
24 | #define _CIFS_SPNEGO_H | ||
25 | |||
26 | #define CIFS_SPNEGO_UPCALL_VERSION 1 | ||
27 | |||
28 | /* | ||
29 | * The version field should always be set to CIFS_SPNEGO_UPCALL_VERSION. | ||
30 | * The flags field is for future use. The request-key callout should set | ||
31 | * sesskey_len and secblob_len, and then concatenate the SessKey+SecBlob | ||
32 | * and stuff it in the data field. | ||
33 | */ | ||
34 | struct cifs_spnego_msg { | ||
35 | uint32_t version; | ||
36 | uint32_t flags; | ||
37 | uint32_t sesskey_len; | ||
38 | uint32_t secblob_len; | ||
39 | uint8_t data[1]; | ||
40 | }; | ||
41 | |||
42 | #ifdef __KERNEL__ | ||
43 | extern struct key_type cifs_spnego_key_type; | ||
44 | #endif /* KERNEL */ | ||
45 | |||
46 | #endif /* _CIFS_SPNEGO_H */ | ||
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index e8e56353f5a1..dabbce00712b 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
@@ -38,13 +38,13 @@ static struct cifs_wksid wksidarr[NUM_WK_SIDS] = { | |||
38 | {{1, 1, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(18), 0, 0, 0, 0} }, "sys"}, | 38 | {{1, 1, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(18), 0, 0, 0, 0} }, "sys"}, |
39 | {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(544), 0, 0, 0} }, "root"}, | 39 | {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(544), 0, 0, 0} }, "root"}, |
40 | {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(545), 0, 0, 0} }, "users"}, | 40 | {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(545), 0, 0, 0} }, "users"}, |
41 | {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(546), 0, 0, 0} }, "guest"} | 41 | {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(546), 0, 0, 0} }, "guest"} } |
42 | }; | 42 | ; |
43 | 43 | ||
44 | 44 | ||
45 | /* security id for everyone */ | 45 | /* security id for everyone */ |
46 | static const struct cifs_sid sid_everyone = | 46 | static const struct cifs_sid sid_everyone = { |
47 | {1, 1, {0, 0, 0, 0, 0, 0}, {} }; | 47 | 1, 1, {0, 0, 0, 0, 0, 1}, {0} }; |
48 | /* group users */ | 48 | /* group users */ |
49 | static const struct cifs_sid sid_user = | 49 | static const struct cifs_sid sid_user = |
50 | {1, 2 , {0, 0, 0, 0, 0, 5}, {} }; | 50 | {1, 2 , {0, 0, 0, 0, 0, 5}, {} }; |
@@ -97,7 +97,7 @@ int match_sid(struct cifs_sid *ctsid) | |||
97 | 97 | ||
98 | /* if the two SIDs (roughly equivalent to a UUID for a user or group) are | 98 | /* if the two SIDs (roughly equivalent to a UUID for a user or group) are |
99 | the same returns 1, if they do not match returns 0 */ | 99 | the same returns 1, if they do not match returns 0 */ |
100 | int compare_sids(struct cifs_sid *ctsid, struct cifs_sid *cwsid) | 100 | int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid) |
101 | { | 101 | { |
102 | int i; | 102 | int i; |
103 | int num_subauth, num_sat, num_saw; | 103 | int num_subauth, num_sat, num_saw; |
@@ -129,66 +129,142 @@ int compare_sids(struct cifs_sid *ctsid, struct cifs_sid *cwsid) | |||
129 | return (1); /* sids compare/match */ | 129 | return (1); /* sids compare/match */ |
130 | } | 130 | } |
131 | 131 | ||
132 | /* | ||
133 | change posix mode to reflect permissions | ||
134 | pmode is the existing mode (we only want to overwrite part of this | ||
135 | bits to set can be: S_IRWXU, S_IRWXG or S_IRWXO ie 00700 or 00070 or 00007 | ||
136 | */ | ||
137 | static void access_flags_to_mode(__u32 ace_flags, int type, umode_t *pmode, | ||
138 | umode_t *pbits_to_set) | ||
139 | { | ||
140 | /* the order of ACEs is important. The canonical order is to begin with | ||
141 | DENY entries followed by ALLOW, otherwise an allow entry could be | ||
142 | encountered first, making the subsequent deny entry like "dead code" | ||
143 | which would be superflous since Windows stops when a match is made | ||
144 | for the operation you are trying to perform for your user */ | ||
145 | |||
146 | /* For deny ACEs we change the mask so that subsequent allow access | ||
147 | control entries do not turn on the bits we are denying */ | ||
148 | if (type == ACCESS_DENIED) { | ||
149 | if (ace_flags & GENERIC_ALL) { | ||
150 | *pbits_to_set &= ~S_IRWXUGO; | ||
151 | } | ||
152 | if ((ace_flags & GENERIC_WRITE) || | ||
153 | ((ace_flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) | ||
154 | *pbits_to_set &= ~S_IWUGO; | ||
155 | if ((ace_flags & GENERIC_READ) || | ||
156 | ((ace_flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS)) | ||
157 | *pbits_to_set &= ~S_IRUGO; | ||
158 | if ((ace_flags & GENERIC_EXECUTE) || | ||
159 | ((ace_flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) | ||
160 | *pbits_to_set &= ~S_IXUGO; | ||
161 | return; | ||
162 | } else if (type != ACCESS_ALLOWED) { | ||
163 | cERROR(1, ("unknown access control type %d", type)); | ||
164 | return; | ||
165 | } | ||
166 | /* else ACCESS_ALLOWED type */ | ||
167 | |||
168 | if (ace_flags & GENERIC_ALL) { | ||
169 | *pmode |= (S_IRWXUGO & (*pbits_to_set)); | ||
170 | #ifdef CONFIG_CIFS_DEBUG2 | ||
171 | cFYI(1, ("all perms")); | ||
172 | #endif | ||
173 | return; | ||
174 | } | ||
175 | if ((ace_flags & GENERIC_WRITE) || | ||
176 | ((ace_flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) | ||
177 | *pmode |= (S_IWUGO & (*pbits_to_set)); | ||
178 | if ((ace_flags & GENERIC_READ) || | ||
179 | ((ace_flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS)) | ||
180 | *pmode |= (S_IRUGO & (*pbits_to_set)); | ||
181 | if ((ace_flags & GENERIC_EXECUTE) || | ||
182 | ((ace_flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) | ||
183 | *pmode |= (S_IXUGO & (*pbits_to_set)); | ||
184 | |||
185 | #ifdef CONFIG_CIFS_DEBUG2 | ||
186 | cFYI(1, ("access flags 0x%x mode now 0x%x", ace_flags, *pmode)); | ||
187 | #endif | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | /* | ||
192 | Generate access flags to reflect permissions mode is the existing mode. | ||
193 | This function is called for every ACE in the DACL whose SID matches | ||
194 | with either owner or group or everyone. | ||
195 | */ | ||
196 | |||
197 | static void mode_to_access_flags(umode_t mode, umode_t bits_to_use, | ||
198 | __u32 *pace_flags) | ||
199 | { | ||
200 | /* reset access mask */ | ||
201 | *pace_flags = 0x0; | ||
202 | |||
203 | /* bits to use are either S_IRWXU or S_IRWXG or S_IRWXO */ | ||
204 | mode &= bits_to_use; | ||
205 | |||
206 | /* check for R/W/X UGO since we do not know whose flags | ||
207 | is this but we have cleared all the bits sans RWX for | ||
208 | either user or group or other as per bits_to_use */ | ||
209 | if (mode & S_IRUGO) | ||
210 | *pace_flags |= SET_FILE_READ_RIGHTS; | ||
211 | if (mode & S_IWUGO) | ||
212 | *pace_flags |= SET_FILE_WRITE_RIGHTS; | ||
213 | if (mode & S_IXUGO) | ||
214 | *pace_flags |= SET_FILE_EXEC_RIGHTS; | ||
215 | |||
216 | #ifdef CONFIG_CIFS_DEBUG2 | ||
217 | cFYI(1, ("mode: 0x%x, access flags now 0x%x", mode, *pace_flags)); | ||
218 | #endif | ||
219 | return; | ||
220 | } | ||
221 | |||
132 | 222 | ||
133 | static void parse_ace(struct cifs_ace *pace, char *end_of_acl) | 223 | #ifdef CONFIG_CIFS_DEBUG2 |
224 | static void dump_ace(struct cifs_ace *pace, char *end_of_acl) | ||
134 | { | 225 | { |
135 | int num_subauth; | 226 | int num_subauth; |
136 | 227 | ||
137 | /* validate that we do not go past end of acl */ | 228 | /* validate that we do not go past end of acl */ |
138 | 229 | ||
139 | /* XXX this if statement can be removed | 230 | if (le16_to_cpu(pace->size) < 16) { |
140 | if (end_of_acl < (char *)pace + sizeof(struct cifs_ace)) { | 231 | cERROR(1, ("ACE too small, %d", le16_to_cpu(pace->size))); |
232 | return; | ||
233 | } | ||
234 | |||
235 | if (end_of_acl < (char *)pace + le16_to_cpu(pace->size)) { | ||
141 | cERROR(1, ("ACL too small to parse ACE")); | 236 | cERROR(1, ("ACL too small to parse ACE")); |
142 | return; | 237 | return; |
143 | } */ | 238 | } |
144 | 239 | ||
145 | num_subauth = pace->num_subauth; | 240 | num_subauth = pace->sid.num_subauth; |
146 | if (num_subauth) { | 241 | if (num_subauth) { |
147 | #ifdef CONFIG_CIFS_DEBUG2 | ||
148 | int i; | 242 | int i; |
149 | cFYI(1, ("ACE revision %d num_subauth %d", | 243 | cFYI(1, ("ACE revision %d num_auth %d type %d flags %d size %d", |
150 | pace->revision, pace->num_subauth)); | 244 | pace->sid.revision, pace->sid.num_subauth, pace->type, |
245 | pace->flags, pace->size)); | ||
151 | for (i = 0; i < num_subauth; ++i) { | 246 | for (i = 0; i < num_subauth; ++i) { |
152 | cFYI(1, ("ACE sub_auth[%d]: 0x%x", i, | 247 | cFYI(1, ("ACE sub_auth[%d]: 0x%x", i, |
153 | le32_to_cpu(pace->sub_auth[i]))); | 248 | le32_to_cpu(pace->sid.sub_auth[i]))); |
154 | } | 249 | } |
155 | 250 | ||
156 | /* BB add length check to make sure that we do not have huge | 251 | /* BB add length check to make sure that we do not have huge |
157 | num auths and therefore go off the end */ | 252 | num auths and therefore go off the end */ |
158 | |||
159 | cFYI(1, ("RID %d", le32_to_cpu(pace->sub_auth[num_subauth-1]))); | ||
160 | #endif | ||
161 | } | 253 | } |
162 | 254 | ||
163 | return; | 255 | return; |
164 | } | 256 | } |
165 | |||
166 | static void parse_ntace(struct cifs_ntace *pntace, char *end_of_acl) | ||
167 | { | ||
168 | /* validate that we do not go past end of acl */ | ||
169 | if (end_of_acl < (char *)pntace + sizeof(struct cifs_ntace)) { | ||
170 | cERROR(1, ("ACL too small to parse NT ACE")); | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | #ifdef CONFIG_CIFS_DEBUG2 | ||
175 | cFYI(1, ("NTACE type %d flags 0x%x size %d, access Req 0x%x", | ||
176 | pntace->type, pntace->flags, pntace->size, | ||
177 | pntace->access_req)); | ||
178 | #endif | 257 | #endif |
179 | return; | ||
180 | } | ||
181 | |||
182 | 258 | ||
183 | 259 | ||
184 | static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, | 260 | static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, |
185 | struct cifs_sid *pownersid, struct cifs_sid *pgrpsid) | 261 | struct cifs_sid *pownersid, struct cifs_sid *pgrpsid, |
262 | struct inode *inode) | ||
186 | { | 263 | { |
187 | int i; | 264 | int i; |
188 | int num_aces = 0; | 265 | int num_aces = 0; |
189 | int acl_size; | 266 | int acl_size; |
190 | char *acl_base; | 267 | char *acl_base; |
191 | struct cifs_ntace **ppntace; | ||
192 | struct cifs_ace **ppace; | 268 | struct cifs_ace **ppace; |
193 | 269 | ||
194 | /* BB need to add parm so we can store the SID BB */ | 270 | /* BB need to add parm so we can store the SID BB */ |
@@ -205,50 +281,63 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, | |||
205 | le32_to_cpu(pdacl->num_aces))); | 281 | le32_to_cpu(pdacl->num_aces))); |
206 | #endif | 282 | #endif |
207 | 283 | ||
284 | /* reset rwx permissions for user/group/other. | ||
285 | Also, if num_aces is 0 i.e. DACL has no ACEs, | ||
286 | user/group/other have no permissions */ | ||
287 | inode->i_mode &= ~(S_IRWXUGO); | ||
288 | |||
289 | if (!pdacl) { | ||
290 | /* no DACL in the security descriptor, set | ||
291 | all the permissions for user/group/other */ | ||
292 | inode->i_mode |= S_IRWXUGO; | ||
293 | return; | ||
294 | } | ||
208 | acl_base = (char *)pdacl; | 295 | acl_base = (char *)pdacl; |
209 | acl_size = sizeof(struct cifs_acl); | 296 | acl_size = sizeof(struct cifs_acl); |
210 | 297 | ||
211 | num_aces = le32_to_cpu(pdacl->num_aces); | 298 | num_aces = le32_to_cpu(pdacl->num_aces); |
212 | if (num_aces > 0) { | 299 | if (num_aces > 0) { |
213 | ppntace = kmalloc(num_aces * sizeof(struct cifs_ntace *), | 300 | umode_t user_mask = S_IRWXU; |
214 | GFP_KERNEL); | 301 | umode_t group_mask = S_IRWXG; |
302 | umode_t other_mask = S_IRWXO; | ||
303 | |||
215 | ppace = kmalloc(num_aces * sizeof(struct cifs_ace *), | 304 | ppace = kmalloc(num_aces * sizeof(struct cifs_ace *), |
216 | GFP_KERNEL); | 305 | GFP_KERNEL); |
217 | 306 | ||
218 | /* cifscred->cecount = pdacl->num_aces; | 307 | /* cifscred->cecount = pdacl->num_aces; |
219 | cifscred->ntaces = kmalloc(num_aces * | ||
220 | sizeof(struct cifs_ntace *), GFP_KERNEL); | ||
221 | cifscred->aces = kmalloc(num_aces * | 308 | cifscred->aces = kmalloc(num_aces * |
222 | sizeof(struct cifs_ace *), GFP_KERNEL);*/ | 309 | sizeof(struct cifs_ace *), GFP_KERNEL);*/ |
223 | 310 | ||
224 | for (i = 0; i < num_aces; ++i) { | 311 | for (i = 0; i < num_aces; ++i) { |
225 | ppntace[i] = (struct cifs_ntace *) | 312 | ppace[i] = (struct cifs_ace *) (acl_base + acl_size); |
226 | (acl_base + acl_size); | 313 | #ifdef CONFIG_CIFS_DEBUG2 |
227 | ppace[i] = (struct cifs_ace *) ((char *)ppntace[i] + | 314 | dump_ace(ppace[i], end_of_acl); |
228 | sizeof(struct cifs_ntace)); | 315 | #endif |
229 | 316 | if (compare_sids(&(ppace[i]->sid), pownersid)) | |
230 | parse_ntace(ppntace[i], end_of_acl); | 317 | access_flags_to_mode(ppace[i]->access_req, |
231 | if (end_of_acl < ((char *)ppace[i] + | 318 | ppace[i]->type, |
232 | (le16_to_cpu(ppntace[i]->size) - | 319 | &(inode->i_mode), |
233 | sizeof(struct cifs_ntace)))) { | 320 | &user_mask); |
234 | cERROR(1, ("ACL too small to parse ACE")); | 321 | if (compare_sids(&(ppace[i]->sid), pgrpsid)) |
235 | break; | 322 | access_flags_to_mode(ppace[i]->access_req, |
236 | } else | 323 | ppace[i]->type, |
237 | parse_ace(ppace[i], end_of_acl); | 324 | &(inode->i_mode), |
238 | 325 | &group_mask); | |
239 | /* memcpy((void *)(&(cifscred->ntaces[i])), | 326 | if (compare_sids(&(ppace[i]->sid), &sid_everyone)) |
240 | (void *)ppntace[i], | 327 | access_flags_to_mode(ppace[i]->access_req, |
241 | sizeof(struct cifs_ntace)); | 328 | ppace[i]->type, |
242 | memcpy((void *)(&(cifscred->aces[i])), | 329 | &(inode->i_mode), |
330 | &other_mask); | ||
331 | |||
332 | /* memcpy((void *)(&(cifscred->aces[i])), | ||
243 | (void *)ppace[i], | 333 | (void *)ppace[i], |
244 | sizeof(struct cifs_ace)); */ | 334 | sizeof(struct cifs_ace)); */ |
245 | 335 | ||
246 | acl_base = (char *)ppntace[i]; | 336 | acl_base = (char *)ppace[i]; |
247 | acl_size = le16_to_cpu(ppntace[i]->size); | 337 | acl_size = le16_to_cpu(ppace[i]->size); |
248 | } | 338 | } |
249 | 339 | ||
250 | kfree(ppace); | 340 | kfree(ppace); |
251 | kfree(ppntace); | ||
252 | } | 341 | } |
253 | 342 | ||
254 | return; | 343 | return; |
@@ -257,20 +346,20 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, | |||
257 | 346 | ||
258 | static int parse_sid(struct cifs_sid *psid, char *end_of_acl) | 347 | static int parse_sid(struct cifs_sid *psid, char *end_of_acl) |
259 | { | 348 | { |
260 | |||
261 | /* BB need to add parm so we can store the SID BB */ | 349 | /* BB need to add parm so we can store the SID BB */ |
262 | 350 | ||
263 | /* validate that we do not go past end of acl */ | 351 | /* validate that we do not go past end of ACL - sid must be at least 8 |
264 | if (end_of_acl < (char *)psid + sizeof(struct cifs_sid)) { | 352 | bytes long (assuming no sub-auths - e.g. the null SID */ |
265 | cERROR(1, ("ACL too small to parse SID")); | 353 | if (end_of_acl < (char *)psid + 8) { |
354 | cERROR(1, ("ACL too small to parse SID %p", psid)); | ||
266 | return -EINVAL; | 355 | return -EINVAL; |
267 | } | 356 | } |
268 | 357 | ||
269 | if (psid->num_subauth) { | 358 | if (psid->num_subauth) { |
270 | #ifdef CONFIG_CIFS_DEBUG2 | 359 | #ifdef CONFIG_CIFS_DEBUG2 |
271 | int i; | 360 | int i; |
272 | cFYI(1, ("SID revision %d num_auth %d First subauth 0x%x", | 361 | cFYI(1, ("SID revision %d num_auth %d", |
273 | psid->revision, psid->num_subauth, psid->sub_auth[0])); | 362 | psid->revision, psid->num_subauth)); |
274 | 363 | ||
275 | for (i = 0; i < psid->num_subauth; i++) { | 364 | for (i = 0; i < psid->num_subauth; i++) { |
276 | cFYI(1, ("SID sub_auth[%d]: 0x%x ", i, | 365 | cFYI(1, ("SID sub_auth[%d]: 0x%x ", i, |
@@ -289,27 +378,32 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl) | |||
289 | 378 | ||
290 | 379 | ||
291 | /* Convert CIFS ACL to POSIX form */ | 380 | /* Convert CIFS ACL to POSIX form */ |
292 | int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len) | 381 | static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len, |
382 | struct inode *inode) | ||
293 | { | 383 | { |
294 | int rc; | 384 | int rc; |
295 | struct cifs_sid *owner_sid_ptr, *group_sid_ptr; | 385 | struct cifs_sid *owner_sid_ptr, *group_sid_ptr; |
296 | struct cifs_acl *dacl_ptr; /* no need for SACL ptr */ | 386 | struct cifs_acl *dacl_ptr; /* no need for SACL ptr */ |
297 | char *end_of_acl = ((char *)pntsd) + acl_len; | 387 | char *end_of_acl = ((char *)pntsd) + acl_len; |
388 | __u32 dacloffset; | ||
389 | |||
390 | if ((inode == NULL) || (pntsd == NULL)) | ||
391 | return -EIO; | ||
298 | 392 | ||
299 | owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + | 393 | owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + |
300 | le32_to_cpu(pntsd->osidoffset)); | 394 | le32_to_cpu(pntsd->osidoffset)); |
301 | group_sid_ptr = (struct cifs_sid *)((char *)pntsd + | 395 | group_sid_ptr = (struct cifs_sid *)((char *)pntsd + |
302 | le32_to_cpu(pntsd->gsidoffset)); | 396 | le32_to_cpu(pntsd->gsidoffset)); |
303 | dacl_ptr = (struct cifs_acl *)((char *)pntsd + | 397 | dacloffset = le32_to_cpu(pntsd->dacloffset); |
304 | le32_to_cpu(pntsd->dacloffset)); | 398 | dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset); |
305 | #ifdef CONFIG_CIFS_DEBUG2 | 399 | #ifdef CONFIG_CIFS_DEBUG2 |
306 | cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " | 400 | cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " |
307 | "sacloffset 0x%x dacloffset 0x%x", | 401 | "sacloffset 0x%x dacloffset 0x%x", |
308 | pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), | 402 | pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), |
309 | le32_to_cpu(pntsd->gsidoffset), | 403 | le32_to_cpu(pntsd->gsidoffset), |
310 | le32_to_cpu(pntsd->sacloffset), | 404 | le32_to_cpu(pntsd->sacloffset), dacloffset)); |
311 | le32_to_cpu(pntsd->dacloffset))); | ||
312 | #endif | 405 | #endif |
406 | /* cifs_dump_mem("owner_sid: ", owner_sid_ptr, 64); */ | ||
313 | rc = parse_sid(owner_sid_ptr, end_of_acl); | 407 | rc = parse_sid(owner_sid_ptr, end_of_acl); |
314 | if (rc) | 408 | if (rc) |
315 | return rc; | 409 | return rc; |
@@ -318,16 +412,120 @@ int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len) | |||
318 | if (rc) | 412 | if (rc) |
319 | return rc; | 413 | return rc; |
320 | 414 | ||
321 | parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr, group_sid_ptr); | 415 | if (dacloffset) |
416 | parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr, | ||
417 | group_sid_ptr, inode); | ||
418 | else | ||
419 | cFYI(1, ("no ACL")); /* BB grant all or default perms? */ | ||
322 | 420 | ||
323 | /* cifscred->uid = owner_sid_ptr->rid; | 421 | /* cifscred->uid = owner_sid_ptr->rid; |
324 | cifscred->gid = group_sid_ptr->rid; | 422 | cifscred->gid = group_sid_ptr->rid; |
325 | memcpy((void *)(&(cifscred->osid)), (void *)owner_sid_ptr, | 423 | memcpy((void *)(&(cifscred->osid)), (void *)owner_sid_ptr, |
326 | sizeof (struct cifs_sid)); | 424 | sizeof(struct cifs_sid)); |
327 | memcpy((void *)(&(cifscred->gsid)), (void *)group_sid_ptr, | 425 | memcpy((void *)(&(cifscred->gsid)), (void *)group_sid_ptr, |
328 | sizeof (struct cifs_sid)); */ | 426 | sizeof(struct cifs_sid)); */ |
329 | 427 | ||
330 | 428 | ||
331 | return (0); | 429 | return (0); |
332 | } | 430 | } |
431 | |||
432 | |||
433 | /* Retrieve an ACL from the server */ | ||
434 | static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode, | ||
435 | const char *path) | ||
436 | { | ||
437 | struct cifsFileInfo *open_file; | ||
438 | int unlock_file = FALSE; | ||
439 | int xid; | ||
440 | int rc = -EIO; | ||
441 | __u16 fid; | ||
442 | struct super_block *sb; | ||
443 | struct cifs_sb_info *cifs_sb; | ||
444 | struct cifs_ntsd *pntsd = NULL; | ||
445 | |||
446 | cFYI(1, ("get mode from ACL for %s", path)); | ||
447 | |||
448 | if (inode == NULL) | ||
449 | return NULL; | ||
450 | |||
451 | xid = GetXid(); | ||
452 | open_file = find_readable_file(CIFS_I(inode)); | ||
453 | sb = inode->i_sb; | ||
454 | if (sb == NULL) { | ||
455 | FreeXid(xid); | ||
456 | return NULL; | ||
457 | } | ||
458 | cifs_sb = CIFS_SB(sb); | ||
459 | |||
460 | if (open_file) { | ||
461 | unlock_file = TRUE; | ||
462 | fid = open_file->netfid; | ||
463 | } else { | ||
464 | int oplock = FALSE; | ||
465 | /* open file */ | ||
466 | rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, | ||
467 | READ_CONTROL, 0, &fid, &oplock, NULL, | ||
468 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | ||
469 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
470 | if (rc != 0) { | ||
471 | cERROR(1, ("Unable to open file to get ACL")); | ||
472 | FreeXid(xid); | ||
473 | return NULL; | ||
474 | } | ||
475 | } | ||
476 | |||
477 | rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen); | ||
478 | cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen)); | ||
479 | if (unlock_file == TRUE) | ||
480 | atomic_dec(&open_file->wrtPending); | ||
481 | else | ||
482 | CIFSSMBClose(xid, cifs_sb->tcon, fid); | ||
483 | |||
484 | FreeXid(xid); | ||
485 | return pntsd; | ||
486 | } | ||
487 | |||
488 | /* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */ | ||
489 | void acl_to_uid_mode(struct inode *inode, const char *path) | ||
490 | { | ||
491 | struct cifs_ntsd *pntsd = NULL; | ||
492 | u32 acllen = 0; | ||
493 | int rc = 0; | ||
494 | |||
495 | #ifdef CONFIG_CIFS_DEBUG2 | ||
496 | cFYI(1, ("converting ACL to mode for %s", path)); | ||
497 | #endif | ||
498 | pntsd = get_cifs_acl(&acllen, inode, path); | ||
499 | |||
500 | /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */ | ||
501 | if (pntsd) | ||
502 | rc = parse_sec_desc(pntsd, acllen, inode); | ||
503 | if (rc) | ||
504 | cFYI(1, ("parse sec desc failed rc = %d", rc)); | ||
505 | |||
506 | kfree(pntsd); | ||
507 | return; | ||
508 | } | ||
509 | |||
510 | /* Convert mode bits to an ACL so we can update the ACL on the server */ | ||
511 | int mode_to_acl(struct inode *inode, const char *path) | ||
512 | { | ||
513 | int rc = 0; | ||
514 | __u32 acllen = 0; | ||
515 | struct cifs_ntsd *pntsd = NULL; | ||
516 | |||
517 | cFYI(1, ("set ACL from mode for %s", path)); | ||
518 | |||
519 | /* Get the security descriptor */ | ||
520 | pntsd = get_cifs_acl(&acllen, inode, path); | ||
521 | |||
522 | /* Add/Modify the three ACEs for owner, group, everyone | ||
523 | while retaining the other ACEs */ | ||
524 | |||
525 | /* Set the security descriptor */ | ||
526 | |||
527 | |||
528 | kfree(pntsd); | ||
529 | return rc; | ||
530 | } | ||
333 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | 531 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ |
diff --git a/fs/cifs/cifsacl.h b/fs/cifs/cifsacl.h index 420f87813647..93a7c3462ea2 100644 --- a/fs/cifs/cifsacl.h +++ b/fs/cifs/cifsacl.h | |||
@@ -35,6 +35,9 @@ | |||
35 | #define UBITSHIFT 6 | 35 | #define UBITSHIFT 6 |
36 | #define GBITSHIFT 3 | 36 | #define GBITSHIFT 3 |
37 | 37 | ||
38 | #define ACCESS_ALLOWED 0 | ||
39 | #define ACCESS_DENIED 1 | ||
40 | |||
38 | struct cifs_ntsd { | 41 | struct cifs_ntsd { |
39 | __le16 revision; /* revision level */ | 42 | __le16 revision; /* revision level */ |
40 | __le16 type; | 43 | __le16 type; |
@@ -48,7 +51,7 @@ struct cifs_sid { | |||
48 | __u8 revision; /* revision level */ | 51 | __u8 revision; /* revision level */ |
49 | __u8 num_subauth; | 52 | __u8 num_subauth; |
50 | __u8 authority[6]; | 53 | __u8 authority[6]; |
51 | __le32 sub_auth[5]; /* sub_auth[num_subauth] */ /* BB FIXME endianness BB */ | 54 | __le32 sub_auth[5]; /* sub_auth[num_subauth] */ |
52 | } __attribute__((packed)); | 55 | } __attribute__((packed)); |
53 | 56 | ||
54 | struct cifs_acl { | 57 | struct cifs_acl { |
@@ -57,18 +60,12 @@ struct cifs_acl { | |||
57 | __le32 num_aces; | 60 | __le32 num_aces; |
58 | } __attribute__((packed)); | 61 | } __attribute__((packed)); |
59 | 62 | ||
60 | struct cifs_ntace { /* first part of ACE which contains perms */ | 63 | struct cifs_ace { |
61 | __u8 type; | 64 | __u8 type; |
62 | __u8 flags; | 65 | __u8 flags; |
63 | __le16 size; | 66 | __le16 size; |
64 | __le32 access_req; | 67 | __le32 access_req; |
65 | } __attribute__((packed)); | 68 | struct cifs_sid sid; /* ie UUID of user or group who gets these perms */ |
66 | |||
67 | struct cifs_ace { /* last part of ACE which includes user info */ | ||
68 | __u8 revision; /* revision level */ | ||
69 | __u8 num_subauth; | ||
70 | __u8 authority[6]; | ||
71 | __le32 sub_auth[5]; | ||
72 | } __attribute__((packed)); | 69 | } __attribute__((packed)); |
73 | 70 | ||
74 | struct cifs_wksid { | 71 | struct cifs_wksid { |
@@ -79,7 +76,7 @@ struct cifs_wksid { | |||
79 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 76 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
80 | 77 | ||
81 | extern int match_sid(struct cifs_sid *); | 78 | extern int match_sid(struct cifs_sid *); |
82 | extern int compare_sids(struct cifs_sid *, struct cifs_sid *); | 79 | extern int compare_sids(const struct cifs_sid *, const struct cifs_sid *); |
83 | 80 | ||
84 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | 81 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ |
85 | 82 | ||
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 632070b4275d..4ff8939c6cc7 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -99,15 +99,16 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec, | |||
99 | MD5Init(&context); | 99 | MD5Init(&context); |
100 | MD5Update(&context, (char *)&key->data, key->len); | 100 | MD5Update(&context, (char *)&key->data, key->len); |
101 | for (i = 0; i < n_vec; i++) { | 101 | for (i = 0; i < n_vec; i++) { |
102 | if (iov[i].iov_len == 0) | ||
103 | continue; | ||
102 | if (iov[i].iov_base == NULL) { | 104 | if (iov[i].iov_base == NULL) { |
103 | cERROR(1, ("null iovec entry")); | 105 | cERROR(1, ("null iovec entry")); |
104 | return -EIO; | 106 | return -EIO; |
105 | } else if (iov[i].iov_len == 0) | 107 | } |
106 | break; /* bail out if we are sent nothing to sign */ | ||
107 | /* The first entry includes a length field (which does not get | 108 | /* The first entry includes a length field (which does not get |
108 | signed that occupies the first 4 bytes before the header */ | 109 | signed that occupies the first 4 bytes before the header */ |
109 | if (i == 0) { | 110 | if (i == 0) { |
110 | if (iov[0].iov_len <= 8 ) /* cmd field at offset 9 */ | 111 | if (iov[0].iov_len <= 8) /* cmd field at offset 9 */ |
111 | break; /* nothing to sign or corrupt header */ | 112 | break; /* nothing to sign or corrupt header */ |
112 | MD5Update(&context, iov[0].iov_base+4, | 113 | MD5Update(&context, iov[0].iov_base+4, |
113 | iov[0].iov_len-4); | 114 | iov[0].iov_len-4); |
@@ -122,7 +123,7 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec, | |||
122 | 123 | ||
123 | 124 | ||
124 | int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, | 125 | int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, |
125 | __u32 * pexpected_response_sequence_number) | 126 | __u32 *pexpected_response_sequence_number) |
126 | { | 127 | { |
127 | int rc = 0; | 128 | int rc = 0; |
128 | char smb_signature[20]; | 129 | char smb_signature[20]; |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index a6fbea57c4b1..416dc9fe8961 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -43,6 +43,8 @@ | |||
43 | #include "cifs_debug.h" | 43 | #include "cifs_debug.h" |
44 | #include "cifs_fs_sb.h" | 44 | #include "cifs_fs_sb.h" |
45 | #include <linux/mm.h> | 45 | #include <linux/mm.h> |
46 | #include <linux/key-type.h> | ||
47 | #include "cifs_spnego.h" | ||
46 | #define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */ | 48 | #define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */ |
47 | 49 | ||
48 | #ifdef CONFIG_CIFS_QUOTA | 50 | #ifdef CONFIG_CIFS_QUOTA |
@@ -1005,12 +1007,16 @@ init_cifs(void) | |||
1005 | rc = register_filesystem(&cifs_fs_type); | 1007 | rc = register_filesystem(&cifs_fs_type); |
1006 | if (rc) | 1008 | if (rc) |
1007 | goto out_destroy_request_bufs; | 1009 | goto out_destroy_request_bufs; |
1008 | 1010 | #ifdef CONFIG_CIFS_UPCALL | |
1011 | rc = register_key_type(&cifs_spnego_key_type); | ||
1012 | if (rc) | ||
1013 | goto out_unregister_filesystem; | ||
1014 | #endif | ||
1009 | oplockThread = kthread_run(cifs_oplock_thread, NULL, "cifsoplockd"); | 1015 | oplockThread = kthread_run(cifs_oplock_thread, NULL, "cifsoplockd"); |
1010 | if (IS_ERR(oplockThread)) { | 1016 | if (IS_ERR(oplockThread)) { |
1011 | rc = PTR_ERR(oplockThread); | 1017 | rc = PTR_ERR(oplockThread); |
1012 | cERROR(1, ("error %d create oplock thread", rc)); | 1018 | cERROR(1, ("error %d create oplock thread", rc)); |
1013 | goto out_unregister_filesystem; | 1019 | goto out_unregister_key_type; |
1014 | } | 1020 | } |
1015 | 1021 | ||
1016 | dnotifyThread = kthread_run(cifs_dnotify_thread, NULL, "cifsdnotifyd"); | 1022 | dnotifyThread = kthread_run(cifs_dnotify_thread, NULL, "cifsdnotifyd"); |
@@ -1024,7 +1030,11 @@ init_cifs(void) | |||
1024 | 1030 | ||
1025 | out_stop_oplock_thread: | 1031 | out_stop_oplock_thread: |
1026 | kthread_stop(oplockThread); | 1032 | kthread_stop(oplockThread); |
1033 | out_unregister_key_type: | ||
1034 | #ifdef CONFIG_CIFS_UPCALL | ||
1035 | unregister_key_type(&cifs_spnego_key_type); | ||
1027 | out_unregister_filesystem: | 1036 | out_unregister_filesystem: |
1037 | #endif | ||
1028 | unregister_filesystem(&cifs_fs_type); | 1038 | unregister_filesystem(&cifs_fs_type); |
1029 | out_destroy_request_bufs: | 1039 | out_destroy_request_bufs: |
1030 | cifs_destroy_request_bufs(); | 1040 | cifs_destroy_request_bufs(); |
@@ -1046,6 +1056,9 @@ exit_cifs(void) | |||
1046 | #ifdef CONFIG_PROC_FS | 1056 | #ifdef CONFIG_PROC_FS |
1047 | cifs_proc_clean(); | 1057 | cifs_proc_clean(); |
1048 | #endif | 1058 | #endif |
1059 | #ifdef CONFIG_CIFS_UPCALL | ||
1060 | unregister_key_type(&cifs_spnego_key_type); | ||
1061 | #endif | ||
1049 | unregister_filesystem(&cifs_fs_type); | 1062 | unregister_filesystem(&cifs_fs_type); |
1050 | cifs_destroy_inodecache(); | 1063 | cifs_destroy_inodecache(); |
1051 | cifs_destroy_mids(); | 1064 | cifs_destroy_mids(); |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 5574ba3ab1f9..2a21dc66f0de 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -106,5 +106,5 @@ extern int cifs_ioctl(struct inode *inode, struct file *filep, | |||
106 | extern const struct export_operations cifs_export_ops; | 106 | extern const struct export_operations cifs_export_ops; |
107 | #endif /* EXPERIMENTAL */ | 107 | #endif /* EXPERIMENTAL */ |
108 | 108 | ||
109 | #define CIFS_VERSION "1.51" | 109 | #define CIFS_VERSION "1.52" |
110 | #endif /* _CIFSFS_H */ | 110 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index c41ff74e9128..dbe6b846f37f 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -220,6 +220,23 @@ | |||
220 | | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES) | 220 | | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES) |
221 | #define FILE_EXEC_RIGHTS (FILE_EXECUTE) | 221 | #define FILE_EXEC_RIGHTS (FILE_EXECUTE) |
222 | 222 | ||
223 | #define SET_FILE_READ_RIGHTS (FILE_READ_DATA | FILE_READ_EA | FILE_WRITE_EA \ | ||
224 | | FILE_READ_ATTRIBUTES \ | ||
225 | | FILE_WRITE_ATTRIBUTES \ | ||
226 | | DELETE | READ_CONTROL | WRITE_DAC \ | ||
227 | | WRITE_OWNER | SYNCHRONIZE) | ||
228 | #define SET_FILE_WRITE_RIGHTS (FILE_WRITE_DATA | FILE_APPEND_DATA \ | ||
229 | | FILE_READ_EA | FILE_WRITE_EA \ | ||
230 | | FILE_DELETE_CHILD | FILE_READ_ATTRIBUTES \ | ||
231 | | FILE_WRITE_ATTRIBUTES \ | ||
232 | | DELETE | READ_CONTROL | WRITE_DAC \ | ||
233 | | WRITE_OWNER | SYNCHRONIZE) | ||
234 | #define SET_FILE_EXEC_RIGHTS (FILE_READ_EA | FILE_WRITE_EA | FILE_EXECUTE \ | ||
235 | | FILE_READ_ATTRIBUTES \ | ||
236 | | FILE_WRITE_ATTRIBUTES \ | ||
237 | | DELETE | READ_CONTROL | WRITE_DAC \ | ||
238 | | WRITE_OWNER | SYNCHRONIZE) | ||
239 | |||
223 | 240 | ||
224 | /* | 241 | /* |
225 | * Invalid readdir handle | 242 | * Invalid readdir handle |
@@ -1211,6 +1228,29 @@ typedef struct smb_com_transaction_qsec_req { | |||
1211 | __le32 AclFlags; | 1228 | __le32 AclFlags; |
1212 | } __attribute__((packed)) QUERY_SEC_DESC_REQ; | 1229 | } __attribute__((packed)) QUERY_SEC_DESC_REQ; |
1213 | 1230 | ||
1231 | |||
1232 | typedef struct smb_com_transaction_ssec_req { | ||
1233 | struct smb_hdr hdr; /* wct = 19 */ | ||
1234 | __u8 MaxSetupCount; | ||
1235 | __u16 Reserved; | ||
1236 | __le32 TotalParameterCount; | ||
1237 | __le32 TotalDataCount; | ||
1238 | __le32 MaxParameterCount; | ||
1239 | __le32 MaxDataCount; | ||
1240 | __le32 ParameterCount; | ||
1241 | __le32 ParameterOffset; | ||
1242 | __le32 DataCount; | ||
1243 | __le32 DataOffset; | ||
1244 | __u8 SetupCount; /* no setup words follow subcommand */ | ||
1245 | /* SNIA spec incorrectly included spurious pad here */ | ||
1246 | __le16 SubCommand; /* 3 = SET_SECURITY_DESC */ | ||
1247 | __le16 ByteCount; /* bcc = 3 + 8 */ | ||
1248 | __u8 Pad[3]; | ||
1249 | __u16 Fid; | ||
1250 | __u16 Reserved2; | ||
1251 | __le32 AclFlags; | ||
1252 | } __attribute__((packed)) SET_SEC_DESC_REQ; | ||
1253 | |||
1214 | typedef struct smb_com_transaction_change_notify_req { | 1254 | typedef struct smb_com_transaction_change_notify_req { |
1215 | struct smb_hdr hdr; /* wct = 23 */ | 1255 | struct smb_hdr hdr; /* wct = 23 */ |
1216 | __u8 MaxSetupCount; | 1256 | __u8 MaxSetupCount; |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 1a883663b22d..dd1d7c200ee6 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -61,6 +61,9 @@ extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); | |||
61 | extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); | 61 | extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); |
62 | extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); | 62 | extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); |
63 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); | 63 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); |
64 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
65 | extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *); | ||
66 | #endif | ||
64 | extern unsigned int smbCalcSize(struct smb_hdr *ptr); | 67 | extern unsigned int smbCalcSize(struct smb_hdr *ptr); |
65 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); | 68 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); |
66 | extern int decode_negTokenInit(unsigned char *security_blob, int length, | 69 | extern int decode_negTokenInit(unsigned char *security_blob, int length, |
@@ -73,6 +76,8 @@ extern void header_assemble(struct smb_hdr *, char /* command */ , | |||
73 | extern int small_smb_init_no_tc(const int smb_cmd, const int wct, | 76 | extern int small_smb_init_no_tc(const int smb_cmd, const int wct, |
74 | struct cifsSesInfo *ses, | 77 | struct cifsSesInfo *ses, |
75 | void **request_buf); | 78 | void **request_buf); |
79 | extern struct key *cifs_get_spnego_key(struct cifsSesInfo *sesInfo, | ||
80 | const char *hostname); | ||
76 | extern int CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, | 81 | extern int CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, |
77 | const int stage, | 82 | const int stage, |
78 | const struct nls_table *nls_cp); | 83 | const struct nls_table *nls_cp); |
@@ -92,6 +97,8 @@ extern int cifs_get_inode_info(struct inode **pinode, | |||
92 | extern int cifs_get_inode_info_unix(struct inode **pinode, | 97 | extern int cifs_get_inode_info_unix(struct inode **pinode, |
93 | const unsigned char *search_path, | 98 | const unsigned char *search_path, |
94 | struct super_block *sb, int xid); | 99 | struct super_block *sb, int xid); |
100 | extern void acl_to_uid_mode(struct inode *inode, const char *search_path); | ||
101 | extern int mode_to_acl(struct inode *inode, const char *path); | ||
95 | 102 | ||
96 | extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, | 103 | extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, |
97 | const char *); | 104 | const char *); |
@@ -311,7 +318,6 @@ extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *, | |||
311 | #ifdef CONFIG_CIFS_WEAK_PW_HASH | 318 | #ifdef CONFIG_CIFS_WEAK_PW_HASH |
312 | extern void calc_lanman_hash(struct cifsSesInfo *ses, char *lnm_session_key); | 319 | extern void calc_lanman_hash(struct cifsSesInfo *ses, char *lnm_session_key); |
313 | #endif /* CIFS_WEAK_PW_HASH */ | 320 | #endif /* CIFS_WEAK_PW_HASH */ |
314 | extern int parse_sec_desc(struct cifs_ntsd *, int); | ||
315 | extern int CIFSSMBCopy(int xid, | 321 | extern int CIFSSMBCopy(int xid, |
316 | struct cifsTconInfo *source_tcon, | 322 | struct cifsTconInfo *source_tcon, |
317 | const char *fromName, | 323 | const char *fromName, |
@@ -336,8 +342,7 @@ extern int CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, | |||
336 | const void *ea_value, const __u16 ea_value_len, | 342 | const void *ea_value, const __u16 ea_value_len, |
337 | const struct nls_table *nls_codepage, int remap_special_chars); | 343 | const struct nls_table *nls_codepage, int remap_special_chars); |
338 | extern int CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, | 344 | extern int CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, |
339 | __u16 fid, char *acl_inf, const int buflen, | 345 | __u16 fid, struct cifs_ntsd **acl_inf, __u32 *buflen); |
340 | const int acl_type /* ACCESS vs. DEFAULT */); | ||
341 | extern int CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon, | 346 | extern int CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon, |
342 | const unsigned char *searchName, | 347 | const unsigned char *searchName, |
343 | char *acl_inf, const int buflen, const int acl_type, | 348 | char *acl_inf, const int buflen, const int acl_type, |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index f0d9a485d095..59d7b7c037ad 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -647,8 +647,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) | |||
647 | count - 16, | 647 | count - 16, |
648 | &server->secType); | 648 | &server->secType); |
649 | if (rc == 1) { | 649 | if (rc == 1) { |
650 | /* BB Need to fill struct for sessetup here */ | 650 | rc = 0; |
651 | rc = -EOPNOTSUPP; | ||
652 | } else { | 651 | } else { |
653 | rc = -EINVAL; | 652 | rc = -EINVAL; |
654 | } | 653 | } |
@@ -2486,6 +2485,7 @@ querySymLinkRetry: | |||
2486 | return rc; | 2485 | return rc; |
2487 | } | 2486 | } |
2488 | 2487 | ||
2488 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
2489 | /* Initialize NT TRANSACT SMB into small smb request buffer. | 2489 | /* Initialize NT TRANSACT SMB into small smb request buffer. |
2490 | This assumes that all NT TRANSACTS that we init here have | 2490 | This assumes that all NT TRANSACTS that we init here have |
2491 | total parm and data under about 400 bytes (to fit in small cifs | 2491 | total parm and data under about 400 bytes (to fit in small cifs |
@@ -2494,7 +2494,7 @@ querySymLinkRetry: | |||
2494 | MaxSetupCount (size of returned setup area) and | 2494 | MaxSetupCount (size of returned setup area) and |
2495 | MaxParameterCount (returned parms size) must be set by caller */ | 2495 | MaxParameterCount (returned parms size) must be set by caller */ |
2496 | static int | 2496 | static int |
2497 | smb_init_ntransact(const __u16 sub_command, const int setup_count, | 2497 | smb_init_nttransact(const __u16 sub_command, const int setup_count, |
2498 | const int parm_len, struct cifsTconInfo *tcon, | 2498 | const int parm_len, struct cifsTconInfo *tcon, |
2499 | void **ret_buf) | 2499 | void **ret_buf) |
2500 | { | 2500 | { |
@@ -2525,12 +2525,15 @@ smb_init_ntransact(const __u16 sub_command, const int setup_count, | |||
2525 | 2525 | ||
2526 | static int | 2526 | static int |
2527 | validate_ntransact(char *buf, char **ppparm, char **ppdata, | 2527 | validate_ntransact(char *buf, char **ppparm, char **ppdata, |
2528 | int *pdatalen, int *pparmlen) | 2528 | __u32 *pparmlen, __u32 *pdatalen) |
2529 | { | 2529 | { |
2530 | char *end_of_smb; | 2530 | char *end_of_smb; |
2531 | __u32 data_count, data_offset, parm_count, parm_offset; | 2531 | __u32 data_count, data_offset, parm_count, parm_offset; |
2532 | struct smb_com_ntransact_rsp *pSMBr; | 2532 | struct smb_com_ntransact_rsp *pSMBr; |
2533 | 2533 | ||
2534 | *pdatalen = 0; | ||
2535 | *pparmlen = 0; | ||
2536 | |||
2534 | if (buf == NULL) | 2537 | if (buf == NULL) |
2535 | return -EINVAL; | 2538 | return -EINVAL; |
2536 | 2539 | ||
@@ -2567,8 +2570,11 @@ validate_ntransact(char *buf, char **ppparm, char **ppdata, | |||
2567 | cFYI(1, ("parm count and data count larger than SMB")); | 2570 | cFYI(1, ("parm count and data count larger than SMB")); |
2568 | return -EINVAL; | 2571 | return -EINVAL; |
2569 | } | 2572 | } |
2573 | *pdatalen = data_count; | ||
2574 | *pparmlen = parm_count; | ||
2570 | return 0; | 2575 | return 0; |
2571 | } | 2576 | } |
2577 | #endif /* CIFS_EXPERIMENTAL */ | ||
2572 | 2578 | ||
2573 | int | 2579 | int |
2574 | CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon, | 2580 | CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon, |
@@ -3067,8 +3073,7 @@ GetExtAttrOut: | |||
3067 | /* Get Security Descriptor (by handle) from remote server for a file or dir */ | 3073 | /* Get Security Descriptor (by handle) from remote server for a file or dir */ |
3068 | int | 3074 | int |
3069 | CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, | 3075 | CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, |
3070 | /* BB fix up return info */ char *acl_inf, const int buflen, | 3076 | struct cifs_ntsd **acl_inf, __u32 *pbuflen) |
3071 | const int acl_type) | ||
3072 | { | 3077 | { |
3073 | int rc = 0; | 3078 | int rc = 0; |
3074 | int buf_type = 0; | 3079 | int buf_type = 0; |
@@ -3077,7 +3082,10 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, | |||
3077 | 3082 | ||
3078 | cFYI(1, ("GetCifsACL")); | 3083 | cFYI(1, ("GetCifsACL")); |
3079 | 3084 | ||
3080 | rc = smb_init_ntransact(NT_TRANSACT_QUERY_SECURITY_DESC, 0, | 3085 | *pbuflen = 0; |
3086 | *acl_inf = NULL; | ||
3087 | |||
3088 | rc = smb_init_nttransact(NT_TRANSACT_QUERY_SECURITY_DESC, 0, | ||
3081 | 8 /* parm len */, tcon, (void **) &pSMB); | 3089 | 8 /* parm len */, tcon, (void **) &pSMB); |
3082 | if (rc) | 3090 | if (rc) |
3083 | return rc; | 3091 | return rc; |
@@ -3099,34 +3107,52 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, | |||
3099 | if (rc) { | 3107 | if (rc) { |
3100 | cFYI(1, ("Send error in QuerySecDesc = %d", rc)); | 3108 | cFYI(1, ("Send error in QuerySecDesc = %d", rc)); |
3101 | } else { /* decode response */ | 3109 | } else { /* decode response */ |
3102 | struct cifs_ntsd *psec_desc; | ||
3103 | __le32 * parm; | 3110 | __le32 * parm; |
3104 | int parm_len; | 3111 | __u32 parm_len; |
3105 | int data_len; | 3112 | __u32 acl_len; |
3106 | int acl_len; | ||
3107 | struct smb_com_ntransact_rsp *pSMBr; | 3113 | struct smb_com_ntransact_rsp *pSMBr; |
3114 | char *pdata; | ||
3108 | 3115 | ||
3109 | /* validate_nttransact */ | 3116 | /* validate_nttransact */ |
3110 | rc = validate_ntransact(iov[0].iov_base, (char **)&parm, | 3117 | rc = validate_ntransact(iov[0].iov_base, (char **)&parm, |
3111 | (char **)&psec_desc, | 3118 | &pdata, &parm_len, pbuflen); |
3112 | &parm_len, &data_len); | ||
3113 | if (rc) | 3119 | if (rc) |
3114 | goto qsec_out; | 3120 | goto qsec_out; |
3115 | pSMBr = (struct smb_com_ntransact_rsp *)iov[0].iov_base; | 3121 | pSMBr = (struct smb_com_ntransact_rsp *)iov[0].iov_base; |
3116 | 3122 | ||
3117 | cFYI(1, ("smb %p parm %p data %p", pSMBr, parm, psec_desc)); | 3123 | cFYI(1, ("smb %p parm %p data %p", pSMBr, parm, *acl_inf)); |
3118 | 3124 | ||
3119 | if (le32_to_cpu(pSMBr->ParameterCount) != 4) { | 3125 | if (le32_to_cpu(pSMBr->ParameterCount) != 4) { |
3120 | rc = -EIO; /* bad smb */ | 3126 | rc = -EIO; /* bad smb */ |
3127 | *pbuflen = 0; | ||
3121 | goto qsec_out; | 3128 | goto qsec_out; |
3122 | } | 3129 | } |
3123 | 3130 | ||
3124 | /* BB check that data area is minimum length and as big as acl_len */ | 3131 | /* BB check that data area is minimum length and as big as acl_len */ |
3125 | 3132 | ||
3126 | acl_len = le32_to_cpu(*parm); | 3133 | acl_len = le32_to_cpu(*parm); |
3127 | /* BB check if (acl_len > bufsize) */ | 3134 | if (acl_len != *pbuflen) { |
3135 | cERROR(1, ("acl length %d does not match %d", | ||
3136 | acl_len, *pbuflen)); | ||
3137 | if (*pbuflen > acl_len) | ||
3138 | *pbuflen = acl_len; | ||
3139 | } | ||
3128 | 3140 | ||
3129 | parse_sec_desc(psec_desc, acl_len); | 3141 | /* check if buffer is big enough for the acl |
3142 | header followed by the smallest SID */ | ||
3143 | if ((*pbuflen < sizeof(struct cifs_ntsd) + 8) || | ||
3144 | (*pbuflen >= 64 * 1024)) { | ||
3145 | cERROR(1, ("bad acl length %d", *pbuflen)); | ||
3146 | rc = -EINVAL; | ||
3147 | *pbuflen = 0; | ||
3148 | } else { | ||
3149 | *acl_inf = kmalloc(*pbuflen, GFP_KERNEL); | ||
3150 | if (*acl_inf == NULL) { | ||
3151 | *pbuflen = 0; | ||
3152 | rc = -ENOMEM; | ||
3153 | } | ||
3154 | memcpy(*acl_inf, pdata, *pbuflen); | ||
3155 | } | ||
3130 | } | 3156 | } |
3131 | qsec_out: | 3157 | qsec_out: |
3132 | if (buf_type == CIFS_SMALL_BUFFER) | 3158 | if (buf_type == CIFS_SMALL_BUFFER) |
@@ -3381,7 +3407,7 @@ UnixQPathInfoRetry: | |||
3381 | memcpy((char *) pFindData, | 3407 | memcpy((char *) pFindData, |
3382 | (char *) &pSMBr->hdr.Protocol + | 3408 | (char *) &pSMBr->hdr.Protocol + |
3383 | data_offset, | 3409 | data_offset, |
3384 | sizeof (FILE_UNIX_BASIC_INFO)); | 3410 | sizeof(FILE_UNIX_BASIC_INFO)); |
3385 | } | 3411 | } |
3386 | } | 3412 | } |
3387 | cifs_buf_release(pSMB); | 3413 | cifs_buf_release(pSMB); |
@@ -3649,7 +3675,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3649 | pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_NEXT); | 3675 | pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_NEXT); |
3650 | pSMB->SearchHandle = searchHandle; /* always kept as le */ | 3676 | pSMB->SearchHandle = searchHandle; /* always kept as le */ |
3651 | pSMB->SearchCount = | 3677 | pSMB->SearchCount = |
3652 | cpu_to_le16(CIFSMaxBufSize / sizeof (FILE_UNIX_INFO)); | 3678 | cpu_to_le16(CIFSMaxBufSize / sizeof(FILE_UNIX_INFO)); |
3653 | pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level); | 3679 | pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level); |
3654 | pSMB->ResumeKey = psrch_inf->resume_key; | 3680 | pSMB->ResumeKey = psrch_inf->resume_key; |
3655 | pSMB->SearchFlags = | 3681 | pSMB->SearchFlags = |
@@ -4331,7 +4357,7 @@ QFSDeviceRetry: | |||
4331 | } else { /* decode response */ | 4357 | } else { /* decode response */ |
4332 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); | 4358 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); |
4333 | 4359 | ||
4334 | if (rc || (pSMBr->ByteCount < sizeof (FILE_SYSTEM_DEVICE_INFO))) | 4360 | if (rc || (pSMBr->ByteCount < sizeof(FILE_SYSTEM_DEVICE_INFO))) |
4335 | rc = -EIO; /* bad smb */ | 4361 | rc = -EIO; /* bad smb */ |
4336 | else { | 4362 | else { |
4337 | __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); | 4363 | __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 19ee11f7f35a..c52a76ff4bb9 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -160,7 +160,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
160 | if (server->ssocket) { | 160 | if (server->ssocket) { |
161 | cFYI(1, ("State: 0x%x Flags: 0x%lx", server->ssocket->state, | 161 | cFYI(1, ("State: 0x%x Flags: 0x%lx", server->ssocket->state, |
162 | server->ssocket->flags)); | 162 | server->ssocket->flags)); |
163 | server->ssocket->ops->shutdown(server->ssocket, SEND_SHUTDOWN); | 163 | kernel_sock_shutdown(server->ssocket, SHUT_WR); |
164 | cFYI(1, ("Post shutdown state: 0x%x Flags: 0x%lx", | 164 | cFYI(1, ("Post shutdown state: 0x%x Flags: 0x%lx", |
165 | server->ssocket->state, | 165 | server->ssocket->state, |
166 | server->ssocket->flags)); | 166 | server->ssocket->flags)); |
@@ -793,7 +793,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
793 | vol->linux_gid = current->gid; | 793 | vol->linux_gid = current->gid; |
794 | vol->dir_mode = S_IRWXUGO; | 794 | vol->dir_mode = S_IRWXUGO; |
795 | /* 2767 perms indicate mandatory locking support */ | 795 | /* 2767 perms indicate mandatory locking support */ |
796 | vol->file_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP); | 796 | vol->file_mode = (S_IRWXUGO | S_ISGID) & (~S_IXGRP); |
797 | 797 | ||
798 | /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ | 798 | /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ |
799 | vol->rw = TRUE; | 799 | vol->rw = TRUE; |
@@ -1790,7 +1790,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1790 | 1790 | ||
1791 | if (volume_info.nullauth) { | 1791 | if (volume_info.nullauth) { |
1792 | cFYI(1, ("null user")); | 1792 | cFYI(1, ("null user")); |
1793 | volume_info.username = NULL; | 1793 | volume_info.username = ""; |
1794 | } else if (volume_info.username) { | 1794 | } else if (volume_info.username) { |
1795 | /* BB fixme parse for domain name here */ | 1795 | /* BB fixme parse for domain name here */ |
1796 | cFYI(1, ("Username: %s", volume_info.username)); | 1796 | cFYI(1, ("Username: %s", volume_info.username)); |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 793404b10925..37dc97af1487 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -593,7 +593,7 @@ static int cifs_ci_compare(struct dentry *dentry, struct qstr *a, | |||
593 | * case take precedence. If a is not a negative dentry, this | 593 | * case take precedence. If a is not a negative dentry, this |
594 | * should have no side effects | 594 | * should have no side effects |
595 | */ | 595 | */ |
596 | memcpy((unsigned char *)a->name, b->name, a->len); | 596 | memcpy(a->name, b->name, a->len); |
597 | return 0; | 597 | return 0; |
598 | } | 598 | } |
599 | return 1; | 599 | return 1; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 1e7e4c06d9e3..68ad4ca0cfa3 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1026,6 +1026,37 @@ static ssize_t cifs_write(struct file *file, const char *write_data, | |||
1026 | return total_written; | 1026 | return total_written; |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
1030 | struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode) | ||
1031 | { | ||
1032 | struct cifsFileInfo *open_file = NULL; | ||
1033 | |||
1034 | read_lock(&GlobalSMBSeslock); | ||
1035 | /* we could simply get the first_list_entry since write-only entries | ||
1036 | are always at the end of the list but since the first entry might | ||
1037 | have a close pending, we go through the whole list */ | ||
1038 | list_for_each_entry(open_file, &cifs_inode->openFileList, flist) { | ||
1039 | if (open_file->closePend) | ||
1040 | continue; | ||
1041 | if (open_file->pfile && ((open_file->pfile->f_flags & O_RDWR) || | ||
1042 | (open_file->pfile->f_flags & O_RDONLY))) { | ||
1043 | if (!open_file->invalidHandle) { | ||
1044 | /* found a good file */ | ||
1045 | /* lock it so it will not be closed on us */ | ||
1046 | atomic_inc(&open_file->wrtPending); | ||
1047 | read_unlock(&GlobalSMBSeslock); | ||
1048 | return open_file; | ||
1049 | } /* else might as well continue, and look for | ||
1050 | another, or simply have the caller reopen it | ||
1051 | again rather than trying to fix this handle */ | ||
1052 | } else /* write only file */ | ||
1053 | break; /* write only files are last so must be done */ | ||
1054 | } | ||
1055 | read_unlock(&GlobalSMBSeslock); | ||
1056 | return NULL; | ||
1057 | } | ||
1058 | #endif | ||
1059 | |||
1029 | struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode) | 1060 | struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode) |
1030 | { | 1061 | { |
1031 | struct cifsFileInfo *open_file; | 1062 | struct cifsFileInfo *open_file; |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 5e8b388be3b6..7d907e84e032 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -289,7 +289,7 @@ static int decode_sfu_inode(struct inode *inode, __u64 size, | |||
289 | 289 | ||
290 | #define SFBITS_MASK (S_ISVTX | S_ISGID | S_ISUID) /* SETFILEBITS valid bits */ | 290 | #define SFBITS_MASK (S_ISVTX | S_ISGID | S_ISUID) /* SETFILEBITS valid bits */ |
291 | 291 | ||
292 | static int get_sfu_uid_mode(struct inode *inode, | 292 | static int get_sfu_mode(struct inode *inode, |
293 | const unsigned char *path, | 293 | const unsigned char *path, |
294 | struct cifs_sb_info *cifs_sb, int xid) | 294 | struct cifs_sb_info *cifs_sb, int xid) |
295 | { | 295 | { |
@@ -527,11 +527,16 @@ int cifs_get_inode_info(struct inode **pinode, | |||
527 | 527 | ||
528 | /* BB fill in uid and gid here? with help from winbind? | 528 | /* BB fill in uid and gid here? with help from winbind? |
529 | or retrieve from NTFS stream extended attribute */ | 529 | or retrieve from NTFS stream extended attribute */ |
530 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
531 | /* fill in 0777 bits from ACL */ | ||
532 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { | ||
533 | cFYI(1, ("Getting mode bits from ACL")); | ||
534 | acl_to_uid_mode(inode, search_path); | ||
535 | } | ||
536 | #endif | ||
530 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { | 537 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { |
531 | /* fill in uid, gid, mode from server ACL */ | 538 | /* fill in remaining high mode bits e.g. SUID, VTX */ |
532 | /* BB FIXME this should also take into account the | 539 | get_sfu_mode(inode, search_path, cifs_sb, xid); |
533 | * default uid specified on mount if present */ | ||
534 | get_sfu_uid_mode(inode, search_path, cifs_sb, xid); | ||
535 | } else if (atomic_read(&cifsInfo->inUse) == 0) { | 540 | } else if (atomic_read(&cifsInfo->inUse) == 0) { |
536 | inode->i_uid = cifs_sb->mnt_uid; | 541 | inode->i_uid = cifs_sb->mnt_uid; |
537 | inode->i_gid = cifs_sb->mnt_gid; | 542 | inode->i_gid = cifs_sb->mnt_gid; |
diff --git a/fs/cifs/md5.c b/fs/cifs/md5.c index e5c3e1212697..f13f96d42fcf 100644 --- a/fs/cifs/md5.c +++ b/fs/cifs/md5.c | |||
@@ -276,8 +276,8 @@ hmac_md5_init_rfc2104(unsigned char *key, int key_len, | |||
276 | } | 276 | } |
277 | 277 | ||
278 | /* start out by storing key in pads */ | 278 | /* start out by storing key in pads */ |
279 | memset(ctx->k_ipad, 0, sizeof (ctx->k_ipad)); | 279 | memset(ctx->k_ipad, 0, sizeof(ctx->k_ipad)); |
280 | memset(ctx->k_opad, 0, sizeof (ctx->k_opad)); | 280 | memset(ctx->k_opad, 0, sizeof(ctx->k_opad)); |
281 | memcpy(ctx->k_ipad, key, key_len); | 281 | memcpy(ctx->k_ipad, key, key_len); |
282 | memcpy(ctx->k_opad, key, key_len); | 282 | memcpy(ctx->k_opad, key, key_len); |
283 | 283 | ||
@@ -307,8 +307,8 @@ hmac_md5_init_limK_to_64(const unsigned char *key, int key_len, | |||
307 | } | 307 | } |
308 | 308 | ||
309 | /* start out by storing key in pads */ | 309 | /* start out by storing key in pads */ |
310 | memset(ctx->k_ipad, 0, sizeof (ctx->k_ipad)); | 310 | memset(ctx->k_ipad, 0, sizeof(ctx->k_ipad)); |
311 | memset(ctx->k_opad, 0, sizeof (ctx->k_opad)); | 311 | memset(ctx->k_opad, 0, sizeof(ctx->k_opad)); |
312 | memcpy(ctx->k_ipad, key, key_len); | 312 | memcpy(ctx->k_ipad, key, key_len); |
313 | memcpy(ctx->k_opad, key, key_len); | 313 | memcpy(ctx->k_opad, key, key_len); |
314 | 314 | ||
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 51ec681fe74a..15546c2354c5 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -73,7 +73,7 @@ sesInfoAlloc(void) | |||
73 | { | 73 | { |
74 | struct cifsSesInfo *ret_buf; | 74 | struct cifsSesInfo *ret_buf; |
75 | 75 | ||
76 | ret_buf = kzalloc(sizeof (struct cifsSesInfo), GFP_KERNEL); | 76 | ret_buf = kzalloc(sizeof(struct cifsSesInfo), GFP_KERNEL); |
77 | if (ret_buf) { | 77 | if (ret_buf) { |
78 | write_lock(&GlobalSMBSeslock); | 78 | write_lock(&GlobalSMBSeslock); |
79 | atomic_inc(&sesInfoAllocCount); | 79 | atomic_inc(&sesInfoAllocCount); |
@@ -109,7 +109,7 @@ struct cifsTconInfo * | |||
109 | tconInfoAlloc(void) | 109 | tconInfoAlloc(void) |
110 | { | 110 | { |
111 | struct cifsTconInfo *ret_buf; | 111 | struct cifsTconInfo *ret_buf; |
112 | ret_buf = kzalloc(sizeof (struct cifsTconInfo), GFP_KERNEL); | 112 | ret_buf = kzalloc(sizeof(struct cifsTconInfo), GFP_KERNEL); |
113 | if (ret_buf) { | 113 | if (ret_buf) { |
114 | write_lock(&GlobalSMBSeslock); | 114 | write_lock(&GlobalSMBSeslock); |
115 | atomic_inc(&tconInfoAllocCount); | 115 | atomic_inc(&tconInfoAllocCount); |
@@ -298,7 +298,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , | |||
298 | memset(temp, 0, 256); /* bigger than MAX_CIFS_HDR_SIZE */ | 298 | memset(temp, 0, 256); /* bigger than MAX_CIFS_HDR_SIZE */ |
299 | 299 | ||
300 | buffer->smb_buf_length = | 300 | buffer->smb_buf_length = |
301 | (2 * word_count) + sizeof (struct smb_hdr) - | 301 | (2 * word_count) + sizeof(struct smb_hdr) - |
302 | 4 /* RFC 1001 length field does not count */ + | 302 | 4 /* RFC 1001 length field does not count */ + |
303 | 2 /* for bcc field itself */ ; | 303 | 2 /* for bcc field itself */ ; |
304 | /* Note that this is the only network field that has to be converted | 304 | /* Note that this is the only network field that has to be converted |
@@ -422,8 +422,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) | |||
422 | __u32 clc_len; /* calculated length */ | 422 | __u32 clc_len; /* calculated length */ |
423 | cFYI(0, ("checkSMB Length: 0x%x, smb_buf_length: 0x%x", length, len)); | 423 | cFYI(0, ("checkSMB Length: 0x%x, smb_buf_length: 0x%x", length, len)); |
424 | 424 | ||
425 | if (length < 2 + sizeof (struct smb_hdr)) { | 425 | if (length < 2 + sizeof(struct smb_hdr)) { |
426 | if ((length >= sizeof (struct smb_hdr) - 1) | 426 | if ((length >= sizeof(struct smb_hdr) - 1) |
427 | && (smb->Status.CifsError != 0)) { | 427 | && (smb->Status.CifsError != 0)) { |
428 | smb->WordCount = 0; | 428 | smb->WordCount = 0; |
429 | /* some error cases do not return wct and bcc */ | 429 | /* some error cases do not return wct and bcc */ |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index f06359cb22ee..646e1f06941b 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -132,6 +132,34 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = { | |||
132 | {0, 0} | 132 | {0, 0} |
133 | }; | 133 | }; |
134 | 134 | ||
135 | |||
136 | /* if the mount helper is missing we need to reverse the 1st slash | ||
137 | from '/' to backslash in order to format the UNC properly for | ||
138 | ip address parsing and for tree connect (unless the user | ||
139 | remembered to put the UNC name in properly). Fortunately we do | ||
140 | not have to call this twice (we check for IPv4 addresses | ||
141 | first, so it is already converted by the time we | ||
142 | try IPv6 addresses */ | ||
143 | static int canonicalize_unc(char *cp) | ||
144 | { | ||
145 | int i; | ||
146 | |||
147 | for (i = 0; i <= 46 /* INET6_ADDRSTRLEN */ ; i++) { | ||
148 | if (cp[i] == 0) | ||
149 | break; | ||
150 | if (cp[i] == '\\') | ||
151 | break; | ||
152 | if (cp[i] == '/') { | ||
153 | #ifdef CONFIG_CIFS_DEBUG2 | ||
154 | cFYI(1, ("change slash to backslash in malformed UNC")); | ||
155 | #endif | ||
156 | cp[i] = '\\'; | ||
157 | return 1; | ||
158 | } | ||
159 | } | ||
160 | return 0; | ||
161 | } | ||
162 | |||
135 | /* Convert string containing dotted ip address to binary form */ | 163 | /* Convert string containing dotted ip address to binary form */ |
136 | /* returns 0 if invalid address */ | 164 | /* returns 0 if invalid address */ |
137 | 165 | ||
@@ -141,11 +169,13 @@ cifs_inet_pton(int address_family, char *cp, void *dst) | |||
141 | int ret = 0; | 169 | int ret = 0; |
142 | 170 | ||
143 | /* calculate length by finding first slash or NULL */ | 171 | /* calculate length by finding first slash or NULL */ |
144 | /* BB Should we convert '/' slash to '\' here since it seems already | 172 | if (address_family == AF_INET) { |
145 | * done before this */ | 173 | ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL); |
146 | if ( address_family == AF_INET ) { | 174 | if (ret == 0) { |
147 | ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL); | 175 | if (canonicalize_unc(cp)) |
148 | } else if ( address_family == AF_INET6 ) { | 176 | ret = in4_pton(cp, -1, dst, '\\', NULL); |
177 | } | ||
178 | } else if (address_family == AF_INET6) { | ||
149 | ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); | 179 | ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); |
150 | } | 180 | } |
151 | #ifdef CONFIG_CIFS_DEBUG2 | 181 | #ifdef CONFIG_CIFS_DEBUG2 |
@@ -740,7 +770,7 @@ cifs_print_status(__u32 status_code) | |||
740 | 770 | ||
741 | 771 | ||
742 | static void | 772 | static void |
743 | ntstatus_to_dos(__u32 ntstatus, __u8 * eclass, __u16 * ecode) | 773 | ntstatus_to_dos(__u32 ntstatus, __u8 *eclass, __u16 *ecode) |
744 | { | 774 | { |
745 | int i; | 775 | int i; |
746 | if (ntstatus == 0) { | 776 | if (ntstatus == 0) { |
@@ -793,8 +823,8 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr) | |||
793 | if (smberrclass == ERRDOS) { /* 1 byte field no need to byte reverse */ | 823 | if (smberrclass == ERRDOS) { /* 1 byte field no need to byte reverse */ |
794 | for (i = 0; | 824 | for (i = 0; |
795 | i < | 825 | i < |
796 | sizeof (mapping_table_ERRDOS) / | 826 | sizeof(mapping_table_ERRDOS) / |
797 | sizeof (struct smb_to_posix_error); i++) { | 827 | sizeof(struct smb_to_posix_error); i++) { |
798 | if (mapping_table_ERRDOS[i].smb_err == 0) | 828 | if (mapping_table_ERRDOS[i].smb_err == 0) |
799 | break; | 829 | break; |
800 | else if (mapping_table_ERRDOS[i].smb_err == | 830 | else if (mapping_table_ERRDOS[i].smb_err == |
@@ -807,8 +837,8 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr) | |||
807 | } else if (smberrclass == ERRSRV) { /* server class of error codes */ | 837 | } else if (smberrclass == ERRSRV) { /* server class of error codes */ |
808 | for (i = 0; | 838 | for (i = 0; |
809 | i < | 839 | i < |
810 | sizeof (mapping_table_ERRSRV) / | 840 | sizeof(mapping_table_ERRSRV) / |
811 | sizeof (struct smb_to_posix_error); i++) { | 841 | sizeof(struct smb_to_posix_error); i++) { |
812 | if (mapping_table_ERRSRV[i].smb_err == 0) | 842 | if (mapping_table_ERRSRV[i].smb_err == 0) |
813 | break; | 843 | break; |
814 | else if (mapping_table_ERRSRV[i].smb_err == | 844 | else if (mapping_table_ERRSRV[i].smb_err == |
@@ -837,14 +867,14 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr) | |||
837 | unsigned int | 867 | unsigned int |
838 | smbCalcSize(struct smb_hdr *ptr) | 868 | smbCalcSize(struct smb_hdr *ptr) |
839 | { | 869 | { |
840 | return (sizeof (struct smb_hdr) + (2 * ptr->WordCount) + | 870 | return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) + |
841 | 2 /* size of the bcc field */ + BCC(ptr)); | 871 | 2 /* size of the bcc field */ + BCC(ptr)); |
842 | } | 872 | } |
843 | 873 | ||
844 | unsigned int | 874 | unsigned int |
845 | smbCalcSize_LE(struct smb_hdr *ptr) | 875 | smbCalcSize_LE(struct smb_hdr *ptr) |
846 | { | 876 | { |
847 | return (sizeof (struct smb_hdr) + (2 * ptr->WordCount) + | 877 | return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) + |
848 | 2 /* size of the bcc field */ + le16_to_cpu(BCC_LE(ptr))); | 878 | 2 /* size of the bcc field */ + le16_to_cpu(BCC_LE(ptr))); |
849 | } | 879 | } |
850 | 880 | ||
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 3746580e9701..0f22def4bdff 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -171,7 +171,13 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
171 | /* Linux can not store file creation time unfortunately so ignore it */ | 171 | /* Linux can not store file creation time unfortunately so ignore it */ |
172 | 172 | ||
173 | cifsInfo->cifsAttrs = attr; | 173 | cifsInfo->cifsAttrs = attr; |
174 | cifsInfo->time = jiffies; | 174 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
175 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { | ||
176 | /* get more accurate mode via ACL - so force inode refresh */ | ||
177 | cifsInfo->time = 0; | ||
178 | } else | ||
179 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | ||
180 | cifsInfo->time = jiffies; | ||
175 | 181 | ||
176 | /* treat dos attribute of read-only as read-only mode bit e.g. 555? */ | 182 | /* treat dos attribute of read-only as read-only mode bit e.g. 555? */ |
177 | /* 2767 perms - indicate mandatory locking */ | 183 | /* 2767 perms - indicate mandatory locking */ |
@@ -495,7 +501,7 @@ ffirst_retry: | |||
495 | static int cifs_unicode_bytelen(char *str) | 501 | static int cifs_unicode_bytelen(char *str) |
496 | { | 502 | { |
497 | int len; | 503 | int len; |
498 | __le16 * ustr = (__le16 *)str; | 504 | __le16 *ustr = (__le16 *)str; |
499 | 505 | ||
500 | for (len = 0; len <= PATH_MAX; len++) { | 506 | for (len = 0; len <= PATH_MAX; len++) { |
501 | if (ustr[len] == 0) | 507 | if (ustr[len] == 0) |
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c index 90542a39be17..58bbfd992cc0 100644 --- a/fs/cifs/smbencrypt.c +++ b/fs/cifs/smbencrypt.c | |||
@@ -80,7 +80,7 @@ SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) | |||
80 | 80 | ||
81 | /* Routines for Windows NT MD4 Hash functions. */ | 81 | /* Routines for Windows NT MD4 Hash functions. */ |
82 | static int | 82 | static int |
83 | _my_wcslen(__u16 * str) | 83 | _my_wcslen(__u16 *str) |
84 | { | 84 | { |
85 | int len = 0; | 85 | int len = 0; |
86 | while (*str++ != 0) | 86 | while (*str++ != 0) |
@@ -96,7 +96,7 @@ _my_wcslen(__u16 * str) | |||
96 | */ | 96 | */ |
97 | 97 | ||
98 | static int | 98 | static int |
99 | _my_mbstowcs(__u16 * dst, const unsigned char *src, int len) | 99 | _my_mbstowcs(__u16 *dst, const unsigned char *src, int len) |
100 | { /* BB not a very good conversion routine - change/fix */ | 100 | { /* BB not a very good conversion routine - change/fix */ |
101 | int i; | 101 | int i; |
102 | __u16 val; | 102 | __u16 val; |
@@ -125,9 +125,9 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16) | |||
125 | /* Password cannot be longer than 128 characters */ | 125 | /* Password cannot be longer than 128 characters */ |
126 | if (passwd) { | 126 | if (passwd) { |
127 | len = strlen((char *) passwd); | 127 | len = strlen((char *) passwd); |
128 | if (len > 128) { | 128 | if (len > 128) |
129 | len = 128; | 129 | len = 128; |
130 | } | 130 | |
131 | /* Password must be converted to NT unicode */ | 131 | /* Password must be converted to NT unicode */ |
132 | _my_mbstowcs(wpwd, passwd, len); | 132 | _my_mbstowcs(wpwd, passwd, len); |
133 | } else | 133 | } else |
@@ -135,7 +135,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16) | |||
135 | 135 | ||
136 | wpwd[len] = 0; /* Ensure string is null terminated */ | 136 | wpwd[len] = 0; /* Ensure string is null terminated */ |
137 | /* Calculate length in bytes */ | 137 | /* Calculate length in bytes */ |
138 | len = _my_wcslen(wpwd) * sizeof (__u16); | 138 | len = _my_wcslen(wpwd) * sizeof(__u16); |
139 | 139 | ||
140 | mdfour(p16, (unsigned char *) wpwd, len); | 140 | mdfour(p16, (unsigned char *) wpwd, len); |
141 | memset(wpwd, 0, 129 * 2); | 141 | memset(wpwd, 0, 129 * 2); |
@@ -167,7 +167,7 @@ nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16]) | |||
167 | E_P16((unsigned char *) passwd, (unsigned char *) p16); | 167 | E_P16((unsigned char *) passwd, (unsigned char *) p16); |
168 | 168 | ||
169 | /* clear out local copy of user's password (just being paranoid). */ | 169 | /* clear out local copy of user's password (just being paranoid). */ |
170 | memset(passwd, '\0', sizeof (passwd)); | 170 | memset(passwd, '\0', sizeof(passwd)); |
171 | } | 171 | } |
172 | #endif | 172 | #endif |
173 | 173 | ||
@@ -189,8 +189,10 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n, | |||
189 | return; | 189 | return; |
190 | dom_u = user_u + 1024; | 190 | dom_u = user_u + 1024; |
191 | 191 | ||
192 | /* push_ucs2(NULL, user_u, user_n, (user_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); | 192 | /* push_ucs2(NULL, user_u, user_n, (user_l+1)*2, |
193 | push_ucs2(NULL, dom_u, domain_n, (domain_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); */ | 193 | STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); |
194 | push_ucs2(NULL, dom_u, domain_n, (domain_l+1)*2, | ||
195 | STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); */ | ||
194 | 196 | ||
195 | /* BB user and domain may need to be uppercased */ | 197 | /* BB user and domain may need to be uppercased */ |
196 | user_l = cifs_strtoUCS(user_u, user_n, 511, nls_codepage); | 198 | user_l = cifs_strtoUCS(user_u, user_n, 511, nls_codepage); |
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 369e838bebd3..54e8ef96cb79 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -265,7 +265,9 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
265 | else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { | 265 | else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { |
266 | __u16 fid; | 266 | __u16 fid; |
267 | int oplock = FALSE; | 267 | int oplock = FALSE; |
268 | if (experimEnabled) | 268 | struct cifs_ntsd *pacl = NULL; |
269 | __u32 buflen = 0; | ||
270 | if (experimEnabled) | ||
269 | rc = CIFSSMBOpen(xid, pTcon, full_path, | 271 | rc = CIFSSMBOpen(xid, pTcon, full_path, |
270 | FILE_OPEN, GENERIC_READ, 0, &fid, | 272 | FILE_OPEN, GENERIC_READ, 0, &fid, |
271 | &oplock, NULL, cifs_sb->local_nls, | 273 | &oplock, NULL, cifs_sb->local_nls, |
@@ -273,10 +275,9 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
273 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 275 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
274 | /* else rc is EOPNOTSUPP from above */ | 276 | /* else rc is EOPNOTSUPP from above */ |
275 | 277 | ||
276 | if(rc == 0) { | 278 | if (rc == 0) { |
277 | rc = CIFSSMBGetCIFSACL(xid, pTcon, fid, | 279 | rc = CIFSSMBGetCIFSACL(xid, pTcon, fid, &pacl, |
278 | ea_value, buf_size, | 280 | &buflen); |
279 | ACL_TYPE_ACCESS); | ||
280 | CIFSSMBClose(xid, pTcon, fid); | 281 | CIFSSMBClose(xid, pTcon, fid); |
281 | } | 282 | } |
282 | } | 283 | } |
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c index 2150edf9a58e..6b7474a4336a 100644 --- a/fs/ecryptfs/read_write.c +++ b/fs/ecryptfs/read_write.c | |||
@@ -87,7 +87,7 @@ int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode, | |||
87 | loff_t offset; | 87 | loff_t offset; |
88 | int rc; | 88 | int rc; |
89 | 89 | ||
90 | offset = ((((off_t)page_for_lower->index) << PAGE_CACHE_SHIFT) | 90 | offset = ((((loff_t)page_for_lower->index) << PAGE_CACHE_SHIFT) |
91 | + offset_in_page); | 91 | + offset_in_page); |
92 | virt = kmap(page_for_lower); | 92 | virt = kmap(page_for_lower); |
93 | rc = ecryptfs_write_lower(ecryptfs_inode, virt, offset, size); | 93 | rc = ecryptfs_write_lower(ecryptfs_inode, virt, offset, size); |
@@ -1692,7 +1692,10 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) | |||
1692 | if (!binfmt || !binfmt->core_dump) | 1692 | if (!binfmt || !binfmt->core_dump) |
1693 | goto fail; | 1693 | goto fail; |
1694 | down_write(&mm->mmap_sem); | 1694 | down_write(&mm->mmap_sem); |
1695 | if (!get_dumpable(mm)) { | 1695 | /* |
1696 | * If another thread got here first, or we are not dumpable, bail out. | ||
1697 | */ | ||
1698 | if (mm->core_waiters || !get_dumpable(mm)) { | ||
1696 | up_write(&mm->mmap_sem); | 1699 | up_write(&mm->mmap_sem); |
1697 | goto fail; | 1700 | goto fail; |
1698 | } | 1701 | } |
@@ -1706,7 +1709,6 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) | |||
1706 | flag = O_EXCL; /* Stop rewrite attacks */ | 1709 | flag = O_EXCL; /* Stop rewrite attacks */ |
1707 | current->fsuid = 0; /* Dump root private */ | 1710 | current->fsuid = 0; /* Dump root private */ |
1708 | } | 1711 | } |
1709 | set_dumpable(mm, 0); | ||
1710 | 1712 | ||
1711 | retval = coredump_wait(exit_code); | 1713 | retval = coredump_wait(exit_code); |
1712 | if (retval < 0) | 1714 | if (retval < 0) |
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index 18a42de25b55..377ad172d74b 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c | |||
@@ -69,14 +69,6 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb, | |||
69 | return desc + offset; | 69 | return desc + offset; |
70 | } | 70 | } |
71 | 71 | ||
72 | static inline int | ||
73 | block_in_use(unsigned long block, struct super_block *sb, unsigned char *map) | ||
74 | { | ||
75 | return ext2_test_bit ((block - | ||
76 | le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block)) % | ||
77 | EXT2_BLOCKS_PER_GROUP(sb), map); | ||
78 | } | ||
79 | |||
80 | /* | 72 | /* |
81 | * Read the bitmap for a given block_group, reading into the specified | 73 | * Read the bitmap for a given block_group, reading into the specified |
82 | * slot in the superblock's bitmap cache. | 74 | * slot in the superblock's bitmap cache. |
@@ -86,51 +78,20 @@ block_in_use(unsigned long block, struct super_block *sb, unsigned char *map) | |||
86 | static struct buffer_head * | 78 | static struct buffer_head * |
87 | read_block_bitmap(struct super_block *sb, unsigned int block_group) | 79 | read_block_bitmap(struct super_block *sb, unsigned int block_group) |
88 | { | 80 | { |
89 | int i; | ||
90 | struct ext2_group_desc * desc; | 81 | struct ext2_group_desc * desc; |
91 | struct buffer_head * bh = NULL; | 82 | struct buffer_head * bh = NULL; |
92 | unsigned int bitmap_blk; | 83 | |
93 | |||
94 | desc = ext2_get_group_desc (sb, block_group, NULL); | 84 | desc = ext2_get_group_desc (sb, block_group, NULL); |
95 | if (!desc) | 85 | if (!desc) |
96 | return NULL; | 86 | goto error_out; |
97 | bitmap_blk = le32_to_cpu(desc->bg_block_bitmap); | 87 | bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap)); |
98 | bh = sb_bread(sb, bitmap_blk); | ||
99 | if (!bh) | 88 | if (!bh) |
100 | ext2_error (sb, __FUNCTION__, | 89 | ext2_error (sb, "read_block_bitmap", |
101 | "Cannot read block bitmap - " | 90 | "Cannot read block bitmap - " |
102 | "block_group = %d, block_bitmap = %u", | 91 | "block_group = %d, block_bitmap = %u", |
103 | block_group, le32_to_cpu(desc->bg_block_bitmap)); | 92 | block_group, le32_to_cpu(desc->bg_block_bitmap)); |
104 | |||
105 | /* check whether block bitmap block number is set */ | ||
106 | if (!block_in_use(bitmap_blk, sb, bh->b_data)) { | ||
107 | /* bad block bitmap */ | ||
108 | goto error_out; | ||
109 | } | ||
110 | /* check whether the inode bitmap block number is set */ | ||
111 | bitmap_blk = le32_to_cpu(desc->bg_inode_bitmap); | ||
112 | if (!block_in_use(bitmap_blk, sb, bh->b_data)) { | ||
113 | /* bad block bitmap */ | ||
114 | goto error_out; | ||
115 | } | ||
116 | /* check whether the inode table block number is set */ | ||
117 | bitmap_blk = le32_to_cpu(desc->bg_inode_table); | ||
118 | for (i = 0; i < EXT2_SB(sb)->s_itb_per_group; i++, bitmap_blk++) { | ||
119 | if (!block_in_use(bitmap_blk, sb, bh->b_data)) { | ||
120 | /* bad block bitmap */ | ||
121 | goto error_out; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | return bh; | ||
126 | |||
127 | error_out: | 93 | error_out: |
128 | brelse(bh); | 94 | return bh; |
129 | ext2_error(sb, __FUNCTION__, | ||
130 | "Invalid block bitmap - " | ||
131 | "block_group = %d, block = %u", | ||
132 | block_group, bitmap_blk); | ||
133 | return NULL; | ||
134 | } | 95 | } |
135 | 96 | ||
136 | static void release_blocks(struct super_block *sb, int count) | 97 | static void release_blocks(struct super_block *sb, int count) |
@@ -1461,7 +1422,6 @@ unsigned long ext2_count_free_blocks (struct super_block * sb) | |||
1461 | #endif | 1422 | #endif |
1462 | } | 1423 | } |
1463 | 1424 | ||
1464 | |||
1465 | static inline int test_root(int a, int b) | 1425 | static inline int test_root(int a, int b) |
1466 | { | 1426 | { |
1467 | int num = b; | 1427 | int num = b; |
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index c2324d5fe4ac..320b2cb3d4d2 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c | |||
@@ -47,6 +47,11 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
47 | flags &= ~EXT2_DIRSYNC_FL; | 47 | flags &= ~EXT2_DIRSYNC_FL; |
48 | 48 | ||
49 | mutex_lock(&inode->i_mutex); | 49 | mutex_lock(&inode->i_mutex); |
50 | /* Is it quota file? Do not allow user to mess with it */ | ||
51 | if (IS_NOQUOTA(inode)) { | ||
52 | mutex_unlock(&inode->i_mutex); | ||
53 | return -EPERM; | ||
54 | } | ||
50 | oldflags = ei->i_flags; | 55 | oldflags = ei->i_flags; |
51 | 56 | ||
52 | /* | 57 | /* |
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 7a87d15523be..a8ba7e831278 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -80,14 +80,6 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, | |||
80 | return desc + offset; | 80 | return desc + offset; |
81 | } | 81 | } |
82 | 82 | ||
83 | static inline int | ||
84 | block_in_use(ext3_fsblk_t block, struct super_block *sb, unsigned char *map) | ||
85 | { | ||
86 | return ext3_test_bit ((block - | ||
87 | le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) % | ||
88 | EXT3_BLOCKS_PER_GROUP(sb), map); | ||
89 | } | ||
90 | |||
91 | /** | 83 | /** |
92 | * read_block_bitmap() | 84 | * read_block_bitmap() |
93 | * @sb: super block | 85 | * @sb: super block |
@@ -101,51 +93,20 @@ block_in_use(ext3_fsblk_t block, struct super_block *sb, unsigned char *map) | |||
101 | static struct buffer_head * | 93 | static struct buffer_head * |
102 | read_block_bitmap(struct super_block *sb, unsigned int block_group) | 94 | read_block_bitmap(struct super_block *sb, unsigned int block_group) |
103 | { | 95 | { |
104 | int i; | ||
105 | struct ext3_group_desc * desc; | 96 | struct ext3_group_desc * desc; |
106 | struct buffer_head * bh = NULL; | 97 | struct buffer_head * bh = NULL; |
107 | ext3_fsblk_t bitmap_blk; | ||
108 | 98 | ||
109 | desc = ext3_get_group_desc (sb, block_group, NULL); | 99 | desc = ext3_get_group_desc (sb, block_group, NULL); |
110 | if (!desc) | 100 | if (!desc) |
111 | return NULL; | 101 | goto error_out; |
112 | bitmap_blk = le32_to_cpu(desc->bg_block_bitmap); | 102 | bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap)); |
113 | bh = sb_bread(sb, bitmap_blk); | ||
114 | if (!bh) | 103 | if (!bh) |
115 | ext3_error (sb, __FUNCTION__, | 104 | ext3_error (sb, "read_block_bitmap", |
116 | "Cannot read block bitmap - " | 105 | "Cannot read block bitmap - " |
117 | "block_group = %d, block_bitmap = %u", | 106 | "block_group = %d, block_bitmap = %u", |
118 | block_group, le32_to_cpu(desc->bg_block_bitmap)); | 107 | block_group, le32_to_cpu(desc->bg_block_bitmap)); |
119 | |||
120 | /* check whether block bitmap block number is set */ | ||
121 | if (!block_in_use(bitmap_blk, sb, bh->b_data)) { | ||
122 | /* bad block bitmap */ | ||
123 | goto error_out; | ||
124 | } | ||
125 | /* check whether the inode bitmap block number is set */ | ||
126 | bitmap_blk = le32_to_cpu(desc->bg_inode_bitmap); | ||
127 | if (!block_in_use(bitmap_blk, sb, bh->b_data)) { | ||
128 | /* bad block bitmap */ | ||
129 | goto error_out; | ||
130 | } | ||
131 | /* check whether the inode table block number is set */ | ||
132 | bitmap_blk = le32_to_cpu(desc->bg_inode_table); | ||
133 | for (i = 0; i < EXT3_SB(sb)->s_itb_per_group; i++, bitmap_blk++) { | ||
134 | if (!block_in_use(bitmap_blk, sb, bh->b_data)) { | ||
135 | /* bad block bitmap */ | ||
136 | goto error_out; | ||
137 | } | ||
138 | } | ||
139 | |||
140 | return bh; | ||
141 | |||
142 | error_out: | 108 | error_out: |
143 | brelse(bh); | 109 | return bh; |
144 | ext3_error(sb, __FUNCTION__, | ||
145 | "Invalid block bitmap - " | ||
146 | "block_group = %d, block = %lu", | ||
147 | block_group, bitmap_blk); | ||
148 | return NULL; | ||
149 | } | 110 | } |
150 | /* | 111 | /* |
151 | * The reservation window structure operations | 112 | * The reservation window structure operations |
@@ -1772,7 +1733,6 @@ ext3_fsblk_t ext3_count_free_blocks(struct super_block *sb) | |||
1772 | #endif | 1733 | #endif |
1773 | } | 1734 | } |
1774 | 1735 | ||
1775 | |||
1776 | static inline int test_root(int a, int b) | 1736 | static inline int test_root(int a, int b) |
1777 | { | 1737 | { |
1778 | int num = b; | 1738 | int num = b; |
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index c8e4ee3af1d0..8ca3bfd72427 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c | |||
@@ -67,7 +67,7 @@ int ext3_check_dir_entry (const char * function, struct inode * dir, | |||
67 | unsigned long offset) | 67 | unsigned long offset) |
68 | { | 68 | { |
69 | const char * error_msg = NULL; | 69 | const char * error_msg = NULL; |
70 | const int rlen = le16_to_cpu(de->rec_len); | 70 | const int rlen = ext3_rec_len_from_disk(de->rec_len); |
71 | 71 | ||
72 | if (rlen < EXT3_DIR_REC_LEN(1)) | 72 | if (rlen < EXT3_DIR_REC_LEN(1)) |
73 | error_msg = "rec_len is smaller than minimal"; | 73 | error_msg = "rec_len is smaller than minimal"; |
@@ -173,10 +173,10 @@ revalidate: | |||
173 | * least that it is non-zero. A | 173 | * least that it is non-zero. A |
174 | * failure will be detected in the | 174 | * failure will be detected in the |
175 | * dirent test below. */ | 175 | * dirent test below. */ |
176 | if (le16_to_cpu(de->rec_len) < | 176 | if (ext3_rec_len_from_disk(de->rec_len) < |
177 | EXT3_DIR_REC_LEN(1)) | 177 | EXT3_DIR_REC_LEN(1)) |
178 | break; | 178 | break; |
179 | i += le16_to_cpu(de->rec_len); | 179 | i += ext3_rec_len_from_disk(de->rec_len); |
180 | } | 180 | } |
181 | offset = i; | 181 | offset = i; |
182 | filp->f_pos = (filp->f_pos & ~(sb->s_blocksize - 1)) | 182 | filp->f_pos = (filp->f_pos & ~(sb->s_blocksize - 1)) |
@@ -197,7 +197,7 @@ revalidate: | |||
197 | ret = stored; | 197 | ret = stored; |
198 | goto out; | 198 | goto out; |
199 | } | 199 | } |
200 | offset += le16_to_cpu(de->rec_len); | 200 | offset += ext3_rec_len_from_disk(de->rec_len); |
201 | if (le32_to_cpu(de->inode)) { | 201 | if (le32_to_cpu(de->inode)) { |
202 | /* We might block in the next section | 202 | /* We might block in the next section |
203 | * if the data destination is | 203 | * if the data destination is |
@@ -219,7 +219,7 @@ revalidate: | |||
219 | goto revalidate; | 219 | goto revalidate; |
220 | stored ++; | 220 | stored ++; |
221 | } | 221 | } |
222 | filp->f_pos += le16_to_cpu(de->rec_len); | 222 | filp->f_pos += ext3_rec_len_from_disk(de->rec_len); |
223 | } | 223 | } |
224 | offset = 0; | 224 | offset = 0; |
225 | brelse (bh); | 225 | brelse (bh); |
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 4a2a02c95bf9..023a070f55f1 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -51,6 +51,11 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
51 | flags &= ~EXT3_DIRSYNC_FL; | 51 | flags &= ~EXT3_DIRSYNC_FL; |
52 | 52 | ||
53 | mutex_lock(&inode->i_mutex); | 53 | mutex_lock(&inode->i_mutex); |
54 | /* Is it quota file? Do not allow user to mess with it */ | ||
55 | if (IS_NOQUOTA(inode)) { | ||
56 | mutex_unlock(&inode->i_mutex); | ||
57 | return -EPERM; | ||
58 | } | ||
54 | oldflags = ei->i_flags; | 59 | oldflags = ei->i_flags; |
55 | 60 | ||
56 | /* The JOURNAL_DATA flag is modifiable only by root */ | 61 | /* The JOURNAL_DATA flag is modifiable only by root */ |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index ec8170adac53..4ab6f76e63d0 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -177,6 +177,16 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry, | |||
177 | struct inode *inode); | 177 | struct inode *inode); |
178 | 178 | ||
179 | /* | 179 | /* |
180 | * p is at least 6 bytes before the end of page | ||
181 | */ | ||
182 | static inline struct ext3_dir_entry_2 * | ||
183 | ext3_next_entry(struct ext3_dir_entry_2 *p) | ||
184 | { | ||
185 | return (struct ext3_dir_entry_2 *)((char *)p + | ||
186 | ext3_rec_len_from_disk(p->rec_len)); | ||
187 | } | ||
188 | |||
189 | /* | ||
180 | * Future: use high four bits of block for coalesce-on-delete flags | 190 | * Future: use high four bits of block for coalesce-on-delete flags |
181 | * Mask them off for now. | 191 | * Mask them off for now. |
182 | */ | 192 | */ |
@@ -280,7 +290,7 @@ static struct stats dx_show_leaf(struct dx_hash_info *hinfo, struct ext3_dir_ent | |||
280 | space += EXT3_DIR_REC_LEN(de->name_len); | 290 | space += EXT3_DIR_REC_LEN(de->name_len); |
281 | names++; | 291 | names++; |
282 | } | 292 | } |
283 | de = (struct ext3_dir_entry_2 *) ((char *) de + le16_to_cpu(de->rec_len)); | 293 | de = ext3_next_entry(de); |
284 | } | 294 | } |
285 | printk("(%i)\n", names); | 295 | printk("(%i)\n", names); |
286 | return (struct stats) { names, space, 1 }; | 296 | return (struct stats) { names, space, 1 }; |
@@ -547,14 +557,6 @@ static int ext3_htree_next_block(struct inode *dir, __u32 hash, | |||
547 | 557 | ||
548 | 558 | ||
549 | /* | 559 | /* |
550 | * p is at least 6 bytes before the end of page | ||
551 | */ | ||
552 | static inline struct ext3_dir_entry_2 *ext3_next_entry(struct ext3_dir_entry_2 *p) | ||
553 | { | ||
554 | return (struct ext3_dir_entry_2 *)((char*)p + le16_to_cpu(p->rec_len)); | ||
555 | } | ||
556 | |||
557 | /* | ||
558 | * This function fills a red-black tree with information from a | 560 | * This function fills a red-black tree with information from a |
559 | * directory block. It returns the number directory entries loaded | 561 | * directory block. It returns the number directory entries loaded |
560 | * into the tree. If there is an error it is returned in err. | 562 | * into the tree. If there is an error it is returned in err. |
@@ -720,7 +722,7 @@ static int dx_make_map (struct ext3_dir_entry_2 *de, int size, | |||
720 | cond_resched(); | 722 | cond_resched(); |
721 | } | 723 | } |
722 | /* XXX: do we need to check rec_len == 0 case? -Chris */ | 724 | /* XXX: do we need to check rec_len == 0 case? -Chris */ |
723 | de = (struct ext3_dir_entry_2 *) ((char *) de + le16_to_cpu(de->rec_len)); | 725 | de = ext3_next_entry(de); |
724 | } | 726 | } |
725 | return count; | 727 | return count; |
726 | } | 728 | } |
@@ -822,7 +824,7 @@ static inline int search_dirblock(struct buffer_head * bh, | |||
822 | return 1; | 824 | return 1; |
823 | } | 825 | } |
824 | /* prevent looping on a bad block */ | 826 | /* prevent looping on a bad block */ |
825 | de_len = le16_to_cpu(de->rec_len); | 827 | de_len = ext3_rec_len_from_disk(de->rec_len); |
826 | if (de_len <= 0) | 828 | if (de_len <= 0) |
827 | return -1; | 829 | return -1; |
828 | offset += de_len; | 830 | offset += de_len; |
@@ -1130,7 +1132,7 @@ dx_move_dirents(char *from, char *to, struct dx_map_entry *map, int count) | |||
1130 | rec_len = EXT3_DIR_REC_LEN(de->name_len); | 1132 | rec_len = EXT3_DIR_REC_LEN(de->name_len); |
1131 | memcpy (to, de, rec_len); | 1133 | memcpy (to, de, rec_len); |
1132 | ((struct ext3_dir_entry_2 *) to)->rec_len = | 1134 | ((struct ext3_dir_entry_2 *) to)->rec_len = |
1133 | cpu_to_le16(rec_len); | 1135 | ext3_rec_len_to_disk(rec_len); |
1134 | de->inode = 0; | 1136 | de->inode = 0; |
1135 | map++; | 1137 | map++; |
1136 | to += rec_len; | 1138 | to += rec_len; |
@@ -1149,13 +1151,12 @@ static struct ext3_dir_entry_2* dx_pack_dirents(char *base, int size) | |||
1149 | 1151 | ||
1150 | prev = to = de; | 1152 | prev = to = de; |
1151 | while ((char*)de < base + size) { | 1153 | while ((char*)de < base + size) { |
1152 | next = (struct ext3_dir_entry_2 *) ((char *) de + | 1154 | next = ext3_next_entry(de); |
1153 | le16_to_cpu(de->rec_len)); | ||
1154 | if (de->inode && de->name_len) { | 1155 | if (de->inode && de->name_len) { |
1155 | rec_len = EXT3_DIR_REC_LEN(de->name_len); | 1156 | rec_len = EXT3_DIR_REC_LEN(de->name_len); |
1156 | if (de > to) | 1157 | if (de > to) |
1157 | memmove(to, de, rec_len); | 1158 | memmove(to, de, rec_len); |
1158 | to->rec_len = cpu_to_le16(rec_len); | 1159 | to->rec_len = ext3_rec_len_to_disk(rec_len); |
1159 | prev = to; | 1160 | prev = to; |
1160 | to = (struct ext3_dir_entry_2 *) (((char *) to) + rec_len); | 1161 | to = (struct ext3_dir_entry_2 *) (((char *) to) + rec_len); |
1161 | } | 1162 | } |
@@ -1229,8 +1230,8 @@ static struct ext3_dir_entry_2 *do_split(handle_t *handle, struct inode *dir, | |||
1229 | /* Fancy dance to stay within two buffers */ | 1230 | /* Fancy dance to stay within two buffers */ |
1230 | de2 = dx_move_dirents(data1, data2, map + split, count - split); | 1231 | de2 = dx_move_dirents(data1, data2, map + split, count - split); |
1231 | de = dx_pack_dirents(data1,blocksize); | 1232 | de = dx_pack_dirents(data1,blocksize); |
1232 | de->rec_len = cpu_to_le16(data1 + blocksize - (char *) de); | 1233 | de->rec_len = ext3_rec_len_to_disk(data1 + blocksize - (char *) de); |
1233 | de2->rec_len = cpu_to_le16(data2 + blocksize - (char *) de2); | 1234 | de2->rec_len = ext3_rec_len_to_disk(data2 + blocksize - (char *) de2); |
1234 | dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data1, blocksize, 1)); | 1235 | dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data1, blocksize, 1)); |
1235 | dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data2, blocksize, 1)); | 1236 | dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data2, blocksize, 1)); |
1236 | 1237 | ||
@@ -1300,7 +1301,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, | |||
1300 | return -EEXIST; | 1301 | return -EEXIST; |
1301 | } | 1302 | } |
1302 | nlen = EXT3_DIR_REC_LEN(de->name_len); | 1303 | nlen = EXT3_DIR_REC_LEN(de->name_len); |
1303 | rlen = le16_to_cpu(de->rec_len); | 1304 | rlen = ext3_rec_len_from_disk(de->rec_len); |
1304 | if ((de->inode? rlen - nlen: rlen) >= reclen) | 1305 | if ((de->inode? rlen - nlen: rlen) >= reclen) |
1305 | break; | 1306 | break; |
1306 | de = (struct ext3_dir_entry_2 *)((char *)de + rlen); | 1307 | de = (struct ext3_dir_entry_2 *)((char *)de + rlen); |
@@ -1319,11 +1320,11 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, | |||
1319 | 1320 | ||
1320 | /* By now the buffer is marked for journaling */ | 1321 | /* By now the buffer is marked for journaling */ |
1321 | nlen = EXT3_DIR_REC_LEN(de->name_len); | 1322 | nlen = EXT3_DIR_REC_LEN(de->name_len); |
1322 | rlen = le16_to_cpu(de->rec_len); | 1323 | rlen = ext3_rec_len_from_disk(de->rec_len); |
1323 | if (de->inode) { | 1324 | if (de->inode) { |
1324 | struct ext3_dir_entry_2 *de1 = (struct ext3_dir_entry_2 *)((char *)de + nlen); | 1325 | struct ext3_dir_entry_2 *de1 = (struct ext3_dir_entry_2 *)((char *)de + nlen); |
1325 | de1->rec_len = cpu_to_le16(rlen - nlen); | 1326 | de1->rec_len = ext3_rec_len_to_disk(rlen - nlen); |
1326 | de->rec_len = cpu_to_le16(nlen); | 1327 | de->rec_len = ext3_rec_len_to_disk(nlen); |
1327 | de = de1; | 1328 | de = de1; |
1328 | } | 1329 | } |
1329 | de->file_type = EXT3_FT_UNKNOWN; | 1330 | de->file_type = EXT3_FT_UNKNOWN; |
@@ -1400,17 +1401,18 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | |||
1400 | 1401 | ||
1401 | /* The 0th block becomes the root, move the dirents out */ | 1402 | /* The 0th block becomes the root, move the dirents out */ |
1402 | fde = &root->dotdot; | 1403 | fde = &root->dotdot; |
1403 | de = (struct ext3_dir_entry_2 *)((char *)fde + le16_to_cpu(fde->rec_len)); | 1404 | de = (struct ext3_dir_entry_2 *)((char *)fde + |
1405 | ext3_rec_len_from_disk(fde->rec_len)); | ||
1404 | len = ((char *) root) + blocksize - (char *) de; | 1406 | len = ((char *) root) + blocksize - (char *) de; |
1405 | memcpy (data1, de, len); | 1407 | memcpy (data1, de, len); |
1406 | de = (struct ext3_dir_entry_2 *) data1; | 1408 | de = (struct ext3_dir_entry_2 *) data1; |
1407 | top = data1 + len; | 1409 | top = data1 + len; |
1408 | while ((char *)(de2=(void*)de+le16_to_cpu(de->rec_len)) < top) | 1410 | while ((char *)(de2 = ext3_next_entry(de)) < top) |
1409 | de = de2; | 1411 | de = de2; |
1410 | de->rec_len = cpu_to_le16(data1 + blocksize - (char *) de); | 1412 | de->rec_len = ext3_rec_len_to_disk(data1 + blocksize - (char *) de); |
1411 | /* Initialize the root; the dot dirents already exist */ | 1413 | /* Initialize the root; the dot dirents already exist */ |
1412 | de = (struct ext3_dir_entry_2 *) (&root->dotdot); | 1414 | de = (struct ext3_dir_entry_2 *) (&root->dotdot); |
1413 | de->rec_len = cpu_to_le16(blocksize - EXT3_DIR_REC_LEN(2)); | 1415 | de->rec_len = ext3_rec_len_to_disk(blocksize - EXT3_DIR_REC_LEN(2)); |
1414 | memset (&root->info, 0, sizeof(root->info)); | 1416 | memset (&root->info, 0, sizeof(root->info)); |
1415 | root->info.info_length = sizeof(root->info); | 1417 | root->info.info_length = sizeof(root->info); |
1416 | root->info.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; | 1418 | root->info.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; |
@@ -1490,7 +1492,7 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry, | |||
1490 | return retval; | 1492 | return retval; |
1491 | de = (struct ext3_dir_entry_2 *) bh->b_data; | 1493 | de = (struct ext3_dir_entry_2 *) bh->b_data; |
1492 | de->inode = 0; | 1494 | de->inode = 0; |
1493 | de->rec_len = cpu_to_le16(blocksize); | 1495 | de->rec_len = ext3_rec_len_to_disk(blocksize); |
1494 | return add_dirent_to_buf(handle, dentry, inode, de, bh); | 1496 | return add_dirent_to_buf(handle, dentry, inode, de, bh); |
1495 | } | 1497 | } |
1496 | 1498 | ||
@@ -1553,7 +1555,7 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry, | |||
1553 | goto cleanup; | 1555 | goto cleanup; |
1554 | node2 = (struct dx_node *)(bh2->b_data); | 1556 | node2 = (struct dx_node *)(bh2->b_data); |
1555 | entries2 = node2->entries; | 1557 | entries2 = node2->entries; |
1556 | node2->fake.rec_len = cpu_to_le16(sb->s_blocksize); | 1558 | node2->fake.rec_len = ext3_rec_len_to_disk(sb->s_blocksize); |
1557 | node2->fake.inode = 0; | 1559 | node2->fake.inode = 0; |
1558 | BUFFER_TRACE(frame->bh, "get_write_access"); | 1560 | BUFFER_TRACE(frame->bh, "get_write_access"); |
1559 | err = ext3_journal_get_write_access(handle, frame->bh); | 1561 | err = ext3_journal_get_write_access(handle, frame->bh); |
@@ -1651,9 +1653,9 @@ static int ext3_delete_entry (handle_t *handle, | |||
1651 | BUFFER_TRACE(bh, "get_write_access"); | 1653 | BUFFER_TRACE(bh, "get_write_access"); |
1652 | ext3_journal_get_write_access(handle, bh); | 1654 | ext3_journal_get_write_access(handle, bh); |
1653 | if (pde) | 1655 | if (pde) |
1654 | pde->rec_len = | 1656 | pde->rec_len = ext3_rec_len_to_disk( |
1655 | cpu_to_le16(le16_to_cpu(pde->rec_len) + | 1657 | ext3_rec_len_from_disk(pde->rec_len) + |
1656 | le16_to_cpu(de->rec_len)); | 1658 | ext3_rec_len_from_disk(de->rec_len)); |
1657 | else | 1659 | else |
1658 | de->inode = 0; | 1660 | de->inode = 0; |
1659 | dir->i_version++; | 1661 | dir->i_version++; |
@@ -1661,10 +1663,9 @@ static int ext3_delete_entry (handle_t *handle, | |||
1661 | ext3_journal_dirty_metadata(handle, bh); | 1663 | ext3_journal_dirty_metadata(handle, bh); |
1662 | return 0; | 1664 | return 0; |
1663 | } | 1665 | } |
1664 | i += le16_to_cpu(de->rec_len); | 1666 | i += ext3_rec_len_from_disk(de->rec_len); |
1665 | pde = de; | 1667 | pde = de; |
1666 | de = (struct ext3_dir_entry_2 *) | 1668 | de = ext3_next_entry(de); |
1667 | ((char *) de + le16_to_cpu(de->rec_len)); | ||
1668 | } | 1669 | } |
1669 | return -ENOENT; | 1670 | return -ENOENT; |
1670 | } | 1671 | } |
@@ -1798,13 +1799,13 @@ retry: | |||
1798 | de = (struct ext3_dir_entry_2 *) dir_block->b_data; | 1799 | de = (struct ext3_dir_entry_2 *) dir_block->b_data; |
1799 | de->inode = cpu_to_le32(inode->i_ino); | 1800 | de->inode = cpu_to_le32(inode->i_ino); |
1800 | de->name_len = 1; | 1801 | de->name_len = 1; |
1801 | de->rec_len = cpu_to_le16(EXT3_DIR_REC_LEN(de->name_len)); | 1802 | de->rec_len = ext3_rec_len_to_disk(EXT3_DIR_REC_LEN(de->name_len)); |
1802 | strcpy (de->name, "."); | 1803 | strcpy (de->name, "."); |
1803 | ext3_set_de_type(dir->i_sb, de, S_IFDIR); | 1804 | ext3_set_de_type(dir->i_sb, de, S_IFDIR); |
1804 | de = (struct ext3_dir_entry_2 *) | 1805 | de = ext3_next_entry(de); |
1805 | ((char *) de + le16_to_cpu(de->rec_len)); | ||
1806 | de->inode = cpu_to_le32(dir->i_ino); | 1806 | de->inode = cpu_to_le32(dir->i_ino); |
1807 | de->rec_len = cpu_to_le16(inode->i_sb->s_blocksize-EXT3_DIR_REC_LEN(1)); | 1807 | de->rec_len = ext3_rec_len_to_disk(inode->i_sb->s_blocksize - |
1808 | EXT3_DIR_REC_LEN(1)); | ||
1808 | de->name_len = 2; | 1809 | de->name_len = 2; |
1809 | strcpy (de->name, ".."); | 1810 | strcpy (de->name, ".."); |
1810 | ext3_set_de_type(dir->i_sb, de, S_IFDIR); | 1811 | ext3_set_de_type(dir->i_sb, de, S_IFDIR); |
@@ -1856,8 +1857,7 @@ static int empty_dir (struct inode * inode) | |||
1856 | return 1; | 1857 | return 1; |
1857 | } | 1858 | } |
1858 | de = (struct ext3_dir_entry_2 *) bh->b_data; | 1859 | de = (struct ext3_dir_entry_2 *) bh->b_data; |
1859 | de1 = (struct ext3_dir_entry_2 *) | 1860 | de1 = ext3_next_entry(de); |
1860 | ((char *) de + le16_to_cpu(de->rec_len)); | ||
1861 | if (le32_to_cpu(de->inode) != inode->i_ino || | 1861 | if (le32_to_cpu(de->inode) != inode->i_ino || |
1862 | !le32_to_cpu(de1->inode) || | 1862 | !le32_to_cpu(de1->inode) || |
1863 | strcmp (".", de->name) || | 1863 | strcmp (".", de->name) || |
@@ -1868,9 +1868,9 @@ static int empty_dir (struct inode * inode) | |||
1868 | brelse (bh); | 1868 | brelse (bh); |
1869 | return 1; | 1869 | return 1; |
1870 | } | 1870 | } |
1871 | offset = le16_to_cpu(de->rec_len) + le16_to_cpu(de1->rec_len); | 1871 | offset = ext3_rec_len_from_disk(de->rec_len) + |
1872 | de = (struct ext3_dir_entry_2 *) | 1872 | ext3_rec_len_from_disk(de1->rec_len); |
1873 | ((char *) de1 + le16_to_cpu(de1->rec_len)); | 1873 | de = ext3_next_entry(de1); |
1874 | while (offset < inode->i_size ) { | 1874 | while (offset < inode->i_size ) { |
1875 | if (!bh || | 1875 | if (!bh || |
1876 | (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { | 1876 | (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { |
@@ -1899,9 +1899,8 @@ static int empty_dir (struct inode * inode) | |||
1899 | brelse (bh); | 1899 | brelse (bh); |
1900 | return 0; | 1900 | return 0; |
1901 | } | 1901 | } |
1902 | offset += le16_to_cpu(de->rec_len); | 1902 | offset += ext3_rec_len_from_disk(de->rec_len); |
1903 | de = (struct ext3_dir_entry_2 *) | 1903 | de = ext3_next_entry(de); |
1904 | ((char *) de + le16_to_cpu(de->rec_len)); | ||
1905 | } | 1904 | } |
1906 | brelse (bh); | 1905 | brelse (bh); |
1907 | return 1; | 1906 | return 1; |
@@ -2255,8 +2254,7 @@ retry: | |||
2255 | } | 2254 | } |
2256 | 2255 | ||
2257 | #define PARENT_INO(buffer) \ | 2256 | #define PARENT_INO(buffer) \ |
2258 | ((struct ext3_dir_entry_2 *) ((char *) buffer + \ | 2257 | (ext3_next_entry((struct ext3_dir_entry_2 *)(buffer))->inode) |
2259 | le16_to_cpu(((struct ext3_dir_entry_2 *) buffer)->rec_len)))->inode | ||
2260 | 2258 | ||
2261 | /* | 2259 | /* |
2262 | * Anybody can rename anything with this: the permission checks are left to the | 2260 | * Anybody can rename anything with this: the permission checks are left to the |
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index e906b65448e2..71ee95e534fd 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -189,15 +189,6 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, | |||
189 | return desc; | 189 | return desc; |
190 | } | 190 | } |
191 | 191 | ||
192 | static inline int | ||
193 | block_in_use(ext4_fsblk_t block, struct super_block *sb, unsigned char *map) | ||
194 | { | ||
195 | ext4_grpblk_t offset; | ||
196 | |||
197 | ext4_get_group_no_and_offset(sb, block, NULL, &offset); | ||
198 | return ext4_test_bit (offset, map); | ||
199 | } | ||
200 | |||
201 | /** | 192 | /** |
202 | * read_block_bitmap() | 193 | * read_block_bitmap() |
203 | * @sb: super block | 194 | * @sb: super block |
@@ -211,7 +202,6 @@ block_in_use(ext4_fsblk_t block, struct super_block *sb, unsigned char *map) | |||
211 | struct buffer_head * | 202 | struct buffer_head * |
212 | read_block_bitmap(struct super_block *sb, unsigned int block_group) | 203 | read_block_bitmap(struct super_block *sb, unsigned int block_group) |
213 | { | 204 | { |
214 | int i; | ||
215 | struct ext4_group_desc * desc; | 205 | struct ext4_group_desc * desc; |
216 | struct buffer_head * bh = NULL; | 206 | struct buffer_head * bh = NULL; |
217 | ext4_fsblk_t bitmap_blk; | 207 | ext4_fsblk_t bitmap_blk; |
@@ -239,38 +229,7 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) | |||
239 | "Cannot read block bitmap - " | 229 | "Cannot read block bitmap - " |
240 | "block_group = %d, block_bitmap = %llu", | 230 | "block_group = %d, block_bitmap = %llu", |
241 | block_group, bitmap_blk); | 231 | block_group, bitmap_blk); |
242 | |||
243 | /* check whether block bitmap block number is set */ | ||
244 | if (!block_in_use(bitmap_blk, sb, bh->b_data)) { | ||
245 | /* bad block bitmap */ | ||
246 | goto error_out; | ||
247 | } | ||
248 | |||
249 | /* check whether the inode bitmap block number is set */ | ||
250 | bitmap_blk = ext4_inode_bitmap(sb, desc); | ||
251 | if (!block_in_use(bitmap_blk, sb, bh->b_data)) { | ||
252 | /* bad block bitmap */ | ||
253 | goto error_out; | ||
254 | } | ||
255 | /* check whether the inode table block number is set */ | ||
256 | bitmap_blk = ext4_inode_table(sb, desc); | ||
257 | for (i = 0; i < EXT4_SB(sb)->s_itb_per_group; i++, bitmap_blk++) { | ||
258 | if (!block_in_use(bitmap_blk, sb, bh->b_data)) { | ||
259 | /* bad block bitmap */ | ||
260 | goto error_out; | ||
261 | } | ||
262 | } | ||
263 | |||
264 | return bh; | 232 | return bh; |
265 | |||
266 | error_out: | ||
267 | brelse(bh); | ||
268 | ext4_error(sb, __FUNCTION__, | ||
269 | "Invalid block bitmap - " | ||
270 | "block_group = %d, block = %llu", | ||
271 | block_group, bitmap_blk); | ||
272 | return NULL; | ||
273 | |||
274 | } | 233 | } |
275 | /* | 234 | /* |
276 | * The reservation window structure operations | 235 | * The reservation window structure operations |
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index c04c7ccba9e3..e7f894bdb420 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -51,6 +51,11 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
51 | flags &= ~EXT4_DIRSYNC_FL; | 51 | flags &= ~EXT4_DIRSYNC_FL; |
52 | 52 | ||
53 | mutex_lock(&inode->i_mutex); | 53 | mutex_lock(&inode->i_mutex); |
54 | /* Is it quota file? Do not allow user to mess with it */ | ||
55 | if (IS_NOQUOTA(inode)) { | ||
56 | mutex_unlock(&inode->i_mutex); | ||
57 | return -EPERM; | ||
58 | } | ||
54 | oldflags = ei->i_flags; | 59 | oldflags = ei->i_flags; |
55 | 60 | ||
56 | /* The JOURNAL_DATA flag is modifiable only by root */ | 61 | /* The JOURNAL_DATA flag is modifiable only by root */ |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 0fcdba9d47c0..535b37399009 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -55,9 +55,10 @@ struct fuse_file *fuse_file_alloc(void) | |||
55 | if (!ff->reserved_req) { | 55 | if (!ff->reserved_req) { |
56 | kfree(ff); | 56 | kfree(ff); |
57 | ff = NULL; | 57 | ff = NULL; |
58 | } else { | ||
59 | INIT_LIST_HEAD(&ff->write_entry); | ||
60 | atomic_set(&ff->count, 0); | ||
58 | } | 61 | } |
59 | INIT_LIST_HEAD(&ff->write_entry); | ||
60 | atomic_set(&ff->count, 0); | ||
61 | } | 62 | } |
62 | return ff; | 63 | return ff; |
63 | } | 64 | } |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 12aca8ed605f..09ee07f02663 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -364,7 +364,6 @@ static void truncate_hugepages(struct inode *inode, loff_t lstart) | |||
364 | ++next; | 364 | ++next; |
365 | truncate_huge_page(page); | 365 | truncate_huge_page(page); |
366 | unlock_page(page); | 366 | unlock_page(page); |
367 | hugetlb_put_quota(mapping); | ||
368 | freed++; | 367 | freed++; |
369 | } | 368 | } |
370 | huge_pagevec_release(&pvec); | 369 | huge_pagevec_release(&pvec); |
@@ -859,15 +858,15 @@ out_free: | |||
859 | return -ENOMEM; | 858 | return -ENOMEM; |
860 | } | 859 | } |
861 | 860 | ||
862 | int hugetlb_get_quota(struct address_space *mapping) | 861 | int hugetlb_get_quota(struct address_space *mapping, long delta) |
863 | { | 862 | { |
864 | int ret = 0; | 863 | int ret = 0; |
865 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); | 864 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); |
866 | 865 | ||
867 | if (sbinfo->free_blocks > -1) { | 866 | if (sbinfo->free_blocks > -1) { |
868 | spin_lock(&sbinfo->stat_lock); | 867 | spin_lock(&sbinfo->stat_lock); |
869 | if (sbinfo->free_blocks > 0) | 868 | if (sbinfo->free_blocks - delta >= 0) |
870 | sbinfo->free_blocks--; | 869 | sbinfo->free_blocks -= delta; |
871 | else | 870 | else |
872 | ret = -ENOMEM; | 871 | ret = -ENOMEM; |
873 | spin_unlock(&sbinfo->stat_lock); | 872 | spin_unlock(&sbinfo->stat_lock); |
@@ -876,13 +875,13 @@ int hugetlb_get_quota(struct address_space *mapping) | |||
876 | return ret; | 875 | return ret; |
877 | } | 876 | } |
878 | 877 | ||
879 | void hugetlb_put_quota(struct address_space *mapping) | 878 | void hugetlb_put_quota(struct address_space *mapping, long delta) |
880 | { | 879 | { |
881 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); | 880 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); |
882 | 881 | ||
883 | if (sbinfo->free_blocks > -1) { | 882 | if (sbinfo->free_blocks > -1) { |
884 | spin_lock(&sbinfo->stat_lock); | 883 | spin_lock(&sbinfo->stat_lock); |
885 | sbinfo->free_blocks++; | 884 | sbinfo->free_blocks += delta; |
886 | spin_unlock(&sbinfo->stat_lock); | 885 | spin_unlock(&sbinfo->stat_lock); |
887 | } | 886 | } |
888 | } | 887 | } |
diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c index 3c8663bea98c..dfda12a073e1 100644 --- a/fs/jfs/ioctl.c +++ b/fs/jfs/ioctl.c | |||
@@ -79,6 +79,9 @@ int jfs_ioctl(struct inode * inode, struct file * filp, unsigned int cmd, | |||
79 | if (!S_ISDIR(inode->i_mode)) | 79 | if (!S_ISDIR(inode->i_mode)) |
80 | flags &= ~JFS_DIRSYNC_FL; | 80 | flags &= ~JFS_DIRSYNC_FL; |
81 | 81 | ||
82 | /* Is it quota file? Do not allow user to mess with it */ | ||
83 | if (IS_NOQUOTA(inode)) | ||
84 | return -EPERM; | ||
82 | jfs_get_inode_flags(jfs_inode); | 85 | jfs_get_inode_flags(jfs_inode); |
83 | oldflags = jfs_inode->mode2; | 86 | oldflags = jfs_inode->mode2; |
84 | 87 | ||
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index b61742885011..0e5fa11e6b44 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c | |||
@@ -41,7 +41,7 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp, | |||
41 | 41 | ||
42 | fh = fh_copy(&resp->fh, &argp->fh); | 42 | fh = fh_copy(&resp->fh, &argp->fh); |
43 | if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) | 43 | if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) |
44 | RETURN_STATUS(nfserr_inval); | 44 | RETURN_STATUS(nfserr); |
45 | 45 | ||
46 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) | 46 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) |
47 | RETURN_STATUS(nfserr_inval); | 47 | RETURN_STATUS(nfserr_inval); |
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c index 3e3f2de82c36..b647f2f872dc 100644 --- a/fs/nfsd/nfs3acl.c +++ b/fs/nfsd/nfs3acl.c | |||
@@ -37,7 +37,7 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp, | |||
37 | 37 | ||
38 | fh = fh_copy(&resp->fh, &argp->fh); | 38 | fh = fh_copy(&resp->fh, &argp->fh); |
39 | if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) | 39 | if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) |
40 | RETURN_STATUS(nfserr_inval); | 40 | RETURN_STATUS(nfserr); |
41 | 41 | ||
42 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) | 42 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) |
43 | RETURN_STATUS(nfserr_inval); | 43 | RETURN_STATUS(nfserr_inval); |
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index 4f712e970584..468f17a78441 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -95,6 +95,22 @@ nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type) | |||
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | 97 | ||
98 | static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp, | ||
99 | struct svc_export *exp) | ||
100 | { | ||
101 | /* Check if the request originated from a secure port. */ | ||
102 | if (!rqstp->rq_secure && EX_SECURE(exp)) { | ||
103 | char buf[RPC_MAX_ADDRBUFLEN]; | ||
104 | dprintk(KERN_WARNING | ||
105 | "nfsd: request from insecure port %s!\n", | ||
106 | svc_print_addr(rqstp, buf, sizeof(buf))); | ||
107 | return nfserr_perm; | ||
108 | } | ||
109 | |||
110 | /* Set user creds for this exportpoint */ | ||
111 | return nfserrno(nfsd_setuser(rqstp, exp)); | ||
112 | } | ||
113 | |||
98 | /* | 114 | /* |
99 | * Perform sanity checks on the dentry in a client's file handle. | 115 | * Perform sanity checks on the dentry in a client's file handle. |
100 | * | 116 | * |
@@ -167,18 +183,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
167 | goto out; | 183 | goto out; |
168 | } | 184 | } |
169 | 185 | ||
170 | /* Check if the request originated from a secure port. */ | 186 | error = nfsd_setuser_and_check_port(rqstp, exp); |
171 | error = nfserr_perm; | ||
172 | if (!rqstp->rq_secure && EX_SECURE(exp)) { | ||
173 | char buf[RPC_MAX_ADDRBUFLEN]; | ||
174 | printk(KERN_WARNING | ||
175 | "nfsd: request from insecure port %s!\n", | ||
176 | svc_print_addr(rqstp, buf, sizeof(buf))); | ||
177 | goto out; | ||
178 | } | ||
179 | |||
180 | /* Set user creds for this exportpoint */ | ||
181 | error = nfserrno(nfsd_setuser(rqstp, exp)); | ||
182 | if (error) | 187 | if (error) |
183 | goto out; | 188 | goto out; |
184 | 189 | ||
@@ -227,18 +232,22 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
227 | fhp->fh_export = exp; | 232 | fhp->fh_export = exp; |
228 | nfsd_nr_verified++; | 233 | nfsd_nr_verified++; |
229 | } else { | 234 | } else { |
230 | /* just rechecking permissions | 235 | /* |
231 | * (e.g. nfsproc_create calls fh_verify, then nfsd_create does as well) | 236 | * just rechecking permissions |
237 | * (e.g. nfsproc_create calls fh_verify, then nfsd_create | ||
238 | * does as well) | ||
232 | */ | 239 | */ |
233 | dprintk("nfsd: fh_verify - just checking\n"); | 240 | dprintk("nfsd: fh_verify - just checking\n"); |
234 | dentry = fhp->fh_dentry; | 241 | dentry = fhp->fh_dentry; |
235 | exp = fhp->fh_export; | 242 | exp = fhp->fh_export; |
236 | /* Set user creds for this exportpoint; necessary even | 243 | /* |
244 | * Set user creds for this exportpoint; necessary even | ||
237 | * in the "just checking" case because this may be a | 245 | * in the "just checking" case because this may be a |
238 | * filehandle that was created by fh_compose, and that | 246 | * filehandle that was created by fh_compose, and that |
239 | * is about to be used in another nfsv4 compound | 247 | * is about to be used in another nfsv4 compound |
240 | * operation */ | 248 | * operation. |
241 | error = nfserrno(nfsd_setuser(rqstp, exp)); | 249 | */ |
250 | error = nfsd_setuser_and_check_port(rqstp, exp); | ||
242 | if (error) | 251 | if (error) |
243 | goto out; | 252 | goto out; |
244 | } | 253 | } |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 685c18065c82..d84bd155997b 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/slab.h> | 58 | #include <linux/slab.h> |
59 | #include <linux/idr.h> | 59 | #include <linux/idr.h> |
60 | #include <linux/kref.h> | 60 | #include <linux/kref.h> |
61 | #include <linux/net.h> | ||
61 | #include <net/tcp.h> | 62 | #include <net/tcp.h> |
62 | 63 | ||
63 | #include <asm/uaccess.h> | 64 | #include <asm/uaccess.h> |
@@ -616,8 +617,7 @@ static void o2net_shutdown_sc(struct work_struct *work) | |||
616 | del_timer_sync(&sc->sc_idle_timeout); | 617 | del_timer_sync(&sc->sc_idle_timeout); |
617 | o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work); | 618 | o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work); |
618 | sc_put(sc); | 619 | sc_put(sc); |
619 | sc->sc_sock->ops->shutdown(sc->sc_sock, | 620 | kernel_sock_shutdown(sc->sc_sock, SHUT_RDWR); |
620 | RCV_SHUTDOWN|SEND_SHUTDOWN); | ||
621 | } | 621 | } |
622 | 622 | ||
623 | /* not fatal so failed connects before the other guy has our | 623 | /* not fatal so failed connects before the other guy has our |
@@ -1061,7 +1061,7 @@ asmlinkage long sys_open(const char __user *filename, int flags, int mode) | |||
1061 | prevent_tail_call(ret); | 1061 | prevent_tail_call(ret); |
1062 | return ret; | 1062 | return ret; |
1063 | } | 1063 | } |
1064 | EXPORT_SYMBOL_GPL(sys_open); | 1064 | EXPORT_UNUSED_SYMBOL_GPL(sys_open); /* To be deleted for 2.6.25 */ |
1065 | 1065 | ||
1066 | asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, | 1066 | asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, |
1067 | int mode) | 1067 | int mode) |
diff --git a/fs/proc/base.c b/fs/proc/base.c index aeaf0d0f2f51..a17c26859074 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2328,21 +2328,18 @@ out: | |||
2328 | 2328 | ||
2329 | void proc_flush_task(struct task_struct *task) | 2329 | void proc_flush_task(struct task_struct *task) |
2330 | { | 2330 | { |
2331 | int i, leader; | 2331 | int i; |
2332 | struct pid *pid, *tgid; | 2332 | struct pid *pid, *tgid = NULL; |
2333 | struct upid *upid; | 2333 | struct upid *upid; |
2334 | 2334 | ||
2335 | leader = thread_group_leader(task); | ||
2336 | proc_flush_task_mnt(proc_mnt, task->pid, leader ? task->tgid : 0); | ||
2337 | pid = task_pid(task); | 2335 | pid = task_pid(task); |
2338 | if (pid->level == 0) | 2336 | if (thread_group_leader(task)) |
2339 | return; | 2337 | tgid = task_tgid(task); |
2340 | 2338 | ||
2341 | tgid = task_tgid(task); | 2339 | for (i = 0; i <= pid->level; i++) { |
2342 | for (i = 1; i <= pid->level; i++) { | ||
2343 | upid = &pid->numbers[i]; | 2340 | upid = &pid->numbers[i]; |
2344 | proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr, | 2341 | proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr, |
2345 | leader ? 0 : tgid->numbers[i].nr); | 2342 | tgid ? tgid->numbers[i].nr : 0); |
2346 | } | 2343 | } |
2347 | 2344 | ||
2348 | upid = &pid->numbers[pid->level]; | 2345 | upid = &pid->numbers[pid->level]; |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 1bdb62435758..a9806bc21ec3 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -561,28 +561,33 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp | |||
561 | static void proc_kill_inodes(struct proc_dir_entry *de) | 561 | static void proc_kill_inodes(struct proc_dir_entry *de) |
562 | { | 562 | { |
563 | struct list_head *p; | 563 | struct list_head *p; |
564 | struct super_block *sb = proc_mnt->mnt_sb; | 564 | struct super_block *sb; |
565 | 565 | ||
566 | /* | 566 | /* |
567 | * Actually it's a partial revoke(). | 567 | * Actually it's a partial revoke(). |
568 | */ | 568 | */ |
569 | file_list_lock(); | 569 | spin_lock(&sb_lock); |
570 | list_for_each(p, &sb->s_files) { | 570 | list_for_each_entry(sb, &proc_fs_type.fs_supers, s_instances) { |
571 | struct file * filp = list_entry(p, struct file, f_u.fu_list); | 571 | file_list_lock(); |
572 | struct dentry * dentry = filp->f_path.dentry; | 572 | list_for_each(p, &sb->s_files) { |
573 | struct inode * inode; | 573 | struct file *filp = list_entry(p, struct file, |
574 | const struct file_operations *fops; | 574 | f_u.fu_list); |
575 | 575 | struct dentry *dentry = filp->f_path.dentry; | |
576 | if (dentry->d_op != &proc_dentry_operations) | 576 | struct inode *inode; |
577 | continue; | 577 | const struct file_operations *fops; |
578 | inode = dentry->d_inode; | 578 | |
579 | if (PDE(inode) != de) | 579 | if (dentry->d_op != &proc_dentry_operations) |
580 | continue; | 580 | continue; |
581 | fops = filp->f_op; | 581 | inode = dentry->d_inode; |
582 | filp->f_op = NULL; | 582 | if (PDE(inode) != de) |
583 | fops_put(fops); | 583 | continue; |
584 | fops = filp->f_op; | ||
585 | filp->f_op = NULL; | ||
586 | fops_put(fops); | ||
587 | } | ||
588 | file_list_unlock(); | ||
584 | } | 589 | } |
585 | file_list_unlock(); | 590 | spin_unlock(&sb_lock); |
586 | } | 591 | } |
587 | 592 | ||
588 | static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, | 593 | static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 1820eb2ef762..1b2b6c6bb475 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -78,3 +78,5 @@ static inline int proc_fd(struct inode *inode) | |||
78 | { | 78 | { |
79 | return PROC_I(inode)->fd; | 79 | return PROC_I(inode)->fd; |
80 | } | 80 | } |
81 | |||
82 | extern struct file_system_type proc_fs_type; | ||
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index 153554cf5575..131f9c68be5f 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
@@ -178,7 +178,7 @@ static __net_exit void proc_net_ns_exit(struct net *net) | |||
178 | kfree(net->proc_net_root); | 178 | kfree(net->proc_net_root); |
179 | } | 179 | } |
180 | 180 | ||
181 | static struct pernet_operations proc_net_ns_ops = { | 181 | static struct pernet_operations __net_initdata proc_net_ns_ops = { |
182 | .init = proc_net_ns_init, | 182 | .init = proc_net_ns_init, |
183 | .exit = proc_net_ns_exit, | 183 | .exit = proc_net_ns_exit, |
184 | }; | 184 | }; |
diff --git a/fs/proc/root.c b/fs/proc/root.c index ec9cb3b6c93b..1f86bb860e04 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -98,7 +98,7 @@ static void proc_kill_sb(struct super_block *sb) | |||
98 | put_pid_ns(ns); | 98 | put_pid_ns(ns); |
99 | } | 99 | } |
100 | 100 | ||
101 | static struct file_system_type proc_fs_type = { | 101 | struct file_system_type proc_fs_type = { |
102 | .name = "proc", | 102 | .name = "proc", |
103 | .get_sb = proc_get_sb, | 103 | .get_sb = proc_get_sb, |
104 | .kill_sb = proc_kill_sb, | 104 | .kill_sb = proc_kill_sb, |
diff --git a/fs/read_write.c b/fs/read_write.c index 124693e8d3fa..ea1f94cc722e 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -370,7 +370,7 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count) | |||
370 | 370 | ||
371 | return ret; | 371 | return ret; |
372 | } | 372 | } |
373 | EXPORT_SYMBOL_GPL(sys_read); | 373 | EXPORT_UNUSED_SYMBOL_GPL(sys_read); /* to be deleted for 2.6.25 */ |
374 | 374 | ||
375 | asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count) | 375 | asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count) |
376 | { | 376 | { |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index c438a8f83f26..e0f0f098a523 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -57,6 +57,9 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | |||
57 | if (get_user(flags, (int __user *)arg)) | 57 | if (get_user(flags, (int __user *)arg)) |
58 | return -EFAULT; | 58 | return -EFAULT; |
59 | 59 | ||
60 | /* Is it quota file? Do not allow user to mess with it. */ | ||
61 | if (IS_NOQUOTA(inode)) | ||
62 | return -EPERM; | ||
60 | if (((flags ^ REISERFS_I(inode)-> | 63 | if (((flags ^ REISERFS_I(inode)-> |
61 | i_attrs) & (REISERFS_IMMUTABLE_FL | | 64 | i_attrs) & (REISERFS_IMMUTABLE_FL | |
62 | REISERFS_APPEND_FL)) | 65 | REISERFS_APPEND_FL)) |
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index ca41567d7890..d2db2417b2bd 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -1458,9 +1458,6 @@ static void unmap_buffers(struct page *page, loff_t pos) | |||
1458 | } | 1458 | } |
1459 | bh = next; | 1459 | bh = next; |
1460 | } while (bh != head); | 1460 | } while (bh != head); |
1461 | if (PAGE_SIZE == bh->b_size) { | ||
1462 | cancel_dirty_page(page, PAGE_CACHE_SIZE); | ||
1463 | } | ||
1464 | } | 1461 | } |
1465 | } | 1462 | } |
1466 | } | 1463 | } |
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c index f5d14cebc75a..efbe29af3d7a 100644 --- a/fs/smbfs/file.c +++ b/fs/smbfs/file.c | |||
@@ -234,7 +234,7 @@ smb_file_aio_read(struct kiocb *iocb, const struct iovec *iov, | |||
234 | 234 | ||
235 | VERBOSE("before read, size=%ld, flags=%x, atime=%ld\n", | 235 | VERBOSE("before read, size=%ld, flags=%x, atime=%ld\n", |
236 | (long)dentry->d_inode->i_size, | 236 | (long)dentry->d_inode->i_size, |
237 | dentry->d_inode->i_flags, dentry->d_inode->i_atime); | 237 | dentry->d_inode->i_flags, dentry->d_inode->i_atime.tv_sec); |
238 | 238 | ||
239 | status = generic_file_aio_read(iocb, iov, nr_segs, pos); | 239 | status = generic_file_aio_read(iocb, iov, nr_segs, pos); |
240 | out: | 240 | out: |
@@ -269,7 +269,7 @@ smb_file_splice_read(struct file *file, loff_t *ppos, | |||
269 | struct dentry *dentry = file->f_path.dentry; | 269 | struct dentry *dentry = file->f_path.dentry; |
270 | ssize_t status; | 270 | ssize_t status; |
271 | 271 | ||
272 | VERBOSE("file %s/%s, pos=%Ld, count=%d\n", | 272 | VERBOSE("file %s/%s, pos=%Ld, count=%lu\n", |
273 | DENTRY_PATH(dentry), *ppos, count); | 273 | DENTRY_PATH(dentry), *ppos, count); |
274 | 274 | ||
275 | status = smb_revalidate_inode(dentry); | 275 | status = smb_revalidate_inode(dentry); |
@@ -363,7 +363,8 @@ smb_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
363 | result = generic_file_aio_write(iocb, iov, nr_segs, pos); | 363 | result = generic_file_aio_write(iocb, iov, nr_segs, pos); |
364 | VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n", | 364 | VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n", |
365 | (long) file->f_pos, (long) dentry->d_inode->i_size, | 365 | (long) file->f_pos, (long) dentry->d_inode->i_size, |
366 | dentry->d_inode->i_mtime, dentry->d_inode->i_atime); | 366 | dentry->d_inode->i_mtime.tv_sec, |
367 | dentry->d_inode->i_atime.tv_sec); | ||
367 | } | 368 | } |
368 | out: | 369 | out: |
369 | return result; | 370 | return result; |
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index ab517755ece0..9416ead0c7aa 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -536,7 +536,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
536 | 536 | ||
537 | /* Allocate the global temp buffer and some superblock helper structs */ | 537 | /* Allocate the global temp buffer and some superblock helper structs */ |
538 | /* FIXME: move these to the smb_sb_info struct */ | 538 | /* FIXME: move these to the smb_sb_info struct */ |
539 | VERBOSE("alloc chunk = %d\n", sizeof(struct smb_ops) + | 539 | VERBOSE("alloc chunk = %lu\n", sizeof(struct smb_ops) + |
540 | sizeof(struct smb_mount_data_kernel)); | 540 | sizeof(struct smb_mount_data_kernel)); |
541 | mem = kmalloc(sizeof(struct smb_ops) + | 541 | mem = kmalloc(sizeof(struct smb_ops) + |
542 | sizeof(struct smb_mount_data_kernel), GFP_KERNEL); | 542 | sizeof(struct smb_mount_data_kernel), GFP_KERNEL); |
diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c index feac46050619..d517a27b7f4b 100644 --- a/fs/smbfs/proc.c +++ b/fs/smbfs/proc.c | |||
@@ -2593,7 +2593,7 @@ smb_proc_getattr_ff(struct smb_sb_info *server, struct dentry *dentry, | |||
2593 | fattr->f_mtime.tv_sec = date_dos2unix(server, date, time); | 2593 | fattr->f_mtime.tv_sec = date_dos2unix(server, date, time); |
2594 | fattr->f_mtime.tv_nsec = 0; | 2594 | fattr->f_mtime.tv_nsec = 0; |
2595 | VERBOSE("name=%s, date=%x, time=%x, mtime=%ld\n", | 2595 | VERBOSE("name=%s, date=%x, time=%x, mtime=%ld\n", |
2596 | mask, date, time, fattr->f_mtime); | 2596 | mask, date, time, fattr->f_mtime.tv_sec); |
2597 | fattr->f_size = DVAL(req->rq_data, 12); | 2597 | fattr->f_size = DVAL(req->rq_data, 12); |
2598 | /* ULONG allocation size */ | 2598 | /* ULONG allocation size */ |
2599 | fattr->attr = WVAL(req->rq_data, 20); | 2599 | fattr->attr = WVAL(req->rq_data, 20); |
diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index 283c5720c9de..fae8e85af0ed 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c | |||
@@ -227,7 +227,7 @@ int smbiod_retry(struct smb_sb_info *server) | |||
227 | printk(KERN_ERR "smb_retry: signal failed [%d]\n", result); | 227 | printk(KERN_ERR "smb_retry: signal failed [%d]\n", result); |
228 | goto out; | 228 | goto out; |
229 | } | 229 | } |
230 | VERBOSE("signalled pid %d\n", pid); | 230 | VERBOSE("signalled pid %d\n", pid_nr(pid)); |
231 | 231 | ||
232 | /* FIXME: The retried requests should perhaps get a "time boost". */ | 232 | /* FIXME: The retried requests should perhaps get a "time boost". */ |
233 | 233 | ||
diff --git a/include/asm-cris/atomic.h b/include/asm-cris/atomic.h index 0b51a87e5532..2949a945876a 100644 --- a/include/asm-cris/atomic.h +++ b/include/asm-cris/atomic.h | |||
@@ -3,6 +3,8 @@ | |||
3 | #ifndef __ASM_CRIS_ATOMIC__ | 3 | #ifndef __ASM_CRIS_ATOMIC__ |
4 | #define __ASM_CRIS_ATOMIC__ | 4 | #define __ASM_CRIS_ATOMIC__ |
5 | 5 | ||
6 | #include <linux/compiler.h> | ||
7 | |||
6 | #include <asm/system.h> | 8 | #include <asm/system.h> |
7 | #include <asm/arch/atomic.h> | 9 | #include <asm/arch/atomic.h> |
8 | 10 | ||
diff --git a/include/asm-cris/checksum.h b/include/asm-cris/checksum.h index 180dbf2757b0..c6c5be62c698 100644 --- a/include/asm-cris/checksum.h +++ b/include/asm-cris/checksum.h | |||
@@ -62,7 +62,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | |||
62 | * returns a 16-bit checksum, already complemented | 62 | * returns a 16-bit checksum, already complemented |
63 | */ | 63 | */ |
64 | 64 | ||
65 | static inline __sum16 int csum_tcpudp_magic(__be32 saddr, __be32 daddr, | 65 | static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, |
66 | unsigned short len, | 66 | unsigned short len, |
67 | unsigned short proto, | 67 | unsigned short proto, |
68 | __wsum sum) | 68 | __wsum sum) |
diff --git a/include/asm-cris/ethernet.h b/include/asm-cris/ethernet.h index 30da58a7d00d..4d58652c3a49 100644 --- a/include/asm-cris/ethernet.h +++ b/include/asm-cris/ethernet.h | |||
@@ -15,4 +15,7 @@ | |||
15 | #define SET_ETH_DUPLEX_AUTO SIOCDEVPRIVATE+3 /* Auto neg duplex */ | 15 | #define SET_ETH_DUPLEX_AUTO SIOCDEVPRIVATE+3 /* Auto neg duplex */ |
16 | #define SET_ETH_DUPLEX_HALF SIOCDEVPRIVATE+4 /* Full duplex */ | 16 | #define SET_ETH_DUPLEX_HALF SIOCDEVPRIVATE+4 /* Full duplex */ |
17 | #define SET_ETH_DUPLEX_FULL SIOCDEVPRIVATE+5 /* Half duplex */ | 17 | #define SET_ETH_DUPLEX_FULL SIOCDEVPRIVATE+5 /* Half duplex */ |
18 | #define SET_ETH_ENABLE_LEDS SIOCDEVPRIVATE+6 /* Enable net LEDs */ | ||
19 | #define SET_ETH_DISABLE_LEDS SIOCDEVPRIVATE+7 /* Disable net LEDs */ | ||
20 | #define SET_ETH_AUTONEG SIOCDEVPRIVATE+8 | ||
18 | #endif /* _CRIS_ETHERNET_H */ | 21 | #endif /* _CRIS_ETHERNET_H */ |
diff --git a/include/asm-cris/fasttimer.h b/include/asm-cris/fasttimer.h index a3a77132ce32..8f8a8d6c9653 100644 --- a/include/asm-cris/fasttimer.h +++ b/include/asm-cris/fasttimer.h | |||
@@ -1,9 +1,8 @@ | |||
1 | /* $Id: fasttimer.h,v 1.3 2004/05/14 10:19:19 starvik Exp $ | 1 | /* |
2 | * linux/include/asm-cris/fasttimer.h | 2 | * linux/include/asm-cris/fasttimer.h |
3 | * | 3 | * |
4 | * Fast timers for ETRAX100LX | 4 | * Fast timers for ETRAX100LX |
5 | * This may be useful in other OS than Linux so use 2 space indentation... | 5 | * Copyright (C) 2000-2007 Axis Communications AB |
6 | * Copyright (C) 2000, 2002 Axis Communications AB | ||
7 | */ | 6 | */ |
8 | #include <linux/time.h> /* struct timeval */ | 7 | #include <linux/time.h> /* struct timeval */ |
9 | #include <linux/timex.h> | 8 | #include <linux/timex.h> |
@@ -12,11 +11,16 @@ | |||
12 | 11 | ||
13 | typedef void fast_timer_function_type(unsigned long); | 12 | typedef void fast_timer_function_type(unsigned long); |
14 | 13 | ||
14 | struct fasttime_t { | ||
15 | unsigned long tv_jiff; /* jiffies */ | ||
16 | unsigned long tv_usec; /* microseconds */ | ||
17 | }; | ||
18 | |||
15 | struct fast_timer{ /* Close to timer_list */ | 19 | struct fast_timer{ /* Close to timer_list */ |
16 | struct fast_timer *next; | 20 | struct fast_timer *next; |
17 | struct fast_timer *prev; | 21 | struct fast_timer *prev; |
18 | struct timeval tv_set; | 22 | struct fasttime_t tv_set; |
19 | struct timeval tv_expires; | 23 | struct fasttime_t tv_expires; |
20 | unsigned long delay_us; | 24 | unsigned long delay_us; |
21 | fast_timer_function_type *function; | 25 | fast_timer_function_type *function; |
22 | unsigned long data; | 26 | unsigned long data; |
@@ -38,6 +42,6 @@ int del_fast_timer(struct fast_timer * t); | |||
38 | void schedule_usleep(unsigned long us); | 42 | void schedule_usleep(unsigned long us); |
39 | 43 | ||
40 | 44 | ||
41 | void fast_timer_init(void); | 45 | int fast_timer_init(void); |
42 | 46 | ||
43 | #endif | 47 | #endif |
diff --git a/include/asm-cris/hardirq.h b/include/asm-cris/hardirq.h index 1c13dd3faac3..74178adeb1cd 100644 --- a/include/asm-cris/hardirq.h +++ b/include/asm-cris/hardirq.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __ASM_HARDIRQ_H | 1 | #ifndef __ASM_HARDIRQ_H |
2 | #define __ASM_HARDIRQ_H | 2 | #define __ASM_HARDIRQ_H |
3 | 3 | ||
4 | #include <asm/irq.h> | ||
4 | #include <linux/threads.h> | 5 | #include <linux/threads.h> |
5 | #include <linux/cache.h> | 6 | #include <linux/cache.h> |
6 | 7 | ||
diff --git a/include/asm-cris/posix_types.h b/include/asm-cris/posix_types.h index 92000d0c3f97..3a5e4c43eae7 100644 --- a/include/asm-cris/posix_types.h +++ b/include/asm-cris/posix_types.h | |||
@@ -52,7 +52,6 @@ typedef struct { | |||
52 | } __kernel_fsid_t; | 52 | } __kernel_fsid_t; |
53 | 53 | ||
54 | #ifdef __KERNEL__ | 54 | #ifdef __KERNEL__ |
55 | #include <linux/bitops.h> | ||
56 | 55 | ||
57 | #undef __FD_SET | 56 | #undef __FD_SET |
58 | #define __FD_SET(fd,fdsetp) set_bit(fd, (void *)(fdsetp)) | 57 | #define __FD_SET(fd,fdsetp) set_bit(fd, (void *)(fdsetp)) |
diff --git a/include/asm-cris/termbits.h b/include/asm-cris/termbits.h index 71c1b36269b8..66e1a7492a0c 100644 --- a/include/asm-cris/termbits.h +++ b/include/asm-cris/termbits.h | |||
@@ -171,6 +171,19 @@ struct ktermios { | |||
171 | #define B115200 0010002 | 171 | #define B115200 0010002 |
172 | #define B230400 0010003 | 172 | #define B230400 0010003 |
173 | #define B460800 0010004 | 173 | #define B460800 0010004 |
174 | |||
175 | /* Unsupported rates, but needed to avoid compile error. */ | ||
176 | #define B500000 0010005 | ||
177 | #define B576000 0010006 | ||
178 | #define B1000000 0010010 | ||
179 | #define B1152000 0010011 | ||
180 | #define B1500000 0010012 | ||
181 | #define B2000000 0010013 | ||
182 | #define B2500000 0010014 | ||
183 | #define B3000000 0010015 | ||
184 | #define B3500000 0010016 | ||
185 | #define B4000000 0010017 | ||
186 | |||
174 | /* etrax supports these additional three baud rates */ | 187 | /* etrax supports these additional three baud rates */ |
175 | #define B921600 0010005 | 188 | #define B921600 0010005 |
176 | #define B1843200 0010006 | 189 | #define B1843200 0010006 |
diff --git a/include/asm-cris/thread_info.h b/include/asm-cris/thread_info.h index fde39f6c49c7..784668ab0fa2 100644 --- a/include/asm-cris/thread_info.h +++ b/include/asm-cris/thread_info.h | |||
@@ -32,6 +32,7 @@ struct thread_info { | |||
32 | unsigned long flags; /* low level flags */ | 32 | unsigned long flags; /* low level flags */ |
33 | __u32 cpu; /* current CPU */ | 33 | __u32 cpu; /* current CPU */ |
34 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | 34 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
35 | __u32 tls; /* TLS for this thread */ | ||
35 | 36 | ||
36 | mm_segment_t addr_limit; /* thread address space: | 37 | mm_segment_t addr_limit; /* thread address space: |
37 | 0-0xBFFFFFFF for user-thead | 38 | 0-0xBFFFFFFF for user-thead |
@@ -79,14 +80,18 @@ struct thread_info { | |||
79 | * - other flags in MSW | 80 | * - other flags in MSW |
80 | */ | 81 | */ |
81 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | 82 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
82 | #define TIF_SIGPENDING 1 /* signal pending */ | 83 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ |
83 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | 84 | #define TIF_SIGPENDING 2 /* signal pending */ |
85 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
86 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ | ||
84 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | 87 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ |
85 | #define TIF_MEMDIE 17 | 88 | #define TIF_MEMDIE 17 |
86 | 89 | ||
87 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 90 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
91 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | ||
88 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 92 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
89 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 93 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
94 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
90 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 95 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
91 | 96 | ||
92 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | 97 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ |
diff --git a/include/asm-cris/tlb.h b/include/asm-cris/tlb.h index 6cc26debe40f..7724246a2601 100644 --- a/include/asm-cris/tlb.h +++ b/include/asm-cris/tlb.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _CRIS_TLB_H | 1 | #ifndef _CRIS_TLB_H |
2 | #define _CRIS_TLB_H | 2 | #define _CRIS_TLB_H |
3 | 3 | ||
4 | #include <linux/pagemap.h> | ||
5 | |||
4 | #include <asm/arch/tlb.h> | 6 | #include <asm/arch/tlb.h> |
5 | 7 | ||
6 | /* | 8 | /* |
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h index 7c90fa970c38..6f2d924f4fd6 100644 --- a/include/asm-cris/unistd.h +++ b/include/asm-cris/unistd.h | |||
@@ -255,6 +255,7 @@ | |||
255 | #define __NR_io_submit 248 | 255 | #define __NR_io_submit 248 |
256 | #define __NR_io_cancel 249 | 256 | #define __NR_io_cancel 249 |
257 | #define __NR_fadvise64 250 | 257 | #define __NR_fadvise64 250 |
258 | /* 251 is available for reuse (was briefly sys_set_zone_reclaim) */ | ||
258 | #define __NR_exit_group 252 | 259 | #define __NR_exit_group 252 |
259 | #define __NR_lookup_dcookie 253 | 260 | #define __NR_lookup_dcookie 253 |
260 | #define __NR_epoll_create 254 | 261 | #define __NR_epoll_create 254 |
@@ -292,10 +293,46 @@ | |||
292 | #define __NR_add_key 286 | 293 | #define __NR_add_key 286 |
293 | #define __NR_request_key 287 | 294 | #define __NR_request_key 287 |
294 | #define __NR_keyctl 288 | 295 | #define __NR_keyctl 288 |
296 | #define __NR_ioprio_set 289 | ||
297 | #define __NR_ioprio_get 290 | ||
298 | #define __NR_inotify_init 291 | ||
299 | #define __NR_inotify_add_watch 292 | ||
300 | #define __NR_inotify_rm_watch 293 | ||
301 | #define __NR_migrate_pages 294 | ||
302 | #define __NR_openat 295 | ||
303 | #define __NR_mkdirat 296 | ||
304 | #define __NR_mknodat 297 | ||
305 | #define __NR_fchownat 298 | ||
306 | #define __NR_futimesat 299 | ||
307 | #define __NR_fstatat64 300 | ||
308 | #define __NR_unlinkat 301 | ||
309 | #define __NR_renameat 302 | ||
310 | #define __NR_linkat 303 | ||
311 | #define __NR_symlinkat 304 | ||
312 | #define __NR_readlinkat 305 | ||
313 | #define __NR_fchmodat 306 | ||
314 | #define __NR_faccessat 307 | ||
315 | #define __NR_pselect6 308 | ||
316 | #define __NR_ppoll 309 | ||
317 | #define __NR_unshare 310 | ||
318 | #define __NR_set_robust_list 311 | ||
319 | #define __NR_get_robust_list 312 | ||
320 | #define __NR_splice 313 | ||
321 | #define __NR_sync_file_range 314 | ||
322 | #define __NR_tee 315 | ||
323 | #define __NR_vmsplice 316 | ||
324 | #define __NR_move_pages 317 | ||
325 | #define __NR_getcpu 318 | ||
326 | #define __NR_epoll_pwait 319 | ||
327 | #define __NR_utimensat 320 | ||
328 | #define __NR_signalfd 321 | ||
329 | #define __NR_timerfd 322 | ||
330 | #define __NR_eventfd 323 | ||
331 | #define __NR_fallocate 324 | ||
295 | 332 | ||
296 | #ifdef __KERNEL__ | 333 | #ifdef __KERNEL__ |
297 | 334 | ||
298 | #define NR_syscalls 289 | 335 | #define NR_syscalls 325 |
299 | 336 | ||
300 | #include <asm/arch/unistd.h> | 337 | #include <asm/arch/unistd.h> |
301 | 338 | ||
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h index 9d74338e3dec..4525c784dfd0 100644 --- a/include/asm-powerpc/cputable.h +++ b/include/asm-powerpc/cputable.h | |||
@@ -138,6 +138,7 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start, | |||
138 | #define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x0000000000800000) | 138 | #define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x0000000000800000) |
139 | #define CPU_FTR_UNIFIED_ID_CACHE ASM_CONST(0x0000000001000000) | 139 | #define CPU_FTR_UNIFIED_ID_CACHE ASM_CONST(0x0000000001000000) |
140 | #define CPU_FTR_SPE ASM_CONST(0x0000000002000000) | 140 | #define CPU_FTR_SPE ASM_CONST(0x0000000002000000) |
141 | #define CPU_FTR_NEED_PAIRED_STWCX ASM_CONST(0x0000000004000000) | ||
141 | 142 | ||
142 | /* | 143 | /* |
143 | * Add the 64-bit processor unique features in the top half of the word; | 144 | * Add the 64-bit processor unique features in the top half of the word; |
@@ -261,25 +262,25 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start, | |||
261 | #define CPU_FTRS_7450_20 (CPU_FTR_COMMON | \ | 262 | #define CPU_FTRS_7450_20 (CPU_FTR_COMMON | \ |
262 | CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ | 263 | CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ |
263 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ | 264 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ |
264 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) | 265 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) |
265 | #define CPU_FTRS_7450_21 (CPU_FTR_COMMON | \ | 266 | #define CPU_FTRS_7450_21 (CPU_FTR_COMMON | \ |
266 | CPU_FTR_USE_TB | \ | 267 | CPU_FTR_USE_TB | \ |
267 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ | 268 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ |
268 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ | 269 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ |
269 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ | 270 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ |
270 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) | 271 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) |
271 | #define CPU_FTRS_7450_23 (CPU_FTR_COMMON | \ | 272 | #define CPU_FTRS_7450_23 (CPU_FTR_COMMON | \ |
272 | CPU_FTR_USE_TB | \ | 273 | CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \ |
273 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ | 274 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ |
274 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ | 275 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ |
275 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) | 276 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) |
276 | #define CPU_FTRS_7455_1 (CPU_FTR_COMMON | \ | 277 | #define CPU_FTRS_7455_1 (CPU_FTR_COMMON | \ |
277 | CPU_FTR_USE_TB | \ | 278 | CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \ |
278 | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \ | 279 | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \ |
279 | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | \ | 280 | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | \ |
280 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) | 281 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) |
281 | #define CPU_FTRS_7455_20 (CPU_FTR_COMMON | \ | 282 | #define CPU_FTRS_7455_20 (CPU_FTR_COMMON | \ |
282 | CPU_FTR_USE_TB | \ | 283 | CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \ |
283 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ | 284 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ |
284 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ | 285 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ |
285 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ | 286 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ |
@@ -289,31 +290,32 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start, | |||
289 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ | 290 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ |
290 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ | 291 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ |
291 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ | 292 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ |
292 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) | 293 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) |
293 | #define CPU_FTRS_7447_10 (CPU_FTR_COMMON | \ | 294 | #define CPU_FTRS_7447_10 (CPU_FTR_COMMON | \ |
294 | CPU_FTR_USE_TB | \ | 295 | CPU_FTR_USE_TB | \ |
295 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ | 296 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ |
296 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ | 297 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ |
297 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ | 298 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ |
298 | CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC | CPU_FTR_PPC_LE) | 299 | CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC | CPU_FTR_PPC_LE | \ |
300 | CPU_FTR_NEED_PAIRED_STWCX) | ||
299 | #define CPU_FTRS_7447 (CPU_FTR_COMMON | \ | 301 | #define CPU_FTRS_7447 (CPU_FTR_COMMON | \ |
300 | CPU_FTR_USE_TB | \ | 302 | CPU_FTR_USE_TB | \ |
301 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ | 303 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ |
302 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ | 304 | CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ |
303 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ | 305 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ |
304 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) | 306 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) |
305 | #define CPU_FTRS_7447A (CPU_FTR_COMMON | \ | 307 | #define CPU_FTRS_7447A (CPU_FTR_COMMON | \ |
306 | CPU_FTR_USE_TB | \ | 308 | CPU_FTR_USE_TB | \ |
307 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ | 309 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ |
308 | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ | 310 | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ |
309 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ | 311 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ |
310 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) | 312 | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) |
311 | #define CPU_FTRS_7448 (CPU_FTR_COMMON | \ | 313 | #define CPU_FTRS_7448 (CPU_FTR_COMMON | \ |
312 | CPU_FTR_USE_TB | \ | 314 | CPU_FTR_USE_TB | \ |
313 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ | 315 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ |
314 | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ | 316 | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ |
315 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ | 317 | CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ |
316 | CPU_FTR_PPC_LE) | 318 | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) |
317 | #define CPU_FTRS_82XX (CPU_FTR_COMMON | \ | 319 | #define CPU_FTRS_82XX (CPU_FTR_COMMON | \ |
318 | CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB) | 320 | CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB) |
319 | #define CPU_FTRS_G2_LE (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \ | 321 | #define CPU_FTRS_G2_LE (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \ |
diff --git a/include/asm-powerpc/tlbflush.h b/include/asm-powerpc/tlbflush.h index e7b4c0d298ae..5c9108147644 100644 --- a/include/asm-powerpc/tlbflush.h +++ b/include/asm-powerpc/tlbflush.h | |||
@@ -44,13 +44,13 @@ static inline void flush_tlb_mm(struct mm_struct *mm) | |||
44 | static inline void flush_tlb_page(struct vm_area_struct *vma, | 44 | static inline void flush_tlb_page(struct vm_area_struct *vma, |
45 | unsigned long vmaddr) | 45 | unsigned long vmaddr) |
46 | { | 46 | { |
47 | _tlbie(vmaddr, vma->vm_mm->context.id); | 47 | _tlbie(vmaddr, vma ? vma->vm_mm->context.id : 0); |
48 | } | 48 | } |
49 | 49 | ||
50 | static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, | 50 | static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, |
51 | unsigned long vmaddr) | 51 | unsigned long vmaddr) |
52 | { | 52 | { |
53 | _tlbie(vmaddr, vma->vm_mm->context.id); | 53 | _tlbie(vmaddr, vma ? vma->vm_mm->context.id : 0); |
54 | } | 54 | } |
55 | 55 | ||
56 | static inline void flush_tlb_range(struct vm_area_struct *vma, | 56 | static inline void flush_tlb_range(struct vm_area_struct *vma, |
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h index aa82b88db805..3ebafbaacb24 100644 --- a/include/asm-um/pgtable-3level.h +++ b/include/asm-um/pgtable-3level.h | |||
@@ -71,7 +71,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) | |||
71 | 71 | ||
72 | static inline void pud_clear (pud_t *pud) | 72 | static inline void pud_clear (pud_t *pud) |
73 | { | 73 | { |
74 | set_pud(pud, __pud(0)); | 74 | set_pud(pud, __pud(_PAGE_NEWPAGE)); |
75 | } | 75 | } |
76 | 76 | ||
77 | #define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK) | 77 | #define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK) |
diff --git a/include/asm-x86/i387_64.h b/include/asm-x86/i387_64.h index 0217b74cc9fc..3a4ffba3d6bc 100644 --- a/include/asm-x86/i387_64.h +++ b/include/asm-x86/i387_64.h | |||
@@ -203,6 +203,11 @@ static inline void save_init_fpu(struct task_struct *tsk) | |||
203 | */ | 203 | */ |
204 | static inline int restore_i387(struct _fpstate __user *buf) | 204 | static inline int restore_i387(struct _fpstate __user *buf) |
205 | { | 205 | { |
206 | set_used_math(); | ||
207 | if (!(task_thread_info(current)->status & TS_USEDFPU)) { | ||
208 | clts(); | ||
209 | task_thread_info(current)->status |= TS_USEDFPU; | ||
210 | } | ||
206 | return restore_fpu_checking((__force struct i387_fxsave_struct *)buf); | 211 | return restore_fpu_checking((__force struct i387_fxsave_struct *)buf); |
207 | } | 212 | } |
208 | 213 | ||
diff --git a/include/asm-x86/ptrace.h b/include/asm-x86/ptrace.h index 213c97300cb3..51ddb2590870 100644 --- a/include/asm-x86/ptrace.h +++ b/include/asm-x86/ptrace.h | |||
@@ -60,7 +60,7 @@ static inline int v8086_mode(struct pt_regs *regs) | |||
60 | 60 | ||
61 | #define instruction_pointer(regs) ((regs)->eip) | 61 | #define instruction_pointer(regs) ((regs)->eip) |
62 | #define frame_pointer(regs) ((regs)->ebp) | 62 | #define frame_pointer(regs) ((regs)->ebp) |
63 | #define stack_pointer(regs) ((regs)->esp) | 63 | #define stack_pointer(regs) ((unsigned long)(regs)) |
64 | #define regs_return_value(regs) ((regs)->eax) | 64 | #define regs_return_value(regs) ((regs)->eax) |
65 | 65 | ||
66 | extern unsigned long profile_pc(struct pt_regs *regs); | 66 | extern unsigned long profile_pc(struct pt_regs *regs); |
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index 0b9bfbde8168..d62fcee9a08a 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h | |||
@@ -13,12 +13,6 @@ SUBSYS(cpuset) | |||
13 | 13 | ||
14 | /* */ | 14 | /* */ |
15 | 15 | ||
16 | #ifdef CONFIG_CGROUP_CPUACCT | ||
17 | SUBSYS(cpuacct) | ||
18 | #endif | ||
19 | |||
20 | /* */ | ||
21 | |||
22 | #ifdef CONFIG_CGROUP_DEBUG | 16 | #ifdef CONFIG_CGROUP_DEBUG |
23 | SUBSYS(debug) | 17 | SUBSYS(debug) |
24 | #endif | 18 | #endif |
diff --git a/include/linux/cpu_acct.h b/include/linux/cpu_acct.h deleted file mode 100644 index 6b5fd8a66c8d..000000000000 --- a/include/linux/cpu_acct.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | |||
2 | #ifndef _LINUX_CPU_ACCT_H | ||
3 | #define _LINUX_CPU_ACCT_H | ||
4 | |||
5 | #include <linux/cgroup.h> | ||
6 | #include <asm/cputime.h> | ||
7 | |||
8 | #ifdef CONFIG_CGROUP_CPUACCT | ||
9 | extern void cpuacct_charge(struct task_struct *, cputime_t cputime); | ||
10 | #else | ||
11 | static void inline cpuacct_charge(struct task_struct *p, cputime_t cputime) {} | ||
12 | #endif | ||
13 | |||
14 | #endif | ||
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 64134456ed8c..241c01cb92b2 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -656,6 +656,26 @@ struct ext3_dir_entry_2 { | |||
656 | #define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1) | 656 | #define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1) |
657 | #define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \ | 657 | #define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \ |
658 | ~EXT3_DIR_ROUND) | 658 | ~EXT3_DIR_ROUND) |
659 | #define EXT3_MAX_REC_LEN ((1<<16)-1) | ||
660 | |||
661 | static inline unsigned ext3_rec_len_from_disk(__le16 dlen) | ||
662 | { | ||
663 | unsigned len = le16_to_cpu(dlen); | ||
664 | |||
665 | if (len == EXT3_MAX_REC_LEN) | ||
666 | return 1 << 16; | ||
667 | return len; | ||
668 | } | ||
669 | |||
670 | static inline __le16 ext3_rec_len_to_disk(unsigned len) | ||
671 | { | ||
672 | if (len == (1 << 16)) | ||
673 | return cpu_to_le16(EXT3_MAX_REC_LEN); | ||
674 | else if (len > (1 << 16)) | ||
675 | BUG(); | ||
676 | return cpu_to_le16(len); | ||
677 | } | ||
678 | |||
659 | /* | 679 | /* |
660 | * Hash Tree Directory indexing | 680 | * Hash Tree Directory indexing |
661 | * (c) Daniel Phillips, 2001 | 681 | * (c) Daniel Phillips, 2001 |
diff --git a/include/linux/f75375s.h b/include/linux/f75375s.h new file mode 100644 index 000000000000..e99e22500668 --- /dev/null +++ b/include/linux/f75375s.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * f75375s.h - platform data structure for f75375s sensor | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2007, Riku Voipio <riku.voipio@iki.fi> | ||
9 | */ | ||
10 | |||
11 | #ifndef __LINUX_F75375S_H | ||
12 | #define __LINUX_F75375S_H | ||
13 | |||
14 | /* We want to set fans spinning on systems where there is no | ||
15 | * BIOS to do that for us */ | ||
16 | struct f75375s_platform_data { | ||
17 | u8 pwm[2]; | ||
18 | u8 pwm_enable[2]; | ||
19 | }; | ||
20 | |||
21 | #endif /* __LINUX_F75375S_H */ | ||
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index ea0f50bfbe03..24968790bc3e 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -19,7 +19,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) | |||
19 | int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); | 19 | int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); |
20 | int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); | 20 | int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); |
21 | int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); | 21 | int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); |
22 | int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int); | 22 | int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int); |
23 | void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); | 23 | void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); |
24 | void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); | 24 | void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); |
25 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); | 25 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); |
@@ -106,7 +106,7 @@ static inline unsigned long hugetlb_total_pages(void) | |||
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
108 | 108 | ||
109 | #define follow_hugetlb_page(m,v,p,vs,a,b,i) ({ BUG(); 0; }) | 109 | #define follow_hugetlb_page(m,v,p,vs,a,b,i,w) ({ BUG(); 0; }) |
110 | #define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) | 110 | #define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) |
111 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) | 111 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) |
112 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) | 112 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) |
@@ -165,8 +165,10 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) | |||
165 | extern const struct file_operations hugetlbfs_file_operations; | 165 | extern const struct file_operations hugetlbfs_file_operations; |
166 | extern struct vm_operations_struct hugetlb_vm_ops; | 166 | extern struct vm_operations_struct hugetlb_vm_ops; |
167 | struct file *hugetlb_file_setup(const char *name, size_t); | 167 | struct file *hugetlb_file_setup(const char *name, size_t); |
168 | int hugetlb_get_quota(struct address_space *mapping); | 168 | int hugetlb_get_quota(struct address_space *mapping, long delta); |
169 | void hugetlb_put_quota(struct address_space *mapping); | 169 | void hugetlb_put_quota(struct address_space *mapping, long delta); |
170 | |||
171 | #define BLOCKS_PER_HUGEPAGE (HPAGE_SIZE / 512) | ||
170 | 172 | ||
171 | static inline int is_file_hugepages(struct file *file) | 173 | static inline int is_file_hugepages(struct file *file) |
172 | { | 174 | { |
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h index 580b3f4956ee..2f4e957af656 100644 --- a/include/linux/mc146818rtc.h +++ b/include/linux/mc146818rtc.h | |||
@@ -109,8 +109,11 @@ struct cmos_rtc_board_info { | |||
109 | #ifndef ARCH_RTC_LOCATION /* Override by <asm/mc146818rtc.h>? */ | 109 | #ifndef ARCH_RTC_LOCATION /* Override by <asm/mc146818rtc.h>? */ |
110 | 110 | ||
111 | #define RTC_IO_EXTENT 0x8 | 111 | #define RTC_IO_EXTENT 0x8 |
112 | #define RTC_IO_EXTENT_USED 0x2 | ||
112 | #define RTC_IOMAPPED 1 /* Default to I/O mapping. */ | 113 | #define RTC_IOMAPPED 1 /* Default to I/O mapping. */ |
113 | 114 | ||
115 | #else | ||
116 | #define RTC_IO_EXTENT_USED RTC_IO_EXTENT | ||
114 | #endif /* ARCH_RTC_LOCATION */ | 117 | #endif /* ARCH_RTC_LOCATION */ |
115 | 118 | ||
116 | #endif /* _MC146818RTC_H */ | 119 | #endif /* _MC146818RTC_H */ |
diff --git a/include/linux/net.h b/include/linux/net.h index dd79cdb8c4cf..596131ea46f4 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -95,6 +95,12 @@ enum sock_type { | |||
95 | 95 | ||
96 | #endif /* ARCH_HAS_SOCKET_TYPES */ | 96 | #endif /* ARCH_HAS_SOCKET_TYPES */ |
97 | 97 | ||
98 | enum sock_shutdown_cmd { | ||
99 | SHUT_RD = 0, | ||
100 | SHUT_WR = 1, | ||
101 | SHUT_RDWR = 2, | ||
102 | }; | ||
103 | |||
98 | /** | 104 | /** |
99 | * struct socket - general BSD socket | 105 | * struct socket - general BSD socket |
100 | * @state: socket state (%SS_CONNECTED, etc) | 106 | * @state: socket state (%SS_CONNECTED, etc) |
@@ -223,6 +229,8 @@ extern int kernel_setsockopt(struct socket *sock, int level, int optname, | |||
223 | extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, | 229 | extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, |
224 | size_t size, int flags); | 230 | size_t size, int flags); |
225 | extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); | 231 | extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); |
232 | extern int kernel_sock_shutdown(struct socket *sock, | ||
233 | enum sock_shutdown_cmd how); | ||
226 | 234 | ||
227 | #ifndef CONFIG_SMP | 235 | #ifndef CONFIG_SMP |
228 | #define SOCKOPS_WRAPPED(name) name | 236 | #define SOCKOPS_WRAPPED(name) name |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index fbe19648bf91..1ee009e8fec8 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -2276,6 +2276,9 @@ | |||
2276 | #define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582 | 2276 | #define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582 |
2277 | #define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590 | 2277 | #define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590 |
2278 | #define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 | 2278 | #define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 |
2279 | #define PCI_DEVICE_ID_INTEL_5000_ERR 0x25F0 | ||
2280 | #define PCI_DEVICE_ID_INTEL_5000_FBD0 0x25F5 | ||
2281 | #define PCI_DEVICE_ID_INTEL_5000_FBD1 0x25F6 | ||
2279 | #define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770 | 2282 | #define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770 |
2280 | #define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772 | 2283 | #define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772 |
2281 | #define PCI_DEVICE_ID_INTEL_3000_HB 0x2778 | 2284 | #define PCI_DEVICE_ID_INTEL_3000_HB 0x2778 |
@@ -2329,6 +2332,7 @@ | |||
2329 | #define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a | 2332 | #define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a |
2330 | #define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e | 2333 | #define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e |
2331 | #define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b | 2334 | #define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b |
2335 | #define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f | ||
2332 | #define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff | 2336 | #define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff |
2333 | #define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031 | 2337 | #define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031 |
2334 | #define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032 | 2338 | #define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032 |
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index 0135c76c76c6..1689e28483e4 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h | |||
@@ -29,6 +29,7 @@ struct pid_namespace { | |||
29 | 29 | ||
30 | extern struct pid_namespace init_pid_ns; | 30 | extern struct pid_namespace init_pid_ns; |
31 | 31 | ||
32 | #ifdef CONFIG_PID_NS | ||
32 | static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) | 33 | static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) |
33 | { | 34 | { |
34 | if (ns != &init_pid_ns) | 35 | if (ns != &init_pid_ns) |
@@ -45,6 +46,28 @@ static inline void put_pid_ns(struct pid_namespace *ns) | |||
45 | kref_put(&ns->kref, free_pid_ns); | 46 | kref_put(&ns->kref, free_pid_ns); |
46 | } | 47 | } |
47 | 48 | ||
49 | #else /* !CONFIG_PID_NS */ | ||
50 | #include <linux/err.h> | ||
51 | |||
52 | static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) | ||
53 | { | ||
54 | return ns; | ||
55 | } | ||
56 | |||
57 | static inline struct pid_namespace * | ||
58 | copy_pid_ns(unsigned long flags, struct pid_namespace *ns) | ||
59 | { | ||
60 | if (flags & CLONE_NEWPID) | ||
61 | ns = ERR_PTR(-EINVAL); | ||
62 | return ns; | ||
63 | } | ||
64 | |||
65 | static inline void put_pid_ns(struct pid_namespace *ns) | ||
66 | { | ||
67 | } | ||
68 | |||
69 | #endif /* CONFIG_PID_NS */ | ||
70 | |||
48 | static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk) | 71 | static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk) |
49 | { | 72 | { |
50 | return tsk->nsproxy->pid_ns; | 73 | return tsk->nsproxy->pid_ns; |
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 5bf618241ab9..4e81836191df 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -491,9 +491,11 @@ struct nduseroptmsg | |||
491 | unsigned char nduseropt_family; | 491 | unsigned char nduseropt_family; |
492 | unsigned char nduseropt_pad1; | 492 | unsigned char nduseropt_pad1; |
493 | unsigned short nduseropt_opts_len; /* Total length of options */ | 493 | unsigned short nduseropt_opts_len; /* Total length of options */ |
494 | int nduseropt_ifindex; | ||
494 | __u8 nduseropt_icmp_type; | 495 | __u8 nduseropt_icmp_type; |
495 | __u8 nduseropt_icmp_code; | 496 | __u8 nduseropt_icmp_code; |
496 | unsigned short nduseropt_pad2; | 497 | unsigned short nduseropt_pad2; |
498 | unsigned int nduseropt_pad3; | ||
497 | /* Followed by one or more ND options */ | 499 | /* Followed by one or more ND options */ |
498 | }; | 500 | }; |
499 | 501 | ||
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 94e49915a8c0..91140fe8c119 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -387,7 +387,9 @@ extern void skb_truesize_bug(struct sk_buff *skb); | |||
387 | 387 | ||
388 | static inline void skb_truesize_check(struct sk_buff *skb) | 388 | static inline void skb_truesize_check(struct sk_buff *skb) |
389 | { | 389 | { |
390 | if (unlikely((int)skb->truesize < sizeof(struct sk_buff) + skb->len)) | 390 | int len = sizeof(struct sk_buff) + skb->len; |
391 | |||
392 | if (unlikely((int)skb->truesize < len)) | ||
391 | skb_truesize_bug(skb); | 393 | skb_truesize_bug(skb); |
392 | } | 394 | } |
393 | 395 | ||
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index ac69e7bb5a14..1a4ed49f6478 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h | |||
@@ -67,7 +67,7 @@ struct vring { | |||
67 | }; | 67 | }; |
68 | 68 | ||
69 | /* The standard layout for the ring is a continuous chunk of memory which looks | 69 | /* The standard layout for the ring is a continuous chunk of memory which looks |
70 | * like this. The used fields will be aligned to a "num+1" boundary. | 70 | * like this. We assume num is a power of 2. |
71 | * | 71 | * |
72 | * struct vring | 72 | * struct vring |
73 | * { | 73 | * { |
@@ -79,8 +79,8 @@ struct vring { | |||
79 | * __u16 avail_idx; | 79 | * __u16 avail_idx; |
80 | * __u16 available[num]; | 80 | * __u16 available[num]; |
81 | * | 81 | * |
82 | * // Padding so a correctly-chosen num value will cache-align used_idx. | 82 | * // Padding to the next page boundary. |
83 | * char pad[sizeof(struct vring_desc) - sizeof(avail_flags)]; | 83 | * char pad[]; |
84 | * | 84 | * |
85 | * // A ring of used descriptor heads with free-running index. | 85 | * // A ring of used descriptor heads with free-running index. |
86 | * __u16 used_flags; | 86 | * __u16 used_flags; |
@@ -88,18 +88,21 @@ struct vring { | |||
88 | * struct vring_used_elem used[num]; | 88 | * struct vring_used_elem used[num]; |
89 | * }; | 89 | * }; |
90 | */ | 90 | */ |
91 | static inline void vring_init(struct vring *vr, unsigned int num, void *p) | 91 | static inline void vring_init(struct vring *vr, unsigned int num, void *p, |
92 | unsigned int pagesize) | ||
92 | { | 93 | { |
93 | vr->num = num; | 94 | vr->num = num; |
94 | vr->desc = p; | 95 | vr->desc = p; |
95 | vr->avail = p + num*sizeof(struct vring); | 96 | vr->avail = p + num*sizeof(struct vring_desc); |
96 | vr->used = p + (num+1)*(sizeof(struct vring) + sizeof(__u16)); | 97 | vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + pagesize-1) |
98 | & ~(pagesize - 1)); | ||
97 | } | 99 | } |
98 | 100 | ||
99 | static inline unsigned vring_size(unsigned int num) | 101 | static inline unsigned vring_size(unsigned int num, unsigned int pagesize) |
100 | { | 102 | { |
101 | return (num + 1) * (sizeof(struct vring_desc) + sizeof(__u16)) | 103 | return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) |
102 | + sizeof(__u32) + num * sizeof(struct vring_used_elem); | 104 | + pagesize - 1) & ~(pagesize - 1)) |
105 | + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num; | ||
103 | } | 106 | } |
104 | 107 | ||
105 | #ifdef __KERNEL__ | 108 | #ifdef __KERNEL__ |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 0864a775de24..a1c805d7f488 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -12,7 +12,7 @@ extern void unix_gc(void); | |||
12 | 12 | ||
13 | #define UNIX_HASH_SIZE 256 | 13 | #define UNIX_HASH_SIZE 256 |
14 | 14 | ||
15 | extern atomic_t unix_tot_inflight; | 15 | extern unsigned int unix_tot_inflight; |
16 | 16 | ||
17 | struct unix_address { | 17 | struct unix_address { |
18 | atomic_t refcnt; | 18 | atomic_t refcnt; |
diff --git a/include/net/dst.h b/include/net/dst.h index e9ff4a4caef9..2f65e894b829 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -143,6 +143,13 @@ static inline void dst_hold(struct dst_entry * dst) | |||
143 | atomic_inc(&dst->__refcnt); | 143 | atomic_inc(&dst->__refcnt); |
144 | } | 144 | } |
145 | 145 | ||
146 | static inline void dst_use(struct dst_entry *dst, unsigned long time) | ||
147 | { | ||
148 | dst_hold(dst); | ||
149 | dst->__use++; | ||
150 | dst->lastuse = time; | ||
151 | } | ||
152 | |||
146 | static inline | 153 | static inline |
147 | struct dst_entry * dst_clone(struct dst_entry * dst) | 154 | struct dst_entry * dst_clone(struct dst_entry * dst) |
148 | { | 155 | { |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 017aebd90683..41a301e38643 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
@@ -107,4 +107,7 @@ extern int fib_rules_unregister(struct fib_rules_ops *); | |||
107 | extern int fib_rules_lookup(struct fib_rules_ops *, | 107 | extern int fib_rules_lookup(struct fib_rules_ops *, |
108 | struct flowi *, int flags, | 108 | struct flowi *, int flags, |
109 | struct fib_lookup_arg *); | 109 | struct fib_lookup_arg *); |
110 | extern int fib_default_rule_add(struct fib_rules_ops *, | ||
111 | u32 pref, u32 table, | ||
112 | u32 flags); | ||
110 | #endif | 113 | #endif |
diff --git a/include/net/inet_common.h b/include/net/inet_common.h index 227adcbdfec8..38d5a1e9980d 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h | |||
@@ -13,9 +13,6 @@ struct sock; | |||
13 | struct sockaddr; | 13 | struct sockaddr; |
14 | struct socket; | 14 | struct socket; |
15 | 15 | ||
16 | extern void inet_remove_sock(struct sock *sk1); | ||
17 | extern void inet_put_sock(unsigned short num, | ||
18 | struct sock *sk); | ||
19 | extern int inet_release(struct socket *sock); | 16 | extern int inet_release(struct socket *sock); |
20 | extern int inet_stream_connect(struct socket *sock, | 17 | extern int inet_stream_connect(struct socket *sock, |
21 | struct sockaddr * uaddr, | 18 | struct sockaddr * uaddr, |
@@ -30,7 +27,6 @@ extern int inet_sendmsg(struct kiocb *iocb, | |||
30 | struct msghdr *msg, | 27 | struct msghdr *msg, |
31 | size_t size); | 28 | size_t size); |
32 | extern int inet_shutdown(struct socket *sock, int how); | 29 | extern int inet_shutdown(struct socket *sock, int how); |
33 | extern unsigned int inet_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait); | ||
34 | extern int inet_listen(struct socket *sock, int backlog); | 30 | extern int inet_listen(struct socket *sock, int backlog); |
35 | 31 | ||
36 | extern void inet_sock_destruct(struct sock *sk); | 32 | extern void inet_sock_destruct(struct sock *sk); |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 8461cda37490..469216d93663 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/wait.h> | 25 | #include <linux/wait.h> |
26 | #include <linux/vmalloc.h> | ||
26 | 27 | ||
27 | #include <net/inet_connection_sock.h> | 28 | #include <net/inet_connection_sock.h> |
28 | #include <net/inet_sock.h> | 29 | #include <net/inet_sock.h> |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index aa10a8178e70..ad8404b56113 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -22,7 +22,7 @@ struct inet_peer | |||
22 | __be32 v4daddr; /* peer's address */ | 22 | __be32 v4daddr; /* peer's address */ |
23 | __u16 avl_height; | 23 | __u16 avl_height; |
24 | __u16 ip_id_count; /* IP ID for the next packet */ | 24 | __u16 ip_id_count; /* IP ID for the next packet */ |
25 | struct inet_peer *unused_next, **unused_prevp; | 25 | struct list_head unused; |
26 | __u32 dtime; /* the time of last use of not | 26 | __u32 dtime; /* the time of last use of not |
27 | * referenced entries */ | 27 | * referenced entries */ |
28 | atomic_t refcnt; | 28 | atomic_t refcnt; |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 5fcc4c104340..17b60391fcd6 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -706,11 +706,16 @@ enum ieee80211_hw_flags { | |||
706 | * | 706 | * |
707 | * @queues: number of available hardware transmit queues for | 707 | * @queues: number of available hardware transmit queues for |
708 | * data packets. WMM/QoS requires at least four. | 708 | * data packets. WMM/QoS requires at least four. |
709 | * | ||
710 | * @rate_control_algorithm: rate control algorithm for this hardware. | ||
711 | * If unset (NULL), the default algorithm will be used. Must be | ||
712 | * set before calling ieee80211_register_hw(). | ||
709 | */ | 713 | */ |
710 | struct ieee80211_hw { | 714 | struct ieee80211_hw { |
711 | struct ieee80211_conf conf; | 715 | struct ieee80211_conf conf; |
712 | struct wiphy *wiphy; | 716 | struct wiphy *wiphy; |
713 | struct workqueue_struct *workqueue; | 717 | struct workqueue_struct *workqueue; |
718 | const char *rate_control_algorithm; | ||
714 | void *priv; | 719 | void *priv; |
715 | u32 flags; | 720 | u32 flags; |
716 | unsigned int extra_tx_headroom; | 721 | unsigned int extra_tx_headroom; |
@@ -936,27 +941,11 @@ enum ieee80211_erp_change_flags { | |||
936 | * and remove_interface calls, i.e. while the interface with the | 941 | * and remove_interface calls, i.e. while the interface with the |
937 | * given local_address is enabled. | 942 | * given local_address is enabled. |
938 | * | 943 | * |
939 | * @set_ieee8021x: Enable/disable IEEE 802.1X. This item requests wlan card | ||
940 | * to pass unencrypted EAPOL-Key frames even when encryption is | ||
941 | * configured. If the wlan card does not require such a configuration, | ||
942 | * this function pointer can be set to NULL. | ||
943 | * | ||
944 | * @set_port_auth: Set port authorization state (IEEE 802.1X PAE) to be | ||
945 | * authorized (@authorized=1) or unauthorized (=0). This function can be | ||
946 | * used if the wlan hardware or low-level driver implements PAE. | ||
947 | * mac80211 will filter frames based on authorization state in any case, | ||
948 | * so this function pointer can be NULL if low-level driver does not | ||
949 | * require event notification about port state changes. | ||
950 | * | ||
951 | * @hw_scan: Ask the hardware to service the scan request, no need to start | 944 | * @hw_scan: Ask the hardware to service the scan request, no need to start |
952 | * the scan state machine in stack. | 945 | * the scan state machine in stack. |
953 | * | 946 | * |
954 | * @get_stats: return low-level statistics | 947 | * @get_stats: return low-level statistics |
955 | * | 948 | * |
956 | * @set_privacy_invoked: For devices that generate their own beacons and probe | ||
957 | * response or association responses this updates the state of privacy_invoked | ||
958 | * returns 0 for success or an error number. | ||
959 | * | ||
960 | * @get_sequence_counter: For devices that have internal sequence counters this | 949 | * @get_sequence_counter: For devices that have internal sequence counters this |
961 | * callback allows mac80211 to access the current value of a counter. | 950 | * callback allows mac80211 to access the current value of a counter. |
962 | * This callback seems not well-defined, tell us if you need it. | 951 | * This callback seems not well-defined, tell us if you need it. |
@@ -1029,14 +1018,9 @@ struct ieee80211_ops { | |||
1029 | int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 1018 | int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
1030 | const u8 *local_address, const u8 *address, | 1019 | const u8 *local_address, const u8 *address, |
1031 | struct ieee80211_key_conf *key); | 1020 | struct ieee80211_key_conf *key); |
1032 | int (*set_ieee8021x)(struct ieee80211_hw *hw, int use_ieee8021x); | ||
1033 | int (*set_port_auth)(struct ieee80211_hw *hw, u8 *addr, | ||
1034 | int authorized); | ||
1035 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); | 1021 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); |
1036 | int (*get_stats)(struct ieee80211_hw *hw, | 1022 | int (*get_stats)(struct ieee80211_hw *hw, |
1037 | struct ieee80211_low_level_stats *stats); | 1023 | struct ieee80211_low_level_stats *stats); |
1038 | int (*set_privacy_invoked)(struct ieee80211_hw *hw, | ||
1039 | int privacy_invoked); | ||
1040 | int (*get_sequence_counter)(struct ieee80211_hw *hw, | 1024 | int (*get_sequence_counter)(struct ieee80211_hw *hw, |
1041 | u8* addr, u8 keyidx, u8 txrx, | 1025 | u8* addr, u8 keyidx, u8 txrx, |
1042 | u32* iv32, u16* iv16); | 1026 | u32* iv32, u16* iv16); |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 1fd449a6530b..5dd6d90b37eb 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -119,9 +119,11 @@ static inline struct net *maybe_get_net(struct net *net) | |||
119 | #ifdef CONFIG_NET_NS | 119 | #ifdef CONFIG_NET_NS |
120 | #define __net_init | 120 | #define __net_init |
121 | #define __net_exit | 121 | #define __net_exit |
122 | #define __net_initdata | ||
122 | #else | 123 | #else |
123 | #define __net_init __init | 124 | #define __net_init __init |
124 | #define __net_exit __exit_refok | 125 | #define __net_exit __exit_refok |
126 | #define __net_initdata __initdata | ||
125 | #endif | 127 | #endif |
126 | 128 | ||
127 | struct pernet_operations { | 129 | struct pernet_operations { |
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index b8733364557f..c1f797673571 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h | |||
@@ -103,6 +103,7 @@ typedef enum { | |||
103 | SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */ | 103 | SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */ |
104 | SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ | 104 | SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ |
105 | SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ | 105 | SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ |
106 | SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ | ||
106 | SCTP_CMD_LAST | 107 | SCTP_CMD_LAST |
107 | } sctp_verb_t; | 108 | } sctp_verb_t; |
108 | 109 | ||
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index da8354e8e33c..f30b537d6952 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -186,6 +186,8 @@ typedef enum { | |||
186 | SCTP_IERROR_AUTH_BAD_HMAC, | 186 | SCTP_IERROR_AUTH_BAD_HMAC, |
187 | SCTP_IERROR_AUTH_BAD_KEYID, | 187 | SCTP_IERROR_AUTH_BAD_KEYID, |
188 | SCTP_IERROR_PROTO_VIOLATION, | 188 | SCTP_IERROR_PROTO_VIOLATION, |
189 | SCTP_IERROR_ERROR, | ||
190 | SCTP_IERROR_ABORT, | ||
189 | } sctp_ierror_t; | 191 | } sctp_ierror_t; |
190 | 192 | ||
191 | 193 | ||
@@ -407,6 +409,7 @@ typedef enum { | |||
407 | SCTP_RTXR_T3_RTX, | 409 | SCTP_RTXR_T3_RTX, |
408 | SCTP_RTXR_FAST_RTX, | 410 | SCTP_RTXR_FAST_RTX, |
409 | SCTP_RTXR_PMTUD, | 411 | SCTP_RTXR_PMTUD, |
412 | SCTP_RTXR_T1_RTX, | ||
410 | } sctp_retransmit_reason_t; | 413 | } sctp_retransmit_reason_t; |
411 | 414 | ||
412 | /* Reasons to lower cwnd. */ | 415 | /* Reasons to lower cwnd. */ |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 93eb708609e7..34318a33a94c 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -65,7 +65,6 @@ | |||
65 | 65 | ||
66 | 66 | ||
67 | #ifdef TEST_FRAME | 67 | #ifdef TEST_FRAME |
68 | #undef CONFIG_PROC_FS | ||
69 | #undef CONFIG_SCTP_DBG_OBJCNT | 68 | #undef CONFIG_SCTP_DBG_OBJCNT |
70 | #undef CONFIG_SYSCTL | 69 | #undef CONFIG_SYSCTL |
71 | #endif /* TEST_FRAME */ | 70 | #endif /* TEST_FRAME */ |
@@ -267,6 +266,7 @@ enum | |||
267 | SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS, | 266 | SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS, |
268 | SCTP_MIB_DELAY_SACK_EXPIREDS, | 267 | SCTP_MIB_DELAY_SACK_EXPIREDS, |
269 | SCTP_MIB_AUTOCLOSE_EXPIREDS, | 268 | SCTP_MIB_AUTOCLOSE_EXPIREDS, |
269 | SCTP_MIB_T1_RETRANSMITS, | ||
270 | SCTP_MIB_T3_RETRANSMITS, | 270 | SCTP_MIB_T3_RETRANSMITS, |
271 | SCTP_MIB_PMTUD_RETRANSMITS, | 271 | SCTP_MIB_PMTUD_RETRANSMITS, |
272 | SCTP_MIB_FAST_RETRANSMITS, | 272 | SCTP_MIB_FAST_RETRANSMITS, |
@@ -664,6 +664,9 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) | |||
664 | return (h & (sctp_assoc_hashsize-1)); | 664 | return (h & (sctp_assoc_hashsize-1)); |
665 | } | 665 | } |
666 | 666 | ||
667 | #define sctp_for_each_hentry(epb, node, head) \ | ||
668 | hlist_for_each_entry(epb, node, head, node) | ||
669 | |||
667 | /* Is a socket of this style? */ | 670 | /* Is a socket of this style? */ |
668 | #define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style)) | 671 | #define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style)) |
669 | static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style) | 672 | static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style) |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index ef892e00c833..eb3113c38a94 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -100,20 +100,19 @@ struct crypto_hash; | |||
100 | struct sctp_bind_bucket { | 100 | struct sctp_bind_bucket { |
101 | unsigned short port; | 101 | unsigned short port; |
102 | unsigned short fastreuse; | 102 | unsigned short fastreuse; |
103 | struct sctp_bind_bucket *next; | 103 | struct hlist_node node; |
104 | struct sctp_bind_bucket **pprev; | ||
105 | struct hlist_head owner; | 104 | struct hlist_head owner; |
106 | }; | 105 | }; |
107 | 106 | ||
108 | struct sctp_bind_hashbucket { | 107 | struct sctp_bind_hashbucket { |
109 | spinlock_t lock; | 108 | spinlock_t lock; |
110 | struct sctp_bind_bucket *chain; | 109 | struct hlist_head chain; |
111 | }; | 110 | }; |
112 | 111 | ||
113 | /* Used for hashing all associations. */ | 112 | /* Used for hashing all associations. */ |
114 | struct sctp_hashbucket { | 113 | struct sctp_hashbucket { |
115 | rwlock_t lock; | 114 | rwlock_t lock; |
116 | struct sctp_ep_common *chain; | 115 | struct hlist_head chain; |
117 | } __attribute__((__aligned__(8))); | 116 | } __attribute__((__aligned__(8))); |
118 | 117 | ||
119 | 118 | ||
@@ -212,6 +211,7 @@ extern struct sctp_globals { | |||
212 | 211 | ||
213 | /* Flag to indicate if addip is enabled. */ | 212 | /* Flag to indicate if addip is enabled. */ |
214 | int addip_enable; | 213 | int addip_enable; |
214 | int addip_noauth_enable; | ||
215 | 215 | ||
216 | /* Flag to indicate if PR-SCTP is enabled. */ | 216 | /* Flag to indicate if PR-SCTP is enabled. */ |
217 | int prsctp_enable; | 217 | int prsctp_enable; |
@@ -249,6 +249,7 @@ extern struct sctp_globals { | |||
249 | #define sctp_local_addr_list (sctp_globals.local_addr_list) | 249 | #define sctp_local_addr_list (sctp_globals.local_addr_list) |
250 | #define sctp_local_addr_lock (sctp_globals.addr_list_lock) | 250 | #define sctp_local_addr_lock (sctp_globals.addr_list_lock) |
251 | #define sctp_addip_enable (sctp_globals.addip_enable) | 251 | #define sctp_addip_enable (sctp_globals.addip_enable) |
252 | #define sctp_addip_noauth (sctp_globals.addip_noauth_enable) | ||
252 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) | 253 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) |
253 | #define sctp_auth_enable (sctp_globals.auth_enable) | 254 | #define sctp_auth_enable (sctp_globals.auth_enable) |
254 | 255 | ||
@@ -873,10 +874,11 @@ struct sctp_transport { | |||
873 | * address list derived from the INIT or INIT ACK chunk, a | 874 | * address list derived from the INIT or INIT ACK chunk, a |
874 | * number of data elements needs to be maintained including: | 875 | * number of data elements needs to be maintained including: |
875 | */ | 876 | */ |
876 | __u32 rtt; /* This is the most recent RTT. */ | ||
877 | |||
878 | /* RTO : The current retransmission timeout value. */ | 877 | /* RTO : The current retransmission timeout value. */ |
879 | unsigned long rto; | 878 | unsigned long rto; |
879 | unsigned long last_rto; | ||
880 | |||
881 | __u32 rtt; /* This is the most recent RTT. */ | ||
880 | 882 | ||
881 | /* RTTVAR : The current RTT variation. */ | 883 | /* RTTVAR : The current RTT variation. */ |
882 | __u32 rttvar; | 884 | __u32 rttvar; |
@@ -1184,9 +1186,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, | |||
1184 | int flags); | 1186 | int flags); |
1185 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, | 1187 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, |
1186 | __u8 use_as_src, gfp_t gfp); | 1188 | __u8 use_as_src, gfp_t gfp); |
1187 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *, | 1189 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); |
1188 | void fastcall (*rcu_call)(struct rcu_head *, | ||
1189 | void (*func)(struct rcu_head *))); | ||
1190 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, | 1190 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, |
1191 | struct sctp_sock *); | 1191 | struct sctp_sock *); |
1192 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, | 1192 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, |
@@ -1229,8 +1229,7 @@ typedef enum { | |||
1229 | 1229 | ||
1230 | struct sctp_ep_common { | 1230 | struct sctp_ep_common { |
1231 | /* Fields to help us manage our entries in the hash tables. */ | 1231 | /* Fields to help us manage our entries in the hash tables. */ |
1232 | struct sctp_ep_common *next; | 1232 | struct hlist_node node; |
1233 | struct sctp_ep_common **pprev; | ||
1234 | int hashent; | 1233 | int hashent; |
1235 | 1234 | ||
1236 | /* Runtime type information. What kind of endpoint is this? */ | 1235 | /* Runtime type information. What kind of endpoint is this? */ |
@@ -1541,7 +1540,6 @@ struct sctp_association { | |||
1541 | __u8 asconf_capable; /* Does peer support ADDIP? */ | 1540 | __u8 asconf_capable; /* Does peer support ADDIP? */ |
1542 | __u8 prsctp_capable; /* Can peer do PR-SCTP? */ | 1541 | __u8 prsctp_capable; /* Can peer do PR-SCTP? */ |
1543 | __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ | 1542 | __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ |
1544 | __u8 addip_capable; /* Can peer do ADD-IP */ | ||
1545 | 1543 | ||
1546 | __u32 adaptation_ind; /* Adaptation Code point. */ | 1544 | __u32 adaptation_ind; /* Adaptation Code point. */ |
1547 | 1545 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index 5504fb9fa88a..567e468d7492 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1235,14 +1235,16 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, | |||
1235 | gfp_t gfp) | 1235 | gfp_t gfp) |
1236 | { | 1236 | { |
1237 | struct sk_buff *skb; | 1237 | struct sk_buff *skb; |
1238 | int hdr_len; | ||
1239 | 1238 | ||
1240 | hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header); | 1239 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); |
1241 | skb = alloc_skb_fclone(size + hdr_len, gfp); | ||
1242 | if (skb) { | 1240 | if (skb) { |
1243 | skb->truesize += mem; | 1241 | skb->truesize += mem; |
1244 | if (sk_stream_wmem_schedule(sk, skb->truesize)) { | 1242 | if (sk_stream_wmem_schedule(sk, skb->truesize)) { |
1245 | skb_reserve(skb, hdr_len); | 1243 | /* |
1244 | * Make sure that we have exactly size bytes | ||
1245 | * available to the caller, no more, no less. | ||
1246 | */ | ||
1247 | skb_reserve(skb, skb_tailroom(skb) - size); | ||
1246 | return skb; | 1248 | return skb; |
1247 | } | 1249 | } |
1248 | __kfree_skb(skb); | 1250 | __kfree_skb(skb); |
diff --git a/init/Kconfig b/init/Kconfig index 8b88d0bedcbd..c5b354b1409e 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -215,6 +215,18 @@ config USER_NS | |||
215 | vservers, to use user namespaces to provide different | 215 | vservers, to use user namespaces to provide different |
216 | user info for different servers. If unsure, say N. | 216 | user info for different servers. If unsure, say N. |
217 | 217 | ||
218 | config PID_NS | ||
219 | bool "PID Namespaces (EXPERIMENTAL)" | ||
220 | default n | ||
221 | depends on EXPERIMENTAL | ||
222 | help | ||
223 | Suport process id namespaces. This allows having multiple | ||
224 | process with the same pid as long as they are in different | ||
225 | pid namespaces. This is a building block of containers. | ||
226 | |||
227 | Unless you want to work with an experimental feature | ||
228 | say N here. | ||
229 | |||
218 | config AUDIT | 230 | config AUDIT |
219 | bool "Auditing support" | 231 | bool "Auditing support" |
220 | depends on NET | 232 | depends on NET |
@@ -301,13 +313,6 @@ config CGROUP_NS | |||
301 | for instance virtual servers and checkpoint/restart | 313 | for instance virtual servers and checkpoint/restart |
302 | jobs. | 314 | jobs. |
303 | 315 | ||
304 | config CGROUP_CPUACCT | ||
305 | bool "Simple CPU accounting cgroup subsystem" | ||
306 | depends on CGROUPS | ||
307 | help | ||
308 | Provides a simple Resource Controller for monitoring the | ||
309 | total CPU consumed by the tasks in a cgroup | ||
310 | |||
311 | config CPUSETS | 316 | config CPUSETS |
312 | bool "Cpuset support" | 317 | bool "Cpuset support" |
313 | depends on SMP && CGROUPS | 318 | depends on SMP && CGROUPS |
diff --git a/kernel/Makefile b/kernel/Makefile index f60afe742599..dfa96956dae0 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -40,7 +40,6 @@ obj-$(CONFIG_COMPAT) += compat.o | |||
40 | obj-$(CONFIG_CGROUPS) += cgroup.o | 40 | obj-$(CONFIG_CGROUPS) += cgroup.o |
41 | obj-$(CONFIG_CGROUP_DEBUG) += cgroup_debug.o | 41 | obj-$(CONFIG_CGROUP_DEBUG) += cgroup_debug.o |
42 | obj-$(CONFIG_CPUSETS) += cpuset.o | 42 | obj-$(CONFIG_CPUSETS) += cpuset.o |
43 | obj-$(CONFIG_CGROUP_CPUACCT) += cpu_acct.o | ||
44 | obj-$(CONFIG_CGROUP_NS) += ns_cgroup.o | 43 | obj-$(CONFIG_CGROUP_NS) += ns_cgroup.o |
45 | obj-$(CONFIG_IKCONFIG) += configs.o | 44 | obj-$(CONFIG_IKCONFIG) += configs.o |
46 | obj-$(CONFIG_STOP_MACHINE) += stop_machine.o | 45 | obj-$(CONFIG_STOP_MACHINE) += stop_machine.o |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 3fe21e19c96e..1a3c23936d43 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * kernel/cgroup.c | ||
3 | * | ||
4 | * Generic process-grouping system. | 2 | * Generic process-grouping system. |
5 | * | 3 | * |
6 | * Based originally on the cpuset system, extracted by Paul Menage | 4 | * Based originally on the cpuset system, extracted by Paul Menage |
@@ -2200,7 +2198,8 @@ static void cgroup_init_subsys(struct cgroup_subsys *ss) | |||
2200 | { | 2198 | { |
2201 | struct cgroup_subsys_state *css; | 2199 | struct cgroup_subsys_state *css; |
2202 | struct list_head *l; | 2200 | struct list_head *l; |
2203 | printk(KERN_ERR "Initializing cgroup subsys %s\n", ss->name); | 2201 | |
2202 | printk(KERN_INFO "Initializing cgroup subsys %s\n", ss->name); | ||
2204 | 2203 | ||
2205 | /* Create the top cgroup state for this subsystem */ | 2204 | /* Create the top cgroup state for this subsystem */ |
2206 | ss->root = &rootnode; | 2205 | ss->root = &rootnode; |
@@ -2273,7 +2272,7 @@ int __init cgroup_init_early(void) | |||
2273 | BUG_ON(!ss->create); | 2272 | BUG_ON(!ss->create); |
2274 | BUG_ON(!ss->destroy); | 2273 | BUG_ON(!ss->destroy); |
2275 | if (ss->subsys_id != i) { | 2274 | if (ss->subsys_id != i) { |
2276 | printk(KERN_ERR "Subsys %s id == %d\n", | 2275 | printk(KERN_ERR "cgroup: Subsys %s id == %d\n", |
2277 | ss->name, ss->subsys_id); | 2276 | ss->name, ss->subsys_id); |
2278 | BUG(); | 2277 | BUG(); |
2279 | } | 2278 | } |
@@ -2605,7 +2604,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys) | |||
2605 | dentry = lookup_one_len(nodename, parent->dentry, strlen(nodename)); | 2604 | dentry = lookup_one_len(nodename, parent->dentry, strlen(nodename)); |
2606 | if (IS_ERR(dentry)) { | 2605 | if (IS_ERR(dentry)) { |
2607 | printk(KERN_INFO | 2606 | printk(KERN_INFO |
2608 | "Couldn't allocate dentry for %s: %ld\n", nodename, | 2607 | "cgroup: Couldn't allocate dentry for %s: %ld\n", nodename, |
2609 | PTR_ERR(dentry)); | 2608 | PTR_ERR(dentry)); |
2610 | ret = PTR_ERR(dentry); | 2609 | ret = PTR_ERR(dentry); |
2611 | goto out_release; | 2610 | goto out_release; |
diff --git a/kernel/cpu_acct.c b/kernel/cpu_acct.c deleted file mode 100644 index 731e47e7f164..000000000000 --- a/kernel/cpu_acct.c +++ /dev/null | |||
@@ -1,186 +0,0 @@ | |||
1 | /* | ||
2 | * kernel/cpu_acct.c - CPU accounting cgroup subsystem | ||
3 | * | ||
4 | * Copyright (C) Google Inc, 2006 | ||
5 | * | ||
6 | * Developed by Paul Menage (menage@google.com) and Balbir Singh | ||
7 | * (balbir@in.ibm.com) | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * Example cgroup subsystem for reporting total CPU usage of tasks in a | ||
13 | * cgroup, along with percentage load over a time interval | ||
14 | */ | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/cgroup.h> | ||
18 | #include <linux/fs.h> | ||
19 | #include <linux/rcupdate.h> | ||
20 | |||
21 | #include <asm/div64.h> | ||
22 | |||
23 | struct cpuacct { | ||
24 | struct cgroup_subsys_state css; | ||
25 | spinlock_t lock; | ||
26 | /* total time used by this class */ | ||
27 | cputime64_t time; | ||
28 | |||
29 | /* time when next load calculation occurs */ | ||
30 | u64 next_interval_check; | ||
31 | |||
32 | /* time used in current period */ | ||
33 | cputime64_t current_interval_time; | ||
34 | |||
35 | /* time used in last period */ | ||
36 | cputime64_t last_interval_time; | ||
37 | }; | ||
38 | |||
39 | struct cgroup_subsys cpuacct_subsys; | ||
40 | |||
41 | static inline struct cpuacct *cgroup_ca(struct cgroup *cont) | ||
42 | { | ||
43 | return container_of(cgroup_subsys_state(cont, cpuacct_subsys_id), | ||
44 | struct cpuacct, css); | ||
45 | } | ||
46 | |||
47 | static inline struct cpuacct *task_ca(struct task_struct *task) | ||
48 | { | ||
49 | return container_of(task_subsys_state(task, cpuacct_subsys_id), | ||
50 | struct cpuacct, css); | ||
51 | } | ||
52 | |||
53 | #define INTERVAL (HZ * 10) | ||
54 | |||
55 | static inline u64 next_interval_boundary(u64 now) | ||
56 | { | ||
57 | /* calculate the next interval boundary beyond the | ||
58 | * current time */ | ||
59 | do_div(now, INTERVAL); | ||
60 | return (now + 1) * INTERVAL; | ||
61 | } | ||
62 | |||
63 | static struct cgroup_subsys_state *cpuacct_create( | ||
64 | struct cgroup_subsys *ss, struct cgroup *cont) | ||
65 | { | ||
66 | struct cpuacct *ca = kzalloc(sizeof(*ca), GFP_KERNEL); | ||
67 | |||
68 | if (!ca) | ||
69 | return ERR_PTR(-ENOMEM); | ||
70 | spin_lock_init(&ca->lock); | ||
71 | ca->next_interval_check = next_interval_boundary(get_jiffies_64()); | ||
72 | return &ca->css; | ||
73 | } | ||
74 | |||
75 | static void cpuacct_destroy(struct cgroup_subsys *ss, | ||
76 | struct cgroup *cont) | ||
77 | { | ||
78 | kfree(cgroup_ca(cont)); | ||
79 | } | ||
80 | |||
81 | /* Lazily update the load calculation if necessary. Called with ca locked */ | ||
82 | static void cpuusage_update(struct cpuacct *ca) | ||
83 | { | ||
84 | u64 now = get_jiffies_64(); | ||
85 | |||
86 | /* If we're not due for an update, return */ | ||
87 | if (ca->next_interval_check > now) | ||
88 | return; | ||
89 | |||
90 | if (ca->next_interval_check <= (now - INTERVAL)) { | ||
91 | /* If it's been more than an interval since the last | ||
92 | * check, then catch up - the last interval must have | ||
93 | * been zero load */ | ||
94 | ca->last_interval_time = 0; | ||
95 | ca->next_interval_check = next_interval_boundary(now); | ||
96 | } else { | ||
97 | /* If a steal takes the last interval time negative, | ||
98 | * then we just ignore it */ | ||
99 | if ((s64)ca->current_interval_time > 0) | ||
100 | ca->last_interval_time = ca->current_interval_time; | ||
101 | else | ||
102 | ca->last_interval_time = 0; | ||
103 | ca->next_interval_check += INTERVAL; | ||
104 | } | ||
105 | ca->current_interval_time = 0; | ||
106 | } | ||
107 | |||
108 | static u64 cpuusage_read(struct cgroup *cont, struct cftype *cft) | ||
109 | { | ||
110 | struct cpuacct *ca = cgroup_ca(cont); | ||
111 | u64 time; | ||
112 | |||
113 | spin_lock_irq(&ca->lock); | ||
114 | cpuusage_update(ca); | ||
115 | time = cputime64_to_jiffies64(ca->time); | ||
116 | spin_unlock_irq(&ca->lock); | ||
117 | |||
118 | /* Convert 64-bit jiffies to seconds */ | ||
119 | time *= 1000; | ||
120 | do_div(time, HZ); | ||
121 | return time; | ||
122 | } | ||
123 | |||
124 | static u64 load_read(struct cgroup *cont, struct cftype *cft) | ||
125 | { | ||
126 | struct cpuacct *ca = cgroup_ca(cont); | ||
127 | u64 time; | ||
128 | |||
129 | /* Find the time used in the previous interval */ | ||
130 | spin_lock_irq(&ca->lock); | ||
131 | cpuusage_update(ca); | ||
132 | time = cputime64_to_jiffies64(ca->last_interval_time); | ||
133 | spin_unlock_irq(&ca->lock); | ||
134 | |||
135 | /* Convert time to a percentage, to give the load in the | ||
136 | * previous period */ | ||
137 | time *= 100; | ||
138 | do_div(time, INTERVAL); | ||
139 | |||
140 | return time; | ||
141 | } | ||
142 | |||
143 | static struct cftype files[] = { | ||
144 | { | ||
145 | .name = "usage", | ||
146 | .read_uint = cpuusage_read, | ||
147 | }, | ||
148 | { | ||
149 | .name = "load", | ||
150 | .read_uint = load_read, | ||
151 | } | ||
152 | }; | ||
153 | |||
154 | static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cont) | ||
155 | { | ||
156 | return cgroup_add_files(cont, ss, files, ARRAY_SIZE(files)); | ||
157 | } | ||
158 | |||
159 | void cpuacct_charge(struct task_struct *task, cputime_t cputime) | ||
160 | { | ||
161 | |||
162 | struct cpuacct *ca; | ||
163 | unsigned long flags; | ||
164 | |||
165 | if (!cpuacct_subsys.active) | ||
166 | return; | ||
167 | rcu_read_lock(); | ||
168 | ca = task_ca(task); | ||
169 | if (ca) { | ||
170 | spin_lock_irqsave(&ca->lock, flags); | ||
171 | cpuusage_update(ca); | ||
172 | ca->time = cputime64_add(ca->time, cputime); | ||
173 | ca->current_interval_time = | ||
174 | cputime64_add(ca->current_interval_time, cputime); | ||
175 | spin_unlock_irqrestore(&ca->lock, flags); | ||
176 | } | ||
177 | rcu_read_unlock(); | ||
178 | } | ||
179 | |||
180 | struct cgroup_subsys cpuacct_subsys = { | ||
181 | .name = "cpuacct", | ||
182 | .create = cpuacct_create, | ||
183 | .destroy = cpuacct_destroy, | ||
184 | .populate = cpuacct_populate, | ||
185 | .subsys_id = cpuacct_subsys_id, | ||
186 | }; | ||
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index e391cbb1f566..dc335ad27525 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -178,9 +178,11 @@ fastcall unsigned int __do_IRQ(unsigned int irq) | |||
178 | */ | 178 | */ |
179 | if (desc->chip->ack) | 179 | if (desc->chip->ack) |
180 | desc->chip->ack(irq); | 180 | desc->chip->ack(irq); |
181 | action_ret = handle_IRQ_event(irq, desc->action); | 181 | if (likely(!(desc->status & IRQ_DISABLED))) { |
182 | if (!noirqdebug) | 182 | action_ret = handle_IRQ_event(irq, desc->action); |
183 | note_interrupt(irq, desc, action_ret); | 183 | if (!noirqdebug) |
184 | note_interrupt(irq, desc, action_ret); | ||
185 | } | ||
184 | desc->chip->end(irq); | 186 | desc->chip->end(irq); |
185 | return 1; | 187 | return 1; |
186 | } | 188 | } |
diff --git a/kernel/marker.c b/kernel/marker.c index ccb48d9a3657..5323cfaedbce 100644 --- a/kernel/marker.c +++ b/kernel/marker.c | |||
@@ -28,7 +28,7 @@ extern struct marker __start___markers[]; | |||
28 | extern struct marker __stop___markers[]; | 28 | extern struct marker __stop___markers[]; |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * module_mutex nests inside markers_mutex. Markers mutex protects the builtin | 31 | * markers_mutex nests inside module_mutex. Markers mutex protects the builtin |
32 | * and module markers, the hash table and deferred_sync. | 32 | * and module markers, the hash table and deferred_sync. |
33 | */ | 33 | */ |
34 | static DEFINE_MUTEX(markers_mutex); | 34 | static DEFINE_MUTEX(markers_mutex); |
@@ -257,7 +257,6 @@ static void disable_marker(struct marker *elem) | |||
257 | * @refcount: number of references left to the given probe_module (out) | 257 | * @refcount: number of references left to the given probe_module (out) |
258 | * | 258 | * |
259 | * Updates the probe callback corresponding to a range of markers. | 259 | * Updates the probe callback corresponding to a range of markers. |
260 | * Must be called with markers_mutex held. | ||
261 | */ | 260 | */ |
262 | void marker_update_probe_range(struct marker *begin, | 261 | void marker_update_probe_range(struct marker *begin, |
263 | struct marker *end, struct module *probe_module, | 262 | struct marker *end, struct module *probe_module, |
@@ -266,6 +265,7 @@ void marker_update_probe_range(struct marker *begin, | |||
266 | struct marker *iter; | 265 | struct marker *iter; |
267 | struct marker_entry *mark_entry; | 266 | struct marker_entry *mark_entry; |
268 | 267 | ||
268 | mutex_lock(&markers_mutex); | ||
269 | for (iter = begin; iter < end; iter++) { | 269 | for (iter = begin; iter < end; iter++) { |
270 | mark_entry = get_marker(iter->name); | 270 | mark_entry = get_marker(iter->name); |
271 | if (mark_entry && mark_entry->refcount) { | 271 | if (mark_entry && mark_entry->refcount) { |
@@ -281,6 +281,7 @@ void marker_update_probe_range(struct marker *begin, | |||
281 | disable_marker(iter); | 281 | disable_marker(iter); |
282 | } | 282 | } |
283 | } | 283 | } |
284 | mutex_unlock(&markers_mutex); | ||
284 | } | 285 | } |
285 | 286 | ||
286 | /* | 287 | /* |
@@ -293,7 +294,6 @@ static void marker_update_probes(struct module *probe_module) | |||
293 | { | 294 | { |
294 | int refcount = 0; | 295 | int refcount = 0; |
295 | 296 | ||
296 | mutex_lock(&markers_mutex); | ||
297 | /* Core kernel markers */ | 297 | /* Core kernel markers */ |
298 | marker_update_probe_range(__start___markers, | 298 | marker_update_probe_range(__start___markers, |
299 | __stop___markers, probe_module, &refcount); | 299 | __stop___markers, probe_module, &refcount); |
@@ -303,7 +303,6 @@ static void marker_update_probes(struct module *probe_module) | |||
303 | synchronize_sched(); | 303 | synchronize_sched(); |
304 | deferred_sync = 0; | 304 | deferred_sync = 0; |
305 | } | 305 | } |
306 | mutex_unlock(&markers_mutex); | ||
307 | } | 306 | } |
308 | 307 | ||
309 | /** | 308 | /** |
@@ -320,7 +319,7 @@ int marker_probe_register(const char *name, const char *format, | |||
320 | marker_probe_func *probe, void *private) | 319 | marker_probe_func *probe, void *private) |
321 | { | 320 | { |
322 | struct marker_entry *entry; | 321 | struct marker_entry *entry; |
323 | int ret = 0, need_update = 0; | 322 | int ret = 0; |
324 | 323 | ||
325 | mutex_lock(&markers_mutex); | 324 | mutex_lock(&markers_mutex); |
326 | entry = get_marker(name); | 325 | entry = get_marker(name); |
@@ -335,11 +334,11 @@ int marker_probe_register(const char *name, const char *format, | |||
335 | ret = add_marker(name, format, probe, private); | 334 | ret = add_marker(name, format, probe, private); |
336 | if (ret) | 335 | if (ret) |
337 | goto end; | 336 | goto end; |
338 | need_update = 1; | 337 | mutex_unlock(&markers_mutex); |
338 | marker_update_probes(NULL); | ||
339 | return ret; | ||
339 | end: | 340 | end: |
340 | mutex_unlock(&markers_mutex); | 341 | mutex_unlock(&markers_mutex); |
341 | if (need_update) | ||
342 | marker_update_probes(NULL); | ||
343 | return ret; | 342 | return ret; |
344 | } | 343 | } |
345 | EXPORT_SYMBOL_GPL(marker_probe_register); | 344 | EXPORT_SYMBOL_GPL(marker_probe_register); |
@@ -355,7 +354,6 @@ void *marker_probe_unregister(const char *name) | |||
355 | struct module *probe_module; | 354 | struct module *probe_module; |
356 | struct marker_entry *entry; | 355 | struct marker_entry *entry; |
357 | void *private; | 356 | void *private; |
358 | int need_update = 0; | ||
359 | 357 | ||
360 | mutex_lock(&markers_mutex); | 358 | mutex_lock(&markers_mutex); |
361 | entry = get_marker(name); | 359 | entry = get_marker(name); |
@@ -368,11 +366,11 @@ void *marker_probe_unregister(const char *name) | |||
368 | probe_module = __module_text_address((unsigned long)entry->probe); | 366 | probe_module = __module_text_address((unsigned long)entry->probe); |
369 | private = remove_marker(name); | 367 | private = remove_marker(name); |
370 | deferred_sync = 1; | 368 | deferred_sync = 1; |
371 | need_update = 1; | 369 | mutex_unlock(&markers_mutex); |
370 | marker_update_probes(probe_module); | ||
371 | return private; | ||
372 | end: | 372 | end: |
373 | mutex_unlock(&markers_mutex); | 373 | mutex_unlock(&markers_mutex); |
374 | if (need_update) | ||
375 | marker_update_probes(probe_module); | ||
376 | return private; | 374 | return private; |
377 | } | 375 | } |
378 | EXPORT_SYMBOL_GPL(marker_probe_unregister); | 376 | EXPORT_SYMBOL_GPL(marker_probe_unregister); |
@@ -392,7 +390,6 @@ void *marker_probe_unregister_private_data(void *private) | |||
392 | struct marker_entry *entry; | 390 | struct marker_entry *entry; |
393 | int found = 0; | 391 | int found = 0; |
394 | unsigned int i; | 392 | unsigned int i; |
395 | int need_update = 0; | ||
396 | 393 | ||
397 | mutex_lock(&markers_mutex); | 394 | mutex_lock(&markers_mutex); |
398 | for (i = 0; i < MARKER_TABLE_SIZE; i++) { | 395 | for (i = 0; i < MARKER_TABLE_SIZE; i++) { |
@@ -414,11 +411,11 @@ iter_end: | |||
414 | probe_module = __module_text_address((unsigned long)entry->probe); | 411 | probe_module = __module_text_address((unsigned long)entry->probe); |
415 | private = remove_marker(entry->name); | 412 | private = remove_marker(entry->name); |
416 | deferred_sync = 1; | 413 | deferred_sync = 1; |
417 | need_update = 1; | 414 | mutex_unlock(&markers_mutex); |
415 | marker_update_probes(probe_module); | ||
416 | return private; | ||
418 | end: | 417 | end: |
419 | mutex_unlock(&markers_mutex); | 418 | mutex_unlock(&markers_mutex); |
420 | if (need_update) | ||
421 | marker_update_probes(probe_module); | ||
422 | return private; | 419 | return private; |
423 | } | 420 | } |
424 | EXPORT_SYMBOL_GPL(marker_probe_unregister_private_data); | 421 | EXPORT_SYMBOL_GPL(marker_probe_unregister_private_data); |
@@ -434,7 +431,7 @@ EXPORT_SYMBOL_GPL(marker_probe_unregister_private_data); | |||
434 | int marker_arm(const char *name) | 431 | int marker_arm(const char *name) |
435 | { | 432 | { |
436 | struct marker_entry *entry; | 433 | struct marker_entry *entry; |
437 | int ret = 0, need_update = 0; | 434 | int ret = 0; |
438 | 435 | ||
439 | mutex_lock(&markers_mutex); | 436 | mutex_lock(&markers_mutex); |
440 | entry = get_marker(name); | 437 | entry = get_marker(name); |
@@ -447,11 +444,9 @@ int marker_arm(const char *name) | |||
447 | */ | 444 | */ |
448 | if (entry->refcount++) | 445 | if (entry->refcount++) |
449 | goto end; | 446 | goto end; |
450 | need_update = 1; | ||
451 | end: | 447 | end: |
452 | mutex_unlock(&markers_mutex); | 448 | mutex_unlock(&markers_mutex); |
453 | if (need_update) | 449 | marker_update_probes(NULL); |
454 | marker_update_probes(NULL); | ||
455 | return ret; | 450 | return ret; |
456 | } | 451 | } |
457 | EXPORT_SYMBOL_GPL(marker_arm); | 452 | EXPORT_SYMBOL_GPL(marker_arm); |
@@ -467,7 +462,7 @@ EXPORT_SYMBOL_GPL(marker_arm); | |||
467 | int marker_disarm(const char *name) | 462 | int marker_disarm(const char *name) |
468 | { | 463 | { |
469 | struct marker_entry *entry; | 464 | struct marker_entry *entry; |
470 | int ret = 0, need_update = 0; | 465 | int ret = 0; |
471 | 466 | ||
472 | mutex_lock(&markers_mutex); | 467 | mutex_lock(&markers_mutex); |
473 | entry = get_marker(name); | 468 | entry = get_marker(name); |
@@ -486,11 +481,9 @@ int marker_disarm(const char *name) | |||
486 | ret = -EPERM; | 481 | ret = -EPERM; |
487 | goto end; | 482 | goto end; |
488 | } | 483 | } |
489 | need_update = 1; | ||
490 | end: | 484 | end: |
491 | mutex_unlock(&markers_mutex); | 485 | mutex_unlock(&markers_mutex); |
492 | if (need_update) | 486 | marker_update_probes(NULL); |
493 | marker_update_probes(NULL); | ||
494 | return ret; | 487 | return ret; |
495 | } | 488 | } |
496 | EXPORT_SYMBOL_GPL(marker_disarm); | 489 | EXPORT_SYMBOL_GPL(marker_disarm); |
diff --git a/kernel/params.c b/kernel/params.c index 16f269e9ddc9..2a4c51487e72 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -592,19 +592,16 @@ static void __init param_sysfs_builtin(void) | |||
592 | 592 | ||
593 | for (i=0; i < __stop___param - __start___param; i++) { | 593 | for (i=0; i < __stop___param - __start___param; i++) { |
594 | char *dot; | 594 | char *dot; |
595 | size_t kplen; | 595 | size_t max_name_len; |
596 | 596 | ||
597 | kp = &__start___param[i]; | 597 | kp = &__start___param[i]; |
598 | kplen = strlen(kp->name); | 598 | max_name_len = |
599 | min_t(size_t, MAX_KBUILD_MODNAME, strlen(kp->name)); | ||
599 | 600 | ||
600 | /* We do not handle args without periods. */ | 601 | dot = memchr(kp->name, '.', max_name_len); |
601 | if (kplen > MAX_KBUILD_MODNAME) { | ||
602 | DEBUGP("kernel parameter name is too long: %s\n", kp->name); | ||
603 | continue; | ||
604 | } | ||
605 | dot = memchr(kp->name, '.', kplen); | ||
606 | if (!dot) { | 602 | if (!dot) { |
607 | DEBUGP("couldn't find period in %s\n", kp->name); | 603 | DEBUGP("couldn't find period in first %d characters " |
604 | "of %s\n", MAX_KBUILD_MODNAME, kp->name); | ||
608 | continue; | 605 | continue; |
609 | } | 606 | } |
610 | name_len = dot - kp->name; | 607 | name_len = dot - kp->name; |
diff --git a/kernel/pid.c b/kernel/pid.c index d1db36b94674..f815455431bf 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -537,6 +537,7 @@ err_alloc: | |||
537 | return NULL; | 537 | return NULL; |
538 | } | 538 | } |
539 | 539 | ||
540 | #ifdef CONFIG_PID_NS | ||
540 | static struct pid_namespace *create_pid_namespace(int level) | 541 | static struct pid_namespace *create_pid_namespace(int level) |
541 | { | 542 | { |
542 | struct pid_namespace *ns; | 543 | struct pid_namespace *ns; |
@@ -621,6 +622,7 @@ void free_pid_ns(struct kref *kref) | |||
621 | if (parent != NULL) | 622 | if (parent != NULL) |
622 | put_pid_ns(parent); | 623 | put_pid_ns(parent); |
623 | } | 624 | } |
625 | #endif /* CONFIG_PID_NS */ | ||
624 | 626 | ||
625 | void zap_pid_ns_processes(struct pid_namespace *pid_ns) | 627 | void zap_pid_ns_processes(struct pid_namespace *pid_ns) |
626 | { | 628 | { |
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 8b15f777010a..05b64790fe83 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -456,7 +456,17 @@ static int software_resume(void) | |||
456 | int error; | 456 | int error; |
457 | unsigned int flags; | 457 | unsigned int flags; |
458 | 458 | ||
459 | mutex_lock(&pm_mutex); | 459 | /* |
460 | * name_to_dev_t() below takes a sysfs buffer mutex when sysfs | ||
461 | * is configured into the kernel. Since the regular hibernate | ||
462 | * trigger path is via sysfs which takes a buffer mutex before | ||
463 | * calling hibernate functions (which take pm_mutex) this can | ||
464 | * cause lockdep to complain about a possible ABBA deadlock | ||
465 | * which cannot happen since we're in the boot code here and | ||
466 | * sysfs can't be invoked yet. Therefore, we use a subclass | ||
467 | * here to avoid lockdep complaining. | ||
468 | */ | ||
469 | mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING); | ||
460 | if (!swsusp_resume_device) { | 470 | if (!swsusp_resume_device) { |
461 | if (!strlen(resume_file)) { | 471 | if (!strlen(resume_file)) { |
462 | mutex_unlock(&pm_mutex); | 472 | mutex_unlock(&pm_mutex); |
diff --git a/kernel/resource.c b/kernel/resource.c index a358142ff48f..2eb553d9b517 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -277,7 +277,7 @@ walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void *arg, | |||
277 | int ret = -1; | 277 | int ret = -1; |
278 | res.start = (u64) start_pfn << PAGE_SHIFT; | 278 | res.start = (u64) start_pfn << PAGE_SHIFT; |
279 | res.end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1; | 279 | res.end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1; |
280 | res.flags = IORESOURCE_MEM; | 280 | res.flags = IORESOURCE_MEM | IORESOURCE_BUSY; |
281 | orig_end = res.end; | 281 | orig_end = res.end; |
282 | while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) { | 282 | while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) { |
283 | pfn = (unsigned long)(res.start >> PAGE_SHIFT); | 283 | pfn = (unsigned long)(res.start >> PAGE_SHIFT); |
diff --git a/kernel/sched.c b/kernel/sched.c index b18f231a4875..4fb3532dd7e8 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -52,7 +52,6 @@ | |||
52 | #include <linux/cpu.h> | 52 | #include <linux/cpu.h> |
53 | #include <linux/cpuset.h> | 53 | #include <linux/cpuset.h> |
54 | #include <linux/percpu.h> | 54 | #include <linux/percpu.h> |
55 | #include <linux/cpu_acct.h> | ||
56 | #include <linux/kthread.h> | 55 | #include <linux/kthread.h> |
57 | #include <linux/seq_file.h> | 56 | #include <linux/seq_file.h> |
58 | #include <linux/sysctl.h> | 57 | #include <linux/sysctl.h> |
@@ -3338,13 +3337,9 @@ void account_user_time(struct task_struct *p, cputime_t cputime) | |||
3338 | { | 3337 | { |
3339 | struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat; | 3338 | struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat; |
3340 | cputime64_t tmp; | 3339 | cputime64_t tmp; |
3341 | struct rq *rq = this_rq(); | ||
3342 | 3340 | ||
3343 | p->utime = cputime_add(p->utime, cputime); | 3341 | p->utime = cputime_add(p->utime, cputime); |
3344 | 3342 | ||
3345 | if (p != rq->idle) | ||
3346 | cpuacct_charge(p, cputime); | ||
3347 | |||
3348 | /* Add user time to cpustat. */ | 3343 | /* Add user time to cpustat. */ |
3349 | tmp = cputime_to_cputime64(cputime); | 3344 | tmp = cputime_to_cputime64(cputime); |
3350 | if (TASK_NICE(p) > 0) | 3345 | if (TASK_NICE(p) > 0) |
@@ -3408,10 +3403,9 @@ void account_system_time(struct task_struct *p, int hardirq_offset, | |||
3408 | cpustat->irq = cputime64_add(cpustat->irq, tmp); | 3403 | cpustat->irq = cputime64_add(cpustat->irq, tmp); |
3409 | else if (softirq_count()) | 3404 | else if (softirq_count()) |
3410 | cpustat->softirq = cputime64_add(cpustat->softirq, tmp); | 3405 | cpustat->softirq = cputime64_add(cpustat->softirq, tmp); |
3411 | else if (p != rq->idle) { | 3406 | else if (p != rq->idle) |
3412 | cpustat->system = cputime64_add(cpustat->system, tmp); | 3407 | cpustat->system = cputime64_add(cpustat->system, tmp); |
3413 | cpuacct_charge(p, cputime); | 3408 | else if (atomic_read(&rq->nr_iowait) > 0) |
3414 | } else if (atomic_read(&rq->nr_iowait) > 0) | ||
3415 | cpustat->iowait = cputime64_add(cpustat->iowait, tmp); | 3409 | cpustat->iowait = cputime64_add(cpustat->iowait, tmp); |
3416 | else | 3410 | else |
3417 | cpustat->idle = cputime64_add(cpustat->idle, tmp); | 3411 | cpustat->idle = cputime64_add(cpustat->idle, tmp); |
@@ -3447,10 +3441,8 @@ void account_steal_time(struct task_struct *p, cputime_t steal) | |||
3447 | cpustat->iowait = cputime64_add(cpustat->iowait, tmp); | 3441 | cpustat->iowait = cputime64_add(cpustat->iowait, tmp); |
3448 | else | 3442 | else |
3449 | cpustat->idle = cputime64_add(cpustat->idle, tmp); | 3443 | cpustat->idle = cputime64_add(cpustat->idle, tmp); |
3450 | } else { | 3444 | } else |
3451 | cpustat->steal = cputime64_add(cpustat->steal, tmp); | 3445 | cpustat->steal = cputime64_add(cpustat->steal, tmp); |
3452 | cpuacct_charge(p, -tmp); | ||
3453 | } | ||
3454 | } | 3446 | } |
3455 | 3447 | ||
3456 | /* | 3448 | /* |
diff --git a/kernel/signal.c b/kernel/signal.c index 909a0cc6bc70..afa4f781f924 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -55,7 +55,7 @@ static int sig_ignored(struct task_struct *t, int sig) | |||
55 | * signal handler may change by the time it is | 55 | * signal handler may change by the time it is |
56 | * unblocked. | 56 | * unblocked. |
57 | */ | 57 | */ |
58 | if (sigismember(&t->blocked, sig)) | 58 | if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig)) |
59 | return 0; | 59 | return 0; |
60 | 60 | ||
61 | /* Is it explicitly or implicitly ignored? */ | 61 | /* Is it explicitly or implicitly ignored? */ |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 3a1744fed2b6..0deed82a6156 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -2620,6 +2620,10 @@ static int deprecated_sysctl_warning(struct __sysctl_args *args) | |||
2620 | int name[CTL_MAXNAME]; | 2620 | int name[CTL_MAXNAME]; |
2621 | int i; | 2621 | int i; |
2622 | 2622 | ||
2623 | /* Check args->nlen. */ | ||
2624 | if (args->nlen < 0 || args->nlen > CTL_MAXNAME) | ||
2625 | return -ENOTDIR; | ||
2626 | |||
2623 | /* Read in the sysctl name for better debug message logging */ | 2627 | /* Read in the sysctl name for better debug message logging */ |
2624 | for (i = 0; i < args->nlen; i++) | 2628 | for (i = 0; i < args->nlen; i++) |
2625 | if (get_user(name[i], args->name + i)) | 2629 | if (get_user(name[i], args->name + i)) |
diff --git a/kernel/sysctl_check.c b/kernel/sysctl_check.c index 5a2f2b2bf888..4abc6d2306f4 100644 --- a/kernel/sysctl_check.c +++ b/kernel/sysctl_check.c | |||
@@ -738,7 +738,7 @@ static struct trans_ctl_table trans_net_table[] = { | |||
738 | { NET_ROSE, "rose", trans_net_rose_table }, | 738 | { NET_ROSE, "rose", trans_net_rose_table }, |
739 | { NET_IPV6, "ipv6", trans_net_ipv6_table }, | 739 | { NET_IPV6, "ipv6", trans_net_ipv6_table }, |
740 | { NET_X25, "x25", trans_net_x25_table }, | 740 | { NET_X25, "x25", trans_net_x25_table }, |
741 | { NET_TR, "tr", trans_net_tr_table }, | 741 | { NET_TR, "token-ring", trans_net_tr_table }, |
742 | { NET_DECNET, "decnet", trans_net_decnet_table }, | 742 | { NET_DECNET, "decnet", trans_net_decnet_table }, |
743 | /* NET_ECONET not used */ | 743 | /* NET_ECONET not used */ |
744 | { NET_SCTP, "sctp", trans_net_sctp_table }, | 744 | { NET_SCTP, "sctp", trans_net_sctp_table }, |
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 354e74bc17c1..07e86a828073 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -398,31 +398,31 @@ static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info) | |||
398 | 398 | ||
399 | fd = nla_get_u32(info->attrs[CGROUPSTATS_CMD_ATTR_FD]); | 399 | fd = nla_get_u32(info->attrs[CGROUPSTATS_CMD_ATTR_FD]); |
400 | file = fget_light(fd, &fput_needed); | 400 | file = fget_light(fd, &fput_needed); |
401 | if (file) { | 401 | if (!file) |
402 | size = nla_total_size(sizeof(struct cgroupstats)); | 402 | return 0; |
403 | 403 | ||
404 | rc = prepare_reply(info, CGROUPSTATS_CMD_NEW, &rep_skb, | 404 | size = nla_total_size(sizeof(struct cgroupstats)); |
405 | size); | ||
406 | if (rc < 0) | ||
407 | goto err; | ||
408 | 405 | ||
409 | na = nla_reserve(rep_skb, CGROUPSTATS_TYPE_CGROUP_STATS, | 406 | rc = prepare_reply(info, CGROUPSTATS_CMD_NEW, &rep_skb, |
410 | sizeof(struct cgroupstats)); | 407 | size); |
411 | stats = nla_data(na); | 408 | if (rc < 0) |
412 | memset(stats, 0, sizeof(*stats)); | 409 | goto err; |
413 | 410 | ||
414 | rc = cgroupstats_build(stats, file->f_dentry); | 411 | na = nla_reserve(rep_skb, CGROUPSTATS_TYPE_CGROUP_STATS, |
415 | if (rc < 0) | 412 | sizeof(struct cgroupstats)); |
416 | goto err; | 413 | stats = nla_data(na); |
414 | memset(stats, 0, sizeof(*stats)); | ||
417 | 415 | ||
418 | fput_light(file, fput_needed); | 416 | rc = cgroupstats_build(stats, file->f_dentry); |
419 | return send_reply(rep_skb, info->snd_pid); | 417 | if (rc < 0) { |
418 | nlmsg_free(rep_skb); | ||
419 | goto err; | ||
420 | } | 420 | } |
421 | 421 | ||
422 | rc = send_reply(rep_skb, info->snd_pid); | ||
423 | |||
422 | err: | 424 | err: |
423 | if (file) | 425 | fput_light(file, fput_needed); |
424 | fput_light(file, fput_needed); | ||
425 | nlmsg_free(rep_skb); | ||
426 | return rc; | 426 | return rc; |
427 | } | 427 | } |
428 | 428 | ||
diff --git a/lib/Makefile b/lib/Makefile index 3a0983b77412..b6793ed28d84 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | lib-y := ctype.o string.o vsprintf.o cmdline.o \ | 5 | lib-y := ctype.o string.o vsprintf.o cmdline.o \ |
6 | rbtree.o radix-tree.o dump_stack.o \ | 6 | rbtree.o radix-tree.o dump_stack.o \ |
7 | idr.o int_sqrt.o bitmap.o extable.o prio_tree.o \ | 7 | idr.o int_sqrt.o extable.o prio_tree.o \ |
8 | sha1.o irq_regs.o reciprocal_div.o argv_split.o \ | 8 | sha1.o irq_regs.o reciprocal_div.o argv_split.o \ |
9 | proportions.o prio_heap.o | 9 | proportions.o prio_heap.o |
10 | 10 | ||
@@ -14,7 +14,7 @@ lib-$(CONFIG_SMP) += cpumask.o | |||
14 | lib-y += kobject.o kref.o klist.o | 14 | lib-y += kobject.o kref.o klist.o |
15 | 15 | ||
16 | obj-y += div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ | 16 | obj-y += div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ |
17 | bust_spinlocks.o hexdump.o kasprintf.o | 17 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o |
18 | 18 | ||
19 | ifeq ($(CONFIG_DEBUG_KOBJECT),y) | 19 | ifeq ($(CONFIG_DEBUG_KOBJECT),y) |
20 | CFLAGS_kobject.o += -DDEBUG | 20 | CFLAGS_kobject.o += -DDEBUG |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 8b809ecefa39..6121b57bbe96 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -116,7 +116,9 @@ static void update_and_free_page(struct page *page) | |||
116 | static void free_huge_page(struct page *page) | 116 | static void free_huge_page(struct page *page) |
117 | { | 117 | { |
118 | int nid = page_to_nid(page); | 118 | int nid = page_to_nid(page); |
119 | struct address_space *mapping; | ||
119 | 120 | ||
121 | mapping = (struct address_space *) page_private(page); | ||
120 | BUG_ON(page_count(page)); | 122 | BUG_ON(page_count(page)); |
121 | INIT_LIST_HEAD(&page->lru); | 123 | INIT_LIST_HEAD(&page->lru); |
122 | 124 | ||
@@ -129,6 +131,9 @@ static void free_huge_page(struct page *page) | |||
129 | enqueue_huge_page(page); | 131 | enqueue_huge_page(page); |
130 | } | 132 | } |
131 | spin_unlock(&hugetlb_lock); | 133 | spin_unlock(&hugetlb_lock); |
134 | if (mapping) | ||
135 | hugetlb_put_quota(mapping, 1); | ||
136 | set_page_private(page, 0); | ||
132 | } | 137 | } |
133 | 138 | ||
134 | /* | 139 | /* |
@@ -323,7 +328,7 @@ free: | |||
323 | * allocated to satisfy the reservation must be explicitly freed if they were | 328 | * allocated to satisfy the reservation must be explicitly freed if they were |
324 | * never used. | 329 | * never used. |
325 | */ | 330 | */ |
326 | void return_unused_surplus_pages(unsigned long unused_resv_pages) | 331 | static void return_unused_surplus_pages(unsigned long unused_resv_pages) |
327 | { | 332 | { |
328 | static int nid = -1; | 333 | static int nid = -1; |
329 | struct page *page; | 334 | struct page *page; |
@@ -353,35 +358,50 @@ void return_unused_surplus_pages(unsigned long unused_resv_pages) | |||
353 | } | 358 | } |
354 | } | 359 | } |
355 | 360 | ||
356 | static struct page *alloc_huge_page(struct vm_area_struct *vma, | 361 | |
357 | unsigned long addr) | 362 | static struct page *alloc_huge_page_shared(struct vm_area_struct *vma, |
363 | unsigned long addr) | ||
358 | { | 364 | { |
359 | struct page *page = NULL; | 365 | struct page *page; |
360 | int use_reserved_page = vma->vm_flags & VM_MAYSHARE; | ||
361 | 366 | ||
362 | spin_lock(&hugetlb_lock); | 367 | spin_lock(&hugetlb_lock); |
363 | if (!use_reserved_page && (free_huge_pages <= resv_huge_pages)) | ||
364 | goto fail; | ||
365 | |||
366 | page = dequeue_huge_page(vma, addr); | 368 | page = dequeue_huge_page(vma, addr); |
367 | if (!page) | ||
368 | goto fail; | ||
369 | |||
370 | spin_unlock(&hugetlb_lock); | 369 | spin_unlock(&hugetlb_lock); |
371 | set_page_refcounted(page); | 370 | return page ? page : ERR_PTR(-VM_FAULT_OOM); |
372 | return page; | 371 | } |
373 | 372 | ||
374 | fail: | 373 | static struct page *alloc_huge_page_private(struct vm_area_struct *vma, |
375 | spin_unlock(&hugetlb_lock); | 374 | unsigned long addr) |
375 | { | ||
376 | struct page *page = NULL; | ||
376 | 377 | ||
377 | /* | 378 | if (hugetlb_get_quota(vma->vm_file->f_mapping, 1)) |
378 | * Private mappings do not use reserved huge pages so the allocation | 379 | return ERR_PTR(-VM_FAULT_SIGBUS); |
379 | * may have failed due to an undersized hugetlb pool. Try to grab a | 380 | |
380 | * surplus huge page from the buddy allocator. | 381 | spin_lock(&hugetlb_lock); |
381 | */ | 382 | if (free_huge_pages > resv_huge_pages) |
382 | if (!use_reserved_page) | 383 | page = dequeue_huge_page(vma, addr); |
384 | spin_unlock(&hugetlb_lock); | ||
385 | if (!page) | ||
383 | page = alloc_buddy_huge_page(vma, addr); | 386 | page = alloc_buddy_huge_page(vma, addr); |
387 | return page ? page : ERR_PTR(-VM_FAULT_OOM); | ||
388 | } | ||
389 | |||
390 | static struct page *alloc_huge_page(struct vm_area_struct *vma, | ||
391 | unsigned long addr) | ||
392 | { | ||
393 | struct page *page; | ||
394 | struct address_space *mapping = vma->vm_file->f_mapping; | ||
384 | 395 | ||
396 | if (vma->vm_flags & VM_MAYSHARE) | ||
397 | page = alloc_huge_page_shared(vma, addr); | ||
398 | else | ||
399 | page = alloc_huge_page_private(vma, addr); | ||
400 | |||
401 | if (!IS_ERR(page)) { | ||
402 | set_page_refcounted(page); | ||
403 | set_page_private(page, (unsigned long) mapping); | ||
404 | } | ||
385 | return page; | 405 | return page; |
386 | } | 406 | } |
387 | 407 | ||
@@ -726,9 +746,9 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma, | |||
726 | page_cache_get(old_page); | 746 | page_cache_get(old_page); |
727 | new_page = alloc_huge_page(vma, address); | 747 | new_page = alloc_huge_page(vma, address); |
728 | 748 | ||
729 | if (!new_page) { | 749 | if (IS_ERR(new_page)) { |
730 | page_cache_release(old_page); | 750 | page_cache_release(old_page); |
731 | return VM_FAULT_OOM; | 751 | return -PTR_ERR(new_page); |
732 | } | 752 | } |
733 | 753 | ||
734 | spin_unlock(&mm->page_table_lock); | 754 | spin_unlock(&mm->page_table_lock); |
@@ -772,27 +792,28 @@ retry: | |||
772 | size = i_size_read(mapping->host) >> HPAGE_SHIFT; | 792 | size = i_size_read(mapping->host) >> HPAGE_SHIFT; |
773 | if (idx >= size) | 793 | if (idx >= size) |
774 | goto out; | 794 | goto out; |
775 | if (hugetlb_get_quota(mapping)) | ||
776 | goto out; | ||
777 | page = alloc_huge_page(vma, address); | 795 | page = alloc_huge_page(vma, address); |
778 | if (!page) { | 796 | if (IS_ERR(page)) { |
779 | hugetlb_put_quota(mapping); | 797 | ret = -PTR_ERR(page); |
780 | ret = VM_FAULT_OOM; | ||
781 | goto out; | 798 | goto out; |
782 | } | 799 | } |
783 | clear_huge_page(page, address); | 800 | clear_huge_page(page, address); |
784 | 801 | ||
785 | if (vma->vm_flags & VM_SHARED) { | 802 | if (vma->vm_flags & VM_SHARED) { |
786 | int err; | 803 | int err; |
804 | struct inode *inode = mapping->host; | ||
787 | 805 | ||
788 | err = add_to_page_cache(page, mapping, idx, GFP_KERNEL); | 806 | err = add_to_page_cache(page, mapping, idx, GFP_KERNEL); |
789 | if (err) { | 807 | if (err) { |
790 | put_page(page); | 808 | put_page(page); |
791 | hugetlb_put_quota(mapping); | ||
792 | if (err == -EEXIST) | 809 | if (err == -EEXIST) |
793 | goto retry; | 810 | goto retry; |
794 | goto out; | 811 | goto out; |
795 | } | 812 | } |
813 | |||
814 | spin_lock(&inode->i_lock); | ||
815 | inode->i_blocks += BLOCKS_PER_HUGEPAGE; | ||
816 | spin_unlock(&inode->i_lock); | ||
796 | } else | 817 | } else |
797 | lock_page(page); | 818 | lock_page(page); |
798 | } | 819 | } |
@@ -822,7 +843,6 @@ out: | |||
822 | 843 | ||
823 | backout: | 844 | backout: |
824 | spin_unlock(&mm->page_table_lock); | 845 | spin_unlock(&mm->page_table_lock); |
825 | hugetlb_put_quota(mapping); | ||
826 | unlock_page(page); | 846 | unlock_page(page); |
827 | put_page(page); | 847 | put_page(page); |
828 | goto out; | 848 | goto out; |
@@ -868,7 +888,8 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
868 | 888 | ||
869 | int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, | 889 | int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, |
870 | struct page **pages, struct vm_area_struct **vmas, | 890 | struct page **pages, struct vm_area_struct **vmas, |
871 | unsigned long *position, int *length, int i) | 891 | unsigned long *position, int *length, int i, |
892 | int write) | ||
872 | { | 893 | { |
873 | unsigned long pfn_offset; | 894 | unsigned long pfn_offset; |
874 | unsigned long vaddr = *position; | 895 | unsigned long vaddr = *position; |
@@ -890,7 +911,7 @@ int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
890 | int ret; | 911 | int ret; |
891 | 912 | ||
892 | spin_unlock(&mm->page_table_lock); | 913 | spin_unlock(&mm->page_table_lock); |
893 | ret = hugetlb_fault(mm, vma, vaddr, 0); | 914 | ret = hugetlb_fault(mm, vma, vaddr, write); |
894 | spin_lock(&mm->page_table_lock); | 915 | spin_lock(&mm->page_table_lock); |
895 | if (!(ret & VM_FAULT_ERROR)) | 916 | if (!(ret & VM_FAULT_ERROR)) |
896 | continue; | 917 | continue; |
@@ -1132,6 +1153,8 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to) | |||
1132 | if (chg < 0) | 1153 | if (chg < 0) |
1133 | return chg; | 1154 | return chg; |
1134 | 1155 | ||
1156 | if (hugetlb_get_quota(inode->i_mapping, chg)) | ||
1157 | return -ENOSPC; | ||
1135 | ret = hugetlb_acct_memory(chg); | 1158 | ret = hugetlb_acct_memory(chg); |
1136 | if (ret < 0) | 1159 | if (ret < 0) |
1137 | return ret; | 1160 | return ret; |
@@ -1142,5 +1165,11 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to) | |||
1142 | void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed) | 1165 | void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed) |
1143 | { | 1166 | { |
1144 | long chg = region_truncate(&inode->i_mapping->private_list, offset); | 1167 | long chg = region_truncate(&inode->i_mapping->private_list, offset); |
1145 | hugetlb_acct_memory(freed - chg); | 1168 | |
1169 | spin_lock(&inode->i_lock); | ||
1170 | inode->i_blocks -= BLOCKS_PER_HUGEPAGE * freed; | ||
1171 | spin_unlock(&inode->i_lock); | ||
1172 | |||
1173 | hugetlb_put_quota(inode->i_mapping, (chg - freed)); | ||
1174 | hugetlb_acct_memory(-(chg - freed)); | ||
1146 | } | 1175 | } |
diff --git a/mm/memory.c b/mm/memory.c index 9791e4786843..4bf0b6d0eb2a 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1036,7 +1036,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1036 | 1036 | ||
1037 | if (is_vm_hugetlb_page(vma)) { | 1037 | if (is_vm_hugetlb_page(vma)) { |
1038 | i = follow_hugetlb_page(mm, vma, pages, vmas, | 1038 | i = follow_hugetlb_page(mm, vma, pages, vmas, |
1039 | &start, &len, i); | 1039 | &start, &len, i, write); |
1040 | continue; | 1040 | continue; |
1041 | } | 1041 | } |
1042 | 1042 | ||
@@ -2084,9 +2084,9 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2084 | count_vm_event(PGMAJFAULT); | 2084 | count_vm_event(PGMAJFAULT); |
2085 | } | 2085 | } |
2086 | 2086 | ||
2087 | delayacct_clear_flag(DELAYACCT_PF_SWAPIN); | ||
2088 | mark_page_accessed(page); | 2087 | mark_page_accessed(page); |
2089 | lock_page(page); | 2088 | lock_page(page); |
2089 | delayacct_clear_flag(DELAYACCT_PF_SWAPIN); | ||
2090 | 2090 | ||
2091 | /* | 2091 | /* |
2092 | * Back out if somebody else already faulted in this pte. | 2092 | * Back out if somebody else already faulted in this pte. |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 3a47871a29d9..9512a544d044 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -39,7 +39,7 @@ static struct resource *register_memory_resource(u64 start, u64 size) | |||
39 | res->name = "System RAM"; | 39 | res->name = "System RAM"; |
40 | res->start = start; | 40 | res->start = start; |
41 | res->end = start + size - 1; | 41 | res->end = start + size - 1; |
42 | res->flags = IORESOURCE_MEM; | 42 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; |
43 | if (request_resource(&iomem_resource, res) < 0) { | 43 | if (request_resource(&iomem_resource, res) < 0) { |
44 | printk("System RAM resource %llx - %llx cannot be added\n", | 44 | printk("System RAM resource %llx - %llx cannot be added\n", |
45 | (unsigned long long)res->start, (unsigned long long)res->end); | 45 | (unsigned long long)res->start, (unsigned long long)res->end); |
@@ -574,8 +574,8 @@ repeat: | |||
574 | /* Ok, all of our target is islaoted. | 574 | /* Ok, all of our target is islaoted. |
575 | We cannot do rollback at this point. */ | 575 | We cannot do rollback at this point. */ |
576 | offline_isolated_pages(start_pfn, end_pfn); | 576 | offline_isolated_pages(start_pfn, end_pfn); |
577 | /* reset pagetype flags */ | 577 | /* reset pagetype flags and makes migrate type to be MOVABLE */ |
578 | start_isolate_page_range(start_pfn, end_pfn); | 578 | undo_isolate_page_range(start_pfn, end_pfn); |
579 | /* removal success */ | 579 | /* removal success */ |
580 | zone->present_pages -= offlined_pages; | 580 | zone->present_pages -= offlined_pages; |
581 | zone->zone_pgdat->node_present_pages -= offlined_pages; | 581 | zone->zone_pgdat->node_present_pages -= offlined_pages; |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index c1592a94582f..83c69f8a64c2 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -722,12 +722,29 @@ out: | |||
722 | 722 | ||
723 | } | 723 | } |
724 | 724 | ||
725 | /* | ||
726 | * Allocate a new page for page migration based on vma policy. | ||
727 | * Start assuming that page is mapped by vma pointed to by @private. | ||
728 | * Search forward from there, if not. N.B., this assumes that the | ||
729 | * list of pages handed to migrate_pages()--which is how we get here-- | ||
730 | * is in virtual address order. | ||
731 | */ | ||
725 | static struct page *new_vma_page(struct page *page, unsigned long private, int **x) | 732 | static struct page *new_vma_page(struct page *page, unsigned long private, int **x) |
726 | { | 733 | { |
727 | struct vm_area_struct *vma = (struct vm_area_struct *)private; | 734 | struct vm_area_struct *vma = (struct vm_area_struct *)private; |
735 | unsigned long uninitialized_var(address); | ||
728 | 736 | ||
729 | return alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, | 737 | while (vma) { |
730 | page_address_in_vma(page, vma)); | 738 | address = page_address_in_vma(page, vma); |
739 | if (address != -EFAULT) | ||
740 | break; | ||
741 | vma = vma->vm_next; | ||
742 | } | ||
743 | |||
744 | /* | ||
745 | * if !vma, alloc_page_vma() will use task or system default policy | ||
746 | */ | ||
747 | return alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address); | ||
731 | } | 748 | } |
732 | #else | 749 | #else |
733 | 750 | ||
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 838a5e31394c..81a91e6f1f99 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -355,8 +355,8 @@ get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty, | |||
355 | */ | 355 | */ |
356 | static void balance_dirty_pages(struct address_space *mapping) | 356 | static void balance_dirty_pages(struct address_space *mapping) |
357 | { | 357 | { |
358 | long bdi_nr_reclaimable; | 358 | long nr_reclaimable, bdi_nr_reclaimable; |
359 | long bdi_nr_writeback; | 359 | long nr_writeback, bdi_nr_writeback; |
360 | long background_thresh; | 360 | long background_thresh; |
361 | long dirty_thresh; | 361 | long dirty_thresh; |
362 | long bdi_thresh; | 362 | long bdi_thresh; |
@@ -376,11 +376,26 @@ static void balance_dirty_pages(struct address_space *mapping) | |||
376 | 376 | ||
377 | get_dirty_limits(&background_thresh, &dirty_thresh, | 377 | get_dirty_limits(&background_thresh, &dirty_thresh, |
378 | &bdi_thresh, bdi); | 378 | &bdi_thresh, bdi); |
379 | |||
380 | nr_reclaimable = global_page_state(NR_FILE_DIRTY) + | ||
381 | global_page_state(NR_UNSTABLE_NFS); | ||
382 | nr_writeback = global_page_state(NR_WRITEBACK); | ||
383 | |||
379 | bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE); | 384 | bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE); |
380 | bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK); | 385 | bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK); |
386 | |||
381 | if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh) | 387 | if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh) |
382 | break; | 388 | break; |
383 | 389 | ||
390 | /* | ||
391 | * Throttle it only when the background writeback cannot | ||
392 | * catch-up. This avoids (excessively) small writeouts | ||
393 | * when the bdi limits are ramping up. | ||
394 | */ | ||
395 | if (nr_reclaimable + nr_writeback < | ||
396 | (background_thresh + dirty_thresh) / 2) | ||
397 | break; | ||
398 | |||
384 | if (!bdi->dirty_exceeded) | 399 | if (!bdi->dirty_exceeded) |
385 | bdi->dirty_exceeded = 1; | 400 | bdi->dirty_exceeded = 1; |
386 | 401 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index da69d833e067..12376ae3f733 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -749,23 +749,6 @@ int move_freepages_block(struct zone *zone, struct page *page, int migratetype) | |||
749 | return move_freepages(zone, start_page, end_page, migratetype); | 749 | return move_freepages(zone, start_page, end_page, migratetype); |
750 | } | 750 | } |
751 | 751 | ||
752 | /* Return the page with the lowest PFN in the list */ | ||
753 | static struct page *min_page(struct list_head *list) | ||
754 | { | ||
755 | unsigned long min_pfn = -1UL; | ||
756 | struct page *min_page = NULL, *page;; | ||
757 | |||
758 | list_for_each_entry(page, list, lru) { | ||
759 | unsigned long pfn = page_to_pfn(page); | ||
760 | if (pfn < min_pfn) { | ||
761 | min_pfn = pfn; | ||
762 | min_page = page; | ||
763 | } | ||
764 | } | ||
765 | |||
766 | return min_page; | ||
767 | } | ||
768 | |||
769 | /* Remove an element from the buddy allocator from the fallback list */ | 752 | /* Remove an element from the buddy allocator from the fallback list */ |
770 | static struct page *__rmqueue_fallback(struct zone *zone, int order, | 753 | static struct page *__rmqueue_fallback(struct zone *zone, int order, |
771 | int start_migratetype) | 754 | int start_migratetype) |
@@ -789,11 +772,8 @@ static struct page *__rmqueue_fallback(struct zone *zone, int order, | |||
789 | if (list_empty(&area->free_list[migratetype])) | 772 | if (list_empty(&area->free_list[migratetype])) |
790 | continue; | 773 | continue; |
791 | 774 | ||
792 | /* Bias kernel allocations towards low pfns */ | ||
793 | page = list_entry(area->free_list[migratetype].next, | 775 | page = list_entry(area->free_list[migratetype].next, |
794 | struct page, lru); | 776 | struct page, lru); |
795 | if (unlikely(start_migratetype != MIGRATE_MOVABLE)) | ||
796 | page = min_page(&area->free_list[migratetype]); | ||
797 | area->nr_free--; | 777 | area->nr_free--; |
798 | 778 | ||
799 | /* | 779 | /* |
diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 8f92a29695cc..3444b58033c8 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c | |||
@@ -55,7 +55,7 @@ start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn) | |||
55 | return 0; | 55 | return 0; |
56 | undo: | 56 | undo: |
57 | for (pfn = start_pfn; | 57 | for (pfn = start_pfn; |
58 | pfn <= undo_pfn; | 58 | pfn < undo_pfn; |
59 | pfn += pageblock_nr_pages) | 59 | pfn += pageblock_nr_pages) |
60 | unset_migratetype_isolate(pfn_to_page(pfn)); | 60 | unset_migratetype_isolate(pfn_to_page(pfn)); |
61 | 61 | ||
@@ -76,7 +76,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn) | |||
76 | pfn < end_pfn; | 76 | pfn < end_pfn; |
77 | pfn += pageblock_nr_pages) { | 77 | pfn += pageblock_nr_pages) { |
78 | page = __first_valid_page(pfn, pageblock_nr_pages); | 78 | page = __first_valid_page(pfn, pageblock_nr_pages); |
79 | if (!page || get_pageblock_flags(page) != MIGRATE_ISOLATE) | 79 | if (!page || get_pageblock_migratetype(page) != MIGRATE_ISOLATE) |
80 | continue; | 80 | continue; |
81 | unset_migratetype_isolate(page); | 81 | unset_migratetype_isolate(page); |
82 | } | 82 | } |
@@ -126,7 +126,7 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn) | |||
126 | */ | 126 | */ |
127 | for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) { | 127 | for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) { |
128 | page = __first_valid_page(pfn, pageblock_nr_pages); | 128 | page = __first_valid_page(pfn, pageblock_nr_pages); |
129 | if (page && get_pageblock_flags(page) != MIGRATE_ISOLATE) | 129 | if (page && get_pageblock_migratetype(page) != MIGRATE_ISOLATE) |
130 | break; | 130 | break; |
131 | } | 131 | } |
132 | if (pfn < end_pfn) | 132 | if (pfn < end_pfn) |
@@ -183,7 +183,9 @@ static void page_unlock_anon_vma(struct anon_vma *anon_vma) | |||
183 | } | 183 | } |
184 | 184 | ||
185 | /* | 185 | /* |
186 | * At what user virtual address is page expected in vma? | 186 | * At what user virtual address is page expected in @vma? |
187 | * Returns virtual address or -EFAULT if page's index/offset is not | ||
188 | * within the range mapped the @vma. | ||
187 | */ | 189 | */ |
188 | static inline unsigned long | 190 | static inline unsigned long |
189 | vma_address(struct page *page, struct vm_area_struct *vma) | 191 | vma_address(struct page *page, struct vm_area_struct *vma) |
@@ -193,8 +195,7 @@ vma_address(struct page *page, struct vm_area_struct *vma) | |||
193 | 195 | ||
194 | address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT); | 196 | address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT); |
195 | if (unlikely(address < vma->vm_start || address >= vma->vm_end)) { | 197 | if (unlikely(address < vma->vm_start || address >= vma->vm_end)) { |
196 | /* page should be within any vma from prio_tree_next */ | 198 | /* page should be within @vma mapping range */ |
197 | BUG_ON(!PageAnon(page)); | ||
198 | return -EFAULT; | 199 | return -EFAULT; |
199 | } | 200 | } |
200 | return address; | 201 | return address; |
@@ -1043,7 +1043,7 @@ static struct array_cache **alloc_alien_cache(int node, int limit) | |||
1043 | } | 1043 | } |
1044 | ac_ptr[i] = alloc_arraycache(node, limit, 0xbaadf00d); | 1044 | ac_ptr[i] = alloc_arraycache(node, limit, 0xbaadf00d); |
1045 | if (!ac_ptr[i]) { | 1045 | if (!ac_ptr[i]) { |
1046 | for (i--; i <= 0; i--) | 1046 | for (i--; i >= 0; i--) |
1047 | kfree(ac_ptr[i]); | 1047 | kfree(ac_ptr[i]); |
1048 | kfree(ac_ptr); | 1048 | kfree(ac_ptr); |
1049 | return NULL; | 1049 | return NULL; |
@@ -1080,7 +1080,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) | |||
1080 | struct page *page; | 1080 | struct page *page; |
1081 | struct kmem_cache_node *n; | 1081 | struct kmem_cache_node *n; |
1082 | void *start; | 1082 | void *start; |
1083 | void *end; | ||
1084 | void *last; | 1083 | void *last; |
1085 | void *p; | 1084 | void *p; |
1086 | 1085 | ||
@@ -1101,7 +1100,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) | |||
1101 | SetSlabDebug(page); | 1100 | SetSlabDebug(page); |
1102 | 1101 | ||
1103 | start = page_address(page); | 1102 | start = page_address(page); |
1104 | end = start + s->objects * s->size; | ||
1105 | 1103 | ||
1106 | if (unlikely(s->flags & SLAB_POISON)) | 1104 | if (unlikely(s->flags & SLAB_POISON)) |
1107 | memset(start, POISON_INUSE, PAGE_SIZE << s->order); | 1105 | memset(start, POISON_INUSE, PAGE_SIZE << s->order); |
@@ -95,8 +95,8 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags) | |||
95 | return (void *)p; | 95 | return (void *)p; |
96 | 96 | ||
97 | ret = kmalloc_track_caller(new_size, flags); | 97 | ret = kmalloc_track_caller(new_size, flags); |
98 | if (ret) { | 98 | if (ret && p) { |
99 | memcpy(ret, p, min(new_size, ks)); | 99 | memcpy(ret, p, ks); |
100 | kfree(p); | 100 | kfree(p); |
101 | } | 101 | } |
102 | return ret; | 102 | return ret; |
diff --git a/mm/vmstat.c b/mm/vmstat.c index 4651bf153f35..e8d846f57774 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -803,7 +803,7 @@ static void vmstat_update(struct work_struct *w) | |||
803 | sysctl_stat_interval); | 803 | sysctl_stat_interval); |
804 | } | 804 | } |
805 | 805 | ||
806 | static void __devinit start_cpu_timer(int cpu) | 806 | static void __cpuinit start_cpu_timer(int cpu) |
807 | { | 807 | { |
808 | struct delayed_work *vmstat_work = &per_cpu(vmstat_work, cpu); | 808 | struct delayed_work *vmstat_work = &per_cpu(vmstat_work, cpu); |
809 | 809 | ||
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 1037748c14db..6567213959cb 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -376,6 +376,7 @@ void vlan_setup(struct net_device *new_dev) | |||
376 | new_dev->init = vlan_dev_init; | 376 | new_dev->init = vlan_dev_init; |
377 | new_dev->open = vlan_dev_open; | 377 | new_dev->open = vlan_dev_open; |
378 | new_dev->stop = vlan_dev_stop; | 378 | new_dev->stop = vlan_dev_stop; |
379 | new_dev->set_mac_address = vlan_set_mac_address; | ||
379 | new_dev->set_multicast_list = vlan_dev_set_multicast_list; | 380 | new_dev->set_multicast_list = vlan_dev_set_multicast_list; |
380 | new_dev->change_rx_flags = vlan_change_rx_flags; | 381 | new_dev->change_rx_flags = vlan_change_rx_flags; |
381 | new_dev->destructor = free_netdev; | 382 | new_dev->destructor = free_netdev; |
@@ -636,6 +637,10 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, | |||
636 | if (!vlandev) | 637 | if (!vlandev) |
637 | continue; | 638 | continue; |
638 | 639 | ||
640 | flgs = vlandev->flags; | ||
641 | if (!(flgs & IFF_UP)) | ||
642 | continue; | ||
643 | |||
639 | vlan_sync_address(dev, vlandev); | 644 | vlan_sync_address(dev, vlandev); |
640 | } | 645 | } |
641 | break; | 646 | break; |
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index cf4a80d06b35..2cd1393073ec 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h | |||
@@ -60,6 +60,7 @@ int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev | |||
60 | int vlan_dev_change_mtu(struct net_device *dev, int new_mtu); | 60 | int vlan_dev_change_mtu(struct net_device *dev, int new_mtu); |
61 | int vlan_dev_open(struct net_device* dev); | 61 | int vlan_dev_open(struct net_device* dev); |
62 | int vlan_dev_stop(struct net_device* dev); | 62 | int vlan_dev_stop(struct net_device* dev); |
63 | int vlan_set_mac_address(struct net_device *dev, void *p); | ||
63 | int vlan_dev_ioctl(struct net_device* dev, struct ifreq *ifr, int cmd); | 64 | int vlan_dev_ioctl(struct net_device* dev, struct ifreq *ifr, int cmd); |
64 | void vlan_dev_set_ingress_priority(const struct net_device *dev, | 65 | void vlan_dev_set_ingress_priority(const struct net_device *dev, |
65 | u32 skb_prio, short vlan_prio); | 66 | u32 skb_prio, short vlan_prio); |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 1a1740aa9a8b..7a36878241da 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -665,6 +665,32 @@ int vlan_dev_stop(struct net_device *dev) | |||
665 | return 0; | 665 | return 0; |
666 | } | 666 | } |
667 | 667 | ||
668 | int vlan_set_mac_address(struct net_device *dev, void *p) | ||
669 | { | ||
670 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; | ||
671 | struct sockaddr *addr = p; | ||
672 | int err; | ||
673 | |||
674 | if (!is_valid_ether_addr(addr->sa_data)) | ||
675 | return -EADDRNOTAVAIL; | ||
676 | |||
677 | if (!(dev->flags & IFF_UP)) | ||
678 | goto out; | ||
679 | |||
680 | if (compare_ether_addr(addr->sa_data, real_dev->dev_addr)) { | ||
681 | err = dev_unicast_add(real_dev, addr->sa_data, ETH_ALEN); | ||
682 | if (err < 0) | ||
683 | return err; | ||
684 | } | ||
685 | |||
686 | if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr)) | ||
687 | dev_unicast_delete(real_dev, dev->dev_addr, ETH_ALEN); | ||
688 | |||
689 | out: | ||
690 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | ||
691 | return 0; | ||
692 | } | ||
693 | |||
668 | int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 694 | int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
669 | { | 695 | { |
670 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; | 696 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index da22f900e89d..c1757c79dfbb 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -766,6 +766,9 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb, | |||
766 | if (!nf_bridge) | 766 | if (!nf_bridge) |
767 | return NF_ACCEPT; | 767 | return NF_ACCEPT; |
768 | 768 | ||
769 | if (!(nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))) | ||
770 | return NF_ACCEPT; | ||
771 | |||
769 | if (!realoutdev) | 772 | if (!realoutdev) |
770 | return NF_DROP; | 773 | return NF_DROP; |
771 | 774 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index be6cedab5aa8..86d62611f2fc 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1171,6 +1171,8 @@ rollback: | |||
1171 | nb->notifier_call(nb, NETDEV_UNREGISTER, dev); | 1171 | nb->notifier_call(nb, NETDEV_UNREGISTER, dev); |
1172 | } | 1172 | } |
1173 | } | 1173 | } |
1174 | |||
1175 | raw_notifier_chain_unregister(&netdev_chain, nb); | ||
1174 | goto unlock; | 1176 | goto unlock; |
1175 | } | 1177 | } |
1176 | 1178 | ||
@@ -2688,7 +2690,7 @@ static void __net_exit dev_proc_net_exit(struct net *net) | |||
2688 | proc_net_remove(net, "dev"); | 2690 | proc_net_remove(net, "dev"); |
2689 | } | 2691 | } |
2690 | 2692 | ||
2691 | static struct pernet_operations dev_proc_ops = { | 2693 | static struct pernet_operations __net_initdata dev_proc_ops = { |
2692 | .init = dev_proc_net_init, | 2694 | .init = dev_proc_net_init, |
2693 | .exit = dev_proc_net_exit, | 2695 | .exit = dev_proc_net_exit, |
2694 | }; | 2696 | }; |
@@ -4330,7 +4332,6 @@ static struct hlist_head *netdev_create_hash(void) | |||
4330 | static int __net_init netdev_init(struct net *net) | 4332 | static int __net_init netdev_init(struct net *net) |
4331 | { | 4333 | { |
4332 | INIT_LIST_HEAD(&net->dev_base_head); | 4334 | INIT_LIST_HEAD(&net->dev_base_head); |
4333 | rwlock_init(&dev_base_lock); | ||
4334 | 4335 | ||
4335 | net->dev_name_head = netdev_create_hash(); | 4336 | net->dev_name_head = netdev_create_hash(); |
4336 | if (net->dev_name_head == NULL) | 4337 | if (net->dev_name_head == NULL) |
@@ -4354,7 +4355,7 @@ static void __net_exit netdev_exit(struct net *net) | |||
4354 | kfree(net->dev_index_head); | 4355 | kfree(net->dev_index_head); |
4355 | } | 4356 | } |
4356 | 4357 | ||
4357 | static struct pernet_operations netdev_net_ops = { | 4358 | static struct pernet_operations __net_initdata netdev_net_ops = { |
4358 | .init = netdev_init, | 4359 | .init = netdev_init, |
4359 | .exit = netdev_exit, | 4360 | .exit = netdev_exit, |
4360 | }; | 4361 | }; |
@@ -4385,7 +4386,7 @@ static void __net_exit default_device_exit(struct net *net) | |||
4385 | rtnl_unlock(); | 4386 | rtnl_unlock(); |
4386 | } | 4387 | } |
4387 | 4388 | ||
4388 | static struct pernet_operations default_device_ops = { | 4389 | static struct pernet_operations __net_initdata default_device_ops = { |
4389 | .exit = default_device_exit, | 4390 | .exit = default_device_exit, |
4390 | }; | 4391 | }; |
4391 | 4392 | ||
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c index ae354057d84c..69fff16ece10 100644 --- a/net/core/dev_mcast.c +++ b/net/core/dev_mcast.c | |||
@@ -168,13 +168,13 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from) | |||
168 | da = from->mc_list; | 168 | da = from->mc_list; |
169 | while (da != NULL) { | 169 | while (da != NULL) { |
170 | next = da->next; | 170 | next = da->next; |
171 | if (!da->da_synced) | 171 | if (da->da_synced) { |
172 | continue; | 172 | __dev_addr_delete(&to->mc_list, &to->mc_count, |
173 | __dev_addr_delete(&to->mc_list, &to->mc_count, | 173 | da->da_addr, da->da_addrlen, 0); |
174 | da->da_addr, da->da_addrlen, 0); | 174 | da->da_synced = 0; |
175 | da->da_synced = 0; | 175 | __dev_addr_delete(&from->mc_list, &from->mc_count, |
176 | __dev_addr_delete(&from->mc_list, &from->mc_count, | 176 | da->da_addr, da->da_addrlen, 0); |
177 | da->da_addr, da->da_addrlen, 0); | 177 | } |
178 | da = next; | 178 | da = next; |
179 | } | 179 | } |
180 | __dev_set_rx_mode(to); | 180 | __dev_set_rx_mode(to); |
@@ -285,7 +285,7 @@ static void __net_exit dev_mc_net_exit(struct net *net) | |||
285 | proc_net_remove(net, "dev_mcast"); | 285 | proc_net_remove(net, "dev_mcast"); |
286 | } | 286 | } |
287 | 287 | ||
288 | static struct pernet_operations dev_mc_net_ops = { | 288 | static struct pernet_operations __net_initdata dev_mc_net_ops = { |
289 | .init = dev_mc_net_init, | 289 | .init = dev_mc_net_init, |
290 | .exit = dev_mc_net_exit, | 290 | .exit = dev_mc_net_exit, |
291 | }; | 291 | }; |
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 13de6f53f098..848132b6cb73 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -18,6 +18,28 @@ | |||
18 | static LIST_HEAD(rules_ops); | 18 | static LIST_HEAD(rules_ops); |
19 | static DEFINE_SPINLOCK(rules_mod_lock); | 19 | static DEFINE_SPINLOCK(rules_mod_lock); |
20 | 20 | ||
21 | int fib_default_rule_add(struct fib_rules_ops *ops, | ||
22 | u32 pref, u32 table, u32 flags) | ||
23 | { | ||
24 | struct fib_rule *r; | ||
25 | |||
26 | r = kzalloc(ops->rule_size, GFP_KERNEL); | ||
27 | if (r == NULL) | ||
28 | return -ENOMEM; | ||
29 | |||
30 | atomic_set(&r->refcnt, 1); | ||
31 | r->action = FR_ACT_TO_TBL; | ||
32 | r->pref = pref; | ||
33 | r->table = table; | ||
34 | r->flags = flags; | ||
35 | |||
36 | /* The lock is not required here, the list in unreacheable | ||
37 | * at the moment this function is called */ | ||
38 | list_add_tail(&r->list, &ops->rules_list); | ||
39 | return 0; | ||
40 | } | ||
41 | EXPORT_SYMBOL(fib_default_rule_add); | ||
42 | |||
21 | static void notify_rule_change(int event, struct fib_rule *rule, | 43 | static void notify_rule_change(int event, struct fib_rule *rule, |
22 | struct fib_rules_ops *ops, struct nlmsghdr *nlh, | 44 | struct fib_rules_ops *ops, struct nlmsghdr *nlh, |
23 | u32 pid); | 45 | u32 pid); |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 3f6d37deac45..383252b50411 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -188,6 +188,7 @@ static int __init net_ns_init(void) | |||
188 | 188 | ||
189 | pure_initcall(net_ns_init); | 189 | pure_initcall(net_ns_init); |
190 | 190 | ||
191 | #ifdef CONFIG_NET_NS | ||
191 | static int register_pernet_operations(struct list_head *list, | 192 | static int register_pernet_operations(struct list_head *list, |
192 | struct pernet_operations *ops) | 193 | struct pernet_operations *ops) |
193 | { | 194 | { |
@@ -228,6 +229,23 @@ static void unregister_pernet_operations(struct pernet_operations *ops) | |||
228 | ops->exit(net); | 229 | ops->exit(net); |
229 | } | 230 | } |
230 | 231 | ||
232 | #else | ||
233 | |||
234 | static int register_pernet_operations(struct list_head *list, | ||
235 | struct pernet_operations *ops) | ||
236 | { | ||
237 | if (ops->init == NULL) | ||
238 | return 0; | ||
239 | return ops->init(&init_net); | ||
240 | } | ||
241 | |||
242 | static void unregister_pernet_operations(struct pernet_operations *ops) | ||
243 | { | ||
244 | if (ops->exit) | ||
245 | ops->exit(&init_net); | ||
246 | } | ||
247 | #endif | ||
248 | |||
231 | /** | 249 | /** |
232 | * register_pernet_subsys - register a network namespace subsystem | 250 | * register_pernet_subsys - register a network namespace subsystem |
233 | * @ops: pernet operations structure for the subsystem | 251 | * @ops: pernet operations structure for the subsystem |
diff --git a/net/core/sock.c b/net/core/sock.c index 8fc2f84209e4..c519b439b8b1 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -2097,7 +2097,3 @@ EXPORT_SYMBOL(sock_wmalloc); | |||
2097 | EXPORT_SYMBOL(sock_i_uid); | 2097 | EXPORT_SYMBOL(sock_i_uid); |
2098 | EXPORT_SYMBOL(sock_i_ino); | 2098 | EXPORT_SYMBOL(sock_i_ino); |
2099 | EXPORT_SYMBOL(sysctl_optmem_max); | 2099 | EXPORT_SYMBOL(sysctl_optmem_max); |
2100 | #ifdef CONFIG_SYSCTL | ||
2101 | EXPORT_SYMBOL(sysctl_rmem_max); | ||
2102 | EXPORT_SYMBOL(sysctl_wmem_max); | ||
2103 | #endif | ||
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 97eee5e8fbbe..66663e5d7acd 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -293,9 +293,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route * | |||
293 | dn_rt_hash_table[hash].chain); | 293 | dn_rt_hash_table[hash].chain); |
294 | rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth); | 294 | rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth); |
295 | 295 | ||
296 | rth->u.dst.__use++; | 296 | dst_use(&rth->u.dst, now); |
297 | dst_hold(&rth->u.dst); | ||
298 | rth->u.dst.lastuse = now; | ||
299 | spin_unlock_bh(&dn_rt_hash_table[hash].lock); | 297 | spin_unlock_bh(&dn_rt_hash_table[hash].lock); |
300 | 298 | ||
301 | dnrt_drop(rt); | 299 | dnrt_drop(rt); |
@@ -308,9 +306,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route * | |||
308 | rcu_assign_pointer(rt->u.dst.dn_next, dn_rt_hash_table[hash].chain); | 306 | rcu_assign_pointer(rt->u.dst.dn_next, dn_rt_hash_table[hash].chain); |
309 | rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); | 307 | rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); |
310 | 308 | ||
311 | dst_hold(&rt->u.dst); | 309 | dst_use(&rt->u.dst, now); |
312 | rt->u.dst.__use++; | ||
313 | rt->u.dst.lastuse = now; | ||
314 | spin_unlock_bh(&dn_rt_hash_table[hash].lock); | 310 | spin_unlock_bh(&dn_rt_hash_table[hash].lock); |
315 | *rp = rt; | 311 | *rp = rt; |
316 | return 0; | 312 | return 0; |
@@ -1182,9 +1178,7 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl | |||
1182 | (flp->mark == rt->fl.mark) && | 1178 | (flp->mark == rt->fl.mark) && |
1183 | (rt->fl.iif == 0) && | 1179 | (rt->fl.iif == 0) && |
1184 | (rt->fl.oif == flp->oif)) { | 1180 | (rt->fl.oif == flp->oif)) { |
1185 | rt->u.dst.lastuse = jiffies; | 1181 | dst_use(&rt->u.dst, jiffies); |
1186 | dst_hold(&rt->u.dst); | ||
1187 | rt->u.dst.__use++; | ||
1188 | rcu_read_unlock_bh(); | 1182 | rcu_read_unlock_bh(); |
1189 | *pprt = &rt->u.dst; | 1183 | *pprt = &rt->u.dst; |
1190 | return 0; | 1184 | return 0; |
@@ -1456,9 +1450,7 @@ int dn_route_input(struct sk_buff *skb) | |||
1456 | (rt->fl.oif == 0) && | 1450 | (rt->fl.oif == 0) && |
1457 | (rt->fl.mark == skb->mark) && | 1451 | (rt->fl.mark == skb->mark) && |
1458 | (rt->fl.iif == cb->iif)) { | 1452 | (rt->fl.iif == cb->iif)) { |
1459 | rt->u.dst.lastuse = jiffies; | 1453 | dst_use(&rt->u.dst, jiffies); |
1460 | dst_hold(&rt->u.dst); | ||
1461 | rt->u.dst.__use++; | ||
1462 | rcu_read_unlock(); | 1454 | rcu_read_unlock(); |
1463 | skb->dst = (struct dst_entry *)rt; | 1455 | skb->dst = (struct dst_entry *)rt; |
1464 | return 0; | 1456 | return 0; |
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c index ddd3f04f0919..ffebea04cc99 100644 --- a/net/decnet/dn_rules.c +++ b/net/decnet/dn_rules.c | |||
@@ -48,15 +48,6 @@ struct dn_fib_rule | |||
48 | u8 flags; | 48 | u8 flags; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static struct dn_fib_rule default_rule = { | ||
52 | .common = { | ||
53 | .refcnt = ATOMIC_INIT(2), | ||
54 | .pref = 0x7fff, | ||
55 | .table = RT_TABLE_MAIN, | ||
56 | .action = FR_ACT_TO_TBL, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | 51 | ||
61 | int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res) | 52 | int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res) |
62 | { | 53 | { |
@@ -262,8 +253,8 @@ static struct fib_rules_ops dn_fib_rules_ops = { | |||
262 | 253 | ||
263 | void __init dn_fib_rules_init(void) | 254 | void __init dn_fib_rules_init(void) |
264 | { | 255 | { |
265 | list_add_tail(&default_rule.common.list, | 256 | BUG_ON(fib_default_rule_add(&dn_fib_rules_ops, 0x7fff, |
266 | &dn_fib_rules_ops.rules_list); | 257 | RT_TABLE_MAIN, 0)); |
267 | fib_rules_register(&dn_fib_rules_ops); | 258 | fib_rules_register(&dn_fib_rules_ops); |
268 | } | 259 | } |
269 | 260 | ||
diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c index ac36767b56e8..e01b59aedc54 100644 --- a/net/ieee80211/softmac/ieee80211softmac_wx.c +++ b/net/ieee80211/softmac/ieee80211softmac_wx.c | |||
@@ -470,7 +470,7 @@ ieee80211softmac_wx_set_mlme(struct net_device *dev, | |||
470 | { | 470 | { |
471 | struct ieee80211softmac_device *mac = ieee80211_priv(dev); | 471 | struct ieee80211softmac_device *mac = ieee80211_priv(dev); |
472 | struct iw_mlme *mlme = (struct iw_mlme *)extra; | 472 | struct iw_mlme *mlme = (struct iw_mlme *)extra; |
473 | u16 reason = cpu_to_le16(mlme->reason_code); | 473 | u16 reason = mlme->reason_code; |
474 | struct ieee80211softmac_network *net; | 474 | struct ieee80211softmac_network *net; |
475 | int err = -EINVAL; | 475 | int err = -EINVAL; |
476 | 476 | ||
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index f16839c6a721..a0ada3a8d8dd 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -49,33 +49,6 @@ struct fib4_rule | |||
49 | #endif | 49 | #endif |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static struct fib4_rule default_rule = { | ||
53 | .common = { | ||
54 | .refcnt = ATOMIC_INIT(2), | ||
55 | .pref = 0x7FFF, | ||
56 | .table = RT_TABLE_DEFAULT, | ||
57 | .action = FR_ACT_TO_TBL, | ||
58 | }, | ||
59 | }; | ||
60 | |||
61 | static struct fib4_rule main_rule = { | ||
62 | .common = { | ||
63 | .refcnt = ATOMIC_INIT(2), | ||
64 | .pref = 0x7FFE, | ||
65 | .table = RT_TABLE_MAIN, | ||
66 | .action = FR_ACT_TO_TBL, | ||
67 | }, | ||
68 | }; | ||
69 | |||
70 | static struct fib4_rule local_rule = { | ||
71 | .common = { | ||
72 | .refcnt = ATOMIC_INIT(2), | ||
73 | .table = RT_TABLE_LOCAL, | ||
74 | .action = FR_ACT_TO_TBL, | ||
75 | .flags = FIB_RULE_PERMANENT, | ||
76 | }, | ||
77 | }; | ||
78 | |||
79 | #ifdef CONFIG_NET_CLS_ROUTE | 52 | #ifdef CONFIG_NET_CLS_ROUTE |
80 | u32 fib_rules_tclass(struct fib_result *res) | 53 | u32 fib_rules_tclass(struct fib_result *res) |
81 | { | 54 | { |
@@ -319,11 +292,27 @@ static struct fib_rules_ops fib4_rules_ops = { | |||
319 | .owner = THIS_MODULE, | 292 | .owner = THIS_MODULE, |
320 | }; | 293 | }; |
321 | 294 | ||
322 | void __init fib4_rules_init(void) | 295 | static int __init fib_default_rules_init(void) |
323 | { | 296 | { |
324 | list_add_tail(&local_rule.common.list, &fib4_rules_ops.rules_list); | 297 | int err; |
325 | list_add_tail(&main_rule.common.list, &fib4_rules_ops.rules_list); | 298 | |
326 | list_add_tail(&default_rule.common.list, &fib4_rules_ops.rules_list); | 299 | err = fib_default_rule_add(&fib4_rules_ops, 0, |
300 | RT_TABLE_LOCAL, FIB_RULE_PERMANENT); | ||
301 | if (err < 0) | ||
302 | return err; | ||
303 | err = fib_default_rule_add(&fib4_rules_ops, 0x7FFE, | ||
304 | RT_TABLE_MAIN, 0); | ||
305 | if (err < 0) | ||
306 | return err; | ||
307 | err = fib_default_rule_add(&fib4_rules_ops, 0x7FFF, | ||
308 | RT_TABLE_DEFAULT, 0); | ||
309 | if (err < 0) | ||
310 | return err; | ||
311 | return 0; | ||
312 | } | ||
327 | 313 | ||
314 | void __init fib4_rules_init(void) | ||
315 | { | ||
316 | BUG_ON(fib_default_rules_init()); | ||
328 | fib_rules_register(&fib4_rules_ops); | 317 | fib_rules_register(&fib4_rules_ops); |
329 | } | 318 | } |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index 771031dfbd0f..af995198f643 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -61,7 +61,7 @@ | |||
61 | * 4. Global variable peer_total is modified under the pool lock. | 61 | * 4. Global variable peer_total is modified under the pool lock. |
62 | * 5. struct inet_peer fields modification: | 62 | * 5. struct inet_peer fields modification: |
63 | * avl_left, avl_right, avl_parent, avl_height: pool lock | 63 | * avl_left, avl_right, avl_parent, avl_height: pool lock |
64 | * unused_next, unused_prevp: unused node list lock | 64 | * unused: unused node list lock |
65 | * refcnt: atomically against modifications on other CPU; | 65 | * refcnt: atomically against modifications on other CPU; |
66 | * usually under some other lock to prevent node disappearing | 66 | * usually under some other lock to prevent node disappearing |
67 | * dtime: unused node list lock | 67 | * dtime: unused node list lock |
@@ -94,8 +94,7 @@ int inet_peer_maxttl __read_mostly = 10 * 60 * HZ; /* usual time to live: 10 min | |||
94 | int inet_peer_gc_mintime __read_mostly = 10 * HZ; | 94 | int inet_peer_gc_mintime __read_mostly = 10 * HZ; |
95 | int inet_peer_gc_maxtime __read_mostly = 120 * HZ; | 95 | int inet_peer_gc_maxtime __read_mostly = 120 * HZ; |
96 | 96 | ||
97 | static struct inet_peer *inet_peer_unused_head; | 97 | static LIST_HEAD(unused_peers); |
98 | static struct inet_peer **inet_peer_unused_tailp = &inet_peer_unused_head; | ||
99 | static DEFINE_SPINLOCK(inet_peer_unused_lock); | 98 | static DEFINE_SPINLOCK(inet_peer_unused_lock); |
100 | 99 | ||
101 | static void peer_check_expire(unsigned long dummy); | 100 | static void peer_check_expire(unsigned long dummy); |
@@ -138,15 +137,7 @@ void __init inet_initpeers(void) | |||
138 | static void unlink_from_unused(struct inet_peer *p) | 137 | static void unlink_from_unused(struct inet_peer *p) |
139 | { | 138 | { |
140 | spin_lock_bh(&inet_peer_unused_lock); | 139 | spin_lock_bh(&inet_peer_unused_lock); |
141 | if (p->unused_prevp != NULL) { | 140 | list_del_init(&p->unused); |
142 | /* On unused list. */ | ||
143 | *p->unused_prevp = p->unused_next; | ||
144 | if (p->unused_next != NULL) | ||
145 | p->unused_next->unused_prevp = p->unused_prevp; | ||
146 | else | ||
147 | inet_peer_unused_tailp = p->unused_prevp; | ||
148 | p->unused_prevp = NULL; /* mark it as removed */ | ||
149 | } | ||
150 | spin_unlock_bh(&inet_peer_unused_lock); | 141 | spin_unlock_bh(&inet_peer_unused_lock); |
151 | } | 142 | } |
152 | 143 | ||
@@ -337,24 +328,24 @@ static void unlink_from_pool(struct inet_peer *p) | |||
337 | /* May be called with local BH enabled. */ | 328 | /* May be called with local BH enabled. */ |
338 | static int cleanup_once(unsigned long ttl) | 329 | static int cleanup_once(unsigned long ttl) |
339 | { | 330 | { |
340 | struct inet_peer *p; | 331 | struct inet_peer *p = NULL; |
341 | 332 | ||
342 | /* Remove the first entry from the list of unused nodes. */ | 333 | /* Remove the first entry from the list of unused nodes. */ |
343 | spin_lock_bh(&inet_peer_unused_lock); | 334 | spin_lock_bh(&inet_peer_unused_lock); |
344 | p = inet_peer_unused_head; | 335 | if (!list_empty(&unused_peers)) { |
345 | if (p != NULL) { | 336 | __u32 delta; |
346 | __u32 delta = (__u32)jiffies - p->dtime; | 337 | |
338 | p = list_first_entry(&unused_peers, struct inet_peer, unused); | ||
339 | delta = (__u32)jiffies - p->dtime; | ||
340 | |||
347 | if (delta < ttl) { | 341 | if (delta < ttl) { |
348 | /* Do not prune fresh entries. */ | 342 | /* Do not prune fresh entries. */ |
349 | spin_unlock_bh(&inet_peer_unused_lock); | 343 | spin_unlock_bh(&inet_peer_unused_lock); |
350 | return -1; | 344 | return -1; |
351 | } | 345 | } |
352 | inet_peer_unused_head = p->unused_next; | 346 | |
353 | if (p->unused_next != NULL) | 347 | list_del_init(&p->unused); |
354 | p->unused_next->unused_prevp = p->unused_prevp; | 348 | |
355 | else | ||
356 | inet_peer_unused_tailp = p->unused_prevp; | ||
357 | p->unused_prevp = NULL; /* mark as not on the list */ | ||
358 | /* Grab an extra reference to prevent node disappearing | 349 | /* Grab an extra reference to prevent node disappearing |
359 | * before unlink_from_pool() call. */ | 350 | * before unlink_from_pool() call. */ |
360 | atomic_inc(&p->refcnt); | 351 | atomic_inc(&p->refcnt); |
@@ -412,7 +403,7 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create) | |||
412 | 403 | ||
413 | /* Link the node. */ | 404 | /* Link the node. */ |
414 | link_to_pool(n); | 405 | link_to_pool(n); |
415 | n->unused_prevp = NULL; /* not on the list */ | 406 | INIT_LIST_HEAD(&n->unused); |
416 | peer_total++; | 407 | peer_total++; |
417 | write_unlock_bh(&peer_pool_lock); | 408 | write_unlock_bh(&peer_pool_lock); |
418 | 409 | ||
@@ -467,10 +458,7 @@ void inet_putpeer(struct inet_peer *p) | |||
467 | { | 458 | { |
468 | spin_lock_bh(&inet_peer_unused_lock); | 459 | spin_lock_bh(&inet_peer_unused_lock); |
469 | if (atomic_dec_and_test(&p->refcnt)) { | 460 | if (atomic_dec_and_test(&p->refcnt)) { |
470 | p->unused_prevp = inet_peer_unused_tailp; | 461 | list_add_tail(&p->unused, &unused_peers); |
471 | p->unused_next = NULL; | ||
472 | *inet_peer_unused_tailp = p; | ||
473 | inet_peer_unused_tailp = &p->unused_next; | ||
474 | p->dtime = (__u32)jiffies; | 462 | p->dtime = (__u32)jiffies; |
475 | } | 463 | } |
476 | spin_unlock_bh(&inet_peer_unused_lock); | 464 | spin_unlock_bh(&inet_peer_unused_lock); |
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c index b7eeae622d9b..0a9f3c37e18d 100644 --- a/net/ipv4/ipvs/ip_vs_conn.c +++ b/net/ipv4/ipvs/ip_vs_conn.c | |||
@@ -441,7 +441,6 @@ struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp) | |||
441 | } else | 441 | } else |
442 | return NULL; | 442 | return NULL; |
443 | } | 443 | } |
444 | EXPORT_SYMBOL(ip_vs_try_bind_dest); | ||
445 | 444 | ||
446 | 445 | ||
447 | /* | 446 | /* |
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 3c4d22a468ec..b64cf45a9ead 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -604,7 +604,6 @@ struct ip_vs_dest *ip_vs_find_dest(__be32 daddr, __be16 dport, | |||
604 | ip_vs_service_put(svc); | 604 | ip_vs_service_put(svc); |
605 | return dest; | 605 | return dest; |
606 | } | 606 | } |
607 | EXPORT_SYMBOL(ip_vs_find_dest); | ||
608 | 607 | ||
609 | /* | 608 | /* |
610 | * Lookup dest by {svc,addr,port} in the destination trash. | 609 | * Lookup dest by {svc,addr,port} in the destination trash. |
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 56e93f692e82..70e7997ea284 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -681,7 +681,7 @@ static int clean_nat(struct nf_conn *i, void *data) | |||
681 | 681 | ||
682 | if (!nat) | 682 | if (!nat) |
683 | return 0; | 683 | return 0; |
684 | memset(nat, 0, sizeof(nat)); | 684 | memset(nat, 0, sizeof(*nat)); |
685 | i->status &= ~(IPS_NAT_MASK | IPS_NAT_DONE_MASK | IPS_SEQ_ADJUST); | 685 | i->status &= ~(IPS_NAT_MASK | IPS_NAT_DONE_MASK | IPS_SEQ_ADJUST); |
686 | return 0; | 686 | return 0; |
687 | } | 687 | } |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 21b12de9e653..1bff9ed349ff 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -578,6 +578,9 @@ static void rt_check_expire(struct work_struct *work) | |||
578 | i = (i + 1) & rt_hash_mask; | 578 | i = (i + 1) & rt_hash_mask; |
579 | rthp = &rt_hash_table[i].chain; | 579 | rthp = &rt_hash_table[i].chain; |
580 | 580 | ||
581 | if (need_resched()) | ||
582 | cond_resched(); | ||
583 | |||
581 | if (*rthp == NULL) | 584 | if (*rthp == NULL) |
582 | continue; | 585 | continue; |
583 | spin_lock_bh(rt_hash_lock_addr(i)); | 586 | spin_lock_bh(rt_hash_lock_addr(i)); |
@@ -851,9 +854,7 @@ restart: | |||
851 | */ | 854 | */ |
852 | rcu_assign_pointer(rt_hash_table[hash].chain, rth); | 855 | rcu_assign_pointer(rt_hash_table[hash].chain, rth); |
853 | 856 | ||
854 | rth->u.dst.__use++; | 857 | dst_use(&rth->u.dst, now); |
855 | dst_hold(&rth->u.dst); | ||
856 | rth->u.dst.lastuse = now; | ||
857 | spin_unlock_bh(rt_hash_lock_addr(hash)); | 858 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
858 | 859 | ||
859 | rt_drop(rt); | 860 | rt_drop(rt); |
@@ -1813,11 +1814,6 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1813 | goto martian_destination; | 1814 | goto martian_destination; |
1814 | 1815 | ||
1815 | err = ip_mkroute_input(skb, &res, &fl, in_dev, daddr, saddr, tos); | 1816 | err = ip_mkroute_input(skb, &res, &fl, in_dev, daddr, saddr, tos); |
1816 | if (err == -ENOBUFS) | ||
1817 | goto e_nobufs; | ||
1818 | if (err == -EINVAL) | ||
1819 | goto e_inval; | ||
1820 | |||
1821 | done: | 1817 | done: |
1822 | in_dev_put(in_dev); | 1818 | in_dev_put(in_dev); |
1823 | if (free_res) | 1819 | if (free_res) |
@@ -1935,9 +1931,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1935 | rth->fl.oif == 0 && | 1931 | rth->fl.oif == 0 && |
1936 | rth->fl.mark == skb->mark && | 1932 | rth->fl.mark == skb->mark && |
1937 | rth->fl.fl4_tos == tos) { | 1933 | rth->fl.fl4_tos == tos) { |
1938 | rth->u.dst.lastuse = jiffies; | 1934 | dst_use(&rth->u.dst, jiffies); |
1939 | dst_hold(&rth->u.dst); | ||
1940 | rth->u.dst.__use++; | ||
1941 | RT_CACHE_STAT_INC(in_hit); | 1935 | RT_CACHE_STAT_INC(in_hit); |
1942 | rcu_read_unlock(); | 1936 | rcu_read_unlock(); |
1943 | skb->dst = (struct dst_entry*)rth; | 1937 | skb->dst = (struct dst_entry*)rth; |
@@ -2331,9 +2325,7 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp) | |||
2331 | rth->fl.mark == flp->mark && | 2325 | rth->fl.mark == flp->mark && |
2332 | !((rth->fl.fl4_tos ^ flp->fl4_tos) & | 2326 | !((rth->fl.fl4_tos ^ flp->fl4_tos) & |
2333 | (IPTOS_RT_MASK | RTO_ONLINK))) { | 2327 | (IPTOS_RT_MASK | RTO_ONLINK))) { |
2334 | rth->u.dst.lastuse = jiffies; | 2328 | dst_use(&rth->u.dst, jiffies); |
2335 | dst_hold(&rth->u.dst); | ||
2336 | rth->u.dst.__use++; | ||
2337 | RT_CACHE_STAT_INC(out_hit); | 2329 | RT_CACHE_STAT_INC(out_hit); |
2338 | rcu_read_unlock_bh(); | 2330 | rcu_read_unlock_bh(); |
2339 | *rp = rth; | 2331 | *rp = rth; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index ca9590f4f520..0f0c1c9829a1 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1269,6 +1269,9 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1269 | if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window)) | 1269 | if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window)) |
1270 | return 0; | 1270 | return 0; |
1271 | 1271 | ||
1272 | if (!tp->packets_out) | ||
1273 | goto out; | ||
1274 | |||
1272 | /* SACK fastpath: | 1275 | /* SACK fastpath: |
1273 | * if the only SACK change is the increase of the end_seq of | 1276 | * if the only SACK change is the increase of the end_seq of |
1274 | * the first block then only apply that SACK block | 1277 | * the first block then only apply that SACK block |
@@ -1400,11 +1403,9 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1400 | /* DSACK info lost if out-of-mem, try SACK still */ | 1403 | /* DSACK info lost if out-of-mem, try SACK still */ |
1401 | if (in_sack <= 0) | 1404 | if (in_sack <= 0) |
1402 | in_sack = tcp_match_skb_to_sack(sk, skb, start_seq, end_seq); | 1405 | in_sack = tcp_match_skb_to_sack(sk, skb, start_seq, end_seq); |
1403 | if (in_sack < 0) | 1406 | if (unlikely(in_sack < 0)) |
1404 | break; | 1407 | break; |
1405 | 1408 | ||
1406 | fack_count += tcp_skb_pcount(skb); | ||
1407 | |||
1408 | sacked = TCP_SKB_CB(skb)->sacked; | 1409 | sacked = TCP_SKB_CB(skb)->sacked; |
1409 | 1410 | ||
1410 | /* Account D-SACK for retransmitted packet. */ | 1411 | /* Account D-SACK for retransmitted packet. */ |
@@ -1419,19 +1420,17 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1419 | if ((dup_sack && in_sack) && | 1420 | if ((dup_sack && in_sack) && |
1420 | (sacked&TCPCB_SACKED_ACKED)) | 1421 | (sacked&TCPCB_SACKED_ACKED)) |
1421 | reord = min(fack_count, reord); | 1422 | reord = min(fack_count, reord); |
1422 | } else { | ||
1423 | /* If it was in a hole, we detected reordering. */ | ||
1424 | if (fack_count < prior_fackets && | ||
1425 | !(sacked&TCPCB_SACKED_ACKED)) | ||
1426 | reord = min(fack_count, reord); | ||
1427 | } | 1423 | } |
1428 | 1424 | ||
1429 | /* Nothing to do; acked frame is about to be dropped. */ | 1425 | /* Nothing to do; acked frame is about to be dropped. */ |
1426 | fack_count += tcp_skb_pcount(skb); | ||
1430 | continue; | 1427 | continue; |
1431 | } | 1428 | } |
1432 | 1429 | ||
1433 | if (!in_sack) | 1430 | if (!in_sack) { |
1431 | fack_count += tcp_skb_pcount(skb); | ||
1434 | continue; | 1432 | continue; |
1433 | } | ||
1435 | 1434 | ||
1436 | if (!(sacked&TCPCB_SACKED_ACKED)) { | 1435 | if (!(sacked&TCPCB_SACKED_ACKED)) { |
1437 | if (sacked & TCPCB_SACKED_RETRANS) { | 1436 | if (sacked & TCPCB_SACKED_RETRANS) { |
@@ -1448,12 +1447,17 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1448 | tp->retransmit_skb_hint = NULL; | 1447 | tp->retransmit_skb_hint = NULL; |
1449 | } | 1448 | } |
1450 | } else { | 1449 | } else { |
1451 | /* New sack for not retransmitted frame, | 1450 | if (!(sacked & TCPCB_RETRANS)) { |
1452 | * which was in hole. It is reordering. | 1451 | /* New sack for not retransmitted frame, |
1453 | */ | 1452 | * which was in hole. It is reordering. |
1454 | if (!(sacked & TCPCB_RETRANS) && | 1453 | */ |
1455 | fack_count < prior_fackets) | 1454 | if (fack_count < prior_fackets) |
1456 | reord = min(fack_count, reord); | 1455 | reord = min(fack_count, reord); |
1456 | |||
1457 | /* SACK enhanced F-RTO (RFC4138; Appendix B) */ | ||
1458 | if (!after(TCP_SKB_CB(skb)->end_seq, tp->frto_highmark)) | ||
1459 | flag |= FLAG_ONLY_ORIG_SACKED; | ||
1460 | } | ||
1457 | 1461 | ||
1458 | if (sacked & TCPCB_LOST) { | 1462 | if (sacked & TCPCB_LOST) { |
1459 | TCP_SKB_CB(skb)->sacked &= ~TCPCB_LOST; | 1463 | TCP_SKB_CB(skb)->sacked &= ~TCPCB_LOST; |
@@ -1462,24 +1466,13 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1462 | /* clear lost hint */ | 1466 | /* clear lost hint */ |
1463 | tp->retransmit_skb_hint = NULL; | 1467 | tp->retransmit_skb_hint = NULL; |
1464 | } | 1468 | } |
1465 | /* SACK enhanced F-RTO detection. | ||
1466 | * Set flag if and only if non-rexmitted | ||
1467 | * segments below frto_highmark are | ||
1468 | * SACKed (RFC4138; Appendix B). | ||
1469 | * Clearing correct due to in-order walk | ||
1470 | */ | ||
1471 | if (after(end_seq, tp->frto_highmark)) { | ||
1472 | flag &= ~FLAG_ONLY_ORIG_SACKED; | ||
1473 | } else { | ||
1474 | if (!(sacked & TCPCB_RETRANS)) | ||
1475 | flag |= FLAG_ONLY_ORIG_SACKED; | ||
1476 | } | ||
1477 | } | 1469 | } |
1478 | 1470 | ||
1479 | TCP_SKB_CB(skb)->sacked |= TCPCB_SACKED_ACKED; | 1471 | TCP_SKB_CB(skb)->sacked |= TCPCB_SACKED_ACKED; |
1480 | flag |= FLAG_DATA_SACKED; | 1472 | flag |= FLAG_DATA_SACKED; |
1481 | tp->sacked_out += tcp_skb_pcount(skb); | 1473 | tp->sacked_out += tcp_skb_pcount(skb); |
1482 | 1474 | ||
1475 | fack_count += tcp_skb_pcount(skb); | ||
1483 | if (fack_count > tp->fackets_out) | 1476 | if (fack_count > tp->fackets_out) |
1484 | tp->fackets_out = fack_count; | 1477 | tp->fackets_out = fack_count; |
1485 | 1478 | ||
@@ -1490,6 +1483,8 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1490 | } else { | 1483 | } else { |
1491 | if (dup_sack && (sacked&TCPCB_RETRANS)) | 1484 | if (dup_sack && (sacked&TCPCB_RETRANS)) |
1492 | reord = min(fack_count, reord); | 1485 | reord = min(fack_count, reord); |
1486 | |||
1487 | fack_count += tcp_skb_pcount(skb); | ||
1493 | } | 1488 | } |
1494 | 1489 | ||
1495 | /* D-SACK. We can detect redundant retransmission | 1490 | /* D-SACK. We can detect redundant retransmission |
@@ -1504,6 +1499,12 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1504 | tp->retransmit_skb_hint = NULL; | 1499 | tp->retransmit_skb_hint = NULL; |
1505 | } | 1500 | } |
1506 | } | 1501 | } |
1502 | |||
1503 | /* SACK enhanced FRTO (RFC4138, Appendix B): Clearing correct | ||
1504 | * due to in-order walk | ||
1505 | */ | ||
1506 | if (after(end_seq, tp->frto_highmark)) | ||
1507 | flag &= ~FLAG_ONLY_ORIG_SACKED; | ||
1507 | } | 1508 | } |
1508 | 1509 | ||
1509 | if (tp->retrans_out && | 1510 | if (tp->retrans_out && |
@@ -1515,7 +1516,9 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1515 | 1516 | ||
1516 | if ((reord < tp->fackets_out) && icsk->icsk_ca_state != TCP_CA_Loss && | 1517 | if ((reord < tp->fackets_out) && icsk->icsk_ca_state != TCP_CA_Loss && |
1517 | (!tp->frto_highmark || after(tp->snd_una, tp->frto_highmark))) | 1518 | (!tp->frto_highmark || after(tp->snd_una, tp->frto_highmark))) |
1518 | tcp_update_reordering(sk, ((tp->fackets_out + 1) - reord), 0); | 1519 | tcp_update_reordering(sk, tp->fackets_out - reord, 0); |
1520 | |||
1521 | out: | ||
1519 | 1522 | ||
1520 | #if FASTRETRANS_DEBUG > 0 | 1523 | #if FASTRETRANS_DEBUG > 0 |
1521 | BUG_TRAP((int)tp->sacked_out >= 0); | 1524 | BUG_TRAP((int)tp->sacked_out >= 0); |
@@ -1671,6 +1674,9 @@ void tcp_enter_frto(struct sock *sk) | |||
1671 | } | 1674 | } |
1672 | tcp_verify_left_out(tp); | 1675 | tcp_verify_left_out(tp); |
1673 | 1676 | ||
1677 | /* Too bad if TCP was application limited */ | ||
1678 | tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp) + 1); | ||
1679 | |||
1674 | /* Earlier loss recovery underway (see RFC4138; Appendix B). | 1680 | /* Earlier loss recovery underway (see RFC4138; Appendix B). |
1675 | * The last condition is necessary at least in tp->frto_counter case. | 1681 | * The last condition is necessary at least in tp->frto_counter case. |
1676 | */ | 1682 | */ |
@@ -1703,6 +1709,8 @@ static void tcp_enter_frto_loss(struct sock *sk, int allowed_segments, int flag) | |||
1703 | tcp_for_write_queue(skb, sk) { | 1709 | tcp_for_write_queue(skb, sk) { |
1704 | if (skb == tcp_send_head(sk)) | 1710 | if (skb == tcp_send_head(sk)) |
1705 | break; | 1711 | break; |
1712 | |||
1713 | TCP_SKB_CB(skb)->sacked &= ~TCPCB_LOST; | ||
1706 | /* | 1714 | /* |
1707 | * Count the retransmission made on RTO correctly (only when | 1715 | * Count the retransmission made on RTO correctly (only when |
1708 | * waiting for the first ACK and did not get it)... | 1716 | * waiting for the first ACK and did not get it)... |
@@ -1716,7 +1724,7 @@ static void tcp_enter_frto_loss(struct sock *sk, int allowed_segments, int flag) | |||
1716 | } else { | 1724 | } else { |
1717 | if (TCP_SKB_CB(skb)->sacked & TCPCB_RETRANS) | 1725 | if (TCP_SKB_CB(skb)->sacked & TCPCB_RETRANS) |
1718 | tp->undo_marker = 0; | 1726 | tp->undo_marker = 0; |
1719 | TCP_SKB_CB(skb)->sacked &= ~(TCPCB_LOST|TCPCB_SACKED_RETRANS); | 1727 | TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS; |
1720 | } | 1728 | } |
1721 | 1729 | ||
1722 | /* Don't lost mark skbs that were fwd transmitted after RTO */ | 1730 | /* Don't lost mark skbs that were fwd transmitted after RTO */ |
@@ -2630,7 +2638,8 @@ static u32 tcp_tso_acked(struct sock *sk, struct sk_buff *skb) | |||
2630 | * is before the ack sequence we can discard it as it's confirmed to have | 2638 | * is before the ack sequence we can discard it as it's confirmed to have |
2631 | * arrived at the other end. | 2639 | * arrived at the other end. |
2632 | */ | 2640 | */ |
2633 | static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p) | 2641 | static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p, |
2642 | int prior_fackets) | ||
2634 | { | 2643 | { |
2635 | struct tcp_sock *tp = tcp_sk(sk); | 2644 | struct tcp_sock *tp = tcp_sk(sk); |
2636 | const struct inet_connection_sock *icsk = inet_csk(sk); | 2645 | const struct inet_connection_sock *icsk = inet_csk(sk); |
@@ -2639,6 +2648,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p) | |||
2639 | int fully_acked = 1; | 2648 | int fully_acked = 1; |
2640 | int flag = 0; | 2649 | int flag = 0; |
2641 | int prior_packets = tp->packets_out; | 2650 | int prior_packets = tp->packets_out; |
2651 | u32 cnt = 0; | ||
2652 | u32 reord = tp->packets_out; | ||
2642 | s32 seq_rtt = -1; | 2653 | s32 seq_rtt = -1; |
2643 | ktime_t last_ackt = net_invalid_timestamp(); | 2654 | ktime_t last_ackt = net_invalid_timestamp(); |
2644 | 2655 | ||
@@ -2679,10 +2690,14 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p) | |||
2679 | if ((flag & FLAG_DATA_ACKED) || | 2690 | if ((flag & FLAG_DATA_ACKED) || |
2680 | (packets_acked > 1)) | 2691 | (packets_acked > 1)) |
2681 | flag |= FLAG_NONHEAD_RETRANS_ACKED; | 2692 | flag |= FLAG_NONHEAD_RETRANS_ACKED; |
2682 | } else if (seq_rtt < 0) { | 2693 | } else { |
2683 | seq_rtt = now - scb->when; | 2694 | if (seq_rtt < 0) { |
2684 | if (fully_acked) | 2695 | seq_rtt = now - scb->when; |
2685 | last_ackt = skb->tstamp; | 2696 | if (fully_acked) |
2697 | last_ackt = skb->tstamp; | ||
2698 | } | ||
2699 | if (!(sacked & TCPCB_SACKED_ACKED)) | ||
2700 | reord = min(cnt, reord); | ||
2686 | } | 2701 | } |
2687 | 2702 | ||
2688 | if (sacked & TCPCB_SACKED_ACKED) | 2703 | if (sacked & TCPCB_SACKED_ACKED) |
@@ -2693,12 +2708,16 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p) | |||
2693 | if ((sacked & TCPCB_URG) && tp->urg_mode && | 2708 | if ((sacked & TCPCB_URG) && tp->urg_mode && |
2694 | !before(end_seq, tp->snd_up)) | 2709 | !before(end_seq, tp->snd_up)) |
2695 | tp->urg_mode = 0; | 2710 | tp->urg_mode = 0; |
2696 | } else if (seq_rtt < 0) { | 2711 | } else { |
2697 | seq_rtt = now - scb->when; | 2712 | if (seq_rtt < 0) { |
2698 | if (fully_acked) | 2713 | seq_rtt = now - scb->when; |
2699 | last_ackt = skb->tstamp; | 2714 | if (fully_acked) |
2715 | last_ackt = skb->tstamp; | ||
2716 | } | ||
2717 | reord = min(cnt, reord); | ||
2700 | } | 2718 | } |
2701 | tp->packets_out -= packets_acked; | 2719 | tp->packets_out -= packets_acked; |
2720 | cnt += packets_acked; | ||
2702 | 2721 | ||
2703 | /* Initial outgoing SYN's get put onto the write_queue | 2722 | /* Initial outgoing SYN's get put onto the write_queue |
2704 | * just like anything else we transmit. It is not | 2723 | * just like anything else we transmit. It is not |
@@ -2730,13 +2749,18 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p) | |||
2730 | tcp_ack_update_rtt(sk, flag, seq_rtt); | 2749 | tcp_ack_update_rtt(sk, flag, seq_rtt); |
2731 | tcp_rearm_rto(sk); | 2750 | tcp_rearm_rto(sk); |
2732 | 2751 | ||
2752 | if (tcp_is_reno(tp)) { | ||
2753 | tcp_remove_reno_sacks(sk, pkts_acked); | ||
2754 | } else { | ||
2755 | /* Non-retransmitted hole got filled? That's reordering */ | ||
2756 | if (reord < prior_fackets) | ||
2757 | tcp_update_reordering(sk, tp->fackets_out - reord, 0); | ||
2758 | } | ||
2759 | |||
2733 | tp->fackets_out -= min(pkts_acked, tp->fackets_out); | 2760 | tp->fackets_out -= min(pkts_acked, tp->fackets_out); |
2734 | /* hint's skb might be NULL but we don't need to care */ | 2761 | /* hint's skb might be NULL but we don't need to care */ |
2735 | tp->fastpath_cnt_hint -= min_t(u32, pkts_acked, | 2762 | tp->fastpath_cnt_hint -= min_t(u32, pkts_acked, |
2736 | tp->fastpath_cnt_hint); | 2763 | tp->fastpath_cnt_hint); |
2737 | if (tcp_is_reno(tp)) | ||
2738 | tcp_remove_reno_sacks(sk, pkts_acked); | ||
2739 | |||
2740 | if (ca_ops->pkts_acked) { | 2764 | if (ca_ops->pkts_acked) { |
2741 | s32 rtt_us = -1; | 2765 | s32 rtt_us = -1; |
2742 | 2766 | ||
@@ -3019,6 +3043,7 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag) | |||
3019 | u32 ack_seq = TCP_SKB_CB(skb)->seq; | 3043 | u32 ack_seq = TCP_SKB_CB(skb)->seq; |
3020 | u32 ack = TCP_SKB_CB(skb)->ack_seq; | 3044 | u32 ack = TCP_SKB_CB(skb)->ack_seq; |
3021 | u32 prior_in_flight; | 3045 | u32 prior_in_flight; |
3046 | u32 prior_fackets; | ||
3022 | s32 seq_rtt; | 3047 | s32 seq_rtt; |
3023 | int prior_packets; | 3048 | int prior_packets; |
3024 | int frto_cwnd = 0; | 3049 | int frto_cwnd = 0; |
@@ -3043,6 +3068,8 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag) | |||
3043 | tp->bytes_acked += min(ack - prior_snd_una, tp->mss_cache); | 3068 | tp->bytes_acked += min(ack - prior_snd_una, tp->mss_cache); |
3044 | } | 3069 | } |
3045 | 3070 | ||
3071 | prior_fackets = tp->fackets_out; | ||
3072 | |||
3046 | if (!(flag&FLAG_SLOWPATH) && after(ack, prior_snd_una)) { | 3073 | if (!(flag&FLAG_SLOWPATH) && after(ack, prior_snd_una)) { |
3047 | /* Window is constant, pure forward advance. | 3074 | /* Window is constant, pure forward advance. |
3048 | * No more checks are required. | 3075 | * No more checks are required. |
@@ -3084,13 +3111,13 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag) | |||
3084 | prior_in_flight = tcp_packets_in_flight(tp); | 3111 | prior_in_flight = tcp_packets_in_flight(tp); |
3085 | 3112 | ||
3086 | /* See if we can take anything off of the retransmit queue. */ | 3113 | /* See if we can take anything off of the retransmit queue. */ |
3087 | flag |= tcp_clean_rtx_queue(sk, &seq_rtt); | 3114 | flag |= tcp_clean_rtx_queue(sk, &seq_rtt, prior_fackets); |
3088 | 3115 | ||
3116 | if (tp->frto_counter) | ||
3117 | frto_cwnd = tcp_process_frto(sk, flag); | ||
3089 | /* Guarantee sacktag reordering detection against wrap-arounds */ | 3118 | /* Guarantee sacktag reordering detection against wrap-arounds */ |
3090 | if (before(tp->frto_highmark, tp->snd_una)) | 3119 | if (before(tp->frto_highmark, tp->snd_una)) |
3091 | tp->frto_highmark = 0; | 3120 | tp->frto_highmark = 0; |
3092 | if (tp->frto_counter) | ||
3093 | frto_cwnd = tcp_process_frto(sk, flag); | ||
3094 | 3121 | ||
3095 | if (tcp_ack_is_dubious(sk, flag)) { | 3122 | if (tcp_ack_is_dubious(sk, flag)) { |
3096 | /* Advance CWND, if state allows this. */ | 3123 | /* Advance CWND, if state allows this. */ |
diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c index a794a8ca8b4f..978b3fd61e65 100644 --- a/net/ipv4/tunnel4.c +++ b/net/ipv4/tunnel4.c | |||
@@ -17,6 +17,11 @@ static struct xfrm_tunnel *tunnel4_handlers; | |||
17 | static struct xfrm_tunnel *tunnel64_handlers; | 17 | static struct xfrm_tunnel *tunnel64_handlers; |
18 | static DEFINE_MUTEX(tunnel4_mutex); | 18 | static DEFINE_MUTEX(tunnel4_mutex); |
19 | 19 | ||
20 | static inline struct xfrm_tunnel **fam_handlers(unsigned short family) | ||
21 | { | ||
22 | return (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers; | ||
23 | } | ||
24 | |||
20 | int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family) | 25 | int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family) |
21 | { | 26 | { |
22 | struct xfrm_tunnel **pprev; | 27 | struct xfrm_tunnel **pprev; |
@@ -25,8 +30,7 @@ int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family) | |||
25 | 30 | ||
26 | mutex_lock(&tunnel4_mutex); | 31 | mutex_lock(&tunnel4_mutex); |
27 | 32 | ||
28 | for (pprev = (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers; | 33 | for (pprev = fam_handlers(family); *pprev; pprev = &(*pprev)->next) { |
29 | *pprev; pprev = &(*pprev)->next) { | ||
30 | if ((*pprev)->priority > priority) | 34 | if ((*pprev)->priority > priority) |
31 | break; | 35 | break; |
32 | if ((*pprev)->priority == priority) | 36 | if ((*pprev)->priority == priority) |
@@ -53,8 +57,7 @@ int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family) | |||
53 | 57 | ||
54 | mutex_lock(&tunnel4_mutex); | 58 | mutex_lock(&tunnel4_mutex); |
55 | 59 | ||
56 | for (pprev = (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers; | 60 | for (pprev = fam_handlers(family); *pprev; pprev = &(*pprev)->next) { |
57 | *pprev; pprev = &(*pprev)->next) { | ||
58 | if (*pprev == handler) { | 61 | if (*pprev == handler) { |
59 | *pprev = handler->next; | 62 | *pprev = handler->next; |
60 | ret = 0; | 63 | ret = 0; |
@@ -118,6 +121,17 @@ static void tunnel4_err(struct sk_buff *skb, u32 info) | |||
118 | break; | 121 | break; |
119 | } | 122 | } |
120 | 123 | ||
124 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
125 | static void tunnel64_err(struct sk_buff *skb, u32 info) | ||
126 | { | ||
127 | struct xfrm_tunnel *handler; | ||
128 | |||
129 | for (handler = tunnel64_handlers; handler; handler = handler->next) | ||
130 | if (!handler->err_handler(skb, info)) | ||
131 | break; | ||
132 | } | ||
133 | #endif | ||
134 | |||
121 | static struct net_protocol tunnel4_protocol = { | 135 | static struct net_protocol tunnel4_protocol = { |
122 | .handler = tunnel4_rcv, | 136 | .handler = tunnel4_rcv, |
123 | .err_handler = tunnel4_err, | 137 | .err_handler = tunnel4_err, |
@@ -127,7 +141,7 @@ static struct net_protocol tunnel4_protocol = { | |||
127 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 141 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
128 | static struct net_protocol tunnel64_protocol = { | 142 | static struct net_protocol tunnel64_protocol = { |
129 | .handler = tunnel64_rcv, | 143 | .handler = tunnel64_rcv, |
130 | .err_handler = tunnel4_err, | 144 | .err_handler = tunnel64_err, |
131 | .no_policy = 1, | 145 | .no_policy = 1, |
132 | }; | 146 | }; |
133 | #endif | 147 | #endif |
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 706622af206f..428c6b0e26d8 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -31,25 +31,6 @@ struct fib6_rule | |||
31 | 31 | ||
32 | static struct fib_rules_ops fib6_rules_ops; | 32 | static struct fib_rules_ops fib6_rules_ops; |
33 | 33 | ||
34 | static struct fib6_rule main_rule = { | ||
35 | .common = { | ||
36 | .refcnt = ATOMIC_INIT(2), | ||
37 | .pref = 0x7FFE, | ||
38 | .action = FR_ACT_TO_TBL, | ||
39 | .table = RT6_TABLE_MAIN, | ||
40 | }, | ||
41 | }; | ||
42 | |||
43 | static struct fib6_rule local_rule = { | ||
44 | .common = { | ||
45 | .refcnt = ATOMIC_INIT(2), | ||
46 | .pref = 0, | ||
47 | .action = FR_ACT_TO_TBL, | ||
48 | .table = RT6_TABLE_LOCAL, | ||
49 | .flags = FIB_RULE_PERMANENT, | ||
50 | }, | ||
51 | }; | ||
52 | |||
53 | struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags, | 34 | struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags, |
54 | pol_lookup_t lookup) | 35 | pol_lookup_t lookup) |
55 | { | 36 | { |
@@ -270,11 +251,23 @@ static struct fib_rules_ops fib6_rules_ops = { | |||
270 | .owner = THIS_MODULE, | 251 | .owner = THIS_MODULE, |
271 | }; | 252 | }; |
272 | 253 | ||
273 | void __init fib6_rules_init(void) | 254 | static int __init fib6_default_rules_init(void) |
274 | { | 255 | { |
275 | list_add_tail(&local_rule.common.list, &fib6_rules_ops.rules_list); | 256 | int err; |
276 | list_add_tail(&main_rule.common.list, &fib6_rules_ops.rules_list); | 257 | |
258 | err = fib_default_rule_add(&fib6_rules_ops, 0, | ||
259 | RT6_TABLE_LOCAL, FIB_RULE_PERMANENT); | ||
260 | if (err < 0) | ||
261 | return err; | ||
262 | err = fib_default_rule_add(&fib6_rules_ops, 0x7FFE, RT6_TABLE_MAIN, 0); | ||
263 | if (err < 0) | ||
264 | return err; | ||
265 | return 0; | ||
266 | } | ||
277 | 267 | ||
268 | void __init fib6_rules_init(void) | ||
269 | { | ||
270 | BUG_ON(fib6_default_rules_init()); | ||
278 | fib_rules_register(&fib6_rules_ops); | 271 | fib_rules_register(&fib6_rules_ops); |
279 | } | 272 | } |
280 | 273 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 36f7dbfb6dbb..67997a74ddce 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1037,6 +1037,7 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt) | |||
1037 | 1037 | ||
1038 | ndmsg = nlmsg_data(nlh); | 1038 | ndmsg = nlmsg_data(nlh); |
1039 | ndmsg->nduseropt_family = AF_INET6; | 1039 | ndmsg->nduseropt_family = AF_INET6; |
1040 | ndmsg->nduseropt_ifindex = ra->dev->ifindex; | ||
1040 | ndmsg->nduseropt_icmp_type = icmp6h->icmp6_type; | 1041 | ndmsg->nduseropt_icmp_type = icmp6h->icmp6_type; |
1041 | ndmsg->nduseropt_icmp_code = icmp6h->icmp6_code; | 1042 | ndmsg->nduseropt_icmp_code = icmp6h->icmp6_code; |
1042 | ndmsg->nduseropt_opts_len = opt->nd_opt_len << 3; | 1043 | ndmsg->nduseropt_opts_len = opt->nd_opt_len << 3; |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 973a97abc446..6ecb5e6fae2e 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -544,12 +544,8 @@ restart: | |||
544 | rt = rt6_device_match(rt, fl->oif, flags); | 544 | rt = rt6_device_match(rt, fl->oif, flags); |
545 | BACKTRACK(&fl->fl6_src); | 545 | BACKTRACK(&fl->fl6_src); |
546 | out: | 546 | out: |
547 | dst_hold(&rt->u.dst); | 547 | dst_use(&rt->u.dst, jiffies); |
548 | read_unlock_bh(&table->tb6_lock); | 548 | read_unlock_bh(&table->tb6_lock); |
549 | |||
550 | rt->u.dst.lastuse = jiffies; | ||
551 | rt->u.dst.__use++; | ||
552 | |||
553 | return rt; | 549 | return rt; |
554 | 550 | ||
555 | } | 551 | } |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index a195a66e0cc7..c76a9523091b 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -92,11 +92,6 @@ extern int ipxrtr_route_skb(struct sk_buff *skb); | |||
92 | extern struct ipx_route *ipxrtr_lookup(__be32 net); | 92 | extern struct ipx_route *ipxrtr_lookup(__be32 net); |
93 | extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg); | 93 | extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg); |
94 | 94 | ||
95 | #undef IPX_REFCNT_DEBUG | ||
96 | #ifdef IPX_REFCNT_DEBUG | ||
97 | atomic_t ipx_sock_nr; | ||
98 | #endif | ||
99 | |||
100 | struct ipx_interface *ipx_interfaces_head(void) | 95 | struct ipx_interface *ipx_interfaces_head(void) |
101 | { | 96 | { |
102 | struct ipx_interface *rc = NULL; | 97 | struct ipx_interface *rc = NULL; |
@@ -151,14 +146,7 @@ static void ipx_destroy_socket(struct sock *sk) | |||
151 | { | 146 | { |
152 | ipx_remove_socket(sk); | 147 | ipx_remove_socket(sk); |
153 | skb_queue_purge(&sk->sk_receive_queue); | 148 | skb_queue_purge(&sk->sk_receive_queue); |
154 | #ifdef IPX_REFCNT_DEBUG | 149 | sk_refcnt_debug_dec(sk); |
155 | atomic_dec(&ipx_sock_nr); | ||
156 | printk(KERN_DEBUG "IPX socket %p released, %d are still alive\n", sk, | ||
157 | atomic_read(&ipx_sock_nr)); | ||
158 | if (atomic_read(&sk->sk_refcnt) != 1) | ||
159 | printk(KERN_DEBUG "Destruction sock ipx %p delayed, cnt=%d\n", | ||
160 | sk, atomic_read(&sk->sk_refcnt)); | ||
161 | #endif | ||
162 | sock_put(sk); | 150 | sock_put(sk); |
163 | } | 151 | } |
164 | 152 | ||
@@ -1384,11 +1372,8 @@ static int ipx_create(struct net *net, struct socket *sock, int protocol) | |||
1384 | sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto); | 1372 | sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto); |
1385 | if (!sk) | 1373 | if (!sk) |
1386 | goto out; | 1374 | goto out; |
1387 | #ifdef IPX_REFCNT_DEBUG | 1375 | |
1388 | atomic_inc(&ipx_sock_nr); | 1376 | sk_refcnt_debug_inc(sk); |
1389 | printk(KERN_DEBUG "IPX socket %p created, now we have %d alive\n", sk, | ||
1390 | atomic_read(&ipx_sock_nr)); | ||
1391 | #endif | ||
1392 | sock_init_data(sock, sk); | 1377 | sock_init_data(sock, sk); |
1393 | sk->sk_no_check = 1; /* Checksum off by default */ | 1378 | sk->sk_no_check = 1; /* Checksum off by default */ |
1394 | sock->ops = &ipx_dgram_ops; | 1379 | sock->ops = &ipx_dgram_ops; |
@@ -1409,6 +1394,7 @@ static int ipx_release(struct socket *sock) | |||
1409 | 1394 | ||
1410 | sock_set_flag(sk, SOCK_DEAD); | 1395 | sock_set_flag(sk, SOCK_DEAD); |
1411 | sock->sk = NULL; | 1396 | sock->sk = NULL; |
1397 | sk_refcnt_debug_release(sk); | ||
1412 | ipx_destroy_socket(sk); | 1398 | ipx_destroy_socket(sk); |
1413 | out: | 1399 | out: |
1414 | return 0; | 1400 | return 0; |
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 6fffb3845ab6..ce176e691afe 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig | |||
@@ -13,6 +13,18 @@ config MAC80211 | |||
13 | This option enables the hardware independent IEEE 802.11 | 13 | This option enables the hardware independent IEEE 802.11 |
14 | networking stack. | 14 | networking stack. |
15 | 15 | ||
16 | config MAC80211_RCSIMPLE | ||
17 | bool "'simple' rate control algorithm" if EMBEDDED | ||
18 | default y | ||
19 | depends on MAC80211 | ||
20 | help | ||
21 | This option allows you to turn off the 'simple' rate | ||
22 | control algorithm in mac80211. If you do turn it off, | ||
23 | you absolutely need another rate control algorithm. | ||
24 | |||
25 | Say Y unless you know you will have another algorithm | ||
26 | available. | ||
27 | |||
16 | config MAC80211_LEDS | 28 | config MAC80211_LEDS |
17 | bool "Enable LED triggers" | 29 | bool "Enable LED triggers" |
18 | depends on MAC80211 && LEDS_TRIGGERS | 30 | depends on MAC80211 && LEDS_TRIGGERS |
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile index 219cd9f9341f..1e6237b34846 100644 --- a/net/mac80211/Makefile +++ b/net/mac80211/Makefile | |||
@@ -1,8 +1,9 @@ | |||
1 | obj-$(CONFIG_MAC80211) += mac80211.o rc80211_simple.o | 1 | obj-$(CONFIG_MAC80211) += mac80211.o |
2 | 2 | ||
3 | mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o | 3 | mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o |
4 | mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o | 4 | mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o |
5 | mac80211-objs-$(CONFIG_NET_SCHED) += wme.o | 5 | mac80211-objs-$(CONFIG_NET_SCHED) += wme.o |
6 | mac80211-objs-$(CONFIG_MAC80211_RCSIMPLE) += rc80211_simple.o | ||
6 | 7 | ||
7 | mac80211-objs := \ | 8 | mac80211-objs := \ |
8 | ieee80211.o \ | 9 | ieee80211.o \ |
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index f484ca7ade9c..e0ee65a969bc 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -1072,7 +1072,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
1072 | ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); | 1072 | ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); |
1073 | ieee80211_if_set_type(local->mdev, IEEE80211_IF_TYPE_AP); | 1073 | ieee80211_if_set_type(local->mdev, IEEE80211_IF_TYPE_AP); |
1074 | 1074 | ||
1075 | result = ieee80211_init_rate_ctrl_alg(local, NULL); | 1075 | result = ieee80211_init_rate_ctrl_alg(local, |
1076 | hw->rate_control_algorithm); | ||
1076 | if (result < 0) { | 1077 | if (result < 0) { |
1077 | printk(KERN_DEBUG "%s: Failed to initialize rate control " | 1078 | printk(KERN_DEBUG "%s: Failed to initialize rate control " |
1078 | "algorithm\n", wiphy_name(local->hw.wiphy)); | 1079 | "algorithm\n", wiphy_name(local->hw.wiphy)); |
@@ -1233,8 +1234,17 @@ static int __init ieee80211_init(void) | |||
1233 | 1234 | ||
1234 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); | 1235 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); |
1235 | 1236 | ||
1237 | #ifdef CONFIG_MAC80211_RCSIMPLE | ||
1238 | ret = ieee80211_rate_control_register(&mac80211_rcsimple); | ||
1239 | if (ret) | ||
1240 | return ret; | ||
1241 | #endif | ||
1242 | |||
1236 | ret = ieee80211_wme_register(); | 1243 | ret = ieee80211_wme_register(); |
1237 | if (ret) { | 1244 | if (ret) { |
1245 | #ifdef CONFIG_MAC80211_RCSIMPLE | ||
1246 | ieee80211_rate_control_unregister(&mac80211_rcsimple); | ||
1247 | #endif | ||
1238 | printk(KERN_DEBUG "ieee80211_init: failed to " | 1248 | printk(KERN_DEBUG "ieee80211_init: failed to " |
1239 | "initialize WME (err=%d)\n", ret); | 1249 | "initialize WME (err=%d)\n", ret); |
1240 | return ret; | 1250 | return ret; |
@@ -1248,6 +1258,10 @@ static int __init ieee80211_init(void) | |||
1248 | 1258 | ||
1249 | static void __exit ieee80211_exit(void) | 1259 | static void __exit ieee80211_exit(void) |
1250 | { | 1260 | { |
1261 | #ifdef CONFIG_MAC80211_RCSIMPLE | ||
1262 | ieee80211_rate_control_unregister(&mac80211_rcsimple); | ||
1263 | #endif | ||
1264 | |||
1251 | ieee80211_wme_unregister(); | 1265 | ieee80211_wme_unregister(); |
1252 | ieee80211_debugfs_netdev_exit(); | 1266 | ieee80211_debugfs_netdev_exit(); |
1253 | } | 1267 | } |
diff --git a/net/mac80211/ieee80211_common.h b/net/mac80211/ieee80211_common.h deleted file mode 100644 index c15295d43d87..000000000000 --- a/net/mac80211/ieee80211_common.h +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * IEEE 802.11 driver (80211.o) -- hostapd interface | ||
3 | * Copyright 2002-2004, Instant802 Networks, Inc. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #ifndef IEEE80211_COMMON_H | ||
11 | #define IEEE80211_COMMON_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | |||
15 | /* | ||
16 | * This is common header information with user space. It is used on all | ||
17 | * frames sent to wlan#ap interface. | ||
18 | */ | ||
19 | |||
20 | #define IEEE80211_FI_VERSION 0x80211001 | ||
21 | |||
22 | struct ieee80211_frame_info { | ||
23 | __be32 version; | ||
24 | __be32 length; | ||
25 | __be64 mactime; | ||
26 | __be64 hosttime; | ||
27 | __be32 phytype; | ||
28 | __be32 channel; | ||
29 | __be32 datarate; | ||
30 | __be32 antenna; | ||
31 | __be32 priority; | ||
32 | __be32 ssi_type; | ||
33 | __be32 ssi_signal; | ||
34 | __be32 ssi_noise; | ||
35 | __be32 preamble; | ||
36 | __be32 encoding; | ||
37 | |||
38 | /* Note: this structure is otherwise identical to capture format used | ||
39 | * in linux-wlan-ng, but this additional field is used to provide meta | ||
40 | * data about the frame to hostapd. This was the easiest method for | ||
41 | * providing this information, but this might change in the future. */ | ||
42 | __be32 msg_type; | ||
43 | } __attribute__ ((packed)); | ||
44 | |||
45 | |||
46 | enum ieee80211_msg_type { | ||
47 | ieee80211_msg_normal = 0, | ||
48 | ieee80211_msg_tx_callback_ack = 1, | ||
49 | ieee80211_msg_tx_callback_fail = 2, | ||
50 | /* hole at 3, was ieee80211_msg_passive_scan but unused */ | ||
51 | /* hole at 4, was ieee80211_msg_wep_frame_unknown_key but now unused */ | ||
52 | ieee80211_msg_michael_mic_failure = 5, | ||
53 | /* hole at 6, was monitor but never sent to userspace */ | ||
54 | ieee80211_msg_sta_not_assoc = 7, | ||
55 | /* 8 was ieee80211_msg_set_aid_for_sta */ | ||
56 | /* 9 was ieee80211_msg_key_threshold_notification */ | ||
57 | /* 11 was ieee80211_msg_radar */ | ||
58 | }; | ||
59 | |||
60 | struct ieee80211_msg_key_notification { | ||
61 | int tx_rx_count; | ||
62 | char ifname[IFNAMSIZ]; | ||
63 | u8 addr[ETH_ALEN]; /* ff:ff:ff:ff:ff:ff for broadcast keys */ | ||
64 | }; | ||
65 | |||
66 | |||
67 | enum ieee80211_phytype { | ||
68 | ieee80211_phytype_fhss_dot11_97 = 1, | ||
69 | ieee80211_phytype_dsss_dot11_97 = 2, | ||
70 | ieee80211_phytype_irbaseband = 3, | ||
71 | ieee80211_phytype_dsss_dot11_b = 4, | ||
72 | ieee80211_phytype_pbcc_dot11_b = 5, | ||
73 | ieee80211_phytype_ofdm_dot11_g = 6, | ||
74 | ieee80211_phytype_pbcc_dot11_g = 7, | ||
75 | ieee80211_phytype_ofdm_dot11_a = 8, | ||
76 | }; | ||
77 | |||
78 | enum ieee80211_ssi_type { | ||
79 | ieee80211_ssi_none = 0, | ||
80 | ieee80211_ssi_norm = 1, /* normalized, 0-1000 */ | ||
81 | ieee80211_ssi_dbm = 2, | ||
82 | ieee80211_ssi_raw = 3, /* raw SSI */ | ||
83 | }; | ||
84 | |||
85 | struct ieee80211_radar_info { | ||
86 | int channel; | ||
87 | int radar; | ||
88 | int radar_type; | ||
89 | }; | ||
90 | |||
91 | #endif /* IEEE80211_COMMON_H */ | ||
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 4b4ed2a5803c..b4e32ab3664d 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -230,6 +230,7 @@ struct ieee80211_if_vlan { | |||
230 | #define IEEE80211_STA_AUTO_SSID_SEL BIT(10) | 230 | #define IEEE80211_STA_AUTO_SSID_SEL BIT(10) |
231 | #define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) | 231 | #define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) |
232 | #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) | 232 | #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) |
233 | #define IEEE80211_STA_PRIVACY_INVOKED BIT(13) | ||
233 | struct ieee80211_if_sta { | 234 | struct ieee80211_if_sta { |
234 | enum { | 235 | enum { |
235 | IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, | 236 | IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, |
@@ -259,7 +260,6 @@ struct ieee80211_if_sta { | |||
259 | unsigned long request; | 260 | unsigned long request; |
260 | struct sk_buff_head skb_queue; | 261 | struct sk_buff_head skb_queue; |
261 | 262 | ||
262 | int key_management_enabled; | ||
263 | unsigned long last_probe; | 263 | unsigned long last_probe; |
264 | 264 | ||
265 | #define IEEE80211_AUTH_ALG_OPEN BIT(0) | 265 | #define IEEE80211_AUTH_ALG_OPEN BIT(0) |
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c index 6caa3ec2cff7..7027eed4d4ae 100644 --- a/net/mac80211/ieee80211_ioctl.c +++ b/net/mac80211/ieee80211_ioctl.c | |||
@@ -917,7 +917,6 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, | |||
917 | struct iw_request_info *info, | 917 | struct iw_request_info *info, |
918 | struct iw_param *data, char *extra) | 918 | struct iw_param *data, char *extra) |
919 | { | 919 | { |
920 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
921 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 920 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
922 | int ret = 0; | 921 | int ret = 0; |
923 | 922 | ||
@@ -927,18 +926,21 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, | |||
927 | case IW_AUTH_CIPHER_GROUP: | 926 | case IW_AUTH_CIPHER_GROUP: |
928 | case IW_AUTH_WPA_ENABLED: | 927 | case IW_AUTH_WPA_ENABLED: |
929 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | 928 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
930 | break; | ||
931 | case IW_AUTH_KEY_MGMT: | 929 | case IW_AUTH_KEY_MGMT: |
930 | break; | ||
931 | case IW_AUTH_PRIVACY_INVOKED: | ||
932 | if (sdata->type != IEEE80211_IF_TYPE_STA) | 932 | if (sdata->type != IEEE80211_IF_TYPE_STA) |
933 | ret = -EINVAL; | 933 | ret = -EINVAL; |
934 | else { | 934 | else { |
935 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; | ||
935 | /* | 936 | /* |
936 | * Key management was set by wpa_supplicant, | 937 | * Privacy invoked by wpa_supplicant, store the |
937 | * we only need this to associate to a network | 938 | * value and allow associating to a protected |
938 | * that has privacy enabled regardless of not | 939 | * network without having a key up front. |
939 | * having a key. | ||
940 | */ | 940 | */ |
941 | sdata->u.sta.key_management_enabled = !!data->value; | 941 | if (data->value) |
942 | sdata->u.sta.flags |= | ||
943 | IEEE80211_STA_PRIVACY_INVOKED; | ||
942 | } | 944 | } |
943 | break; | 945 | break; |
944 | case IW_AUTH_80211_AUTH_ALG: | 946 | case IW_AUTH_80211_AUTH_ALG: |
@@ -948,11 +950,6 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, | |||
948 | else | 950 | else |
949 | ret = -EOPNOTSUPP; | 951 | ret = -EOPNOTSUPP; |
950 | break; | 952 | break; |
951 | case IW_AUTH_PRIVACY_INVOKED: | ||
952 | if (local->ops->set_privacy_invoked) | ||
953 | ret = local->ops->set_privacy_invoked( | ||
954 | local_to_hw(local), data->value); | ||
955 | break; | ||
956 | default: | 953 | default: |
957 | ret = -EOPNOTSUPP; | 954 | ret = -EOPNOTSUPP; |
958 | break; | 955 | break; |
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c index 93abb8fff141..7254bd609839 100644 --- a/net/mac80211/ieee80211_rate.c +++ b/net/mac80211/ieee80211_rate.c | |||
@@ -25,13 +25,25 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops) | |||
25 | { | 25 | { |
26 | struct rate_control_alg *alg; | 26 | struct rate_control_alg *alg; |
27 | 27 | ||
28 | if (!ops->name) | ||
29 | return -EINVAL; | ||
30 | |||
31 | mutex_lock(&rate_ctrl_mutex); | ||
32 | list_for_each_entry(alg, &rate_ctrl_algs, list) { | ||
33 | if (!strcmp(alg->ops->name, ops->name)) { | ||
34 | /* don't register an algorithm twice */ | ||
35 | WARN_ON(1); | ||
36 | return -EALREADY; | ||
37 | } | ||
38 | } | ||
39 | |||
28 | alg = kzalloc(sizeof(*alg), GFP_KERNEL); | 40 | alg = kzalloc(sizeof(*alg), GFP_KERNEL); |
29 | if (alg == NULL) { | 41 | if (alg == NULL) { |
42 | mutex_unlock(&rate_ctrl_mutex); | ||
30 | return -ENOMEM; | 43 | return -ENOMEM; |
31 | } | 44 | } |
32 | alg->ops = ops; | 45 | alg->ops = ops; |
33 | 46 | ||
34 | mutex_lock(&rate_ctrl_mutex); | ||
35 | list_add_tail(&alg->list, &rate_ctrl_algs); | 47 | list_add_tail(&alg->list, &rate_ctrl_algs); |
36 | mutex_unlock(&rate_ctrl_mutex); | 48 | mutex_unlock(&rate_ctrl_mutex); |
37 | 49 | ||
@@ -61,9 +73,12 @@ ieee80211_try_rate_control_ops_get(const char *name) | |||
61 | struct rate_control_alg *alg; | 73 | struct rate_control_alg *alg; |
62 | struct rate_control_ops *ops = NULL; | 74 | struct rate_control_ops *ops = NULL; |
63 | 75 | ||
76 | if (!name) | ||
77 | return NULL; | ||
78 | |||
64 | mutex_lock(&rate_ctrl_mutex); | 79 | mutex_lock(&rate_ctrl_mutex); |
65 | list_for_each_entry(alg, &rate_ctrl_algs, list) { | 80 | list_for_each_entry(alg, &rate_ctrl_algs, list) { |
66 | if (!name || !strcmp(alg->ops->name, name)) | 81 | if (!strcmp(alg->ops->name, name)) |
67 | if (try_module_get(alg->ops->module)) { | 82 | if (try_module_get(alg->ops->module)) { |
68 | ops = alg->ops; | 83 | ops = alg->ops; |
69 | break; | 84 | break; |
@@ -80,9 +95,12 @@ ieee80211_rate_control_ops_get(const char *name) | |||
80 | { | 95 | { |
81 | struct rate_control_ops *ops; | 96 | struct rate_control_ops *ops; |
82 | 97 | ||
98 | if (!name) | ||
99 | name = "simple"; | ||
100 | |||
83 | ops = ieee80211_try_rate_control_ops_get(name); | 101 | ops = ieee80211_try_rate_control_ops_get(name); |
84 | if (!ops) { | 102 | if (!ops) { |
85 | request_module("rc80211_%s", name ? name : "default"); | 103 | request_module("rc80211_%s", name); |
86 | ops = ieee80211_try_rate_control_ops_get(name); | 104 | ops = ieee80211_try_rate_control_ops_get(name); |
87 | } | 105 | } |
88 | return ops; | 106 | return ops; |
diff --git a/net/mac80211/ieee80211_rate.h b/net/mac80211/ieee80211_rate.h index 7cd1ebab4f83..23688139ffb3 100644 --- a/net/mac80211/ieee80211_rate.h +++ b/net/mac80211/ieee80211_rate.h | |||
@@ -65,6 +65,9 @@ struct rate_control_ref { | |||
65 | struct kref kref; | 65 | struct kref kref; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /* default 'simple' algorithm */ | ||
69 | extern struct rate_control_ops mac80211_rcsimple; | ||
70 | |||
68 | int ieee80211_rate_control_register(struct rate_control_ops *ops); | 71 | int ieee80211_rate_control_register(struct rate_control_ops *ops); |
69 | void ieee80211_rate_control_unregister(struct rate_control_ops *ops); | 72 | void ieee80211_rate_control_unregister(struct rate_control_ops *ops); |
70 | 73 | ||
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c index fda0e06453e8..2079e988fc56 100644 --- a/net/mac80211/ieee80211_sta.c +++ b/net/mac80211/ieee80211_sta.c | |||
@@ -704,10 +704,11 @@ static int ieee80211_privacy_mismatch(struct net_device *dev, | |||
704 | { | 704 | { |
705 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 705 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
706 | struct ieee80211_sta_bss *bss; | 706 | struct ieee80211_sta_bss *bss; |
707 | int res = 0; | 707 | int bss_privacy; |
708 | int wep_privacy; | ||
709 | int privacy_invoked; | ||
708 | 710 | ||
709 | if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL) || | 711 | if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL)) |
710 | ifsta->key_management_enabled) | ||
711 | return 0; | 712 | return 0; |
712 | 713 | ||
713 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel, | 714 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel, |
@@ -715,13 +716,16 @@ static int ieee80211_privacy_mismatch(struct net_device *dev, | |||
715 | if (!bss) | 716 | if (!bss) |
716 | return 0; | 717 | return 0; |
717 | 718 | ||
718 | if (ieee80211_sta_wep_configured(dev) != | 719 | bss_privacy = !!(bss->capability & WLAN_CAPABILITY_PRIVACY); |
719 | !!(bss->capability & WLAN_CAPABILITY_PRIVACY)) | 720 | wep_privacy = !!ieee80211_sta_wep_configured(dev); |
720 | res = 1; | 721 | privacy_invoked = !!(ifsta->flags & IEEE80211_STA_PRIVACY_INVOKED); |
721 | 722 | ||
722 | ieee80211_rx_bss_put(dev, bss); | 723 | ieee80211_rx_bss_put(dev, bss); |
723 | 724 | ||
724 | return res; | 725 | if ((bss_privacy == wep_privacy) || (bss_privacy == privacy_invoked)) |
726 | return 0; | ||
727 | |||
728 | return 1; | ||
725 | } | 729 | } |
726 | 730 | ||
727 | 731 | ||
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c index 314b8de88862..da72737364e4 100644 --- a/net/mac80211/rc80211_simple.c +++ b/net/mac80211/rc80211_simple.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/init.h> | 10 | #include <linux/init.h> |
12 | #include <linux/netdevice.h> | 11 | #include <linux/netdevice.h> |
13 | #include <linux/types.h> | 12 | #include <linux/types.h> |
@@ -29,8 +28,6 @@ | |||
29 | #define RATE_CONTROL_INTERVAL (HZ / 20) | 28 | #define RATE_CONTROL_INTERVAL (HZ / 20) |
30 | #define RATE_CONTROL_MIN_TX 10 | 29 | #define RATE_CONTROL_MIN_TX 10 |
31 | 30 | ||
32 | MODULE_ALIAS("rc80211_default"); | ||
33 | |||
34 | static void rate_control_rate_inc(struct ieee80211_local *local, | 31 | static void rate_control_rate_inc(struct ieee80211_local *local, |
35 | struct sta_info *sta) | 32 | struct sta_info *sta) |
36 | { | 33 | { |
@@ -394,8 +391,7 @@ static void rate_control_simple_remove_sta_debugfs(void *priv, void *priv_sta) | |||
394 | } | 391 | } |
395 | #endif | 392 | #endif |
396 | 393 | ||
397 | static struct rate_control_ops rate_control_simple = { | 394 | struct rate_control_ops mac80211_rcsimple = { |
398 | .module = THIS_MODULE, | ||
399 | .name = "simple", | 395 | .name = "simple", |
400 | .tx_status = rate_control_simple_tx_status, | 396 | .tx_status = rate_control_simple_tx_status, |
401 | .get_rate = rate_control_simple_get_rate, | 397 | .get_rate = rate_control_simple_get_rate, |
@@ -410,22 +406,3 @@ static struct rate_control_ops rate_control_simple = { | |||
410 | .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs, | 406 | .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs, |
411 | #endif | 407 | #endif |
412 | }; | 408 | }; |
413 | |||
414 | |||
415 | static int __init rate_control_simple_init(void) | ||
416 | { | ||
417 | return ieee80211_rate_control_register(&rate_control_simple); | ||
418 | } | ||
419 | |||
420 | |||
421 | static void __exit rate_control_simple_exit(void) | ||
422 | { | ||
423 | ieee80211_rate_control_unregister(&rate_control_simple); | ||
424 | } | ||
425 | |||
426 | |||
427 | subsys_initcall(rate_control_simple_init); | ||
428 | module_exit(rate_control_simple_exit); | ||
429 | |||
430 | MODULE_DESCRIPTION("Simple rate control algorithm for ieee80211"); | ||
431 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index ece77766ea2b..428a9fcf57d6 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -509,9 +509,11 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx) | |||
509 | rx->key->tx_rx_count++; | 509 | rx->key->tx_rx_count++; |
510 | /* TODO: add threshold stuff again */ | 510 | /* TODO: add threshold stuff again */ |
511 | } else { | 511 | } else { |
512 | #ifdef CONFIG_MAC80211_DEBUG | ||
512 | if (net_ratelimit()) | 513 | if (net_ratelimit()) |
513 | printk(KERN_DEBUG "%s: RX protected frame," | 514 | printk(KERN_DEBUG "%s: RX protected frame," |
514 | " but have no key\n", rx->dev->name); | 515 | " but have no key\n", rx->dev->name); |
516 | #endif /* CONFIG_MAC80211_DEBUG */ | ||
515 | return TXRX_DROP; | 517 | return TXRX_DROP; |
516 | } | 518 | } |
517 | 519 | ||
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c index a84a23310ff4..9bf0e1cc530a 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -314,9 +314,11 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_txrx_data *rx) | |||
314 | 314 | ||
315 | if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) { | 315 | if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) { |
316 | if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { | 316 | if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { |
317 | #ifdef CONFIG_MAC80211_DEBUG | ||
317 | if (net_ratelimit()) | 318 | if (net_ratelimit()) |
318 | printk(KERN_DEBUG "%s: RX WEP frame, decrypt " | 319 | printk(KERN_DEBUG "%s: RX WEP frame, decrypt " |
319 | "failed\n", rx->dev->name); | 320 | "failed\n", rx->dev->name); |
321 | #endif /* CONFIG_MAC80211_DEBUG */ | ||
320 | return TXRX_DROP; | 322 | return TXRX_DROP; |
321 | } | 323 | } |
322 | } else if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) { | 324 | } else if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) { |
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index 6695efba57ec..20cec1cb956f 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -323,9 +323,12 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_txrx_data *rx) | |||
323 | &rx->u.rx.tkip_iv32, | 323 | &rx->u.rx.tkip_iv32, |
324 | &rx->u.rx.tkip_iv16); | 324 | &rx->u.rx.tkip_iv16); |
325 | if (res != TKIP_DECRYPT_OK || wpa_test) { | 325 | if (res != TKIP_DECRYPT_OK || wpa_test) { |
326 | printk(KERN_DEBUG "%s: TKIP decrypt failed for RX frame from " | 326 | #ifdef CONFIG_MAC80211_DEBUG |
327 | "%s (res=%d)\n", | 327 | if (net_ratelimit()) |
328 | rx->dev->name, print_mac(mac, rx->sta->addr), res); | 328 | printk(KERN_DEBUG "%s: TKIP decrypt failed for RX " |
329 | "frame from %s (res=%d)\n", rx->dev->name, | ||
330 | print_mac(mac, rx->sta->addr), res); | ||
331 | #endif /* CONFIG_MAC80211_DEBUG */ | ||
329 | return TXRX_DROP; | 332 | return TXRX_DROP; |
330 | } | 333 | } |
331 | 334 | ||
@@ -594,9 +597,12 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_txrx_data *rx) | |||
594 | skb->data + hdrlen + CCMP_HDR_LEN, data_len, | 597 | skb->data + hdrlen + CCMP_HDR_LEN, data_len, |
595 | skb->data + skb->len - CCMP_MIC_LEN, | 598 | skb->data + skb->len - CCMP_MIC_LEN, |
596 | skb->data + hdrlen + CCMP_HDR_LEN)) { | 599 | skb->data + hdrlen + CCMP_HDR_LEN)) { |
597 | printk(KERN_DEBUG "%s: CCMP decrypt failed for RX " | 600 | #ifdef CONFIG_MAC80211_DEBUG |
598 | "frame from %s\n", rx->dev->name, | 601 | if (net_ratelimit()) |
599 | print_mac(mac, rx->sta->addr)); | 602 | printk(KERN_DEBUG "%s: CCMP decrypt failed " |
603 | "for RX frame from %s\n", rx->dev->name, | ||
604 | print_mac(mac, rx->sta->addr)); | ||
605 | #endif /* CONFIG_MAC80211_DEBUG */ | ||
600 | return TXRX_DROP; | 606 | return TXRX_DROP; |
601 | } | 607 | } |
602 | } | 608 | } |
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c index 2dfac3253569..87bc1443c520 100644 --- a/net/netfilter/nf_sockopt.c +++ b/net/netfilter/nf_sockopt.c | |||
@@ -60,46 +60,57 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg) | |||
60 | } | 60 | } |
61 | EXPORT_SYMBOL(nf_unregister_sockopt); | 61 | EXPORT_SYMBOL(nf_unregister_sockopt); |
62 | 62 | ||
63 | /* Call get/setsockopt() */ | 63 | static struct nf_sockopt_ops *nf_sockopt_find(struct sock *sk, int pf, |
64 | static int nf_sockopt(struct sock *sk, int pf, int val, | 64 | int val, int get) |
65 | char __user *opt, int *len, int get) | ||
66 | { | 65 | { |
67 | struct nf_sockopt_ops *ops; | 66 | struct nf_sockopt_ops *ops; |
68 | int ret; | ||
69 | 67 | ||
70 | if (sk->sk_net != &init_net) | 68 | if (sk->sk_net != &init_net) |
71 | return -ENOPROTOOPT; | 69 | return ERR_PTR(-ENOPROTOOPT); |
72 | 70 | ||
73 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) | 71 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) |
74 | return -EINTR; | 72 | return ERR_PTR(-EINTR); |
75 | 73 | ||
76 | list_for_each_entry(ops, &nf_sockopts, list) { | 74 | list_for_each_entry(ops, &nf_sockopts, list) { |
77 | if (ops->pf == pf) { | 75 | if (ops->pf == pf) { |
78 | if (!try_module_get(ops->owner)) | 76 | if (!try_module_get(ops->owner)) |
79 | goto out_nosup; | 77 | goto out_nosup; |
78 | |||
80 | if (get) { | 79 | if (get) { |
81 | if (val >= ops->get_optmin | 80 | if (val >= ops->get_optmin && |
82 | && val < ops->get_optmax) { | 81 | val < ops->get_optmax) |
83 | mutex_unlock(&nf_sockopt_mutex); | ||
84 | ret = ops->get(sk, val, opt, len); | ||
85 | goto out; | 82 | goto out; |
86 | } | ||
87 | } else { | 83 | } else { |
88 | if (val >= ops->set_optmin | 84 | if (val >= ops->set_optmin && |
89 | && val < ops->set_optmax) { | 85 | val < ops->set_optmax) |
90 | mutex_unlock(&nf_sockopt_mutex); | ||
91 | ret = ops->set(sk, val, opt, *len); | ||
92 | goto out; | 86 | goto out; |
93 | } | ||
94 | } | 87 | } |
95 | module_put(ops->owner); | 88 | module_put(ops->owner); |
96 | } | 89 | } |
97 | } | 90 | } |
98 | out_nosup: | 91 | out_nosup: |
92 | ops = ERR_PTR(-ENOPROTOOPT); | ||
93 | out: | ||
99 | mutex_unlock(&nf_sockopt_mutex); | 94 | mutex_unlock(&nf_sockopt_mutex); |
100 | return -ENOPROTOOPT; | 95 | return ops; |
96 | } | ||
97 | |||
98 | /* Call get/setsockopt() */ | ||
99 | static int nf_sockopt(struct sock *sk, int pf, int val, | ||
100 | char __user *opt, int *len, int get) | ||
101 | { | ||
102 | struct nf_sockopt_ops *ops; | ||
103 | int ret; | ||
104 | |||
105 | ops = nf_sockopt_find(sk, pf, val, get); | ||
106 | if (IS_ERR(ops)) | ||
107 | return PTR_ERR(ops); | ||
108 | |||
109 | if (get) | ||
110 | ret = ops->get(sk, val, opt, len); | ||
111 | else | ||
112 | ret = ops->set(sk, val, opt, *len); | ||
101 | 113 | ||
102 | out: | ||
103 | module_put(ops->owner); | 114 | module_put(ops->owner); |
104 | return ret; | 115 | return ret; |
105 | } | 116 | } |
@@ -124,51 +135,22 @@ static int compat_nf_sockopt(struct sock *sk, int pf, int val, | |||
124 | struct nf_sockopt_ops *ops; | 135 | struct nf_sockopt_ops *ops; |
125 | int ret; | 136 | int ret; |
126 | 137 | ||
127 | if (sk->sk_net != &init_net) | 138 | ops = nf_sockopt_find(sk, pf, val, get); |
128 | return -ENOPROTOOPT; | 139 | if (IS_ERR(ops)) |
129 | 140 | return PTR_ERR(ops); | |
130 | 141 | ||
131 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) | 142 | if (get) { |
132 | return -EINTR; | 143 | if (ops->compat_get) |
133 | 144 | ret = ops->compat_get(sk, val, opt, len); | |
134 | list_for_each_entry(ops, &nf_sockopts, list) { | 145 | else |
135 | if (ops->pf == pf) { | 146 | ret = ops->get(sk, val, ops, len); |
136 | if (!try_module_get(ops->owner)) | 147 | } else { |
137 | goto out_nosup; | 148 | if (ops->compat_set) |
138 | 149 | ret = ops->compat_set(sk, val, ops, *len); | |
139 | if (get) { | 150 | else |
140 | if (val >= ops->get_optmin | 151 | ret = ops->set(sk, val, ops, *len); |
141 | && val < ops->get_optmax) { | ||
142 | mutex_unlock(&nf_sockopt_mutex); | ||
143 | if (ops->compat_get) | ||
144 | ret = ops->compat_get(sk, | ||
145 | val, opt, len); | ||
146 | else | ||
147 | ret = ops->get(sk, | ||
148 | val, opt, len); | ||
149 | goto out; | ||
150 | } | ||
151 | } else { | ||
152 | if (val >= ops->set_optmin | ||
153 | && val < ops->set_optmax) { | ||
154 | mutex_unlock(&nf_sockopt_mutex); | ||
155 | if (ops->compat_set) | ||
156 | ret = ops->compat_set(sk, | ||
157 | val, opt, *len); | ||
158 | else | ||
159 | ret = ops->set(sk, | ||
160 | val, opt, *len); | ||
161 | goto out; | ||
162 | } | ||
163 | } | ||
164 | module_put(ops->owner); | ||
165 | } | ||
166 | } | 152 | } |
167 | out_nosup: | ||
168 | mutex_unlock(&nf_sockopt_mutex); | ||
169 | return -ENOPROTOOPT; | ||
170 | 153 | ||
171 | out: | ||
172 | module_put(ops->owner); | 154 | module_put(ops->owner); |
173 | return ret; | 155 | return ret; |
174 | } | 156 | } |
diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c index ff44f86c24ce..f9c55dcd894b 100644 --- a/net/netfilter/xt_time.c +++ b/net/netfilter/xt_time.c | |||
@@ -170,7 +170,7 @@ static bool xt_time_match(const struct sk_buff *skb, | |||
170 | if (skb->tstamp.tv64 == 0) | 170 | if (skb->tstamp.tv64 == 0) |
171 | __net_timestamp((struct sk_buff *)skb); | 171 | __net_timestamp((struct sk_buff *)skb); |
172 | 172 | ||
173 | stamp = skb->tstamp.tv64; | 173 | stamp = ktime_to_ns(skb->tstamp); |
174 | do_div(stamp, NSEC_PER_SEC); | 174 | do_div(stamp, NSEC_PER_SEC); |
175 | 175 | ||
176 | if (info->flags & XT_TIME_LOCAL_TZ) | 176 | if (info->flags & XT_TIME_LOCAL_TZ) |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 415c97236f63..de3988ba1f46 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1888,7 +1888,7 @@ static void __net_exit netlink_net_exit(struct net *net) | |||
1888 | #endif | 1888 | #endif |
1889 | } | 1889 | } |
1890 | 1890 | ||
1891 | static struct pernet_operations netlink_net_ops = { | 1891 | static struct pernet_operations __net_initdata netlink_net_ops = { |
1892 | .init = netlink_net_init, | 1892 | .init = netlink_net_init, |
1893 | .exit = netlink_net_exit, | 1893 | .exit = netlink_net_exit, |
1894 | }; | 1894 | }; |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 4cb2dfba0993..8a7807dbba01 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -139,9 +139,6 @@ dev->hard_header == NULL (ll header is added by device, we cannot control it) | |||
139 | static HLIST_HEAD(packet_sklist); | 139 | static HLIST_HEAD(packet_sklist); |
140 | static DEFINE_RWLOCK(packet_sklist_lock); | 140 | static DEFINE_RWLOCK(packet_sklist_lock); |
141 | 141 | ||
142 | static atomic_t packet_socks_nr; | ||
143 | |||
144 | |||
145 | /* Private packet socket structures. */ | 142 | /* Private packet socket structures. */ |
146 | 143 | ||
147 | struct packet_mclist | 144 | struct packet_mclist |
@@ -236,10 +233,7 @@ static void packet_sock_destruct(struct sock *sk) | |||
236 | return; | 233 | return; |
237 | } | 234 | } |
238 | 235 | ||
239 | atomic_dec(&packet_socks_nr); | 236 | sk_refcnt_debug_dec(sk); |
240 | #ifdef PACKET_REFCNT_DEBUG | ||
241 | printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, atomic_read(&packet_socks_nr)); | ||
242 | #endif | ||
243 | } | 237 | } |
244 | 238 | ||
245 | 239 | ||
@@ -515,7 +509,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
515 | sll->sll_hatype = dev->type; | 509 | sll->sll_hatype = dev->type; |
516 | sll->sll_protocol = skb->protocol; | 510 | sll->sll_protocol = skb->protocol; |
517 | sll->sll_pkttype = skb->pkt_type; | 511 | sll->sll_pkttype = skb->pkt_type; |
518 | if (unlikely(po->origdev) && skb->pkt_type == PACKET_HOST) | 512 | if (unlikely(po->origdev)) |
519 | sll->sll_ifindex = orig_dev->ifindex; | 513 | sll->sll_ifindex = orig_dev->ifindex; |
520 | else | 514 | else |
521 | sll->sll_ifindex = dev->ifindex; | 515 | sll->sll_ifindex = dev->ifindex; |
@@ -661,7 +655,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
661 | sll->sll_hatype = dev->type; | 655 | sll->sll_hatype = dev->type; |
662 | sll->sll_protocol = skb->protocol; | 656 | sll->sll_protocol = skb->protocol; |
663 | sll->sll_pkttype = skb->pkt_type; | 657 | sll->sll_pkttype = skb->pkt_type; |
664 | if (unlikely(po->origdev) && skb->pkt_type == PACKET_HOST) | 658 | if (unlikely(po->origdev)) |
665 | sll->sll_ifindex = orig_dev->ifindex; | 659 | sll->sll_ifindex = orig_dev->ifindex; |
666 | else | 660 | else |
667 | sll->sll_ifindex = dev->ifindex; | 661 | sll->sll_ifindex = dev->ifindex; |
@@ -849,6 +843,7 @@ static int packet_release(struct socket *sock) | |||
849 | /* Purge queues */ | 843 | /* Purge queues */ |
850 | 844 | ||
851 | skb_queue_purge(&sk->sk_receive_queue); | 845 | skb_queue_purge(&sk->sk_receive_queue); |
846 | sk_refcnt_debug_release(sk); | ||
852 | 847 | ||
853 | sock_put(sk); | 848 | sock_put(sk); |
854 | return 0; | 849 | return 0; |
@@ -886,20 +881,14 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc | |||
886 | if (protocol == 0) | 881 | if (protocol == 0) |
887 | goto out_unlock; | 882 | goto out_unlock; |
888 | 883 | ||
889 | if (dev) { | 884 | if (!dev || (dev->flags & IFF_UP)) { |
890 | if (dev->flags&IFF_UP) { | ||
891 | dev_add_pack(&po->prot_hook); | ||
892 | sock_hold(sk); | ||
893 | po->running = 1; | ||
894 | } else { | ||
895 | sk->sk_err = ENETDOWN; | ||
896 | if (!sock_flag(sk, SOCK_DEAD)) | ||
897 | sk->sk_error_report(sk); | ||
898 | } | ||
899 | } else { | ||
900 | dev_add_pack(&po->prot_hook); | 885 | dev_add_pack(&po->prot_hook); |
901 | sock_hold(sk); | 886 | sock_hold(sk); |
902 | po->running = 1; | 887 | po->running = 1; |
888 | } else { | ||
889 | sk->sk_err = ENETDOWN; | ||
890 | if (!sock_flag(sk, SOCK_DEAD)) | ||
891 | sk->sk_error_report(sk); | ||
903 | } | 892 | } |
904 | 893 | ||
905 | out_unlock: | 894 | out_unlock: |
@@ -1010,7 +999,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol) | |||
1010 | po->num = proto; | 999 | po->num = proto; |
1011 | 1000 | ||
1012 | sk->sk_destruct = packet_sock_destruct; | 1001 | sk->sk_destruct = packet_sock_destruct; |
1013 | atomic_inc(&packet_socks_nr); | 1002 | sk_refcnt_debug_inc(sk); |
1014 | 1003 | ||
1015 | /* | 1004 | /* |
1016 | * Attach a protocol block | 1005 | * Attach a protocol block |
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index 51d151c0e962..73d60a307129 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c | |||
@@ -27,6 +27,10 @@ | |||
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/rfkill.h> | 28 | #include <linux/rfkill.h> |
29 | 29 | ||
30 | /* Get declaration of rfkill_switch_all() to shut up sparse. */ | ||
31 | #include "rfkill-input.h" | ||
32 | |||
33 | |||
30 | MODULE_AUTHOR("Ivo van Doorn <IvDoorn@gmail.com>"); | 34 | MODULE_AUTHOR("Ivo van Doorn <IvDoorn@gmail.com>"); |
31 | MODULE_VERSION("1.0"); | 35 | MODULE_VERSION("1.0"); |
32 | MODULE_DESCRIPTION("RF switch support"); | 36 | MODULE_DESCRIPTION("RF switch support"); |
@@ -276,21 +280,17 @@ static struct class rfkill_class = { | |||
276 | 280 | ||
277 | static int rfkill_add_switch(struct rfkill *rfkill) | 281 | static int rfkill_add_switch(struct rfkill *rfkill) |
278 | { | 282 | { |
279 | int retval; | 283 | int error; |
280 | |||
281 | retval = mutex_lock_interruptible(&rfkill_mutex); | ||
282 | if (retval) | ||
283 | return retval; | ||
284 | 284 | ||
285 | retval = rfkill_toggle_radio(rfkill, rfkill_states[rfkill->type]); | 285 | mutex_lock(&rfkill_mutex); |
286 | if (retval) | ||
287 | goto out; | ||
288 | 286 | ||
289 | list_add_tail(&rfkill->node, &rfkill_list); | 287 | error = rfkill_toggle_radio(rfkill, rfkill_states[rfkill->type]); |
288 | if (!error) | ||
289 | list_add_tail(&rfkill->node, &rfkill_list); | ||
290 | 290 | ||
291 | out: | ||
292 | mutex_unlock(&rfkill_mutex); | 291 | mutex_unlock(&rfkill_mutex); |
293 | return retval; | 292 | |
293 | return error; | ||
294 | } | 294 | } |
295 | 295 | ||
296 | static void rfkill_remove_switch(struct rfkill *rfkill) | 296 | static void rfkill_remove_switch(struct rfkill *rfkill) |
@@ -387,20 +387,23 @@ int rfkill_register(struct rfkill *rfkill) | |||
387 | 387 | ||
388 | if (!rfkill->toggle_radio) | 388 | if (!rfkill->toggle_radio) |
389 | return -EINVAL; | 389 | return -EINVAL; |
390 | if (rfkill->type >= RFKILL_TYPE_MAX) | ||
391 | return -EINVAL; | ||
392 | |||
393 | snprintf(dev->bus_id, sizeof(dev->bus_id), | ||
394 | "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1); | ||
395 | |||
396 | rfkill_led_trigger_register(rfkill); | ||
390 | 397 | ||
391 | error = rfkill_add_switch(rfkill); | 398 | error = rfkill_add_switch(rfkill); |
392 | if (error) | 399 | if (error) |
393 | return error; | 400 | return error; |
394 | 401 | ||
395 | snprintf(dev->bus_id, sizeof(dev->bus_id), | ||
396 | "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1); | ||
397 | |||
398 | error = device_add(dev); | 402 | error = device_add(dev); |
399 | if (error) { | 403 | if (error) { |
400 | rfkill_remove_switch(rfkill); | 404 | rfkill_remove_switch(rfkill); |
401 | return error; | 405 | return error; |
402 | } | 406 | } |
403 | rfkill_led_trigger_register(rfkill); | ||
404 | 407 | ||
405 | return 0; | 408 | return 0; |
406 | } | 409 | } |
@@ -416,9 +419,9 @@ EXPORT_SYMBOL(rfkill_register); | |||
416 | */ | 419 | */ |
417 | void rfkill_unregister(struct rfkill *rfkill) | 420 | void rfkill_unregister(struct rfkill *rfkill) |
418 | { | 421 | { |
419 | rfkill_led_trigger_unregister(rfkill); | ||
420 | device_del(&rfkill->dev); | 422 | device_del(&rfkill->dev); |
421 | rfkill_remove_switch(rfkill); | 423 | rfkill_remove_switch(rfkill); |
424 | rfkill_led_trigger_unregister(rfkill); | ||
422 | put_device(&rfkill->dev); | 425 | put_device(&rfkill->dev); |
423 | } | 426 | } |
424 | EXPORT_SYMBOL(rfkill_unregister); | 427 | EXPORT_SYMBOL(rfkill_unregister); |
@@ -448,5 +451,5 @@ static void __exit rfkill_exit(void) | |||
448 | class_unregister(&rfkill_class); | 451 | class_unregister(&rfkill_class); |
449 | } | 452 | } |
450 | 453 | ||
451 | module_init(rfkill_init); | 454 | subsys_initcall(rfkill_init); |
452 | module_exit(rfkill_exit); | 455 | module_exit(rfkill_exit); |
diff --git a/net/rxrpc/ar-local.c b/net/rxrpc/ar-local.c index fe03f71f17da..f3a2bd747a8f 100644 --- a/net/rxrpc/ar-local.c +++ b/net/rxrpc/ar-local.c | |||
@@ -114,7 +114,7 @@ static int rxrpc_create_local(struct rxrpc_local *local) | |||
114 | return 0; | 114 | return 0; |
115 | 115 | ||
116 | error: | 116 | error: |
117 | local->socket->ops->shutdown(local->socket, 2); | 117 | kernel_sock_shutdown(local->socket, SHUT_RDWR); |
118 | local->socket->sk->sk_user_data = NULL; | 118 | local->socket->sk->sk_user_data = NULL; |
119 | sock_release(local->socket); | 119 | sock_release(local->socket); |
120 | local->socket = NULL; | 120 | local->socket = NULL; |
@@ -267,7 +267,7 @@ static void rxrpc_destroy_local(struct work_struct *work) | |||
267 | /* finish cleaning up the local descriptor */ | 267 | /* finish cleaning up the local descriptor */ |
268 | rxrpc_purge_queue(&local->accept_queue); | 268 | rxrpc_purge_queue(&local->accept_queue); |
269 | rxrpc_purge_queue(&local->reject_queue); | 269 | rxrpc_purge_queue(&local->reject_queue); |
270 | local->socket->ops->shutdown(local->socket, 2); | 270 | kernel_sock_shutdown(local->socket, SHUT_RDWR); |
271 | sock_release(local->socket); | 271 | sock_release(local->socket); |
272 | 272 | ||
273 | up_read(&rxrpc_local_sem); | 273 | up_read(&rxrpc_local_sem); |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 53171029439f..c39008209164 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -613,17 +613,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
613 | memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key)); | 613 | memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key)); |
614 | n->ht_up = ht; | 614 | n->ht_up = ht; |
615 | n->handle = handle; | 615 | n->handle = handle; |
616 | { | 616 | n->fshift = s->hmask ? ffs(ntohl(s->hmask)) - 1 : 0; |
617 | u8 i = 0; | ||
618 | u32 mask = ntohl(s->hmask); | ||
619 | if (mask) { | ||
620 | while (!(mask & 1)) { | ||
621 | i++; | ||
622 | mask>>=1; | ||
623 | } | ||
624 | } | ||
625 | n->fshift = i; | ||
626 | } | ||
627 | 617 | ||
628 | #ifdef CONFIG_CLS_U32_MARK | 618 | #ifdef CONFIG_CLS_U32_MARK |
629 | if (tb[TCA_U32_MARK-1]) { | 619 | if (tb[TCA_U32_MARK-1]) { |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index fa1a6f45dc41..e595e6570ce0 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -134,7 +134,7 @@ static inline int qdisc_restart(struct net_device *dev) | |||
134 | { | 134 | { |
135 | struct Qdisc *q = dev->qdisc; | 135 | struct Qdisc *q = dev->qdisc; |
136 | struct sk_buff *skb; | 136 | struct sk_buff *skb; |
137 | int ret; | 137 | int ret = NETDEV_TX_BUSY; |
138 | 138 | ||
139 | /* Dequeue packet */ | 139 | /* Dequeue packet */ |
140 | if (unlikely((skb = dev_dequeue_skb(dev, q)) == NULL)) | 140 | if (unlikely((skb = dev_dequeue_skb(dev, q)) == NULL)) |
@@ -145,7 +145,8 @@ static inline int qdisc_restart(struct net_device *dev) | |||
145 | spin_unlock(&dev->queue_lock); | 145 | spin_unlock(&dev->queue_lock); |
146 | 146 | ||
147 | HARD_TX_LOCK(dev, smp_processor_id()); | 147 | HARD_TX_LOCK(dev, smp_processor_id()); |
148 | ret = dev_hard_start_xmit(skb, dev); | 148 | if (!netif_subqueue_stopped(dev, skb)) |
149 | ret = dev_hard_start_xmit(skb, dev); | ||
149 | HARD_TX_UNLOCK(dev); | 150 | HARD_TX_UNLOCK(dev); |
150 | 151 | ||
151 | spin_lock(&dev->queue_lock); | 152 | spin_lock(&dev->queue_lock); |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 03158e3665da..013e3d3ab0f1 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -262,10 +262,14 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
262 | */ | 262 | */ |
263 | asoc->peer.sack_needed = 1; | 263 | asoc->peer.sack_needed = 1; |
264 | 264 | ||
265 | /* Assume that the peer recongizes ASCONF until reported otherwise | 265 | /* Assume that the peer will tell us if he recognizes ASCONF |
266 | * via an ERROR chunk. | 266 | * as part of INIT exchange. |
267 | * The sctp_addip_noauth option is there for backward compatibilty | ||
268 | * and will revert old behavior. | ||
267 | */ | 269 | */ |
268 | asoc->peer.asconf_capable = 1; | 270 | asoc->peer.asconf_capable = 0; |
271 | if (sctp_addip_noauth) | ||
272 | asoc->peer.asconf_capable = 1; | ||
269 | 273 | ||
270 | /* Create an input queue. */ | 274 | /* Create an input queue. */ |
271 | sctp_inq_init(&asoc->base.inqueue); | 275 | sctp_inq_init(&asoc->base.inqueue); |
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index dfffa94fb9f6..cae95af9a8cc 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c | |||
@@ -180,9 +180,7 @@ int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new, | |||
180 | /* Delete an address from the bind address list in the SCTP_bind_addr | 180 | /* Delete an address from the bind address list in the SCTP_bind_addr |
181 | * structure. | 181 | * structure. |
182 | */ | 182 | */ |
183 | int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr, | 183 | int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr) |
184 | void fastcall (*rcu_call)(struct rcu_head *head, | ||
185 | void (*func)(struct rcu_head *head))) | ||
186 | { | 184 | { |
187 | struct sctp_sockaddr_entry *addr, *temp; | 185 | struct sctp_sockaddr_entry *addr, *temp; |
188 | 186 | ||
@@ -198,15 +196,10 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr, | |||
198 | } | 196 | } |
199 | } | 197 | } |
200 | 198 | ||
201 | /* Call the rcu callback provided in the args. This function is | ||
202 | * called by both BH packet processing and user side socket option | ||
203 | * processing, but it works on different lists in those 2 contexts. | ||
204 | * Each context provides it's own callback, whether call_rcu_bh() | ||
205 | * or call_rcu(), to make sure that we wait for an appropriate time. | ||
206 | */ | ||
207 | if (addr && !addr->valid) { | 199 | if (addr && !addr->valid) { |
208 | rcu_call(&addr->rcu, sctp_local_addr_free); | 200 | call_rcu(&addr->rcu, sctp_local_addr_free); |
209 | SCTP_DBG_OBJCNT_DEC(addr); | 201 | SCTP_DBG_OBJCNT_DEC(addr); |
202 | return 0; | ||
210 | } | 203 | } |
211 | 204 | ||
212 | return -EINVAL; | 205 | return -EINVAL; |
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 2d2d81ef4a69..de6f505d6ff8 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c | |||
@@ -328,24 +328,35 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc( | |||
328 | const union sctp_addr *paddr, | 328 | const union sctp_addr *paddr, |
329 | struct sctp_transport **transport) | 329 | struct sctp_transport **transport) |
330 | { | 330 | { |
331 | struct sctp_association *asoc = NULL; | ||
332 | struct sctp_transport *t = NULL; | ||
333 | struct sctp_hashbucket *head; | ||
334 | struct sctp_ep_common *epb; | ||
335 | struct hlist_node *node; | ||
336 | int hash; | ||
331 | int rport; | 337 | int rport; |
332 | struct sctp_association *asoc; | ||
333 | struct list_head *pos; | ||
334 | 338 | ||
339 | *transport = NULL; | ||
335 | rport = ntohs(paddr->v4.sin_port); | 340 | rport = ntohs(paddr->v4.sin_port); |
336 | 341 | ||
337 | list_for_each(pos, &ep->asocs) { | 342 | hash = sctp_assoc_hashfn(ep->base.bind_addr.port, rport); |
338 | asoc = list_entry(pos, struct sctp_association, asocs); | 343 | head = &sctp_assoc_hashtable[hash]; |
339 | if (rport == asoc->peer.port) { | 344 | read_lock(&head->lock); |
340 | *transport = sctp_assoc_lookup_paddr(asoc, paddr); | 345 | sctp_for_each_hentry(epb, node, &head->chain) { |
341 | 346 | asoc = sctp_assoc(epb); | |
342 | if (*transport) | 347 | if (asoc->ep != ep || rport != asoc->peer.port) |
343 | return asoc; | 348 | goto next; |
349 | |||
350 | t = sctp_assoc_lookup_paddr(asoc, paddr); | ||
351 | if (t) { | ||
352 | *transport = t; | ||
353 | break; | ||
344 | } | 354 | } |
355 | next: | ||
356 | asoc = NULL; | ||
345 | } | 357 | } |
346 | 358 | read_unlock(&head->lock); | |
347 | *transport = NULL; | 359 | return asoc; |
348 | return NULL; | ||
349 | } | 360 | } |
350 | 361 | ||
351 | /* Lookup association on an endpoint based on a peer address. BH-safe. */ | 362 | /* Lookup association on an endpoint based on a peer address. BH-safe. */ |
diff --git a/net/sctp/input.c b/net/sctp/input.c index 86503e7fa21e..91ae463b079b 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -656,7 +656,6 @@ discard: | |||
656 | /* Insert endpoint into the hash table. */ | 656 | /* Insert endpoint into the hash table. */ |
657 | static void __sctp_hash_endpoint(struct sctp_endpoint *ep) | 657 | static void __sctp_hash_endpoint(struct sctp_endpoint *ep) |
658 | { | 658 | { |
659 | struct sctp_ep_common **epp; | ||
660 | struct sctp_ep_common *epb; | 659 | struct sctp_ep_common *epb; |
661 | struct sctp_hashbucket *head; | 660 | struct sctp_hashbucket *head; |
662 | 661 | ||
@@ -666,12 +665,7 @@ static void __sctp_hash_endpoint(struct sctp_endpoint *ep) | |||
666 | head = &sctp_ep_hashtable[epb->hashent]; | 665 | head = &sctp_ep_hashtable[epb->hashent]; |
667 | 666 | ||
668 | sctp_write_lock(&head->lock); | 667 | sctp_write_lock(&head->lock); |
669 | epp = &head->chain; | 668 | hlist_add_head(&epb->node, &head->chain); |
670 | epb->next = *epp; | ||
671 | if (epb->next) | ||
672 | (*epp)->pprev = &epb->next; | ||
673 | *epp = epb; | ||
674 | epb->pprev = epp; | ||
675 | sctp_write_unlock(&head->lock); | 669 | sctp_write_unlock(&head->lock); |
676 | } | 670 | } |
677 | 671 | ||
@@ -691,19 +685,15 @@ static void __sctp_unhash_endpoint(struct sctp_endpoint *ep) | |||
691 | 685 | ||
692 | epb = &ep->base; | 686 | epb = &ep->base; |
693 | 687 | ||
688 | if (hlist_unhashed(&epb->node)) | ||
689 | return; | ||
690 | |||
694 | epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); | 691 | epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); |
695 | 692 | ||
696 | head = &sctp_ep_hashtable[epb->hashent]; | 693 | head = &sctp_ep_hashtable[epb->hashent]; |
697 | 694 | ||
698 | sctp_write_lock(&head->lock); | 695 | sctp_write_lock(&head->lock); |
699 | 696 | __hlist_del(&epb->node); | |
700 | if (epb->pprev) { | ||
701 | if (epb->next) | ||
702 | epb->next->pprev = epb->pprev; | ||
703 | *epb->pprev = epb->next; | ||
704 | epb->pprev = NULL; | ||
705 | } | ||
706 | |||
707 | sctp_write_unlock(&head->lock); | 697 | sctp_write_unlock(&head->lock); |
708 | } | 698 | } |
709 | 699 | ||
@@ -721,12 +711,13 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *l | |||
721 | struct sctp_hashbucket *head; | 711 | struct sctp_hashbucket *head; |
722 | struct sctp_ep_common *epb; | 712 | struct sctp_ep_common *epb; |
723 | struct sctp_endpoint *ep; | 713 | struct sctp_endpoint *ep; |
714 | struct hlist_node *node; | ||
724 | int hash; | 715 | int hash; |
725 | 716 | ||
726 | hash = sctp_ep_hashfn(ntohs(laddr->v4.sin_port)); | 717 | hash = sctp_ep_hashfn(ntohs(laddr->v4.sin_port)); |
727 | head = &sctp_ep_hashtable[hash]; | 718 | head = &sctp_ep_hashtable[hash]; |
728 | read_lock(&head->lock); | 719 | read_lock(&head->lock); |
729 | for (epb = head->chain; epb; epb = epb->next) { | 720 | sctp_for_each_hentry(epb, node, &head->chain) { |
730 | ep = sctp_ep(epb); | 721 | ep = sctp_ep(epb); |
731 | if (sctp_endpoint_is_match(ep, laddr)) | 722 | if (sctp_endpoint_is_match(ep, laddr)) |
732 | goto hit; | 723 | goto hit; |
@@ -744,7 +735,6 @@ hit: | |||
744 | /* Insert association into the hash table. */ | 735 | /* Insert association into the hash table. */ |
745 | static void __sctp_hash_established(struct sctp_association *asoc) | 736 | static void __sctp_hash_established(struct sctp_association *asoc) |
746 | { | 737 | { |
747 | struct sctp_ep_common **epp; | ||
748 | struct sctp_ep_common *epb; | 738 | struct sctp_ep_common *epb; |
749 | struct sctp_hashbucket *head; | 739 | struct sctp_hashbucket *head; |
750 | 740 | ||
@@ -756,12 +746,7 @@ static void __sctp_hash_established(struct sctp_association *asoc) | |||
756 | head = &sctp_assoc_hashtable[epb->hashent]; | 746 | head = &sctp_assoc_hashtable[epb->hashent]; |
757 | 747 | ||
758 | sctp_write_lock(&head->lock); | 748 | sctp_write_lock(&head->lock); |
759 | epp = &head->chain; | 749 | hlist_add_head(&epb->node, &head->chain); |
760 | epb->next = *epp; | ||
761 | if (epb->next) | ||
762 | (*epp)->pprev = &epb->next; | ||
763 | *epp = epb; | ||
764 | epb->pprev = epp; | ||
765 | sctp_write_unlock(&head->lock); | 750 | sctp_write_unlock(&head->lock); |
766 | } | 751 | } |
767 | 752 | ||
@@ -790,14 +775,7 @@ static void __sctp_unhash_established(struct sctp_association *asoc) | |||
790 | head = &sctp_assoc_hashtable[epb->hashent]; | 775 | head = &sctp_assoc_hashtable[epb->hashent]; |
791 | 776 | ||
792 | sctp_write_lock(&head->lock); | 777 | sctp_write_lock(&head->lock); |
793 | 778 | __hlist_del(&epb->node); | |
794 | if (epb->pprev) { | ||
795 | if (epb->next) | ||
796 | epb->next->pprev = epb->pprev; | ||
797 | *epb->pprev = epb->next; | ||
798 | epb->pprev = NULL; | ||
799 | } | ||
800 | |||
801 | sctp_write_unlock(&head->lock); | 779 | sctp_write_unlock(&head->lock); |
802 | } | 780 | } |
803 | 781 | ||
@@ -822,6 +800,7 @@ static struct sctp_association *__sctp_lookup_association( | |||
822 | struct sctp_ep_common *epb; | 800 | struct sctp_ep_common *epb; |
823 | struct sctp_association *asoc; | 801 | struct sctp_association *asoc; |
824 | struct sctp_transport *transport; | 802 | struct sctp_transport *transport; |
803 | struct hlist_node *node; | ||
825 | int hash; | 804 | int hash; |
826 | 805 | ||
827 | /* Optimize here for direct hit, only listening connections can | 806 | /* Optimize here for direct hit, only listening connections can |
@@ -830,7 +809,7 @@ static struct sctp_association *__sctp_lookup_association( | |||
830 | hash = sctp_assoc_hashfn(ntohs(local->v4.sin_port), ntohs(peer->v4.sin_port)); | 809 | hash = sctp_assoc_hashfn(ntohs(local->v4.sin_port), ntohs(peer->v4.sin_port)); |
831 | head = &sctp_assoc_hashtable[hash]; | 810 | head = &sctp_assoc_hashtable[hash]; |
832 | read_lock(&head->lock); | 811 | read_lock(&head->lock); |
833 | for (epb = head->chain; epb; epb = epb->next) { | 812 | sctp_for_each_hentry(epb, node, &head->chain) { |
834 | asoc = sctp_assoc(epb); | 813 | asoc = sctp_assoc(epb); |
835 | transport = sctp_assoc_is_match(asoc, local, peer); | 814 | transport = sctp_assoc_is_match(asoc, local, peer); |
836 | if (transport) | 815 | if (transport) |
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c index f10fe7fbf24c..cf4b7eb023b3 100644 --- a/net/sctp/inqueue.c +++ b/net/sctp/inqueue.c | |||
@@ -90,6 +90,10 @@ void sctp_inq_free(struct sctp_inq *queue) | |||
90 | void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk) | 90 | void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk) |
91 | { | 91 | { |
92 | /* Directly call the packet handling routine. */ | 92 | /* Directly call the packet handling routine. */ |
93 | if (chunk->rcvr->dead) { | ||
94 | sctp_chunk_free(chunk); | ||
95 | return; | ||
96 | } | ||
93 | 97 | ||
94 | /* We are now calling this either from the soft interrupt | 98 | /* We are now calling this either from the soft interrupt |
95 | * or from the backlog processing. | 99 | * or from the backlog processing. |
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index 28f4fe77ceee..fa76f235169b 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -382,7 +382,7 @@ static void sctp_insert_list(struct list_head *head, struct list_head *new) | |||
382 | /* Mark all the eligible packets on a transport for retransmission. */ | 382 | /* Mark all the eligible packets on a transport for retransmission. */ |
383 | void sctp_retransmit_mark(struct sctp_outq *q, | 383 | void sctp_retransmit_mark(struct sctp_outq *q, |
384 | struct sctp_transport *transport, | 384 | struct sctp_transport *transport, |
385 | __u8 fast_retransmit) | 385 | __u8 reason) |
386 | { | 386 | { |
387 | struct list_head *lchunk, *ltemp; | 387 | struct list_head *lchunk, *ltemp; |
388 | struct sctp_chunk *chunk; | 388 | struct sctp_chunk *chunk; |
@@ -412,20 +412,20 @@ void sctp_retransmit_mark(struct sctp_outq *q, | |||
412 | continue; | 412 | continue; |
413 | } | 413 | } |
414 | 414 | ||
415 | /* If we are doing retransmission due to a fast retransmit, | 415 | /* If we are doing retransmission due to a timeout or pmtu |
416 | * only the chunk's that are marked for fast retransmit | 416 | * discovery, only the chunks that are not yet acked should |
417 | * should be added to the retransmit queue. If we are doing | 417 | * be added to the retransmit queue. |
418 | * retransmission due to a timeout or pmtu discovery, only the | ||
419 | * chunks that are not yet acked should be added to the | ||
420 | * retransmit queue. | ||
421 | */ | 418 | */ |
422 | if ((fast_retransmit && (chunk->fast_retransmit > 0)) || | 419 | if ((reason == SCTP_RTXR_FAST_RTX && |
423 | (!fast_retransmit && !chunk->tsn_gap_acked)) { | 420 | (chunk->fast_retransmit > 0)) || |
421 | (reason != SCTP_RTXR_FAST_RTX && !chunk->tsn_gap_acked)) { | ||
424 | /* If this chunk was sent less then 1 rto ago, do not | 422 | /* If this chunk was sent less then 1 rto ago, do not |
425 | * retransmit this chunk, but give the peer time | 423 | * retransmit this chunk, but give the peer time |
426 | * to acknowlege it. | 424 | * to acknowlege it. Do this only when |
425 | * retransmitting due to T3 timeout. | ||
427 | */ | 426 | */ |
428 | if ((jiffies - chunk->sent_at) < transport->rto) | 427 | if (reason == SCTP_RTXR_T3_RTX && |
428 | (jiffies - chunk->sent_at) < transport->last_rto) | ||
429 | continue; | 429 | continue; |
430 | 430 | ||
431 | /* RFC 2960 6.2.1 Processing a Received SACK | 431 | /* RFC 2960 6.2.1 Processing a Received SACK |
@@ -467,10 +467,10 @@ void sctp_retransmit_mark(struct sctp_outq *q, | |||
467 | } | 467 | } |
468 | } | 468 | } |
469 | 469 | ||
470 | SCTP_DEBUG_PRINTK("%s: transport: %p, fast_retransmit: %d, " | 470 | SCTP_DEBUG_PRINTK("%s: transport: %p, reason: %d, " |
471 | "cwnd: %d, ssthresh: %d, flight_size: %d, " | 471 | "cwnd: %d, ssthresh: %d, flight_size: %d, " |
472 | "pba: %d\n", __FUNCTION__, | 472 | "pba: %d\n", __FUNCTION__, |
473 | transport, fast_retransmit, | 473 | transport, reason, |
474 | transport->cwnd, transport->ssthresh, | 474 | transport->cwnd, transport->ssthresh, |
475 | transport->flight_size, | 475 | transport->flight_size, |
476 | transport->partial_bytes_acked); | 476 | transport->partial_bytes_acked); |
@@ -484,7 +484,6 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport, | |||
484 | sctp_retransmit_reason_t reason) | 484 | sctp_retransmit_reason_t reason) |
485 | { | 485 | { |
486 | int error = 0; | 486 | int error = 0; |
487 | __u8 fast_retransmit = 0; | ||
488 | 487 | ||
489 | switch(reason) { | 488 | switch(reason) { |
490 | case SCTP_RTXR_T3_RTX: | 489 | case SCTP_RTXR_T3_RTX: |
@@ -499,16 +498,18 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport, | |||
499 | case SCTP_RTXR_FAST_RTX: | 498 | case SCTP_RTXR_FAST_RTX: |
500 | SCTP_INC_STATS(SCTP_MIB_FAST_RETRANSMITS); | 499 | SCTP_INC_STATS(SCTP_MIB_FAST_RETRANSMITS); |
501 | sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_FAST_RTX); | 500 | sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_FAST_RTX); |
502 | fast_retransmit = 1; | ||
503 | break; | 501 | break; |
504 | case SCTP_RTXR_PMTUD: | 502 | case SCTP_RTXR_PMTUD: |
505 | SCTP_INC_STATS(SCTP_MIB_PMTUD_RETRANSMITS); | 503 | SCTP_INC_STATS(SCTP_MIB_PMTUD_RETRANSMITS); |
506 | break; | 504 | break; |
505 | case SCTP_RTXR_T1_RTX: | ||
506 | SCTP_INC_STATS(SCTP_MIB_T1_RETRANSMITS); | ||
507 | break; | ||
507 | default: | 508 | default: |
508 | BUG(); | 509 | BUG(); |
509 | } | 510 | } |
510 | 511 | ||
511 | sctp_retransmit_mark(q, transport, fast_retransmit); | 512 | sctp_retransmit_mark(q, transport, reason); |
512 | 513 | ||
513 | /* PR-SCTP A5) Any time the T3-rtx timer expires, on any destination, | 514 | /* PR-SCTP A5) Any time the T3-rtx timer expires, on any destination, |
514 | * the sender SHOULD try to advance the "Advanced.Peer.Ack.Point" by | 515 | * the sender SHOULD try to advance the "Advanced.Peer.Ack.Point" by |
@@ -641,7 +642,8 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt, | |||
641 | 642 | ||
642 | /* If we are here due to a retransmit timeout or a fast | 643 | /* If we are here due to a retransmit timeout or a fast |
643 | * retransmit and if there are any chunks left in the retransmit | 644 | * retransmit and if there are any chunks left in the retransmit |
644 | * queue that could not fit in the PMTU sized packet, they need * to be marked as ineligible for a subsequent fast retransmit. | 645 | * queue that could not fit in the PMTU sized packet, they need |
646 | * to be marked as ineligible for a subsequent fast retransmit. | ||
645 | */ | 647 | */ |
646 | if (rtx_timeout && !lchunk) { | 648 | if (rtx_timeout && !lchunk) { |
647 | list_for_each(lchunk1, lqueue) { | 649 | list_for_each(lchunk1, lqueue) { |
@@ -660,10 +662,9 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt, | |||
660 | int sctp_outq_uncork(struct sctp_outq *q) | 662 | int sctp_outq_uncork(struct sctp_outq *q) |
661 | { | 663 | { |
662 | int error = 0; | 664 | int error = 0; |
663 | if (q->cork) { | 665 | if (q->cork) |
664 | q->cork = 0; | 666 | q->cork = 0; |
665 | error = sctp_outq_flush(q, 0); | 667 | error = sctp_outq_flush(q, 0); |
666 | } | ||
667 | return error; | 668 | return error; |
668 | } | 669 | } |
669 | 670 | ||
diff --git a/net/sctp/proc.c b/net/sctp/proc.c index e4cd841a22e4..249973204070 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c | |||
@@ -225,6 +225,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v) | |||
225 | struct sctp_ep_common *epb; | 225 | struct sctp_ep_common *epb; |
226 | struct sctp_endpoint *ep; | 226 | struct sctp_endpoint *ep; |
227 | struct sock *sk; | 227 | struct sock *sk; |
228 | struct hlist_node *node; | ||
228 | int hash = *(loff_t *)v; | 229 | int hash = *(loff_t *)v; |
229 | 230 | ||
230 | if (hash >= sctp_ep_hashsize) | 231 | if (hash >= sctp_ep_hashsize) |
@@ -233,7 +234,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v) | |||
233 | head = &sctp_ep_hashtable[hash]; | 234 | head = &sctp_ep_hashtable[hash]; |
234 | sctp_local_bh_disable(); | 235 | sctp_local_bh_disable(); |
235 | read_lock(&head->lock); | 236 | read_lock(&head->lock); |
236 | for (epb = head->chain; epb; epb = epb->next) { | 237 | sctp_for_each_hentry(epb, node, &head->chain) { |
237 | ep = sctp_ep(epb); | 238 | ep = sctp_ep(epb); |
238 | sk = epb->sk; | 239 | sk = epb->sk; |
239 | seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk, | 240 | seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk, |
@@ -328,6 +329,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) | |||
328 | struct sctp_ep_common *epb; | 329 | struct sctp_ep_common *epb; |
329 | struct sctp_association *assoc; | 330 | struct sctp_association *assoc; |
330 | struct sock *sk; | 331 | struct sock *sk; |
332 | struct hlist_node *node; | ||
331 | int hash = *(loff_t *)v; | 333 | int hash = *(loff_t *)v; |
332 | 334 | ||
333 | if (hash >= sctp_assoc_hashsize) | 335 | if (hash >= sctp_assoc_hashsize) |
@@ -336,7 +338,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) | |||
336 | head = &sctp_assoc_hashtable[hash]; | 338 | head = &sctp_assoc_hashtable[hash]; |
337 | sctp_local_bh_disable(); | 339 | sctp_local_bh_disable(); |
338 | read_lock(&head->lock); | 340 | read_lock(&head->lock); |
339 | for (epb = head->chain; epb; epb = epb->next) { | 341 | sctp_for_each_hentry(epb, node, &head->chain) { |
340 | assoc = sctp_assoc(epb); | 342 | assoc = sctp_assoc(epb); |
341 | sk = epb->sk; | 343 | sk = epb->sk; |
342 | seq_printf(seq, | 344 | seq_printf(seq, |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 40c1a47d1b8d..d50f610d1b02 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -1137,7 +1137,7 @@ SCTP_STATIC __init int sctp_init(void) | |||
1137 | } | 1137 | } |
1138 | for (i = 0; i < sctp_assoc_hashsize; i++) { | 1138 | for (i = 0; i < sctp_assoc_hashsize; i++) { |
1139 | rwlock_init(&sctp_assoc_hashtable[i].lock); | 1139 | rwlock_init(&sctp_assoc_hashtable[i].lock); |
1140 | sctp_assoc_hashtable[i].chain = NULL; | 1140 | INIT_HLIST_HEAD(&sctp_assoc_hashtable[i].chain); |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | /* Allocate and initialize the endpoint hash table. */ | 1143 | /* Allocate and initialize the endpoint hash table. */ |
@@ -1151,7 +1151,7 @@ SCTP_STATIC __init int sctp_init(void) | |||
1151 | } | 1151 | } |
1152 | for (i = 0; i < sctp_ep_hashsize; i++) { | 1152 | for (i = 0; i < sctp_ep_hashsize; i++) { |
1153 | rwlock_init(&sctp_ep_hashtable[i].lock); | 1153 | rwlock_init(&sctp_ep_hashtable[i].lock); |
1154 | sctp_ep_hashtable[i].chain = NULL; | 1154 | INIT_HLIST_HEAD(&sctp_ep_hashtable[i].chain); |
1155 | } | 1155 | } |
1156 | 1156 | ||
1157 | /* Allocate and initialize the SCTP port hash table. */ | 1157 | /* Allocate and initialize the SCTP port hash table. */ |
@@ -1170,7 +1170,7 @@ SCTP_STATIC __init int sctp_init(void) | |||
1170 | } | 1170 | } |
1171 | for (i = 0; i < sctp_port_hashsize; i++) { | 1171 | for (i = 0; i < sctp_port_hashsize; i++) { |
1172 | spin_lock_init(&sctp_port_hashtable[i].lock); | 1172 | spin_lock_init(&sctp_port_hashtable[i].lock); |
1173 | sctp_port_hashtable[i].chain = NULL; | 1173 | INIT_HLIST_HEAD(&sctp_port_hashtable[i].chain); |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | printk(KERN_INFO "SCTP: Hash tables configured " | 1176 | printk(KERN_INFO "SCTP: Hash tables configured " |
@@ -1179,6 +1179,7 @@ SCTP_STATIC __init int sctp_init(void) | |||
1179 | 1179 | ||
1180 | /* Disable ADDIP by default. */ | 1180 | /* Disable ADDIP by default. */ |
1181 | sctp_addip_enable = 0; | 1181 | sctp_addip_enable = 0; |
1182 | sctp_addip_noauth = 0; | ||
1182 | 1183 | ||
1183 | /* Enable PR-SCTP by default. */ | 1184 | /* Enable PR-SCTP by default. */ |
1184 | sctp_prsctp_enable = 1; | 1185 | sctp_prsctp_enable = 1; |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index c377e4e8f653..5a9783c38de1 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1788,9 +1788,14 @@ static int sctp_process_inv_paramlength(const struct sctp_association *asoc, | |||
1788 | sizeof(sctp_paramhdr_t); | 1788 | sizeof(sctp_paramhdr_t); |
1789 | 1789 | ||
1790 | 1790 | ||
1791 | /* This is a fatal error. Any accumulated non-fatal errors are | ||
1792 | * not reported. | ||
1793 | */ | ||
1794 | if (*errp) | ||
1795 | sctp_chunk_free(*errp); | ||
1796 | |||
1791 | /* Create an error chunk and fill it in with our payload. */ | 1797 | /* Create an error chunk and fill it in with our payload. */ |
1792 | if (!*errp) | 1798 | *errp = sctp_make_op_error_space(asoc, chunk, payload_len); |
1793 | *errp = sctp_make_op_error_space(asoc, chunk, payload_len); | ||
1794 | 1799 | ||
1795 | if (*errp) { | 1800 | if (*errp) { |
1796 | sctp_init_cause(*errp, SCTP_ERROR_PROTO_VIOLATION, | 1801 | sctp_init_cause(*errp, SCTP_ERROR_PROTO_VIOLATION, |
@@ -1813,9 +1818,15 @@ static int sctp_process_hn_param(const struct sctp_association *asoc, | |||
1813 | { | 1818 | { |
1814 | __u16 len = ntohs(param.p->length); | 1819 | __u16 len = ntohs(param.p->length); |
1815 | 1820 | ||
1816 | /* Make an ERROR chunk. */ | 1821 | /* Processing of the HOST_NAME parameter will generate an |
1817 | if (!*errp) | 1822 | * ABORT. If we've accumulated any non-fatal errors, they |
1818 | *errp = sctp_make_op_error_space(asoc, chunk, len); | 1823 | * would be unrecognized parameters and we should not include |
1824 | * them in the ABORT. | ||
1825 | */ | ||
1826 | if (*errp) | ||
1827 | sctp_chunk_free(*errp); | ||
1828 | |||
1829 | *errp = sctp_make_op_error_space(asoc, chunk, len); | ||
1819 | 1830 | ||
1820 | if (*errp) { | 1831 | if (*errp) { |
1821 | sctp_init_cause(*errp, SCTP_ERROR_DNS_FAILED, len); | 1832 | sctp_init_cause(*errp, SCTP_ERROR_DNS_FAILED, len); |
@@ -1847,7 +1858,7 @@ static void sctp_process_ext_param(struct sctp_association *asoc, | |||
1847 | break; | 1858 | break; |
1848 | case SCTP_CID_ASCONF: | 1859 | case SCTP_CID_ASCONF: |
1849 | case SCTP_CID_ASCONF_ACK: | 1860 | case SCTP_CID_ASCONF_ACK: |
1850 | asoc->peer.addip_capable = 1; | 1861 | asoc->peer.asconf_capable = 1; |
1851 | break; | 1862 | break; |
1852 | default: | 1863 | default: |
1853 | break; | 1864 | break; |
@@ -1862,56 +1873,40 @@ static void sctp_process_ext_param(struct sctp_association *asoc, | |||
1862 | * taken if the processing endpoint does not recognize the | 1873 | * taken if the processing endpoint does not recognize the |
1863 | * Parameter Type. | 1874 | * Parameter Type. |
1864 | * | 1875 | * |
1865 | * 00 - Stop processing this SCTP chunk and discard it, | 1876 | * 00 - Stop processing this parameter; do not process any further |
1866 | * do not process any further chunks within it. | 1877 | * parameters within this chunk |
1867 | * | 1878 | * |
1868 | * 01 - Stop processing this SCTP chunk and discard it, | 1879 | * 01 - Stop processing this parameter, do not process any further |
1869 | * do not process any further chunks within it, and report | 1880 | * parameters within this chunk, and report the unrecognized |
1870 | * the unrecognized parameter in an 'Unrecognized | 1881 | * parameter in an 'Unrecognized Parameter' ERROR chunk. |
1871 | * Parameter Type' (in either an ERROR or in the INIT ACK). | ||
1872 | * | 1882 | * |
1873 | * 10 - Skip this parameter and continue processing. | 1883 | * 10 - Skip this parameter and continue processing. |
1874 | * | 1884 | * |
1875 | * 11 - Skip this parameter and continue processing but | 1885 | * 11 - Skip this parameter and continue processing but |
1876 | * report the unrecognized parameter in an | 1886 | * report the unrecognized parameter in an |
1877 | * 'Unrecognized Parameter Type' (in either an ERROR or in | 1887 | * 'Unrecognized Parameter' ERROR chunk. |
1878 | * the INIT ACK). | ||
1879 | * | 1888 | * |
1880 | * Return value: | 1889 | * Return value: |
1881 | * 0 - discard the chunk | 1890 | * SCTP_IERROR_NO_ERROR - continue with the chunk |
1882 | * 1 - continue with the chunk | 1891 | * SCTP_IERROR_ERROR - stop and report an error. |
1892 | * SCTP_IERROR_NOMEME - out of memory. | ||
1883 | */ | 1893 | */ |
1884 | static int sctp_process_unk_param(const struct sctp_association *asoc, | 1894 | static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc, |
1885 | union sctp_params param, | 1895 | union sctp_params param, |
1886 | struct sctp_chunk *chunk, | 1896 | struct sctp_chunk *chunk, |
1887 | struct sctp_chunk **errp) | 1897 | struct sctp_chunk **errp) |
1888 | { | 1898 | { |
1889 | int retval = 1; | 1899 | int retval = SCTP_IERROR_NO_ERROR; |
1890 | 1900 | ||
1891 | switch (param.p->type & SCTP_PARAM_ACTION_MASK) { | 1901 | switch (param.p->type & SCTP_PARAM_ACTION_MASK) { |
1892 | case SCTP_PARAM_ACTION_DISCARD: | 1902 | case SCTP_PARAM_ACTION_DISCARD: |
1893 | retval = 0; | 1903 | retval = SCTP_IERROR_ERROR; |
1894 | break; | ||
1895 | case SCTP_PARAM_ACTION_DISCARD_ERR: | ||
1896 | retval = 0; | ||
1897 | /* Make an ERROR chunk, preparing enough room for | ||
1898 | * returning multiple unknown parameters. | ||
1899 | */ | ||
1900 | if (NULL == *errp) | ||
1901 | *errp = sctp_make_op_error_space(asoc, chunk, | ||
1902 | ntohs(chunk->chunk_hdr->length)); | ||
1903 | |||
1904 | if (*errp) { | ||
1905 | sctp_init_cause(*errp, SCTP_ERROR_UNKNOWN_PARAM, | ||
1906 | WORD_ROUND(ntohs(param.p->length))); | ||
1907 | sctp_addto_chunk(*errp, | ||
1908 | WORD_ROUND(ntohs(param.p->length)), | ||
1909 | param.v); | ||
1910 | } | ||
1911 | |||
1912 | break; | 1904 | break; |
1913 | case SCTP_PARAM_ACTION_SKIP: | 1905 | case SCTP_PARAM_ACTION_SKIP: |
1914 | break; | 1906 | break; |
1907 | case SCTP_PARAM_ACTION_DISCARD_ERR: | ||
1908 | retval = SCTP_IERROR_ERROR; | ||
1909 | /* Fall through */ | ||
1915 | case SCTP_PARAM_ACTION_SKIP_ERR: | 1910 | case SCTP_PARAM_ACTION_SKIP_ERR: |
1916 | /* Make an ERROR chunk, preparing enough room for | 1911 | /* Make an ERROR chunk, preparing enough room for |
1917 | * returning multiple unknown parameters. | 1912 | * returning multiple unknown parameters. |
@@ -1932,9 +1927,8 @@ static int sctp_process_unk_param(const struct sctp_association *asoc, | |||
1932 | * to the peer and the association won't be | 1927 | * to the peer and the association won't be |
1933 | * established. | 1928 | * established. |
1934 | */ | 1929 | */ |
1935 | retval = 0; | 1930 | retval = SCTP_IERROR_NOMEM; |
1936 | } | 1931 | } |
1937 | |||
1938 | break; | 1932 | break; |
1939 | default: | 1933 | default: |
1940 | break; | 1934 | break; |
@@ -1943,18 +1937,20 @@ static int sctp_process_unk_param(const struct sctp_association *asoc, | |||
1943 | return retval; | 1937 | return retval; |
1944 | } | 1938 | } |
1945 | 1939 | ||
1946 | /* Find unrecognized parameters in the chunk. | 1940 | /* Verify variable length parameters |
1947 | * Return values: | 1941 | * Return values: |
1948 | * 0 - discard the chunk | 1942 | * SCTP_IERROR_ABORT - trigger an ABORT |
1949 | * 1 - continue with the chunk | 1943 | * SCTP_IERROR_NOMEM - out of memory (abort) |
1944 | * SCTP_IERROR_ERROR - stop processing, trigger an ERROR | ||
1945 | * SCTP_IERROR_NO_ERROR - continue with the chunk | ||
1950 | */ | 1946 | */ |
1951 | static int sctp_verify_param(const struct sctp_association *asoc, | 1947 | static sctp_ierror_t sctp_verify_param(const struct sctp_association *asoc, |
1952 | union sctp_params param, | 1948 | union sctp_params param, |
1953 | sctp_cid_t cid, | 1949 | sctp_cid_t cid, |
1954 | struct sctp_chunk *chunk, | 1950 | struct sctp_chunk *chunk, |
1955 | struct sctp_chunk **err_chunk) | 1951 | struct sctp_chunk **err_chunk) |
1956 | { | 1952 | { |
1957 | int retval = 1; | 1953 | int retval = SCTP_IERROR_NO_ERROR; |
1958 | 1954 | ||
1959 | /* FIXME - This routine is not looking at each parameter per the | 1955 | /* FIXME - This routine is not looking at each parameter per the |
1960 | * chunk type, i.e., unrecognized parameters should be further | 1956 | * chunk type, i.e., unrecognized parameters should be further |
@@ -1976,7 +1972,9 @@ static int sctp_verify_param(const struct sctp_association *asoc, | |||
1976 | 1972 | ||
1977 | case SCTP_PARAM_HOST_NAME_ADDRESS: | 1973 | case SCTP_PARAM_HOST_NAME_ADDRESS: |
1978 | /* Tell the peer, we won't support this param. */ | 1974 | /* Tell the peer, we won't support this param. */ |
1979 | return sctp_process_hn_param(asoc, param, chunk, err_chunk); | 1975 | sctp_process_hn_param(asoc, param, chunk, err_chunk); |
1976 | retval = SCTP_IERROR_ABORT; | ||
1977 | break; | ||
1980 | 1978 | ||
1981 | case SCTP_PARAM_FWD_TSN_SUPPORT: | 1979 | case SCTP_PARAM_FWD_TSN_SUPPORT: |
1982 | if (sctp_prsctp_enable) | 1980 | if (sctp_prsctp_enable) |
@@ -1993,9 +1991,11 @@ static int sctp_verify_param(const struct sctp_association *asoc, | |||
1993 | * cause 'Protocol Violation'. | 1991 | * cause 'Protocol Violation'. |
1994 | */ | 1992 | */ |
1995 | if (SCTP_AUTH_RANDOM_LENGTH != | 1993 | if (SCTP_AUTH_RANDOM_LENGTH != |
1996 | ntohs(param.p->length) - sizeof(sctp_paramhdr_t)) | 1994 | ntohs(param.p->length) - sizeof(sctp_paramhdr_t)) { |
1997 | return sctp_process_inv_paramlength(asoc, param.p, | 1995 | sctp_process_inv_paramlength(asoc, param.p, |
1998 | chunk, err_chunk); | 1996 | chunk, err_chunk); |
1997 | retval = SCTP_IERROR_ABORT; | ||
1998 | } | ||
1999 | break; | 1999 | break; |
2000 | 2000 | ||
2001 | case SCTP_PARAM_CHUNKS: | 2001 | case SCTP_PARAM_CHUNKS: |
@@ -2007,9 +2007,11 @@ static int sctp_verify_param(const struct sctp_association *asoc, | |||
2007 | * INIT-ACK chunk if the sender wants to receive authenticated | 2007 | * INIT-ACK chunk if the sender wants to receive authenticated |
2008 | * chunks. Its maximum length is 260 bytes. | 2008 | * chunks. Its maximum length is 260 bytes. |
2009 | */ | 2009 | */ |
2010 | if (260 < ntohs(param.p->length)) | 2010 | if (260 < ntohs(param.p->length)) { |
2011 | return sctp_process_inv_paramlength(asoc, param.p, | 2011 | sctp_process_inv_paramlength(asoc, param.p, |
2012 | chunk, err_chunk); | 2012 | chunk, err_chunk); |
2013 | retval = SCTP_IERROR_ABORT; | ||
2014 | } | ||
2013 | break; | 2015 | break; |
2014 | 2016 | ||
2015 | case SCTP_PARAM_HMAC_ALGO: | 2017 | case SCTP_PARAM_HMAC_ALGO: |
@@ -2020,8 +2022,7 @@ fallthrough: | |||
2020 | default: | 2022 | default: |
2021 | SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n", | 2023 | SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n", |
2022 | ntohs(param.p->type), cid); | 2024 | ntohs(param.p->type), cid); |
2023 | return sctp_process_unk_param(asoc, param, chunk, err_chunk); | 2025 | retval = sctp_process_unk_param(asoc, param, chunk, err_chunk); |
2024 | |||
2025 | break; | 2026 | break; |
2026 | } | 2027 | } |
2027 | return retval; | 2028 | return retval; |
@@ -2036,6 +2037,7 @@ int sctp_verify_init(const struct sctp_association *asoc, | |||
2036 | { | 2037 | { |
2037 | union sctp_params param; | 2038 | union sctp_params param; |
2038 | int has_cookie = 0; | 2039 | int has_cookie = 0; |
2040 | int result; | ||
2039 | 2041 | ||
2040 | /* Verify stream values are non-zero. */ | 2042 | /* Verify stream values are non-zero. */ |
2041 | if ((0 == peer_init->init_hdr.num_outbound_streams) || | 2043 | if ((0 == peer_init->init_hdr.num_outbound_streams) || |
@@ -2043,8 +2045,7 @@ int sctp_verify_init(const struct sctp_association *asoc, | |||
2043 | (0 == peer_init->init_hdr.init_tag) || | 2045 | (0 == peer_init->init_hdr.init_tag) || |
2044 | (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) { | 2046 | (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) { |
2045 | 2047 | ||
2046 | sctp_process_inv_mandatory(asoc, chunk, errp); | 2048 | return sctp_process_inv_mandatory(asoc, chunk, errp); |
2047 | return 0; | ||
2048 | } | 2049 | } |
2049 | 2050 | ||
2050 | /* Check for missing mandatory parameters. */ | 2051 | /* Check for missing mandatory parameters. */ |
@@ -2062,29 +2063,29 @@ int sctp_verify_init(const struct sctp_association *asoc, | |||
2062 | * VIOLATION error. We build the ERROR chunk here and let the normal | 2063 | * VIOLATION error. We build the ERROR chunk here and let the normal |
2063 | * error handling code build and send the packet. | 2064 | * error handling code build and send the packet. |
2064 | */ | 2065 | */ |
2065 | if (param.v != (void*)chunk->chunk_end) { | 2066 | if (param.v != (void*)chunk->chunk_end) |
2066 | sctp_process_inv_paramlength(asoc, param.p, chunk, errp); | 2067 | return sctp_process_inv_paramlength(asoc, param.p, chunk, errp); |
2067 | return 0; | ||
2068 | } | ||
2069 | 2068 | ||
2070 | /* The only missing mandatory param possible today is | 2069 | /* The only missing mandatory param possible today is |
2071 | * the state cookie for an INIT-ACK chunk. | 2070 | * the state cookie for an INIT-ACK chunk. |
2072 | */ | 2071 | */ |
2073 | if ((SCTP_CID_INIT_ACK == cid) && !has_cookie) { | 2072 | if ((SCTP_CID_INIT_ACK == cid) && !has_cookie) |
2074 | sctp_process_missing_param(asoc, SCTP_PARAM_STATE_COOKIE, | 2073 | return sctp_process_missing_param(asoc, SCTP_PARAM_STATE_COOKIE, |
2075 | chunk, errp); | 2074 | chunk, errp); |
2076 | return 0; | ||
2077 | } | ||
2078 | |||
2079 | /* Find unrecognized parameters. */ | ||
2080 | 2075 | ||
2076 | /* Verify all the variable length parameters */ | ||
2081 | sctp_walk_params(param, peer_init, init_hdr.params) { | 2077 | sctp_walk_params(param, peer_init, init_hdr.params) { |
2082 | 2078 | ||
2083 | if (!sctp_verify_param(asoc, param, cid, chunk, errp)) { | 2079 | result = sctp_verify_param(asoc, param, cid, chunk, errp); |
2084 | if (SCTP_PARAM_HOST_NAME_ADDRESS == param.p->type) | 2080 | switch (result) { |
2081 | case SCTP_IERROR_ABORT: | ||
2082 | case SCTP_IERROR_NOMEM: | ||
2085 | return 0; | 2083 | return 0; |
2086 | else | 2084 | case SCTP_IERROR_ERROR: |
2087 | return 1; | 2085 | return 1; |
2086 | case SCTP_IERROR_NO_ERROR: | ||
2087 | default: | ||
2088 | break; | ||
2088 | } | 2089 | } |
2089 | 2090 | ||
2090 | } /* for (loop through all parameters) */ | 2091 | } /* for (loop through all parameters) */ |
@@ -2137,11 +2138,14 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, | |||
2137 | 2138 | ||
2138 | /* If the peer claims support for ADD-IP without support | 2139 | /* If the peer claims support for ADD-IP without support |
2139 | * for AUTH, disable support for ADD-IP. | 2140 | * for AUTH, disable support for ADD-IP. |
2141 | * Do this only if backward compatible mode is turned off. | ||
2140 | */ | 2142 | */ |
2141 | if (asoc->peer.addip_capable && !asoc->peer.auth_capable) { | 2143 | if (!sctp_addip_noauth && |
2144 | (asoc->peer.asconf_capable && !asoc->peer.auth_capable)) { | ||
2142 | asoc->peer.addip_disabled_mask |= (SCTP_PARAM_ADD_IP | | 2145 | asoc->peer.addip_disabled_mask |= (SCTP_PARAM_ADD_IP | |
2143 | SCTP_PARAM_DEL_IP | | 2146 | SCTP_PARAM_DEL_IP | |
2144 | SCTP_PARAM_SET_PRIMARY); | 2147 | SCTP_PARAM_SET_PRIMARY); |
2148 | asoc->peer.asconf_capable = 0; | ||
2145 | } | 2149 | } |
2146 | 2150 | ||
2147 | /* Walk list of transports, removing transports in the UNKNOWN state. */ | 2151 | /* Walk list of transports, removing transports in the UNKNOWN state. */ |
@@ -2848,10 +2852,11 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, | |||
2848 | 2852 | ||
2849 | __be16 err_code; | 2853 | __be16 err_code; |
2850 | int length = 0; | 2854 | int length = 0; |
2851 | int chunk_len = asconf->skb->len; | 2855 | int chunk_len; |
2852 | __u32 serial; | 2856 | __u32 serial; |
2853 | int all_param_pass = 1; | 2857 | int all_param_pass = 1; |
2854 | 2858 | ||
2859 | chunk_len = ntohs(asconf->chunk_hdr->length) - sizeof(sctp_chunkhdr_t); | ||
2855 | hdr = (sctp_addiphdr_t *)asconf->skb->data; | 2860 | hdr = (sctp_addiphdr_t *)asconf->skb->data; |
2856 | serial = ntohl(hdr->serial); | 2861 | serial = ntohl(hdr->serial); |
2857 | 2862 | ||
@@ -2952,13 +2957,17 @@ static int sctp_asconf_param_success(struct sctp_association *asoc, | |||
2952 | /* This is always done in BH context with a socket lock | 2957 | /* This is always done in BH context with a socket lock |
2953 | * held, so the list can not change. | 2958 | * held, so the list can not change. |
2954 | */ | 2959 | */ |
2960 | local_bh_disable(); | ||
2955 | list_for_each_entry(saddr, &bp->address_list, list) { | 2961 | list_for_each_entry(saddr, &bp->address_list, list) { |
2956 | if (sctp_cmp_addr_exact(&saddr->a, &addr)) | 2962 | if (sctp_cmp_addr_exact(&saddr->a, &addr)) |
2957 | saddr->use_as_src = 1; | 2963 | saddr->use_as_src = 1; |
2958 | } | 2964 | } |
2965 | local_bh_enable(); | ||
2959 | break; | 2966 | break; |
2960 | case SCTP_PARAM_DEL_IP: | 2967 | case SCTP_PARAM_DEL_IP: |
2961 | retval = sctp_del_bind_addr(bp, &addr, call_rcu_bh); | 2968 | local_bh_disable(); |
2969 | retval = sctp_del_bind_addr(bp, &addr); | ||
2970 | local_bh_enable(); | ||
2962 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 2971 | list_for_each(pos, &asoc->peer.transport_addr_list) { |
2963 | transport = list_entry(pos, struct sctp_transport, | 2972 | transport = list_entry(pos, struct sctp_transport, |
2964 | transports); | 2973 | transports); |
@@ -2990,7 +2999,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack, | |||
2990 | sctp_addip_param_t *asconf_ack_param; | 2999 | sctp_addip_param_t *asconf_ack_param; |
2991 | sctp_errhdr_t *err_param; | 3000 | sctp_errhdr_t *err_param; |
2992 | int length; | 3001 | int length; |
2993 | int asconf_ack_len = asconf_ack->skb->len; | 3002 | int asconf_ack_len; |
2994 | __be16 err_code; | 3003 | __be16 err_code; |
2995 | 3004 | ||
2996 | if (no_err) | 3005 | if (no_err) |
@@ -2998,6 +3007,9 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack, | |||
2998 | else | 3007 | else |
2999 | err_code = SCTP_ERROR_REQ_REFUSED; | 3008 | err_code = SCTP_ERROR_REQ_REFUSED; |
3000 | 3009 | ||
3010 | asconf_ack_len = ntohs(asconf_ack->chunk_hdr->length) - | ||
3011 | sizeof(sctp_chunkhdr_t); | ||
3012 | |||
3001 | /* Skip the addiphdr from the asconf_ack chunk and store a pointer to | 3013 | /* Skip the addiphdr from the asconf_ack chunk and store a pointer to |
3002 | * the first asconf_ack parameter. | 3014 | * the first asconf_ack parameter. |
3003 | */ | 3015 | */ |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index bbdc938da86f..78d1a8a49bd0 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -453,6 +453,7 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc, | |||
453 | * maximum value discussed in rule C7 above (RTO.max) may be | 453 | * maximum value discussed in rule C7 above (RTO.max) may be |
454 | * used to provide an upper bound to this doubling operation. | 454 | * used to provide an upper bound to this doubling operation. |
455 | */ | 455 | */ |
456 | transport->last_rto = transport->rto; | ||
456 | transport->rto = min((transport->rto * 2), transport->asoc->rto_max); | 457 | transport->rto = min((transport->rto * 2), transport->asoc->rto_max); |
457 | } | 458 | } |
458 | 459 | ||
@@ -1267,6 +1268,12 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1267 | sctp_ootb_pkt_free(packet); | 1268 | sctp_ootb_pkt_free(packet); |
1268 | break; | 1269 | break; |
1269 | 1270 | ||
1271 | case SCTP_CMD_T1_RETRAN: | ||
1272 | /* Mark a transport for retransmission. */ | ||
1273 | sctp_retransmit(&asoc->outqueue, cmd->obj.transport, | ||
1274 | SCTP_RTXR_T1_RTX); | ||
1275 | break; | ||
1276 | |||
1270 | case SCTP_CMD_RETRAN: | 1277 | case SCTP_CMD_RETRAN: |
1271 | /* Mark a transport for retransmission. */ | 1278 | /* Mark a transport for retransmission. */ |
1272 | sctp_retransmit(&asoc->outqueue, cmd->obj.transport, | 1279 | sctp_retransmit(&asoc->outqueue, cmd->obj.transport, |
@@ -1393,7 +1400,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1393 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 1400 | list_for_each(pos, &asoc->peer.transport_addr_list) { |
1394 | t = list_entry(pos, struct sctp_transport, | 1401 | t = list_entry(pos, struct sctp_transport, |
1395 | transports); | 1402 | transports); |
1396 | sctp_retransmit_mark(&asoc->outqueue, t, 0); | 1403 | sctp_retransmit_mark(&asoc->outqueue, t, |
1404 | SCTP_RTXR_T1_RTX); | ||
1397 | } | 1405 | } |
1398 | 1406 | ||
1399 | sctp_add_cmd_sf(commands, | 1407 | sctp_add_cmd_sf(commands, |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index f01b408508ff..5ebbe808d801 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -2305,7 +2305,7 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(const struct sctp_endpoint *ep, | |||
2305 | /* If we've sent any data bundled with COOKIE-ECHO we will need to | 2305 | /* If we've sent any data bundled with COOKIE-ECHO we will need to |
2306 | * resend | 2306 | * resend |
2307 | */ | 2307 | */ |
2308 | sctp_add_cmd_sf(commands, SCTP_CMD_RETRAN, | 2308 | sctp_add_cmd_sf(commands, SCTP_CMD_T1_RETRAN, |
2309 | SCTP_TRANSPORT(asoc->peer.primary_path)); | 2309 | SCTP_TRANSPORT(asoc->peer.primary_path)); |
2310 | 2310 | ||
2311 | /* Cast away the const modifier, as we want to just | 2311 | /* Cast away the const modifier, as we want to just |
@@ -4064,11 +4064,6 @@ static sctp_disposition_t sctp_sf_abort_violation( | |||
4064 | struct sctp_chunk *chunk = arg; | 4064 | struct sctp_chunk *chunk = arg; |
4065 | struct sctp_chunk *abort = NULL; | 4065 | struct sctp_chunk *abort = NULL; |
4066 | 4066 | ||
4067 | /* Make the abort chunk. */ | ||
4068 | abort = sctp_make_abort_violation(asoc, chunk, payload, paylen); | ||
4069 | if (!abort) | ||
4070 | goto nomem; | ||
4071 | |||
4072 | /* SCTP-AUTH, Section 6.3: | 4067 | /* SCTP-AUTH, Section 6.3: |
4073 | * It should be noted that if the receiver wants to tear | 4068 | * It should be noted that if the receiver wants to tear |
4074 | * down an association in an authenticated way only, the | 4069 | * down an association in an authenticated way only, the |
@@ -4083,6 +4078,11 @@ static sctp_disposition_t sctp_sf_abort_violation( | |||
4083 | if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc)) | 4078 | if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc)) |
4084 | goto discard; | 4079 | goto discard; |
4085 | 4080 | ||
4081 | /* Make the abort chunk. */ | ||
4082 | abort = sctp_make_abort_violation(asoc, chunk, payload, paylen); | ||
4083 | if (!abort) | ||
4084 | goto nomem; | ||
4085 | |||
4086 | if (asoc) { | 4086 | if (asoc) { |
4087 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); | 4087 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); |
4088 | SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS); | 4088 | SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS); |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index a7ecf3159e53..ff8bc95670ed 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -660,7 +660,7 @@ static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) | |||
660 | * socket routing and failover schemes. Refer to comments in | 660 | * socket routing and failover schemes. Refer to comments in |
661 | * sctp_do_bind(). -daisy | 661 | * sctp_do_bind(). -daisy |
662 | */ | 662 | */ |
663 | retval = sctp_del_bind_addr(bp, sa_addr, call_rcu); | 663 | retval = sctp_del_bind_addr(bp, sa_addr); |
664 | 664 | ||
665 | addr_buf += af->sockaddr_len; | 665 | addr_buf += af->sockaddr_len; |
666 | err_bindx_rem: | 666 | err_bindx_rem: |
@@ -5307,6 +5307,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) | |||
5307 | { | 5307 | { |
5308 | struct sctp_bind_hashbucket *head; /* hash list */ | 5308 | struct sctp_bind_hashbucket *head; /* hash list */ |
5309 | struct sctp_bind_bucket *pp; /* hash list port iterator */ | 5309 | struct sctp_bind_bucket *pp; /* hash list port iterator */ |
5310 | struct hlist_node *node; | ||
5310 | unsigned short snum; | 5311 | unsigned short snum; |
5311 | int ret; | 5312 | int ret; |
5312 | 5313 | ||
@@ -5331,7 +5332,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) | |||
5331 | index = sctp_phashfn(rover); | 5332 | index = sctp_phashfn(rover); |
5332 | head = &sctp_port_hashtable[index]; | 5333 | head = &sctp_port_hashtable[index]; |
5333 | sctp_spin_lock(&head->lock); | 5334 | sctp_spin_lock(&head->lock); |
5334 | for (pp = head->chain; pp; pp = pp->next) | 5335 | sctp_for_each_hentry(pp, node, &head->chain) |
5335 | if (pp->port == rover) | 5336 | if (pp->port == rover) |
5336 | goto next; | 5337 | goto next; |
5337 | break; | 5338 | break; |
@@ -5358,7 +5359,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) | |||
5358 | */ | 5359 | */ |
5359 | head = &sctp_port_hashtable[sctp_phashfn(snum)]; | 5360 | head = &sctp_port_hashtable[sctp_phashfn(snum)]; |
5360 | sctp_spin_lock(&head->lock); | 5361 | sctp_spin_lock(&head->lock); |
5361 | for (pp = head->chain; pp; pp = pp->next) { | 5362 | sctp_for_each_hentry(pp, node, &head->chain) { |
5362 | if (pp->port == snum) | 5363 | if (pp->port == snum) |
5363 | goto pp_found; | 5364 | goto pp_found; |
5364 | } | 5365 | } |
@@ -5702,10 +5703,7 @@ static struct sctp_bind_bucket *sctp_bucket_create( | |||
5702 | pp->port = snum; | 5703 | pp->port = snum; |
5703 | pp->fastreuse = 0; | 5704 | pp->fastreuse = 0; |
5704 | INIT_HLIST_HEAD(&pp->owner); | 5705 | INIT_HLIST_HEAD(&pp->owner); |
5705 | if ((pp->next = head->chain) != NULL) | 5706 | hlist_add_head(&pp->node, &head->chain); |
5706 | pp->next->pprev = &pp->next; | ||
5707 | head->chain = pp; | ||
5708 | pp->pprev = &head->chain; | ||
5709 | } | 5707 | } |
5710 | return pp; | 5708 | return pp; |
5711 | } | 5709 | } |
@@ -5714,9 +5712,7 @@ static struct sctp_bind_bucket *sctp_bucket_create( | |||
5714 | static void sctp_bucket_destroy(struct sctp_bind_bucket *pp) | 5712 | static void sctp_bucket_destroy(struct sctp_bind_bucket *pp) |
5715 | { | 5713 | { |
5716 | if (pp && hlist_empty(&pp->owner)) { | 5714 | if (pp && hlist_empty(&pp->owner)) { |
5717 | if (pp->next) | 5715 | __hlist_del(&pp->node); |
5718 | pp->next->pprev = pp->pprev; | ||
5719 | *(pp->pprev) = pp->next; | ||
5720 | kmem_cache_free(sctp_bucket_cachep, pp); | 5716 | kmem_cache_free(sctp_bucket_cachep, pp); |
5721 | SCTP_DBG_OBJCNT_DEC(bind_bucket); | 5717 | SCTP_DBG_OBJCNT_DEC(bind_bucket); |
5722 | } | 5718 | } |
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index 0669778e4335..da4f15734fb1 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
@@ -263,6 +263,15 @@ static ctl_table sctp_table[] = { | |||
263 | .proc_handler = &proc_dointvec, | 263 | .proc_handler = &proc_dointvec, |
264 | .strategy = &sysctl_intvec | 264 | .strategy = &sysctl_intvec |
265 | }, | 265 | }, |
266 | { | ||
267 | .ctl_name = CTL_UNNUMBERED, | ||
268 | .procname = "addip_noauth_enable", | ||
269 | .data = &sctp_addip_noauth, | ||
270 | .maxlen = sizeof(int), | ||
271 | .mode = 0644, | ||
272 | .proc_handler = &proc_dointvec, | ||
273 | .strategy = &sysctl_intvec | ||
274 | }, | ||
266 | { .ctl_name = 0 } | 275 | { .ctl_name = 0 } |
267 | }; | 276 | }; |
268 | 277 | ||
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index 5f467c914f80..d55ce83a020b 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
@@ -74,8 +74,8 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, | |||
74 | * given destination transport address, set RTO to the protocol | 74 | * given destination transport address, set RTO to the protocol |
75 | * parameter 'RTO.Initial'. | 75 | * parameter 'RTO.Initial'. |
76 | */ | 76 | */ |
77 | peer->last_rto = peer->rto = msecs_to_jiffies(sctp_rto_initial); | ||
77 | peer->rtt = 0; | 78 | peer->rtt = 0; |
78 | peer->rto = msecs_to_jiffies(sctp_rto_initial); | ||
79 | peer->rttvar = 0; | 79 | peer->rttvar = 0; |
80 | peer->srtt = 0; | 80 | peer->srtt = 0; |
81 | peer->rto_pending = 0; | 81 | peer->rto_pending = 0; |
@@ -385,6 +385,7 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt) | |||
385 | tp->rto = tp->asoc->rto_max; | 385 | tp->rto = tp->asoc->rto_max; |
386 | 386 | ||
387 | tp->rtt = rtt; | 387 | tp->rtt = rtt; |
388 | tp->last_rto = tp->rto; | ||
388 | 389 | ||
389 | /* Reset rto_pending so that a new RTT measurement is started when a | 390 | /* Reset rto_pending so that a new RTT measurement is started when a |
390 | * new data chunk is sent. | 391 | * new data chunk is sent. |
@@ -578,7 +579,7 @@ void sctp_transport_reset(struct sctp_transport *t) | |||
578 | */ | 579 | */ |
579 | t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380)); | 580 | t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380)); |
580 | t->ssthresh = asoc->peer.i.a_rwnd; | 581 | t->ssthresh = asoc->peer.i.a_rwnd; |
581 | t->rto = asoc->rto_initial; | 582 | t->last_rto = t->rto = asoc->rto_initial; |
582 | t->rtt = 0; | 583 | t->rtt = 0; |
583 | t->srtt = 0; | 584 | t->srtt = 0; |
584 | t->rttvar = 0; | 585 | t->rttvar = 0; |
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c index 4be92d0a2cab..4908041ffb31 100644 --- a/net/sctp/ulpqueue.c +++ b/net/sctp/ulpqueue.c | |||
@@ -862,7 +862,7 @@ static inline void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid) | |||
862 | continue; | 862 | continue; |
863 | 863 | ||
864 | /* see if this ssn has been marked by skipping */ | 864 | /* see if this ssn has been marked by skipping */ |
865 | if (!SSN_lt(cssn, sctp_ssn_peek(in, csid))) | 865 | if (!SSN_lte(cssn, sctp_ssn_peek(in, csid))) |
866 | break; | 866 | break; |
867 | 867 | ||
868 | __skb_unlink(pos, &ulpq->lobby); | 868 | __skb_unlink(pos, &ulpq->lobby); |
diff --git a/net/socket.c b/net/socket.c index 5d879fd3d01d..74784dfe8e5b 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -2319,6 +2319,11 @@ int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg) | |||
2319 | return err; | 2319 | return err; |
2320 | } | 2320 | } |
2321 | 2321 | ||
2322 | int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how) | ||
2323 | { | ||
2324 | return sock->ops->shutdown(sock, how); | ||
2325 | } | ||
2326 | |||
2322 | /* ABI emulation layers need these two */ | 2327 | /* ABI emulation layers need these two */ |
2323 | EXPORT_SYMBOL(move_addr_to_kernel); | 2328 | EXPORT_SYMBOL(move_addr_to_kernel); |
2324 | EXPORT_SYMBOL(move_addr_to_user); | 2329 | EXPORT_SYMBOL(move_addr_to_user); |
@@ -2345,3 +2350,4 @@ EXPORT_SYMBOL(kernel_getsockopt); | |||
2345 | EXPORT_SYMBOL(kernel_setsockopt); | 2350 | EXPORT_SYMBOL(kernel_setsockopt); |
2346 | EXPORT_SYMBOL(kernel_sendpage); | 2351 | EXPORT_SYMBOL(kernel_sendpage); |
2347 | EXPORT_SYMBOL(kernel_sock_ioctl); | 2352 | EXPORT_SYMBOL(kernel_sock_ioctl); |
2353 | EXPORT_SYMBOL(kernel_sock_shutdown); | ||
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index dc55cc974c90..1afeb3eb8e4c 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c | |||
@@ -320,9 +320,9 @@ xprt_setup_rdma(struct xprt_create *args) | |||
320 | xprt->slot = kcalloc(xprt->max_reqs, | 320 | xprt->slot = kcalloc(xprt->max_reqs, |
321 | sizeof(struct rpc_rqst), GFP_KERNEL); | 321 | sizeof(struct rpc_rqst), GFP_KERNEL); |
322 | if (xprt->slot == NULL) { | 322 | if (xprt->slot == NULL) { |
323 | kfree(xprt); | ||
324 | dprintk("RPC: %s: couldn't allocate %d slots\n", | 323 | dprintk("RPC: %s: couldn't allocate %d slots\n", |
325 | __func__, xprt->max_reqs); | 324 | __func__, xprt->max_reqs); |
325 | kfree(xprt); | ||
326 | return ERR_PTR(-ENOMEM); | 326 | return ERR_PTR(-ENOMEM); |
327 | } | 327 | } |
328 | 328 | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 515e7a692f9b..e835da8fc091 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -457,7 +457,7 @@ static int unix_release_sock (struct sock *sk, int embrion) | |||
457 | * What the above comment does talk about? --ANK(980817) | 457 | * What the above comment does talk about? --ANK(980817) |
458 | */ | 458 | */ |
459 | 459 | ||
460 | if (atomic_read(&unix_tot_inflight)) | 460 | if (unix_tot_inflight) |
461 | unix_gc(); /* Garbage collect fds */ | 461 | unix_gc(); /* Garbage collect fds */ |
462 | 462 | ||
463 | return 0; | 463 | return 0; |
@@ -599,15 +599,14 @@ static struct sock * unix_create1(struct net *net, struct socket *sock) | |||
599 | struct sock *sk = NULL; | 599 | struct sock *sk = NULL; |
600 | struct unix_sock *u; | 600 | struct unix_sock *u; |
601 | 601 | ||
602 | if (atomic_read(&unix_nr_socks) >= 2*get_max_files()) | 602 | atomic_inc(&unix_nr_socks); |
603 | if (atomic_read(&unix_nr_socks) > 2 * get_max_files()) | ||
603 | goto out; | 604 | goto out; |
604 | 605 | ||
605 | sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto); | 606 | sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto); |
606 | if (!sk) | 607 | if (!sk) |
607 | goto out; | 608 | goto out; |
608 | 609 | ||
609 | atomic_inc(&unix_nr_socks); | ||
610 | |||
611 | sock_init_data(sock,sk); | 610 | sock_init_data(sock,sk); |
612 | lockdep_set_class(&sk->sk_receive_queue.lock, | 611 | lockdep_set_class(&sk->sk_receive_queue.lock, |
613 | &af_unix_sk_receive_queue_lock_key); | 612 | &af_unix_sk_receive_queue_lock_key); |
@@ -625,6 +624,8 @@ static struct sock * unix_create1(struct net *net, struct socket *sock) | |||
625 | init_waitqueue_head(&u->peer_wait); | 624 | init_waitqueue_head(&u->peer_wait); |
626 | unix_insert_socket(unix_sockets_unbound, sk); | 625 | unix_insert_socket(unix_sockets_unbound, sk); |
627 | out: | 626 | out: |
627 | if (sk == NULL) | ||
628 | atomic_dec(&unix_nr_socks); | ||
628 | return sk; | 629 | return sk; |
629 | } | 630 | } |
630 | 631 | ||
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 406b6433e467..ebdff3d877a1 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -92,7 +92,7 @@ static LIST_HEAD(gc_inflight_list); | |||
92 | static LIST_HEAD(gc_candidates); | 92 | static LIST_HEAD(gc_candidates); |
93 | static DEFINE_SPINLOCK(unix_gc_lock); | 93 | static DEFINE_SPINLOCK(unix_gc_lock); |
94 | 94 | ||
95 | atomic_t unix_tot_inflight = ATOMIC_INIT(0); | 95 | unsigned int unix_tot_inflight; |
96 | 96 | ||
97 | 97 | ||
98 | static struct sock *unix_get_socket(struct file *filp) | 98 | static struct sock *unix_get_socket(struct file *filp) |
@@ -133,7 +133,7 @@ void unix_inflight(struct file *fp) | |||
133 | } else { | 133 | } else { |
134 | BUG_ON(list_empty(&u->link)); | 134 | BUG_ON(list_empty(&u->link)); |
135 | } | 135 | } |
136 | atomic_inc(&unix_tot_inflight); | 136 | unix_tot_inflight++; |
137 | spin_unlock(&unix_gc_lock); | 137 | spin_unlock(&unix_gc_lock); |
138 | } | 138 | } |
139 | } | 139 | } |
@@ -147,7 +147,7 @@ void unix_notinflight(struct file *fp) | |||
147 | BUG_ON(list_empty(&u->link)); | 147 | BUG_ON(list_empty(&u->link)); |
148 | if (atomic_dec_and_test(&u->inflight)) | 148 | if (atomic_dec_and_test(&u->inflight)) |
149 | list_del_init(&u->link); | 149 | list_del_init(&u->link); |
150 | atomic_dec(&unix_tot_inflight); | 150 | unix_tot_inflight--; |
151 | spin_unlock(&unix_gc_lock); | 151 | spin_unlock(&unix_gc_lock); |
152 | } | 152 | } |
153 | } | 153 | } |
@@ -161,7 +161,7 @@ static inline struct sk_buff *sock_queue_head(struct sock *sk) | |||
161 | for (skb = sock_queue_head(sk)->next, next = skb->next; \ | 161 | for (skb = sock_queue_head(sk)->next, next = skb->next; \ |
162 | skb != sock_queue_head(sk); skb = next, next = skb->next) | 162 | skb != sock_queue_head(sk); skb = next, next = skb->next) |
163 | 163 | ||
164 | static void scan_inflight(struct sock *x, void (*func)(struct sock *), | 164 | static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), |
165 | struct sk_buff_head *hitlist) | 165 | struct sk_buff_head *hitlist) |
166 | { | 166 | { |
167 | struct sk_buff *skb; | 167 | struct sk_buff *skb; |
@@ -185,9 +185,9 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *), | |||
185 | * if it indeed does so | 185 | * if it indeed does so |
186 | */ | 186 | */ |
187 | struct sock *sk = unix_get_socket(*fp++); | 187 | struct sock *sk = unix_get_socket(*fp++); |
188 | if(sk) { | 188 | if (sk) { |
189 | hit = true; | 189 | hit = true; |
190 | func(sk); | 190 | func(unix_sk(sk)); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | if (hit && hitlist != NULL) { | 193 | if (hit && hitlist != NULL) { |
@@ -199,7 +199,7 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *), | |||
199 | spin_unlock(&x->sk_receive_queue.lock); | 199 | spin_unlock(&x->sk_receive_queue.lock); |
200 | } | 200 | } |
201 | 201 | ||
202 | static void scan_children(struct sock *x, void (*func)(struct sock *), | 202 | static void scan_children(struct sock *x, void (*func)(struct unix_sock *), |
203 | struct sk_buff_head *hitlist) | 203 | struct sk_buff_head *hitlist) |
204 | { | 204 | { |
205 | if (x->sk_state != TCP_LISTEN) | 205 | if (x->sk_state != TCP_LISTEN) |
@@ -235,20 +235,18 @@ static void scan_children(struct sock *x, void (*func)(struct sock *), | |||
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
238 | static void dec_inflight(struct sock *sk) | 238 | static void dec_inflight(struct unix_sock *usk) |
239 | { | 239 | { |
240 | atomic_dec(&unix_sk(sk)->inflight); | 240 | atomic_dec(&usk->inflight); |
241 | } | 241 | } |
242 | 242 | ||
243 | static void inc_inflight(struct sock *sk) | 243 | static void inc_inflight(struct unix_sock *usk) |
244 | { | 244 | { |
245 | atomic_inc(&unix_sk(sk)->inflight); | 245 | atomic_inc(&usk->inflight); |
246 | } | 246 | } |
247 | 247 | ||
248 | static void inc_inflight_move_tail(struct sock *sk) | 248 | static void inc_inflight_move_tail(struct unix_sock *u) |
249 | { | 249 | { |
250 | struct unix_sock *u = unix_sk(sk); | ||
251 | |||
252 | atomic_inc(&u->inflight); | 250 | atomic_inc(&u->inflight); |
253 | /* | 251 | /* |
254 | * If this is still a candidate, move it to the end of the | 252 | * If this is still a candidate, move it to the end of the |
diff --git a/samples/markers/marker-example.c b/samples/markers/marker-example.c index e787c6d16dd7..05e438f8b4e2 100644 --- a/samples/markers/marker-example.c +++ b/samples/markers/marker-example.c | |||
@@ -19,7 +19,8 @@ static int my_open(struct inode *inode, struct file *file) | |||
19 | { | 19 | { |
20 | int i; | 20 | int i; |
21 | 21 | ||
22 | trace_mark(subsystem_event, "%d %s", 123, "example string"); | 22 | trace_mark(subsystem_event, "integer %d string %s", 123, |
23 | "example string"); | ||
23 | for (i = 0; i < 10; i++) | 24 | for (i = 0; i < 10; i++) |
24 | trace_mark(subsystem_eventb, MARK_NOARGS); | 25 | trace_mark(subsystem_eventb, MARK_NOARGS); |
25 | return -EPERM; | 26 | return -EPERM; |
diff --git a/samples/markers/probe-example.c b/samples/markers/probe-example.c index 238b2e384fc8..a36797535615 100644 --- a/samples/markers/probe-example.c +++ b/samples/markers/probe-example.c | |||
@@ -53,7 +53,7 @@ void probe_subsystem_eventb(const struct marker *mdata, void *private, | |||
53 | static struct probe_data probe_array[] = | 53 | static struct probe_data probe_array[] = |
54 | { | 54 | { |
55 | { .name = "subsystem_event", | 55 | { .name = "subsystem_event", |
56 | .format = "%d %s", | 56 | .format = "integer %d string %s", |
57 | .probe_func = probe_subsystem_event }, | 57 | .probe_func = probe_subsystem_event }, |
58 | { .name = "subsystem_eventb", | 58 | { .name = "subsystem_eventb", |
59 | .format = MARK_NOARGS, | 59 | .format = MARK_NOARGS, |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 59594126e8b6..1ad6f7fc490a 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -4,12 +4,7 @@ | |||
4 | 4 | ||
5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config | 5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config |
6 | 6 | ||
7 | # If a arch/$(SRCARCH)/Kconfig.$(ARCH) file exist use it | 7 | Kconfig := arch/$(SRCARCH)/Kconfig |
8 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/Kconfig.$(ARCH)),) | ||
9 | Kconfig := arch/$(SRCARCH)/Kconfig.$(ARCH) | ||
10 | else | ||
11 | Kconfig := arch/$(SRCARCH)/Kconfig | ||
12 | endif | ||
13 | 8 | ||
14 | xconfig: $(obj)/qconf | 9 | xconfig: $(obj)/qconf |
15 | $< $(Kconfig) | 10 | $< $(Kconfig) |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index a38787a881ea..c6bee85c3962 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -591,6 +591,7 @@ int main(int ac, char **av) | |||
591 | conf_read_simple(name, S_DEF_USER); | 591 | conf_read_simple(name, S_DEF_USER); |
592 | else if (!stat("all.config", &tmpstat)) | 592 | else if (!stat("all.config", &tmpstat)) |
593 | conf_read_simple("all.config", S_DEF_USER); | 593 | conf_read_simple("all.config", S_DEF_USER); |
594 | conf_set_env_sym("K64BIT", "64BIT", S_DEF_USER); | ||
594 | break; | 595 | break; |
595 | default: | 596 | default: |
596 | break; | 597 | break; |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index b2913e9da495..e4fa3f302541 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -83,6 +83,95 @@ char *conf_get_default_confname(void) | |||
83 | return name; | 83 | return name; |
84 | } | 84 | } |
85 | 85 | ||
86 | static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) | ||
87 | { | ||
88 | char *p2; | ||
89 | |||
90 | switch (sym->type) { | ||
91 | case S_TRISTATE: | ||
92 | if (p[0] == 'm') { | ||
93 | sym->def[def].tri = mod; | ||
94 | sym->flags |= def_flags; | ||
95 | break; | ||
96 | } | ||
97 | case S_BOOLEAN: | ||
98 | if (p[0] == 'y') { | ||
99 | sym->def[def].tri = yes; | ||
100 | sym->flags |= def_flags; | ||
101 | break; | ||
102 | } | ||
103 | if (p[0] == 'n') { | ||
104 | sym->def[def].tri = no; | ||
105 | sym->flags |= def_flags; | ||
106 | break; | ||
107 | } | ||
108 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); | ||
109 | break; | ||
110 | case S_OTHER: | ||
111 | if (*p != '"') { | ||
112 | for (p2 = p; *p2 && !isspace(*p2); p2++) | ||
113 | ; | ||
114 | sym->type = S_STRING; | ||
115 | goto done; | ||
116 | } | ||
117 | case S_STRING: | ||
118 | if (*p++ != '"') | ||
119 | break; | ||
120 | for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) { | ||
121 | if (*p2 == '"') { | ||
122 | *p2 = 0; | ||
123 | break; | ||
124 | } | ||
125 | memmove(p2, p2 + 1, strlen(p2)); | ||
126 | } | ||
127 | if (!p2) { | ||
128 | conf_warning("invalid string found"); | ||
129 | return 1; | ||
130 | } | ||
131 | case S_INT: | ||
132 | case S_HEX: | ||
133 | done: | ||
134 | if (sym_string_valid(sym, p)) { | ||
135 | sym->def[def].val = strdup(p); | ||
136 | sym->flags |= def_flags; | ||
137 | } else { | ||
138 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); | ||
139 | return 1; | ||
140 | } | ||
141 | break; | ||
142 | default: | ||
143 | ; | ||
144 | } | ||
145 | return 0; | ||
146 | } | ||
147 | |||
148 | /* Read an environment variable and assign the value to the symbol */ | ||
149 | int conf_set_env_sym(const char *env, const char *symname, int def) | ||
150 | { | ||
151 | struct symbol *sym; | ||
152 | char *p; | ||
153 | int def_flags; | ||
154 | |||
155 | p = getenv(env); | ||
156 | if (p) { | ||
157 | char warning[200]; | ||
158 | sprintf(warning, "Environment variable (%s = \"%s\")", env, p); | ||
159 | conf_filename = warning; | ||
160 | def_flags = SYMBOL_DEF << def; | ||
161 | if (def == S_DEF_USER) { | ||
162 | sym = sym_find(symname); | ||
163 | if (!sym) | ||
164 | return 1; | ||
165 | } else { | ||
166 | sym = sym_lookup(symname, 0); | ||
167 | if (sym->type == S_UNKNOWN) | ||
168 | sym->type = S_OTHER; | ||
169 | } | ||
170 | conf_set_sym_val(sym, def, def_flags, p); | ||
171 | } | ||
172 | return 0; | ||
173 | } | ||
174 | |||
86 | int conf_read_simple(const char *name, int def) | 175 | int conf_read_simple(const char *name, int def) |
87 | { | 176 | { |
88 | FILE *in = NULL; | 177 | FILE *in = NULL; |
@@ -213,61 +302,8 @@ load: | |||
213 | conf_warning("trying to reassign symbol %s", sym->name); | 302 | conf_warning("trying to reassign symbol %s", sym->name); |
214 | break; | 303 | break; |
215 | } | 304 | } |
216 | switch (sym->type) { | 305 | if (conf_set_sym_val(sym, def, def_flags, p)) |
217 | case S_TRISTATE: | 306 | continue; |
218 | if (p[0] == 'm') { | ||
219 | sym->def[def].tri = mod; | ||
220 | sym->flags |= def_flags; | ||
221 | break; | ||
222 | } | ||
223 | case S_BOOLEAN: | ||
224 | if (p[0] == 'y') { | ||
225 | sym->def[def].tri = yes; | ||
226 | sym->flags |= def_flags; | ||
227 | break; | ||
228 | } | ||
229 | if (p[0] == 'n') { | ||
230 | sym->def[def].tri = no; | ||
231 | sym->flags |= def_flags; | ||
232 | break; | ||
233 | } | ||
234 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); | ||
235 | break; | ||
236 | case S_OTHER: | ||
237 | if (*p != '"') { | ||
238 | for (p2 = p; *p2 && !isspace(*p2); p2++) | ||
239 | ; | ||
240 | sym->type = S_STRING; | ||
241 | goto done; | ||
242 | } | ||
243 | case S_STRING: | ||
244 | if (*p++ != '"') | ||
245 | break; | ||
246 | for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) { | ||
247 | if (*p2 == '"') { | ||
248 | *p2 = 0; | ||
249 | break; | ||
250 | } | ||
251 | memmove(p2, p2 + 1, strlen(p2)); | ||
252 | } | ||
253 | if (!p2) { | ||
254 | conf_warning("invalid string found"); | ||
255 | continue; | ||
256 | } | ||
257 | case S_INT: | ||
258 | case S_HEX: | ||
259 | done: | ||
260 | if (sym_string_valid(sym, p)) { | ||
261 | sym->def[def].val = strdup(p); | ||
262 | sym->flags |= def_flags; | ||
263 | } else { | ||
264 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); | ||
265 | continue; | ||
266 | } | ||
267 | break; | ||
268 | default: | ||
269 | ; | ||
270 | } | ||
271 | break; | 307 | break; |
272 | case '\r': | 308 | case '\r': |
273 | case '\n': | 309 | case '\n': |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 4d09f6ddefe3..dca294e90cc3 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -1,6 +1,7 @@ | |||
1 | 1 | ||
2 | /* confdata.c */ | 2 | /* confdata.c */ |
3 | P(conf_parse,void,(const char *name)); | 3 | P(conf_parse,void,(const char *name)); |
4 | P(conf_set_env_sym,int,(const char *envname, const char *symname, int def)); | ||
4 | P(conf_read,int,(const char *name)); | 5 | P(conf_read,int,(const char *name)); |
5 | P(conf_read_simple,int,(const char *name, int)); | 6 | P(conf_read_simple,int,(const char *name, int)); |
6 | P(conf_write,int,(const char *name)); | 7 | P(conf_write,int,(const char *name)); |
diff --git a/security/commoncap.c b/security/commoncap.c index bf67871173ef..302e8d0839a9 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -526,6 +526,10 @@ int cap_task_kill(struct task_struct *p, struct siginfo *info, | |||
526 | if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info))) | 526 | if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info))) |
527 | return 0; | 527 | return 0; |
528 | 528 | ||
529 | /* sigcont is permitted within same session */ | ||
530 | if (sig == SIGCONT && (task_session_nr(current) == task_session_nr(p))) | ||
531 | return 0; | ||
532 | |||
529 | if (secid) | 533 | if (secid) |
530 | /* | 534 | /* |
531 | * Signal sent as a particular user. | 535 | * Signal sent as a particular user. |