diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-21 04:39:51 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-21 04:39:51 -0500 |
commit | 198030782cedf25391e67e7c88b04f87a5eb6563 (patch) | |
tree | 5b7368c6bf052bcb4bb273497a57900720d36f51 /drivers | |
parent | 4ec71fa2d2c3f1040348f2604f4b8ccc833d1c2e (diff) | |
parent | 92181f190b649f7ef2b79cbf5c00f26ccc66da2a (diff) |
Merge branch 'x86/mm' into core/percpu
Conflicts:
arch/x86/mm/fault.c
Diffstat (limited to 'drivers')
171 files changed, 5116 insertions, 1663 deletions
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index d80f4cc2e0d..65d90c720b5 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -19,7 +19,7 @@ obj-y += osl.o utils.o reboot.o\ | |||
19 | 19 | ||
20 | # sleep related files | 20 | # sleep related files |
21 | obj-y += wakeup.o | 21 | obj-y += wakeup.o |
22 | obj-y += main.o | 22 | obj-y += sleep.o |
23 | obj-$(CONFIG_ACPI_SLEEP) += proc.o | 23 | obj-$(CONFIG_ACPI_SLEEP) += proc.o |
24 | 24 | ||
25 | 25 | ||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 8dfcbb8aff7..a2b82c90a68 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -120,31 +120,6 @@ static struct acpi_ec { | |||
120 | spinlock_t curr_lock; | 120 | spinlock_t curr_lock; |
121 | } *boot_ec, *first_ec; | 121 | } *boot_ec, *first_ec; |
122 | 122 | ||
123 | /* | ||
124 | * Some Asus system have exchanged ECDT data/command IO addresses. | ||
125 | */ | ||
126 | static int print_ecdt_error(const struct dmi_system_id *id) | ||
127 | { | ||
128 | printk(KERN_NOTICE PREFIX "%s detected - " | ||
129 | "ECDT has exchanged control/data I/O address\n", | ||
130 | id->ident); | ||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | static struct dmi_system_id __cpuinitdata ec_dmi_table[] = { | ||
135 | { | ||
136 | print_ecdt_error, "Asus L4R", { | ||
137 | DMI_MATCH(DMI_BIOS_VERSION, "1008.006"), | ||
138 | DMI_MATCH(DMI_PRODUCT_NAME, "L4R"), | ||
139 | DMI_MATCH(DMI_BOARD_NAME, "L4R") }, NULL}, | ||
140 | { | ||
141 | print_ecdt_error, "Asus M6R", { | ||
142 | DMI_MATCH(DMI_BIOS_VERSION, "0207"), | ||
143 | DMI_MATCH(DMI_PRODUCT_NAME, "M6R"), | ||
144 | DMI_MATCH(DMI_BOARD_NAME, "M6R") }, NULL}, | ||
145 | {}, | ||
146 | }; | ||
147 | |||
148 | /* -------------------------------------------------------------------------- | 123 | /* -------------------------------------------------------------------------- |
149 | Transaction Management | 124 | Transaction Management |
150 | -------------------------------------------------------------------------- */ | 125 | -------------------------------------------------------------------------- */ |
@@ -983,8 +958,8 @@ static const struct acpi_device_id ec_device_ids[] = { | |||
983 | int __init acpi_ec_ecdt_probe(void) | 958 | int __init acpi_ec_ecdt_probe(void) |
984 | { | 959 | { |
985 | acpi_status status; | 960 | acpi_status status; |
961 | struct acpi_ec *saved_ec = NULL; | ||
986 | struct acpi_table_ecdt *ecdt_ptr; | 962 | struct acpi_table_ecdt *ecdt_ptr; |
987 | acpi_handle dummy; | ||
988 | 963 | ||
989 | boot_ec = make_acpi_ec(); | 964 | boot_ec = make_acpi_ec(); |
990 | if (!boot_ec) | 965 | if (!boot_ec) |
@@ -998,21 +973,16 @@ int __init acpi_ec_ecdt_probe(void) | |||
998 | pr_info(PREFIX "EC description table is found, configuring boot EC\n"); | 973 | pr_info(PREFIX "EC description table is found, configuring boot EC\n"); |
999 | boot_ec->command_addr = ecdt_ptr->control.address; | 974 | boot_ec->command_addr = ecdt_ptr->control.address; |
1000 | boot_ec->data_addr = ecdt_ptr->data.address; | 975 | boot_ec->data_addr = ecdt_ptr->data.address; |
1001 | if (dmi_check_system(ec_dmi_table)) { | ||
1002 | /* | ||
1003 | * If the board falls into ec_dmi_table, it means | ||
1004 | * that ECDT table gives the incorrect command/status | ||
1005 | * & data I/O address. Just fix it. | ||
1006 | */ | ||
1007 | boot_ec->data_addr = ecdt_ptr->control.address; | ||
1008 | boot_ec->command_addr = ecdt_ptr->data.address; | ||
1009 | } | ||
1010 | boot_ec->gpe = ecdt_ptr->gpe; | 976 | boot_ec->gpe = ecdt_ptr->gpe; |
1011 | boot_ec->handle = ACPI_ROOT_OBJECT; | 977 | boot_ec->handle = ACPI_ROOT_OBJECT; |
1012 | acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); | 978 | acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); |
1013 | /* Add some basic check against completely broken table */ | 979 | /* Don't trust ECDT, which comes from ASUSTek */ |
1014 | if (boot_ec->data_addr != boot_ec->command_addr) | 980 | if (!dmi_name_in_vendors("ASUS")) |
1015 | goto install; | 981 | goto install; |
982 | saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); | ||
983 | if (!saved_ec) | ||
984 | return -ENOMEM; | ||
985 | memcpy(&saved_ec, boot_ec, sizeof(saved_ec)); | ||
1016 | /* fall through */ | 986 | /* fall through */ |
1017 | } | 987 | } |
1018 | /* This workaround is needed only on some broken machines, | 988 | /* This workaround is needed only on some broken machines, |
@@ -1023,12 +993,29 @@ int __init acpi_ec_ecdt_probe(void) | |||
1023 | /* Check that acpi_get_devices actually find something */ | 993 | /* Check that acpi_get_devices actually find something */ |
1024 | if (ACPI_FAILURE(status) || !boot_ec->handle) | 994 | if (ACPI_FAILURE(status) || !boot_ec->handle) |
1025 | goto error; | 995 | goto error; |
1026 | /* We really need to limit this workaround, the only ASUS, | 996 | if (saved_ec) { |
1027 | * which needs it, has fake EC._INI method, so use it as flag. | 997 | /* try to find good ECDT from ASUSTek */ |
1028 | * Keep boot_ec struct as it will be needed soon. | 998 | if (saved_ec->command_addr != boot_ec->command_addr || |
1029 | */ | 999 | saved_ec->data_addr != boot_ec->data_addr || |
1030 | if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &dummy))) | 1000 | saved_ec->gpe != boot_ec->gpe || |
1031 | return -ENODEV; | 1001 | saved_ec->handle != boot_ec->handle) |
1002 | pr_info(PREFIX "ASUSTek keeps feeding us with broken " | ||
1003 | "ECDT tables, which are very hard to workaround. " | ||
1004 | "Trying to use DSDT EC info instead. Please send " | ||
1005 | "output of acpidump to linux-acpi@vger.kernel.org\n"); | ||
1006 | kfree(saved_ec); | ||
1007 | saved_ec = NULL; | ||
1008 | } else { | ||
1009 | /* We really need to limit this workaround, the only ASUS, | ||
1010 | * which needs it, has fake EC._INI method, so use it as flag. | ||
1011 | * Keep boot_ec struct as it will be needed soon. | ||
1012 | */ | ||
1013 | acpi_handle dummy; | ||
1014 | if (!dmi_name_in_vendors("ASUS") || | ||
1015 | ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", | ||
1016 | &dummy))) | ||
1017 | return -ENODEV; | ||
1018 | } | ||
1032 | install: | 1019 | install: |
1033 | if (!ec_install_handlers(boot_ec)) { | 1020 | if (!ec_install_handlers(boot_ec)) { |
1034 | first_ec = boot_ec; | 1021 | first_ec = boot_ec; |
diff --git a/drivers/acpi/main.c b/drivers/acpi/sleep.c index 7e3c609cbef..7e3c609cbef 100644 --- a/drivers/acpi/main.c +++ b/drivers/acpi/sleep.c | |||
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 073ff09218a..99e6f1f8ea4 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -416,7 +416,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
416 | } | 416 | } |
417 | 417 | ||
418 | /* Passive (optional) */ | 418 | /* Passive (optional) */ |
419 | if (flag & ACPI_TRIPS_PASSIVE) { | 419 | if (((flag & ACPI_TRIPS_PASSIVE) && tz->trips.passive.flags.valid) || |
420 | (flag == ACPI_TRIPS_INIT)) { | ||
420 | valid = tz->trips.passive.flags.valid; | 421 | valid = tz->trips.passive.flags.valid; |
421 | if (psv == -1) { | 422 | if (psv == -1) { |
422 | status = AE_SUPPORT; | 423 | status = AE_SUPPORT; |
@@ -462,8 +463,11 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
462 | memset(&devices, 0, sizeof(struct acpi_handle_list)); | 463 | memset(&devices, 0, sizeof(struct acpi_handle_list)); |
463 | status = acpi_evaluate_reference(tz->device->handle, "_PSL", | 464 | status = acpi_evaluate_reference(tz->device->handle, "_PSL", |
464 | NULL, &devices); | 465 | NULL, &devices); |
465 | if (ACPI_FAILURE(status)) | 466 | if (ACPI_FAILURE(status)) { |
467 | printk(KERN_WARNING PREFIX | ||
468 | "Invalid passive threshold\n"); | ||
466 | tz->trips.passive.flags.valid = 0; | 469 | tz->trips.passive.flags.valid = 0; |
470 | } | ||
467 | else | 471 | else |
468 | tz->trips.passive.flags.valid = 1; | 472 | tz->trips.passive.flags.valid = 1; |
469 | 473 | ||
@@ -487,7 +491,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
487 | if (act == -1) | 491 | if (act == -1) |
488 | break; /* disable all active trip points */ | 492 | break; /* disable all active trip points */ |
489 | 493 | ||
490 | if (flag & ACPI_TRIPS_ACTIVE) { | 494 | if ((flag == ACPI_TRIPS_INIT) || ((flag & ACPI_TRIPS_ACTIVE) && |
495 | tz->trips.active[i].flags.valid)) { | ||
491 | status = acpi_evaluate_integer(tz->device->handle, | 496 | status = acpi_evaluate_integer(tz->device->handle, |
492 | name, NULL, &tmp); | 497 | name, NULL, &tmp); |
493 | if (ACPI_FAILURE(status)) { | 498 | if (ACPI_FAILURE(status)) { |
@@ -521,8 +526,11 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
521 | memset(&devices, 0, sizeof(struct acpi_handle_list)); | 526 | memset(&devices, 0, sizeof(struct acpi_handle_list)); |
522 | status = acpi_evaluate_reference(tz->device->handle, | 527 | status = acpi_evaluate_reference(tz->device->handle, |
523 | name, NULL, &devices); | 528 | name, NULL, &devices); |
524 | if (ACPI_FAILURE(status)) | 529 | if (ACPI_FAILURE(status)) { |
530 | printk(KERN_WARNING PREFIX | ||
531 | "Invalid active%d threshold\n", i); | ||
525 | tz->trips.active[i].flags.valid = 0; | 532 | tz->trips.active[i].flags.valid = 0; |
533 | } | ||
526 | else | 534 | else |
527 | tz->trips.active[i].flags.valid = 1; | 535 | tz->trips.active[i].flags.valid = 1; |
528 | 536 | ||
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 1a7be96d627..503a908afc8 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -698,6 +698,15 @@ config PATA_IXP4XX_CF | |||
698 | 698 | ||
699 | If unsure, say N. | 699 | If unsure, say N. |
700 | 700 | ||
701 | config PATA_OCTEON_CF | ||
702 | tristate "OCTEON Boot Bus Compact Flash support" | ||
703 | depends on CPU_CAVIUM_OCTEON | ||
704 | help | ||
705 | This option enables a polled compact flash driver for use with | ||
706 | compact flash cards attached to the OCTEON boot bus. | ||
707 | |||
708 | If unsure, say N. | ||
709 | |||
701 | config PATA_SCC | 710 | config PATA_SCC |
702 | tristate "Toshiba's Cell Reference Set IDE support" | 711 | tristate "Toshiba's Cell Reference Set IDE support" |
703 | depends on PCI && PPC_CELLEB | 712 | depends on PCI && PPC_CELLEB |
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 674965fa326..7f1ecf99528 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -69,6 +69,7 @@ obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o | |||
69 | obj-$(CONFIG_PATA_SCC) += pata_scc.o | 69 | obj-$(CONFIG_PATA_SCC) += pata_scc.o |
70 | obj-$(CONFIG_PATA_SCH) += pata_sch.o | 70 | obj-$(CONFIG_PATA_SCH) += pata_sch.o |
71 | obj-$(CONFIG_PATA_BF54X) += pata_bf54x.o | 71 | obj-$(CONFIG_PATA_BF54X) += pata_bf54x.o |
72 | obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o | ||
72 | obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o | 73 | obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o |
73 | obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o | 74 | obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o |
74 | obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o | 75 | obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 71218d76d75..88c242856da 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3029,33 +3029,33 @@ int sata_set_spd(struct ata_link *link) | |||
3029 | */ | 3029 | */ |
3030 | 3030 | ||
3031 | static const struct ata_timing ata_timing[] = { | 3031 | static const struct ata_timing ata_timing[] = { |
3032 | /* { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 960, 0 }, */ | 3032 | /* { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 0, 960, 0 }, */ |
3033 | { XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0 }, | 3033 | { XFER_PIO_0, 70, 290, 240, 600, 165, 150, 0, 600, 0 }, |
3034 | { XFER_PIO_1, 50, 290, 93, 383, 125, 100, 383, 0 }, | 3034 | { XFER_PIO_1, 50, 290, 93, 383, 125, 100, 0, 383, 0 }, |
3035 | { XFER_PIO_2, 30, 290, 40, 330, 100, 90, 240, 0 }, | 3035 | { XFER_PIO_2, 30, 290, 40, 330, 100, 90, 0, 240, 0 }, |
3036 | { XFER_PIO_3, 30, 80, 70, 180, 80, 70, 180, 0 }, | 3036 | { XFER_PIO_3, 30, 80, 70, 180, 80, 70, 0, 180, 0 }, |
3037 | { XFER_PIO_4, 25, 70, 25, 120, 70, 25, 120, 0 }, | 3037 | { XFER_PIO_4, 25, 70, 25, 120, 70, 25, 0, 120, 0 }, |
3038 | { XFER_PIO_5, 15, 65, 25, 100, 65, 25, 100, 0 }, | 3038 | { XFER_PIO_5, 15, 65, 25, 100, 65, 25, 0, 100, 0 }, |
3039 | { XFER_PIO_6, 10, 55, 20, 80, 55, 20, 80, 0 }, | 3039 | { XFER_PIO_6, 10, 55, 20, 80, 55, 20, 0, 80, 0 }, |
3040 | 3040 | ||
3041 | { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 960, 0 }, | 3041 | { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 50, 960, 0 }, |
3042 | { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 480, 0 }, | 3042 | { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 30, 480, 0 }, |
3043 | { XFER_SW_DMA_2, 60, 0, 0, 0, 120, 120, 240, 0 }, | 3043 | { XFER_SW_DMA_2, 60, 0, 0, 0, 120, 120, 20, 240, 0 }, |
3044 | 3044 | ||
3045 | { XFER_MW_DMA_0, 60, 0, 0, 0, 215, 215, 480, 0 }, | 3045 | { XFER_MW_DMA_0, 60, 0, 0, 0, 215, 215, 20, 480, 0 }, |
3046 | { XFER_MW_DMA_1, 45, 0, 0, 0, 80, 50, 150, 0 }, | 3046 | { XFER_MW_DMA_1, 45, 0, 0, 0, 80, 50, 5, 150, 0 }, |
3047 | { XFER_MW_DMA_2, 25, 0, 0, 0, 70, 25, 120, 0 }, | 3047 | { XFER_MW_DMA_2, 25, 0, 0, 0, 70, 25, 5, 120, 0 }, |
3048 | { XFER_MW_DMA_3, 25, 0, 0, 0, 65, 25, 100, 0 }, | 3048 | { XFER_MW_DMA_3, 25, 0, 0, 0, 65, 25, 5, 100, 0 }, |
3049 | { XFER_MW_DMA_4, 25, 0, 0, 0, 55, 20, 80, 0 }, | 3049 | { XFER_MW_DMA_4, 25, 0, 0, 0, 55, 20, 5, 80, 0 }, |
3050 | 3050 | ||
3051 | /* { XFER_UDMA_SLOW, 0, 0, 0, 0, 0, 0, 0, 150 }, */ | 3051 | /* { XFER_UDMA_SLOW, 0, 0, 0, 0, 0, 0, 0, 0, 150 }, */ |
3052 | { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 120 }, | 3052 | { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 0, 120 }, |
3053 | { XFER_UDMA_1, 0, 0, 0, 0, 0, 0, 0, 80 }, | 3053 | { XFER_UDMA_1, 0, 0, 0, 0, 0, 0, 0, 0, 80 }, |
3054 | { XFER_UDMA_2, 0, 0, 0, 0, 0, 0, 0, 60 }, | 3054 | { XFER_UDMA_2, 0, 0, 0, 0, 0, 0, 0, 0, 60 }, |
3055 | { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 45 }, | 3055 | { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 0, 45 }, |
3056 | { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 30 }, | 3056 | { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 0, 30 }, |
3057 | { XFER_UDMA_5, 0, 0, 0, 0, 0, 0, 0, 20 }, | 3057 | { XFER_UDMA_5, 0, 0, 0, 0, 0, 0, 0, 0, 20 }, |
3058 | { XFER_UDMA_6, 0, 0, 0, 0, 0, 0, 0, 15 }, | 3058 | { XFER_UDMA_6, 0, 0, 0, 0, 0, 0, 0, 0, 15 }, |
3059 | 3059 | ||
3060 | { 0xFF } | 3060 | { 0xFF } |
3061 | }; | 3061 | }; |
@@ -3065,14 +3065,15 @@ static const struct ata_timing ata_timing[] = { | |||
3065 | 3065 | ||
3066 | static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT) | 3066 | static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT) |
3067 | { | 3067 | { |
3068 | q->setup = EZ(t->setup * 1000, T); | 3068 | q->setup = EZ(t->setup * 1000, T); |
3069 | q->act8b = EZ(t->act8b * 1000, T); | 3069 | q->act8b = EZ(t->act8b * 1000, T); |
3070 | q->rec8b = EZ(t->rec8b * 1000, T); | 3070 | q->rec8b = EZ(t->rec8b * 1000, T); |
3071 | q->cyc8b = EZ(t->cyc8b * 1000, T); | 3071 | q->cyc8b = EZ(t->cyc8b * 1000, T); |
3072 | q->active = EZ(t->active * 1000, T); | 3072 | q->active = EZ(t->active * 1000, T); |
3073 | q->recover = EZ(t->recover * 1000, T); | 3073 | q->recover = EZ(t->recover * 1000, T); |
3074 | q->cycle = EZ(t->cycle * 1000, T); | 3074 | q->dmack_hold = EZ(t->dmack_hold * 1000, T); |
3075 | q->udma = EZ(t->udma * 1000, UT); | 3075 | q->cycle = EZ(t->cycle * 1000, T); |
3076 | q->udma = EZ(t->udma * 1000, UT); | ||
3076 | } | 3077 | } |
3077 | 3078 | ||
3078 | void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b, | 3079 | void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b, |
@@ -3084,6 +3085,7 @@ void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b, | |||
3084 | if (what & ATA_TIMING_CYC8B ) m->cyc8b = max(a->cyc8b, b->cyc8b); | 3085 | if (what & ATA_TIMING_CYC8B ) m->cyc8b = max(a->cyc8b, b->cyc8b); |
3085 | if (what & ATA_TIMING_ACTIVE ) m->active = max(a->active, b->active); | 3086 | if (what & ATA_TIMING_ACTIVE ) m->active = max(a->active, b->active); |
3086 | if (what & ATA_TIMING_RECOVER) m->recover = max(a->recover, b->recover); | 3087 | if (what & ATA_TIMING_RECOVER) m->recover = max(a->recover, b->recover); |
3088 | if (what & ATA_TIMING_DMACK_HOLD) m->dmack_hold = max(a->dmack_hold, b->dmack_hold); | ||
3087 | if (what & ATA_TIMING_CYCLE ) m->cycle = max(a->cycle, b->cycle); | 3089 | if (what & ATA_TIMING_CYCLE ) m->cycle = max(a->cycle, b->cycle); |
3088 | if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma); | 3090 | if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma); |
3089 | } | 3091 | } |
@@ -6638,7 +6640,6 @@ EXPORT_SYMBOL_GPL(ata_dev_pair); | |||
6638 | EXPORT_SYMBOL_GPL(ata_port_disable); | 6640 | EXPORT_SYMBOL_GPL(ata_port_disable); |
6639 | EXPORT_SYMBOL_GPL(ata_ratelimit); | 6641 | EXPORT_SYMBOL_GPL(ata_ratelimit); |
6640 | EXPORT_SYMBOL_GPL(ata_wait_register); | 6642 | EXPORT_SYMBOL_GPL(ata_wait_register); |
6641 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); | ||
6642 | EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); | 6643 | EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); |
6643 | EXPORT_SYMBOL_GPL(ata_scsi_slave_config); | 6644 | EXPORT_SYMBOL_GPL(ata_scsi_slave_config); |
6644 | EXPORT_SYMBOL_GPL(ata_scsi_slave_destroy); | 6645 | EXPORT_SYMBOL_GPL(ata_scsi_slave_destroy); |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 9e92107691f..a1a6e6298c3 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -423,9 +423,9 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev, | |||
423 | * RETURNS: | 423 | * RETURNS: |
424 | * Zero on success, negative errno on error. | 424 | * Zero on success, negative errno on error. |
425 | */ | 425 | */ |
426 | static int ata_get_identity(struct scsi_device *sdev, void __user *arg) | 426 | static int ata_get_identity(struct ata_port *ap, struct scsi_device *sdev, |
427 | void __user *arg) | ||
427 | { | 428 | { |
428 | struct ata_port *ap = ata_shost_to_port(sdev->host); | ||
429 | struct ata_device *dev = ata_scsi_find_dev(ap, sdev); | 429 | struct ata_device *dev = ata_scsi_find_dev(ap, sdev); |
430 | u16 __user *dst = arg; | 430 | u16 __user *dst = arg; |
431 | char buf[40]; | 431 | char buf[40]; |
@@ -645,7 +645,8 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg) | |||
645 | return rc; | 645 | return rc; |
646 | } | 646 | } |
647 | 647 | ||
648 | int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) | 648 | int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *scsidev, |
649 | int cmd, void __user *arg) | ||
649 | { | 650 | { |
650 | int val = -EINVAL, rc = -EINVAL; | 651 | int val = -EINVAL, rc = -EINVAL; |
651 | 652 | ||
@@ -663,7 +664,7 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) | |||
663 | return 0; | 664 | return 0; |
664 | 665 | ||
665 | case HDIO_GET_IDENTITY: | 666 | case HDIO_GET_IDENTITY: |
666 | return ata_get_identity(scsidev, arg); | 667 | return ata_get_identity(ap, scsidev, arg); |
667 | 668 | ||
668 | case HDIO_DRIVE_CMD: | 669 | case HDIO_DRIVE_CMD: |
669 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) | 670 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) |
@@ -682,6 +683,14 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) | |||
682 | 683 | ||
683 | return rc; | 684 | return rc; |
684 | } | 685 | } |
686 | EXPORT_SYMBOL_GPL(ata_sas_scsi_ioctl); | ||
687 | |||
688 | int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) | ||
689 | { | ||
690 | return ata_sas_scsi_ioctl(ata_shost_to_port(scsidev->host), | ||
691 | scsidev, cmd, arg); | ||
692 | } | ||
693 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); | ||
685 | 694 | ||
686 | /** | 695 | /** |
687 | * ata_scsi_qc_new - acquire new ata_queued_cmd reference | 696 | * ata_scsi_qc_new - acquire new ata_queued_cmd reference |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index a7999c19f0c..eb99dbe7808 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -41,7 +41,7 @@ static int ali_atapi_dma = 0; | |||
41 | module_param_named(atapi_dma, ali_atapi_dma, int, 0644); | 41 | module_param_named(atapi_dma, ali_atapi_dma, int, 0644); |
42 | MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)"); | 42 | MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)"); |
43 | 43 | ||
44 | static struct pci_dev *isa_bridge; | 44 | static struct pci_dev *ali_isa_bridge; |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * Cable special cases | 47 | * Cable special cases |
@@ -346,13 +346,13 @@ static void ali_c2_c3_postreset(struct ata_link *link, unsigned int *classes) | |||
346 | int port_bit = 4 << link->ap->port_no; | 346 | int port_bit = 4 << link->ap->port_no; |
347 | 347 | ||
348 | /* If our bridge is an ALI 1533 then do the extra work */ | 348 | /* If our bridge is an ALI 1533 then do the extra work */ |
349 | if (isa_bridge) { | 349 | if (ali_isa_bridge) { |
350 | /* Tristate and re-enable the bus signals */ | 350 | /* Tristate and re-enable the bus signals */ |
351 | pci_read_config_byte(isa_bridge, 0x58, &r); | 351 | pci_read_config_byte(ali_isa_bridge, 0x58, &r); |
352 | r &= ~port_bit; | 352 | r &= ~port_bit; |
353 | pci_write_config_byte(isa_bridge, 0x58, r); | 353 | pci_write_config_byte(ali_isa_bridge, 0x58, r); |
354 | r |= port_bit; | 354 | r |= port_bit; |
355 | pci_write_config_byte(isa_bridge, 0x58, r); | 355 | pci_write_config_byte(ali_isa_bridge, 0x58, r); |
356 | } | 356 | } |
357 | ata_sff_postreset(link, classes); | 357 | ata_sff_postreset(link, classes); |
358 | } | 358 | } |
@@ -467,14 +467,14 @@ static void ali_init_chipset(struct pci_dev *pdev) | |||
467 | pci_write_config_byte(pdev, 0x53, tmp); | 467 | pci_write_config_byte(pdev, 0x53, tmp); |
468 | } | 468 | } |
469 | north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); | 469 | north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); |
470 | if (north && north->vendor == PCI_VENDOR_ID_AL && isa_bridge) { | 470 | if (north && north->vendor == PCI_VENDOR_ID_AL && ali_isa_bridge) { |
471 | /* Configure the ALi bridge logic. For non ALi rely on BIOS. | 471 | /* Configure the ALi bridge logic. For non ALi rely on BIOS. |
472 | Set the south bridge enable bit */ | 472 | Set the south bridge enable bit */ |
473 | pci_read_config_byte(isa_bridge, 0x79, &tmp); | 473 | pci_read_config_byte(ali_isa_bridge, 0x79, &tmp); |
474 | if (pdev->revision == 0xC2) | 474 | if (pdev->revision == 0xC2) |
475 | pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04); | 475 | pci_write_config_byte(ali_isa_bridge, 0x79, tmp | 0x04); |
476 | else if (pdev->revision > 0xC2 && pdev->revision < 0xC5) | 476 | else if (pdev->revision > 0xC2 && pdev->revision < 0xC5) |
477 | pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02); | 477 | pci_write_config_byte(ali_isa_bridge, 0x79, tmp | 0x02); |
478 | } | 478 | } |
479 | pci_dev_put(north); | 479 | pci_dev_put(north); |
480 | ata_pci_bmdma_clear_simplex(pdev); | 480 | ata_pci_bmdma_clear_simplex(pdev); |
@@ -571,9 +571,9 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
571 | 571 | ||
572 | ali_init_chipset(pdev); | 572 | ali_init_chipset(pdev); |
573 | 573 | ||
574 | if (isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) { | 574 | if (ali_isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) { |
575 | /* Are we paired with a UDMA capable chip */ | 575 | /* Are we paired with a UDMA capable chip */ |
576 | pci_read_config_byte(isa_bridge, 0x5E, &tmp); | 576 | pci_read_config_byte(ali_isa_bridge, 0x5E, &tmp); |
577 | if ((tmp & 0x1E) == 0x12) | 577 | if ((tmp & 0x1E) == 0x12) |
578 | ppi[0] = &info_20_udma; | 578 | ppi[0] = &info_20_udma; |
579 | } | 579 | } |
@@ -617,11 +617,11 @@ static struct pci_driver ali_pci_driver = { | |||
617 | static int __init ali_init(void) | 617 | static int __init ali_init(void) |
618 | { | 618 | { |
619 | int ret; | 619 | int ret; |
620 | isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); | 620 | ali_isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); |
621 | 621 | ||
622 | ret = pci_register_driver(&ali_pci_driver); | 622 | ret = pci_register_driver(&ali_pci_driver); |
623 | if (ret < 0) | 623 | if (ret < 0) |
624 | pci_dev_put(isa_bridge); | 624 | pci_dev_put(ali_isa_bridge); |
625 | return ret; | 625 | return ret; |
626 | } | 626 | } |
627 | 627 | ||
@@ -629,7 +629,7 @@ static int __init ali_init(void) | |||
629 | static void __exit ali_exit(void) | 629 | static void __exit ali_exit(void) |
630 | { | 630 | { |
631 | pci_unregister_driver(&ali_pci_driver); | 631 | pci_unregister_driver(&ali_pci_driver); |
632 | pci_dev_put(isa_bridge); | 632 | pci_dev_put(ali_isa_bridge); |
633 | } | 633 | } |
634 | 634 | ||
635 | 635 | ||
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index 0e2cde8f997..506adde8ebb 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -32,21 +32,6 @@ enum { | |||
32 | ATIIXP_IDE_UDMA_MODE = 0x56 | 32 | ATIIXP_IDE_UDMA_MODE = 0x56 |
33 | }; | 33 | }; |
34 | 34 | ||
35 | static int atiixp_pre_reset(struct ata_link *link, unsigned long deadline) | ||
36 | { | ||
37 | struct ata_port *ap = link->ap; | ||
38 | static const struct pci_bits atiixp_enable_bits[] = { | ||
39 | { 0x48, 1, 0x01, 0x00 }, | ||
40 | { 0x48, 1, 0x08, 0x00 } | ||
41 | }; | ||
42 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
43 | |||
44 | if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no])) | ||
45 | return -ENOENT; | ||
46 | |||
47 | return ata_sff_prereset(link, deadline); | ||
48 | } | ||
49 | |||
50 | static int atiixp_cable_detect(struct ata_port *ap) | 35 | static int atiixp_cable_detect(struct ata_port *ap) |
51 | { | 36 | { |
52 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 37 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
@@ -229,10 +214,9 @@ static struct ata_port_operations atiixp_port_ops = { | |||
229 | .cable_detect = atiixp_cable_detect, | 214 | .cable_detect = atiixp_cable_detect, |
230 | .set_piomode = atiixp_set_piomode, | 215 | .set_piomode = atiixp_set_piomode, |
231 | .set_dmamode = atiixp_set_dmamode, | 216 | .set_dmamode = atiixp_set_dmamode, |
232 | .prereset = atiixp_pre_reset, | ||
233 | }; | 217 | }; |
234 | 218 | ||
235 | static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 219 | static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
236 | { | 220 | { |
237 | static const struct ata_port_info info = { | 221 | static const struct ata_port_info info = { |
238 | .flags = ATA_FLAG_SLAVE_POSS, | 222 | .flags = ATA_FLAG_SLAVE_POSS, |
@@ -241,8 +225,18 @@ static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
241 | .udma_mask = 0x3F, | 225 | .udma_mask = 0x3F, |
242 | .port_ops = &atiixp_port_ops | 226 | .port_ops = &atiixp_port_ops |
243 | }; | 227 | }; |
244 | const struct ata_port_info *ppi[] = { &info, NULL }; | 228 | static const struct pci_bits atiixp_enable_bits[] = { |
245 | return ata_pci_sff_init_one(dev, ppi, &atiixp_sht, NULL); | 229 | { 0x48, 1, 0x01, 0x00 }, |
230 | { 0x48, 1, 0x08, 0x00 } | ||
231 | }; | ||
232 | const struct ata_port_info *ppi[] = { &info, &info }; | ||
233 | int i; | ||
234 | |||
235 | for (i = 0; i < 2; i++) | ||
236 | if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i])) | ||
237 | ppi[i] = &ata_dummy_port_info; | ||
238 | |||
239 | return ata_pci_sff_init_one(pdev, ppi, &atiixp_sht, NULL); | ||
246 | } | 240 | } |
247 | 241 | ||
248 | static const struct pci_device_id atiixp[] = { | 242 | static const struct pci_device_id atiixp[] = { |
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c new file mode 100644 index 00000000000..0fe4ef309c6 --- /dev/null +++ b/drivers/ata/pata_octeon_cf.c | |||
@@ -0,0 +1,965 @@ | |||
1 | /* | ||
2 | * Driver for the Octeon bootbus compact flash. | ||
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) 2005 - 2009 Cavium Networks | ||
9 | * Copyright (C) 2008 Wind River Systems | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/libata.h> | ||
15 | #include <linux/irq.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/workqueue.h> | ||
18 | #include <scsi/scsi_host.h> | ||
19 | |||
20 | #include <asm/octeon/octeon.h> | ||
21 | |||
22 | /* | ||
23 | * The Octeon bootbus compact flash interface is connected in at least | ||
24 | * 3 different configurations on various evaluation boards: | ||
25 | * | ||
26 | * -- 8 bits no irq, no DMA | ||
27 | * -- 16 bits no irq, no DMA | ||
28 | * -- 16 bits True IDE mode with DMA, but no irq. | ||
29 | * | ||
30 | * In the last case the DMA engine can generate an interrupt when the | ||
31 | * transfer is complete. For the first two cases only PIO is supported. | ||
32 | * | ||
33 | */ | ||
34 | |||
35 | #define DRV_NAME "pata_octeon_cf" | ||
36 | #define DRV_VERSION "2.1" | ||
37 | |||
38 | |||
39 | struct octeon_cf_port { | ||
40 | struct workqueue_struct *wq; | ||
41 | struct delayed_work delayed_finish; | ||
42 | struct ata_port *ap; | ||
43 | int dma_finished; | ||
44 | }; | ||
45 | |||
46 | static struct scsi_host_template octeon_cf_sht = { | ||
47 | ATA_PIO_SHT(DRV_NAME), | ||
48 | }; | ||
49 | |||
50 | /** | ||
51 | * Convert nanosecond based time to setting used in the | ||
52 | * boot bus timing register, based on timing multiple | ||
53 | */ | ||
54 | static unsigned int ns_to_tim_reg(unsigned int tim_mult, unsigned int nsecs) | ||
55 | { | ||
56 | unsigned int val; | ||
57 | |||
58 | /* | ||
59 | * Compute # of eclock periods to get desired duration in | ||
60 | * nanoseconds. | ||
61 | */ | ||
62 | val = DIV_ROUND_UP(nsecs * (octeon_get_clock_rate() / 1000000), | ||
63 | 1000 * tim_mult); | ||
64 | |||
65 | return val; | ||
66 | } | ||
67 | |||
68 | static void octeon_cf_set_boot_reg_cfg(int cs) | ||
69 | { | ||
70 | union cvmx_mio_boot_reg_cfgx reg_cfg; | ||
71 | reg_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(cs)); | ||
72 | reg_cfg.s.dmack = 0; /* Don't assert DMACK on access */ | ||
73 | reg_cfg.s.tim_mult = 2; /* Timing mutiplier 2x */ | ||
74 | reg_cfg.s.rd_dly = 0; /* Sample on falling edge of BOOT_OE */ | ||
75 | reg_cfg.s.sam = 0; /* Don't combine write and output enable */ | ||
76 | reg_cfg.s.we_ext = 0; /* No write enable extension */ | ||
77 | reg_cfg.s.oe_ext = 0; /* No read enable extension */ | ||
78 | reg_cfg.s.en = 1; /* Enable this region */ | ||
79 | reg_cfg.s.orbit = 0; /* Don't combine with previous region */ | ||
80 | reg_cfg.s.ale = 0; /* Don't do address multiplexing */ | ||
81 | cvmx_write_csr(CVMX_MIO_BOOT_REG_CFGX(cs), reg_cfg.u64); | ||
82 | } | ||
83 | |||
84 | /** | ||
85 | * Called after libata determines the needed PIO mode. This | ||
86 | * function programs the Octeon bootbus regions to support the | ||
87 | * timing requirements of the PIO mode. | ||
88 | * | ||
89 | * @ap: ATA port information | ||
90 | * @dev: ATA device | ||
91 | */ | ||
92 | static void octeon_cf_set_piomode(struct ata_port *ap, struct ata_device *dev) | ||
93 | { | ||
94 | struct octeon_cf_data *ocd = ap->dev->platform_data; | ||
95 | union cvmx_mio_boot_reg_timx reg_tim; | ||
96 | int cs = ocd->base_region; | ||
97 | int T; | ||
98 | struct ata_timing timing; | ||
99 | |||
100 | int use_iordy; | ||
101 | int trh; | ||
102 | int pause; | ||
103 | /* These names are timing parameters from the ATA spec */ | ||
104 | int t1; | ||
105 | int t2; | ||
106 | int t2i; | ||
107 | |||
108 | T = (int)(2000000000000LL / octeon_get_clock_rate()); | ||
109 | |||
110 | if (ata_timing_compute(dev, dev->pio_mode, &timing, T, T)) | ||
111 | BUG(); | ||
112 | |||
113 | t1 = timing.setup; | ||
114 | if (t1) | ||
115 | t1--; | ||
116 | t2 = timing.active; | ||
117 | if (t2) | ||
118 | t2--; | ||
119 | t2i = timing.act8b; | ||
120 | if (t2i) | ||
121 | t2i--; | ||
122 | |||
123 | trh = ns_to_tim_reg(2, 20); | ||
124 | if (trh) | ||
125 | trh--; | ||
126 | |||
127 | pause = timing.cycle - timing.active - timing.setup - trh; | ||
128 | if (pause) | ||
129 | pause--; | ||
130 | |||
131 | octeon_cf_set_boot_reg_cfg(cs); | ||
132 | if (ocd->dma_engine >= 0) | ||
133 | /* True IDE mode, program both chip selects. */ | ||
134 | octeon_cf_set_boot_reg_cfg(cs + 1); | ||
135 | |||
136 | |||
137 | use_iordy = ata_pio_need_iordy(dev); | ||
138 | |||
139 | reg_tim.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_TIMX(cs)); | ||
140 | /* Disable page mode */ | ||
141 | reg_tim.s.pagem = 0; | ||
142 | /* Enable dynamic timing */ | ||
143 | reg_tim.s.waitm = use_iordy; | ||
144 | /* Pages are disabled */ | ||
145 | reg_tim.s.pages = 0; | ||
146 | /* We don't use multiplexed address mode */ | ||
147 | reg_tim.s.ale = 0; | ||
148 | /* Not used */ | ||
149 | reg_tim.s.page = 0; | ||
150 | /* Time after IORDY to coninue to assert the data */ | ||
151 | reg_tim.s.wait = 0; | ||
152 | /* Time to wait to complete the cycle. */ | ||
153 | reg_tim.s.pause = pause; | ||
154 | /* How long to hold after a write to de-assert CE. */ | ||
155 | reg_tim.s.wr_hld = trh; | ||
156 | /* How long to wait after a read to de-assert CE. */ | ||
157 | reg_tim.s.rd_hld = trh; | ||
158 | /* How long write enable is asserted */ | ||
159 | reg_tim.s.we = t2; | ||
160 | /* How long read enable is asserted */ | ||
161 | reg_tim.s.oe = t2; | ||
162 | /* Time after CE that read/write starts */ | ||
163 | reg_tim.s.ce = ns_to_tim_reg(2, 5); | ||
164 | /* Time before CE that address is valid */ | ||
165 | reg_tim.s.adr = 0; | ||
166 | |||
167 | /* Program the bootbus region timing for the data port chip select. */ | ||
168 | cvmx_write_csr(CVMX_MIO_BOOT_REG_TIMX(cs), reg_tim.u64); | ||
169 | if (ocd->dma_engine >= 0) | ||
170 | /* True IDE mode, program both chip selects. */ | ||
171 | cvmx_write_csr(CVMX_MIO_BOOT_REG_TIMX(cs + 1), reg_tim.u64); | ||
172 | } | ||
173 | |||
174 | static void octeon_cf_set_dmamode(struct ata_port *ap, struct ata_device *dev) | ||
175 | { | ||
176 | struct octeon_cf_data *ocd = dev->link->ap->dev->platform_data; | ||
177 | union cvmx_mio_boot_dma_timx dma_tim; | ||
178 | unsigned int oe_a; | ||
179 | unsigned int oe_n; | ||
180 | unsigned int dma_ackh; | ||
181 | unsigned int dma_arq; | ||
182 | unsigned int pause; | ||
183 | unsigned int T0, Tkr, Td; | ||
184 | unsigned int tim_mult; | ||
185 | |||
186 | const struct ata_timing *timing; | ||
187 | |||
188 | timing = ata_timing_find_mode(dev->dma_mode); | ||
189 | T0 = timing->cycle; | ||
190 | Td = timing->active; | ||
191 | Tkr = timing->recover; | ||
192 | dma_ackh = timing->dmack_hold; | ||
193 | |||
194 | dma_tim.u64 = 0; | ||
195 | /* dma_tim.s.tim_mult = 0 --> 4x */ | ||
196 | tim_mult = 4; | ||
197 | |||
198 | /* not spec'ed, value in eclocks, not affected by tim_mult */ | ||
199 | dma_arq = 8; | ||
200 | pause = 25 - dma_arq * 1000 / | ||
201 | (octeon_get_clock_rate() / 1000000); /* Tz */ | ||
202 | |||
203 | oe_a = Td; | ||
204 | /* Tkr from cf spec, lengthened to meet T0 */ | ||
205 | oe_n = max(T0 - oe_a, Tkr); | ||
206 | |||
207 | dma_tim.s.dmack_pi = 1; | ||
208 | |||
209 | dma_tim.s.oe_n = ns_to_tim_reg(tim_mult, oe_n); | ||
210 | dma_tim.s.oe_a = ns_to_tim_reg(tim_mult, oe_a); | ||
211 | |||
212 | /* | ||
213 | * This is tI, C.F. spec. says 0, but Sony CF card requires | ||
214 | * more, we use 20 nS. | ||
215 | */ | ||
216 | dma_tim.s.dmack_s = ns_to_tim_reg(tim_mult, 20);; | ||
217 | dma_tim.s.dmack_h = ns_to_tim_reg(tim_mult, dma_ackh); | ||
218 | |||
219 | dma_tim.s.dmarq = dma_arq; | ||
220 | dma_tim.s.pause = ns_to_tim_reg(tim_mult, pause); | ||
221 | |||
222 | dma_tim.s.rd_dly = 0; /* Sample right on edge */ | ||
223 | |||
224 | /* writes only */ | ||
225 | dma_tim.s.we_n = ns_to_tim_reg(tim_mult, oe_n); | ||
226 | dma_tim.s.we_a = ns_to_tim_reg(tim_mult, oe_a); | ||
227 | |||
228 | pr_debug("ns to ticks (mult %d) of %d is: %d\n", tim_mult, 60, | ||
229 | ns_to_tim_reg(tim_mult, 60)); | ||
230 | pr_debug("oe_n: %d, oe_a: %d, dmack_s: %d, dmack_h: " | ||
231 | "%d, dmarq: %d, pause: %d\n", | ||
232 | dma_tim.s.oe_n, dma_tim.s.oe_a, dma_tim.s.dmack_s, | ||
233 | dma_tim.s.dmack_h, dma_tim.s.dmarq, dma_tim.s.pause); | ||
234 | |||
235 | cvmx_write_csr(CVMX_MIO_BOOT_DMA_TIMX(ocd->dma_engine), | ||
236 | dma_tim.u64); | ||
237 | |||
238 | } | ||
239 | |||
240 | /** | ||
241 | * Handle an 8 bit I/O request. | ||
242 | * | ||
243 | * @dev: Device to access | ||
244 | * @buffer: Data buffer | ||
245 | * @buflen: Length of the buffer. | ||
246 | * @rw: True to write. | ||
247 | */ | ||
248 | static unsigned int octeon_cf_data_xfer8(struct ata_device *dev, | ||
249 | unsigned char *buffer, | ||
250 | unsigned int buflen, | ||
251 | int rw) | ||
252 | { | ||
253 | struct ata_port *ap = dev->link->ap; | ||
254 | void __iomem *data_addr = ap->ioaddr.data_addr; | ||
255 | unsigned long words; | ||
256 | int count; | ||
257 | |||
258 | words = buflen; | ||
259 | if (rw) { | ||
260 | count = 16; | ||
261 | while (words--) { | ||
262 | iowrite8(*buffer, data_addr); | ||
263 | buffer++; | ||
264 | /* | ||
265 | * Every 16 writes do a read so the bootbus | ||
266 | * FIFO doesn't fill up. | ||
267 | */ | ||
268 | if (--count == 0) { | ||
269 | ioread8(ap->ioaddr.altstatus_addr); | ||
270 | count = 16; | ||
271 | } | ||
272 | } | ||
273 | } else { | ||
274 | ioread8_rep(data_addr, buffer, words); | ||
275 | } | ||
276 | return buflen; | ||
277 | } | ||
278 | |||
279 | /** | ||
280 | * Handle a 16 bit I/O request. | ||
281 | * | ||
282 | * @dev: Device to access | ||
283 | * @buffer: Data buffer | ||
284 | * @buflen: Length of the buffer. | ||
285 | * @rw: True to write. | ||
286 | */ | ||
287 | static unsigned int octeon_cf_data_xfer16(struct ata_device *dev, | ||
288 | unsigned char *buffer, | ||
289 | unsigned int buflen, | ||
290 | int rw) | ||
291 | { | ||
292 | struct ata_port *ap = dev->link->ap; | ||
293 | void __iomem *data_addr = ap->ioaddr.data_addr; | ||
294 | unsigned long words; | ||
295 | int count; | ||
296 | |||
297 | words = buflen / 2; | ||
298 | if (rw) { | ||
299 | count = 16; | ||
300 | while (words--) { | ||
301 | iowrite16(*(uint16_t *)buffer, data_addr); | ||
302 | buffer += sizeof(uint16_t); | ||
303 | /* | ||
304 | * Every 16 writes do a read so the bootbus | ||
305 | * FIFO doesn't fill up. | ||
306 | */ | ||
307 | if (--count == 0) { | ||
308 | ioread8(ap->ioaddr.altstatus_addr); | ||
309 | count = 16; | ||
310 | } | ||
311 | } | ||
312 | } else { | ||
313 | while (words--) { | ||
314 | *(uint16_t *)buffer = ioread16(data_addr); | ||
315 | buffer += sizeof(uint16_t); | ||
316 | } | ||
317 | } | ||
318 | /* Transfer trailing 1 byte, if any. */ | ||
319 | if (unlikely(buflen & 0x01)) { | ||
320 | __le16 align_buf[1] = { 0 }; | ||
321 | |||
322 | if (rw == READ) { | ||
323 | align_buf[0] = cpu_to_le16(ioread16(data_addr)); | ||
324 | memcpy(buffer, align_buf, 1); | ||
325 | } else { | ||
326 | memcpy(align_buf, buffer, 1); | ||
327 | iowrite16(le16_to_cpu(align_buf[0]), data_addr); | ||
328 | } | ||
329 | words++; | ||
330 | } | ||
331 | return buflen; | ||
332 | } | ||
333 | |||
334 | /** | ||
335 | * Read the taskfile for 16bit non-True IDE only. | ||
336 | */ | ||
337 | static void octeon_cf_tf_read16(struct ata_port *ap, struct ata_taskfile *tf) | ||
338 | { | ||
339 | u16 blob; | ||
340 | /* The base of the registers is at ioaddr.data_addr. */ | ||
341 | void __iomem *base = ap->ioaddr.data_addr; | ||
342 | |||
343 | blob = __raw_readw(base + 0xc); | ||
344 | tf->feature = blob >> 8; | ||
345 | |||
346 | blob = __raw_readw(base + 2); | ||
347 | tf->nsect = blob & 0xff; | ||
348 | tf->lbal = blob >> 8; | ||
349 | |||
350 | blob = __raw_readw(base + 4); | ||
351 | tf->lbam = blob & 0xff; | ||
352 | tf->lbah = blob >> 8; | ||
353 | |||
354 | blob = __raw_readw(base + 6); | ||
355 | tf->device = blob & 0xff; | ||
356 | tf->command = blob >> 8; | ||
357 | |||
358 | if (tf->flags & ATA_TFLAG_LBA48) { | ||
359 | if (likely(ap->ioaddr.ctl_addr)) { | ||
360 | iowrite8(tf->ctl | ATA_HOB, ap->ioaddr.ctl_addr); | ||
361 | |||
362 | blob = __raw_readw(base + 0xc); | ||
363 | tf->hob_feature = blob >> 8; | ||
364 | |||
365 | blob = __raw_readw(base + 2); | ||
366 | tf->hob_nsect = blob & 0xff; | ||
367 | tf->hob_lbal = blob >> 8; | ||
368 | |||
369 | blob = __raw_readw(base + 4); | ||
370 | tf->hob_lbam = blob & 0xff; | ||
371 | tf->hob_lbah = blob >> 8; | ||
372 | |||
373 | iowrite8(tf->ctl, ap->ioaddr.ctl_addr); | ||
374 | ap->last_ctl = tf->ctl; | ||
375 | } else { | ||
376 | WARN_ON(1); | ||
377 | } | ||
378 | } | ||
379 | } | ||
380 | |||
381 | static u8 octeon_cf_check_status16(struct ata_port *ap) | ||
382 | { | ||
383 | u16 blob; | ||
384 | void __iomem *base = ap->ioaddr.data_addr; | ||
385 | |||
386 | blob = __raw_readw(base + 6); | ||
387 | return blob >> 8; | ||
388 | } | ||
389 | |||
390 | static int octeon_cf_softreset16(struct ata_link *link, unsigned int *classes, | ||
391 | unsigned long deadline) | ||
392 | { | ||
393 | struct ata_port *ap = link->ap; | ||
394 | void __iomem *base = ap->ioaddr.data_addr; | ||
395 | int rc; | ||
396 | u8 err; | ||
397 | |||
398 | DPRINTK("about to softreset\n"); | ||
399 | __raw_writew(ap->ctl, base + 0xe); | ||
400 | udelay(20); | ||
401 | __raw_writew(ap->ctl | ATA_SRST, base + 0xe); | ||
402 | udelay(20); | ||
403 | __raw_writew(ap->ctl, base + 0xe); | ||
404 | |||
405 | rc = ata_sff_wait_after_reset(link, 1, deadline); | ||
406 | if (rc) { | ||
407 | ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc); | ||
408 | return rc; | ||
409 | } | ||
410 | |||
411 | /* determine by signature whether we have ATA or ATAPI devices */ | ||
412 | classes[0] = ata_sff_dev_classify(&link->device[0], 1, &err); | ||
413 | DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]); | ||
414 | return 0; | ||
415 | } | ||
416 | |||
417 | /** | ||
418 | * Load the taskfile for 16bit non-True IDE only. The device_addr is | ||
419 | * not loaded, we do this as part of octeon_cf_exec_command16. | ||
420 | */ | ||
421 | static void octeon_cf_tf_load16(struct ata_port *ap, | ||
422 | const struct ata_taskfile *tf) | ||
423 | { | ||
424 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | ||
425 | /* The base of the registers is at ioaddr.data_addr. */ | ||
426 | void __iomem *base = ap->ioaddr.data_addr; | ||
427 | |||
428 | if (tf->ctl != ap->last_ctl) { | ||
429 | iowrite8(tf->ctl, ap->ioaddr.ctl_addr); | ||
430 | ap->last_ctl = tf->ctl; | ||
431 | ata_wait_idle(ap); | ||
432 | } | ||
433 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { | ||
434 | __raw_writew(tf->hob_feature << 8, base + 0xc); | ||
435 | __raw_writew(tf->hob_nsect | tf->hob_lbal << 8, base + 2); | ||
436 | __raw_writew(tf->hob_lbam | tf->hob_lbah << 8, base + 4); | ||
437 | VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", | ||
438 | tf->hob_feature, | ||
439 | tf->hob_nsect, | ||
440 | tf->hob_lbal, | ||
441 | tf->hob_lbam, | ||
442 | tf->hob_lbah); | ||
443 | } | ||
444 | if (is_addr) { | ||
445 | __raw_writew(tf->feature << 8, base + 0xc); | ||
446 | __raw_writew(tf->nsect | tf->lbal << 8, base + 2); | ||
447 | __raw_writew(tf->lbam | tf->lbah << 8, base + 4); | ||
448 | VPRINTK("feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", | ||
449 | tf->feature, | ||
450 | tf->nsect, | ||
451 | tf->lbal, | ||
452 | tf->lbam, | ||
453 | tf->lbah); | ||
454 | } | ||
455 | ata_wait_idle(ap); | ||
456 | } | ||
457 | |||
458 | |||
459 | static void octeon_cf_dev_select(struct ata_port *ap, unsigned int device) | ||
460 | { | ||
461 | /* There is only one device, do nothing. */ | ||
462 | return; | ||
463 | } | ||
464 | |||
465 | /* | ||
466 | * Issue ATA command to host controller. The device_addr is also sent | ||
467 | * as it must be written in a combined write with the command. | ||
468 | */ | ||
469 | static void octeon_cf_exec_command16(struct ata_port *ap, | ||
470 | const struct ata_taskfile *tf) | ||
471 | { | ||
472 | /* The base of the registers is at ioaddr.data_addr. */ | ||
473 | void __iomem *base = ap->ioaddr.data_addr; | ||
474 | u16 blob; | ||
475 | |||
476 | if (tf->flags & ATA_TFLAG_DEVICE) { | ||
477 | VPRINTK("device 0x%X\n", tf->device); | ||
478 | blob = tf->device; | ||
479 | } else { | ||
480 | blob = 0; | ||
481 | } | ||
482 | |||
483 | DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); | ||
484 | blob |= (tf->command << 8); | ||
485 | __raw_writew(blob, base + 6); | ||
486 | |||
487 | |||
488 | ata_wait_idle(ap); | ||
489 | } | ||
490 | |||
491 | static u8 octeon_cf_irq_on(struct ata_port *ap) | ||
492 | { | ||
493 | return 0; | ||
494 | } | ||
495 | |||
496 | static void octeon_cf_irq_clear(struct ata_port *ap) | ||
497 | { | ||
498 | return; | ||
499 | } | ||
500 | |||
501 | static void octeon_cf_dma_setup(struct ata_queued_cmd *qc) | ||
502 | { | ||
503 | struct ata_port *ap = qc->ap; | ||
504 | struct octeon_cf_port *cf_port; | ||
505 | |||
506 | cf_port = (struct octeon_cf_port *)ap->private_data; | ||
507 | DPRINTK("ENTER\n"); | ||
508 | /* issue r/w command */ | ||
509 | qc->cursg = qc->sg; | ||
510 | cf_port->dma_finished = 0; | ||
511 | ap->ops->sff_exec_command(ap, &qc->tf); | ||
512 | DPRINTK("EXIT\n"); | ||
513 | } | ||
514 | |||
515 | /** | ||
516 | * Start a DMA transfer that was already setup | ||
517 | * | ||
518 | * @qc: Information about the DMA | ||
519 | */ | ||
520 | static void octeon_cf_dma_start(struct ata_queued_cmd *qc) | ||
521 | { | ||
522 | struct octeon_cf_data *ocd = qc->ap->dev->platform_data; | ||
523 | union cvmx_mio_boot_dma_cfgx mio_boot_dma_cfg; | ||
524 | union cvmx_mio_boot_dma_intx mio_boot_dma_int; | ||
525 | struct scatterlist *sg; | ||
526 | |||
527 | VPRINTK("%d scatterlists\n", qc->n_elem); | ||
528 | |||
529 | /* Get the scatter list entry we need to DMA into */ | ||
530 | sg = qc->cursg; | ||
531 | BUG_ON(!sg); | ||
532 | |||
533 | /* | ||
534 | * Clear the DMA complete status. | ||
535 | */ | ||
536 | mio_boot_dma_int.u64 = 0; | ||
537 | mio_boot_dma_int.s.done = 1; | ||
538 | cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine), | ||
539 | mio_boot_dma_int.u64); | ||
540 | |||
541 | /* Enable the interrupt. */ | ||
542 | cvmx_write_csr(CVMX_MIO_BOOT_DMA_INT_ENX(ocd->dma_engine), | ||
543 | mio_boot_dma_int.u64); | ||
544 | |||
545 | /* Set the direction of the DMA */ | ||
546 | mio_boot_dma_cfg.u64 = 0; | ||
547 | mio_boot_dma_cfg.s.en = 1; | ||
548 | mio_boot_dma_cfg.s.rw = ((qc->tf.flags & ATA_TFLAG_WRITE) != 0); | ||
549 | |||
550 | /* | ||
551 | * Don't stop the DMA if the device deasserts DMARQ. Many | ||
552 | * compact flashes deassert DMARQ for a short time between | ||
553 | * sectors. Instead of stopping and restarting the DMA, we'll | ||
554 | * let the hardware do it. If the DMA is really stopped early | ||
555 | * due to an error condition, a later timeout will force us to | ||
556 | * stop. | ||
557 | */ | ||
558 | mio_boot_dma_cfg.s.clr = 0; | ||
559 | |||
560 | /* Size is specified in 16bit words and minus one notation */ | ||
561 | mio_boot_dma_cfg.s.size = sg_dma_len(sg) / 2 - 1; | ||
562 | |||
563 | /* We need to swap the high and low bytes of every 16 bits */ | ||
564 | mio_boot_dma_cfg.s.swap8 = 1; | ||
565 | |||
566 | mio_boot_dma_cfg.s.adr = sg_dma_address(sg); | ||
567 | |||
568 | VPRINTK("%s %d bytes address=%p\n", | ||
569 | (mio_boot_dma_cfg.s.rw) ? "write" : "read", sg->length, | ||
570 | (void *)(unsigned long)mio_boot_dma_cfg.s.adr); | ||
571 | |||
572 | cvmx_write_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine), | ||
573 | mio_boot_dma_cfg.u64); | ||
574 | } | ||
575 | |||
576 | /** | ||
577 | * | ||
578 | * LOCKING: | ||
579 | * spin_lock_irqsave(host lock) | ||
580 | * | ||
581 | */ | ||
582 | static unsigned int octeon_cf_dma_finished(struct ata_port *ap, | ||
583 | struct ata_queued_cmd *qc) | ||
584 | { | ||
585 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
586 | struct octeon_cf_data *ocd = ap->dev->platform_data; | ||
587 | union cvmx_mio_boot_dma_cfgx dma_cfg; | ||
588 | union cvmx_mio_boot_dma_intx dma_int; | ||
589 | struct octeon_cf_port *cf_port; | ||
590 | u8 status; | ||
591 | |||
592 | VPRINTK("ata%u: protocol %d task_state %d\n", | ||
593 | ap->print_id, qc->tf.protocol, ap->hsm_task_state); | ||
594 | |||
595 | |||
596 | if (ap->hsm_task_state != HSM_ST_LAST) | ||
597 | return 0; | ||
598 | |||
599 | cf_port = (struct octeon_cf_port *)ap->private_data; | ||
600 | |||
601 | dma_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine)); | ||
602 | if (dma_cfg.s.size != 0xfffff) { | ||
603 | /* Error, the transfer was not complete. */ | ||
604 | qc->err_mask |= AC_ERR_HOST_BUS; | ||
605 | ap->hsm_task_state = HSM_ST_ERR; | ||
606 | } | ||
607 | |||
608 | /* Stop and clear the dma engine. */ | ||
609 | dma_cfg.u64 = 0; | ||
610 | dma_cfg.s.size = -1; | ||
611 | cvmx_write_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine), dma_cfg.u64); | ||
612 | |||
613 | /* Disable the interrupt. */ | ||
614 | dma_int.u64 = 0; | ||
615 | cvmx_write_csr(CVMX_MIO_BOOT_DMA_INT_ENX(ocd->dma_engine), dma_int.u64); | ||
616 | |||
617 | /* Clear the DMA complete status */ | ||
618 | dma_int.s.done = 1; | ||
619 | cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine), dma_int.u64); | ||
620 | |||
621 | status = ap->ops->sff_check_status(ap); | ||
622 | |||
623 | ata_sff_hsm_move(ap, qc, status, 0); | ||
624 | |||
625 | if (unlikely(qc->err_mask) && (qc->tf.protocol == ATA_PROT_DMA)) | ||
626 | ata_ehi_push_desc(ehi, "DMA stat 0x%x", status); | ||
627 | |||
628 | return 1; | ||
629 | } | ||
630 | |||
631 | /* | ||
632 | * Check if any queued commands have more DMAs, if so start the next | ||
633 | * transfer, else do end of transfer handling. | ||
634 | */ | ||
635 | static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance) | ||
636 | { | ||
637 | struct ata_host *host = dev_instance; | ||
638 | struct octeon_cf_port *cf_port; | ||
639 | int i; | ||
640 | unsigned int handled = 0; | ||
641 | unsigned long flags; | ||
642 | |||
643 | spin_lock_irqsave(&host->lock, flags); | ||
644 | |||
645 | DPRINTK("ENTER\n"); | ||
646 | for (i = 0; i < host->n_ports; i++) { | ||
647 | u8 status; | ||
648 | struct ata_port *ap; | ||
649 | struct ata_queued_cmd *qc; | ||
650 | union cvmx_mio_boot_dma_intx dma_int; | ||
651 | union cvmx_mio_boot_dma_cfgx dma_cfg; | ||
652 | struct octeon_cf_data *ocd; | ||
653 | |||
654 | ap = host->ports[i]; | ||
655 | ocd = ap->dev->platform_data; | ||
656 | if (!ap || (ap->flags & ATA_FLAG_DISABLED)) | ||
657 | continue; | ||
658 | |||
659 | ocd = ap->dev->platform_data; | ||
660 | cf_port = (struct octeon_cf_port *)ap->private_data; | ||
661 | dma_int.u64 = | ||
662 | cvmx_read_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine)); | ||
663 | dma_cfg.u64 = | ||
664 | cvmx_read_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine)); | ||
665 | |||
666 | qc = ata_qc_from_tag(ap, ap->link.active_tag); | ||
667 | |||
668 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && | ||
669 | (qc->flags & ATA_QCFLAG_ACTIVE)) { | ||
670 | if (dma_int.s.done && !dma_cfg.s.en) { | ||
671 | if (!sg_is_last(qc->cursg)) { | ||
672 | qc->cursg = sg_next(qc->cursg); | ||
673 | handled = 1; | ||
674 | octeon_cf_dma_start(qc); | ||
675 | continue; | ||
676 | } else { | ||
677 | cf_port->dma_finished = 1; | ||
678 | } | ||
679 | } | ||
680 | if (!cf_port->dma_finished) | ||
681 | continue; | ||
682 | status = ioread8(ap->ioaddr.altstatus_addr); | ||
683 | if (status & (ATA_BUSY | ATA_DRQ)) { | ||
684 | /* | ||
685 | * We are busy, try to handle it | ||
686 | * later. This is the DMA finished | ||
687 | * interrupt, and it could take a | ||
688 | * little while for the card to be | ||
689 | * ready for more commands. | ||
690 | */ | ||
691 | /* Clear DMA irq. */ | ||
692 | dma_int.u64 = 0; | ||
693 | dma_int.s.done = 1; | ||
694 | cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine), | ||
695 | dma_int.u64); | ||
696 | |||
697 | queue_delayed_work(cf_port->wq, | ||
698 | &cf_port->delayed_finish, 1); | ||
699 | handled = 1; | ||
700 | } else { | ||
701 | handled |= octeon_cf_dma_finished(ap, qc); | ||
702 | } | ||
703 | } | ||
704 | } | ||
705 | spin_unlock_irqrestore(&host->lock, flags); | ||
706 | DPRINTK("EXIT\n"); | ||
707 | return IRQ_RETVAL(handled); | ||
708 | } | ||
709 | |||
710 | static void octeon_cf_delayed_finish(struct work_struct *work) | ||
711 | { | ||
712 | struct octeon_cf_port *cf_port = container_of(work, | ||
713 | struct octeon_cf_port, | ||
714 | delayed_finish.work); | ||
715 | struct ata_port *ap = cf_port->ap; | ||
716 | struct ata_host *host = ap->host; | ||
717 | struct ata_queued_cmd *qc; | ||
718 | unsigned long flags; | ||
719 | u8 status; | ||
720 | |||
721 | spin_lock_irqsave(&host->lock, flags); | ||
722 | |||
723 | /* | ||
724 | * If the port is not waiting for completion, it must have | ||
725 | * handled it previously. The hsm_task_state is | ||
726 | * protected by host->lock. | ||
727 | */ | ||
728 | if (ap->hsm_task_state != HSM_ST_LAST || !cf_port->dma_finished) | ||
729 | goto out; | ||
730 | |||
731 | status = ioread8(ap->ioaddr.altstatus_addr); | ||
732 | if (status & (ATA_BUSY | ATA_DRQ)) { | ||
733 | /* Still busy, try again. */ | ||
734 | queue_delayed_work(cf_port->wq, | ||
735 | &cf_port->delayed_finish, 1); | ||
736 | goto out; | ||
737 | } | ||
738 | qc = ata_qc_from_tag(ap, ap->link.active_tag); | ||
739 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && | ||
740 | (qc->flags & ATA_QCFLAG_ACTIVE)) | ||
741 | octeon_cf_dma_finished(ap, qc); | ||
742 | out: | ||
743 | spin_unlock_irqrestore(&host->lock, flags); | ||
744 | } | ||
745 | |||
746 | static void octeon_cf_dev_config(struct ata_device *dev) | ||
747 | { | ||
748 | /* | ||
749 | * A maximum of 2^20 - 1 16 bit transfers are possible with | ||
750 | * the bootbus DMA. So we need to throttle max_sectors to | ||
751 | * (2^12 - 1 == 4095) to assure that this can never happen. | ||
752 | */ | ||
753 | dev->max_sectors = min(dev->max_sectors, 4095U); | ||
754 | } | ||
755 | |||
756 | /* | ||
757 | * Trap if driver tries to do standard bmdma commands. They are not | ||
758 | * supported. | ||
759 | */ | ||
760 | static void unreachable_qc(struct ata_queued_cmd *qc) | ||
761 | { | ||
762 | BUG(); | ||
763 | } | ||
764 | |||
765 | static u8 unreachable_port(struct ata_port *ap) | ||
766 | { | ||
767 | BUG(); | ||
768 | } | ||
769 | |||
770 | /* | ||
771 | * We don't do ATAPI DMA so return 0. | ||
772 | */ | ||
773 | static int octeon_cf_check_atapi_dma(struct ata_queued_cmd *qc) | ||
774 | { | ||
775 | return 0; | ||
776 | } | ||
777 | |||
778 | static unsigned int octeon_cf_qc_issue(struct ata_queued_cmd *qc) | ||
779 | { | ||
780 | struct ata_port *ap = qc->ap; | ||
781 | |||
782 | switch (qc->tf.protocol) { | ||
783 | case ATA_PROT_DMA: | ||
784 | WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING); | ||
785 | |||
786 | ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ | ||
787 | octeon_cf_dma_setup(qc); /* set up dma */ | ||
788 | octeon_cf_dma_start(qc); /* initiate dma */ | ||
789 | ap->hsm_task_state = HSM_ST_LAST; | ||
790 | break; | ||
791 | |||
792 | case ATAPI_PROT_DMA: | ||
793 | dev_err(ap->dev, "Error, ATAPI not supported\n"); | ||
794 | BUG(); | ||
795 | |||
796 | default: | ||
797 | return ata_sff_qc_issue(qc); | ||
798 | } | ||
799 | |||
800 | return 0; | ||
801 | } | ||
802 | |||
803 | static struct ata_port_operations octeon_cf_ops = { | ||
804 | .inherits = &ata_sff_port_ops, | ||
805 | .check_atapi_dma = octeon_cf_check_atapi_dma, | ||
806 | .qc_prep = ata_noop_qc_prep, | ||
807 | .qc_issue = octeon_cf_qc_issue, | ||
808 | .sff_dev_select = octeon_cf_dev_select, | ||
809 | .sff_irq_on = octeon_cf_irq_on, | ||
810 | .sff_irq_clear = octeon_cf_irq_clear, | ||
811 | .bmdma_setup = unreachable_qc, | ||
812 | .bmdma_start = unreachable_qc, | ||
813 | .bmdma_stop = unreachable_qc, | ||
814 | .bmdma_status = unreachable_port, | ||
815 | .cable_detect = ata_cable_40wire, | ||
816 | .set_piomode = octeon_cf_set_piomode, | ||
817 | .set_dmamode = octeon_cf_set_dmamode, | ||
818 | .dev_config = octeon_cf_dev_config, | ||
819 | }; | ||
820 | |||
821 | static int __devinit octeon_cf_probe(struct platform_device *pdev) | ||
822 | { | ||
823 | struct resource *res_cs0, *res_cs1; | ||
824 | |||
825 | void __iomem *cs0; | ||
826 | void __iomem *cs1 = NULL; | ||
827 | struct ata_host *host; | ||
828 | struct ata_port *ap; | ||
829 | struct octeon_cf_data *ocd; | ||
830 | int irq = 0; | ||
831 | irq_handler_t irq_handler = NULL; | ||
832 | void __iomem *base; | ||
833 | struct octeon_cf_port *cf_port; | ||
834 | |||
835 | res_cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
836 | |||
837 | if (!res_cs0) | ||
838 | return -EINVAL; | ||
839 | |||
840 | ocd = pdev->dev.platform_data; | ||
841 | |||
842 | cs0 = devm_ioremap_nocache(&pdev->dev, res_cs0->start, | ||
843 | res_cs0->end - res_cs0->start + 1); | ||
844 | |||
845 | if (!cs0) | ||
846 | return -ENOMEM; | ||
847 | |||
848 | /* Determine from availability of DMA if True IDE mode or not */ | ||
849 | if (ocd->dma_engine >= 0) { | ||
850 | res_cs1 = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
851 | if (!res_cs1) | ||
852 | return -EINVAL; | ||
853 | |||
854 | cs1 = devm_ioremap_nocache(&pdev->dev, res_cs1->start, | ||
855 | res_cs0->end - res_cs1->start + 1); | ||
856 | |||
857 | if (!cs1) | ||
858 | return -ENOMEM; | ||
859 | } | ||
860 | |||
861 | cf_port = kzalloc(sizeof(*cf_port), GFP_KERNEL); | ||
862 | if (!cf_port) | ||
863 | return -ENOMEM; | ||
864 | |||
865 | /* allocate host */ | ||
866 | host = ata_host_alloc(&pdev->dev, 1); | ||
867 | if (!host) | ||
868 | goto free_cf_port; | ||
869 | |||
870 | ap = host->ports[0]; | ||
871 | ap->private_data = cf_port; | ||
872 | cf_port->ap = ap; | ||
873 | ap->ops = &octeon_cf_ops; | ||
874 | ap->pio_mask = 0x7f; /* Support PIO 0-6 */ | ||
875 | ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ||
876 | | ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING; | ||
877 | |||
878 | base = cs0 + ocd->base_region_bias; | ||
879 | if (!ocd->is16bit) { | ||
880 | ap->ioaddr.cmd_addr = base; | ||
881 | ata_sff_std_ports(&ap->ioaddr); | ||
882 | |||
883 | ap->ioaddr.altstatus_addr = base + 0xe; | ||
884 | ap->ioaddr.ctl_addr = base + 0xe; | ||
885 | octeon_cf_ops.sff_data_xfer = octeon_cf_data_xfer8; | ||
886 | } else if (cs1) { | ||
887 | /* Presence of cs1 indicates True IDE mode. */ | ||
888 | ap->ioaddr.cmd_addr = base + (ATA_REG_CMD << 1) + 1; | ||
889 | ap->ioaddr.data_addr = base + (ATA_REG_DATA << 1); | ||
890 | ap->ioaddr.error_addr = base + (ATA_REG_ERR << 1) + 1; | ||
891 | ap->ioaddr.feature_addr = base + (ATA_REG_FEATURE << 1) + 1; | ||
892 | ap->ioaddr.nsect_addr = base + (ATA_REG_NSECT << 1) + 1; | ||
893 | ap->ioaddr.lbal_addr = base + (ATA_REG_LBAL << 1) + 1; | ||
894 | ap->ioaddr.lbam_addr = base + (ATA_REG_LBAM << 1) + 1; | ||
895 | ap->ioaddr.lbah_addr = base + (ATA_REG_LBAH << 1) + 1; | ||
896 | ap->ioaddr.device_addr = base + (ATA_REG_DEVICE << 1) + 1; | ||
897 | ap->ioaddr.status_addr = base + (ATA_REG_STATUS << 1) + 1; | ||
898 | ap->ioaddr.command_addr = base + (ATA_REG_CMD << 1) + 1; | ||
899 | ap->ioaddr.altstatus_addr = cs1 + (6 << 1) + 1; | ||
900 | ap->ioaddr.ctl_addr = cs1 + (6 << 1) + 1; | ||
901 | octeon_cf_ops.sff_data_xfer = octeon_cf_data_xfer16; | ||
902 | |||
903 | ap->mwdma_mask = 0x1f; /* Support MWDMA 0-4 */ | ||
904 | irq = platform_get_irq(pdev, 0); | ||
905 | irq_handler = octeon_cf_interrupt; | ||
906 | |||
907 | /* True IDE mode needs delayed work to poll for not-busy. */ | ||
908 | cf_port->wq = create_singlethread_workqueue(DRV_NAME); | ||
909 | if (!cf_port->wq) | ||
910 | goto free_cf_port; | ||
911 | INIT_DELAYED_WORK(&cf_port->delayed_finish, | ||
912 | octeon_cf_delayed_finish); | ||
913 | |||
914 | } else { | ||
915 | /* 16 bit but not True IDE */ | ||
916 | octeon_cf_ops.sff_data_xfer = octeon_cf_data_xfer16; | ||
917 | octeon_cf_ops.softreset = octeon_cf_softreset16; | ||
918 | octeon_cf_ops.sff_check_status = octeon_cf_check_status16; | ||
919 | octeon_cf_ops.sff_tf_read = octeon_cf_tf_read16; | ||
920 | octeon_cf_ops.sff_tf_load = octeon_cf_tf_load16; | ||
921 | octeon_cf_ops.sff_exec_command = octeon_cf_exec_command16; | ||
922 | |||
923 | ap->ioaddr.data_addr = base + ATA_REG_DATA; | ||
924 | ap->ioaddr.nsect_addr = base + ATA_REG_NSECT; | ||
925 | ap->ioaddr.lbal_addr = base + ATA_REG_LBAL; | ||
926 | ap->ioaddr.ctl_addr = base + 0xe; | ||
927 | ap->ioaddr.altstatus_addr = base + 0xe; | ||
928 | } | ||
929 | |||
930 | ata_port_desc(ap, "cmd %p ctl %p", base, ap->ioaddr.ctl_addr); | ||
931 | |||
932 | |||
933 | dev_info(&pdev->dev, "version " DRV_VERSION" %d bit%s.\n", | ||
934 | (ocd->is16bit) ? 16 : 8, | ||
935 | (cs1) ? ", True IDE" : ""); | ||
936 | |||
937 | |||
938 | return ata_host_activate(host, irq, irq_handler, 0, &octeon_cf_sht); | ||
939 | |||
940 | free_cf_port: | ||
941 | kfree(cf_port); | ||
942 | return -ENOMEM; | ||
943 | } | ||
944 | |||
945 | static struct platform_driver octeon_cf_driver = { | ||
946 | .probe = octeon_cf_probe, | ||
947 | .driver = { | ||
948 | .name = DRV_NAME, | ||
949 | .owner = THIS_MODULE, | ||
950 | }, | ||
951 | }; | ||
952 | |||
953 | static int __init octeon_cf_init(void) | ||
954 | { | ||
955 | return platform_driver_register(&octeon_cf_driver); | ||
956 | } | ||
957 | |||
958 | |||
959 | MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); | ||
960 | MODULE_DESCRIPTION("low-level driver for Cavium OCTEON Compact Flash PATA"); | ||
961 | MODULE_LICENSE("GPL"); | ||
962 | MODULE_VERSION(DRV_VERSION); | ||
963 | MODULE_ALIAS("platform:" DRV_NAME); | ||
964 | |||
965 | module_init(octeon_cf_init); | ||
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 1a56db92ff7..55bc88c1707 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -1288,7 +1288,7 @@ static const struct ata_port_info sata_fsl_port_info[] = { | |||
1288 | static int sata_fsl_probe(struct of_device *ofdev, | 1288 | static int sata_fsl_probe(struct of_device *ofdev, |
1289 | const struct of_device_id *match) | 1289 | const struct of_device_id *match) |
1290 | { | 1290 | { |
1291 | int retval = 0; | 1291 | int retval = -ENXIO; |
1292 | void __iomem *hcr_base = NULL; | 1292 | void __iomem *hcr_base = NULL; |
1293 | void __iomem *ssr_base = NULL; | 1293 | void __iomem *ssr_base = NULL; |
1294 | void __iomem *csr_base = NULL; | 1294 | void __iomem *csr_base = NULL; |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index c18935f0bda..5c62da9cd49 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -92,6 +92,8 @@ static const struct pci_device_id svia_pci_tbl[] = { | |||
92 | { PCI_VDEVICE(VIA, 0x5372), vt6420 }, | 92 | { PCI_VDEVICE(VIA, 0x5372), vt6420 }, |
93 | { PCI_VDEVICE(VIA, 0x7372), vt6420 }, | 93 | { PCI_VDEVICE(VIA, 0x7372), vt6420 }, |
94 | { PCI_VDEVICE(VIA, 0x5287), vt8251 }, /* 2 sata chnls (Master/Slave) */ | 94 | { PCI_VDEVICE(VIA, 0x5287), vt8251 }, /* 2 sata chnls (Master/Slave) */ |
95 | { PCI_VDEVICE(VIA, 0x9000), vt8251 }, | ||
96 | { PCI_VDEVICE(VIA, 0x9040), vt8251 }, | ||
95 | 97 | ||
96 | { } /* terminate list */ | 98 | { } /* terminate list */ |
97 | }; | 99 | }; |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 7bcc1d8bc96..34f80fa6fed 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -406,6 +406,7 @@ static int nbd_do_it(struct nbd_device *lo) | |||
406 | ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); | 406 | ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); |
407 | if (ret) { | 407 | if (ret) { |
408 | printk(KERN_ERR "nbd: sysfs_create_file failed!"); | 408 | printk(KERN_ERR "nbd: sysfs_create_file failed!"); |
409 | lo->pid = 0; | ||
409 | return ret; | 410 | return ret; |
410 | } | 411 | } |
411 | 412 | ||
@@ -413,6 +414,7 @@ static int nbd_do_it(struct nbd_device *lo) | |||
413 | nbd_end_request(req); | 414 | nbd_end_request(req); |
414 | 415 | ||
415 | sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); | 416 | sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); |
417 | lo->pid = 0; | ||
416 | return 0; | 418 | return 0; |
417 | } | 419 | } |
418 | 420 | ||
@@ -648,6 +650,8 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode, | |||
648 | set_capacity(lo->disk, lo->bytesize >> 9); | 650 | set_capacity(lo->disk, lo->bytesize >> 9); |
649 | return 0; | 651 | return 0; |
650 | case NBD_DO_IT: | 652 | case NBD_DO_IT: |
653 | if (lo->pid) | ||
654 | return -EBUSY; | ||
651 | if (!lo->file) | 655 | if (!lo->file) |
652 | return -EINVAL; | 656 | return -EINVAL; |
653 | thread = kthread_create(nbd_thread, lo, lo->disk->disk_name); | 657 | thread = kthread_create(nbd_thread, lo, lo->disk->disk_name); |
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index 936466f62af..bccc42bb921 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c | |||
@@ -141,7 +141,7 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev, | |||
141 | 141 | ||
142 | start_sector = req->sector * priv->blocking_factor; | 142 | start_sector = req->sector * priv->blocking_factor; |
143 | sectors = req->nr_sectors * priv->blocking_factor; | 143 | sectors = req->nr_sectors * priv->blocking_factor; |
144 | dev_dbg(&dev->sbd.core, "%s:%u: %s %lu sectors starting at %lu\n", | 144 | dev_dbg(&dev->sbd.core, "%s:%u: %s %llu sectors starting at %llu\n", |
145 | __func__, __LINE__, op, sectors, start_sector); | 145 | __func__, __LINE__, op, sectors, start_sector); |
146 | 146 | ||
147 | if (write) { | 147 | if (write) { |
@@ -178,7 +178,7 @@ static int ps3disk_submit_flush_request(struct ps3_storage_device *dev, | |||
178 | LV1_STORAGE_ATA_HDDOUT, 0, 0, 0, | 178 | LV1_STORAGE_ATA_HDDOUT, 0, 0, 0, |
179 | 0, &dev->tag); | 179 | 0, &dev->tag); |
180 | if (res) { | 180 | if (res) { |
181 | dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%lx\n", | 181 | dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%llx\n", |
182 | __func__, __LINE__, res); | 182 | __func__, __LINE__, res); |
183 | end_request(req, 0); | 183 | end_request(req, 0); |
184 | return 0; | 184 | return 0; |
@@ -238,11 +238,11 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data) | |||
238 | 238 | ||
239 | if (tag != dev->tag) | 239 | if (tag != dev->tag) |
240 | dev_err(&dev->sbd.core, | 240 | dev_err(&dev->sbd.core, |
241 | "%s:%u: tag mismatch, got %lx, expected %lx\n", | 241 | "%s:%u: tag mismatch, got %llx, expected %llx\n", |
242 | __func__, __LINE__, tag, dev->tag); | 242 | __func__, __LINE__, tag, dev->tag); |
243 | 243 | ||
244 | if (res) { | 244 | if (res) { |
245 | dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%lx\n", | 245 | dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%llx\n", |
246 | __func__, __LINE__, res, status); | 246 | __func__, __LINE__, res, status); |
247 | return IRQ_HANDLED; | 247 | return IRQ_HANDLED; |
248 | } | 248 | } |
@@ -269,7 +269,7 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data) | |||
269 | op = read ? "read" : "write"; | 269 | op = read ? "read" : "write"; |
270 | } | 270 | } |
271 | if (status) { | 271 | if (status) { |
272 | dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__, | 272 | dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%llx\n", __func__, |
273 | __LINE__, op, status); | 273 | __LINE__, op, status); |
274 | error = -EIO; | 274 | error = -EIO; |
275 | } else { | 275 | } else { |
@@ -297,7 +297,7 @@ static int ps3disk_sync_cache(struct ps3_storage_device *dev) | |||
297 | 297 | ||
298 | res = ps3stor_send_command(dev, LV1_STORAGE_ATA_HDDOUT, 0, 0, 0, 0); | 298 | res = ps3stor_send_command(dev, LV1_STORAGE_ATA_HDDOUT, 0, 0, 0, 0); |
299 | if (res) { | 299 | if (res) { |
300 | dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%lx\n", | 300 | dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%llx\n", |
301 | __func__, __LINE__, res); | 301 | __func__, __LINE__, res); |
302 | return -EIO; | 302 | return -EIO; |
303 | } | 303 | } |
@@ -388,7 +388,7 @@ static int ps3disk_identify(struct ps3_storage_device *dev) | |||
388 | sizeof(ata_cmnd), ata_cmnd.buffer, | 388 | sizeof(ata_cmnd), ata_cmnd.buffer, |
389 | ata_cmnd.arglen); | 389 | ata_cmnd.arglen); |
390 | if (res) { | 390 | if (res) { |
391 | dev_err(&dev->sbd.core, "%s:%u: identify disk failed 0x%lx\n", | 391 | dev_err(&dev->sbd.core, "%s:%u: identify disk failed 0x%llx\n", |
392 | __func__, __LINE__, res); | 392 | __func__, __LINE__, res); |
393 | return -EIO; | 393 | return -EIO; |
394 | } | 394 | } |
@@ -426,7 +426,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev) | |||
426 | 426 | ||
427 | if (dev->blk_size < 512) { | 427 | if (dev->blk_size < 512) { |
428 | dev_err(&dev->sbd.core, | 428 | dev_err(&dev->sbd.core, |
429 | "%s:%u: cannot handle block size %lu\n", __func__, | 429 | "%s:%u: cannot handle block size %llu\n", __func__, |
430 | __LINE__, dev->blk_size); | 430 | __LINE__, dev->blk_size); |
431 | return -EINVAL; | 431 | return -EINVAL; |
432 | } | 432 | } |
@@ -512,7 +512,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev) | |||
512 | dev->regions[dev->region_idx].size*priv->blocking_factor); | 512 | dev->regions[dev->region_idx].size*priv->blocking_factor); |
513 | 513 | ||
514 | dev_info(&dev->sbd.core, | 514 | dev_info(&dev->sbd.core, |
515 | "%s is a %s (%lu MiB total, %lu MiB for OtherOS)\n", | 515 | "%s is a %s (%llu MiB total, %lu MiB for OtherOS)\n", |
516 | gendisk->disk_name, priv->model, priv->raw_capacity >> 11, | 516 | gendisk->disk_name, priv->model, priv->raw_capacity >> 11, |
517 | get_capacity(gendisk) >> 11); | 517 | get_capacity(gendisk) >> 11); |
518 | 518 | ||
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index 29e1dfafb7c..381d686fc1a 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -1206,6 +1206,7 @@ static struct of_device_id ace_of_match[] __devinitdata = { | |||
1206 | { .compatible = "xlnx,opb-sysace-1.00.b", }, | 1206 | { .compatible = "xlnx,opb-sysace-1.00.b", }, |
1207 | { .compatible = "xlnx,opb-sysace-1.00.c", }, | 1207 | { .compatible = "xlnx,opb-sysace-1.00.c", }, |
1208 | { .compatible = "xlnx,xps-sysace-1.00.a", }, | 1208 | { .compatible = "xlnx,xps-sysace-1.00.a", }, |
1209 | { .compatible = "xlnx,sysace", }, | ||
1209 | {}, | 1210 | {}, |
1210 | }; | 1211 | }; |
1211 | MODULE_DEVICE_TABLE(of, ace_of_match); | 1212 | MODULE_DEVICE_TABLE(of, ace_of_match); |
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c index 977dfb1096a..f6094ae0ef3 100644 --- a/drivers/char/bsr.c +++ b/drivers/char/bsr.c | |||
@@ -103,7 +103,7 @@ static ssize_t | |||
103 | bsr_len_show(struct device *dev, struct device_attribute *attr, char *buf) | 103 | bsr_len_show(struct device *dev, struct device_attribute *attr, char *buf) |
104 | { | 104 | { |
105 | struct bsr_dev *bsr_dev = dev_get_drvdata(dev); | 105 | struct bsr_dev *bsr_dev = dev_get_drvdata(dev); |
106 | return sprintf(buf, "%lu\n", bsr_dev->bsr_len); | 106 | return sprintf(buf, "%llu\n", bsr_dev->bsr_len); |
107 | } | 107 | } |
108 | 108 | ||
109 | static struct device_attribute bsr_dev_attrs[] = { | 109 | static struct device_attribute bsr_dev_attrs[] = { |
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 5a8a4c28c86..94e7e3c8c05 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -318,7 +318,6 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) | |||
318 | } /* else count == 0 */ | 318 | } /* else count == 0 */ |
319 | 319 | ||
320 | tty->driver_data = hp; | 320 | tty->driver_data = hp; |
321 | tty->low_latency = 1; /* Makes flushes to ldisc synchronous. */ | ||
322 | 321 | ||
323 | hp->tty = tty; | 322 | hp->tty = tty; |
324 | 323 | ||
@@ -764,13 +763,11 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int data, | |||
764 | return ERR_PTR(err); | 763 | return ERR_PTR(err); |
765 | } | 764 | } |
766 | 765 | ||
767 | hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, | 766 | hp = kzalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, |
768 | GFP_KERNEL); | 767 | GFP_KERNEL); |
769 | if (!hp) | 768 | if (!hp) |
770 | return ERR_PTR(-ENOMEM); | 769 | return ERR_PTR(-ENOMEM); |
771 | 770 | ||
772 | memset(hp, 0x00, sizeof(*hp)); | ||
773 | |||
774 | hp->vtermno = vtermno; | 771 | hp->vtermno = vtermno; |
775 | hp->data = data; | 772 | hp->data = data; |
776 | hp->ops = ops; | 773 | hp->ops = ops; |
@@ -876,8 +873,11 @@ static int hvc_init(void) | |||
876 | goto stop_thread; | 873 | goto stop_thread; |
877 | } | 874 | } |
878 | 875 | ||
879 | /* FIXME: This mb() seems completely random. Remove it. */ | 876 | /* |
880 | mb(); | 877 | * Make sure tty is fully registered before allowing it to be |
878 | * found by hvc_console_device. | ||
879 | */ | ||
880 | smp_mb(); | ||
881 | hvc_driver = drv; | 881 | hvc_driver = drv; |
882 | return 0; | 882 | return 0; |
883 | 883 | ||
diff --git a/drivers/char/hvc_irq.c b/drivers/char/hvc_irq.c index d09e5688d44..2623e177e8d 100644 --- a/drivers/char/hvc_irq.c +++ b/drivers/char/hvc_irq.c | |||
@@ -37,7 +37,7 @@ int notifier_add_irq(struct hvc_struct *hp, int irq) | |||
37 | 37 | ||
38 | void notifier_del_irq(struct hvc_struct *hp, int irq) | 38 | void notifier_del_irq(struct hvc_struct *hp, int irq) |
39 | { | 39 | { |
40 | if (!irq) | 40 | if (!hp->irq_requested) |
41 | return; | 41 | return; |
42 | free_irq(irq, hp); | 42 | free_irq(irq, hp); |
43 | hp->irq_requested = 0; | 43 | hp->irq_requested = 0; |
diff --git a/drivers/char/ps3flash.c b/drivers/char/ps3flash.c index 79b6f461be7..afbe45676d7 100644 --- a/drivers/char/ps3flash.c +++ b/drivers/char/ps3flash.c | |||
@@ -44,7 +44,7 @@ static ssize_t ps3flash_read_write_sectors(struct ps3_storage_device *dev, | |||
44 | u64 res = ps3stor_read_write_sectors(dev, lpar, start_sector, sectors, | 44 | u64 res = ps3stor_read_write_sectors(dev, lpar, start_sector, sectors, |
45 | write); | 45 | write); |
46 | if (res) { | 46 | if (res) { |
47 | dev_err(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__, | 47 | dev_err(&dev->sbd.core, "%s:%u: %s failed 0x%llx\n", __func__, |
48 | __LINE__, write ? "write" : "read", res); | 48 | __LINE__, write ? "write" : "read", res); |
49 | return -EIO; | 49 | return -EIO; |
50 | } | 50 | } |
@@ -59,7 +59,7 @@ static ssize_t ps3flash_read_sectors(struct ps3_storage_device *dev, | |||
59 | 59 | ||
60 | max_sectors = dev->bounce_size / dev->blk_size; | 60 | max_sectors = dev->bounce_size / dev->blk_size; |
61 | if (sectors > max_sectors) { | 61 | if (sectors > max_sectors) { |
62 | dev_dbg(&dev->sbd.core, "%s:%u Limiting sectors to %lu\n", | 62 | dev_dbg(&dev->sbd.core, "%s:%u Limiting sectors to %llu\n", |
63 | __func__, __LINE__, max_sectors); | 63 | __func__, __LINE__, max_sectors); |
64 | sectors = max_sectors; | 64 | sectors = max_sectors; |
65 | } | 65 | } |
@@ -144,7 +144,7 @@ static ssize_t ps3flash_read(struct file *file, char __user *buf, size_t count, | |||
144 | goto fail; | 144 | goto fail; |
145 | } | 145 | } |
146 | 146 | ||
147 | n = min(remaining, sectors_read*dev->blk_size-offset); | 147 | n = min_t(u64, remaining, sectors_read*dev->blk_size-offset); |
148 | dev_dbg(&dev->sbd.core, | 148 | dev_dbg(&dev->sbd.core, |
149 | "%s:%u: copy %lu bytes from 0x%p to user 0x%p\n", | 149 | "%s:%u: copy %lu bytes from 0x%p to user 0x%p\n", |
150 | __func__, __LINE__, n, dev->bounce_buf+offset, buf); | 150 | __func__, __LINE__, n, dev->bounce_buf+offset, buf); |
@@ -225,7 +225,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf, | |||
225 | if (end_read_sector >= start_read_sector) { | 225 | if (end_read_sector >= start_read_sector) { |
226 | /* Merge head and tail */ | 226 | /* Merge head and tail */ |
227 | dev_dbg(&dev->sbd.core, | 227 | dev_dbg(&dev->sbd.core, |
228 | "Merged head and tail: %lu sectors at %lu\n", | 228 | "Merged head and tail: %llu sectors at %llu\n", |
229 | chunk_sectors, start_write_sector); | 229 | chunk_sectors, start_write_sector); |
230 | res = ps3flash_read_sectors(dev, start_write_sector, | 230 | res = ps3flash_read_sectors(dev, start_write_sector, |
231 | chunk_sectors, 0); | 231 | chunk_sectors, 0); |
@@ -235,7 +235,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf, | |||
235 | if (head) { | 235 | if (head) { |
236 | /* Read head */ | 236 | /* Read head */ |
237 | dev_dbg(&dev->sbd.core, | 237 | dev_dbg(&dev->sbd.core, |
238 | "head: %lu sectors at %lu\n", head, | 238 | "head: %llu sectors at %llu\n", head, |
239 | start_write_sector); | 239 | start_write_sector); |
240 | res = ps3flash_read_sectors(dev, | 240 | res = ps3flash_read_sectors(dev, |
241 | start_write_sector, | 241 | start_write_sector, |
@@ -247,7 +247,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf, | |||
247 | start_write_sector+chunk_sectors) { | 247 | start_write_sector+chunk_sectors) { |
248 | /* Read tail */ | 248 | /* Read tail */ |
249 | dev_dbg(&dev->sbd.core, | 249 | dev_dbg(&dev->sbd.core, |
250 | "tail: %lu sectors at %lu\n", tail, | 250 | "tail: %llu sectors at %llu\n", tail, |
251 | start_read_sector); | 251 | start_read_sector); |
252 | sec_off = start_read_sector-start_write_sector; | 252 | sec_off = start_read_sector-start_write_sector; |
253 | res = ps3flash_read_sectors(dev, | 253 | res = ps3flash_read_sectors(dev, |
@@ -258,7 +258,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf, | |||
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | n = min(remaining, dev->bounce_size-offset); | 261 | n = min_t(u64, remaining, dev->bounce_size-offset); |
262 | dev_dbg(&dev->sbd.core, | 262 | dev_dbg(&dev->sbd.core, |
263 | "%s:%u: copy %lu bytes from user 0x%p to 0x%p\n", | 263 | "%s:%u: copy %lu bytes from user 0x%p to 0x%p\n", |
264 | __func__, __LINE__, n, buf, dev->bounce_buf+offset); | 264 | __func__, __LINE__, n, buf, dev->bounce_buf+offset); |
@@ -299,11 +299,11 @@ static irqreturn_t ps3flash_interrupt(int irq, void *data) | |||
299 | 299 | ||
300 | if (tag != dev->tag) | 300 | if (tag != dev->tag) |
301 | dev_err(&dev->sbd.core, | 301 | dev_err(&dev->sbd.core, |
302 | "%s:%u: tag mismatch, got %lx, expected %lx\n", | 302 | "%s:%u: tag mismatch, got %llx, expected %llx\n", |
303 | __func__, __LINE__, tag, dev->tag); | 303 | __func__, __LINE__, tag, dev->tag); |
304 | 304 | ||
305 | if (res) { | 305 | if (res) { |
306 | dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%lx\n", | 306 | dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%llx\n", |
307 | __func__, __LINE__, res, status); | 307 | __func__, __LINE__, res, status); |
308 | } else { | 308 | } else { |
309 | dev->lv1_status = status; | 309 | dev->lv1_status = status; |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 53544e21f19..f329f459817 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: synclink_gt.c,v 4.50 2007/07/25 19:29:25 paulkf Exp $ | ||
3 | * | ||
4 | * Device driver for Microgate SyncLink GT serial adapters. | 2 | * Device driver for Microgate SyncLink GT serial adapters. |
5 | * | 3 | * |
6 | * written by Paul Fulghum for Microgate Corporation | 4 | * written by Paul Fulghum for Microgate Corporation |
@@ -91,7 +89,6 @@ | |||
91 | * module identification | 89 | * module identification |
92 | */ | 90 | */ |
93 | static char *driver_name = "SyncLink GT"; | 91 | static char *driver_name = "SyncLink GT"; |
94 | static char *driver_version = "$Revision: 4.50 $"; | ||
95 | static char *tty_driver_name = "synclink_gt"; | 92 | static char *tty_driver_name = "synclink_gt"; |
96 | static char *tty_dev_prefix = "ttySLG"; | 93 | static char *tty_dev_prefix = "ttySLG"; |
97 | MODULE_LICENSE("GPL"); | 94 | MODULE_LICENSE("GPL"); |
@@ -1309,7 +1306,7 @@ static int read_proc(char *page, char **start, off_t off, int count, | |||
1309 | off_t begin = 0; | 1306 | off_t begin = 0; |
1310 | struct slgt_info *info; | 1307 | struct slgt_info *info; |
1311 | 1308 | ||
1312 | len += sprintf(page, "synclink_gt driver:%s\n", driver_version); | 1309 | len += sprintf(page, "synclink_gt driver\n"); |
1313 | 1310 | ||
1314 | info = slgt_device_list; | 1311 | info = slgt_device_list; |
1315 | while( info ) { | 1312 | while( info ) { |
@@ -2441,7 +2438,7 @@ static void program_hw(struct slgt_info *info) | |||
2441 | info->ri_chkcount = 0; | 2438 | info->ri_chkcount = 0; |
2442 | info->dsr_chkcount = 0; | 2439 | info->dsr_chkcount = 0; |
2443 | 2440 | ||
2444 | slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR); | 2441 | slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR | IRQ_RI); |
2445 | get_signals(info); | 2442 | get_signals(info); |
2446 | 2443 | ||
2447 | if (info->netcount || | 2444 | if (info->netcount || |
@@ -3576,7 +3573,7 @@ static void slgt_cleanup(void) | |||
3576 | struct slgt_info *info; | 3573 | struct slgt_info *info; |
3577 | struct slgt_info *tmp; | 3574 | struct slgt_info *tmp; |
3578 | 3575 | ||
3579 | printk("unload %s %s\n", driver_name, driver_version); | 3576 | printk(KERN_INFO "unload %s\n", driver_name); |
3580 | 3577 | ||
3581 | if (serial_driver) { | 3578 | if (serial_driver) { |
3582 | for (info=slgt_device_list ; info != NULL ; info=info->next_device) | 3579 | for (info=slgt_device_list ; info != NULL ; info=info->next_device) |
@@ -3619,7 +3616,7 @@ static int __init slgt_init(void) | |||
3619 | { | 3616 | { |
3620 | int rc; | 3617 | int rc; |
3621 | 3618 | ||
3622 | printk("%s %s\n", driver_name, driver_version); | 3619 | printk(KERN_INFO "%s\n", driver_name); |
3623 | 3620 | ||
3624 | serial_driver = alloc_tty_driver(MAX_DEVICES); | 3621 | serial_driver = alloc_tty_driver(MAX_DEVICES); |
3625 | if (!serial_driver) { | 3622 | if (!serial_driver) { |
@@ -3650,9 +3647,8 @@ static int __init slgt_init(void) | |||
3650 | goto error; | 3647 | goto error; |
3651 | } | 3648 | } |
3652 | 3649 | ||
3653 | printk("%s %s, tty major#%d\n", | 3650 | printk(KERN_INFO "%s, tty major#%d\n", |
3654 | driver_name, driver_version, | 3651 | driver_name, serial_driver->major); |
3655 | serial_driver->major); | ||
3656 | 3652 | ||
3657 | slgt_device_count = 0; | 3653 | slgt_device_count = 0; |
3658 | if ((rc = pci_register_driver(&pci_driver)) < 0) { | 3654 | if ((rc = pci_register_driver(&pci_driver)) < 0) { |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index d41b9f6f790..33a9351c896 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -473,6 +473,12 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask) | |||
473 | unsigned long flags; | 473 | unsigned long flags; |
474 | 474 | ||
475 | spin_lock_irqsave(&sysrq_key_table_lock, flags); | 475 | spin_lock_irqsave(&sysrq_key_table_lock, flags); |
476 | /* | ||
477 | * Raise the apparent loglevel to maximum so that the sysrq header | ||
478 | * is shown to provide the user with positive feedback. We do not | ||
479 | * simply emit this at KERN_EMERG as that would change message | ||
480 | * routing in the consumers of /proc/kmsg. | ||
481 | */ | ||
476 | orig_log_level = console_loglevel; | 482 | orig_log_level = console_loglevel; |
477 | console_loglevel = 7; | 483 | console_loglevel = 7; |
478 | printk(KERN_INFO "SysRq : "); | 484 | printk(KERN_INFO "SysRq : "); |
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index a408c8e487e..6f4c7d0a53b 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -1057,7 +1057,7 @@ int tty_perform_flush(struct tty_struct *tty, unsigned long arg) | |||
1057 | if (retval) | 1057 | if (retval) |
1058 | return retval; | 1058 | return retval; |
1059 | 1059 | ||
1060 | ld = tty_ldisc_ref(tty); | 1060 | ld = tty_ldisc_ref_wait(tty); |
1061 | switch (arg) { | 1061 | switch (arg) { |
1062 | case TCIFLUSH: | 1062 | case TCIFLUSH: |
1063 | if (ld && ld->ops->flush_buffer) | 1063 | if (ld && ld->ops->flush_buffer) |
diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c index 8b24d784db9..3e7f4e06386 100644 --- a/drivers/gpio/max7301.c +++ b/drivers/gpio/max7301.c | |||
@@ -217,8 +217,10 @@ static int __devinit max7301_probe(struct spi_device *spi) | |||
217 | int i, ret; | 217 | int i, ret; |
218 | 218 | ||
219 | pdata = spi->dev.platform_data; | 219 | pdata = spi->dev.platform_data; |
220 | if (!pdata || !pdata->base) | 220 | if (!pdata || !pdata->base) { |
221 | return -ENODEV; | 221 | dev_dbg(&spi->dev, "incorrect or missing platform data\n"); |
222 | return -EINVAL; | ||
223 | } | ||
222 | 224 | ||
223 | /* | 225 | /* |
224 | * bits_per_word cannot be configured in platform data | 226 | * bits_per_word cannot be configured in platform data |
diff --git a/drivers/gpio/max732x.c b/drivers/gpio/max732x.c index 55ae9a41897..f7868243af8 100644 --- a/drivers/gpio/max732x.c +++ b/drivers/gpio/max732x.c | |||
@@ -267,8 +267,10 @@ static int __devinit max732x_probe(struct i2c_client *client, | |||
267 | int ret, nr_port; | 267 | int ret, nr_port; |
268 | 268 | ||
269 | pdata = client->dev.platform_data; | 269 | pdata = client->dev.platform_data; |
270 | if (pdata == NULL) | 270 | if (pdata == NULL) { |
271 | return -ENODEV; | 271 | dev_dbg(&client->dev, "no platform data\n"); |
272 | return -EINVAL; | ||
273 | } | ||
272 | 274 | ||
273 | chip = kzalloc(sizeof(struct max732x_chip), GFP_KERNEL); | 275 | chip = kzalloc(sizeof(struct max732x_chip), GFP_KERNEL); |
274 | if (chip == NULL) | 276 | if (chip == NULL) |
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c index 89c1d222e9d..f6fae0e50e6 100644 --- a/drivers/gpio/mcp23s08.c +++ b/drivers/gpio/mcp23s08.c | |||
@@ -310,8 +310,10 @@ static int mcp23s08_probe(struct spi_device *spi) | |||
310 | unsigned base; | 310 | unsigned base; |
311 | 311 | ||
312 | pdata = spi->dev.platform_data; | 312 | pdata = spi->dev.platform_data; |
313 | if (!pdata || !gpio_is_valid(pdata->base)) | 313 | if (!pdata || !gpio_is_valid(pdata->base)) { |
314 | return -ENODEV; | 314 | dev_dbg(&spi->dev, "invalid or missing platform data\n"); |
315 | return -EINVAL; | ||
316 | } | ||
315 | 317 | ||
316 | for (addr = 0; addr < 4; addr++) { | 318 | for (addr = 0; addr < 4; addr++) { |
317 | if (!pdata->chip[addr].is_present) | 319 | if (!pdata->chip[addr].is_present) |
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index 37f35388a2a..8dc0164bd51 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -202,8 +202,10 @@ static int __devinit pca953x_probe(struct i2c_client *client, | |||
202 | int ret; | 202 | int ret; |
203 | 203 | ||
204 | pdata = client->dev.platform_data; | 204 | pdata = client->dev.platform_data; |
205 | if (pdata == NULL) | 205 | if (pdata == NULL) { |
206 | return -ENODEV; | 206 | dev_dbg(&client->dev, "no platform data\n"); |
207 | return -EINVAL; | ||
208 | } | ||
207 | 209 | ||
208 | chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); | 210 | chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); |
209 | if (chip == NULL) | 211 | if (chip == NULL) |
diff --git a/drivers/gpio/pcf857x.c b/drivers/gpio/pcf857x.c index 4bc2070dd4a..9525724be73 100644 --- a/drivers/gpio/pcf857x.c +++ b/drivers/gpio/pcf857x.c | |||
@@ -188,8 +188,10 @@ static int pcf857x_probe(struct i2c_client *client, | |||
188 | int status; | 188 | int status; |
189 | 189 | ||
190 | pdata = client->dev.platform_data; | 190 | pdata = client->dev.platform_data; |
191 | if (!pdata) | 191 | if (!pdata) { |
192 | return -ENODEV; | 192 | dev_dbg(&client->dev, "no platform data\n"); |
193 | return -EINVAL; | ||
194 | } | ||
193 | 195 | ||
194 | /* Allocate, initialize, and register this gpio_chip. */ | 196 | /* Allocate, initialize, and register this gpio_chip. */ |
195 | gpio = kzalloc(sizeof *gpio, GFP_KERNEL); | 197 | gpio = kzalloc(sizeof *gpio, GFP_KERNEL); |
@@ -248,8 +250,10 @@ static int pcf857x_probe(struct i2c_client *client, | |||
248 | else | 250 | else |
249 | status = i2c_read_le16(client); | 251 | status = i2c_read_le16(client); |
250 | 252 | ||
251 | } else | 253 | } else { |
252 | status = -ENODEV; | 254 | dev_dbg(&client->dev, "unsupported number of gpios\n"); |
255 | status = -EINVAL; | ||
256 | } | ||
253 | 257 | ||
254 | if (status < 0) | 258 | if (status < 0) |
255 | goto fail; | 259 | goto fail; |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index d8a982b7129..964c5eb1fad 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -36,7 +36,7 @@ | |||
36 | /* | 36 | /* |
37 | * Detailed mode info for 800x600@60Hz | 37 | * Detailed mode info for 800x600@60Hz |
38 | */ | 38 | */ |
39 | static struct drm_display_mode std_mode[] = { | 39 | static struct drm_display_mode std_modes[] = { |
40 | { DRM_MODE("800x600", DRM_MODE_TYPE_DEFAULT, 40000, 800, 840, | 40 | { DRM_MODE("800x600", DRM_MODE_TYPE_DEFAULT, 40000, 800, 840, |
41 | 968, 1056, 0, 600, 601, 605, 628, 0, | 41 | 968, 1056, 0, 600, 601, 605, 628, 0, |
42 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | 42 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, |
@@ -60,15 +60,18 @@ static struct drm_display_mode std_mode[] = { | |||
60 | * changes have occurred. | 60 | * changes have occurred. |
61 | * | 61 | * |
62 | * FIXME: take into account monitor limits | 62 | * FIXME: take into account monitor limits |
63 | * | ||
64 | * RETURNS: | ||
65 | * Number of modes found on @connector. | ||
63 | */ | 66 | */ |
64 | void drm_helper_probe_single_connector_modes(struct drm_connector *connector, | 67 | int drm_helper_probe_single_connector_modes(struct drm_connector *connector, |
65 | uint32_t maxX, uint32_t maxY) | 68 | uint32_t maxX, uint32_t maxY) |
66 | { | 69 | { |
67 | struct drm_device *dev = connector->dev; | 70 | struct drm_device *dev = connector->dev; |
68 | struct drm_display_mode *mode, *t; | 71 | struct drm_display_mode *mode, *t; |
69 | struct drm_connector_helper_funcs *connector_funcs = | 72 | struct drm_connector_helper_funcs *connector_funcs = |
70 | connector->helper_private; | 73 | connector->helper_private; |
71 | int ret; | 74 | int count = 0; |
72 | 75 | ||
73 | DRM_DEBUG("%s\n", drm_get_connector_name(connector)); | 76 | DRM_DEBUG("%s\n", drm_get_connector_name(connector)); |
74 | /* set all modes to the unverified state */ | 77 | /* set all modes to the unverified state */ |
@@ -81,14 +84,14 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector, | |||
81 | DRM_DEBUG("%s is disconnected\n", | 84 | DRM_DEBUG("%s is disconnected\n", |
82 | drm_get_connector_name(connector)); | 85 | drm_get_connector_name(connector)); |
83 | /* TODO set EDID to NULL */ | 86 | /* TODO set EDID to NULL */ |
84 | return; | 87 | return 0; |
85 | } | 88 | } |
86 | 89 | ||
87 | ret = (*connector_funcs->get_modes)(connector); | 90 | count = (*connector_funcs->get_modes)(connector); |
91 | if (!count) | ||
92 | return 0; | ||
88 | 93 | ||
89 | if (ret) { | 94 | drm_mode_connector_list_update(connector); |
90 | drm_mode_connector_list_update(connector); | ||
91 | } | ||
92 | 95 | ||
93 | if (maxX && maxY) | 96 | if (maxX && maxY) |
94 | drm_mode_validate_size(dev, &connector->modes, maxX, | 97 | drm_mode_validate_size(dev, &connector->modes, maxX, |
@@ -102,25 +105,8 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector, | |||
102 | 105 | ||
103 | drm_mode_prune_invalid(dev, &connector->modes, true); | 106 | drm_mode_prune_invalid(dev, &connector->modes, true); |
104 | 107 | ||
105 | if (list_empty(&connector->modes)) { | 108 | if (list_empty(&connector->modes)) |
106 | struct drm_display_mode *stdmode; | 109 | return 0; |
107 | |||
108 | DRM_DEBUG("No valid modes on %s\n", | ||
109 | drm_get_connector_name(connector)); | ||
110 | |||
111 | /* Should we do this here ??? | ||
112 | * When no valid EDID modes are available we end up | ||
113 | * here and bailed in the past, now we add a standard | ||
114 | * 640x480@60Hz mode and carry on. | ||
115 | */ | ||
116 | stdmode = drm_mode_duplicate(dev, &std_mode[0]); | ||
117 | drm_mode_probed_add(connector, stdmode); | ||
118 | drm_mode_list_concat(&connector->probed_modes, | ||
119 | &connector->modes); | ||
120 | |||
121 | DRM_DEBUG("Adding standard 640x480 @ 60Hz to %s\n", | ||
122 | drm_get_connector_name(connector)); | ||
123 | } | ||
124 | 110 | ||
125 | drm_mode_sort(&connector->modes); | 111 | drm_mode_sort(&connector->modes); |
126 | 112 | ||
@@ -131,20 +117,58 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector, | |||
131 | drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); | 117 | drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); |
132 | drm_mode_debug_printmodeline(mode); | 118 | drm_mode_debug_printmodeline(mode); |
133 | } | 119 | } |
120 | |||
121 | return count; | ||
134 | } | 122 | } |
135 | EXPORT_SYMBOL(drm_helper_probe_single_connector_modes); | 123 | EXPORT_SYMBOL(drm_helper_probe_single_connector_modes); |
136 | 124 | ||
137 | void drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX, | 125 | int drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX, |
138 | uint32_t maxY) | 126 | uint32_t maxY) |
139 | { | 127 | { |
140 | struct drm_connector *connector; | 128 | struct drm_connector *connector; |
129 | int count = 0; | ||
141 | 130 | ||
142 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 131 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
143 | drm_helper_probe_single_connector_modes(connector, maxX, maxY); | 132 | count += drm_helper_probe_single_connector_modes(connector, |
133 | maxX, maxY); | ||
144 | } | 134 | } |
135 | |||
136 | return count; | ||
145 | } | 137 | } |
146 | EXPORT_SYMBOL(drm_helper_probe_connector_modes); | 138 | EXPORT_SYMBOL(drm_helper_probe_connector_modes); |
147 | 139 | ||
140 | static void drm_helper_add_std_modes(struct drm_device *dev, | ||
141 | struct drm_connector *connector) | ||
142 | { | ||
143 | struct drm_display_mode *mode, *t; | ||
144 | int i; | ||
145 | |||
146 | for (i = 0; i < ARRAY_SIZE(std_modes); i++) { | ||
147 | struct drm_display_mode *stdmode; | ||
148 | |||
149 | /* | ||
150 | * When no valid EDID modes are available we end up | ||
151 | * here and bailed in the past, now we add some standard | ||
152 | * modes and move on. | ||
153 | */ | ||
154 | stdmode = drm_mode_duplicate(dev, &std_modes[i]); | ||
155 | drm_mode_probed_add(connector, stdmode); | ||
156 | drm_mode_list_concat(&connector->probed_modes, | ||
157 | &connector->modes); | ||
158 | |||
159 | DRM_DEBUG("Adding mode %s to %s\n", stdmode->name, | ||
160 | drm_get_connector_name(connector)); | ||
161 | } | ||
162 | drm_mode_sort(&connector->modes); | ||
163 | |||
164 | DRM_DEBUG("Added std modes on %s\n", drm_get_connector_name(connector)); | ||
165 | list_for_each_entry_safe(mode, t, &connector->modes, head) { | ||
166 | mode->vrefresh = drm_mode_vrefresh(mode); | ||
167 | |||
168 | drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); | ||
169 | drm_mode_debug_printmodeline(mode); | ||
170 | } | ||
171 | } | ||
148 | 172 | ||
149 | /** | 173 | /** |
150 | * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config | 174 | * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config |
@@ -237,6 +261,8 @@ static void drm_enable_connectors(struct drm_device *dev, bool *enabled) | |||
237 | 261 | ||
238 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 262 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
239 | enabled[i] = drm_connector_enabled(connector, true); | 263 | enabled[i] = drm_connector_enabled(connector, true); |
264 | DRM_DEBUG("connector %d enabled? %s\n", connector->base.id, | ||
265 | enabled[i] ? "yes" : "no"); | ||
240 | any_enabled |= enabled[i]; | 266 | any_enabled |= enabled[i]; |
241 | i++; | 267 | i++; |
242 | } | 268 | } |
@@ -265,11 +291,17 @@ static bool drm_target_preferred(struct drm_device *dev, | |||
265 | continue; | 291 | continue; |
266 | } | 292 | } |
267 | 293 | ||
294 | DRM_DEBUG("looking for preferred mode on connector %d\n", | ||
295 | connector->base.id); | ||
296 | |||
268 | modes[i] = drm_has_preferred_mode(connector, width, height); | 297 | modes[i] = drm_has_preferred_mode(connector, width, height); |
269 | if (!modes[i]) { | 298 | /* No preferred modes, pick one off the list */ |
299 | if (!modes[i] && !list_empty(&connector->modes)) { | ||
270 | list_for_each_entry(modes[i], &connector->modes, head) | 300 | list_for_each_entry(modes[i], &connector->modes, head) |
271 | break; | 301 | break; |
272 | } | 302 | } |
303 | DRM_DEBUG("found mode %s\n", modes[i] ? modes[i]->name : | ||
304 | "none"); | ||
273 | i++; | 305 | i++; |
274 | } | 306 | } |
275 | return true; | 307 | return true; |
@@ -369,6 +401,8 @@ static void drm_setup_crtcs(struct drm_device *dev) | |||
369 | int width, height; | 401 | int width, height; |
370 | int i, ret; | 402 | int i, ret; |
371 | 403 | ||
404 | DRM_DEBUG("\n"); | ||
405 | |||
372 | width = dev->mode_config.max_width; | 406 | width = dev->mode_config.max_width; |
373 | height = dev->mode_config.max_height; | 407 | height = dev->mode_config.max_height; |
374 | 408 | ||
@@ -390,6 +424,8 @@ static void drm_setup_crtcs(struct drm_device *dev) | |||
390 | if (!ret) | 424 | if (!ret) |
391 | DRM_ERROR("Unable to find initial modes\n"); | 425 | DRM_ERROR("Unable to find initial modes\n"); |
392 | 426 | ||
427 | DRM_DEBUG("picking CRTCs for %dx%d config\n", width, height); | ||
428 | |||
393 | drm_pick_crtcs(dev, crtcs, modes, 0, width, height); | 429 | drm_pick_crtcs(dev, crtcs, modes, 0, width, height); |
394 | 430 | ||
395 | i = 0; | 431 | i = 0; |
@@ -403,6 +439,8 @@ static void drm_setup_crtcs(struct drm_device *dev) | |||
403 | } | 439 | } |
404 | 440 | ||
405 | if (mode && crtc) { | 441 | if (mode && crtc) { |
442 | DRM_DEBUG("desired mode %s set on crtc %d\n", | ||
443 | mode->name, crtc->base.id); | ||
406 | crtc->desired_mode = mode; | 444 | crtc->desired_mode = mode; |
407 | connector->encoder->crtc = crtc; | 445 | connector->encoder->crtc = crtc; |
408 | } else | 446 | } else |
@@ -442,6 +480,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
442 | int saved_x, saved_y; | 480 | int saved_x, saved_y; |
443 | struct drm_encoder *encoder; | 481 | struct drm_encoder *encoder; |
444 | bool ret = true; | 482 | bool ret = true; |
483 | bool depth_changed, bpp_changed; | ||
445 | 484 | ||
446 | adjusted_mode = drm_mode_duplicate(dev, mode); | 485 | adjusted_mode = drm_mode_duplicate(dev, mode); |
447 | 486 | ||
@@ -450,6 +489,15 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
450 | if (!crtc->enabled) | 489 | if (!crtc->enabled) |
451 | return true; | 490 | return true; |
452 | 491 | ||
492 | if (old_fb && crtc->fb) { | ||
493 | depth_changed = (old_fb->depth != crtc->fb->depth); | ||
494 | bpp_changed = (old_fb->bits_per_pixel != | ||
495 | crtc->fb->bits_per_pixel); | ||
496 | } else { | ||
497 | depth_changed = true; | ||
498 | bpp_changed = true; | ||
499 | } | ||
500 | |||
453 | saved_mode = crtc->mode; | 501 | saved_mode = crtc->mode; |
454 | saved_x = crtc->x; | 502 | saved_x = crtc->x; |
455 | saved_y = crtc->y; | 503 | saved_y = crtc->y; |
@@ -462,7 +510,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
462 | crtc->y = y; | 510 | crtc->y = y; |
463 | 511 | ||
464 | if (drm_mode_equal(&saved_mode, &crtc->mode)) { | 512 | if (drm_mode_equal(&saved_mode, &crtc->mode)) { |
465 | if (saved_x != crtc->x || saved_y != crtc->y) { | 513 | if (saved_x != crtc->x || saved_y != crtc->y || |
514 | depth_changed || bpp_changed) { | ||
466 | crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, | 515 | crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, |
467 | old_fb); | 516 | old_fb); |
468 | goto done; | 517 | goto done; |
@@ -568,8 +617,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
568 | struct drm_encoder **save_encoders, *new_encoder; | 617 | struct drm_encoder **save_encoders, *new_encoder; |
569 | struct drm_framebuffer *old_fb; | 618 | struct drm_framebuffer *old_fb; |
570 | bool save_enabled; | 619 | bool save_enabled; |
571 | bool changed = false; | 620 | bool mode_changed = false; |
572 | bool flip_or_move = false; | 621 | bool fb_changed = false; |
573 | struct drm_connector *connector; | 622 | struct drm_connector *connector; |
574 | int count = 0, ro, fail = 0; | 623 | int count = 0, ro, fail = 0; |
575 | struct drm_crtc_helper_funcs *crtc_funcs; | 624 | struct drm_crtc_helper_funcs *crtc_funcs; |
@@ -597,7 +646,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
597 | /* save previous config */ | 646 | /* save previous config */ |
598 | save_enabled = set->crtc->enabled; | 647 | save_enabled = set->crtc->enabled; |
599 | 648 | ||
600 | /* this is meant to be num_connector not num_crtc */ | 649 | /* |
650 | * We do mode_config.num_connectors here since we'll look at the | ||
651 | * CRTC and encoder associated with each connector later. | ||
652 | */ | ||
601 | save_crtcs = kzalloc(dev->mode_config.num_connector * | 653 | save_crtcs = kzalloc(dev->mode_config.num_connector * |
602 | sizeof(struct drm_crtc *), GFP_KERNEL); | 654 | sizeof(struct drm_crtc *), GFP_KERNEL); |
603 | if (!save_crtcs) | 655 | if (!save_crtcs) |
@@ -613,21 +665,25 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
613 | /* We should be able to check here if the fb has the same properties | 665 | /* We should be able to check here if the fb has the same properties |
614 | * and then just flip_or_move it */ | 666 | * and then just flip_or_move it */ |
615 | if (set->crtc->fb != set->fb) { | 667 | if (set->crtc->fb != set->fb) { |
616 | /* if we have no fb then its a change not a flip */ | 668 | /* If we have no fb then treat it as a full mode set */ |
617 | if (set->crtc->fb == NULL) | 669 | if (set->crtc->fb == NULL) |
618 | changed = true; | 670 | mode_changed = true; |
671 | else if ((set->fb->bits_per_pixel != | ||
672 | set->crtc->fb->bits_per_pixel) || | ||
673 | set->fb->depth != set->crtc->fb->depth) | ||
674 | fb_changed = true; | ||
619 | else | 675 | else |
620 | flip_or_move = true; | 676 | fb_changed = true; |
621 | } | 677 | } |
622 | 678 | ||
623 | if (set->x != set->crtc->x || set->y != set->crtc->y) | 679 | if (set->x != set->crtc->x || set->y != set->crtc->y) |
624 | flip_or_move = true; | 680 | fb_changed = true; |
625 | 681 | ||
626 | if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) { | 682 | if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) { |
627 | DRM_DEBUG("modes are different\n"); | 683 | DRM_DEBUG("modes are different\n"); |
628 | drm_mode_debug_printmodeline(&set->crtc->mode); | 684 | drm_mode_debug_printmodeline(&set->crtc->mode); |
629 | drm_mode_debug_printmodeline(set->mode); | 685 | drm_mode_debug_printmodeline(set->mode); |
630 | changed = true; | 686 | mode_changed = true; |
631 | } | 687 | } |
632 | 688 | ||
633 | /* a) traverse passed in connector list and get encoders for them */ | 689 | /* a) traverse passed in connector list and get encoders for them */ |
@@ -650,7 +706,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
650 | } | 706 | } |
651 | 707 | ||
652 | if (new_encoder != connector->encoder) { | 708 | if (new_encoder != connector->encoder) { |
653 | changed = true; | 709 | mode_changed = true; |
654 | connector->encoder = new_encoder; | 710 | connector->encoder = new_encoder; |
655 | } | 711 | } |
656 | } | 712 | } |
@@ -677,16 +733,16 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
677 | new_crtc = set->crtc; | 733 | new_crtc = set->crtc; |
678 | } | 734 | } |
679 | if (new_crtc != connector->encoder->crtc) { | 735 | if (new_crtc != connector->encoder->crtc) { |
680 | changed = true; | 736 | mode_changed = true; |
681 | connector->encoder->crtc = new_crtc; | 737 | connector->encoder->crtc = new_crtc; |
682 | } | 738 | } |
683 | } | 739 | } |
684 | 740 | ||
685 | /* mode_set_base is not a required function */ | 741 | /* mode_set_base is not a required function */ |
686 | if (flip_or_move && !crtc_funcs->mode_set_base) | 742 | if (fb_changed && !crtc_funcs->mode_set_base) |
687 | changed = true; | 743 | mode_changed = true; |
688 | 744 | ||
689 | if (changed) { | 745 | if (mode_changed) { |
690 | old_fb = set->crtc->fb; | 746 | old_fb = set->crtc->fb; |
691 | set->crtc->fb = set->fb; | 747 | set->crtc->fb = set->fb; |
692 | set->crtc->enabled = (set->mode != NULL); | 748 | set->crtc->enabled = (set->mode != NULL); |
@@ -705,7 +761,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
705 | set->crtc->desired_mode = set->mode; | 761 | set->crtc->desired_mode = set->mode; |
706 | } | 762 | } |
707 | drm_helper_disable_unused_functions(dev); | 763 | drm_helper_disable_unused_functions(dev); |
708 | } else if (flip_or_move) { | 764 | } else if (fb_changed) { |
709 | old_fb = set->crtc->fb; | 765 | old_fb = set->crtc->fb; |
710 | if (set->crtc->fb != set->fb) | 766 | if (set->crtc->fb != set->fb) |
711 | set->crtc->fb = set->fb; | 767 | set->crtc->fb = set->fb; |
@@ -764,10 +820,31 @@ bool drm_helper_plugged_event(struct drm_device *dev) | |||
764 | */ | 820 | */ |
765 | bool drm_helper_initial_config(struct drm_device *dev, bool can_grow) | 821 | bool drm_helper_initial_config(struct drm_device *dev, bool can_grow) |
766 | { | 822 | { |
767 | int ret = false; | 823 | struct drm_connector *connector; |
824 | int count = 0; | ||
768 | 825 | ||
769 | drm_helper_plugged_event(dev); | 826 | count = drm_helper_probe_connector_modes(dev, |
770 | return ret; | 827 | dev->mode_config.max_width, |
828 | dev->mode_config.max_height); | ||
829 | |||
830 | /* | ||
831 | * None of the available connectors had any modes, so add some | ||
832 | * and try to light them up anyway | ||
833 | */ | ||
834 | if (!count) { | ||
835 | DRM_ERROR("connectors have no modes, using standard modes\n"); | ||
836 | list_for_each_entry(connector, | ||
837 | &dev->mode_config.connector_list, | ||
838 | head) | ||
839 | drm_helper_add_std_modes(dev, connector); | ||
840 | } | ||
841 | |||
842 | drm_setup_crtcs(dev); | ||
843 | |||
844 | /* alert the driver fb layer */ | ||
845 | dev->mode_config.funcs->fb_changed(dev); | ||
846 | |||
847 | return 0; | ||
771 | } | 848 | } |
772 | EXPORT_SYMBOL(drm_helper_initial_config); | 849 | EXPORT_SYMBOL(drm_helper_initial_config); |
773 | 850 | ||
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 724e505873c..477caa1b1e4 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -267,7 +267,8 @@ EXPORT_SYMBOL(drm_irq_install); | |||
267 | */ | 267 | */ |
268 | int drm_irq_uninstall(struct drm_device * dev) | 268 | int drm_irq_uninstall(struct drm_device * dev) |
269 | { | 269 | { |
270 | int irq_enabled; | 270 | unsigned long irqflags; |
271 | int irq_enabled, i; | ||
271 | 272 | ||
272 | if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) | 273 | if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) |
273 | return -EINVAL; | 274 | return -EINVAL; |
@@ -277,6 +278,16 @@ int drm_irq_uninstall(struct drm_device * dev) | |||
277 | dev->irq_enabled = 0; | 278 | dev->irq_enabled = 0; |
278 | mutex_unlock(&dev->struct_mutex); | 279 | mutex_unlock(&dev->struct_mutex); |
279 | 280 | ||
281 | /* | ||
282 | * Wake up any waiters so they don't hang. | ||
283 | */ | ||
284 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | ||
285 | for (i = 0; i < dev->num_crtcs; i++) { | ||
286 | DRM_WAKEUP(&dev->vbl_queue[i]); | ||
287 | dev->vblank_enabled[i] = 0; | ||
288 | } | ||
289 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
290 | |||
280 | if (!irq_enabled) | 291 | if (!irq_enabled) |
281 | return -EINVAL; | 292 | return -EINVAL; |
282 | 293 | ||
@@ -652,8 +663,9 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
652 | vblwait->request.sequence, crtc); | 663 | vblwait->request.sequence, crtc); |
653 | dev->last_vblank_wait[crtc] = vblwait->request.sequence; | 664 | dev->last_vblank_wait[crtc] = vblwait->request.sequence; |
654 | DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ, | 665 | DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ, |
655 | ((drm_vblank_count(dev, crtc) | 666 | (((drm_vblank_count(dev, crtc) - |
656 | - vblwait->request.sequence) <= (1 << 23))); | 667 | vblwait->request.sequence) <= (1 << 23)) || |
668 | !dev->irq_enabled)); | ||
657 | 669 | ||
658 | if (ret != -EINTR) { | 670 | if (ret != -EINTR) { |
659 | struct timeval now; | 671 | struct timeval now; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 62a4bf7b49d..bbadf1c0414 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -177,6 +177,14 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init) | |||
177 | drm_i915_private_t *dev_priv = dev->dev_private; | 177 | drm_i915_private_t *dev_priv = dev->dev_private; |
178 | struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; | 178 | struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; |
179 | 179 | ||
180 | master_priv->sarea = drm_getsarea(dev); | ||
181 | if (master_priv->sarea) { | ||
182 | master_priv->sarea_priv = (drm_i915_sarea_t *) | ||
183 | ((u8 *)master_priv->sarea->handle + init->sarea_priv_offset); | ||
184 | } else { | ||
185 | DRM_DEBUG("sarea not found assuming DRI2 userspace\n"); | ||
186 | } | ||
187 | |||
180 | if (init->ring_size != 0) { | 188 | if (init->ring_size != 0) { |
181 | if (dev_priv->ring.ring_obj != NULL) { | 189 | if (dev_priv->ring.ring_obj != NULL) { |
182 | i915_dma_cleanup(dev); | 190 | i915_dma_cleanup(dev); |
@@ -1152,6 +1160,8 @@ int i915_driver_unload(struct drm_device *dev) | |||
1152 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 1160 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
1153 | intel_modeset_cleanup(dev); | 1161 | intel_modeset_cleanup(dev); |
1154 | 1162 | ||
1163 | i915_gem_free_all_phys_object(dev); | ||
1164 | |||
1155 | mutex_lock(&dev->struct_mutex); | 1165 | mutex_lock(&dev->struct_mutex); |
1156 | i915_gem_cleanup_ringbuffer(dev); | 1166 | i915_gem_cleanup_ringbuffer(dev); |
1157 | mutex_unlock(&dev->struct_mutex); | 1167 | mutex_unlock(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 563de18063f..e1351825200 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -72,6 +72,18 @@ enum pipe { | |||
72 | #define WATCH_INACTIVE 0 | 72 | #define WATCH_INACTIVE 0 |
73 | #define WATCH_PWRITE 0 | 73 | #define WATCH_PWRITE 0 |
74 | 74 | ||
75 | #define I915_GEM_PHYS_CURSOR_0 1 | ||
76 | #define I915_GEM_PHYS_CURSOR_1 2 | ||
77 | #define I915_GEM_PHYS_OVERLAY_REGS 3 | ||
78 | #define I915_MAX_PHYS_OBJECT (I915_GEM_PHYS_OVERLAY_REGS) | ||
79 | |||
80 | struct drm_i915_gem_phys_object { | ||
81 | int id; | ||
82 | struct page **page_list; | ||
83 | drm_dma_handle_t *handle; | ||
84 | struct drm_gem_object *cur_obj; | ||
85 | }; | ||
86 | |||
75 | typedef struct _drm_i915_ring_buffer { | 87 | typedef struct _drm_i915_ring_buffer { |
76 | int tail_mask; | 88 | int tail_mask; |
77 | unsigned long Size; | 89 | unsigned long Size; |
@@ -358,6 +370,9 @@ typedef struct drm_i915_private { | |||
358 | uint32_t bit_6_swizzle_x; | 370 | uint32_t bit_6_swizzle_x; |
359 | /** Bit 6 swizzling required for Y tiling */ | 371 | /** Bit 6 swizzling required for Y tiling */ |
360 | uint32_t bit_6_swizzle_y; | 372 | uint32_t bit_6_swizzle_y; |
373 | |||
374 | /* storage for physical objects */ | ||
375 | struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT]; | ||
361 | } mm; | 376 | } mm; |
362 | } drm_i915_private_t; | 377 | } drm_i915_private_t; |
363 | 378 | ||
@@ -436,6 +451,9 @@ struct drm_i915_gem_object { | |||
436 | /** User space pin count and filp owning the pin */ | 451 | /** User space pin count and filp owning the pin */ |
437 | uint32_t user_pin_count; | 452 | uint32_t user_pin_count; |
438 | struct drm_file *pin_filp; | 453 | struct drm_file *pin_filp; |
454 | |||
455 | /** for phy allocated objects */ | ||
456 | struct drm_i915_gem_phys_object *phys_obj; | ||
439 | }; | 457 | }; |
440 | 458 | ||
441 | /** | 459 | /** |
@@ -598,6 +616,11 @@ int i915_gem_do_init(struct drm_device *dev, unsigned long start, | |||
598 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); | 616 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); |
599 | int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, | 617 | int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, |
600 | int write); | 618 | int write); |
619 | int i915_gem_attach_phys_object(struct drm_device *dev, | ||
620 | struct drm_gem_object *obj, int id); | ||
621 | void i915_gem_detach_phys_object(struct drm_device *dev, | ||
622 | struct drm_gem_object *obj); | ||
623 | void i915_gem_free_all_phys_object(struct drm_device *dev); | ||
601 | 624 | ||
602 | /* i915_gem_tiling.c */ | 625 | /* i915_gem_tiling.c */ |
603 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); | 626 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 1384d668655..96316fd4723 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -55,6 +55,9 @@ static int i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, | |||
55 | static void i915_gem_object_get_fence_reg(struct drm_gem_object *obj); | 55 | static void i915_gem_object_get_fence_reg(struct drm_gem_object *obj); |
56 | static void i915_gem_clear_fence_reg(struct drm_gem_object *obj); | 56 | static void i915_gem_clear_fence_reg(struct drm_gem_object *obj); |
57 | static int i915_gem_evict_something(struct drm_device *dev); | 57 | static int i915_gem_evict_something(struct drm_device *dev); |
58 | static int i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj, | ||
59 | struct drm_i915_gem_pwrite *args, | ||
60 | struct drm_file *file_priv); | ||
58 | 61 | ||
59 | int i915_gem_do_init(struct drm_device *dev, unsigned long start, | 62 | int i915_gem_do_init(struct drm_device *dev, unsigned long start, |
60 | unsigned long end) | 63 | unsigned long end) |
@@ -386,8 +389,10 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
386 | * pread/pwrite currently are reading and writing from the CPU | 389 | * pread/pwrite currently are reading and writing from the CPU |
387 | * perspective, requiring manual detiling by the client. | 390 | * perspective, requiring manual detiling by the client. |
388 | */ | 391 | */ |
389 | if (obj_priv->tiling_mode == I915_TILING_NONE && | 392 | if (obj_priv->phys_obj) |
390 | dev->gtt_total != 0) | 393 | ret = i915_gem_phys_pwrite(dev, obj, args, file_priv); |
394 | else if (obj_priv->tiling_mode == I915_TILING_NONE && | ||
395 | dev->gtt_total != 0) | ||
391 | ret = i915_gem_gtt_pwrite(dev, obj, args, file_priv); | 396 | ret = i915_gem_gtt_pwrite(dev, obj, args, file_priv); |
392 | else | 397 | else |
393 | ret = i915_gem_shmem_pwrite(dev, obj, args, file_priv); | 398 | ret = i915_gem_shmem_pwrite(dev, obj, args, file_priv); |
@@ -2858,6 +2863,9 @@ void i915_gem_free_object(struct drm_gem_object *obj) | |||
2858 | while (obj_priv->pin_count > 0) | 2863 | while (obj_priv->pin_count > 0) |
2859 | i915_gem_object_unpin(obj); | 2864 | i915_gem_object_unpin(obj); |
2860 | 2865 | ||
2866 | if (obj_priv->phys_obj) | ||
2867 | i915_gem_detach_phys_object(dev, obj); | ||
2868 | |||
2861 | i915_gem_object_unbind(obj); | 2869 | i915_gem_object_unbind(obj); |
2862 | 2870 | ||
2863 | list = &obj->map_list; | 2871 | list = &obj->map_list; |
@@ -3293,3 +3301,180 @@ i915_gem_load(struct drm_device *dev) | |||
3293 | 3301 | ||
3294 | i915_gem_detect_bit_6_swizzle(dev); | 3302 | i915_gem_detect_bit_6_swizzle(dev); |
3295 | } | 3303 | } |
3304 | |||
3305 | /* | ||
3306 | * Create a physically contiguous memory object for this object | ||
3307 | * e.g. for cursor + overlay regs | ||
3308 | */ | ||
3309 | int i915_gem_init_phys_object(struct drm_device *dev, | ||
3310 | int id, int size) | ||
3311 | { | ||
3312 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
3313 | struct drm_i915_gem_phys_object *phys_obj; | ||
3314 | int ret; | ||
3315 | |||
3316 | if (dev_priv->mm.phys_objs[id - 1] || !size) | ||
3317 | return 0; | ||
3318 | |||
3319 | phys_obj = drm_calloc(1, sizeof(struct drm_i915_gem_phys_object), DRM_MEM_DRIVER); | ||
3320 | if (!phys_obj) | ||
3321 | return -ENOMEM; | ||
3322 | |||
3323 | phys_obj->id = id; | ||
3324 | |||
3325 | phys_obj->handle = drm_pci_alloc(dev, size, 0, 0xffffffff); | ||
3326 | if (!phys_obj->handle) { | ||
3327 | ret = -ENOMEM; | ||
3328 | goto kfree_obj; | ||
3329 | } | ||
3330 | #ifdef CONFIG_X86 | ||
3331 | set_memory_wc((unsigned long)phys_obj->handle->vaddr, phys_obj->handle->size / PAGE_SIZE); | ||
3332 | #endif | ||
3333 | |||
3334 | dev_priv->mm.phys_objs[id - 1] = phys_obj; | ||
3335 | |||
3336 | return 0; | ||
3337 | kfree_obj: | ||
3338 | drm_free(phys_obj, sizeof(struct drm_i915_gem_phys_object), DRM_MEM_DRIVER); | ||
3339 | return ret; | ||
3340 | } | ||
3341 | |||
3342 | void i915_gem_free_phys_object(struct drm_device *dev, int id) | ||
3343 | { | ||
3344 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
3345 | struct drm_i915_gem_phys_object *phys_obj; | ||
3346 | |||
3347 | if (!dev_priv->mm.phys_objs[id - 1]) | ||
3348 | return; | ||
3349 | |||
3350 | phys_obj = dev_priv->mm.phys_objs[id - 1]; | ||
3351 | if (phys_obj->cur_obj) { | ||
3352 | i915_gem_detach_phys_object(dev, phys_obj->cur_obj); | ||
3353 | } | ||
3354 | |||
3355 | #ifdef CONFIG_X86 | ||
3356 | set_memory_wb((unsigned long)phys_obj->handle->vaddr, phys_obj->handle->size / PAGE_SIZE); | ||
3357 | #endif | ||
3358 | drm_pci_free(dev, phys_obj->handle); | ||
3359 | kfree(phys_obj); | ||
3360 | dev_priv->mm.phys_objs[id - 1] = NULL; | ||
3361 | } | ||
3362 | |||
3363 | void i915_gem_free_all_phys_object(struct drm_device *dev) | ||
3364 | { | ||
3365 | int i; | ||
3366 | |||
3367 | for (i = 0; i < I915_MAX_PHYS_OBJECT; i++) | ||
3368 | i915_gem_free_phys_object(dev, i); | ||
3369 | } | ||
3370 | |||
3371 | void i915_gem_detach_phys_object(struct drm_device *dev, | ||
3372 | struct drm_gem_object *obj) | ||
3373 | { | ||
3374 | struct drm_i915_gem_object *obj_priv; | ||
3375 | int i; | ||
3376 | int ret; | ||
3377 | int page_count; | ||
3378 | |||
3379 | obj_priv = obj->driver_private; | ||
3380 | if (!obj_priv->phys_obj) | ||
3381 | return; | ||
3382 | |||
3383 | ret = i915_gem_object_get_page_list(obj); | ||
3384 | if (ret) | ||
3385 | goto out; | ||
3386 | |||
3387 | page_count = obj->size / PAGE_SIZE; | ||
3388 | |||
3389 | for (i = 0; i < page_count; i++) { | ||
3390 | char *dst = kmap_atomic(obj_priv->page_list[i], KM_USER0); | ||
3391 | char *src = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE); | ||
3392 | |||
3393 | memcpy(dst, src, PAGE_SIZE); | ||
3394 | kunmap_atomic(dst, KM_USER0); | ||
3395 | } | ||
3396 | drm_clflush_pages(obj_priv->page_list, page_count); | ||
3397 | drm_agp_chipset_flush(dev); | ||
3398 | out: | ||
3399 | obj_priv->phys_obj->cur_obj = NULL; | ||
3400 | obj_priv->phys_obj = NULL; | ||
3401 | } | ||
3402 | |||
3403 | int | ||
3404 | i915_gem_attach_phys_object(struct drm_device *dev, | ||
3405 | struct drm_gem_object *obj, int id) | ||
3406 | { | ||
3407 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
3408 | struct drm_i915_gem_object *obj_priv; | ||
3409 | int ret = 0; | ||
3410 | int page_count; | ||
3411 | int i; | ||
3412 | |||
3413 | if (id > I915_MAX_PHYS_OBJECT) | ||
3414 | return -EINVAL; | ||
3415 | |||
3416 | obj_priv = obj->driver_private; | ||
3417 | |||
3418 | if (obj_priv->phys_obj) { | ||
3419 | if (obj_priv->phys_obj->id == id) | ||
3420 | return 0; | ||
3421 | i915_gem_detach_phys_object(dev, obj); | ||
3422 | } | ||
3423 | |||
3424 | |||
3425 | /* create a new object */ | ||
3426 | if (!dev_priv->mm.phys_objs[id - 1]) { | ||
3427 | ret = i915_gem_init_phys_object(dev, id, | ||
3428 | obj->size); | ||
3429 | if (ret) { | ||
3430 | DRM_ERROR("failed to init phys object %d size: %d\n", id, obj->size); | ||
3431 | goto out; | ||
3432 | } | ||
3433 | } | ||
3434 | |||
3435 | /* bind to the object */ | ||
3436 | obj_priv->phys_obj = dev_priv->mm.phys_objs[id - 1]; | ||
3437 | obj_priv->phys_obj->cur_obj = obj; | ||
3438 | |||
3439 | ret = i915_gem_object_get_page_list(obj); | ||
3440 | if (ret) { | ||
3441 | DRM_ERROR("failed to get page list\n"); | ||
3442 | goto out; | ||
3443 | } | ||
3444 | |||
3445 | page_count = obj->size / PAGE_SIZE; | ||
3446 | |||
3447 | for (i = 0; i < page_count; i++) { | ||
3448 | char *src = kmap_atomic(obj_priv->page_list[i], KM_USER0); | ||
3449 | char *dst = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE); | ||
3450 | |||
3451 | memcpy(dst, src, PAGE_SIZE); | ||
3452 | kunmap_atomic(src, KM_USER0); | ||
3453 | } | ||
3454 | |||
3455 | return 0; | ||
3456 | out: | ||
3457 | return ret; | ||
3458 | } | ||
3459 | |||
3460 | static int | ||
3461 | i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj, | ||
3462 | struct drm_i915_gem_pwrite *args, | ||
3463 | struct drm_file *file_priv) | ||
3464 | { | ||
3465 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | ||
3466 | void *obj_addr; | ||
3467 | int ret; | ||
3468 | char __user *user_data; | ||
3469 | |||
3470 | user_data = (char __user *) (uintptr_t) args->data_ptr; | ||
3471 | obj_addr = obj_priv->phys_obj->handle->vaddr + args->offset; | ||
3472 | |||
3473 | DRM_ERROR("obj_addr %p, %lld\n", obj_addr, args->size); | ||
3474 | ret = copy_from_user(obj_addr, user_data, args->size); | ||
3475 | if (ret) | ||
3476 | return -EFAULT; | ||
3477 | |||
3478 | drm_agp_chipset_flush(dev); | ||
3479 | return 0; | ||
3480 | } | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 0cadafbef41..6290219de6c 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -411,6 +411,12 @@ int i915_enable_vblank(struct drm_device *dev, int pipe) | |||
411 | { | 411 | { |
412 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 412 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
413 | unsigned long irqflags; | 413 | unsigned long irqflags; |
414 | int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; | ||
415 | u32 pipeconf; | ||
416 | |||
417 | pipeconf = I915_READ(pipeconf_reg); | ||
418 | if (!(pipeconf & PIPEACONF_ENABLE)) | ||
419 | return -EINVAL; | ||
414 | 420 | ||
415 | spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags); | 421 | spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags); |
416 | if (IS_I965G(dev)) | 422 | if (IS_I965G(dev)) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 8ccb9c3ab86..31c3732b7a6 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -401,6 +401,8 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
401 | I915_WRITE(dspstride, crtc->fb->pitch); | 401 | I915_WRITE(dspstride, crtc->fb->pitch); |
402 | 402 | ||
403 | dspcntr = I915_READ(dspcntr_reg); | 403 | dspcntr = I915_READ(dspcntr_reg); |
404 | /* Mask out pixel format bits in case we change it */ | ||
405 | dspcntr &= ~DISPPLANE_PIXFORMAT_MASK; | ||
404 | switch (crtc->fb->bits_per_pixel) { | 406 | switch (crtc->fb->bits_per_pixel) { |
405 | case 8: | 407 | case 8: |
406 | dspcntr |= DISPPLANE_8BPP; | 408 | dspcntr |= DISPPLANE_8BPP; |
@@ -1014,21 +1016,25 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1014 | 1016 | ||
1015 | if (bo->size < width * height * 4) { | 1017 | if (bo->size < width * height * 4) { |
1016 | DRM_ERROR("buffer is to small\n"); | 1018 | DRM_ERROR("buffer is to small\n"); |
1017 | drm_gem_object_unreference(bo); | 1019 | ret = -ENOMEM; |
1018 | return -ENOMEM; | 1020 | goto fail; |
1019 | } | 1021 | } |
1020 | 1022 | ||
1021 | if (dev_priv->cursor_needs_physical) { | 1023 | /* we only need to pin inside GTT if cursor is non-phy */ |
1022 | addr = dev->agp->base + obj_priv->gtt_offset; | 1024 | if (!dev_priv->cursor_needs_physical) { |
1023 | } else { | 1025 | ret = i915_gem_object_pin(bo, PAGE_SIZE); |
1026 | if (ret) { | ||
1027 | DRM_ERROR("failed to pin cursor bo\n"); | ||
1028 | goto fail; | ||
1029 | } | ||
1024 | addr = obj_priv->gtt_offset; | 1030 | addr = obj_priv->gtt_offset; |
1025 | } | 1031 | } else { |
1026 | 1032 | ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1); | |
1027 | ret = i915_gem_object_pin(bo, PAGE_SIZE); | 1033 | if (ret) { |
1028 | if (ret) { | 1034 | DRM_ERROR("failed to attach phys object\n"); |
1029 | DRM_ERROR("failed to pin cursor bo\n"); | 1035 | goto fail; |
1030 | drm_gem_object_unreference(bo); | 1036 | } |
1031 | return ret; | 1037 | addr = obj_priv->phys_obj->handle->busaddr; |
1032 | } | 1038 | } |
1033 | 1039 | ||
1034 | temp = 0; | 1040 | temp = 0; |
@@ -1041,14 +1047,25 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1041 | I915_WRITE(base, addr); | 1047 | I915_WRITE(base, addr); |
1042 | 1048 | ||
1043 | if (intel_crtc->cursor_bo) { | 1049 | if (intel_crtc->cursor_bo) { |
1044 | i915_gem_object_unpin(intel_crtc->cursor_bo); | 1050 | if (dev_priv->cursor_needs_physical) { |
1051 | if (intel_crtc->cursor_bo != bo) | ||
1052 | i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); | ||
1053 | } else | ||
1054 | i915_gem_object_unpin(intel_crtc->cursor_bo); | ||
1055 | mutex_lock(&dev->struct_mutex); | ||
1045 | drm_gem_object_unreference(intel_crtc->cursor_bo); | 1056 | drm_gem_object_unreference(intel_crtc->cursor_bo); |
1057 | mutex_unlock(&dev->struct_mutex); | ||
1046 | } | 1058 | } |
1047 | 1059 | ||
1048 | intel_crtc->cursor_addr = addr; | 1060 | intel_crtc->cursor_addr = addr; |
1049 | intel_crtc->cursor_bo = bo; | 1061 | intel_crtc->cursor_bo = bo; |
1050 | 1062 | ||
1051 | return 0; | 1063 | return 0; |
1064 | fail: | ||
1065 | mutex_lock(&dev->struct_mutex); | ||
1066 | drm_gem_object_unreference(bo); | ||
1067 | mutex_unlock(&dev->struct_mutex); | ||
1068 | return ret; | ||
1052 | } | 1069 | } |
1053 | 1070 | ||
1054 | static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) | 1071 | static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index ccecfaf6307..2fafdcc108f 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -456,6 +456,13 @@ void intel_lvds_init(struct drm_device *dev) | |||
456 | dev_priv->panel_fixed_mode = | 456 | dev_priv->panel_fixed_mode = |
457 | drm_mode_duplicate(dev, dev_priv->vbt_mode); | 457 | drm_mode_duplicate(dev, dev_priv->vbt_mode); |
458 | mutex_unlock(&dev->mode_config.mutex); | 458 | mutex_unlock(&dev->mode_config.mutex); |
459 | if (dev_priv->panel_fixed_mode) { | ||
460 | dev_priv->panel_fixed_mode->type |= | ||
461 | DRM_MODE_TYPE_PREFERRED; | ||
462 | drm_mode_probed_add(connector, | ||
463 | dev_priv->panel_fixed_mode); | ||
464 | goto out; | ||
465 | } | ||
459 | } | 466 | } |
460 | 467 | ||
461 | /* | 468 | /* |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 4b33bc82cc2..b84bf066879 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -189,6 +189,16 @@ config SENSORS_ADT7473 | |||
189 | This driver can also be built as a module. If so, the module | 189 | This driver can also be built as a module. If so, the module |
190 | will be called adt7473. | 190 | will be called adt7473. |
191 | 191 | ||
192 | config SENSORS_ADT7475 | ||
193 | tristate "Analog Devices ADT7475" | ||
194 | depends on I2C && EXPERIMENTAL | ||
195 | help | ||
196 | If you say yes here you get support for the Analog Devices | ||
197 | ADT7475 hardware monitoring chips. | ||
198 | |||
199 | This driver can also be build as a module. If so, the module | ||
200 | will be called adt7475. | ||
201 | |||
192 | config SENSORS_K8TEMP | 202 | config SENSORS_K8TEMP |
193 | tristate "AMD Athlon64/FX or Opteron temperature sensor" | 203 | tristate "AMD Athlon64/FX or Opteron temperature sensor" |
194 | depends on X86 && PCI && EXPERIMENTAL | 204 | depends on X86 && PCI && EXPERIMENTAL |
@@ -861,6 +871,8 @@ config SENSORS_HDAPS | |||
861 | config SENSORS_LIS3LV02D | 871 | config SENSORS_LIS3LV02D |
862 | tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer" | 872 | tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer" |
863 | depends on ACPI && INPUT | 873 | depends on ACPI && INPUT |
874 | select NEW_LEDS | ||
875 | select LEDS_CLASS | ||
864 | default n | 876 | default n |
865 | help | 877 | help |
866 | This driver provides support for the LIS3LV02Dx accelerometer. In | 878 | This driver provides support for the LIS3LV02Dx accelerometer. In |
@@ -872,10 +884,16 @@ config SENSORS_LIS3LV02D | |||
872 | /sys/devices/platform/lis3lv02d. | 884 | /sys/devices/platform/lis3lv02d. |
873 | 885 | ||
874 | This driver also provides an absolute input class device, allowing | 886 | This driver also provides an absolute input class device, allowing |
875 | the laptop to act as a pinball machine-esque joystick. | 887 | the laptop to act as a pinball machine-esque joystick. On HP laptops, |
888 | if the led infrastructure is activated, support for a led indicating | ||
889 | disk protection will be provided as hp:red:hddprotection. | ||
876 | 890 | ||
877 | This driver can also be built as a module. If so, the module | 891 | This driver can also be built as modules. If so, the core module |
878 | will be called lis3lv02d. | 892 | will be called lis3lv02d and a specific module for HP laptops will be |
893 | called hp_accel. | ||
894 | |||
895 | Say Y here if you have an applicable laptop and want to experience | ||
896 | the awesome power of lis3lv02d. | ||
879 | 897 | ||
880 | config SENSORS_APPLESMC | 898 | config SENSORS_APPLESMC |
881 | tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" | 899 | tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 19cb1ace3eb..2e80f37f39e 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -28,6 +28,8 @@ obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o | |||
28 | obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o | 28 | obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o |
29 | obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o | 29 | obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o |
30 | obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o | 30 | obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o |
31 | obj-$(CONFIG_SENSORS_ADT7475) += adt7475.o | ||
32 | |||
31 | obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o | 33 | obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o |
32 | obj-$(CONFIG_SENSORS_AMS) += ams/ | 34 | obj-$(CONFIG_SENSORS_AMS) += ams/ |
33 | obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o | 35 | obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o |
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index 70bb854086d..e52b38806d0 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
@@ -279,7 +279,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
279 | { "OTES1 Fan", 36, 2, 60, 1, 0 }, | 279 | { "OTES1 Fan", 36, 2, 60, 1, 0 }, |
280 | { NULL, 0, 0, 0, 0, 0 } } | 280 | { NULL, 0, 0, 0, 0, 0 } } |
281 | }, | 281 | }, |
282 | { 0x0011, "AT8 32X(ATI RD580-ULI M1575)", { | 282 | { 0x0011, "AT8 32X", { |
283 | { "CPU Core", 0, 0, 10, 1, 0 }, | 283 | { "CPU Core", 0, 0, 10, 1, 0 }, |
284 | { "DDR", 1, 0, 20, 1, 0 }, | 284 | { "DDR", 1, 0, 20, 1, 0 }, |
285 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 285 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -402,7 +402,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
402 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 402 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
403 | { NULL, 0, 0, 0, 0, 0 } } | 403 | { NULL, 0, 0, 0, 0, 0 } } |
404 | }, | 404 | }, |
405 | { 0x0016, "AW9D-MAX (Intel i975-ICH7)", { | 405 | { 0x0016, "AW9D-MAX", { |
406 | { "CPU Core", 0, 0, 10, 1, 0 }, | 406 | { "CPU Core", 0, 0, 10, 1, 0 }, |
407 | { "DDR2", 1, 0, 20, 1, 0 }, | 407 | { "DDR2", 1, 0, 20, 1, 0 }, |
408 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 408 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -482,7 +482,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
482 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 482 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
483 | { NULL, 0, 0, 0, 0, 0 } } | 483 | { NULL, 0, 0, 0, 0, 0 } } |
484 | }, | 484 | }, |
485 | { 0x0019, NULL /* Unknown, need DMI string */, { | 485 | { 0x0019, "IN9 32X MAX", { |
486 | { "CPU Core", 7, 0, 10, 1, 0 }, | 486 | { "CPU Core", 7, 0, 10, 1, 0 }, |
487 | { "DDR2", 13, 0, 20, 1, 0 }, | 487 | { "DDR2", 13, 0, 20, 1, 0 }, |
488 | { "DDR2 VTT", 14, 0, 10, 1, 0 }, | 488 | { "DDR2 VTT", 14, 0, 10, 1, 0 }, |
@@ -509,7 +509,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
509 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, | 509 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, |
510 | { NULL, 0, 0, 0, 0, 0 } } | 510 | { NULL, 0, 0, 0, 0, 0 } } |
511 | }, | 511 | }, |
512 | { 0x001A, "IP35 Pro(Intel P35-ICH9R)", { | 512 | { 0x001A, "IP35 Pro", { |
513 | { "CPU Core", 0, 0, 10, 1, 0 }, | 513 | { "CPU Core", 0, 0, 10, 1, 0 }, |
514 | { "DDR2", 1, 0, 20, 1, 0 }, | 514 | { "DDR2", 1, 0, 20, 1, 0 }, |
515 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 515 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -1128,6 +1128,7 @@ static int __init abituguru3_dmi_detect(void) | |||
1128 | { | 1128 | { |
1129 | const char *board_vendor, *board_name; | 1129 | const char *board_vendor, *board_name; |
1130 | int i, err = (force) ? 1 : -ENODEV; | 1130 | int i, err = (force) ? 1 : -ENODEV; |
1131 | size_t sublen; | ||
1131 | 1132 | ||
1132 | board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); | 1133 | board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); |
1133 | if (!board_vendor || strcmp(board_vendor, "http://www.abit.com.tw/")) | 1134 | if (!board_vendor || strcmp(board_vendor, "http://www.abit.com.tw/")) |
@@ -1137,9 +1138,20 @@ static int __init abituguru3_dmi_detect(void) | |||
1137 | if (!board_name) | 1138 | if (!board_name) |
1138 | return err; | 1139 | return err; |
1139 | 1140 | ||
1141 | /* At the moment, we don't care about the part of the vendor | ||
1142 | * DMI string contained in brackets. Truncate the string at | ||
1143 | * the first occurrence of a bracket. Trim any trailing space | ||
1144 | * from the substring. | ||
1145 | */ | ||
1146 | sublen = strcspn(board_name, "("); | ||
1147 | while (sublen > 0 && board_name[sublen - 1] == ' ') | ||
1148 | sublen--; | ||
1149 | |||
1140 | for (i = 0; abituguru3_motherboards[i].id; i++) { | 1150 | for (i = 0; abituguru3_motherboards[i].id; i++) { |
1141 | const char *dmi_name = abituguru3_motherboards[i].dmi_name; | 1151 | const char *dmi_name = abituguru3_motherboards[i].dmi_name; |
1142 | if (dmi_name && !strcmp(dmi_name, board_name)) | 1152 | if (!dmi_name || strlen(dmi_name) != sublen) |
1153 | continue; | ||
1154 | if (!strncasecmp(board_name, dmi_name, sublen)) | ||
1143 | break; | 1155 | break; |
1144 | } | 1156 | } |
1145 | 1157 | ||
@@ -1153,7 +1165,7 @@ static int __init abituguru3_dmi_detect(void) | |||
1153 | 1165 | ||
1154 | static inline int abituguru3_dmi_detect(void) | 1166 | static inline int abituguru3_dmi_detect(void) |
1155 | { | 1167 | { |
1156 | return -ENODEV; | 1168 | return 1; |
1157 | } | 1169 | } |
1158 | 1170 | ||
1159 | #endif /* CONFIG_DMI */ | 1171 | #endif /* CONFIG_DMI */ |
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c new file mode 100644 index 00000000000..d39877a7da6 --- /dev/null +++ b/drivers/hwmon/adt7475.c | |||
@@ -0,0 +1,1221 @@ | |||
1 | /* | ||
2 | * adt7475 - Thermal sensor driver for the ADT7475 chip and derivatives | ||
3 | * Copyright (C) 2007-2008, Advanced Micro Devices, Inc. | ||
4 | * Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net> | ||
5 | * Copyright (C) 2008 Hans de Goede <hdegoede@redhat.com> | ||
6 | |||
7 | * Derived from the lm83 driver by Jean Delvare | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/i2c.h> | ||
18 | #include <linux/hwmon.h> | ||
19 | #include <linux/hwmon-sysfs.h> | ||
20 | #include <linux/err.h> | ||
21 | |||
22 | /* Indexes for the sysfs hooks */ | ||
23 | |||
24 | #define INPUT 0 | ||
25 | #define MIN 1 | ||
26 | #define MAX 2 | ||
27 | #define CONTROL 3 | ||
28 | #define OFFSET 3 | ||
29 | #define AUTOMIN 4 | ||
30 | #define THERM 5 | ||
31 | #define HYSTERSIS 6 | ||
32 | |||
33 | /* These are unique identifiers for the sysfs functions - unlike the | ||
34 | numbers above, these are not also indexes into an array | ||
35 | */ | ||
36 | |||
37 | #define ALARM 9 | ||
38 | #define FAULT 10 | ||
39 | |||
40 | /* 7475 Common Registers */ | ||
41 | |||
42 | #define REG_VOLTAGE_BASE 0x21 | ||
43 | #define REG_TEMP_BASE 0x25 | ||
44 | #define REG_TACH_BASE 0x28 | ||
45 | #define REG_PWM_BASE 0x30 | ||
46 | #define REG_PWM_MAX_BASE 0x38 | ||
47 | |||
48 | #define REG_DEVID 0x3D | ||
49 | #define REG_VENDID 0x3E | ||
50 | |||
51 | #define REG_STATUS1 0x41 | ||
52 | #define REG_STATUS2 0x42 | ||
53 | |||
54 | #define REG_VOLTAGE_MIN_BASE 0x46 | ||
55 | #define REG_VOLTAGE_MAX_BASE 0x47 | ||
56 | |||
57 | #define REG_TEMP_MIN_BASE 0x4E | ||
58 | #define REG_TEMP_MAX_BASE 0x4F | ||
59 | |||
60 | #define REG_TACH_MIN_BASE 0x54 | ||
61 | |||
62 | #define REG_PWM_CONFIG_BASE 0x5C | ||
63 | |||
64 | #define REG_TEMP_TRANGE_BASE 0x5F | ||
65 | |||
66 | #define REG_PWM_MIN_BASE 0x64 | ||
67 | |||
68 | #define REG_TEMP_TMIN_BASE 0x67 | ||
69 | #define REG_TEMP_THERM_BASE 0x6A | ||
70 | |||
71 | #define REG_REMOTE1_HYSTERSIS 0x6D | ||
72 | #define REG_REMOTE2_HYSTERSIS 0x6E | ||
73 | |||
74 | #define REG_TEMP_OFFSET_BASE 0x70 | ||
75 | |||
76 | #define REG_EXTEND1 0x76 | ||
77 | #define REG_EXTEND2 0x77 | ||
78 | #define REG_CONFIG5 0x7C | ||
79 | |||
80 | #define CONFIG5_TWOSCOMP 0x01 | ||
81 | #define CONFIG5_TEMPOFFSET 0x02 | ||
82 | |||
83 | /* ADT7475 Settings */ | ||
84 | |||
85 | #define ADT7475_VOLTAGE_COUNT 2 | ||
86 | #define ADT7475_TEMP_COUNT 3 | ||
87 | #define ADT7475_TACH_COUNT 4 | ||
88 | #define ADT7475_PWM_COUNT 3 | ||
89 | |||
90 | /* Macro to read the registers */ | ||
91 | |||
92 | #define adt7475_read(reg) i2c_smbus_read_byte_data(client, (reg)) | ||
93 | |||
94 | /* Macros to easily index the registers */ | ||
95 | |||
96 | #define TACH_REG(idx) (REG_TACH_BASE + ((idx) * 2)) | ||
97 | #define TACH_MIN_REG(idx) (REG_TACH_MIN_BASE + ((idx) * 2)) | ||
98 | |||
99 | #define PWM_REG(idx) (REG_PWM_BASE + (idx)) | ||
100 | #define PWM_MAX_REG(idx) (REG_PWM_MAX_BASE + (idx)) | ||
101 | #define PWM_MIN_REG(idx) (REG_PWM_MIN_BASE + (idx)) | ||
102 | #define PWM_CONFIG_REG(idx) (REG_PWM_CONFIG_BASE + (idx)) | ||
103 | |||
104 | #define VOLTAGE_REG(idx) (REG_VOLTAGE_BASE + (idx)) | ||
105 | #define VOLTAGE_MIN_REG(idx) (REG_VOLTAGE_MIN_BASE + ((idx) * 2)) | ||
106 | #define VOLTAGE_MAX_REG(idx) (REG_VOLTAGE_MAX_BASE + ((idx) * 2)) | ||
107 | |||
108 | #define TEMP_REG(idx) (REG_TEMP_BASE + (idx)) | ||
109 | #define TEMP_MIN_REG(idx) (REG_TEMP_MIN_BASE + ((idx) * 2)) | ||
110 | #define TEMP_MAX_REG(idx) (REG_TEMP_MAX_BASE + ((idx) * 2)) | ||
111 | #define TEMP_TMIN_REG(idx) (REG_TEMP_TMIN_BASE + (idx)) | ||
112 | #define TEMP_THERM_REG(idx) (REG_TEMP_THERM_BASE + (idx)) | ||
113 | #define TEMP_OFFSET_REG(idx) (REG_TEMP_OFFSET_BASE + (idx)) | ||
114 | #define TEMP_TRANGE_REG(idx) (REG_TEMP_TRANGE_BASE + (idx)) | ||
115 | |||
116 | static unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END }; | ||
117 | |||
118 | I2C_CLIENT_INSMOD_1(adt7475); | ||
119 | |||
120 | static const struct i2c_device_id adt7475_id[] = { | ||
121 | { "adt7475", adt7475 }, | ||
122 | { } | ||
123 | }; | ||
124 | MODULE_DEVICE_TABLE(i2c, adt7475_id); | ||
125 | |||
126 | struct adt7475_data { | ||
127 | struct device *hwmon_dev; | ||
128 | struct mutex lock; | ||
129 | |||
130 | unsigned long measure_updated; | ||
131 | unsigned long limits_updated; | ||
132 | char valid; | ||
133 | |||
134 | u8 config5; | ||
135 | u16 alarms; | ||
136 | u16 voltage[3][3]; | ||
137 | u16 temp[7][3]; | ||
138 | u16 tach[2][4]; | ||
139 | u8 pwm[4][3]; | ||
140 | u8 range[3]; | ||
141 | u8 pwmctl[3]; | ||
142 | u8 pwmchan[3]; | ||
143 | }; | ||
144 | |||
145 | static struct i2c_driver adt7475_driver; | ||
146 | static struct adt7475_data *adt7475_update_device(struct device *dev); | ||
147 | static void adt7475_read_hystersis(struct i2c_client *client); | ||
148 | static void adt7475_read_pwm(struct i2c_client *client, int index); | ||
149 | |||
150 | /* Given a temp value, convert it to register value */ | ||
151 | |||
152 | static inline u16 temp2reg(struct adt7475_data *data, long val) | ||
153 | { | ||
154 | u16 ret; | ||
155 | |||
156 | if (!(data->config5 & CONFIG5_TWOSCOMP)) { | ||
157 | val = SENSORS_LIMIT(val, -64000, 191000); | ||
158 | ret = (val + 64500) / 1000; | ||
159 | } else { | ||
160 | val = SENSORS_LIMIT(val, -128000, 127000); | ||
161 | if (val < -500) | ||
162 | ret = (256500 + val) / 1000; | ||
163 | else | ||
164 | ret = (val + 500) / 1000; | ||
165 | } | ||
166 | |||
167 | return ret << 2; | ||
168 | } | ||
169 | |||
170 | /* Given a register value, convert it to a real temp value */ | ||
171 | |||
172 | static inline int reg2temp(struct adt7475_data *data, u16 reg) | ||
173 | { | ||
174 | if (data->config5 & CONFIG5_TWOSCOMP) { | ||
175 | if (reg >= 512) | ||
176 | return (reg - 1024) * 250; | ||
177 | else | ||
178 | return reg * 250; | ||
179 | } else | ||
180 | return (reg - 256) * 250; | ||
181 | } | ||
182 | |||
183 | static inline int tach2rpm(u16 tach) | ||
184 | { | ||
185 | if (tach == 0 || tach == 0xFFFF) | ||
186 | return 0; | ||
187 | |||
188 | return (90000 * 60) / tach; | ||
189 | } | ||
190 | |||
191 | static inline u16 rpm2tach(unsigned long rpm) | ||
192 | { | ||
193 | if (rpm == 0) | ||
194 | return 0; | ||
195 | |||
196 | return SENSORS_LIMIT((90000 * 60) / rpm, 1, 0xFFFF); | ||
197 | } | ||
198 | |||
199 | static inline int reg2vcc(u16 reg) | ||
200 | { | ||
201 | return (4296 * reg) / 1000; | ||
202 | } | ||
203 | |||
204 | static inline int reg2vccp(u16 reg) | ||
205 | { | ||
206 | return (2929 * reg) / 1000; | ||
207 | } | ||
208 | |||
209 | static inline u16 vcc2reg(long vcc) | ||
210 | { | ||
211 | vcc = SENSORS_LIMIT(vcc, 0, 4396); | ||
212 | return (vcc * 1000) / 4296; | ||
213 | } | ||
214 | |||
215 | static inline u16 vccp2reg(long vcc) | ||
216 | { | ||
217 | vcc = SENSORS_LIMIT(vcc, 0, 2998); | ||
218 | return (vcc * 1000) / 2929; | ||
219 | } | ||
220 | |||
221 | static u16 adt7475_read_word(struct i2c_client *client, int reg) | ||
222 | { | ||
223 | u16 val; | ||
224 | |||
225 | val = i2c_smbus_read_byte_data(client, reg); | ||
226 | val |= (i2c_smbus_read_byte_data(client, reg + 1) << 8); | ||
227 | |||
228 | return val; | ||
229 | } | ||
230 | |||
231 | static void adt7475_write_word(struct i2c_client *client, int reg, u16 val) | ||
232 | { | ||
233 | i2c_smbus_write_byte_data(client, reg + 1, val >> 8); | ||
234 | i2c_smbus_write_byte_data(client, reg, val & 0xFF); | ||
235 | } | ||
236 | |||
237 | /* Find the nearest value in a table - used for pwm frequency and | ||
238 | auto temp range */ | ||
239 | static int find_nearest(long val, const int *array, int size) | ||
240 | { | ||
241 | int i; | ||
242 | |||
243 | if (val < array[0]) | ||
244 | return 0; | ||
245 | |||
246 | if (val > array[size - 1]) | ||
247 | return size - 1; | ||
248 | |||
249 | for (i = 0; i < size - 1; i++) { | ||
250 | int a, b; | ||
251 | |||
252 | if (val > array[i + 1]) | ||
253 | continue; | ||
254 | |||
255 | a = val - array[i]; | ||
256 | b = array[i + 1] - val; | ||
257 | |||
258 | return (a <= b) ? i : i + 1; | ||
259 | } | ||
260 | |||
261 | return 0; | ||
262 | } | ||
263 | |||
264 | static ssize_t show_voltage(struct device *dev, struct device_attribute *attr, | ||
265 | char *buf) | ||
266 | { | ||
267 | struct adt7475_data *data = adt7475_update_device(dev); | ||
268 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
269 | unsigned short val; | ||
270 | |||
271 | switch (sattr->nr) { | ||
272 | case ALARM: | ||
273 | return sprintf(buf, "%d\n", | ||
274 | (data->alarms >> (sattr->index + 1)) & 1); | ||
275 | default: | ||
276 | val = data->voltage[sattr->nr][sattr->index]; | ||
277 | return sprintf(buf, "%d\n", | ||
278 | sattr->index == | ||
279 | 0 ? reg2vccp(val) : reg2vcc(val)); | ||
280 | } | ||
281 | } | ||
282 | |||
283 | static ssize_t set_voltage(struct device *dev, struct device_attribute *attr, | ||
284 | const char *buf, size_t count) | ||
285 | { | ||
286 | |||
287 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
288 | struct i2c_client *client = to_i2c_client(dev); | ||
289 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
290 | unsigned char reg; | ||
291 | long val; | ||
292 | |||
293 | if (strict_strtol(buf, 10, &val)) | ||
294 | return -EINVAL; | ||
295 | |||
296 | mutex_lock(&data->lock); | ||
297 | |||
298 | data->voltage[sattr->nr][sattr->index] = | ||
299 | sattr->index ? vcc2reg(val) : vccp2reg(val); | ||
300 | |||
301 | if (sattr->nr == MIN) | ||
302 | reg = VOLTAGE_MIN_REG(sattr->index); | ||
303 | else | ||
304 | reg = VOLTAGE_MAX_REG(sattr->index); | ||
305 | |||
306 | i2c_smbus_write_byte_data(client, reg, | ||
307 | data->voltage[sattr->nr][sattr->index] >> 2); | ||
308 | mutex_unlock(&data->lock); | ||
309 | |||
310 | return count; | ||
311 | } | ||
312 | |||
313 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, | ||
314 | char *buf) | ||
315 | { | ||
316 | struct adt7475_data *data = adt7475_update_device(dev); | ||
317 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
318 | int out; | ||
319 | |||
320 | switch (sattr->nr) { | ||
321 | case HYSTERSIS: | ||
322 | mutex_lock(&data->lock); | ||
323 | out = data->temp[sattr->nr][sattr->index]; | ||
324 | if (sattr->index != 1) | ||
325 | out = (out >> 4) & 0xF; | ||
326 | else | ||
327 | out = (out & 0xF); | ||
328 | /* Show the value as an absolute number tied to | ||
329 | * THERM */ | ||
330 | out = reg2temp(data, data->temp[THERM][sattr->index]) - | ||
331 | out * 1000; | ||
332 | mutex_unlock(&data->lock); | ||
333 | break; | ||
334 | |||
335 | case OFFSET: | ||
336 | /* Offset is always 2's complement, regardless of the | ||
337 | * setting in CONFIG5 */ | ||
338 | mutex_lock(&data->lock); | ||
339 | out = (s8)data->temp[sattr->nr][sattr->index]; | ||
340 | if (data->config5 & CONFIG5_TEMPOFFSET) | ||
341 | out *= 1000; | ||
342 | else | ||
343 | out *= 500; | ||
344 | mutex_unlock(&data->lock); | ||
345 | break; | ||
346 | |||
347 | case ALARM: | ||
348 | out = (data->alarms >> (sattr->index + 4)) & 1; | ||
349 | break; | ||
350 | |||
351 | case FAULT: | ||
352 | /* Note - only for remote1 and remote2 */ | ||
353 | out = data->alarms & (sattr->index ? 0x8000 : 0x4000); | ||
354 | out = out ? 0 : 1; | ||
355 | break; | ||
356 | |||
357 | default: | ||
358 | /* All other temp values are in the configured format */ | ||
359 | out = reg2temp(data, data->temp[sattr->nr][sattr->index]); | ||
360 | } | ||
361 | |||
362 | return sprintf(buf, "%d\n", out); | ||
363 | } | ||
364 | |||
365 | static ssize_t set_temp(struct device *dev, struct device_attribute *attr, | ||
366 | const char *buf, size_t count) | ||
367 | { | ||
368 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
369 | struct i2c_client *client = to_i2c_client(dev); | ||
370 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
371 | unsigned char reg = 0; | ||
372 | u8 out; | ||
373 | int temp; | ||
374 | long val; | ||
375 | |||
376 | if (strict_strtol(buf, 10, &val)) | ||
377 | return -EINVAL; | ||
378 | |||
379 | mutex_lock(&data->lock); | ||
380 | |||
381 | /* We need the config register in all cases for temp <-> reg conv. */ | ||
382 | data->config5 = adt7475_read(REG_CONFIG5); | ||
383 | |||
384 | switch (sattr->nr) { | ||
385 | case OFFSET: | ||
386 | if (data->config5 & CONFIG5_TEMPOFFSET) { | ||
387 | val = SENSORS_LIMIT(val, -63000, 127000); | ||
388 | out = data->temp[OFFSET][sattr->index] = val / 1000; | ||
389 | } else { | ||
390 | val = SENSORS_LIMIT(val, -63000, 64000); | ||
391 | out = data->temp[OFFSET][sattr->index] = val / 500; | ||
392 | } | ||
393 | break; | ||
394 | |||
395 | case HYSTERSIS: | ||
396 | /* The value will be given as an absolute value, turn it | ||
397 | into an offset based on THERM */ | ||
398 | |||
399 | /* Read fresh THERM and HYSTERSIS values from the chip */ | ||
400 | data->temp[THERM][sattr->index] = | ||
401 | adt7475_read(TEMP_THERM_REG(sattr->index)) << 2; | ||
402 | adt7475_read_hystersis(client); | ||
403 | |||
404 | temp = reg2temp(data, data->temp[THERM][sattr->index]); | ||
405 | val = SENSORS_LIMIT(val, temp - 15000, temp); | ||
406 | val = (temp - val) / 1000; | ||
407 | |||
408 | if (sattr->index != 1) { | ||
409 | data->temp[HYSTERSIS][sattr->index] &= 0xF0; | ||
410 | data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4; | ||
411 | } else { | ||
412 | data->temp[HYSTERSIS][sattr->index] &= 0x0F; | ||
413 | data->temp[HYSTERSIS][sattr->index] |= (val & 0xF); | ||
414 | } | ||
415 | |||
416 | out = data->temp[HYSTERSIS][sattr->index]; | ||
417 | break; | ||
418 | |||
419 | default: | ||
420 | data->temp[sattr->nr][sattr->index] = temp2reg(data, val); | ||
421 | |||
422 | /* We maintain an extra 2 digits of precision for simplicity | ||
423 | * - shift those back off before writing the value */ | ||
424 | out = (u8) (data->temp[sattr->nr][sattr->index] >> 2); | ||
425 | } | ||
426 | |||
427 | switch (sattr->nr) { | ||
428 | case MIN: | ||
429 | reg = TEMP_MIN_REG(sattr->index); | ||
430 | break; | ||
431 | case MAX: | ||
432 | reg = TEMP_MAX_REG(sattr->index); | ||
433 | break; | ||
434 | case OFFSET: | ||
435 | reg = TEMP_OFFSET_REG(sattr->index); | ||
436 | break; | ||
437 | case AUTOMIN: | ||
438 | reg = TEMP_TMIN_REG(sattr->index); | ||
439 | break; | ||
440 | case THERM: | ||
441 | reg = TEMP_THERM_REG(sattr->index); | ||
442 | break; | ||
443 | case HYSTERSIS: | ||
444 | if (sattr->index != 2) | ||
445 | reg = REG_REMOTE1_HYSTERSIS; | ||
446 | else | ||
447 | reg = REG_REMOTE2_HYSTERSIS; | ||
448 | |||
449 | break; | ||
450 | } | ||
451 | |||
452 | i2c_smbus_write_byte_data(client, reg, out); | ||
453 | |||
454 | mutex_unlock(&data->lock); | ||
455 | return count; | ||
456 | } | ||
457 | |||
458 | /* Table of autorange values - the user will write the value in millidegrees, | ||
459 | and we'll convert it */ | ||
460 | static const int autorange_table[] = { | ||
461 | 2000, 2500, 3330, 4000, 5000, 6670, 8000, | ||
462 | 10000, 13330, 16000, 20000, 26670, 32000, 40000, | ||
463 | 53330, 80000 | ||
464 | }; | ||
465 | |||
466 | static ssize_t show_point2(struct device *dev, struct device_attribute *attr, | ||
467 | char *buf) | ||
468 | { | ||
469 | struct adt7475_data *data = adt7475_update_device(dev); | ||
470 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
471 | int out, val; | ||
472 | |||
473 | mutex_lock(&data->lock); | ||
474 | out = (data->range[sattr->index] >> 4) & 0x0F; | ||
475 | val = reg2temp(data, data->temp[AUTOMIN][sattr->index]); | ||
476 | mutex_unlock(&data->lock); | ||
477 | |||
478 | return sprintf(buf, "%d\n", val + autorange_table[out]); | ||
479 | } | ||
480 | |||
481 | static ssize_t set_point2(struct device *dev, struct device_attribute *attr, | ||
482 | const char *buf, size_t count) | ||
483 | { | ||
484 | struct i2c_client *client = to_i2c_client(dev); | ||
485 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
486 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
487 | int temp; | ||
488 | long val; | ||
489 | |||
490 | if (strict_strtol(buf, 10, &val)) | ||
491 | return -EINVAL; | ||
492 | |||
493 | mutex_lock(&data->lock); | ||
494 | |||
495 | /* Get a fresh copy of the needed registers */ | ||
496 | data->config5 = adt7475_read(REG_CONFIG5); | ||
497 | data->temp[AUTOMIN][sattr->index] = | ||
498 | adt7475_read(TEMP_TMIN_REG(sattr->index)) << 2; | ||
499 | data->range[sattr->index] = | ||
500 | adt7475_read(TEMP_TRANGE_REG(sattr->index)); | ||
501 | |||
502 | /* The user will write an absolute value, so subtract the start point | ||
503 | to figure the range */ | ||
504 | temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]); | ||
505 | val = SENSORS_LIMIT(val, temp + autorange_table[0], | ||
506 | temp + autorange_table[ARRAY_SIZE(autorange_table) - 1]); | ||
507 | val -= temp; | ||
508 | |||
509 | /* Find the nearest table entry to what the user wrote */ | ||
510 | val = find_nearest(val, autorange_table, ARRAY_SIZE(autorange_table)); | ||
511 | |||
512 | data->range[sattr->index] &= ~0xF0; | ||
513 | data->range[sattr->index] |= val << 4; | ||
514 | |||
515 | i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index), | ||
516 | data->range[sattr->index]); | ||
517 | |||
518 | mutex_unlock(&data->lock); | ||
519 | return count; | ||
520 | } | ||
521 | |||
522 | static ssize_t show_tach(struct device *dev, struct device_attribute *attr, | ||
523 | char *buf) | ||
524 | { | ||
525 | struct adt7475_data *data = adt7475_update_device(dev); | ||
526 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
527 | int out; | ||
528 | |||
529 | if (sattr->nr == ALARM) | ||
530 | out = (data->alarms >> (sattr->index + 10)) & 1; | ||
531 | else | ||
532 | out = tach2rpm(data->tach[sattr->nr][sattr->index]); | ||
533 | |||
534 | return sprintf(buf, "%d\n", out); | ||
535 | } | ||
536 | |||
537 | static ssize_t set_tach(struct device *dev, struct device_attribute *attr, | ||
538 | const char *buf, size_t count) | ||
539 | { | ||
540 | |||
541 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
542 | struct i2c_client *client = to_i2c_client(dev); | ||
543 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
544 | unsigned long val; | ||
545 | |||
546 | if (strict_strtoul(buf, 10, &val)) | ||
547 | return -EINVAL; | ||
548 | |||
549 | mutex_lock(&data->lock); | ||
550 | |||
551 | data->tach[MIN][sattr->index] = rpm2tach(val); | ||
552 | |||
553 | adt7475_write_word(client, TACH_MIN_REG(sattr->index), | ||
554 | data->tach[MIN][sattr->index]); | ||
555 | |||
556 | mutex_unlock(&data->lock); | ||
557 | return count; | ||
558 | } | ||
559 | |||
560 | static ssize_t show_pwm(struct device *dev, struct device_attribute *attr, | ||
561 | char *buf) | ||
562 | { | ||
563 | struct adt7475_data *data = adt7475_update_device(dev); | ||
564 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
565 | |||
566 | return sprintf(buf, "%d\n", data->pwm[sattr->nr][sattr->index]); | ||
567 | } | ||
568 | |||
569 | static ssize_t show_pwmchan(struct device *dev, struct device_attribute *attr, | ||
570 | char *buf) | ||
571 | { | ||
572 | struct adt7475_data *data = adt7475_update_device(dev); | ||
573 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
574 | |||
575 | return sprintf(buf, "%d\n", data->pwmchan[sattr->index]); | ||
576 | } | ||
577 | |||
578 | static ssize_t show_pwmctrl(struct device *dev, struct device_attribute *attr, | ||
579 | char *buf) | ||
580 | { | ||
581 | struct adt7475_data *data = adt7475_update_device(dev); | ||
582 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
583 | |||
584 | return sprintf(buf, "%d\n", data->pwmctl[sattr->index]); | ||
585 | } | ||
586 | |||
587 | static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, | ||
588 | const char *buf, size_t count) | ||
589 | { | ||
590 | |||
591 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
592 | struct i2c_client *client = to_i2c_client(dev); | ||
593 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
594 | unsigned char reg = 0; | ||
595 | long val; | ||
596 | |||
597 | if (strict_strtol(buf, 10, &val)) | ||
598 | return -EINVAL; | ||
599 | |||
600 | mutex_lock(&data->lock); | ||
601 | |||
602 | switch (sattr->nr) { | ||
603 | case INPUT: | ||
604 | /* Get a fresh value for CONTROL */ | ||
605 | data->pwm[CONTROL][sattr->index] = | ||
606 | adt7475_read(PWM_CONFIG_REG(sattr->index)); | ||
607 | |||
608 | /* If we are not in manual mode, then we shouldn't allow | ||
609 | * the user to set the pwm speed */ | ||
610 | if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) { | ||
611 | mutex_unlock(&data->lock); | ||
612 | return count; | ||
613 | } | ||
614 | |||
615 | reg = PWM_REG(sattr->index); | ||
616 | break; | ||
617 | |||
618 | case MIN: | ||
619 | reg = PWM_MIN_REG(sattr->index); | ||
620 | break; | ||
621 | |||
622 | case MAX: | ||
623 | reg = PWM_MAX_REG(sattr->index); | ||
624 | break; | ||
625 | } | ||
626 | |||
627 | data->pwm[sattr->nr][sattr->index] = SENSORS_LIMIT(val, 0, 0xFF); | ||
628 | i2c_smbus_write_byte_data(client, reg, | ||
629 | data->pwm[sattr->nr][sattr->index]); | ||
630 | |||
631 | mutex_unlock(&data->lock); | ||
632 | |||
633 | return count; | ||
634 | } | ||
635 | |||
636 | /* Called by set_pwmctrl and set_pwmchan */ | ||
637 | |||
638 | static int hw_set_pwm(struct i2c_client *client, int index, | ||
639 | unsigned int pwmctl, unsigned int pwmchan) | ||
640 | { | ||
641 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
642 | long val = 0; | ||
643 | |||
644 | switch (pwmctl) { | ||
645 | case 0: | ||
646 | val = 0x03; /* Run at full speed */ | ||
647 | break; | ||
648 | case 1: | ||
649 | val = 0x07; /* Manual mode */ | ||
650 | break; | ||
651 | case 2: | ||
652 | switch (pwmchan) { | ||
653 | case 1: | ||
654 | /* Remote1 controls PWM */ | ||
655 | val = 0x00; | ||
656 | break; | ||
657 | case 2: | ||
658 | /* local controls PWM */ | ||
659 | val = 0x01; | ||
660 | break; | ||
661 | case 4: | ||
662 | /* remote2 controls PWM */ | ||
663 | val = 0x02; | ||
664 | break; | ||
665 | case 6: | ||
666 | /* local/remote2 control PWM */ | ||
667 | val = 0x05; | ||
668 | break; | ||
669 | case 7: | ||
670 | /* All three control PWM */ | ||
671 | val = 0x06; | ||
672 | break; | ||
673 | default: | ||
674 | return -EINVAL; | ||
675 | } | ||
676 | break; | ||
677 | default: | ||
678 | return -EINVAL; | ||
679 | } | ||
680 | |||
681 | data->pwmctl[index] = pwmctl; | ||
682 | data->pwmchan[index] = pwmchan; | ||
683 | |||
684 | data->pwm[CONTROL][index] &= ~0xE0; | ||
685 | data->pwm[CONTROL][index] |= (val & 7) << 5; | ||
686 | |||
687 | i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index), | ||
688 | data->pwm[CONTROL][index]); | ||
689 | |||
690 | return 0; | ||
691 | } | ||
692 | |||
693 | static ssize_t set_pwmchan(struct device *dev, struct device_attribute *attr, | ||
694 | const char *buf, size_t count) | ||
695 | { | ||
696 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
697 | struct i2c_client *client = to_i2c_client(dev); | ||
698 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
699 | int r; | ||
700 | long val; | ||
701 | |||
702 | if (strict_strtol(buf, 10, &val)) | ||
703 | return -EINVAL; | ||
704 | |||
705 | mutex_lock(&data->lock); | ||
706 | /* Read Modify Write PWM values */ | ||
707 | adt7475_read_pwm(client, sattr->index); | ||
708 | r = hw_set_pwm(client, sattr->index, data->pwmctl[sattr->index], val); | ||
709 | if (r) | ||
710 | count = r; | ||
711 | mutex_unlock(&data->lock); | ||
712 | |||
713 | return count; | ||
714 | } | ||
715 | |||
716 | static ssize_t set_pwmctrl(struct device *dev, struct device_attribute *attr, | ||
717 | const char *buf, size_t count) | ||
718 | { | ||
719 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
720 | struct i2c_client *client = to_i2c_client(dev); | ||
721 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
722 | int r; | ||
723 | long val; | ||
724 | |||
725 | if (strict_strtol(buf, 10, &val)) | ||
726 | return -EINVAL; | ||
727 | |||
728 | mutex_lock(&data->lock); | ||
729 | /* Read Modify Write PWM values */ | ||
730 | adt7475_read_pwm(client, sattr->index); | ||
731 | r = hw_set_pwm(client, sattr->index, val, data->pwmchan[sattr->index]); | ||
732 | if (r) | ||
733 | count = r; | ||
734 | mutex_unlock(&data->lock); | ||
735 | |||
736 | return count; | ||
737 | } | ||
738 | |||
739 | /* List of frequencies for the PWM */ | ||
740 | static const int pwmfreq_table[] = { | ||
741 | 11, 14, 22, 29, 35, 44, 58, 88 | ||
742 | }; | ||
743 | |||
744 | static ssize_t show_pwmfreq(struct device *dev, struct device_attribute *attr, | ||
745 | char *buf) | ||
746 | { | ||
747 | struct adt7475_data *data = adt7475_update_device(dev); | ||
748 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
749 | |||
750 | return sprintf(buf, "%d\n", | ||
751 | pwmfreq_table[data->range[sattr->index] & 7]); | ||
752 | } | ||
753 | |||
754 | static ssize_t set_pwmfreq(struct device *dev, struct device_attribute *attr, | ||
755 | const char *buf, size_t count) | ||
756 | { | ||
757 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
758 | struct i2c_client *client = to_i2c_client(dev); | ||
759 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
760 | int out; | ||
761 | long val; | ||
762 | |||
763 | if (strict_strtol(buf, 10, &val)) | ||
764 | return -EINVAL; | ||
765 | |||
766 | out = find_nearest(val, pwmfreq_table, ARRAY_SIZE(pwmfreq_table)); | ||
767 | |||
768 | mutex_lock(&data->lock); | ||
769 | |||
770 | data->range[sattr->index] = | ||
771 | adt7475_read(TEMP_TRANGE_REG(sattr->index)); | ||
772 | data->range[sattr->index] &= ~7; | ||
773 | data->range[sattr->index] |= out; | ||
774 | |||
775 | i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index), | ||
776 | data->range[sattr->index]); | ||
777 | |||
778 | mutex_unlock(&data->lock); | ||
779 | return count; | ||
780 | } | ||
781 | |||
782 | static SENSOR_DEVICE_ATTR_2(in1_input, S_IRUGO, show_voltage, NULL, INPUT, 0); | ||
783 | static SENSOR_DEVICE_ATTR_2(in1_max, S_IRUGO | S_IWUSR, show_voltage, | ||
784 | set_voltage, MAX, 0); | ||
785 | static SENSOR_DEVICE_ATTR_2(in1_min, S_IRUGO | S_IWUSR, show_voltage, | ||
786 | set_voltage, MIN, 0); | ||
787 | static SENSOR_DEVICE_ATTR_2(in1_alarm, S_IRUGO, show_voltage, NULL, ALARM, 0); | ||
788 | static SENSOR_DEVICE_ATTR_2(in2_input, S_IRUGO, show_voltage, NULL, INPUT, 1); | ||
789 | static SENSOR_DEVICE_ATTR_2(in2_max, S_IRUGO | S_IWUSR, show_voltage, | ||
790 | set_voltage, MAX, 1); | ||
791 | static SENSOR_DEVICE_ATTR_2(in2_min, S_IRUGO | S_IWUSR, show_voltage, | ||
792 | set_voltage, MIN, 1); | ||
793 | static SENSOR_DEVICE_ATTR_2(in2_alarm, S_IRUGO, show_voltage, NULL, ALARM, 1); | ||
794 | static SENSOR_DEVICE_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, INPUT, 0); | ||
795 | static SENSOR_DEVICE_ATTR_2(temp1_alarm, S_IRUGO, show_temp, NULL, ALARM, 0); | ||
796 | static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, show_temp, NULL, FAULT, 0); | ||
797 | static SENSOR_DEVICE_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
798 | MAX, 0); | ||
799 | static SENSOR_DEVICE_ATTR_2(temp1_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
800 | MIN, 0); | ||
801 | static SENSOR_DEVICE_ATTR_2(temp1_offset, S_IRUGO | S_IWUSR, show_temp, | ||
802 | set_temp, OFFSET, 0); | ||
803 | static SENSOR_DEVICE_ATTR_2(temp1_auto_point1_temp, S_IRUGO | S_IWUSR, | ||
804 | show_temp, set_temp, AUTOMIN, 0); | ||
805 | static SENSOR_DEVICE_ATTR_2(temp1_auto_point2_temp, S_IRUGO | S_IWUSR, | ||
806 | show_point2, set_point2, 0, 0); | ||
807 | static SENSOR_DEVICE_ATTR_2(temp1_crit, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
808 | THERM, 0); | ||
809 | static SENSOR_DEVICE_ATTR_2(temp1_crit_hyst, S_IRUGO | S_IWUSR, show_temp, | ||
810 | set_temp, HYSTERSIS, 0); | ||
811 | static SENSOR_DEVICE_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, INPUT, 1); | ||
812 | static SENSOR_DEVICE_ATTR_2(temp2_alarm, S_IRUGO, show_temp, NULL, ALARM, 1); | ||
813 | static SENSOR_DEVICE_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
814 | MAX, 1); | ||
815 | static SENSOR_DEVICE_ATTR_2(temp2_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
816 | MIN, 1); | ||
817 | static SENSOR_DEVICE_ATTR_2(temp2_offset, S_IRUGO | S_IWUSR, show_temp, | ||
818 | set_temp, OFFSET, 1); | ||
819 | static SENSOR_DEVICE_ATTR_2(temp2_auto_point1_temp, S_IRUGO | S_IWUSR, | ||
820 | show_temp, set_temp, AUTOMIN, 1); | ||
821 | static SENSOR_DEVICE_ATTR_2(temp2_auto_point2_temp, S_IRUGO | S_IWUSR, | ||
822 | show_point2, set_point2, 0, 1); | ||
823 | static SENSOR_DEVICE_ATTR_2(temp2_crit, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
824 | THERM, 1); | ||
825 | static SENSOR_DEVICE_ATTR_2(temp2_crit_hyst, S_IRUGO | S_IWUSR, show_temp, | ||
826 | set_temp, HYSTERSIS, 1); | ||
827 | static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, INPUT, 2); | ||
828 | static SENSOR_DEVICE_ATTR_2(temp3_alarm, S_IRUGO, show_temp, NULL, ALARM, 2); | ||
829 | static SENSOR_DEVICE_ATTR_2(temp3_fault, S_IRUGO, show_temp, NULL, FAULT, 2); | ||
830 | static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
831 | MAX, 2); | ||
832 | static SENSOR_DEVICE_ATTR_2(temp3_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
833 | MIN, 2); | ||
834 | static SENSOR_DEVICE_ATTR_2(temp3_offset, S_IRUGO | S_IWUSR, show_temp, | ||
835 | set_temp, OFFSET, 2); | ||
836 | static SENSOR_DEVICE_ATTR_2(temp3_auto_point1_temp, S_IRUGO | S_IWUSR, | ||
837 | show_temp, set_temp, AUTOMIN, 2); | ||
838 | static SENSOR_DEVICE_ATTR_2(temp3_auto_point2_temp, S_IRUGO | S_IWUSR, | ||
839 | show_point2, set_point2, 0, 2); | ||
840 | static SENSOR_DEVICE_ATTR_2(temp3_crit, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
841 | THERM, 2); | ||
842 | static SENSOR_DEVICE_ATTR_2(temp3_crit_hyst, S_IRUGO | S_IWUSR, show_temp, | ||
843 | set_temp, HYSTERSIS, 2); | ||
844 | static SENSOR_DEVICE_ATTR_2(fan1_input, S_IRUGO, show_tach, NULL, INPUT, 0); | ||
845 | static SENSOR_DEVICE_ATTR_2(fan1_min, S_IRUGO | S_IWUSR, show_tach, set_tach, | ||
846 | MIN, 0); | ||
847 | static SENSOR_DEVICE_ATTR_2(fan1_alarm, S_IRUGO, show_tach, NULL, ALARM, 0); | ||
848 | static SENSOR_DEVICE_ATTR_2(fan2_input, S_IRUGO, show_tach, NULL, INPUT, 1); | ||
849 | static SENSOR_DEVICE_ATTR_2(fan2_min, S_IRUGO | S_IWUSR, show_tach, set_tach, | ||
850 | MIN, 1); | ||
851 | static SENSOR_DEVICE_ATTR_2(fan2_alarm, S_IRUGO, show_tach, NULL, ALARM, 1); | ||
852 | static SENSOR_DEVICE_ATTR_2(fan3_input, S_IRUGO, show_tach, NULL, INPUT, 2); | ||
853 | static SENSOR_DEVICE_ATTR_2(fan3_min, S_IRUGO | S_IWUSR, show_tach, set_tach, | ||
854 | MIN, 2); | ||
855 | static SENSOR_DEVICE_ATTR_2(fan3_alarm, S_IRUGO, show_tach, NULL, ALARM, 2); | ||
856 | static SENSOR_DEVICE_ATTR_2(fan4_input, S_IRUGO, show_tach, NULL, INPUT, 3); | ||
857 | static SENSOR_DEVICE_ATTR_2(fan4_min, S_IRUGO | S_IWUSR, show_tach, set_tach, | ||
858 | MIN, 3); | ||
859 | static SENSOR_DEVICE_ATTR_2(fan4_alarm, S_IRUGO, show_tach, NULL, ALARM, 3); | ||
860 | static SENSOR_DEVICE_ATTR_2(pwm1, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT, | ||
861 | 0); | ||
862 | static SENSOR_DEVICE_ATTR_2(pwm1_freq, S_IRUGO | S_IWUSR, show_pwmfreq, | ||
863 | set_pwmfreq, INPUT, 0); | ||
864 | static SENSOR_DEVICE_ATTR_2(pwm1_enable, S_IRUGO | S_IWUSR, show_pwmctrl, | ||
865 | set_pwmctrl, INPUT, 0); | ||
866 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_channel_temp, S_IRUGO | S_IWUSR, | ||
867 | show_pwmchan, set_pwmchan, INPUT, 0); | ||
868 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
869 | set_pwm, MIN, 0); | ||
870 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
871 | set_pwm, MAX, 0); | ||
872 | static SENSOR_DEVICE_ATTR_2(pwm2, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT, | ||
873 | 1); | ||
874 | static SENSOR_DEVICE_ATTR_2(pwm2_freq, S_IRUGO | S_IWUSR, show_pwmfreq, | ||
875 | set_pwmfreq, INPUT, 1); | ||
876 | static SENSOR_DEVICE_ATTR_2(pwm2_enable, S_IRUGO | S_IWUSR, show_pwmctrl, | ||
877 | set_pwmctrl, INPUT, 1); | ||
878 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_channel_temp, S_IRUGO | S_IWUSR, | ||
879 | show_pwmchan, set_pwmchan, INPUT, 1); | ||
880 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
881 | set_pwm, MIN, 1); | ||
882 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
883 | set_pwm, MAX, 1); | ||
884 | static SENSOR_DEVICE_ATTR_2(pwm3, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT, | ||
885 | 2); | ||
886 | static SENSOR_DEVICE_ATTR_2(pwm3_freq, S_IRUGO | S_IWUSR, show_pwmfreq, | ||
887 | set_pwmfreq, INPUT, 2); | ||
888 | static SENSOR_DEVICE_ATTR_2(pwm3_enable, S_IRUGO | S_IWUSR, show_pwmctrl, | ||
889 | set_pwmctrl, INPUT, 2); | ||
890 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_channel_temp, S_IRUGO | S_IWUSR, | ||
891 | show_pwmchan, set_pwmchan, INPUT, 2); | ||
892 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
893 | set_pwm, MIN, 2); | ||
894 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
895 | set_pwm, MAX, 2); | ||
896 | |||
897 | static struct attribute *adt7475_attrs[] = { | ||
898 | &sensor_dev_attr_in1_input.dev_attr.attr, | ||
899 | &sensor_dev_attr_in1_max.dev_attr.attr, | ||
900 | &sensor_dev_attr_in1_min.dev_attr.attr, | ||
901 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
902 | &sensor_dev_attr_in2_input.dev_attr.attr, | ||
903 | &sensor_dev_attr_in2_max.dev_attr.attr, | ||
904 | &sensor_dev_attr_in2_min.dev_attr.attr, | ||
905 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
906 | &sensor_dev_attr_temp1_input.dev_attr.attr, | ||
907 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
908 | &sensor_dev_attr_temp1_fault.dev_attr.attr, | ||
909 | &sensor_dev_attr_temp1_max.dev_attr.attr, | ||
910 | &sensor_dev_attr_temp1_min.dev_attr.attr, | ||
911 | &sensor_dev_attr_temp1_offset.dev_attr.attr, | ||
912 | &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, | ||
913 | &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr, | ||
914 | &sensor_dev_attr_temp1_crit.dev_attr.attr, | ||
915 | &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, | ||
916 | &sensor_dev_attr_temp2_input.dev_attr.attr, | ||
917 | &sensor_dev_attr_temp2_alarm.dev_attr.attr, | ||
918 | &sensor_dev_attr_temp2_max.dev_attr.attr, | ||
919 | &sensor_dev_attr_temp2_min.dev_attr.attr, | ||
920 | &sensor_dev_attr_temp2_offset.dev_attr.attr, | ||
921 | &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr, | ||
922 | &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr, | ||
923 | &sensor_dev_attr_temp2_crit.dev_attr.attr, | ||
924 | &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr, | ||
925 | &sensor_dev_attr_temp3_input.dev_attr.attr, | ||
926 | &sensor_dev_attr_temp3_fault.dev_attr.attr, | ||
927 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | ||
928 | &sensor_dev_attr_temp3_max.dev_attr.attr, | ||
929 | &sensor_dev_attr_temp3_min.dev_attr.attr, | ||
930 | &sensor_dev_attr_temp3_offset.dev_attr.attr, | ||
931 | &sensor_dev_attr_temp3_auto_point1_temp.dev_attr.attr, | ||
932 | &sensor_dev_attr_temp3_auto_point2_temp.dev_attr.attr, | ||
933 | &sensor_dev_attr_temp3_crit.dev_attr.attr, | ||
934 | &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr, | ||
935 | &sensor_dev_attr_fan1_input.dev_attr.attr, | ||
936 | &sensor_dev_attr_fan1_min.dev_attr.attr, | ||
937 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
938 | &sensor_dev_attr_fan2_input.dev_attr.attr, | ||
939 | &sensor_dev_attr_fan2_min.dev_attr.attr, | ||
940 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
941 | &sensor_dev_attr_fan3_input.dev_attr.attr, | ||
942 | &sensor_dev_attr_fan3_min.dev_attr.attr, | ||
943 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | ||
944 | &sensor_dev_attr_fan4_input.dev_attr.attr, | ||
945 | &sensor_dev_attr_fan4_min.dev_attr.attr, | ||
946 | &sensor_dev_attr_fan4_alarm.dev_attr.attr, | ||
947 | &sensor_dev_attr_pwm1.dev_attr.attr, | ||
948 | &sensor_dev_attr_pwm1_freq.dev_attr.attr, | ||
949 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | ||
950 | &sensor_dev_attr_pwm1_auto_channel_temp.dev_attr.attr, | ||
951 | &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, | ||
952 | &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, | ||
953 | &sensor_dev_attr_pwm2.dev_attr.attr, | ||
954 | &sensor_dev_attr_pwm2_freq.dev_attr.attr, | ||
955 | &sensor_dev_attr_pwm2_enable.dev_attr.attr, | ||
956 | &sensor_dev_attr_pwm2_auto_channel_temp.dev_attr.attr, | ||
957 | &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr, | ||
958 | &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr, | ||
959 | &sensor_dev_attr_pwm3.dev_attr.attr, | ||
960 | &sensor_dev_attr_pwm3_freq.dev_attr.attr, | ||
961 | &sensor_dev_attr_pwm3_enable.dev_attr.attr, | ||
962 | &sensor_dev_attr_pwm3_auto_channel_temp.dev_attr.attr, | ||
963 | &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr, | ||
964 | &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr, | ||
965 | NULL, | ||
966 | }; | ||
967 | |||
968 | struct attribute_group adt7475_attr_group = { .attrs = adt7475_attrs }; | ||
969 | |||
970 | static int adt7475_detect(struct i2c_client *client, int kind, | ||
971 | struct i2c_board_info *info) | ||
972 | { | ||
973 | struct i2c_adapter *adapter = client->adapter; | ||
974 | |||
975 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | ||
976 | return -ENODEV; | ||
977 | |||
978 | if (kind <= 0) { | ||
979 | if (adt7475_read(REG_VENDID) != 0x41 || | ||
980 | adt7475_read(REG_DEVID) != 0x75) { | ||
981 | dev_err(&adapter->dev, | ||
982 | "Couldn't detect a adt7475 part at 0x%02x\n", | ||
983 | (unsigned int)client->addr); | ||
984 | return -ENODEV; | ||
985 | } | ||
986 | } | ||
987 | |||
988 | strlcpy(info->type, adt7475_id[0].name, I2C_NAME_SIZE); | ||
989 | |||
990 | return 0; | ||
991 | } | ||
992 | |||
993 | static int adt7475_probe(struct i2c_client *client, | ||
994 | const struct i2c_device_id *id) | ||
995 | { | ||
996 | struct adt7475_data *data; | ||
997 | int i, ret = 0; | ||
998 | |||
999 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
1000 | if (data == NULL) | ||
1001 | return -ENOMEM; | ||
1002 | |||
1003 | mutex_init(&data->lock); | ||
1004 | i2c_set_clientdata(client, data); | ||
1005 | |||
1006 | /* Call adt7475_read_pwm for all pwm's as this will reprogram any | ||
1007 | pwm's which are disabled to manual mode with 0% duty cycle */ | ||
1008 | for (i = 0; i < ADT7475_PWM_COUNT; i++) | ||
1009 | adt7475_read_pwm(client, i); | ||
1010 | |||
1011 | ret = sysfs_create_group(&client->dev.kobj, &adt7475_attr_group); | ||
1012 | if (ret) | ||
1013 | goto efree; | ||
1014 | |||
1015 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
1016 | if (IS_ERR(data->hwmon_dev)) { | ||
1017 | ret = PTR_ERR(data->hwmon_dev); | ||
1018 | goto eremove; | ||
1019 | } | ||
1020 | |||
1021 | return 0; | ||
1022 | |||
1023 | eremove: | ||
1024 | sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group); | ||
1025 | efree: | ||
1026 | kfree(data); | ||
1027 | return ret; | ||
1028 | } | ||
1029 | |||
1030 | static int adt7475_remove(struct i2c_client *client) | ||
1031 | { | ||
1032 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
1033 | |||
1034 | hwmon_device_unregister(data->hwmon_dev); | ||
1035 | sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group); | ||
1036 | kfree(data); | ||
1037 | |||
1038 | return 0; | ||
1039 | } | ||
1040 | |||
1041 | static struct i2c_driver adt7475_driver = { | ||
1042 | .class = I2C_CLASS_HWMON, | ||
1043 | .driver = { | ||
1044 | .name = "adt7475", | ||
1045 | }, | ||
1046 | .probe = adt7475_probe, | ||
1047 | .remove = adt7475_remove, | ||
1048 | .id_table = adt7475_id, | ||
1049 | .detect = adt7475_detect, | ||
1050 | .address_data = &addr_data, | ||
1051 | }; | ||
1052 | |||
1053 | static void adt7475_read_hystersis(struct i2c_client *client) | ||
1054 | { | ||
1055 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
1056 | |||
1057 | data->temp[HYSTERSIS][0] = (u16) adt7475_read(REG_REMOTE1_HYSTERSIS); | ||
1058 | data->temp[HYSTERSIS][1] = data->temp[HYSTERSIS][0]; | ||
1059 | data->temp[HYSTERSIS][2] = (u16) adt7475_read(REG_REMOTE2_HYSTERSIS); | ||
1060 | } | ||
1061 | |||
1062 | static void adt7475_read_pwm(struct i2c_client *client, int index) | ||
1063 | { | ||
1064 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
1065 | unsigned int v; | ||
1066 | |||
1067 | data->pwm[CONTROL][index] = adt7475_read(PWM_CONFIG_REG(index)); | ||
1068 | |||
1069 | /* Figure out the internal value for pwmctrl and pwmchan | ||
1070 | based on the current settings */ | ||
1071 | v = (data->pwm[CONTROL][index] >> 5) & 7; | ||
1072 | |||
1073 | if (v == 3) | ||
1074 | data->pwmctl[index] = 0; | ||
1075 | else if (v == 7) | ||
1076 | data->pwmctl[index] = 1; | ||
1077 | else if (v == 4) { | ||
1078 | /* The fan is disabled - we don't want to | ||
1079 | support that, so change to manual mode and | ||
1080 | set the duty cycle to 0 instead | ||
1081 | */ | ||
1082 | data->pwm[INPUT][index] = 0; | ||
1083 | data->pwm[CONTROL][index] &= ~0xE0; | ||
1084 | data->pwm[CONTROL][index] |= (7 << 5); | ||
1085 | |||
1086 | i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index), | ||
1087 | data->pwm[INPUT][index]); | ||
1088 | |||
1089 | i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index), | ||
1090 | data->pwm[CONTROL][index]); | ||
1091 | |||
1092 | data->pwmctl[index] = 1; | ||
1093 | } else { | ||
1094 | data->pwmctl[index] = 2; | ||
1095 | |||
1096 | switch (v) { | ||
1097 | case 0: | ||
1098 | data->pwmchan[index] = 1; | ||
1099 | break; | ||
1100 | case 1: | ||
1101 | data->pwmchan[index] = 2; | ||
1102 | break; | ||
1103 | case 2: | ||
1104 | data->pwmchan[index] = 4; | ||
1105 | break; | ||
1106 | case 5: | ||
1107 | data->pwmchan[index] = 6; | ||
1108 | break; | ||
1109 | case 6: | ||
1110 | data->pwmchan[index] = 7; | ||
1111 | break; | ||
1112 | } | ||
1113 | } | ||
1114 | } | ||
1115 | |||
1116 | static struct adt7475_data *adt7475_update_device(struct device *dev) | ||
1117 | { | ||
1118 | struct i2c_client *client = to_i2c_client(dev); | ||
1119 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
1120 | u8 ext; | ||
1121 | int i; | ||
1122 | |||
1123 | mutex_lock(&data->lock); | ||
1124 | |||
1125 | /* Measurement values update every 2 seconds */ | ||
1126 | if (time_after(jiffies, data->measure_updated + HZ * 2) || | ||
1127 | !data->valid) { | ||
1128 | data->alarms = adt7475_read(REG_STATUS2) << 8; | ||
1129 | data->alarms |= adt7475_read(REG_STATUS1); | ||
1130 | |||
1131 | ext = adt7475_read(REG_EXTEND1); | ||
1132 | for (i = 0; i < ADT7475_VOLTAGE_COUNT; i++) | ||
1133 | data->voltage[INPUT][i] = | ||
1134 | (adt7475_read(VOLTAGE_REG(i)) << 2) | | ||
1135 | ((ext >> ((i + 1) * 2)) & 3); | ||
1136 | |||
1137 | ext = adt7475_read(REG_EXTEND2); | ||
1138 | for (i = 0; i < ADT7475_TEMP_COUNT; i++) | ||
1139 | data->temp[INPUT][i] = | ||
1140 | (adt7475_read(TEMP_REG(i)) << 2) | | ||
1141 | ((ext >> ((i + 1) * 2)) & 3); | ||
1142 | |||
1143 | for (i = 0; i < ADT7475_TACH_COUNT; i++) | ||
1144 | data->tach[INPUT][i] = | ||
1145 | adt7475_read_word(client, TACH_REG(i)); | ||
1146 | |||
1147 | /* Updated by hw when in auto mode */ | ||
1148 | for (i = 0; i < ADT7475_PWM_COUNT; i++) | ||
1149 | data->pwm[INPUT][i] = adt7475_read(PWM_REG(i)); | ||
1150 | |||
1151 | data->measure_updated = jiffies; | ||
1152 | } | ||
1153 | |||
1154 | /* Limits and settings, should never change update every 60 seconds */ | ||
1155 | if (time_after(jiffies, data->limits_updated + HZ * 2) || | ||
1156 | !data->valid) { | ||
1157 | data->config5 = adt7475_read(REG_CONFIG5); | ||
1158 | |||
1159 | for (i = 0; i < ADT7475_VOLTAGE_COUNT; i++) { | ||
1160 | /* Adjust values so they match the input precision */ | ||
1161 | data->voltage[MIN][i] = | ||
1162 | adt7475_read(VOLTAGE_MIN_REG(i)) << 2; | ||
1163 | data->voltage[MAX][i] = | ||
1164 | adt7475_read(VOLTAGE_MAX_REG(i)) << 2; | ||
1165 | } | ||
1166 | |||
1167 | for (i = 0; i < ADT7475_TEMP_COUNT; i++) { | ||
1168 | /* Adjust values so they match the input precision */ | ||
1169 | data->temp[MIN][i] = | ||
1170 | adt7475_read(TEMP_MIN_REG(i)) << 2; | ||
1171 | data->temp[MAX][i] = | ||
1172 | adt7475_read(TEMP_MAX_REG(i)) << 2; | ||
1173 | data->temp[AUTOMIN][i] = | ||
1174 | adt7475_read(TEMP_TMIN_REG(i)) << 2; | ||
1175 | data->temp[THERM][i] = | ||
1176 | adt7475_read(TEMP_THERM_REG(i)) << 2; | ||
1177 | data->temp[OFFSET][i] = | ||
1178 | adt7475_read(TEMP_OFFSET_REG(i)); | ||
1179 | } | ||
1180 | adt7475_read_hystersis(client); | ||
1181 | |||
1182 | for (i = 0; i < ADT7475_TACH_COUNT; i++) | ||
1183 | data->tach[MIN][i] = | ||
1184 | adt7475_read_word(client, TACH_MIN_REG(i)); | ||
1185 | |||
1186 | for (i = 0; i < ADT7475_PWM_COUNT; i++) { | ||
1187 | data->pwm[MAX][i] = adt7475_read(PWM_MAX_REG(i)); | ||
1188 | data->pwm[MIN][i] = adt7475_read(PWM_MIN_REG(i)); | ||
1189 | /* Set the channel and control information */ | ||
1190 | adt7475_read_pwm(client, i); | ||
1191 | } | ||
1192 | |||
1193 | data->range[0] = adt7475_read(TEMP_TRANGE_REG(0)); | ||
1194 | data->range[1] = adt7475_read(TEMP_TRANGE_REG(1)); | ||
1195 | data->range[2] = adt7475_read(TEMP_TRANGE_REG(2)); | ||
1196 | |||
1197 | data->limits_updated = jiffies; | ||
1198 | data->valid = 1; | ||
1199 | } | ||
1200 | |||
1201 | mutex_unlock(&data->lock); | ||
1202 | |||
1203 | return data; | ||
1204 | } | ||
1205 | |||
1206 | static int __init sensors_adt7475_init(void) | ||
1207 | { | ||
1208 | return i2c_add_driver(&adt7475_driver); | ||
1209 | } | ||
1210 | |||
1211 | static void __exit sensors_adt7475_exit(void) | ||
1212 | { | ||
1213 | i2c_del_driver(&adt7475_driver); | ||
1214 | } | ||
1215 | |||
1216 | MODULE_AUTHOR("Advanced Micro Devices, Inc"); | ||
1217 | MODULE_DESCRIPTION("adt7475 driver"); | ||
1218 | MODULE_LICENSE("GPL"); | ||
1219 | |||
1220 | module_init(sensors_adt7475_init); | ||
1221 | module_exit(sensors_adt7475_exit); | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index dca47a591ba..e3018623658 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -590,6 +590,11 @@ static ssize_t applesmc_light_show(struct device *dev, | |||
590 | } | 590 | } |
591 | 591 | ||
592 | ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); | 592 | ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); |
593 | /* newer macbooks report a single 10-bit bigendian value */ | ||
594 | if (data_length == 10) { | ||
595 | left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2; | ||
596 | goto out; | ||
597 | } | ||
593 | left = buffer[2]; | 598 | left = buffer[2]; |
594 | if (ret) | 599 | if (ret) |
595 | goto out; | 600 | goto out; |
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index bf8d4058057..03705240000 100644 --- a/drivers/hwmon/hp_accel.c +++ b/drivers/hwmon/hp_accel.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2007-2008 Yan Burman | 4 | * Copyright (C) 2007-2008 Yan Burman |
5 | * Copyright (C) 2008 Eric Piel | 5 | * Copyright (C) 2008 Eric Piel |
6 | * Copyright (C) 2008 Pavel Machek | 6 | * Copyright (C) 2008-2009 Pavel Machek |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 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 | 9 | * it under the terms of the GNU General Public License as published by |
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/freezer.h> | 36 | #include <linux/freezer.h> |
37 | #include <linux/version.h> | 37 | #include <linux/version.h> |
38 | #include <linux/uaccess.h> | 38 | #include <linux/uaccess.h> |
39 | #include <linux/leds.h> | ||
39 | #include <acpi/acpi_drivers.h> | 40 | #include <acpi/acpi_drivers.h> |
40 | #include <asm/atomic.h> | 41 | #include <asm/atomic.h> |
41 | #include "lis3lv02d.h" | 42 | #include "lis3lv02d.h" |
@@ -43,6 +44,36 @@ | |||
43 | #define DRIVER_NAME "lis3lv02d" | 44 | #define DRIVER_NAME "lis3lv02d" |
44 | #define ACPI_MDPS_CLASS "accelerometer" | 45 | #define ACPI_MDPS_CLASS "accelerometer" |
45 | 46 | ||
47 | /* Delayed LEDs infrastructure ------------------------------------ */ | ||
48 | |||
49 | /* Special LED class that can defer work */ | ||
50 | struct delayed_led_classdev { | ||
51 | struct led_classdev led_classdev; | ||
52 | struct work_struct work; | ||
53 | enum led_brightness new_brightness; | ||
54 | |||
55 | unsigned int led; /* For driver */ | ||
56 | void (*set_brightness)(struct delayed_led_classdev *data, enum led_brightness value); | ||
57 | }; | ||
58 | |||
59 | static inline void delayed_set_status_worker(struct work_struct *work) | ||
60 | { | ||
61 | struct delayed_led_classdev *data = | ||
62 | container_of(work, struct delayed_led_classdev, work); | ||
63 | |||
64 | data->set_brightness(data, data->new_brightness); | ||
65 | } | ||
66 | |||
67 | static inline void delayed_sysfs_set(struct led_classdev *led_cdev, | ||
68 | enum led_brightness brightness) | ||
69 | { | ||
70 | struct delayed_led_classdev *data = container_of(led_cdev, | ||
71 | struct delayed_led_classdev, led_classdev); | ||
72 | data->new_brightness = brightness; | ||
73 | schedule_work(&data->work); | ||
74 | } | ||
75 | |||
76 | /* HP-specific accelerometer driver ------------------------------------ */ | ||
46 | 77 | ||
47 | /* For automatic insertion of the module */ | 78 | /* For automatic insertion of the module */ |
48 | static struct acpi_device_id lis3lv02d_device_ids[] = { | 79 | static struct acpi_device_id lis3lv02d_device_ids[] = { |
@@ -154,10 +185,33 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { | |||
154 | */ | 185 | */ |
155 | }; | 186 | }; |
156 | 187 | ||
188 | static void hpled_set(struct delayed_led_classdev *led_cdev, enum led_brightness value) | ||
189 | { | ||
190 | acpi_handle handle = adev.device->handle; | ||
191 | unsigned long long ret; /* Not used when writing */ | ||
192 | union acpi_object in_obj[1]; | ||
193 | struct acpi_object_list args = { 1, in_obj }; | ||
194 | |||
195 | in_obj[0].type = ACPI_TYPE_INTEGER; | ||
196 | in_obj[0].integer.value = !!value; | ||
197 | |||
198 | acpi_evaluate_integer(handle, "ALED", &args, &ret); | ||
199 | } | ||
200 | |||
201 | static struct delayed_led_classdev hpled_led = { | ||
202 | .led_classdev = { | ||
203 | .name = "hp::hddprotect", | ||
204 | .default_trigger = "none", | ||
205 | .brightness_set = delayed_sysfs_set, | ||
206 | .flags = LED_CORE_SUSPENDRESUME, | ||
207 | }, | ||
208 | .set_brightness = hpled_set, | ||
209 | }; | ||
157 | 210 | ||
158 | static int lis3lv02d_add(struct acpi_device *device) | 211 | static int lis3lv02d_add(struct acpi_device *device) |
159 | { | 212 | { |
160 | u8 val; | 213 | u8 val; |
214 | int ret; | ||
161 | 215 | ||
162 | if (!device) | 216 | if (!device) |
163 | return -EINVAL; | 217 | return -EINVAL; |
@@ -183,7 +237,19 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
183 | adev.ac = lis3lv02d_axis_normal; | 237 | adev.ac = lis3lv02d_axis_normal; |
184 | } | 238 | } |
185 | 239 | ||
186 | return lis3lv02d_init_device(&adev); | 240 | INIT_WORK(&hpled_led.work, delayed_set_status_worker); |
241 | ret = led_classdev_register(NULL, &hpled_led.led_classdev); | ||
242 | if (ret) | ||
243 | return ret; | ||
244 | |||
245 | ret = lis3lv02d_init_device(&adev); | ||
246 | if (ret) { | ||
247 | flush_work(&hpled_led.work); | ||
248 | led_classdev_unregister(&hpled_led.led_classdev); | ||
249 | return ret; | ||
250 | } | ||
251 | |||
252 | return ret; | ||
187 | } | 253 | } |
188 | 254 | ||
189 | static int lis3lv02d_remove(struct acpi_device *device, int type) | 255 | static int lis3lv02d_remove(struct acpi_device *device, int type) |
@@ -194,6 +260,9 @@ static int lis3lv02d_remove(struct acpi_device *device, int type) | |||
194 | lis3lv02d_joystick_disable(); | 260 | lis3lv02d_joystick_disable(); |
195 | lis3lv02d_poweroff(device->handle); | 261 | lis3lv02d_poweroff(device->handle); |
196 | 262 | ||
263 | flush_work(&hpled_led.work); | ||
264 | led_classdev_unregister(&hpled_led.led_classdev); | ||
265 | |||
197 | return lis3lv02d_remove_fs(); | 266 | return lis3lv02d_remove_fs(); |
198 | } | 267 | } |
199 | 268 | ||
@@ -256,7 +325,7 @@ static void __exit lis3lv02d_exit_module(void) | |||
256 | acpi_bus_unregister_driver(&lis3lv02d_driver); | 325 | acpi_bus_unregister_driver(&lis3lv02d_driver); |
257 | } | 326 | } |
258 | 327 | ||
259 | MODULE_DESCRIPTION("Glue between LIS3LV02Dx and HP ACPI BIOS"); | 328 | MODULE_DESCRIPTION("Glue between LIS3LV02Dx and HP ACPI BIOS and support for disk protection LED."); |
260 | MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek"); | 329 | MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek"); |
261 | MODULE_LICENSE("GPL"); | 330 | MODULE_LICENSE("GPL"); |
262 | 331 | ||
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c index bd2bde0ef95..1fe99511184 100644 --- a/drivers/hwmon/k8temp.c +++ b/drivers/hwmon/k8temp.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/hwmon-sysfs.h> | 31 | #include <linux/hwmon-sysfs.h> |
32 | #include <linux/err.h> | 32 | #include <linux/err.h> |
33 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
34 | #include <asm/processor.h> | ||
34 | 35 | ||
35 | #define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000) | 36 | #define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000) |
36 | #define REG_TEMP 0xe4 | 37 | #define REG_TEMP 0xe4 |
@@ -47,6 +48,8 @@ struct k8temp_data { | |||
47 | /* registers values */ | 48 | /* registers values */ |
48 | u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */ | 49 | u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */ |
49 | u32 temp[2][2]; /* core, place */ | 50 | u32 temp[2][2]; /* core, place */ |
51 | u8 swap_core_select; /* meaning of SEL_CORE is inverted */ | ||
52 | u32 temp_offset; | ||
50 | }; | 53 | }; |
51 | 54 | ||
52 | static struct k8temp_data *k8temp_update_device(struct device *dev) | 55 | static struct k8temp_data *k8temp_update_device(struct device *dev) |
@@ -114,10 +117,15 @@ static ssize_t show_temp(struct device *dev, | |||
114 | to_sensor_dev_attr_2(devattr); | 117 | to_sensor_dev_attr_2(devattr); |
115 | int core = attr->nr; | 118 | int core = attr->nr; |
116 | int place = attr->index; | 119 | int place = attr->index; |
120 | int temp; | ||
117 | struct k8temp_data *data = k8temp_update_device(dev); | 121 | struct k8temp_data *data = k8temp_update_device(dev); |
118 | 122 | ||
119 | return sprintf(buf, "%d\n", | 123 | if (data->swap_core_select) |
120 | TEMP_FROM_REG(data->temp[core][place])); | 124 | core = core ? 0 : 1; |
125 | |||
126 | temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset; | ||
127 | |||
128 | return sprintf(buf, "%d\n", temp); | ||
121 | } | 129 | } |
122 | 130 | ||
123 | /* core, place */ | 131 | /* core, place */ |
@@ -141,20 +149,49 @@ static int __devinit k8temp_probe(struct pci_dev *pdev, | |||
141 | int err; | 149 | int err; |
142 | u8 scfg; | 150 | u8 scfg; |
143 | u32 temp; | 151 | u32 temp; |
152 | u8 model, stepping; | ||
144 | struct k8temp_data *data; | 153 | struct k8temp_data *data; |
145 | u32 cpuid = cpuid_eax(1); | ||
146 | |||
147 | /* this feature should be available since SH-C0 core */ | ||
148 | if ((cpuid == 0xf40) || (cpuid == 0xf50) || (cpuid == 0xf51)) { | ||
149 | err = -ENODEV; | ||
150 | goto exit; | ||
151 | } | ||
152 | 154 | ||
153 | if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) { | 155 | if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) { |
154 | err = -ENOMEM; | 156 | err = -ENOMEM; |
155 | goto exit; | 157 | goto exit; |
156 | } | 158 | } |
157 | 159 | ||
160 | model = boot_cpu_data.x86_model; | ||
161 | stepping = boot_cpu_data.x86_mask; | ||
162 | |||
163 | switch (boot_cpu_data.x86) { | ||
164 | case 0xf: | ||
165 | /* feature available since SH-C0, exclude older revisions */ | ||
166 | if (((model == 4) && (stepping == 0)) || | ||
167 | ((model == 5) && (stepping <= 1))) { | ||
168 | err = -ENODEV; | ||
169 | goto exit_free; | ||
170 | } | ||
171 | |||
172 | /* | ||
173 | * AMD NPT family 0fh, i.e. RevF and RevG: | ||
174 | * meaning of SEL_CORE bit is inverted | ||
175 | */ | ||
176 | if (model >= 0x40) { | ||
177 | data->swap_core_select = 1; | ||
178 | dev_warn(&pdev->dev, "Temperature readouts might be " | ||
179 | "wrong - check erratum #141\n"); | ||
180 | } | ||
181 | |||
182 | if ((model >= 0x69) && | ||
183 | !(model == 0xc1 || model == 0x6c || model == 0x7c)) { | ||
184 | /* | ||
185 | * RevG desktop CPUs (i.e. no socket S1G1 parts) | ||
186 | * need additional offset, otherwise reported | ||
187 | * temperature is below ambient temperature | ||
188 | */ | ||
189 | data->temp_offset = 21000; | ||
190 | } | ||
191 | |||
192 | break; | ||
193 | } | ||
194 | |||
158 | pci_read_config_byte(pdev, REG_TEMP, &scfg); | 195 | pci_read_config_byte(pdev, REG_TEMP, &scfg); |
159 | scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */ | 196 | scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */ |
160 | pci_write_config_byte(pdev, REG_TEMP, scfg); | 197 | pci_write_config_byte(pdev, REG_TEMP, scfg); |
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig index 59c3d23f5bd..b9bef04b7be 100644 --- a/drivers/i2c/chips/Kconfig +++ b/drivers/i2c/chips/Kconfig | |||
@@ -139,15 +139,4 @@ config SENSORS_TSL2550 | |||
139 | This driver can also be built as a module. If so, the module | 139 | This driver can also be built as a module. If so, the module |
140 | will be called tsl2550. | 140 | will be called tsl2550. |
141 | 141 | ||
142 | config MCU_MPC8349EMITX | ||
143 | tristate "MPC8349E-mITX MCU driver" | ||
144 | depends on I2C && PPC_83xx | ||
145 | select GENERIC_GPIO | ||
146 | select ARCH_REQUIRE_GPIOLIB | ||
147 | help | ||
148 | Say Y here to enable soft power-off functionality on the Freescale | ||
149 | boards with the MPC8349E-mITX-compatible MCU chips. This driver will | ||
150 | also register MCU GPIOs with the generic GPIO API, so you'll able | ||
151 | to use MCU pins as GPIOs. | ||
152 | |||
153 | endmenu | 142 | endmenu |
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile index 83accaaf816..00fcb5193ac 100644 --- a/drivers/i2c/chips/Makefile +++ b/drivers/i2c/chips/Makefile | |||
@@ -19,7 +19,6 @@ obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o | |||
19 | obj-$(CONFIG_PCF8575) += pcf8575.o | 19 | obj-$(CONFIG_PCF8575) += pcf8575.o |
20 | obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o | 20 | obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o |
21 | obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o | 21 | obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o |
22 | obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o | ||
23 | 22 | ||
24 | ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) | 23 | ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) |
25 | EXTRA_CFLAGS += -DDEBUG | 24 | EXTRA_CFLAGS += -DDEBUG |
diff --git a/drivers/i2c/chips/mcu_mpc8349emitx.c b/drivers/i2c/chips/mcu_mpc8349emitx.c deleted file mode 100644 index 82a9bcb858b..00000000000 --- a/drivers/i2c/chips/mcu_mpc8349emitx.c +++ /dev/null | |||
@@ -1,209 +0,0 @@ | |||
1 | /* | ||
2 | * Power Management and GPIO expander driver for MPC8349E-mITX-compatible MCU | ||
3 | * | ||
4 | * Copyright (c) 2008 MontaVista Software, Inc. | ||
5 | * | ||
6 | * Author: Anton Vorontsov <avorontsov@ru.mvista.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 | |||
14 | #include <linux/init.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/mutex.h> | ||
19 | #include <linux/i2c.h> | ||
20 | #include <linux/gpio.h> | ||
21 | #include <linux/of.h> | ||
22 | #include <linux/of_gpio.h> | ||
23 | #include <asm/prom.h> | ||
24 | #include <asm/machdep.h> | ||
25 | |||
26 | /* | ||
27 | * I don't have specifications for the MCU firmware, I found this register | ||
28 | * and bits positions by the trial&error method. | ||
29 | */ | ||
30 | #define MCU_REG_CTRL 0x20 | ||
31 | #define MCU_CTRL_POFF 0x40 | ||
32 | |||
33 | #define MCU_NUM_GPIO 2 | ||
34 | |||
35 | struct mcu { | ||
36 | struct mutex lock; | ||
37 | struct device_node *np; | ||
38 | struct i2c_client *client; | ||
39 | struct of_gpio_chip of_gc; | ||
40 | u8 reg_ctrl; | ||
41 | }; | ||
42 | |||
43 | static struct mcu *glob_mcu; | ||
44 | |||
45 | static void mcu_power_off(void) | ||
46 | { | ||
47 | struct mcu *mcu = glob_mcu; | ||
48 | |||
49 | pr_info("Sending power-off request to the MCU...\n"); | ||
50 | mutex_lock(&mcu->lock); | ||
51 | i2c_smbus_write_byte_data(glob_mcu->client, MCU_REG_CTRL, | ||
52 | mcu->reg_ctrl | MCU_CTRL_POFF); | ||
53 | mutex_unlock(&mcu->lock); | ||
54 | } | ||
55 | |||
56 | static void mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) | ||
57 | { | ||
58 | struct of_gpio_chip *of_gc = to_of_gpio_chip(gc); | ||
59 | struct mcu *mcu = container_of(of_gc, struct mcu, of_gc); | ||
60 | u8 bit = 1 << (4 + gpio); | ||
61 | |||
62 | mutex_lock(&mcu->lock); | ||
63 | if (val) | ||
64 | mcu->reg_ctrl &= ~bit; | ||
65 | else | ||
66 | mcu->reg_ctrl |= bit; | ||
67 | |||
68 | i2c_smbus_write_byte_data(mcu->client, MCU_REG_CTRL, mcu->reg_ctrl); | ||
69 | mutex_unlock(&mcu->lock); | ||
70 | } | ||
71 | |||
72 | static int mcu_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) | ||
73 | { | ||
74 | mcu_gpio_set(gc, gpio, val); | ||
75 | return 0; | ||
76 | } | ||
77 | |||
78 | static int mcu_gpiochip_add(struct mcu *mcu) | ||
79 | { | ||
80 | struct device_node *np; | ||
81 | struct of_gpio_chip *of_gc = &mcu->of_gc; | ||
82 | struct gpio_chip *gc = &of_gc->gc; | ||
83 | int ret; | ||
84 | |||
85 | np = of_find_compatible_node(NULL, NULL, "fsl,mcu-mpc8349emitx"); | ||
86 | if (!np) | ||
87 | return -ENODEV; | ||
88 | |||
89 | gc->owner = THIS_MODULE; | ||
90 | gc->label = np->full_name; | ||
91 | gc->can_sleep = 1; | ||
92 | gc->ngpio = MCU_NUM_GPIO; | ||
93 | gc->base = -1; | ||
94 | gc->set = mcu_gpio_set; | ||
95 | gc->direction_output = mcu_gpio_dir_out; | ||
96 | of_gc->gpio_cells = 2; | ||
97 | of_gc->xlate = of_gpio_simple_xlate; | ||
98 | |||
99 | np->data = of_gc; | ||
100 | mcu->np = np; | ||
101 | |||
102 | /* | ||
103 | * We don't want to lose the node, its ->data and ->full_name... | ||
104 | * So, if succeeded, we don't put the node here. | ||
105 | */ | ||
106 | ret = gpiochip_add(gc); | ||
107 | if (ret) | ||
108 | of_node_put(np); | ||
109 | return ret; | ||
110 | } | ||
111 | |||
112 | static int mcu_gpiochip_remove(struct mcu *mcu) | ||
113 | { | ||
114 | int ret; | ||
115 | |||
116 | ret = gpiochip_remove(&mcu->of_gc.gc); | ||
117 | if (ret) | ||
118 | return ret; | ||
119 | of_node_put(mcu->np); | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | static int __devinit mcu_probe(struct i2c_client *client, | ||
125 | const struct i2c_device_id *id) | ||
126 | { | ||
127 | struct mcu *mcu; | ||
128 | int ret; | ||
129 | |||
130 | mcu = kzalloc(sizeof(*mcu), GFP_KERNEL); | ||
131 | if (!mcu) | ||
132 | return -ENOMEM; | ||
133 | |||
134 | mutex_init(&mcu->lock); | ||
135 | mcu->client = client; | ||
136 | i2c_set_clientdata(client, mcu); | ||
137 | |||
138 | ret = i2c_smbus_read_byte_data(mcu->client, MCU_REG_CTRL); | ||
139 | if (ret < 0) | ||
140 | goto err; | ||
141 | mcu->reg_ctrl = ret; | ||
142 | |||
143 | ret = mcu_gpiochip_add(mcu); | ||
144 | if (ret) | ||
145 | goto err; | ||
146 | |||
147 | /* XXX: this is potentially racy, but there is no lock for ppc_md */ | ||
148 | if (!ppc_md.power_off) { | ||
149 | glob_mcu = mcu; | ||
150 | ppc_md.power_off = mcu_power_off; | ||
151 | dev_info(&client->dev, "will provide power-off service\n"); | ||
152 | } | ||
153 | |||
154 | return 0; | ||
155 | err: | ||
156 | kfree(mcu); | ||
157 | return ret; | ||
158 | } | ||
159 | |||
160 | static int __devexit mcu_remove(struct i2c_client *client) | ||
161 | { | ||
162 | struct mcu *mcu = i2c_get_clientdata(client); | ||
163 | int ret; | ||
164 | |||
165 | if (glob_mcu == mcu) { | ||
166 | ppc_md.power_off = NULL; | ||
167 | glob_mcu = NULL; | ||
168 | } | ||
169 | |||
170 | ret = mcu_gpiochip_remove(mcu); | ||
171 | if (ret) | ||
172 | return ret; | ||
173 | i2c_set_clientdata(client, NULL); | ||
174 | kfree(mcu); | ||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static const struct i2c_device_id mcu_ids[] = { | ||
179 | { "mcu-mpc8349emitx", }, | ||
180 | {}, | ||
181 | }; | ||
182 | MODULE_DEVICE_TABLE(i2c, mcu_ids); | ||
183 | |||
184 | static struct i2c_driver mcu_driver = { | ||
185 | .driver = { | ||
186 | .name = "mcu-mpc8349emitx", | ||
187 | .owner = THIS_MODULE, | ||
188 | }, | ||
189 | .probe = mcu_probe, | ||
190 | .remove = __devexit_p(mcu_remove), | ||
191 | .id_table = mcu_ids, | ||
192 | }; | ||
193 | |||
194 | static int __init mcu_init(void) | ||
195 | { | ||
196 | return i2c_add_driver(&mcu_driver); | ||
197 | } | ||
198 | module_init(mcu_init); | ||
199 | |||
200 | static void __exit mcu_exit(void) | ||
201 | { | ||
202 | i2c_del_driver(&mcu_driver); | ||
203 | } | ||
204 | module_exit(mcu_exit); | ||
205 | |||
206 | MODULE_DESCRIPTION("Power Management and GPIO expander driver for " | ||
207 | "MPC8349E-mITX-compatible MCU"); | ||
208 | MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>"); | ||
209 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 3f9503867e6..b1c6f68d98c 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -701,11 +701,6 @@ config BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | |||
701 | depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX | 701 | depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX |
702 | endchoice | 702 | endchoice |
703 | 703 | ||
704 | config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ | ||
705 | int "Maximum transfer size (KB) per request (up to 128)" | ||
706 | default "128" | ||
707 | depends on BLK_DEV_IDE_AU1XXX | ||
708 | |||
709 | config BLK_DEV_IDE_TX4938 | 704 | config BLK_DEV_IDE_TX4938 |
710 | tristate "TX4938 internal IDE support" | 705 | tristate "TX4938 internal IDE support" |
711 | depends on SOC_TX4938 | 706 | depends on SOC_TX4938 |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 4088a622873..806760d24ce 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -633,7 +633,7 @@ static void ide_disk_setup(ide_drive_t *drive) | |||
633 | printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, | 633 | printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, |
634 | q->max_sectors / 2); | 634 | q->max_sectors / 2); |
635 | 635 | ||
636 | if (ata_id_is_ssd(id) || ata_id_is_cfa(id)) | 636 | if (ata_id_is_ssd(id)) |
637 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); | 637 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); |
638 | 638 | ||
639 | /* calculate drive capacity, and select LBA if possible */ | 639 | /* calculate drive capacity, and select LBA if possible */ |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index e728cfe7273..753b92ebe0a 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -493,7 +493,7 @@ static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long ti | |||
493 | stat = tp_ops->read_status(hwif); | 493 | stat = tp_ops->read_status(hwif); |
494 | 494 | ||
495 | if (stat & ATA_BUSY) { | 495 | if (stat & ATA_BUSY) { |
496 | local_irq_save(flags); | 496 | local_save_flags(flags); |
497 | local_irq_enable_in_hardirq(); | 497 | local_irq_enable_in_hardirq(); |
498 | timeout += jiffies; | 498 | timeout += jiffies; |
499 | while ((stat = tp_ops->read_status(hwif)) & ATA_BUSY) { | 499 | while ((stat = tp_ops->read_status(hwif)) & ATA_BUSY) { |
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index 4b3bf6a06b7..60538d9c84e 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c | |||
@@ -186,12 +186,10 @@ void ide_complete_pm_request(ide_drive_t *drive, struct request *rq) | |||
186 | blk_pm_suspend_request(rq) ? "suspend" : "resume"); | 186 | blk_pm_suspend_request(rq) ? "suspend" : "resume"); |
187 | #endif | 187 | #endif |
188 | spin_lock_irqsave(q->queue_lock, flags); | 188 | spin_lock_irqsave(q->queue_lock, flags); |
189 | if (blk_pm_suspend_request(rq)) { | 189 | if (blk_pm_suspend_request(rq)) |
190 | blk_stop_queue(q); | 190 | blk_stop_queue(q); |
191 | } else { | 191 | else |
192 | drive->dev_flags &= ~IDE_DFLAG_BLOCKED; | 192 | drive->dev_flags &= ~IDE_DFLAG_BLOCKED; |
193 | blk_start_queue(q); | ||
194 | } | ||
195 | spin_unlock_irqrestore(q->queue_lock, flags); | 193 | spin_unlock_irqrestore(q->queue_lock, flags); |
196 | 194 | ||
197 | drive->hwif->rq = NULL; | 195 | drive->hwif->rq = NULL; |
@@ -219,6 +217,8 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq) | |||
219 | * point. | 217 | * point. |
220 | */ | 218 | */ |
221 | ide_hwif_t *hwif = drive->hwif; | 219 | ide_hwif_t *hwif = drive->hwif; |
220 | struct request_queue *q = drive->queue; | ||
221 | unsigned long flags; | ||
222 | int rc; | 222 | int rc; |
223 | #ifdef DEBUG_PM | 223 | #ifdef DEBUG_PM |
224 | printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name); | 224 | printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name); |
@@ -231,5 +231,9 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq) | |||
231 | rc = ide_wait_not_busy(hwif, 100000); | 231 | rc = ide_wait_not_busy(hwif, 100000); |
232 | if (rc) | 232 | if (rc) |
233 | printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); | 233 | printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); |
234 | |||
235 | spin_lock_irqsave(q->queue_lock, flags); | ||
236 | blk_start_queue(q); | ||
237 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
234 | } | 238 | } |
235 | } | 239 | } |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 0ccbb4459fb..312127ea443 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -796,7 +796,7 @@ static int ide_probe_port(ide_hwif_t *hwif) | |||
796 | if (irqd) | 796 | if (irqd) |
797 | disable_irq(hwif->irq); | 797 | disable_irq(hwif->irq); |
798 | 798 | ||
799 | local_irq_save(flags); | 799 | local_save_flags(flags); |
800 | local_irq_enable_in_hardirq(); | 800 | local_irq_enable_in_hardirq(); |
801 | 801 | ||
802 | if (ide_port_wait_ready(hwif) == -EBUSY) | 802 | if (ide_port_wait_ready(hwif) == -EBUSY) |
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c index 0be27ac1f07..e1c4f543739 100644 --- a/drivers/ide/it821x.c +++ b/drivers/ide/it821x.c | |||
@@ -68,6 +68,8 @@ | |||
68 | 68 | ||
69 | #define DRV_NAME "it821x" | 69 | #define DRV_NAME "it821x" |
70 | 70 | ||
71 | #define QUIRK_VORTEX86 1 | ||
72 | |||
71 | struct it821x_dev | 73 | struct it821x_dev |
72 | { | 74 | { |
73 | unsigned int smart:1, /* Are we in smart raid mode */ | 75 | unsigned int smart:1, /* Are we in smart raid mode */ |
@@ -79,6 +81,7 @@ struct it821x_dev | |||
79 | u16 pio[2]; /* Cached PIO values */ | 81 | u16 pio[2]; /* Cached PIO values */ |
80 | u16 mwdma[2]; /* Cached MWDMA values */ | 82 | u16 mwdma[2]; /* Cached MWDMA values */ |
81 | u16 udma[2]; /* Cached UDMA values (per drive) */ | 83 | u16 udma[2]; /* Cached UDMA values (per drive) */ |
84 | u16 quirks; | ||
82 | }; | 85 | }; |
83 | 86 | ||
84 | #define ATA_66 0 | 87 | #define ATA_66 0 |
@@ -557,8 +560,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
557 | * this is necessary. | 560 | * this is necessary. |
558 | */ | 561 | */ |
559 | 562 | ||
560 | pci_read_config_byte(dev, 0x08, &conf); | 563 | if (dev->revision == 0x10) { |
561 | if (conf == 0x10) { | ||
562 | idev->timing10 = 1; | 564 | idev->timing10 = 1; |
563 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | 565 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; |
564 | if (idev->smart == 0) | 566 | if (idev->smart == 0) |
@@ -577,6 +579,12 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
577 | 579 | ||
578 | hwif->ultra_mask = ATA_UDMA6; | 580 | hwif->ultra_mask = ATA_UDMA6; |
579 | hwif->mwdma_mask = ATA_MWDMA2; | 581 | hwif->mwdma_mask = ATA_MWDMA2; |
582 | |||
583 | /* Vortex86SX quirk: prevent Ultra-DMA mode to fix BadCRC issue */ | ||
584 | if (idev->quirks & QUIRK_VORTEX86) { | ||
585 | if (dev->revision == 0x11) | ||
586 | hwif->ultra_mask = 0; | ||
587 | } | ||
580 | } | 588 | } |
581 | 589 | ||
582 | static void it8212_disable_raid(struct pci_dev *dev) | 590 | static void it8212_disable_raid(struct pci_dev *dev) |
@@ -649,6 +657,8 @@ static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_devic | |||
649 | return -ENOMEM; | 657 | return -ENOMEM; |
650 | } | 658 | } |
651 | 659 | ||
660 | itdevs->quirks = id->driver_data; | ||
661 | |||
652 | rc = ide_pci_init_one(dev, &it821x_chipset, itdevs); | 662 | rc = ide_pci_init_one(dev, &it821x_chipset, itdevs); |
653 | if (rc) | 663 | if (rc) |
654 | kfree(itdevs); | 664 | kfree(itdevs); |
@@ -668,6 +678,7 @@ static void __devexit it821x_remove(struct pci_dev *dev) | |||
668 | static const struct pci_device_id it821x_pci_tbl[] = { | 678 | static const struct pci_device_id it821x_pci_tbl[] = { |
669 | { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), 0 }, | 679 | { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), 0 }, |
670 | { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), 0 }, | 680 | { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), 0 }, |
681 | { PCI_VDEVICE(RDC, PCI_DEVICE_ID_RDC_D1010), QUIRK_VORTEX86 }, | ||
671 | { 0, }, | 682 | { 0, }, |
672 | }; | 683 | }; |
673 | 684 | ||
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c index 48cc748c504..6297956507c 100644 --- a/drivers/ide/sl82c105.c +++ b/drivers/ide/sl82c105.c | |||
@@ -310,10 +310,6 @@ static const struct ide_port_info sl82c105_chipset __devinitdata = { | |||
310 | .dma_ops = &sl82c105_dma_ops, | 310 | .dma_ops = &sl82c105_dma_ops, |
311 | .host_flags = IDE_HFLAG_IO_32BIT | | 311 | .host_flags = IDE_HFLAG_IO_32BIT | |
312 | IDE_HFLAG_UNMASK_IRQS | | 312 | IDE_HFLAG_UNMASK_IRQS | |
313 | /* FIXME: check for Compatibility mode in generic IDE PCI code */ | ||
314 | #if defined(CONFIG_LOPEC) || defined(CONFIG_SANDPOINT) | ||
315 | IDE_HFLAG_FORCE_LEGACY_IRQS | | ||
316 | #endif | ||
317 | IDE_HFLAG_SERIALIZE_DMA | | 313 | IDE_HFLAG_SERIALIZE_DMA | |
318 | IDE_HFLAG_NO_AUTODMA, | 314 | IDE_HFLAG_NO_AUTODMA, |
319 | .pio_mask = ATA_PIO5, | 315 | .pio_mask = ATA_PIO5, |
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c index b4ef218072c..d9095345f7c 100644 --- a/drivers/ide/tx4938ide.c +++ b/drivers/ide/tx4938ide.c | |||
@@ -202,7 +202,6 @@ static const struct ide_tp_ops tx4938ide_tp_ops = { | |||
202 | .exec_command = ide_exec_command, | 202 | .exec_command = ide_exec_command, |
203 | .read_status = ide_read_status, | 203 | .read_status = ide_read_status, |
204 | .read_altstatus = ide_read_altstatus, | 204 | .read_altstatus = ide_read_altstatus, |
205 | .read_sff_dma_status = ide_read_sff_dma_status, | ||
206 | 205 | ||
207 | .set_irq = ide_set_irq, | 206 | .set_irq = ide_set_irq, |
208 | 207 | ||
diff --git a/drivers/ide/via82cxxx.c b/drivers/ide/via82cxxx.c index fecc0e03c3f..703c3eeb20a 100644 --- a/drivers/ide/via82cxxx.c +++ b/drivers/ide/via82cxxx.c | |||
@@ -432,8 +432,6 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i | |||
432 | if (via_clock < 20000 || via_clock > 50000) { | 432 | if (via_clock < 20000 || via_clock > 50000) { |
433 | printk(KERN_WARNING DRV_NAME ": User given PCI clock speed " | 433 | printk(KERN_WARNING DRV_NAME ": User given PCI clock speed " |
434 | "impossible (%d), using 33 MHz instead.\n", via_clock); | 434 | "impossible (%d), using 33 MHz instead.\n", via_clock); |
435 | printk(KERN_WARNING DRV_NAME ": Use ide0=ata66 if you want " | ||
436 | "to assume 80-wire cable.\n"); | ||
437 | via_clock = 33333; | 435 | via_clock = 33333; |
438 | } | 436 | } |
439 | 437 | ||
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 7c5f97033b9..cb8943da4f1 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -292,7 +292,9 @@ isdn_net_unbind_channel(isdn_net_local * lp) | |||
292 | lp->dialstate = 0; | 292 | lp->dialstate = 0; |
293 | dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; | 293 | dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; |
294 | dev->st_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; | 294 | dev->st_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; |
295 | isdn_free_channel(lp->isdn_device, lp->isdn_channel, ISDN_USAGE_NET); | 295 | if (lp->isdn_device != -1 && lp->isdn_channel != -1) |
296 | isdn_free_channel(lp->isdn_device, lp->isdn_channel, | ||
297 | ISDN_USAGE_NET); | ||
296 | lp->flags &= ~ISDN_NET_CONNECTED; | 298 | lp->flags &= ~ISDN_NET_CONNECTED; |
297 | lp->isdn_device = -1; | 299 | lp->isdn_device = -1; |
298 | lp->isdn_channel = -1; | 300 | lp->isdn_channel = -1; |
@@ -2513,7 +2515,6 @@ static const struct net_device_ops isdn_netdev_ops = { | |||
2513 | .ndo_stop = isdn_net_close, | 2515 | .ndo_stop = isdn_net_close, |
2514 | .ndo_do_ioctl = isdn_net_ioctl, | 2516 | .ndo_do_ioctl = isdn_net_ioctl, |
2515 | 2517 | ||
2516 | .ndo_validate_addr = NULL, | ||
2517 | .ndo_start_xmit = isdn_net_start_xmit, | 2518 | .ndo_start_xmit = isdn_net_start_xmit, |
2518 | .ndo_get_stats = isdn_net_get_stats, | 2519 | .ndo_get_stats = isdn_net_get_stats, |
2519 | .ndo_tx_timeout = isdn_net_tx_timeout, | 2520 | .ndo_tx_timeout = isdn_net_tx_timeout, |
@@ -2528,12 +2529,8 @@ static void _isdn_setup(struct net_device *dev) | |||
2528 | 2529 | ||
2529 | ether_setup(dev); | 2530 | ether_setup(dev); |
2530 | 2531 | ||
2531 | dev->flags = IFF_NOARP | IFF_POINTOPOINT; | ||
2532 | /* Setup the generic properties */ | 2532 | /* Setup the generic properties */ |
2533 | dev->mtu = 1500; | ||
2534 | dev->flags = IFF_NOARP|IFF_POINTOPOINT; | 2533 | dev->flags = IFF_NOARP|IFF_POINTOPOINT; |
2535 | dev->type = ARPHRD_ETHER; | ||
2536 | dev->addr_len = ETH_ALEN; | ||
2537 | dev->header_ops = NULL; | 2534 | dev->header_ops = NULL; |
2538 | dev->netdev_ops = &isdn_netdev_ops; | 2535 | dev->netdev_ops = &isdn_netdev_ops; |
2539 | 2536 | ||
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index a4a1ae21463..742713611bc 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -119,13 +119,6 @@ config LEDS_GPIO | |||
119 | outputs. To be useful the particular board must have LEDs | 119 | outputs. To be useful the particular board must have LEDs |
120 | and they must be connected to the GPIO lines. | 120 | and they must be connected to the GPIO lines. |
121 | 121 | ||
122 | config LEDS_HP_DISK | ||
123 | tristate "LED Support for disk protection LED on HP notebooks" | ||
124 | depends on LEDS_CLASS && ACPI | ||
125 | help | ||
126 | This option enable support for disk protection LED, found on | ||
127 | newer HP notebooks. | ||
128 | |||
129 | config LEDS_CLEVO_MAIL | 122 | config LEDS_CLEVO_MAIL |
130 | tristate "Mail LED on Clevo notebook (EXPERIMENTAL)" | 123 | tristate "Mail LED on Clevo notebook (EXPERIMENTAL)" |
131 | depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI && EXPERIMENTAL | 124 | depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI && EXPERIMENTAL |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index bc247cb02e8..9d76f0f160a 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -23,7 +23,6 @@ obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o | |||
23 | obj-$(CONFIG_LEDS_FSG) += leds-fsg.o | 23 | obj-$(CONFIG_LEDS_FSG) += leds-fsg.o |
24 | obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o | 24 | obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o |
25 | obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o | 25 | obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o |
26 | obj-$(CONFIG_LEDS_HP_DISK) += leds-hp-disk.o | ||
27 | obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o | 26 | obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o |
28 | 27 | ||
29 | # LED Triggers | 28 | # LED Triggers |
diff --git a/drivers/leds/leds-hp-disk.c b/drivers/leds/leds-hp-disk.c deleted file mode 100644 index d786adc8c5e..00000000000 --- a/drivers/leds/leds-hp-disk.c +++ /dev/null | |||
@@ -1,137 +0,0 @@ | |||
1 | /* | ||
2 | * leds-hp-disk.c - driver for HP "hard disk protection" LED | ||
3 | * | ||
4 | * Copyright (C) 2008 Pavel Machek | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/dmi.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/input.h> | ||
29 | #include <linux/kthread.h> | ||
30 | #include <linux/leds.h> | ||
31 | #include <acpi/acpi_drivers.h> | ||
32 | |||
33 | #define DRIVER_NAME "leds-hp-disk" | ||
34 | #define ACPI_MDPS_CLASS "led" | ||
35 | |||
36 | /* For automatic insertion of the module */ | ||
37 | static struct acpi_device_id hpled_device_ids[] = { | ||
38 | {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */ | ||
39 | {"", 0}, | ||
40 | }; | ||
41 | MODULE_DEVICE_TABLE(acpi, hpled_device_ids); | ||
42 | |||
43 | struct acpi_hpled { | ||
44 | struct acpi_device *device; /* The ACPI device */ | ||
45 | }; | ||
46 | |||
47 | static struct acpi_hpled adev; | ||
48 | |||
49 | static acpi_status hpled_acpi_write(acpi_handle handle, int reg) | ||
50 | { | ||
51 | unsigned long long ret; /* Not used when writing */ | ||
52 | union acpi_object in_obj[1]; | ||
53 | struct acpi_object_list args = { 1, in_obj }; | ||
54 | |||
55 | in_obj[0].type = ACPI_TYPE_INTEGER; | ||
56 | in_obj[0].integer.value = reg; | ||
57 | |||
58 | return acpi_evaluate_integer(handle, "ALED", &args, &ret); | ||
59 | } | ||
60 | |||
61 | static void hpled_set(struct led_classdev *led_cdev, | ||
62 | enum led_brightness value) | ||
63 | { | ||
64 | hpled_acpi_write(adev.device->handle, !!value); | ||
65 | } | ||
66 | |||
67 | static struct led_classdev hpled_led = { | ||
68 | .name = "hp:red:hddprotection", | ||
69 | .default_trigger = "heartbeat", | ||
70 | .brightness_set = hpled_set, | ||
71 | .flags = LED_CORE_SUSPENDRESUME, | ||
72 | }; | ||
73 | |||
74 | static int hpled_add(struct acpi_device *device) | ||
75 | { | ||
76 | int ret; | ||
77 | |||
78 | if (!device) | ||
79 | return -EINVAL; | ||
80 | |||
81 | adev.device = device; | ||
82 | strcpy(acpi_device_name(device), DRIVER_NAME); | ||
83 | strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); | ||
84 | device->driver_data = &adev; | ||
85 | |||
86 | ret = led_classdev_register(NULL, &hpled_led); | ||
87 | return ret; | ||
88 | } | ||
89 | |||
90 | static int hpled_remove(struct acpi_device *device, int type) | ||
91 | { | ||
92 | if (!device) | ||
93 | return -EINVAL; | ||
94 | |||
95 | led_classdev_unregister(&hpled_led); | ||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | |||
100 | |||
101 | static struct acpi_driver leds_hp_driver = { | ||
102 | .name = DRIVER_NAME, | ||
103 | .class = ACPI_MDPS_CLASS, | ||
104 | .ids = hpled_device_ids, | ||
105 | .ops = { | ||
106 | .add = hpled_add, | ||
107 | .remove = hpled_remove, | ||
108 | } | ||
109 | }; | ||
110 | |||
111 | static int __init hpled_init_module(void) | ||
112 | { | ||
113 | int ret; | ||
114 | |||
115 | if (acpi_disabled) | ||
116 | return -ENODEV; | ||
117 | |||
118 | ret = acpi_bus_register_driver(&leds_hp_driver); | ||
119 | if (ret < 0) | ||
120 | return ret; | ||
121 | |||
122 | printk(KERN_INFO DRIVER_NAME " driver loaded.\n"); | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static void __exit hpled_exit_module(void) | ||
128 | { | ||
129 | acpi_bus_unregister_driver(&leds_hp_driver); | ||
130 | } | ||
131 | |||
132 | MODULE_DESCRIPTION("Driver for HP disk protection LED"); | ||
133 | MODULE_AUTHOR("Pavel Machek <pavel@suse.cz>"); | ||
134 | MODULE_LICENSE("GPL"); | ||
135 | |||
136 | module_init(hpled_init_module); | ||
137 | module_exit(hpled_exit_module); | ||
diff --git a/drivers/message/fusion/lsi/mpi.h b/drivers/message/fusion/lsi/mpi.h index 10b6ef75872..11c0f461320 100644 --- a/drivers/message/fusion/lsi/mpi.h +++ b/drivers/message/fusion/lsi/mpi.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Title: MPI Message independent structures and definitions | 6 | * Title: MPI Message independent structures and definitions |
7 | * Creation Date: July 27, 2000 | 7 | * Creation Date: July 27, 2000 |
8 | * | 8 | * |
9 | * mpi.h Version: 01.05.13 | 9 | * mpi.h Version: 01.05.16 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -79,6 +79,9 @@ | |||
79 | * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT. | 79 | * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT. |
80 | * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT. | 80 | * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT. |
81 | * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT. | 81 | * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT. |
82 | * 08-07-07 01.05.14 Bumped MPI_HEADER_VERSION_UNIT. | ||
83 | * 01-15-08 01.05.15 Bumped MPI_HEADER_VERSION_UNIT. | ||
84 | * 03-28-08 01.05.16 Bumped MPI_HEADER_VERSION_UNIT. | ||
82 | * -------------------------------------------------------------------------- | 85 | * -------------------------------------------------------------------------- |
83 | */ | 86 | */ |
84 | 87 | ||
@@ -109,7 +112,7 @@ | |||
109 | /* Note: The major versions of 0xe0 through 0xff are reserved */ | 112 | /* Note: The major versions of 0xe0 through 0xff are reserved */ |
110 | 113 | ||
111 | /* versioning for this MPI header set */ | 114 | /* versioning for this MPI header set */ |
112 | #define MPI_HEADER_VERSION_UNIT (0x10) | 115 | #define MPI_HEADER_VERSION_UNIT (0x13) |
113 | #define MPI_HEADER_VERSION_DEV (0x00) | 116 | #define MPI_HEADER_VERSION_DEV (0x00) |
114 | #define MPI_HEADER_VERSION_UNIT_MASK (0xFF00) | 117 | #define MPI_HEADER_VERSION_UNIT_MASK (0xFF00) |
115 | #define MPI_HEADER_VERSION_UNIT_SHIFT (8) | 118 | #define MPI_HEADER_VERSION_UNIT_SHIFT (8) |
diff --git a/drivers/message/fusion/lsi/mpi_cnfg.h b/drivers/message/fusion/lsi/mpi_cnfg.h index b2db3330c59..013c7d88194 100644 --- a/drivers/message/fusion/lsi/mpi_cnfg.h +++ b/drivers/message/fusion/lsi/mpi_cnfg.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Title: MPI Config message, structures, and Pages | 6 | * Title: MPI Config message, structures, and Pages |
7 | * Creation Date: July 27, 2000 | 7 | * Creation Date: July 27, 2000 |
8 | * | 8 | * |
9 | * mpi_cnfg.h Version: 01.05.15 | 9 | * mpi_cnfg.h Version: 01.05.18 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -308,6 +308,20 @@ | |||
308 | * Expander Page 0 Flags field. | 308 | * Expander Page 0 Flags field. |
309 | * Fixed define for | 309 | * Fixed define for |
310 | * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED. | 310 | * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED. |
311 | * 08-07-07 01.05.16 Added MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT | ||
312 | * define. | ||
313 | * Added BIOS Page 4 structure. | ||
314 | * Added MPI_RAID_PHYS_DISK1_PATH_MAX define for RAID | ||
315 | * Physcial Disk Page 1. | ||
316 | * 01-15-07 01.05.17 Added additional bit defines for ExtFlags field of | ||
317 | * Manufacturing Page 4. | ||
318 | * Added Solid State Drives Supported bit to IOC Page 6 | ||
319 | * Capabilities Flags. | ||
320 | * Added new value for AccessStatus field of SAS Device | ||
321 | * Page 0 (_SATA_NEEDS_INITIALIZATION). | ||
322 | * 03-28-08 01.05.18 Defined new bits in Manufacturing Page 4 ExtFlags field | ||
323 | * to control coercion size and the mixing of SAS and SATA | ||
324 | * SSD drives. | ||
311 | * -------------------------------------------------------------------------- | 325 | * -------------------------------------------------------------------------- |
312 | */ | 326 | */ |
313 | 327 | ||
@@ -686,6 +700,14 @@ typedef struct _CONFIG_PAGE_MANUFACTURING_4 | |||
686 | #define MPI_MANPAGE4_IR_NO_MIX_SAS_SATA (0x01) | 700 | #define MPI_MANPAGE4_IR_NO_MIX_SAS_SATA (0x01) |
687 | 701 | ||
688 | /* defines for the ExtFlags field */ | 702 | /* defines for the ExtFlags field */ |
703 | #define MPI_MANPAGE4_EXTFLAGS_MASK_COERCION_SIZE (0x0180) | ||
704 | #define MPI_MANPAGE4_EXTFLAGS_SHIFT_COERCION_SIZE (7) | ||
705 | #define MPI_MANPAGE4_EXTFLAGS_1GB_COERCION_SIZE (0) | ||
706 | #define MPI_MANPAGE4_EXTFLAGS_128MB_COERCION_SIZE (1) | ||
707 | |||
708 | #define MPI_MANPAGE4_EXTFLAGS_NO_MIX_SSD_SAS_SATA (0x0040) | ||
709 | #define MPI_MANPAGE4_EXTFLAGS_MIX_SSD_AND_NON_SSD (0x0020) | ||
710 | #define MPI_MANPAGE4_EXTFLAGS_DUAL_PORT_SUPPORT (0x0010) | ||
689 | #define MPI_MANPAGE4_EXTFLAGS_HIDE_NON_IR_METADATA (0x0008) | 711 | #define MPI_MANPAGE4_EXTFLAGS_HIDE_NON_IR_METADATA (0x0008) |
690 | #define MPI_MANPAGE4_EXTFLAGS_SAS_CACHE_DISABLE (0x0004) | 712 | #define MPI_MANPAGE4_EXTFLAGS_SAS_CACHE_DISABLE (0x0004) |
691 | #define MPI_MANPAGE4_EXTFLAGS_SATA_CACHE_DISABLE (0x0002) | 713 | #define MPI_MANPAGE4_EXTFLAGS_SATA_CACHE_DISABLE (0x0002) |
@@ -1159,6 +1181,8 @@ typedef struct _CONFIG_PAGE_IOC_6 | |||
1159 | 1181 | ||
1160 | /* IOC Page 6 Capabilities Flags */ | 1182 | /* IOC Page 6 Capabilities Flags */ |
1161 | 1183 | ||
1184 | #define MPI_IOCPAGE6_CAP_FLAGS_SSD_SUPPORT (0x00000020) | ||
1185 | #define MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT (0x00000010) | ||
1162 | #define MPI_IOCPAGE6_CAP_FLAGS_DISABLE_SMART_POLLING (0x00000008) | 1186 | #define MPI_IOCPAGE6_CAP_FLAGS_DISABLE_SMART_POLLING (0x00000008) |
1163 | 1187 | ||
1164 | #define MPI_IOCPAGE6_CAP_FLAGS_MASK_METADATA_SIZE (0x00000006) | 1188 | #define MPI_IOCPAGE6_CAP_FLAGS_MASK_METADATA_SIZE (0x00000006) |
@@ -1428,6 +1452,15 @@ typedef struct _CONFIG_PAGE_BIOS_2 | |||
1428 | #define MPI_BIOSPAGE2_FORM_SAS_WWN (0x05) | 1452 | #define MPI_BIOSPAGE2_FORM_SAS_WWN (0x05) |
1429 | #define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT (0x06) | 1453 | #define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT (0x06) |
1430 | 1454 | ||
1455 | typedef struct _CONFIG_PAGE_BIOS_4 | ||
1456 | { | ||
1457 | CONFIG_PAGE_HEADER Header; /* 00h */ | ||
1458 | U64 ReassignmentBaseWWID; /* 04h */ | ||
1459 | } CONFIG_PAGE_BIOS_4, MPI_POINTER PTR_CONFIG_PAGE_BIOS_4, | ||
1460 | BIOSPage4_t, MPI_POINTER pBIOSPage4_t; | ||
1461 | |||
1462 | #define MPI_BIOSPAGE4_PAGEVERSION (0x00) | ||
1463 | |||
1431 | 1464 | ||
1432 | /**************************************************************************** | 1465 | /**************************************************************************** |
1433 | * SCSI Port Config Pages | 1466 | * SCSI Port Config Pages |
@@ -2419,6 +2452,15 @@ typedef struct _RAID_PHYS_DISK1_PATH | |||
2419 | #define MPI_RAID_PHYSDISK1_FLAG_BROKEN (0x0002) | 2452 | #define MPI_RAID_PHYSDISK1_FLAG_BROKEN (0x0002) |
2420 | #define MPI_RAID_PHYSDISK1_FLAG_INVALID (0x0001) | 2453 | #define MPI_RAID_PHYSDISK1_FLAG_INVALID (0x0001) |
2421 | 2454 | ||
2455 | |||
2456 | /* | ||
2457 | * Host code (drivers, BIOS, utilities, etc.) should leave this define set to | ||
2458 | * one and check Header.PageLength or NumPhysDiskPaths at runtime. | ||
2459 | */ | ||
2460 | #ifndef MPI_RAID_PHYS_DISK1_PATH_MAX | ||
2461 | #define MPI_RAID_PHYS_DISK1_PATH_MAX (1) | ||
2462 | #endif | ||
2463 | |||
2422 | typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1 | 2464 | typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1 |
2423 | { | 2465 | { |
2424 | CONFIG_PAGE_HEADER Header; /* 00h */ | 2466 | CONFIG_PAGE_HEADER Header; /* 00h */ |
@@ -2426,7 +2468,7 @@ typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1 | |||
2426 | U8 PhysDiskNum; /* 05h */ | 2468 | U8 PhysDiskNum; /* 05h */ |
2427 | U16 Reserved2; /* 06h */ | 2469 | U16 Reserved2; /* 06h */ |
2428 | U32 Reserved1; /* 08h */ | 2470 | U32 Reserved1; /* 08h */ |
2429 | RAID_PHYS_DISK1_PATH Path[1]; /* 0Ch */ | 2471 | RAID_PHYS_DISK1_PATH Path[MPI_RAID_PHYS_DISK1_PATH_MAX];/* 0Ch */ |
2430 | } CONFIG_PAGE_RAID_PHYS_DISK_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_1, | 2472 | } CONFIG_PAGE_RAID_PHYS_DISK_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_1, |
2431 | RaidPhysDiskPage1_t, MPI_POINTER pRaidPhysDiskPage1_t; | 2473 | RaidPhysDiskPage1_t, MPI_POINTER pRaidPhysDiskPage1_t; |
2432 | 2474 | ||
@@ -2844,6 +2886,7 @@ typedef struct _CONFIG_PAGE_SAS_DEVICE_0 | |||
2844 | #define MPI_SAS_DEVICE0_ASTATUS_SATA_INIT_FAILED (0x01) | 2886 | #define MPI_SAS_DEVICE0_ASTATUS_SATA_INIT_FAILED (0x01) |
2845 | #define MPI_SAS_DEVICE0_ASTATUS_SATA_CAPABILITY_FAILED (0x02) | 2887 | #define MPI_SAS_DEVICE0_ASTATUS_SATA_CAPABILITY_FAILED (0x02) |
2846 | #define MPI_SAS_DEVICE0_ASTATUS_SATA_AFFILIATION_CONFLICT (0x03) | 2888 | #define MPI_SAS_DEVICE0_ASTATUS_SATA_AFFILIATION_CONFLICT (0x03) |
2889 | #define MPI_SAS_DEVICE0_ASTATUS_SATA_NEEDS_INITIALIZATION (0x04) | ||
2847 | /* specific values for SATA Init failures */ | 2890 | /* specific values for SATA Init failures */ |
2848 | #define MPI_SAS_DEVICE0_ASTATUS_SIF_UNKNOWN (0x10) | 2891 | #define MPI_SAS_DEVICE0_ASTATUS_SIF_UNKNOWN (0x10) |
2849 | #define MPI_SAS_DEVICE0_ASTATUS_SIF_AFFILIATION_CONFLICT (0x11) | 2892 | #define MPI_SAS_DEVICE0_ASTATUS_SIF_AFFILIATION_CONFLICT (0x11) |
diff --git a/drivers/message/fusion/lsi/mpi_fc.h b/drivers/message/fusion/lsi/mpi_fc.h index 627acfbb862..7d663ce76f8 100644 --- a/drivers/message/fusion/lsi/mpi_fc.h +++ b/drivers/message/fusion/lsi/mpi_fc.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2004 LSI Corporation. | 2 | * Copyright (c) 2000-2008 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi_fc.h | 5 | * Name: mpi_fc.h |
diff --git a/drivers/message/fusion/lsi/mpi_history.txt b/drivers/message/fusion/lsi/mpi_history.txt index 3f15fcfe4a2..693e4b51135 100644 --- a/drivers/message/fusion/lsi/mpi_history.txt +++ b/drivers/message/fusion/lsi/mpi_history.txt | |||
@@ -3,28 +3,28 @@ | |||
3 | MPI Header File Change History | 3 | MPI Header File Change History |
4 | ============================== | 4 | ============================== |
5 | 5 | ||
6 | Copyright (c) 2000-2007 LSI Corporation. | 6 | Copyright (c) 2000-2008 LSI Corporation. |
7 | 7 | ||
8 | --------------------------------------- | 8 | --------------------------------------- |
9 | Header Set Release Version: 01.05.16 | 9 | Header Set Release Version: 01.05.19 |
10 | Header Set Release Date: 05-24-07 | 10 | Header Set Release Date: 03-28-08 |
11 | --------------------------------------- | 11 | --------------------------------------- |
12 | 12 | ||
13 | Filename Current version Prior version | 13 | Filename Current version Prior version |
14 | ---------- --------------- ------------- | 14 | ---------- --------------- ------------- |
15 | mpi.h 01.05.13 01.05.12 | 15 | mpi.h 01.05.16 01.05.15 |
16 | mpi_ioc.h 01.05.14 01.05.13 | 16 | mpi_ioc.h 01.05.16 01.05.15 |
17 | mpi_cnfg.h 01.05.15 01.05.14 | 17 | mpi_cnfg.h 01.05.18 01.05.17 |
18 | mpi_init.h 01.05.09 01.05.09 | 18 | mpi_init.h 01.05.09 01.05.09 |
19 | mpi_targ.h 01.05.06 01.05.06 | 19 | mpi_targ.h 01.05.06 01.05.06 |
20 | mpi_fc.h 01.05.01 01.05.01 | 20 | mpi_fc.h 01.05.01 01.05.01 |
21 | mpi_lan.h 01.05.01 01.05.01 | 21 | mpi_lan.h 01.05.01 01.05.01 |
22 | mpi_raid.h 01.05.03 01.05.03 | 22 | mpi_raid.h 01.05.05 01.05.05 |
23 | mpi_tool.h 01.05.03 01.05.03 | 23 | mpi_tool.h 01.05.03 01.05.03 |
24 | mpi_inb.h 01.05.01 01.05.01 | 24 | mpi_inb.h 01.05.01 01.05.01 |
25 | mpi_sas.h 01.05.04 01.05.04 | 25 | mpi_sas.h 01.05.05 01.05.05 |
26 | mpi_type.h 01.05.02 01.05.02 | 26 | mpi_type.h 01.05.02 01.05.02 |
27 | mpi_history.txt 01.05.14 01.05.14 | 27 | mpi_history.txt 01.05.19 01.05.18 |
28 | 28 | ||
29 | 29 | ||
30 | * Date Version Description | 30 | * Date Version Description |
@@ -96,6 +96,9 @@ mpi.h | |||
96 | * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT. | 96 | * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT. |
97 | * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT. | 97 | * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT. |
98 | * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT. | 98 | * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT. |
99 | * 08-07-07 01.05.14 Bumped MPI_HEADER_VERSION_UNIT. | ||
100 | * 01-15-08 01.05.15 Bumped MPI_HEADER_VERSION_UNIT. | ||
101 | * 03-28-08 01.05.16 Bumped MPI_HEADER_VERSION_UNIT. | ||
99 | * -------------------------------------------------------------------------- | 102 | * -------------------------------------------------------------------------- |
100 | 103 | ||
101 | mpi_ioc.h | 104 | mpi_ioc.h |
@@ -127,7 +130,7 @@ mpi_ioc.h | |||
127 | * 08-08-01 01.02.01 Original release for v1.2 work. | 130 | * 08-08-01 01.02.01 Original release for v1.2 work. |
128 | * New format for FWVersion and ProductId in | 131 | * New format for FWVersion and ProductId in |
129 | * MSG_IOC_FACTS_REPLY and MPI_FW_HEADER. | 132 | * MSG_IOC_FACTS_REPLY and MPI_FW_HEADER. |
130 | * 08-31-01 01.02.02 Added event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and | 133 | * 08-31-01 01.02.02 Addded event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and |
131 | * related structure and defines. | 134 | * related structure and defines. |
132 | * Added event MPI_EVENT_ON_BUS_TIMER_EXPIRED. | 135 | * Added event MPI_EVENT_ON_BUS_TIMER_EXPIRED. |
133 | * Added MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE. | 136 | * Added MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE. |
@@ -187,7 +190,7 @@ mpi_ioc.h | |||
187 | * 10-11-06 01.05.12 Added MPI_IOCFACTS_EXCEPT_METADATA_UNSUPPORTED. | 190 | * 10-11-06 01.05.12 Added MPI_IOCFACTS_EXCEPT_METADATA_UNSUPPORTED. |
188 | * Added MaxInitiators field to PortFacts reply. | 191 | * Added MaxInitiators field to PortFacts reply. |
189 | * Added SAS Device Status Change ReasonCode for | 192 | * Added SAS Device Status Change ReasonCode for |
190 | * asynchronous notification. | 193 | * asynchronous notificaiton. |
191 | * Added MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE and event | 194 | * Added MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE and event |
192 | * data structure. | 195 | * data structure. |
193 | * Added new ImageType values for FWDownload and FWUpload | 196 | * Added new ImageType values for FWDownload and FWUpload |
@@ -199,6 +202,16 @@ mpi_ioc.h | |||
199 | * added _MULTI_PORT_DOMAIN. | 202 | * added _MULTI_PORT_DOMAIN. |
200 | * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request. | 203 | * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request. |
201 | * Added Common Boot Block type to FWUpload Request. | 204 | * Added Common Boot Block type to FWUpload Request. |
205 | * 08-07-07 01.05.15 Added MPI_EVENT_SAS_INIT_RC_REMOVED define. | ||
206 | * Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and | ||
207 | * MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data. | ||
208 | * Added SASAddress field to SAS Initiator Device Table | ||
209 | * Overflow event data structure. | ||
210 | * 03-28-08 01.05.16 Added two new ReasonCode values to SAS Device Status | ||
211 | * Change Event data to indicate completion of internally | ||
212 | * generated task management. | ||
213 | * Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define. | ||
214 | * Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define. | ||
202 | * -------------------------------------------------------------------------- | 215 | * -------------------------------------------------------------------------- |
203 | 216 | ||
204 | mpi_cnfg.h | 217 | mpi_cnfg.h |
@@ -213,7 +226,7 @@ mpi_cnfg.h | |||
213 | * Added _RESPONSE_ID_MASK definition to SCSI_PORT_1 | 226 | * Added _RESPONSE_ID_MASK definition to SCSI_PORT_1 |
214 | * page and updated the page version. | 227 | * page and updated the page version. |
215 | * Added Information field and _INFO_PARAMS_NEGOTIATED | 228 | * Added Information field and _INFO_PARAMS_NEGOTIATED |
216 | * definition to SCSI_DEVICE_0 page. | 229 | * definitionto SCSI_DEVICE_0 page. |
217 | * 06-22-00 01.00.03 Removed batch controls from LAN_0 page and updated the | 230 | * 06-22-00 01.00.03 Removed batch controls from LAN_0 page and updated the |
218 | * page version. | 231 | * page version. |
219 | * Added BucketsRemaining to LAN_1 page, redefined the | 232 | * Added BucketsRemaining to LAN_1 page, redefined the |
@@ -496,6 +509,20 @@ mpi_cnfg.h | |||
496 | * Expander Page 0 Flags field. | 509 | * Expander Page 0 Flags field. |
497 | * Fixed define for | 510 | * Fixed define for |
498 | * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED. | 511 | * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED. |
512 | * 08-07-07 01.05.16 Added MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT | ||
513 | * define. | ||
514 | * Added BIOS Page 4 structure. | ||
515 | * Added MPI_RAID_PHYS_DISK1_PATH_MAX define for RAID | ||
516 | * Physcial Disk Page 1. | ||
517 | * 01-15-07 01.05.17 Added additional bit defines for ExtFlags field of | ||
518 | * Manufacturing Page 4. | ||
519 | * Added Solid State Drives Supported bit to IOC Page 6 | ||
520 | * Capabilities Flags. | ||
521 | * Added new value for AccessStatus field of SAS Device | ||
522 | * Page 0 (_SATA_NEEDS_INITIALIZATION). | ||
523 | * 03-28-08 01.05.18 Defined new bits in Manufacturing Page 4 ExtFlags field | ||
524 | * to control coercion size and the mixing of SAS and SATA | ||
525 | * SSD drives. | ||
499 | * -------------------------------------------------------------------------- | 526 | * -------------------------------------------------------------------------- |
500 | 527 | ||
501 | mpi_init.h | 528 | mpi_init.h |
@@ -661,6 +688,9 @@ mpi_raid.h | |||
661 | * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE. | 688 | * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE. |
662 | * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and | 689 | * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and |
663 | * associated defines. | 690 | * associated defines. |
691 | * 08-07-07 01.05.04 Added Disable Full Rebuild bit to the ActionDataWord | ||
692 | * for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME. | ||
693 | * 01-15-08 01.05.05 Added define for MPI_RAID_ACTION_SET_VOLUME_NAME. | ||
664 | * -------------------------------------------------------------------------- | 694 | * -------------------------------------------------------------------------- |
665 | 695 | ||
666 | mpi_tool.h | 696 | mpi_tool.h |
@@ -694,6 +724,10 @@ mpi_sas.h | |||
694 | * reply. | 724 | * reply. |
695 | * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO | 725 | * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO |
696 | * Unit Control request. | 726 | * Unit Control request. |
727 | * 01-15-08 01.05.05 Added support for MPI_SAS_OP_SET_IOC_PARAMETER, | ||
728 | * including adding IOCParameter and IOCParameter value | ||
729 | * fields to SAS IO Unit Control Request. | ||
730 | * Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define. | ||
697 | * -------------------------------------------------------------------------- | 731 | * -------------------------------------------------------------------------- |
698 | 732 | ||
699 | mpi_type.h | 733 | mpi_type.h |
@@ -709,20 +743,20 @@ mpi_type.h | |||
709 | 743 | ||
710 | mpi_history.txt Parts list history | 744 | mpi_history.txt Parts list history |
711 | 745 | ||
712 | Filename 01.05.15 01.05.15 | 746 | Filename 01.05.19 01.05.18 01.05.17 01.05.16 01.05.15 |
713 | ---------- -------- -------- | 747 | ---------- -------- -------- -------- -------- -------- |
714 | mpi.h 01.05.12 01.05.13 | 748 | mpi.h 01.05.16 01.05.15 01.05.14 01.05.13 01.05.12 |
715 | mpi_ioc.h 01.05.13 01.05.14 | 749 | mpi_ioc.h 01.05.16 01.05.15 01.05.15 01.05.14 01.05.13 |
716 | mpi_cnfg.h 01.05.14 01.05.15 | 750 | mpi_cnfg.h 01.05.18 01.05.17 01.05.16 01.05.15 01.05.14 |
717 | mpi_init.h 01.05.09 01.05.09 | 751 | mpi_init.h 01.05.09 01.05.09 01.05.09 01.05.09 01.05.09 |
718 | mpi_targ.h 01.05.06 01.05.06 | 752 | mpi_targ.h 01.05.06 01.05.06 01.05.06 01.05.06 01.05.06 |
719 | mpi_fc.h 01.05.01 01.05.01 | 753 | mpi_fc.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01 |
720 | mpi_lan.h 01.05.01 01.05.01 | 754 | mpi_lan.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01 |
721 | mpi_raid.h 01.05.03 01.05.03 | 755 | mpi_raid.h 01.05.05 01.05.05 01.05.04 01.05.03 01.05.03 |
722 | mpi_tool.h 01.05.03 01.05.03 | 756 | mpi_tool.h 01.05.03 01.05.03 01.05.03 01.05.03 01.05.03 |
723 | mpi_inb.h 01.05.01 01.05.01 | 757 | mpi_inb.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01 |
724 | mpi_sas.h 01.05.04 01.05.04 | 758 | mpi_sas.h 01.05.05 01.05.05 01.05.04 01.05.04 01.05.04 |
725 | mpi_type.h 01.05.02 01.05.02 | 759 | mpi_type.h 01.05.02 01.05.02 01.05.02 01.05.02 01.05.02 |
726 | 760 | ||
727 | Filename 01.05.14 01.05.13 01.05.12 01.05.11 01.05.10 01.05.09 | 761 | Filename 01.05.14 01.05.13 01.05.12 01.05.11 01.05.10 01.05.09 |
728 | ---------- -------- -------- -------- -------- -------- -------- | 762 | ---------- -------- -------- -------- -------- -------- -------- |
diff --git a/drivers/message/fusion/lsi/mpi_init.h b/drivers/message/fusion/lsi/mpi_init.h index a9e3693601a..4295d062caa 100644 --- a/drivers/message/fusion/lsi/mpi_init.h +++ b/drivers/message/fusion/lsi/mpi_init.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2007 LSI Corporation. | 2 | * Copyright (c) 2000-2008 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi_init.h | 5 | * Name: mpi_init.h |
diff --git a/drivers/message/fusion/lsi/mpi_ioc.h b/drivers/message/fusion/lsi/mpi_ioc.h index 5cbb6bd048e..8faa4fab7b8 100644 --- a/drivers/message/fusion/lsi/mpi_ioc.h +++ b/drivers/message/fusion/lsi/mpi_ioc.h | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2007 LSI Corporation. | 2 | * Copyright (c) 2000-2008 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi_ioc.h | 5 | * Name: mpi_ioc.h |
6 | * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages | 6 | * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages |
7 | * Creation Date: August 11, 2000 | 7 | * Creation Date: August 11, 2000 |
8 | * | 8 | * |
9 | * mpi_ioc.h Version: 01.05.14 | 9 | * mpi_ioc.h Version: 01.05.16 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -113,6 +113,16 @@ | |||
113 | * added _MULTI_PORT_DOMAIN. | 113 | * added _MULTI_PORT_DOMAIN. |
114 | * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request. | 114 | * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request. |
115 | * Added Common Boot Block type to FWUpload Request. | 115 | * Added Common Boot Block type to FWUpload Request. |
116 | * 08-07-07 01.05.15 Added MPI_EVENT_SAS_INIT_RC_REMOVED define. | ||
117 | * Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and | ||
118 | * MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data. | ||
119 | * Added SASAddress field to SAS Initiator Device Table | ||
120 | * Overflow event data structure. | ||
121 | * 03-28-08 01.05.16 Added two new ReasonCode values to SAS Device Status | ||
122 | * Change Event data to indicate completion of internally | ||
123 | * generated task management. | ||
124 | * Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define. | ||
125 | * Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define. | ||
116 | * -------------------------------------------------------------------------- | 126 | * -------------------------------------------------------------------------- |
117 | */ | 127 | */ |
118 | 128 | ||
@@ -612,6 +622,8 @@ typedef struct _EVENT_DATA_SAS_DEVICE_STATUS_CHANGE | |||
612 | #define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL (0x0B) | 622 | #define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL (0x0B) |
613 | #define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL (0x0C) | 623 | #define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL (0x0C) |
614 | #define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION (0x0D) | 624 | #define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION (0x0D) |
625 | #define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET (0x0E) | ||
626 | #define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL (0x0F) | ||
615 | 627 | ||
616 | 628 | ||
617 | /* SCSI Event data for Queue Full event */ | 629 | /* SCSI Event data for Queue Full event */ |
@@ -708,6 +720,8 @@ typedef struct _MPI_EVENT_DATA_IR2 | |||
708 | #define MPI_EVENT_IR2_RC_PD_REMOVED (0x05) | 720 | #define MPI_EVENT_IR2_RC_PD_REMOVED (0x05) |
709 | #define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED (0x06) | 721 | #define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED (0x06) |
710 | #define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR (0x07) | 722 | #define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR (0x07) |
723 | #define MPI_EVENT_IR2_RC_DUAL_PORT_ADDED (0x08) | ||
724 | #define MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED (0x09) | ||
711 | 725 | ||
712 | /* defines for logical disk states */ | 726 | /* defines for logical disk states */ |
713 | #define MPI_LD_STATE_OPTIMAL (0x00) | 727 | #define MPI_LD_STATE_OPTIMAL (0x00) |
@@ -867,6 +881,7 @@ typedef struct _EVENT_DATA_DISCOVERY_ERROR | |||
867 | #define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE (0x00000800) | 881 | #define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE (0x00000800) |
868 | #define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS (0x00001000) | 882 | #define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS (0x00001000) |
869 | #define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN (0x00002000) | 883 | #define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN (0x00002000) |
884 | #define MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE (0x00004000) | ||
870 | 885 | ||
871 | /* SAS SMP Error Event data */ | 886 | /* SAS SMP Error Event data */ |
872 | 887 | ||
@@ -902,6 +917,8 @@ typedef struct _EVENT_DATA_SAS_INIT_DEV_STATUS_CHANGE | |||
902 | 917 | ||
903 | /* defines for the ReasonCode field of the SAS Initiator Device Status Change event */ | 918 | /* defines for the ReasonCode field of the SAS Initiator Device Status Change event */ |
904 | #define MPI_EVENT_SAS_INIT_RC_ADDED (0x01) | 919 | #define MPI_EVENT_SAS_INIT_RC_ADDED (0x01) |
920 | #define MPI_EVENT_SAS_INIT_RC_REMOVED (0x02) | ||
921 | #define MPI_EVENT_SAS_INIT_RC_INACCESSIBLE (0x03) | ||
905 | 922 | ||
906 | /* SAS Initiator Device Table Overflow Event data */ | 923 | /* SAS Initiator Device Table Overflow Event data */ |
907 | 924 | ||
@@ -910,6 +927,7 @@ typedef struct _EVENT_DATA_SAS_INIT_TABLE_OVERFLOW | |||
910 | U8 MaxInit; /* 00h */ | 927 | U8 MaxInit; /* 00h */ |
911 | U8 CurrentInit; /* 01h */ | 928 | U8 CurrentInit; /* 01h */ |
912 | U16 Reserved1; /* 02h */ | 929 | U16 Reserved1; /* 02h */ |
930 | U64 SASAddress; /* 04h */ | ||
913 | } EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, | 931 | } EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, |
914 | MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, | 932 | MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, |
915 | MpiEventDataSasInitTableOverflow_t, | 933 | MpiEventDataSasInitTableOverflow_t, |
diff --git a/drivers/message/fusion/lsi/mpi_lan.h b/drivers/message/fusion/lsi/mpi_lan.h index 03253b53b78..f41fcb69b35 100644 --- a/drivers/message/fusion/lsi/mpi_lan.h +++ b/drivers/message/fusion/lsi/mpi_lan.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2004 LSI Corporation. | 2 | * Copyright (c) 2000-2008 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi_lan.h | 5 | * Name: mpi_lan.h |
diff --git a/drivers/message/fusion/lsi/mpi_log_fc.h b/drivers/message/fusion/lsi/mpi_log_fc.h index e4dafcefeec..face6e7acc7 100644 --- a/drivers/message/fusion/lsi/mpi_log_fc.h +++ b/drivers/message/fusion/lsi/mpi_log_fc.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2001 LSI Corporation. All rights reserved. | 2 | * Copyright (c) 2000-2008 LSI Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * NAME: fc_log.h | 4 | * NAME: fc_log.h |
5 | * SUMMARY: MPI IocLogInfo definitions for the SYMFC9xx chips | 5 | * SUMMARY: MPI IocLogInfo definitions for the SYMFC9xx chips |
diff --git a/drivers/message/fusion/lsi/mpi_log_sas.h b/drivers/message/fusion/lsi/mpi_log_sas.h index af9da03e95e..691620dbedd 100644 --- a/drivers/message/fusion/lsi/mpi_log_sas.h +++ b/drivers/message/fusion/lsi/mpi_log_sas.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * Copyright 2003 LSI Corporation. All rights reserved. * | 3 | * Copyright (c) 2000-2008 LSI Corporation. All rights reserved. * |
4 | * * | 4 | * * |
5 | * Description * | 5 | * Description * |
6 | * ------------ * | 6 | * ------------ * |
@@ -73,6 +73,8 @@ | |||
73 | #define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO (0x00070004) | 73 | #define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO (0x00070004) |
74 | #define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO_REQ (0x00070005) | 74 | #define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO_REQ (0x00070005) |
75 | 75 | ||
76 | #define IOP_LOGINFO_CODE_LOG_TIMESTAMP_EVENT (0x00080000) | ||
77 | |||
76 | /****************************************************************************/ | 78 | /****************************************************************************/ |
77 | /* PL LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = PL */ | 79 | /* PL LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = PL */ |
78 | /****************************************************************************/ | 80 | /****************************************************************************/ |
@@ -92,7 +94,7 @@ | |||
92 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_OPEN_TIMEOUT_EXP (0x0000000C) | 94 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_OPEN_TIMEOUT_EXP (0x0000000C) |
93 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_UNUSED_0D (0x0000000D) | 95 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_UNUSED_0D (0x0000000D) |
94 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_DVTBLE_ACCSS_FAIL (0x0000000E) | 96 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_DVTBLE_ACCSS_FAIL (0x0000000E) |
95 | #define PL_LOGINFO_SUB CODE_OPEN_FAIL_BAD_DEST (0x00000011) | 97 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_BAD_DEST (0x00000011) |
96 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RATE_NOT_SUPP (0x00000012) | 98 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RATE_NOT_SUPP (0x00000012) |
97 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_PROT_NOT_SUPP (0x00000013) | 99 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_PROT_NOT_SUPP (0x00000013) |
98 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RESERVED_ABANDON0 (0x00000014) | 100 | #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RESERVED_ABANDON0 (0x00000014) |
@@ -159,10 +161,11 @@ | |||
159 | 161 | ||
160 | #define PL_LOGINFO_SUB_CODE_INVALID_SGL (0x00000200) | 162 | #define PL_LOGINFO_SUB_CODE_INVALID_SGL (0x00000200) |
161 | #define PL_LOGINFO_SUB_CODE_WRONG_REL_OFF_OR_FRAME_LENGTH (0x00000300) | 163 | #define PL_LOGINFO_SUB_CODE_WRONG_REL_OFF_OR_FRAME_LENGTH (0x00000300) |
162 | #define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400) /* Bits 0-3 encode Transport Status Register (offset 0x08) */ | 164 | #define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400) |
163 | /* Bit 0 is Status Bit 0: FrameXferErr */ | 165 | /* Bits 0-3 encode Transport Status Register (offset 0x08) */ |
164 | /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */ | 166 | /* Bit 0 is Status Bit 0: FrameXferErr */ |
165 | /* Bit 3 is Status Bit 18 WriteDataLengthGTDataLengthErr */ | 167 | /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */ |
168 | /* Bit 3 is Status Bit 18 WriteDataLenghtGTDataLengthErr */ | ||
166 | 169 | ||
167 | #define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500) | 170 | #define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500) |
168 | #define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600) | 171 | #define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600) |
@@ -177,6 +180,11 @@ | |||
177 | #define PL_LOGINFO_SUB_CODE_DISCOVERY_REMOTE_SEP_RESET (0x00000E01) | 180 | #define PL_LOGINFO_SUB_CODE_DISCOVERY_REMOTE_SEP_RESET (0x00000E01) |
178 | #define PL_LOGINFO_SUB_CODE_SECOND_OPEN (0x00000F00) | 181 | #define PL_LOGINFO_SUB_CODE_SECOND_OPEN (0x00000F00) |
179 | #define PL_LOGINFO_SUB_CODE_DSCVRY_SATA_INIT_TIMEOUT (0x00001000) | 182 | #define PL_LOGINFO_SUB_CODE_DSCVRY_SATA_INIT_TIMEOUT (0x00001000) |
183 | #define PL_LOGINFO_SUB_CODE_BREAK_ON_SATA_CONNECTION (0x00002000) | ||
184 | /* not currently used in mainline */ | ||
185 | #define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK (0x00003000) | ||
186 | #define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK_AIP (0x00004000) | ||
187 | #define PL_LOGINFO_SUB_CODE_BREAK_ON_INCOMPLETE_BREAK_RCVD (0x00005000) | ||
180 | 188 | ||
181 | #define PL_LOGINFO_CODE_ENCL_MGMT_SMP_FRAME_FAILURE (0x00200000) /* Can't get SMP Frame */ | 189 | #define PL_LOGINFO_CODE_ENCL_MGMT_SMP_FRAME_FAILURE (0x00200000) /* Can't get SMP Frame */ |
182 | #define PL_LOGINFO_CODE_ENCL_MGMT_SMP_READ_ERROR (0x00200010) /* Error occured on SMP Read */ | 190 | #define PL_LOGINFO_CODE_ENCL_MGMT_SMP_READ_ERROR (0x00200010) /* Error occured on SMP Read */ |
@@ -243,6 +251,8 @@ | |||
243 | #define IR_LOGINFO_VOLUME_ACTIVATE_VOLUME_FAILED (0x00010014) | 251 | #define IR_LOGINFO_VOLUME_ACTIVATE_VOLUME_FAILED (0x00010014) |
244 | /* Activation failed trying to import the volume */ | 252 | /* Activation failed trying to import the volume */ |
245 | #define IR_LOGINFO_VOLUME_ACTIVATING_IMPORT_VOLUME_FAILED (0x00010015) | 253 | #define IR_LOGINFO_VOLUME_ACTIVATING_IMPORT_VOLUME_FAILED (0x00010015) |
254 | /* Activation failed trying to import the volume */ | ||
255 | #define IR_LOGINFO_VOLUME_ACTIVATING_TOO_MANY_PHYS_DISKS (0x00010016) | ||
246 | 256 | ||
247 | /* Phys Disk failed, too many phys disks */ | 257 | /* Phys Disk failed, too many phys disks */ |
248 | #define IR_LOGINFO_PHYSDISK_CREATE_TOO_MANY_DISKS (0x00010020) | 258 | #define IR_LOGINFO_PHYSDISK_CREATE_TOO_MANY_DISKS (0x00010020) |
@@ -285,6 +295,21 @@ | |||
285 | /* Compatibility Error : IME size limited to < 2TB */ | 295 | /* Compatibility Error : IME size limited to < 2TB */ |
286 | #define IR_LOGINFO_COMPAT_ERROR_IME_VOL_NOT_CURRENTLY_SUPPORTED (0x0001003D) | 296 | #define IR_LOGINFO_COMPAT_ERROR_IME_VOL_NOT_CURRENTLY_SUPPORTED (0x0001003D) |
287 | 297 | ||
298 | /* Device Firmware Update: DFU can only be started once */ | ||
299 | #define IR_LOGINFO_DEV_FW_UPDATE_ERR_DFU_IN_PROGRESS (0x00010050) | ||
300 | /* Device Firmware Update: Volume must be Optimal/Active/non-Quiesced */ | ||
301 | #define IR_LOGINFO_DEV_FW_UPDATE_ERR_DEVICE_IN_INVALID_STATE (0x00010051) | ||
302 | /* Device Firmware Update: DFU Timeout cannot be zero */ | ||
303 | #define IR_LOGINFO_DEV_FW_UPDATE_ERR_INVALID_TIMEOUT (0x00010052) | ||
304 | /* Device Firmware Update: CREATE TIMER FAILED */ | ||
305 | #define IR_LOGINFO_DEV_FW_UPDATE_ERR_NO_TIMERS (0x00010053) | ||
306 | /* Device Firmware Update: Failed to read SAS_IO_UNIT_PG_1 */ | ||
307 | #define IR_LOGINFO_DEV_FW_UPDATE_ERR_READING_CFG_PAGE (0x00010054) | ||
308 | /* Device Firmware Update: Invalid SAS_IO_UNIT_PG_1 value(s) */ | ||
309 | #define IR_LOGINFO_DEV_FW_UPDATE_ERR_PORT_IO_TIMEOUTS_REQUIRED (0x00010055) | ||
310 | /* Device Firmware Update: Unable to allocate memory for page */ | ||
311 | #define IR_LOGINFO_DEV_FW_UPDATE_ERR_ALLOC_CFG_PAGE (0x00010056) | ||
312 | |||
288 | 313 | ||
289 | /****************************************************************************/ | 314 | /****************************************************************************/ |
290 | /* Defines for convenience */ | 315 | /* Defines for convenience */ |
diff --git a/drivers/message/fusion/lsi/mpi_raid.h b/drivers/message/fusion/lsi/mpi_raid.h index 2856108421d..add60cc85be 100644 --- a/drivers/message/fusion/lsi/mpi_raid.h +++ b/drivers/message/fusion/lsi/mpi_raid.h | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2001-2007 LSI Corporation. | 2 | * Copyright (c) 2001-2008 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi_raid.h | 5 | * Name: mpi_raid.h |
6 | * Title: MPI RAID message and structures | 6 | * Title: MPI RAID message and structures |
7 | * Creation Date: February 27, 2001 | 7 | * Creation Date: February 27, 2001 |
8 | * | 8 | * |
9 | * mpi_raid.h Version: 01.05.03 | 9 | * mpi_raid.h Version: 01.05.05 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -34,6 +34,9 @@ | |||
34 | * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE. | 34 | * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE. |
35 | * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and | 35 | * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and |
36 | * associated defines. | 36 | * associated defines. |
37 | * 08-07-07 01.05.04 Added Disable Full Rebuild bit to the ActionDataWord | ||
38 | * for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME. | ||
39 | * 01-15-08 01.05.05 Added define for MPI_RAID_ACTION_SET_VOLUME_NAME. | ||
37 | * -------------------------------------------------------------------------- | 40 | * -------------------------------------------------------------------------- |
38 | */ | 41 | */ |
39 | 42 | ||
@@ -93,6 +96,7 @@ typedef struct _MSG_RAID_ACTION | |||
93 | #define MPI_RAID_ACTION_SET_RESYNC_RATE (0x13) | 96 | #define MPI_RAID_ACTION_SET_RESYNC_RATE (0x13) |
94 | #define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE (0x14) | 97 | #define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE (0x14) |
95 | #define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE (0x15) | 98 | #define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE (0x15) |
99 | #define MPI_RAID_ACTION_SET_VOLUME_NAME (0x16) | ||
96 | 100 | ||
97 | /* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */ | 101 | /* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */ |
98 | #define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC (0x00000001) | 102 | #define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC (0x00000001) |
@@ -105,6 +109,9 @@ typedef struct _MSG_RAID_ACTION | |||
105 | #define MPI_RAID_ACTION_ADATA_KEEP_LBA0 (0x00000000) | 109 | #define MPI_RAID_ACTION_ADATA_KEEP_LBA0 (0x00000000) |
106 | #define MPI_RAID_ACTION_ADATA_ZERO_LBA0 (0x00000002) | 110 | #define MPI_RAID_ACTION_ADATA_ZERO_LBA0 (0x00000002) |
107 | 111 | ||
112 | /* ActionDataWord defines for use with MPI_RAID_ACTION_DISABLE_VOLUME action */ | ||
113 | #define MPI_RAID_ACTION_ADATA_DISABLE_FULL_REBUILD (0x00000001) | ||
114 | |||
108 | /* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */ | 115 | /* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */ |
109 | #define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL (0x00000001) | 116 | #define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL (0x00000001) |
110 | 117 | ||
diff --git a/drivers/message/fusion/lsi/mpi_sas.h b/drivers/message/fusion/lsi/mpi_sas.h index 33fca83cefc..ab410036bbf 100644 --- a/drivers/message/fusion/lsi/mpi_sas.h +++ b/drivers/message/fusion/lsi/mpi_sas.h | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2004-2006 LSI Corporation. | 2 | * Copyright (c) 2004-2008 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi_sas.h | 5 | * Name: mpi_sas.h |
6 | * Title: MPI Serial Attached SCSI structures and definitions | 6 | * Title: MPI Serial Attached SCSI structures and definitions |
7 | * Creation Date: August 19, 2004 | 7 | * Creation Date: August 19, 2004 |
8 | * | 8 | * |
9 | * mpi_sas.h Version: 01.05.04 | 9 | * mpi_sas.h Version: 01.05.05 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -23,6 +23,10 @@ | |||
23 | * reply. | 23 | * reply. |
24 | * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO | 24 | * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO |
25 | * Unit Control request. | 25 | * Unit Control request. |
26 | * 01-15-08 01.05.05 Added support for MPI_SAS_OP_SET_IOC_PARAMETER, | ||
27 | * including adding IOCParameter and IOCParameter value | ||
28 | * fields to SAS IO Unit Control Request. | ||
29 | * Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define. | ||
26 | * -------------------------------------------------------------------------- | 30 | * -------------------------------------------------------------------------- |
27 | */ | 31 | */ |
28 | 32 | ||
@@ -60,6 +64,8 @@ | |||
60 | * Values for the SAS DeviceInfo field used in SAS Device Status Change Event | 64 | * Values for the SAS DeviceInfo field used in SAS Device Status Change Event |
61 | * data and SAS IO Unit Configuration pages. | 65 | * data and SAS IO Unit Configuration pages. |
62 | */ | 66 | */ |
67 | #define MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC (0xF0000000) | ||
68 | |||
63 | #define MPI_SAS_DEVICE_INFO_SEP (0x00004000) | 69 | #define MPI_SAS_DEVICE_INFO_SEP (0x00004000) |
64 | #define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE (0x00002000) | 70 | #define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE (0x00002000) |
65 | #define MPI_SAS_DEVICE_INFO_LSI_DEVICE (0x00001000) | 71 | #define MPI_SAS_DEVICE_INFO_LSI_DEVICE (0x00001000) |
@@ -216,7 +222,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST | |||
216 | U8 ChainOffset; /* 02h */ | 222 | U8 ChainOffset; /* 02h */ |
217 | U8 Function; /* 03h */ | 223 | U8 Function; /* 03h */ |
218 | U16 DevHandle; /* 04h */ | 224 | U16 DevHandle; /* 04h */ |
219 | U8 Reserved3; /* 06h */ | 225 | U8 IOCParameter; /* 06h */ |
220 | U8 MsgFlags; /* 07h */ | 226 | U8 MsgFlags; /* 07h */ |
221 | U32 MsgContext; /* 08h */ | 227 | U32 MsgContext; /* 08h */ |
222 | U8 TargetID; /* 0Ch */ | 228 | U8 TargetID; /* 0Ch */ |
@@ -225,7 +231,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST | |||
225 | U8 PrimFlags; /* 0Fh */ | 231 | U8 PrimFlags; /* 0Fh */ |
226 | U32 Primitive; /* 10h */ | 232 | U32 Primitive; /* 10h */ |
227 | U64 SASAddress; /* 14h */ | 233 | U64 SASAddress; /* 14h */ |
228 | U32 Reserved4; /* 1Ch */ | 234 | U32 IOCParameterValue; /* 1Ch */ |
229 | } MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST, | 235 | } MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST, |
230 | SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t; | 236 | SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t; |
231 | 237 | ||
@@ -241,6 +247,8 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST | |||
241 | #define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C) | 247 | #define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C) |
242 | #define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE (0x0D) /* obsolete name */ | 248 | #define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE (0x0D) /* obsolete name */ |
243 | #define MPI_SAS_OP_REMOVE_DEVICE (0x0D) | 249 | #define MPI_SAS_OP_REMOVE_DEVICE (0x0D) |
250 | #define MPI_SAS_OP_SET_IOC_PARAMETER (0x0E) | ||
251 | #define MPI_SAS_OP_PRODUCT_SPECIFIC_MIN (0x80) | ||
244 | 252 | ||
245 | /* values for the PrimFlags field */ | 253 | /* values for the PrimFlags field */ |
246 | #define MPI_SAS_PRIMFLAGS_SINGLE (0x08) | 254 | #define MPI_SAS_PRIMFLAGS_SINGLE (0x08) |
@@ -256,7 +264,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REPLY | |||
256 | U8 MsgLength; /* 02h */ | 264 | U8 MsgLength; /* 02h */ |
257 | U8 Function; /* 03h */ | 265 | U8 Function; /* 03h */ |
258 | U16 DevHandle; /* 04h */ | 266 | U16 DevHandle; /* 04h */ |
259 | U8 Reserved3; /* 06h */ | 267 | U8 IOCParameter; /* 06h */ |
260 | U8 MsgFlags; /* 07h */ | 268 | U8 MsgFlags; /* 07h */ |
261 | U32 MsgContext; /* 08h */ | 269 | U32 MsgContext; /* 08h */ |
262 | U16 Reserved4; /* 0Ch */ | 270 | U16 Reserved4; /* 0Ch */ |
diff --git a/drivers/message/fusion/lsi/mpi_targ.h b/drivers/message/fusion/lsi/mpi_targ.h index ff8c37d3fdc..c3dea7f6909 100644 --- a/drivers/message/fusion/lsi/mpi_targ.h +++ b/drivers/message/fusion/lsi/mpi_targ.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2004 LSI Corporation. | 2 | * Copyright (c) 2000-2008 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi_targ.h | 5 | * Name: mpi_targ.h |
diff --git a/drivers/message/fusion/lsi/mpi_tool.h b/drivers/message/fusion/lsi/mpi_tool.h index 8834ae6ce0f..53cd715aa7e 100644 --- a/drivers/message/fusion/lsi/mpi_tool.h +++ b/drivers/message/fusion/lsi/mpi_tool.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2001-2005 LSI Corporation. | 2 | * Copyright (c) 2001-2008 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi_tool.h | 5 | * Name: mpi_tool.h |
diff --git a/drivers/message/fusion/lsi/mpi_type.h b/drivers/message/fusion/lsi/mpi_type.h index 08dad9c1e44..888b26dbc41 100644 --- a/drivers/message/fusion/lsi/mpi_type.h +++ b/drivers/message/fusion/lsi/mpi_type.h | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2004 LSI Corporation. | 2 | * Copyright (c) 2000-2008 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi_type.h | 5 | * Name: mpi_type.h |
6 | * Title: MPI Basic type definitions | 6 | * Title: MPI Basic type definitions |
7 | * Creation Date: June 6, 2000 | 7 | * Creation Date: June 6, 2000 |
8 | * | 8 | * |
9 | * mpi_type.h Version: 01.05.01 | 9 | * mpi_type.h Version: 01.05.02 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index c4e8b9aa382..96ac88317b8 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -79,9 +79,22 @@ MODULE_VERSION(my_VERSION); | |||
79 | /* | 79 | /* |
80 | * cmd line parameters | 80 | * cmd line parameters |
81 | */ | 81 | */ |
82 | static int mpt_msi_enable = -1; | 82 | |
83 | module_param(mpt_msi_enable, int, 0); | 83 | static int mpt_msi_enable_spi; |
84 | MODULE_PARM_DESC(mpt_msi_enable, " MSI Support Enable (default=0)"); | 84 | module_param(mpt_msi_enable_spi, int, 0); |
85 | MODULE_PARM_DESC(mpt_msi_enable_spi, " Enable MSI Support for SPI \ | ||
86 | controllers (default=0)"); | ||
87 | |||
88 | static int mpt_msi_enable_fc; | ||
89 | module_param(mpt_msi_enable_fc, int, 0); | ||
90 | MODULE_PARM_DESC(mpt_msi_enable_fc, " Enable MSI Support for FC \ | ||
91 | controllers (default=0)"); | ||
92 | |||
93 | static int mpt_msi_enable_sas; | ||
94 | module_param(mpt_msi_enable_sas, int, 1); | ||
95 | MODULE_PARM_DESC(mpt_msi_enable_sas, " Enable MSI Support for SAS \ | ||
96 | controllers (default=1)"); | ||
97 | |||
85 | 98 | ||
86 | static int mpt_channel_mapping; | 99 | static int mpt_channel_mapping; |
87 | module_param(mpt_channel_mapping, int, 0); | 100 | module_param(mpt_channel_mapping, int, 0); |
@@ -91,7 +104,17 @@ static int mpt_debug_level; | |||
91 | static int mpt_set_debug_level(const char *val, struct kernel_param *kp); | 104 | static int mpt_set_debug_level(const char *val, struct kernel_param *kp); |
92 | module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int, | 105 | module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int, |
93 | &mpt_debug_level, 0600); | 106 | &mpt_debug_level, 0600); |
94 | MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)"); | 107 | MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h \ |
108 | - (default=0)"); | ||
109 | |||
110 | int mpt_fwfault_debug; | ||
111 | EXPORT_SYMBOL(mpt_fwfault_debug); | ||
112 | module_param_call(mpt_fwfault_debug, param_set_int, param_get_int, | ||
113 | &mpt_fwfault_debug, 0600); | ||
114 | MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault" | ||
115 | " and halt Firmware on fault - (default=0)"); | ||
116 | |||
117 | |||
95 | 118 | ||
96 | #ifdef MFCNT | 119 | #ifdef MFCNT |
97 | static int mfcounter = 0; | 120 | static int mfcounter = 0; |
@@ -1751,16 +1774,25 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1751 | ioc->bus_type = SAS; | 1774 | ioc->bus_type = SAS; |
1752 | } | 1775 | } |
1753 | 1776 | ||
1754 | if (mpt_msi_enable == -1) { | ||
1755 | /* Enable on SAS, disable on FC and SPI */ | ||
1756 | if (ioc->bus_type == SAS) | ||
1757 | ioc->msi_enable = 1; | ||
1758 | else | ||
1759 | ioc->msi_enable = 0; | ||
1760 | } else | ||
1761 | /* follow flag: 0 - disable; 1 - enable */ | ||
1762 | ioc->msi_enable = mpt_msi_enable; | ||
1763 | 1777 | ||
1778 | switch (ioc->bus_type) { | ||
1779 | |||
1780 | case SAS: | ||
1781 | ioc->msi_enable = mpt_msi_enable_sas; | ||
1782 | break; | ||
1783 | |||
1784 | case SPI: | ||
1785 | ioc->msi_enable = mpt_msi_enable_spi; | ||
1786 | break; | ||
1787 | |||
1788 | case FC: | ||
1789 | ioc->msi_enable = mpt_msi_enable_fc; | ||
1790 | break; | ||
1791 | |||
1792 | default: | ||
1793 | ioc->msi_enable = 0; | ||
1794 | break; | ||
1795 | } | ||
1764 | if (ioc->errata_flag_1064) | 1796 | if (ioc->errata_flag_1064) |
1765 | pci_disable_io_access(pdev); | 1797 | pci_disable_io_access(pdev); |
1766 | 1798 | ||
@@ -6313,6 +6345,33 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh | |||
6313 | *size = y; | 6345 | *size = y; |
6314 | } | 6346 | } |
6315 | 6347 | ||
6348 | |||
6349 | /** | ||
6350 | * mpt_halt_firmware - Halts the firmware if it is operational and panic | ||
6351 | * the kernel | ||
6352 | * @ioc: Pointer to MPT_ADAPTER structure | ||
6353 | * | ||
6354 | **/ | ||
6355 | void | ||
6356 | mpt_halt_firmware(MPT_ADAPTER *ioc) | ||
6357 | { | ||
6358 | u32 ioc_raw_state; | ||
6359 | |||
6360 | ioc_raw_state = mpt_GetIocState(ioc, 0); | ||
6361 | |||
6362 | if ((ioc_raw_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_FAULT) { | ||
6363 | printk(MYIOC_s_ERR_FMT "IOC is in FAULT state (%04xh)!!!\n", | ||
6364 | ioc->name, ioc_raw_state & MPI_DOORBELL_DATA_MASK); | ||
6365 | panic("%s: IOC Fault (%04xh)!!!\n", ioc->name, | ||
6366 | ioc_raw_state & MPI_DOORBELL_DATA_MASK); | ||
6367 | } else { | ||
6368 | CHIPREG_WRITE32(&ioc->chip->Doorbell, 0xC0FFEE00); | ||
6369 | panic("%s: Firmware is halted due to command timeout\n", | ||
6370 | ioc->name); | ||
6371 | } | ||
6372 | } | ||
6373 | EXPORT_SYMBOL(mpt_halt_firmware); | ||
6374 | |||
6316 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6375 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
6317 | /* | 6376 | /* |
6318 | * Reset Handling | 6377 | * Reset Handling |
@@ -6345,6 +6404,8 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag) | |||
6345 | printk(MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name); | 6404 | printk(MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name); |
6346 | printk("MF count 0x%x !\n", ioc->mfcnt); | 6405 | printk("MF count 0x%x !\n", ioc->mfcnt); |
6347 | #endif | 6406 | #endif |
6407 | if (mpt_fwfault_debug) | ||
6408 | mpt_halt_firmware(ioc); | ||
6348 | 6409 | ||
6349 | /* Reset the adapter. Prevent more than 1 call to | 6410 | /* Reset the adapter. Prevent more than 1 call to |
6350 | * mpt_do_ioc_recovery at any instant in time. | 6411 | * mpt_do_ioc_recovery at any instant in time. |
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index dff048cfa10..b3e981d2a50 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h | |||
@@ -922,11 +922,14 @@ extern void mpt_free_fw_memory(MPT_ADAPTER *ioc); | |||
922 | extern int mpt_findImVolumes(MPT_ADAPTER *ioc); | 922 | extern int mpt_findImVolumes(MPT_ADAPTER *ioc); |
923 | extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); | 923 | extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); |
924 | extern int mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage0_t phys_disk); | 924 | extern int mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage0_t phys_disk); |
925 | extern void mpt_halt_firmware(MPT_ADAPTER *ioc); | ||
926 | |||
925 | 927 | ||
926 | /* | 928 | /* |
927 | * Public data decl's... | 929 | * Public data decl's... |
928 | */ | 930 | */ |
929 | extern struct list_head ioc_list; | 931 | extern struct list_head ioc_list; |
932 | extern int mpt_fwfault_debug; | ||
930 | 933 | ||
931 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 934 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
932 | #endif /* } __KERNEL__ */ | 935 | #endif /* } __KERNEL__ */ |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index ee090413e59..e62c6bc4ad3 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -1846,6 +1846,9 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) | |||
1846 | if (hd->timeouts < -1) | 1846 | if (hd->timeouts < -1) |
1847 | hd->timeouts++; | 1847 | hd->timeouts++; |
1848 | 1848 | ||
1849 | if (mpt_fwfault_debug) | ||
1850 | mpt_halt_firmware(ioc); | ||
1851 | |||
1849 | /* Most important! Set TaskMsgContext to SCpnt's MsgContext! | 1852 | /* Most important! Set TaskMsgContext to SCpnt's MsgContext! |
1850 | * (the IO to be ABORT'd) | 1853 | * (the IO to be ABORT'd) |
1851 | * | 1854 | * |
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 9cf8ae6e4b3..d5749a7bc77 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile | |||
@@ -10,7 +10,6 @@ obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o | |||
10 | obj-$(CONFIG_ICS932S401) += ics932s401.o | 10 | obj-$(CONFIG_ICS932S401) += ics932s401.o |
11 | obj-$(CONFIG_LKDTM) += lkdtm.o | 11 | obj-$(CONFIG_LKDTM) += lkdtm.o |
12 | obj-$(CONFIG_TIFM_CORE) += tifm_core.o | 12 | obj-$(CONFIG_TIFM_CORE) += tifm_core.o |
13 | obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o | ||
14 | obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o | 13 | obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o |
15 | obj-$(CONFIG_PHANTOM) += phantom.o | 14 | obj-$(CONFIG_PHANTOM) += phantom.o |
16 | obj-$(CONFIG_SGI_IOC4) += ioc4.o | 15 | obj-$(CONFIG_SGI_IOC4) += ioc4.o |
diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c index 73b7fb8de47..82fb9958f22 100644 --- a/drivers/misc/sgi-xp/xpc_sn2.c +++ b/drivers/misc/sgi-xp/xpc_sn2.c | |||
@@ -899,7 +899,7 @@ xpc_update_partition_info_sn2(struct xpc_partition *part, u8 remote_rp_version, | |||
899 | dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n", | 899 | dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n", |
900 | part_sn2->remote_vars_pa); | 900 | part_sn2->remote_vars_pa); |
901 | 901 | ||
902 | part->last_heartbeat = remote_vars->heartbeat; | 902 | part->last_heartbeat = remote_vars->heartbeat - 1; |
903 | dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n", | 903 | dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n", |
904 | part->last_heartbeat); | 904 | part->last_heartbeat); |
905 | 905 | ||
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c index 745ac188bab..d15d8b79d8e 100644 --- a/drivers/net/arm/etherh.c +++ b/drivers/net/arm/etherh.c | |||
@@ -646,7 +646,7 @@ static const struct net_device_ops etherh_netdev_ops = { | |||
646 | .ndo_get_stats = ei_get_stats, | 646 | .ndo_get_stats = ei_get_stats, |
647 | .ndo_set_multicast_list = ei_set_multicast_list, | 647 | .ndo_set_multicast_list = ei_set_multicast_list, |
648 | .ndo_validate_addr = eth_validate_addr, | 648 | .ndo_validate_addr = eth_validate_addr, |
649 | .ndo_set_mac_addr = eth_set_mac_addr, | 649 | .ndo_set_mac_address = eth_set_mac_addr, |
650 | .ndo_change_mtu = eth_change_mtu, | 650 | .ndo_change_mtu = eth_change_mtu, |
651 | #ifdef CONFIG_NET_POLL_CONTROLLER | 651 | #ifdef CONFIG_NET_POLL_CONTROLLER |
652 | .ndo_poll_controller = ei_poll, | 652 | .ndo_poll_controller = ei_poll, |
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c index 337488ec707..a4eb6c40678 100644 --- a/drivers/net/ax88796.c +++ b/drivers/net/ax88796.c | |||
@@ -37,7 +37,10 @@ static int phy_debug = 0; | |||
37 | #define __ei_open ax_ei_open | 37 | #define __ei_open ax_ei_open |
38 | #define __ei_close ax_ei_close | 38 | #define __ei_close ax_ei_close |
39 | #define __ei_poll ax_ei_poll | 39 | #define __ei_poll ax_ei_poll |
40 | #define __ei_start_xmit ax_ei_start_xmit | ||
40 | #define __ei_tx_timeout ax_ei_tx_timeout | 41 | #define __ei_tx_timeout ax_ei_tx_timeout |
42 | #define __ei_get_stats ax_ei_get_stats | ||
43 | #define __ei_set_multicast_list ax_ei_set_multicast_list | ||
41 | #define __ei_interrupt ax_ei_interrupt | 44 | #define __ei_interrupt ax_ei_interrupt |
42 | #define ____alloc_ei_netdev ax__alloc_ei_netdev | 45 | #define ____alloc_ei_netdev ax__alloc_ei_netdev |
43 | #define __NS8390_init ax_NS8390_init | 46 | #define __NS8390_init ax_NS8390_init |
@@ -623,6 +626,23 @@ static void ax_eeprom_register_write(struct eeprom_93cx6 *eeprom) | |||
623 | } | 626 | } |
624 | #endif | 627 | #endif |
625 | 628 | ||
629 | static const struct net_device_ops ax_netdev_ops = { | ||
630 | .ndo_open = ax_open, | ||
631 | .ndo_stop = ax_close, | ||
632 | .ndo_do_ioctl = ax_ioctl, | ||
633 | |||
634 | .ndo_start_xmit = ax_ei_start_xmit, | ||
635 | .ndo_tx_timeout = ax_ei_tx_timeout, | ||
636 | .ndo_get_stats = ax_ei_get_stats, | ||
637 | .ndo_set_multicast_list = ax_ei_set_multicast_list, | ||
638 | .ndo_validate_addr = eth_validate_addr, | ||
639 | .ndo_set_mac_address = eth_mac_addr, | ||
640 | .ndo_change_mtu = eth_change_mtu, | ||
641 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
642 | .ndo_poll_controller = ax_ei_poll, | ||
643 | #endif | ||
644 | }; | ||
645 | |||
626 | /* setup code */ | 646 | /* setup code */ |
627 | 647 | ||
628 | static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) | 648 | static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) |
@@ -738,9 +758,7 @@ static int ax_init_dev(struct net_device *dev, int first_init) | |||
738 | ei_status.get_8390_hdr = &ax_get_8390_hdr; | 758 | ei_status.get_8390_hdr = &ax_get_8390_hdr; |
739 | ei_status.priv = 0; | 759 | ei_status.priv = 0; |
740 | 760 | ||
741 | dev->open = ax_open; | 761 | dev->netdev_ops = &ax_netdev_ops; |
742 | dev->stop = ax_close; | ||
743 | dev->do_ioctl = ax_ioctl; | ||
744 | dev->ethtool_ops = &ax_ethtool_ops; | 762 | dev->ethtool_ops = &ax_ethtool_ops; |
745 | 763 | ||
746 | ax->msg_enable = NETIF_MSG_LINK; | 764 | ax->msg_enable = NETIF_MSG_LINK; |
@@ -753,9 +771,6 @@ static int ax_init_dev(struct net_device *dev, int first_init) | |||
753 | ax->mii.mdio_write = ax_phy_write; | 771 | ax->mii.mdio_write = ax_phy_write; |
754 | ax->mii.dev = dev; | 772 | ax->mii.dev = dev; |
755 | 773 | ||
756 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
757 | dev->poll_controller = ax_ei_poll; | ||
758 | #endif | ||
759 | ax_NS8390_init(dev, 0); | 774 | ax_NS8390_init(dev, 0); |
760 | 775 | ||
761 | if (first_init) | 776 | if (first_init) |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 5ae131c147f..c38512ebcea 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -679,6 +679,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
679 | dev_kfree_skb_any(skb); | 679 | dev_kfree_skb_any(skb); |
680 | return -ENOMEM; | 680 | return -ENOMEM; |
681 | } | 681 | } |
682 | bp->force_copybreak = 1; | ||
682 | } | 683 | } |
683 | 684 | ||
684 | rh = (struct rx_header *) skb->data; | 685 | rh = (struct rx_header *) skb->data; |
@@ -800,7 +801,7 @@ static int b44_rx(struct b44 *bp, int budget) | |||
800 | /* Omit CRC. */ | 801 | /* Omit CRC. */ |
801 | len -= 4; | 802 | len -= 4; |
802 | 803 | ||
803 | if (len > RX_COPY_THRESHOLD) { | 804 | if (!bp->force_copybreak && len > RX_COPY_THRESHOLD) { |
804 | int skb_size; | 805 | int skb_size; |
805 | skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod); | 806 | skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod); |
806 | if (skb_size < 0) | 807 | if (skb_size < 0) |
@@ -2152,6 +2153,7 @@ static int __devinit b44_init_one(struct ssb_device *sdev, | |||
2152 | bp = netdev_priv(dev); | 2153 | bp = netdev_priv(dev); |
2153 | bp->sdev = sdev; | 2154 | bp->sdev = sdev; |
2154 | bp->dev = dev; | 2155 | bp->dev = dev; |
2156 | bp->force_copybreak = 0; | ||
2155 | 2157 | ||
2156 | bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE); | 2158 | bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE); |
2157 | 2159 | ||
diff --git a/drivers/net/b44.h b/drivers/net/b44.h index 7db0c84a795..e678498de6d 100644 --- a/drivers/net/b44.h +++ b/drivers/net/b44.h | |||
@@ -395,7 +395,7 @@ struct b44 { | |||
395 | u32 rx_pending; | 395 | u32 rx_pending; |
396 | u32 tx_pending; | 396 | u32 tx_pending; |
397 | u8 phy_addr; | 397 | u8 phy_addr; |
398 | 398 | u8 force_copybreak; | |
399 | struct mii_if_info mii_if; | 399 | struct mii_if_info mii_if; |
400 | }; | 400 | }; |
401 | 401 | ||
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h index fd705d1295a..6fcccef4cf3 100644 --- a/drivers/net/bnx2x.h +++ b/drivers/net/bnx2x.h | |||
@@ -20,6 +20,11 @@ | |||
20 | * (you will need to reboot afterwards) */ | 20 | * (you will need to reboot afterwards) */ |
21 | /* #define BNX2X_STOP_ON_ERROR */ | 21 | /* #define BNX2X_STOP_ON_ERROR */ |
22 | 22 | ||
23 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | ||
24 | #define BCM_VLAN 1 | ||
25 | #endif | ||
26 | |||
27 | |||
23 | /* error/debug prints */ | 28 | /* error/debug prints */ |
24 | 29 | ||
25 | #define DRV_MODULE_NAME "bnx2x" | 30 | #define DRV_MODULE_NAME "bnx2x" |
@@ -78,11 +83,6 @@ | |||
78 | #endif | 83 | #endif |
79 | 84 | ||
80 | 85 | ||
81 | #ifdef NETIF_F_HW_VLAN_TX | ||
82 | #define BCM_VLAN 1 | ||
83 | #endif | ||
84 | |||
85 | |||
86 | #define U64_LO(x) (u32)(((u64)(x)) & 0xffffffff) | 86 | #define U64_LO(x) (u32)(((u64)(x)) & 0xffffffff) |
87 | #define U64_HI(x) (u32)(((u64)(x)) >> 32) | 87 | #define U64_HI(x) (u32)(((u64)(x)) >> 32) |
88 | #define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo)) | 88 | #define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo)) |
@@ -150,6 +150,9 @@ struct sw_rx_page { | |||
150 | 150 | ||
151 | #define PAGES_PER_SGE_SHIFT 0 | 151 | #define PAGES_PER_SGE_SHIFT 0 |
152 | #define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT) | 152 | #define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT) |
153 | #define SGE_PAGE_SIZE PAGE_SIZE | ||
154 | #define SGE_PAGE_SHIFT PAGE_SHIFT | ||
155 | #define SGE_PAGE_ALIGN(addr) PAGE_ALIGN(addr) | ||
153 | 156 | ||
154 | #define BCM_RX_ETH_PAYLOAD_ALIGN 64 | 157 | #define BCM_RX_ETH_PAYLOAD_ALIGN 64 |
155 | 158 | ||
@@ -736,7 +739,7 @@ struct bnx2x { | |||
736 | struct bnx2x_fastpath fp[MAX_CONTEXT]; | 739 | struct bnx2x_fastpath fp[MAX_CONTEXT]; |
737 | void __iomem *regview; | 740 | void __iomem *regview; |
738 | void __iomem *doorbells; | 741 | void __iomem *doorbells; |
739 | #define BNX2X_DB_SIZE (16*2048) | 742 | #define BNX2X_DB_SIZE (16*BCM_PAGE_SIZE) |
740 | 743 | ||
741 | struct net_device *dev; | 744 | struct net_device *dev; |
742 | struct pci_dev *pdev; | 745 | struct pci_dev *pdev; |
@@ -801,6 +804,8 @@ struct bnx2x { | |||
801 | #define TPA_ENABLE_FLAG 0x80 | 804 | #define TPA_ENABLE_FLAG 0x80 |
802 | #define NO_MCP_FLAG 0x100 | 805 | #define NO_MCP_FLAG 0x100 |
803 | #define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG) | 806 | #define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG) |
807 | #define HW_VLAN_TX_FLAG 0x400 | ||
808 | #define HW_VLAN_RX_FLAG 0x800 | ||
804 | 809 | ||
805 | int func; | 810 | int func; |
806 | #define BP_PORT(bp) (bp->func % PORT_MAX) | 811 | #define BP_PORT(bp) (bp->func % PORT_MAX) |
@@ -811,7 +816,7 @@ struct bnx2x { | |||
811 | int pm_cap; | 816 | int pm_cap; |
812 | int pcie_cap; | 817 | int pcie_cap; |
813 | 818 | ||
814 | struct work_struct sp_task; | 819 | struct delayed_work sp_task; |
815 | struct work_struct reset_task; | 820 | struct work_struct reset_task; |
816 | 821 | ||
817 | struct timer_list timer; | 822 | struct timer_list timer; |
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 4be05847f86..7c533797c06 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -38,9 +38,7 @@ | |||
38 | #include <linux/time.h> | 38 | #include <linux/time.h> |
39 | #include <linux/ethtool.h> | 39 | #include <linux/ethtool.h> |
40 | #include <linux/mii.h> | 40 | #include <linux/mii.h> |
41 | #ifdef NETIF_F_HW_VLAN_TX | 41 | #include <linux/if_vlan.h> |
42 | #include <linux/if_vlan.h> | ||
43 | #endif | ||
44 | #include <net/ip.h> | 42 | #include <net/ip.h> |
45 | #include <net/tcp.h> | 43 | #include <net/tcp.h> |
46 | #include <net/checksum.h> | 44 | #include <net/checksum.h> |
@@ -95,6 +93,7 @@ MODULE_PARM_DESC(debug, "default debug msglevel"); | |||
95 | module_param(use_multi, int, 0); | 93 | module_param(use_multi, int, 0); |
96 | MODULE_PARM_DESC(use_multi, "use per-CPU queues"); | 94 | MODULE_PARM_DESC(use_multi, "use per-CPU queues"); |
97 | #endif | 95 | #endif |
96 | static struct workqueue_struct *bnx2x_wq; | ||
98 | 97 | ||
99 | enum bnx2x_board_type { | 98 | enum bnx2x_board_type { |
100 | BCM57710 = 0, | 99 | BCM57710 = 0, |
@@ -671,7 +670,8 @@ static void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw) | |||
671 | synchronize_irq(bp->pdev->irq); | 670 | synchronize_irq(bp->pdev->irq); |
672 | 671 | ||
673 | /* make sure sp_task is not running */ | 672 | /* make sure sp_task is not running */ |
674 | cancel_work_sync(&bp->sp_task); | 673 | cancel_delayed_work(&bp->sp_task); |
674 | flush_workqueue(bnx2x_wq); | ||
675 | } | 675 | } |
676 | 676 | ||
677 | /* fast path */ | 677 | /* fast path */ |
@@ -972,7 +972,7 @@ static inline void bnx2x_free_rx_sge(struct bnx2x *bp, | |||
972 | return; | 972 | return; |
973 | 973 | ||
974 | pci_unmap_page(bp->pdev, pci_unmap_addr(sw_buf, mapping), | 974 | pci_unmap_page(bp->pdev, pci_unmap_addr(sw_buf, mapping), |
975 | BCM_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); | 975 | SGE_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); |
976 | __free_pages(page, PAGES_PER_SGE_SHIFT); | 976 | __free_pages(page, PAGES_PER_SGE_SHIFT); |
977 | 977 | ||
978 | sw_buf->page = NULL; | 978 | sw_buf->page = NULL; |
@@ -1000,7 +1000,7 @@ static inline int bnx2x_alloc_rx_sge(struct bnx2x *bp, | |||
1000 | if (unlikely(page == NULL)) | 1000 | if (unlikely(page == NULL)) |
1001 | return -ENOMEM; | 1001 | return -ENOMEM; |
1002 | 1002 | ||
1003 | mapping = pci_map_page(bp->pdev, page, 0, BCM_PAGE_SIZE*PAGES_PER_SGE, | 1003 | mapping = pci_map_page(bp->pdev, page, 0, SGE_PAGE_SIZE*PAGES_PER_SGE, |
1004 | PCI_DMA_FROMDEVICE); | 1004 | PCI_DMA_FROMDEVICE); |
1005 | if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { | 1005 | if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { |
1006 | __free_pages(page, PAGES_PER_SGE_SHIFT); | 1006 | __free_pages(page, PAGES_PER_SGE_SHIFT); |
@@ -1096,9 +1096,9 @@ static void bnx2x_update_sge_prod(struct bnx2x_fastpath *fp, | |||
1096 | struct eth_fast_path_rx_cqe *fp_cqe) | 1096 | struct eth_fast_path_rx_cqe *fp_cqe) |
1097 | { | 1097 | { |
1098 | struct bnx2x *bp = fp->bp; | 1098 | struct bnx2x *bp = fp->bp; |
1099 | u16 sge_len = BCM_PAGE_ALIGN(le16_to_cpu(fp_cqe->pkt_len) - | 1099 | u16 sge_len = SGE_PAGE_ALIGN(le16_to_cpu(fp_cqe->pkt_len) - |
1100 | le16_to_cpu(fp_cqe->len_on_bd)) >> | 1100 | le16_to_cpu(fp_cqe->len_on_bd)) >> |
1101 | BCM_PAGE_SHIFT; | 1101 | SGE_PAGE_SHIFT; |
1102 | u16 last_max, last_elem, first_elem; | 1102 | u16 last_max, last_elem, first_elem; |
1103 | u16 delta = 0; | 1103 | u16 delta = 0; |
1104 | u16 i; | 1104 | u16 i; |
@@ -1203,22 +1203,22 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
1203 | u16 cqe_idx) | 1203 | u16 cqe_idx) |
1204 | { | 1204 | { |
1205 | struct sw_rx_page *rx_pg, old_rx_pg; | 1205 | struct sw_rx_page *rx_pg, old_rx_pg; |
1206 | struct page *sge; | ||
1207 | u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd); | 1206 | u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd); |
1208 | u32 i, frag_len, frag_size, pages; | 1207 | u32 i, frag_len, frag_size, pages; |
1209 | int err; | 1208 | int err; |
1210 | int j; | 1209 | int j; |
1211 | 1210 | ||
1212 | frag_size = le16_to_cpu(fp_cqe->pkt_len) - len_on_bd; | 1211 | frag_size = le16_to_cpu(fp_cqe->pkt_len) - len_on_bd; |
1213 | pages = BCM_PAGE_ALIGN(frag_size) >> BCM_PAGE_SHIFT; | 1212 | pages = SGE_PAGE_ALIGN(frag_size) >> SGE_PAGE_SHIFT; |
1214 | 1213 | ||
1215 | /* This is needed in order to enable forwarding support */ | 1214 | /* This is needed in order to enable forwarding support */ |
1216 | if (frag_size) | 1215 | if (frag_size) |
1217 | skb_shinfo(skb)->gso_size = min((u32)BCM_PAGE_SIZE, | 1216 | skb_shinfo(skb)->gso_size = min((u32)SGE_PAGE_SIZE, |
1218 | max(frag_size, (u32)len_on_bd)); | 1217 | max(frag_size, (u32)len_on_bd)); |
1219 | 1218 | ||
1220 | #ifdef BNX2X_STOP_ON_ERROR | 1219 | #ifdef BNX2X_STOP_ON_ERROR |
1221 | if (pages > 8*PAGES_PER_SGE) { | 1220 | if (pages > |
1221 | min((u32)8, (u32)MAX_SKB_FRAGS) * SGE_PAGE_SIZE * PAGES_PER_SGE) { | ||
1222 | BNX2X_ERR("SGL length is too long: %d. CQE index is %d\n", | 1222 | BNX2X_ERR("SGL length is too long: %d. CQE index is %d\n", |
1223 | pages, cqe_idx); | 1223 | pages, cqe_idx); |
1224 | BNX2X_ERR("fp_cqe->pkt_len = %d fp_cqe->len_on_bd = %d\n", | 1224 | BNX2X_ERR("fp_cqe->pkt_len = %d fp_cqe->len_on_bd = %d\n", |
@@ -1234,9 +1234,8 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
1234 | 1234 | ||
1235 | /* FW gives the indices of the SGE as if the ring is an array | 1235 | /* FW gives the indices of the SGE as if the ring is an array |
1236 | (meaning that "next" element will consume 2 indices) */ | 1236 | (meaning that "next" element will consume 2 indices) */ |
1237 | frag_len = min(frag_size, (u32)(BCM_PAGE_SIZE*PAGES_PER_SGE)); | 1237 | frag_len = min(frag_size, (u32)(SGE_PAGE_SIZE*PAGES_PER_SGE)); |
1238 | rx_pg = &fp->rx_page_ring[sge_idx]; | 1238 | rx_pg = &fp->rx_page_ring[sge_idx]; |
1239 | sge = rx_pg->page; | ||
1240 | old_rx_pg = *rx_pg; | 1239 | old_rx_pg = *rx_pg; |
1241 | 1240 | ||
1242 | /* If we fail to allocate a substitute page, we simply stop | 1241 | /* If we fail to allocate a substitute page, we simply stop |
@@ -1249,7 +1248,7 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
1249 | 1248 | ||
1250 | /* Unmap the page as we r going to pass it to the stack */ | 1249 | /* Unmap the page as we r going to pass it to the stack */ |
1251 | pci_unmap_page(bp->pdev, pci_unmap_addr(&old_rx_pg, mapping), | 1250 | pci_unmap_page(bp->pdev, pci_unmap_addr(&old_rx_pg, mapping), |
1252 | BCM_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); | 1251 | SGE_PAGE_SIZE*PAGES_PER_SGE, PCI_DMA_FROMDEVICE); |
1253 | 1252 | ||
1254 | /* Add one frag and update the appropriate fields in the skb */ | 1253 | /* Add one frag and update the appropriate fields in the skb */ |
1255 | skb_fill_page_desc(skb, j, old_rx_pg.page, 0, frag_len); | 1254 | skb_fill_page_desc(skb, j, old_rx_pg.page, 0, frag_len); |
@@ -1282,6 +1281,13 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
1282 | if (likely(new_skb)) { | 1281 | if (likely(new_skb)) { |
1283 | /* fix ip xsum and give it to the stack */ | 1282 | /* fix ip xsum and give it to the stack */ |
1284 | /* (no need to map the new skb) */ | 1283 | /* (no need to map the new skb) */ |
1284 | #ifdef BCM_VLAN | ||
1285 | int is_vlan_cqe = | ||
1286 | (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & | ||
1287 | PARSING_FLAGS_VLAN); | ||
1288 | int is_not_hwaccel_vlan_cqe = | ||
1289 | (is_vlan_cqe && (!(bp->flags & HW_VLAN_RX_FLAG))); | ||
1290 | #endif | ||
1285 | 1291 | ||
1286 | prefetch(skb); | 1292 | prefetch(skb); |
1287 | prefetch(((char *)(skb)) + 128); | 1293 | prefetch(((char *)(skb)) + 128); |
@@ -1306,6 +1312,12 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
1306 | struct iphdr *iph; | 1312 | struct iphdr *iph; |
1307 | 1313 | ||
1308 | iph = (struct iphdr *)skb->data; | 1314 | iph = (struct iphdr *)skb->data; |
1315 | #ifdef BCM_VLAN | ||
1316 | /* If there is no Rx VLAN offloading - | ||
1317 | take VLAN tag into an account */ | ||
1318 | if (unlikely(is_not_hwaccel_vlan_cqe)) | ||
1319 | iph = (struct iphdr *)((u8 *)iph + VLAN_HLEN); | ||
1320 | #endif | ||
1309 | iph->check = 0; | 1321 | iph->check = 0; |
1310 | iph->check = ip_fast_csum((u8 *)iph, iph->ihl); | 1322 | iph->check = ip_fast_csum((u8 *)iph, iph->ihl); |
1311 | } | 1323 | } |
@@ -1313,9 +1325,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
1313 | if (!bnx2x_fill_frag_skb(bp, fp, skb, | 1325 | if (!bnx2x_fill_frag_skb(bp, fp, skb, |
1314 | &cqe->fast_path_cqe, cqe_idx)) { | 1326 | &cqe->fast_path_cqe, cqe_idx)) { |
1315 | #ifdef BCM_VLAN | 1327 | #ifdef BCM_VLAN |
1316 | if ((bp->vlgrp != NULL) && | 1328 | if ((bp->vlgrp != NULL) && is_vlan_cqe && |
1317 | (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & | 1329 | (!is_not_hwaccel_vlan_cqe)) |
1318 | PARSING_FLAGS_VLAN)) | ||
1319 | vlan_hwaccel_receive_skb(skb, bp->vlgrp, | 1330 | vlan_hwaccel_receive_skb(skb, bp->vlgrp, |
1320 | le16_to_cpu(cqe->fast_path_cqe. | 1331 | le16_to_cpu(cqe->fast_path_cqe. |
1321 | vlan_tag)); | 1332 | vlan_tag)); |
@@ -1355,11 +1366,23 @@ static inline void bnx2x_update_rx_prod(struct bnx2x *bp, | |||
1355 | rx_prods.cqe_prod = rx_comp_prod; | 1366 | rx_prods.cqe_prod = rx_comp_prod; |
1356 | rx_prods.sge_prod = rx_sge_prod; | 1367 | rx_prods.sge_prod = rx_sge_prod; |
1357 | 1368 | ||
1369 | /* | ||
1370 | * Make sure that the BD and SGE data is updated before updating the | ||
1371 | * producers since FW might read the BD/SGE right after the producer | ||
1372 | * is updated. | ||
1373 | * This is only applicable for weak-ordered memory model archs such | ||
1374 | * as IA-64. The following barrier is also mandatory since FW will | ||
1375 | * assumes BDs must have buffers. | ||
1376 | */ | ||
1377 | wmb(); | ||
1378 | |||
1358 | for (i = 0; i < sizeof(struct tstorm_eth_rx_producers)/4; i++) | 1379 | for (i = 0; i < sizeof(struct tstorm_eth_rx_producers)/4; i++) |
1359 | REG_WR(bp, BAR_TSTRORM_INTMEM + | 1380 | REG_WR(bp, BAR_TSTRORM_INTMEM + |
1360 | TSTORM_RX_PRODS_OFFSET(BP_PORT(bp), FP_CL_ID(fp)) + i*4, | 1381 | TSTORM_RX_PRODS_OFFSET(BP_PORT(bp), FP_CL_ID(fp)) + i*4, |
1361 | ((u32 *)&rx_prods)[i]); | 1382 | ((u32 *)&rx_prods)[i]); |
1362 | 1383 | ||
1384 | mmiowb(); /* keep prod updates ordered */ | ||
1385 | |||
1363 | DP(NETIF_MSG_RX_STATUS, | 1386 | DP(NETIF_MSG_RX_STATUS, |
1364 | "Wrote: bd_prod %u cqe_prod %u sge_prod %u\n", | 1387 | "Wrote: bd_prod %u cqe_prod %u sge_prod %u\n", |
1365 | bd_prod, rx_comp_prod, rx_sge_prod); | 1388 | bd_prod, rx_comp_prod, rx_sge_prod); |
@@ -1415,7 +1438,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) | |||
1415 | DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x" | 1438 | DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x" |
1416 | " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags), | 1439 | " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags), |
1417 | cqe_fp_flags, cqe->fast_path_cqe.status_flags, | 1440 | cqe_fp_flags, cqe->fast_path_cqe.status_flags, |
1418 | cqe->fast_path_cqe.rss_hash_result, | 1441 | le32_to_cpu(cqe->fast_path_cqe.rss_hash_result), |
1419 | le16_to_cpu(cqe->fast_path_cqe.vlan_tag), | 1442 | le16_to_cpu(cqe->fast_path_cqe.vlan_tag), |
1420 | le16_to_cpu(cqe->fast_path_cqe.pkt_len)); | 1443 | le16_to_cpu(cqe->fast_path_cqe.pkt_len)); |
1421 | 1444 | ||
@@ -1547,7 +1570,7 @@ reuse_rx: | |||
1547 | } | 1570 | } |
1548 | 1571 | ||
1549 | #ifdef BCM_VLAN | 1572 | #ifdef BCM_VLAN |
1550 | if ((bp->vlgrp != NULL) && | 1573 | if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) && |
1551 | (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & | 1574 | (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & |
1552 | PARSING_FLAGS_VLAN)) | 1575 | PARSING_FLAGS_VLAN)) |
1553 | vlan_hwaccel_receive_skb(skb, bp->vlgrp, | 1576 | vlan_hwaccel_receive_skb(skb, bp->vlgrp, |
@@ -1580,7 +1603,6 @@ next_cqe: | |||
1580 | /* Update producers */ | 1603 | /* Update producers */ |
1581 | bnx2x_update_rx_prod(bp, fp, bd_prod_fw, sw_comp_prod, | 1604 | bnx2x_update_rx_prod(bp, fp, bd_prod_fw, sw_comp_prod, |
1582 | fp->rx_sge_prod); | 1605 | fp->rx_sge_prod); |
1583 | mmiowb(); /* keep prod updates ordered */ | ||
1584 | 1606 | ||
1585 | fp->rx_pkt += rx_pkt; | 1607 | fp->rx_pkt += rx_pkt; |
1586 | fp->rx_calls++; | 1608 | fp->rx_calls++; |
@@ -1660,7 +1682,7 @@ static irqreturn_t bnx2x_interrupt(int irq, void *dev_instance) | |||
1660 | 1682 | ||
1661 | 1683 | ||
1662 | if (unlikely(status & 0x1)) { | 1684 | if (unlikely(status & 0x1)) { |
1663 | schedule_work(&bp->sp_task); | 1685 | queue_delayed_work(bnx2x_wq, &bp->sp_task, 0); |
1664 | 1686 | ||
1665 | status &= ~0x1; | 1687 | status &= ~0x1; |
1666 | if (!status) | 1688 | if (!status) |
@@ -1887,7 +1909,8 @@ static int bnx2x_set_spio(struct bnx2x *bp, int spio_num, u32 mode) | |||
1887 | 1909 | ||
1888 | static void bnx2x_calc_fc_adv(struct bnx2x *bp) | 1910 | static void bnx2x_calc_fc_adv(struct bnx2x *bp) |
1889 | { | 1911 | { |
1890 | switch (bp->link_vars.ieee_fc) { | 1912 | switch (bp->link_vars.ieee_fc & |
1913 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK) { | ||
1891 | case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE: | 1914 | case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE: |
1892 | bp->port.advertising &= ~(ADVERTISED_Asym_Pause | | 1915 | bp->port.advertising &= ~(ADVERTISED_Asym_Pause | |
1893 | ADVERTISED_Pause); | 1916 | ADVERTISED_Pause); |
@@ -1957,10 +1980,11 @@ static u8 bnx2x_initial_phy_init(struct bnx2x *bp) | |||
1957 | rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars); | 1980 | rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars); |
1958 | bnx2x_release_phy_lock(bp); | 1981 | bnx2x_release_phy_lock(bp); |
1959 | 1982 | ||
1983 | bnx2x_calc_fc_adv(bp); | ||
1984 | |||
1960 | if (bp->link_vars.link_up) | 1985 | if (bp->link_vars.link_up) |
1961 | bnx2x_link_report(bp); | 1986 | bnx2x_link_report(bp); |
1962 | 1987 | ||
1963 | bnx2x_calc_fc_adv(bp); | ||
1964 | 1988 | ||
1965 | return rc; | 1989 | return rc; |
1966 | } | 1990 | } |
@@ -2220,9 +2244,7 @@ static void bnx2x_link_attn(struct bnx2x *bp) | |||
2220 | /* Make sure that we are synced with the current statistics */ | 2244 | /* Make sure that we are synced with the current statistics */ |
2221 | bnx2x_stats_handle(bp, STATS_EVENT_STOP); | 2245 | bnx2x_stats_handle(bp, STATS_EVENT_STOP); |
2222 | 2246 | ||
2223 | bnx2x_acquire_phy_lock(bp); | ||
2224 | bnx2x_link_update(&bp->link_params, &bp->link_vars); | 2247 | bnx2x_link_update(&bp->link_params, &bp->link_vars); |
2225 | bnx2x_release_phy_lock(bp); | ||
2226 | 2248 | ||
2227 | if (bp->link_vars.link_up) { | 2249 | if (bp->link_vars.link_up) { |
2228 | 2250 | ||
@@ -2471,6 +2493,8 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted) | |||
2471 | if (asserted & ATTN_HARD_WIRED_MASK) { | 2493 | if (asserted & ATTN_HARD_WIRED_MASK) { |
2472 | if (asserted & ATTN_NIG_FOR_FUNC) { | 2494 | if (asserted & ATTN_NIG_FOR_FUNC) { |
2473 | 2495 | ||
2496 | bnx2x_acquire_phy_lock(bp); | ||
2497 | |||
2474 | /* save nig interrupt mask */ | 2498 | /* save nig interrupt mask */ |
2475 | bp->nig_mask = REG_RD(bp, nig_int_mask_addr); | 2499 | bp->nig_mask = REG_RD(bp, nig_int_mask_addr); |
2476 | REG_WR(bp, nig_int_mask_addr, 0); | 2500 | REG_WR(bp, nig_int_mask_addr, 0); |
@@ -2526,8 +2550,10 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted) | |||
2526 | REG_WR(bp, hc_addr, asserted); | 2550 | REG_WR(bp, hc_addr, asserted); |
2527 | 2551 | ||
2528 | /* now set back the mask */ | 2552 | /* now set back the mask */ |
2529 | if (asserted & ATTN_NIG_FOR_FUNC) | 2553 | if (asserted & ATTN_NIG_FOR_FUNC) { |
2530 | REG_WR(bp, nig_int_mask_addr, bp->nig_mask); | 2554 | REG_WR(bp, nig_int_mask_addr, bp->nig_mask); |
2555 | bnx2x_release_phy_lock(bp); | ||
2556 | } | ||
2531 | } | 2557 | } |
2532 | 2558 | ||
2533 | static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn) | 2559 | static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn) |
@@ -2795,8 +2821,10 @@ static void bnx2x_attn_int_deasserted(struct bnx2x *bp, u32 deasserted) | |||
2795 | static void bnx2x_attn_int(struct bnx2x *bp) | 2821 | static void bnx2x_attn_int(struct bnx2x *bp) |
2796 | { | 2822 | { |
2797 | /* read local copy of bits */ | 2823 | /* read local copy of bits */ |
2798 | u32 attn_bits = bp->def_status_blk->atten_status_block.attn_bits; | 2824 | u32 attn_bits = le32_to_cpu(bp->def_status_blk->atten_status_block. |
2799 | u32 attn_ack = bp->def_status_blk->atten_status_block.attn_bits_ack; | 2825 | attn_bits); |
2826 | u32 attn_ack = le32_to_cpu(bp->def_status_blk->atten_status_block. | ||
2827 | attn_bits_ack); | ||
2800 | u32 attn_state = bp->attn_state; | 2828 | u32 attn_state = bp->attn_state; |
2801 | 2829 | ||
2802 | /* look for changed bits */ | 2830 | /* look for changed bits */ |
@@ -2820,7 +2848,7 @@ static void bnx2x_attn_int(struct bnx2x *bp) | |||
2820 | 2848 | ||
2821 | static void bnx2x_sp_task(struct work_struct *work) | 2849 | static void bnx2x_sp_task(struct work_struct *work) |
2822 | { | 2850 | { |
2823 | struct bnx2x *bp = container_of(work, struct bnx2x, sp_task); | 2851 | struct bnx2x *bp = container_of(work, struct bnx2x, sp_task.work); |
2824 | u16 status; | 2852 | u16 status; |
2825 | 2853 | ||
2826 | 2854 | ||
@@ -2844,7 +2872,7 @@ static void bnx2x_sp_task(struct work_struct *work) | |||
2844 | if (status & 0x2) | 2872 | if (status & 0x2) |
2845 | bp->stats_pending = 0; | 2873 | bp->stats_pending = 0; |
2846 | 2874 | ||
2847 | bnx2x_ack_sb(bp, DEF_SB_ID, ATTENTION_ID, bp->def_att_idx, | 2875 | bnx2x_ack_sb(bp, DEF_SB_ID, ATTENTION_ID, le16_to_cpu(bp->def_att_idx), |
2848 | IGU_INT_NOP, 1); | 2876 | IGU_INT_NOP, 1); |
2849 | bnx2x_ack_sb(bp, DEF_SB_ID, USTORM_ID, le16_to_cpu(bp->def_u_idx), | 2877 | bnx2x_ack_sb(bp, DEF_SB_ID, USTORM_ID, le16_to_cpu(bp->def_u_idx), |
2850 | IGU_INT_NOP, 1); | 2878 | IGU_INT_NOP, 1); |
@@ -2875,7 +2903,7 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance) | |||
2875 | return IRQ_HANDLED; | 2903 | return IRQ_HANDLED; |
2876 | #endif | 2904 | #endif |
2877 | 2905 | ||
2878 | schedule_work(&bp->sp_task); | 2906 | queue_delayed_work(bnx2x_wq, &bp->sp_task, 0); |
2879 | 2907 | ||
2880 | return IRQ_HANDLED; | 2908 | return IRQ_HANDLED; |
2881 | } | 2909 | } |
@@ -2892,7 +2920,7 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance) | |||
2892 | #define ADD_64(s_hi, a_hi, s_lo, a_lo) \ | 2920 | #define ADD_64(s_hi, a_hi, s_lo, a_lo) \ |
2893 | do { \ | 2921 | do { \ |
2894 | s_lo += a_lo; \ | 2922 | s_lo += a_lo; \ |
2895 | s_hi += a_hi + (s_lo < a_lo) ? 1 : 0; \ | 2923 | s_hi += a_hi + ((s_lo < a_lo) ? 1 : 0); \ |
2896 | } while (0) | 2924 | } while (0) |
2897 | 2925 | ||
2898 | /* difference = minuend - subtrahend */ | 2926 | /* difference = minuend - subtrahend */ |
@@ -4496,7 +4524,7 @@ static void bnx2x_init_context(struct bnx2x *bp) | |||
4496 | 4524 | ||
4497 | static void bnx2x_init_ind_table(struct bnx2x *bp) | 4525 | static void bnx2x_init_ind_table(struct bnx2x *bp) |
4498 | { | 4526 | { |
4499 | int port = BP_PORT(bp); | 4527 | int func = BP_FUNC(bp); |
4500 | int i; | 4528 | int i; |
4501 | 4529 | ||
4502 | if (!is_multi(bp)) | 4530 | if (!is_multi(bp)) |
@@ -4505,10 +4533,8 @@ static void bnx2x_init_ind_table(struct bnx2x *bp) | |||
4505 | DP(NETIF_MSG_IFUP, "Initializing indirection table\n"); | 4533 | DP(NETIF_MSG_IFUP, "Initializing indirection table\n"); |
4506 | for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++) | 4534 | for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++) |
4507 | REG_WR8(bp, BAR_TSTRORM_INTMEM + | 4535 | REG_WR8(bp, BAR_TSTRORM_INTMEM + |
4508 | TSTORM_INDIRECTION_TABLE_OFFSET(port) + i, | 4536 | TSTORM_INDIRECTION_TABLE_OFFSET(func) + i, |
4509 | i % bp->num_queues); | 4537 | BP_CL_ID(bp) + (i % bp->num_queues)); |
4510 | |||
4511 | REG_WR(bp, PRS_REG_A_PRSU_20, 0xf); | ||
4512 | } | 4538 | } |
4513 | 4539 | ||
4514 | static void bnx2x_set_client_config(struct bnx2x *bp) | 4540 | static void bnx2x_set_client_config(struct bnx2x *bp) |
@@ -4517,12 +4543,12 @@ static void bnx2x_set_client_config(struct bnx2x *bp) | |||
4517 | int port = BP_PORT(bp); | 4543 | int port = BP_PORT(bp); |
4518 | int i; | 4544 | int i; |
4519 | 4545 | ||
4520 | tstorm_client.mtu = bp->dev->mtu + ETH_OVREHEAD; | 4546 | tstorm_client.mtu = bp->dev->mtu; |
4521 | tstorm_client.statistics_counter_id = BP_CL_ID(bp); | 4547 | tstorm_client.statistics_counter_id = BP_CL_ID(bp); |
4522 | tstorm_client.config_flags = | 4548 | tstorm_client.config_flags = |
4523 | TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE; | 4549 | TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE; |
4524 | #ifdef BCM_VLAN | 4550 | #ifdef BCM_VLAN |
4525 | if (bp->rx_mode && bp->vlgrp) { | 4551 | if (bp->rx_mode && bp->vlgrp && (bp->flags & HW_VLAN_RX_FLAG)) { |
4526 | tstorm_client.config_flags |= | 4552 | tstorm_client.config_flags |= |
4527 | TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE; | 4553 | TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE; |
4528 | DP(NETIF_MSG_IFUP, "vlan removal enabled\n"); | 4554 | DP(NETIF_MSG_IFUP, "vlan removal enabled\n"); |
@@ -4531,7 +4557,7 @@ static void bnx2x_set_client_config(struct bnx2x *bp) | |||
4531 | 4557 | ||
4532 | if (bp->flags & TPA_ENABLE_FLAG) { | 4558 | if (bp->flags & TPA_ENABLE_FLAG) { |
4533 | tstorm_client.max_sges_for_packet = | 4559 | tstorm_client.max_sges_for_packet = |
4534 | BCM_PAGE_ALIGN(tstorm_client.mtu) >> BCM_PAGE_SHIFT; | 4560 | SGE_PAGE_ALIGN(tstorm_client.mtu) >> SGE_PAGE_SHIFT; |
4535 | tstorm_client.max_sges_for_packet = | 4561 | tstorm_client.max_sges_for_packet = |
4536 | ((tstorm_client.max_sges_for_packet + | 4562 | ((tstorm_client.max_sges_for_packet + |
4537 | PAGES_PER_SGE - 1) & (~(PAGES_PER_SGE - 1))) >> | 4563 | PAGES_PER_SGE - 1) & (~(PAGES_PER_SGE - 1))) >> |
@@ -4714,10 +4740,11 @@ static void bnx2x_init_internal_func(struct bnx2x *bp) | |||
4714 | bp->e1hov); | 4740 | bp->e1hov); |
4715 | } | 4741 | } |
4716 | 4742 | ||
4717 | /* Init CQ ring mapping and aggregation size */ | 4743 | /* Init CQ ring mapping and aggregation size, the FW limit is 8 frags */ |
4718 | max_agg_size = min((u32)(bp->rx_buf_size + | 4744 | max_agg_size = |
4719 | 8*BCM_PAGE_SIZE*PAGES_PER_SGE), | 4745 | min((u32)(min((u32)8, (u32)MAX_SKB_FRAGS) * |
4720 | (u32)0xffff); | 4746 | SGE_PAGE_SIZE * PAGES_PER_SGE), |
4747 | (u32)0xffff); | ||
4721 | for_each_queue(bp, i) { | 4748 | for_each_queue(bp, i) { |
4722 | struct bnx2x_fastpath *fp = &bp->fp[i]; | 4749 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
4723 | 4750 | ||
@@ -4785,6 +4812,15 @@ static void bnx2x_nic_init(struct bnx2x *bp, u32 load_code) | |||
4785 | bnx2x_init_context(bp); | 4812 | bnx2x_init_context(bp); |
4786 | bnx2x_init_internal(bp, load_code); | 4813 | bnx2x_init_internal(bp, load_code); |
4787 | bnx2x_init_ind_table(bp); | 4814 | bnx2x_init_ind_table(bp); |
4815 | bnx2x_stats_init(bp); | ||
4816 | |||
4817 | /* At this point, we are ready for interrupts */ | ||
4818 | atomic_set(&bp->intr_sem, 0); | ||
4819 | |||
4820 | /* flush all before enabling interrupts */ | ||
4821 | mb(); | ||
4822 | mmiowb(); | ||
4823 | |||
4788 | bnx2x_int_enable(bp); | 4824 | bnx2x_int_enable(bp); |
4789 | } | 4825 | } |
4790 | 4826 | ||
@@ -5134,7 +5170,6 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
5134 | REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1); | 5170 | REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1); |
5135 | REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1); | 5171 | REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1); |
5136 | REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1); | 5172 | REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1); |
5137 | REG_WR(bp, PXP2_REG_RQ_HC_ENDIAN_M, 1); | ||
5138 | 5173 | ||
5139 | /* REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */ | 5174 | /* REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */ |
5140 | REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1); | 5175 | REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1); |
@@ -5212,6 +5247,7 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
5212 | } | 5247 | } |
5213 | 5248 | ||
5214 | bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END); | 5249 | bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END); |
5250 | REG_WR(bp, PRS_REG_A_PRSU_20, 0xf); | ||
5215 | /* set NIC mode */ | 5251 | /* set NIC mode */ |
5216 | REG_WR(bp, PRS_REG_NIC_MODE, 1); | 5252 | REG_WR(bp, PRS_REG_NIC_MODE, 1); |
5217 | if (CHIP_IS_E1H(bp)) | 5253 | if (CHIP_IS_E1H(bp)) |
@@ -6393,17 +6429,8 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
6393 | } | 6429 | } |
6394 | } | 6430 | } |
6395 | 6431 | ||
6396 | bnx2x_stats_init(bp); | ||
6397 | |||
6398 | bp->state = BNX2X_STATE_OPENING_WAIT4_PORT; | 6432 | bp->state = BNX2X_STATE_OPENING_WAIT4_PORT; |
6399 | 6433 | ||
6400 | /* Enable Rx interrupt handling before sending the ramrod | ||
6401 | as it's completed on Rx FP queue */ | ||
6402 | bnx2x_napi_enable(bp); | ||
6403 | |||
6404 | /* Enable interrupt handling */ | ||
6405 | atomic_set(&bp->intr_sem, 0); | ||
6406 | |||
6407 | rc = bnx2x_setup_leading(bp); | 6434 | rc = bnx2x_setup_leading(bp); |
6408 | if (rc) { | 6435 | if (rc) { |
6409 | BNX2X_ERR("Setup leading failed!\n"); | 6436 | BNX2X_ERR("Setup leading failed!\n"); |
@@ -7501,7 +7528,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) | |||
7501 | 7528 | ||
7502 | mutex_init(&bp->port.phy_mutex); | 7529 | mutex_init(&bp->port.phy_mutex); |
7503 | 7530 | ||
7504 | INIT_WORK(&bp->sp_task, bnx2x_sp_task); | 7531 | INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); |
7505 | INIT_WORK(&bp->reset_task, bnx2x_reset_task); | 7532 | INIT_WORK(&bp->reset_task, bnx2x_reset_task); |
7506 | 7533 | ||
7507 | rc = bnx2x_get_hwinfo(bp); | 7534 | rc = bnx2x_get_hwinfo(bp); |
@@ -8727,6 +8754,8 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up) | |||
8727 | tx_bd->general_data = ((UNICAST_ADDRESS << | 8754 | tx_bd->general_data = ((UNICAST_ADDRESS << |
8728 | ETH_TX_BD_ETH_ADDR_TYPE_SHIFT) | 1); | 8755 | ETH_TX_BD_ETH_ADDR_TYPE_SHIFT) | 1); |
8729 | 8756 | ||
8757 | wmb(); | ||
8758 | |||
8730 | fp->hw_tx_prods->bds_prod = | 8759 | fp->hw_tx_prods->bds_prod = |
8731 | cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + 1); | 8760 | cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + 1); |
8732 | mb(); /* FW restriction: must not reorder writing nbd and packets */ | 8761 | mb(); /* FW restriction: must not reorder writing nbd and packets */ |
@@ -8778,7 +8807,6 @@ test_loopback_rx_exit: | |||
8778 | /* Update producers */ | 8807 | /* Update producers */ |
8779 | bnx2x_update_rx_prod(bp, fp, fp->rx_bd_prod, fp->rx_comp_prod, | 8808 | bnx2x_update_rx_prod(bp, fp, fp->rx_bd_prod, fp->rx_comp_prod, |
8780 | fp->rx_sge_prod); | 8809 | fp->rx_sge_prod); |
8781 | mmiowb(); /* keep prod updates ordered */ | ||
8782 | 8810 | ||
8783 | test_loopback_exit: | 8811 | test_loopback_exit: |
8784 | bp->link_params.loopback_mode = LOOPBACK_NONE; | 8812 | bp->link_params.loopback_mode = LOOPBACK_NONE; |
@@ -9549,11 +9577,14 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
9549 | "sending pkt %u @%p next_idx %u bd %u @%p\n", | 9577 | "sending pkt %u @%p next_idx %u bd %u @%p\n", |
9550 | pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_bd); | 9578 | pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_bd); |
9551 | 9579 | ||
9552 | if ((bp->vlgrp != NULL) && vlan_tx_tag_present(skb)) { | 9580 | #ifdef BCM_VLAN |
9581 | if ((bp->vlgrp != NULL) && vlan_tx_tag_present(skb) && | ||
9582 | (bp->flags & HW_VLAN_TX_FLAG)) { | ||
9553 | tx_bd->vlan = cpu_to_le16(vlan_tx_tag_get(skb)); | 9583 | tx_bd->vlan = cpu_to_le16(vlan_tx_tag_get(skb)); |
9554 | tx_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_VLAN_TAG; | 9584 | tx_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_VLAN_TAG; |
9555 | vlan_off += 4; | 9585 | vlan_off += 4; |
9556 | } else | 9586 | } else |
9587 | #endif | ||
9557 | tx_bd->vlan = cpu_to_le16(pkt_prod); | 9588 | tx_bd->vlan = cpu_to_le16(pkt_prod); |
9558 | 9589 | ||
9559 | if (xmit_type) { | 9590 | if (xmit_type) { |
@@ -9705,6 +9736,15 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
9705 | 9736 | ||
9706 | DP(NETIF_MSG_TX_QUEUED, "doorbell: nbd %d bd %u\n", nbd, bd_prod); | 9737 | DP(NETIF_MSG_TX_QUEUED, "doorbell: nbd %d bd %u\n", nbd, bd_prod); |
9707 | 9738 | ||
9739 | /* | ||
9740 | * Make sure that the BD data is updated before updating the producer | ||
9741 | * since FW might read the BD right after the producer is updated. | ||
9742 | * This is only applicable for weak-ordered memory model archs such | ||
9743 | * as IA-64. The following barrier is also mandatory since FW will | ||
9744 | * assumes packets must have BDs. | ||
9745 | */ | ||
9746 | wmb(); | ||
9747 | |||
9708 | fp->hw_tx_prods->bds_prod = | 9748 | fp->hw_tx_prods->bds_prod = |
9709 | cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + nbd); | 9749 | cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + nbd); |
9710 | mb(); /* FW restriction: must not reorder writing nbd and packets */ | 9750 | mb(); /* FW restriction: must not reorder writing nbd and packets */ |
@@ -9718,6 +9758,9 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
9718 | dev->trans_start = jiffies; | 9758 | dev->trans_start = jiffies; |
9719 | 9759 | ||
9720 | if (unlikely(bnx2x_tx_avail(fp) < MAX_SKB_FRAGS + 3)) { | 9760 | if (unlikely(bnx2x_tx_avail(fp) < MAX_SKB_FRAGS + 3)) { |
9761 | /* We want bnx2x_tx_int to "see" the updated tx_bd_prod | ||
9762 | if we put Tx into XOFF state. */ | ||
9763 | smp_mb(); | ||
9721 | netif_stop_queue(dev); | 9764 | netif_stop_queue(dev); |
9722 | bp->eth_stats.driver_xoff++; | 9765 | bp->eth_stats.driver_xoff++; |
9723 | if (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3) | 9766 | if (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3) |
@@ -9987,6 +10030,16 @@ static void bnx2x_vlan_rx_register(struct net_device *dev, | |||
9987 | struct bnx2x *bp = netdev_priv(dev); | 10030 | struct bnx2x *bp = netdev_priv(dev); |
9988 | 10031 | ||
9989 | bp->vlgrp = vlgrp; | 10032 | bp->vlgrp = vlgrp; |
10033 | |||
10034 | /* Set flags according to the required capabilities */ | ||
10035 | bp->flags &= ~(HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG); | ||
10036 | |||
10037 | if (dev->features & NETIF_F_HW_VLAN_TX) | ||
10038 | bp->flags |= HW_VLAN_TX_FLAG; | ||
10039 | |||
10040 | if (dev->features & NETIF_F_HW_VLAN_RX) | ||
10041 | bp->flags |= HW_VLAN_RX_FLAG; | ||
10042 | |||
9990 | if (netif_running(dev)) | 10043 | if (netif_running(dev)) |
9991 | bnx2x_set_client_config(bp); | 10044 | bnx2x_set_client_config(bp); |
9992 | } | 10045 | } |
@@ -10143,6 +10196,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |||
10143 | dev->features |= NETIF_F_HIGHDMA; | 10196 | dev->features |= NETIF_F_HIGHDMA; |
10144 | #ifdef BCM_VLAN | 10197 | #ifdef BCM_VLAN |
10145 | dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); | 10198 | dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); |
10199 | bp->flags |= (HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG); | ||
10146 | #endif | 10200 | #endif |
10147 | dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); | 10201 | dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); |
10148 | dev->features |= NETIF_F_TSO6; | 10202 | dev->features |= NETIF_F_TSO6; |
@@ -10519,12 +10573,20 @@ static struct pci_driver bnx2x_pci_driver = { | |||
10519 | 10573 | ||
10520 | static int __init bnx2x_init(void) | 10574 | static int __init bnx2x_init(void) |
10521 | { | 10575 | { |
10576 | bnx2x_wq = create_singlethread_workqueue("bnx2x"); | ||
10577 | if (bnx2x_wq == NULL) { | ||
10578 | printk(KERN_ERR PFX "Cannot create workqueue\n"); | ||
10579 | return -ENOMEM; | ||
10580 | } | ||
10581 | |||
10522 | return pci_register_driver(&bnx2x_pci_driver); | 10582 | return pci_register_driver(&bnx2x_pci_driver); |
10523 | } | 10583 | } |
10524 | 10584 | ||
10525 | static void __exit bnx2x_cleanup(void) | 10585 | static void __exit bnx2x_cleanup(void) |
10526 | { | 10586 | { |
10527 | pci_unregister_driver(&bnx2x_pci_driver); | 10587 | pci_unregister_driver(&bnx2x_pci_driver); |
10588 | |||
10589 | destroy_workqueue(bnx2x_wq); | ||
10528 | } | 10590 | } |
10529 | 10591 | ||
10530 | module_init(bnx2x_init); | 10592 | module_init(bnx2x_init); |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index e3131ea629c..dfe92264e82 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -132,7 +132,7 @@ void ehea_dump(void *adr, int len, char *msg) | |||
132 | int x; | 132 | int x; |
133 | unsigned char *deb = adr; | 133 | unsigned char *deb = adr; |
134 | for (x = 0; x < len; x += 16) { | 134 | for (x = 0; x < len; x += 16) { |
135 | printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg, | 135 | printk(DRV_NAME " %s adr=%p ofs=%04x %016llx %016llx\n", msg, |
136 | deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8])); | 136 | deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8])); |
137 | deb += 16; | 137 | deb += 16; |
138 | } | 138 | } |
@@ -883,7 +883,7 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param) | |||
883 | 883 | ||
884 | while (eqe) { | 884 | while (eqe) { |
885 | qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); | 885 | qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); |
886 | ehea_error("QP aff_err: entry=0x%lx, token=0x%x", | 886 | ehea_error("QP aff_err: entry=0x%llx, token=0x%x", |
887 | eqe->entry, qp_token); | 887 | eqe->entry, qp_token); |
888 | 888 | ||
889 | qp = port->port_res[qp_token].qp; | 889 | qp = port->port_res[qp_token].qp; |
@@ -1159,7 +1159,7 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe) | |||
1159 | netif_stop_queue(port->netdev); | 1159 | netif_stop_queue(port->netdev); |
1160 | break; | 1160 | break; |
1161 | default: | 1161 | default: |
1162 | ehea_error("unknown event code %x, eqe=0x%lX", ec, eqe); | 1162 | ehea_error("unknown event code %x, eqe=0x%llX", ec, eqe); |
1163 | break; | 1163 | break; |
1164 | } | 1164 | } |
1165 | } | 1165 | } |
@@ -1971,7 +1971,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1971 | } | 1971 | } |
1972 | 1972 | ||
1973 | if (dev->mc_count > port->adapter->max_mc_mac) { | 1973 | if (dev->mc_count > port->adapter->max_mc_mac) { |
1974 | ehea_info("Mcast registration limit reached (0x%lx). " | 1974 | ehea_info("Mcast registration limit reached (0x%llx). " |
1975 | "Use ALLMULTI!", | 1975 | "Use ALLMULTI!", |
1976 | port->adapter->max_mc_mac); | 1976 | port->adapter->max_mc_mac); |
1977 | goto out; | 1977 | goto out; |
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c index 225c692b5d9..49d766ebbcf 100644 --- a/drivers/net/ehea/ehea_qmr.c +++ b/drivers/net/ehea/ehea_qmr.c | |||
@@ -168,7 +168,7 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter, | |||
168 | cq->fw_handle, rpage, 1); | 168 | cq->fw_handle, rpage, 1); |
169 | if (hret < H_SUCCESS) { | 169 | if (hret < H_SUCCESS) { |
170 | ehea_error("register_rpage_cq failed ehea_cq=%p " | 170 | ehea_error("register_rpage_cq failed ehea_cq=%p " |
171 | "hret=%lx counter=%i act_pages=%i", | 171 | "hret=%llx counter=%i act_pages=%i", |
172 | cq, hret, counter, cq->attr.nr_pages); | 172 | cq, hret, counter, cq->attr.nr_pages); |
173 | goto out_kill_hwq; | 173 | goto out_kill_hwq; |
174 | } | 174 | } |
@@ -178,13 +178,13 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter, | |||
178 | 178 | ||
179 | if ((hret != H_SUCCESS) || (vpage)) { | 179 | if ((hret != H_SUCCESS) || (vpage)) { |
180 | ehea_error("registration of pages not " | 180 | ehea_error("registration of pages not " |
181 | "complete hret=%lx\n", hret); | 181 | "complete hret=%llx\n", hret); |
182 | goto out_kill_hwq; | 182 | goto out_kill_hwq; |
183 | } | 183 | } |
184 | } else { | 184 | } else { |
185 | if (hret != H_PAGE_REGISTERED) { | 185 | if (hret != H_PAGE_REGISTERED) { |
186 | ehea_error("CQ: registration of page failed " | 186 | ehea_error("CQ: registration of page failed " |
187 | "hret=%lx\n", hret); | 187 | "hret=%llx\n", hret); |
188 | goto out_kill_hwq; | 188 | goto out_kill_hwq; |
189 | } | 189 | } |
190 | } | 190 | } |
@@ -986,15 +986,15 @@ void print_error_data(u64 *data) | |||
986 | length = EHEA_PAGESIZE; | 986 | length = EHEA_PAGESIZE; |
987 | 987 | ||
988 | if (type == 0x8) /* Queue Pair */ | 988 | if (type == 0x8) /* Queue Pair */ |
989 | ehea_error("QP (resource=%lX) state: AER=0x%lX, AERR=0x%lX, " | 989 | ehea_error("QP (resource=%llX) state: AER=0x%llX, AERR=0x%llX, " |
990 | "port=%lX", resource, data[6], data[12], data[22]); | 990 | "port=%llX", resource, data[6], data[12], data[22]); |
991 | 991 | ||
992 | if (type == 0x4) /* Completion Queue */ | 992 | if (type == 0x4) /* Completion Queue */ |
993 | ehea_error("CQ (resource=%lX) state: AER=0x%lX", resource, | 993 | ehea_error("CQ (resource=%llX) state: AER=0x%llX", resource, |
994 | data[6]); | 994 | data[6]); |
995 | 995 | ||
996 | if (type == 0x3) /* Event Queue */ | 996 | if (type == 0x3) /* Event Queue */ |
997 | ehea_error("EQ (resource=%lX) state: AER=0x%lX", resource, | 997 | ehea_error("EQ (resource=%llX) state: AER=0x%llX", resource, |
998 | data[6]); | 998 | data[6]); |
999 | 999 | ||
1000 | ehea_dump(data, length, "error data"); | 1000 | ehea_dump(data, length, "error data"); |
@@ -1016,11 +1016,11 @@ void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle) | |||
1016 | rblock); | 1016 | rblock); |
1017 | 1017 | ||
1018 | if (ret == H_R_STATE) | 1018 | if (ret == H_R_STATE) |
1019 | ehea_error("No error data is available: %lX.", res_handle); | 1019 | ehea_error("No error data is available: %llX.", res_handle); |
1020 | else if (ret == H_SUCCESS) | 1020 | else if (ret == H_SUCCESS) |
1021 | print_error_data(rblock); | 1021 | print_error_data(rblock); |
1022 | else | 1022 | else |
1023 | ehea_error("Error data could not be fetched: %lX", res_handle); | 1023 | ehea_error("Error data could not be fetched: %llX", res_handle); |
1024 | 1024 | ||
1025 | kfree(rblock); | 1025 | kfree(rblock); |
1026 | } | 1026 | } |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 4e6a9195fe5..ce900e54d8d 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -795,6 +795,7 @@ static int fs_enet_open(struct net_device *dev) | |||
795 | 795 | ||
796 | err = fs_init_phy(dev); | 796 | err = fs_init_phy(dev); |
797 | if (err) { | 797 | if (err) { |
798 | free_irq(fep->interrupt, dev); | ||
798 | if (fep->fpi->use_napi) | 799 | if (fep->fpi->use_napi) |
799 | napi_disable(&fep->napi); | 800 | napi_disable(&fep->napi); |
800 | return err; | 801 | return err; |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index efcbeb6c867..ea530673236 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -1622,10 +1622,18 @@ static int gfar_clean_tx_ring(struct net_device *dev) | |||
1622 | static void gfar_schedule_cleanup(struct net_device *dev) | 1622 | static void gfar_schedule_cleanup(struct net_device *dev) |
1623 | { | 1623 | { |
1624 | struct gfar_private *priv = netdev_priv(dev); | 1624 | struct gfar_private *priv = netdev_priv(dev); |
1625 | unsigned long flags; | ||
1626 | |||
1627 | spin_lock_irqsave(&priv->txlock, flags); | ||
1628 | spin_lock(&priv->rxlock); | ||
1629 | |||
1625 | if (netif_rx_schedule_prep(&priv->napi)) { | 1630 | if (netif_rx_schedule_prep(&priv->napi)) { |
1626 | gfar_write(&priv->regs->imask, IMASK_RTX_DISABLED); | 1631 | gfar_write(&priv->regs->imask, IMASK_RTX_DISABLED); |
1627 | __netif_rx_schedule(&priv->napi); | 1632 | __netif_rx_schedule(&priv->napi); |
1628 | } | 1633 | } |
1634 | |||
1635 | spin_unlock(&priv->rxlock); | ||
1636 | spin_unlock_irqrestore(&priv->txlock, flags); | ||
1629 | } | 1637 | } |
1630 | 1638 | ||
1631 | /* Interrupt Handler for Transmit complete */ | 1639 | /* Interrupt Handler for Transmit complete */ |
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c index ecf9798987f..2a2fc17b287 100644 --- a/drivers/net/ibm_newemac/mal.c +++ b/drivers/net/ibm_newemac/mal.c | |||
@@ -613,7 +613,9 @@ static int __devinit mal_probe(struct of_device *ofdev, | |||
613 | INIT_LIST_HEAD(&mal->list); | 613 | INIT_LIST_HEAD(&mal->list); |
614 | spin_lock_init(&mal->lock); | 614 | spin_lock_init(&mal->lock); |
615 | 615 | ||
616 | netif_napi_add(NULL, &mal->napi, mal_poll, | 616 | init_dummy_netdev(&mal->dummy_dev); |
617 | |||
618 | netif_napi_add(&mal->dummy_dev, &mal->napi, mal_poll, | ||
617 | CONFIG_IBM_NEW_EMAC_POLL_WEIGHT); | 619 | CONFIG_IBM_NEW_EMAC_POLL_WEIGHT); |
618 | 620 | ||
619 | /* Load power-on reset defaults */ | 621 | /* Load power-on reset defaults */ |
diff --git a/drivers/net/ibm_newemac/mal.h b/drivers/net/ibm_newemac/mal.h index 2f0a8736084..9ededfbf072 100644 --- a/drivers/net/ibm_newemac/mal.h +++ b/drivers/net/ibm_newemac/mal.h | |||
@@ -214,6 +214,8 @@ struct mal_instance { | |||
214 | int index; | 214 | int index; |
215 | spinlock_t lock; | 215 | spinlock_t lock; |
216 | 216 | ||
217 | struct net_device dummy_dev; | ||
218 | |||
217 | unsigned int features; | 219 | unsigned int features; |
218 | }; | 220 | }; |
219 | 221 | ||
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index ca3bb9f7321..dfa6348ac1d 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -602,7 +602,7 @@ static int ibmveth_open(struct net_device *netdev) | |||
602 | 602 | ||
603 | if(lpar_rc != H_SUCCESS) { | 603 | if(lpar_rc != H_SUCCESS) { |
604 | ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); | 604 | ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); |
605 | ibmveth_error_printk("buffer TCE:0x%lx filter TCE:0x%lx rxq desc:0x%lx MAC:0x%lx\n", | 605 | ibmveth_error_printk("buffer TCE:0x%llx filter TCE:0x%llx rxq desc:0x%llx MAC:0x%llx\n", |
606 | adapter->buffer_list_dma, | 606 | adapter->buffer_list_dma, |
607 | adapter->filter_list_dma, | 607 | adapter->filter_list_dma, |
608 | rxq_desc.desc, | 608 | rxq_desc.desc, |
@@ -1378,13 +1378,13 @@ static int ibmveth_show(struct seq_file *seq, void *v) | |||
1378 | seq_printf(seq, "Firmware MAC: %pM\n", firmware_mac); | 1378 | seq_printf(seq, "Firmware MAC: %pM\n", firmware_mac); |
1379 | 1379 | ||
1380 | seq_printf(seq, "\nAdapter Statistics:\n"); | 1380 | seq_printf(seq, "\nAdapter Statistics:\n"); |
1381 | seq_printf(seq, " TX: vio_map_single failres: %ld\n", adapter->tx_map_failed); | 1381 | seq_printf(seq, " TX: vio_map_single failres: %lld\n", adapter->tx_map_failed); |
1382 | seq_printf(seq, " send failures: %ld\n", adapter->tx_send_failed); | 1382 | seq_printf(seq, " send failures: %lld\n", adapter->tx_send_failed); |
1383 | seq_printf(seq, " RX: replenish task cycles: %ld\n", adapter->replenish_task_cycles); | 1383 | seq_printf(seq, " RX: replenish task cycles: %lld\n", adapter->replenish_task_cycles); |
1384 | seq_printf(seq, " alloc_skb_failures: %ld\n", adapter->replenish_no_mem); | 1384 | seq_printf(seq, " alloc_skb_failures: %lld\n", adapter->replenish_no_mem); |
1385 | seq_printf(seq, " add buffer failures: %ld\n", adapter->replenish_add_buff_failure); | 1385 | seq_printf(seq, " add buffer failures: %lld\n", adapter->replenish_add_buff_failure); |
1386 | seq_printf(seq, " invalid buffers: %ld\n", adapter->rx_invalid_buffer); | 1386 | seq_printf(seq, " invalid buffers: %lld\n", adapter->rx_invalid_buffer); |
1387 | seq_printf(seq, " no buffers: %ld\n", adapter->rx_no_buffer); | 1387 | seq_printf(seq, " no buffers: %lld\n", adapter->rx_no_buffer); |
1388 | 1388 | ||
1389 | return 0; | 1389 | return 0; |
1390 | } | 1390 | } |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 29118f58a14..3a22dc41b65 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -1073,7 +1073,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self) | |||
1073 | { | 1073 | { |
1074 | unsigned int i; | 1074 | unsigned int i; |
1075 | int ret; | 1075 | int ret; |
1076 | char stir421x_fw_name[11]; | 1076 | char stir421x_fw_name[12]; |
1077 | const struct firmware *fw; | 1077 | const struct firmware *fw; |
1078 | const unsigned char *fw_version_ptr; /* pointer to version string */ | 1078 | const unsigned char *fw_version_ptr; /* pointer to version string */ |
1079 | unsigned long fw_version = 0; | 1079 | unsigned long fw_version = 0; |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index c7457f97259..cb793c2bade 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -429,7 +429,7 @@ SIMPLE_PORT_ATTR(promiscuous); | |||
429 | SIMPLE_PORT_ATTR(num_mcast); | 429 | SIMPLE_PORT_ATTR(num_mcast); |
430 | CUSTOM_PORT_ATTR(lpar_map, "0x%X\n", port->lpar_map); | 430 | CUSTOM_PORT_ATTR(lpar_map, "0x%X\n", port->lpar_map); |
431 | CUSTOM_PORT_ATTR(stopped_map, "0x%X\n", port->stopped_map); | 431 | CUSTOM_PORT_ATTR(stopped_map, "0x%X\n", port->stopped_map); |
432 | CUSTOM_PORT_ATTR(mac_addr, "0x%lX\n", port->mac_addr); | 432 | CUSTOM_PORT_ATTR(mac_addr, "0x%llX\n", port->mac_addr); |
433 | 433 | ||
434 | #define GET_PORT_ATTR(_name) (&veth_port_attr_##_name.attr) | 434 | #define GET_PORT_ATTR(_name) (&veth_port_attr_##_name.attr) |
435 | static struct attribute *veth_port_default_attrs[] = { | 435 | static struct attribute *veth_port_default_attrs[] = { |
diff --git a/drivers/net/korina.c b/drivers/net/korina.c index 4a5580c1126..1d6e48e1336 100644 --- a/drivers/net/korina.c +++ b/drivers/net/korina.c | |||
@@ -84,7 +84,10 @@ | |||
84 | #define KORINA_NUM_RDS 64 /* number of receive descriptors */ | 84 | #define KORINA_NUM_RDS 64 /* number of receive descriptors */ |
85 | #define KORINA_NUM_TDS 64 /* number of transmit descriptors */ | 85 | #define KORINA_NUM_TDS 64 /* number of transmit descriptors */ |
86 | 86 | ||
87 | #define KORINA_RBSIZE 536 /* size of one resource buffer = Ether MTU */ | 87 | /* KORINA_RBSIZE is the hardware's default maximum receive |
88 | * frame size in bytes. Having this hardcoded means that there | ||
89 | * is no support for MTU sizes greater than 1500. */ | ||
90 | #define KORINA_RBSIZE 1536 /* size of one resource buffer = Ether MTU */ | ||
88 | #define KORINA_RDS_MASK (KORINA_NUM_RDS - 1) | 91 | #define KORINA_RDS_MASK (KORINA_NUM_RDS - 1) |
89 | #define KORINA_TDS_MASK (KORINA_NUM_TDS - 1) | 92 | #define KORINA_TDS_MASK (KORINA_NUM_TDS - 1) |
90 | #define RD_RING_SIZE (KORINA_NUM_RDS * sizeof(struct dma_desc)) | 93 | #define RD_RING_SIZE (KORINA_NUM_RDS * sizeof(struct dma_desc)) |
@@ -196,7 +199,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
196 | struct korina_private *lp = netdev_priv(dev); | 199 | struct korina_private *lp = netdev_priv(dev); |
197 | unsigned long flags; | 200 | unsigned long flags; |
198 | u32 length; | 201 | u32 length; |
199 | u32 chain_index; | 202 | u32 chain_prev, chain_next; |
200 | struct dma_desc *td; | 203 | struct dma_desc *td; |
201 | 204 | ||
202 | spin_lock_irqsave(&lp->lock, flags); | 205 | spin_lock_irqsave(&lp->lock, flags); |
@@ -228,8 +231,8 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
228 | /* Setup the transmit descriptor. */ | 231 | /* Setup the transmit descriptor. */ |
229 | dma_cache_inv((u32) td, sizeof(*td)); | 232 | dma_cache_inv((u32) td, sizeof(*td)); |
230 | td->ca = CPHYSADDR(skb->data); | 233 | td->ca = CPHYSADDR(skb->data); |
231 | chain_index = (lp->tx_chain_tail - 1) & | 234 | chain_prev = (lp->tx_chain_tail - 1) & KORINA_TDS_MASK; |
232 | KORINA_TDS_MASK; | 235 | chain_next = (lp->tx_chain_tail + 1) & KORINA_TDS_MASK; |
233 | 236 | ||
234 | if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) { | 237 | if (readl(&(lp->tx_dma_regs->dmandptr)) == 0) { |
235 | if (lp->tx_chain_status == desc_empty) { | 238 | if (lp->tx_chain_status == desc_empty) { |
@@ -237,7 +240,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
237 | td->control = DMA_COUNT(length) | | 240 | td->control = DMA_COUNT(length) | |
238 | DMA_DESC_COF | DMA_DESC_IOF; | 241 | DMA_DESC_COF | DMA_DESC_IOF; |
239 | /* Move tail */ | 242 | /* Move tail */ |
240 | lp->tx_chain_tail = chain_index; | 243 | lp->tx_chain_tail = chain_next; |
241 | /* Write to NDPTR */ | 244 | /* Write to NDPTR */ |
242 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), | 245 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), |
243 | &lp->tx_dma_regs->dmandptr); | 246 | &lp->tx_dma_regs->dmandptr); |
@@ -248,12 +251,12 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
248 | td->control = DMA_COUNT(length) | | 251 | td->control = DMA_COUNT(length) | |
249 | DMA_DESC_COF | DMA_DESC_IOF; | 252 | DMA_DESC_COF | DMA_DESC_IOF; |
250 | /* Link to prev */ | 253 | /* Link to prev */ |
251 | lp->td_ring[chain_index].control &= | 254 | lp->td_ring[chain_prev].control &= |
252 | ~DMA_DESC_COF; | 255 | ~DMA_DESC_COF; |
253 | /* Link to prev */ | 256 | /* Link to prev */ |
254 | lp->td_ring[chain_index].link = CPHYSADDR(td); | 257 | lp->td_ring[chain_prev].link = CPHYSADDR(td); |
255 | /* Move tail */ | 258 | /* Move tail */ |
256 | lp->tx_chain_tail = chain_index; | 259 | lp->tx_chain_tail = chain_next; |
257 | /* Write to NDPTR */ | 260 | /* Write to NDPTR */ |
258 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), | 261 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), |
259 | &(lp->tx_dma_regs->dmandptr)); | 262 | &(lp->tx_dma_regs->dmandptr)); |
@@ -267,17 +270,16 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
267 | td->control = DMA_COUNT(length) | | 270 | td->control = DMA_COUNT(length) | |
268 | DMA_DESC_COF | DMA_DESC_IOF; | 271 | DMA_DESC_COF | DMA_DESC_IOF; |
269 | /* Move tail */ | 272 | /* Move tail */ |
270 | lp->tx_chain_tail = chain_index; | 273 | lp->tx_chain_tail = chain_next; |
271 | lp->tx_chain_status = desc_filled; | 274 | lp->tx_chain_status = desc_filled; |
272 | netif_stop_queue(dev); | ||
273 | } else { | 275 | } else { |
274 | /* Update tail */ | 276 | /* Update tail */ |
275 | td->control = DMA_COUNT(length) | | 277 | td->control = DMA_COUNT(length) | |
276 | DMA_DESC_COF | DMA_DESC_IOF; | 278 | DMA_DESC_COF | DMA_DESC_IOF; |
277 | lp->td_ring[chain_index].control &= | 279 | lp->td_ring[chain_prev].control &= |
278 | ~DMA_DESC_COF; | 280 | ~DMA_DESC_COF; |
279 | lp->td_ring[chain_index].link = CPHYSADDR(td); | 281 | lp->td_ring[chain_prev].link = CPHYSADDR(td); |
280 | lp->tx_chain_tail = chain_index; | 282 | lp->tx_chain_tail = chain_next; |
281 | } | 283 | } |
282 | } | 284 | } |
283 | dma_cache_wback((u32) td, sizeof(*td)); | 285 | dma_cache_wback((u32) td, sizeof(*td)); |
@@ -327,13 +329,13 @@ static irqreturn_t korina_rx_dma_interrupt(int irq, void *dev_id) | |||
327 | 329 | ||
328 | dmas = readl(&lp->rx_dma_regs->dmas); | 330 | dmas = readl(&lp->rx_dma_regs->dmas); |
329 | if (dmas & (DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR)) { | 331 | if (dmas & (DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR)) { |
330 | netif_rx_schedule_prep(&lp->napi); | ||
331 | |||
332 | dmasm = readl(&lp->rx_dma_regs->dmasm); | 332 | dmasm = readl(&lp->rx_dma_regs->dmasm); |
333 | writel(dmasm | (DMA_STAT_DONE | | 333 | writel(dmasm | (DMA_STAT_DONE | |
334 | DMA_STAT_HALT | DMA_STAT_ERR), | 334 | DMA_STAT_HALT | DMA_STAT_ERR), |
335 | &lp->rx_dma_regs->dmasm); | 335 | &lp->rx_dma_regs->dmasm); |
336 | 336 | ||
337 | netif_rx_schedule(&lp->napi); | ||
338 | |||
337 | if (dmas & DMA_STAT_ERR) | 339 | if (dmas & DMA_STAT_ERR) |
338 | printk(KERN_ERR DRV_NAME "%s: DMA error\n", dev->name); | 340 | printk(KERN_ERR DRV_NAME "%s: DMA error\n", dev->name); |
339 | 341 | ||
@@ -350,15 +352,20 @@ static int korina_rx(struct net_device *dev, int limit) | |||
350 | struct dma_desc *rd = &lp->rd_ring[lp->rx_next_done]; | 352 | struct dma_desc *rd = &lp->rd_ring[lp->rx_next_done]; |
351 | struct sk_buff *skb, *skb_new; | 353 | struct sk_buff *skb, *skb_new; |
352 | u8 *pkt_buf; | 354 | u8 *pkt_buf; |
353 | u32 devcs, pkt_len, dmas, rx_free_desc; | 355 | u32 devcs, pkt_len, dmas; |
354 | int count; | 356 | int count; |
355 | 357 | ||
356 | dma_cache_inv((u32)rd, sizeof(*rd)); | 358 | dma_cache_inv((u32)rd, sizeof(*rd)); |
357 | 359 | ||
358 | for (count = 0; count < limit; count++) { | 360 | for (count = 0; count < limit; count++) { |
361 | skb = lp->rx_skb[lp->rx_next_done]; | ||
362 | skb_new = NULL; | ||
359 | 363 | ||
360 | devcs = rd->devcs; | 364 | devcs = rd->devcs; |
361 | 365 | ||
366 | if ((KORINA_RBSIZE - (u32)DMA_COUNT(rd->control)) == 0) | ||
367 | break; | ||
368 | |||
362 | /* Update statistics counters */ | 369 | /* Update statistics counters */ |
363 | if (devcs & ETH_RX_CRC) | 370 | if (devcs & ETH_RX_CRC) |
364 | dev->stats.rx_crc_errors++; | 371 | dev->stats.rx_crc_errors++; |
@@ -381,63 +388,55 @@ static int korina_rx(struct net_device *dev, int limit) | |||
381 | * in Rc32434 (errata ref #077) */ | 388 | * in Rc32434 (errata ref #077) */ |
382 | dev->stats.rx_errors++; | 389 | dev->stats.rx_errors++; |
383 | dev->stats.rx_dropped++; | 390 | dev->stats.rx_dropped++; |
384 | } | 391 | } else if ((devcs & ETH_RX_ROK)) { |
385 | |||
386 | while ((rx_free_desc = KORINA_RBSIZE - (u32)DMA_COUNT(rd->control)) != 0) { | ||
387 | /* init the var. used for the later | ||
388 | * operations within the while loop */ | ||
389 | skb_new = NULL; | ||
390 | pkt_len = RCVPKT_LENGTH(devcs); | 392 | pkt_len = RCVPKT_LENGTH(devcs); |
391 | skb = lp->rx_skb[lp->rx_next_done]; | 393 | |
392 | 394 | /* must be the (first and) last | |
393 | if ((devcs & ETH_RX_ROK)) { | 395 | * descriptor then */ |
394 | /* must be the (first and) last | 396 | pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data; |
395 | * descriptor then */ | 397 | |
396 | pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data; | 398 | /* invalidate the cache */ |
397 | 399 | dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4); | |
398 | /* invalidate the cache */ | 400 | |
399 | dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4); | 401 | /* Malloc up new buffer. */ |
400 | 402 | skb_new = netdev_alloc_skb(dev, KORINA_RBSIZE + 2); | |
401 | /* Malloc up new buffer. */ | 403 | |
402 | skb_new = netdev_alloc_skb(dev, KORINA_RBSIZE + 2); | 404 | if (!skb_new) |
403 | 405 | break; | |
404 | if (!skb_new) | 406 | /* Do not count the CRC */ |
405 | break; | 407 | skb_put(skb, pkt_len - 4); |
406 | /* Do not count the CRC */ | 408 | skb->protocol = eth_type_trans(skb, dev); |
407 | skb_put(skb, pkt_len - 4); | 409 | |
408 | skb->protocol = eth_type_trans(skb, dev); | 410 | /* Pass the packet to upper layers */ |
409 | 411 | netif_receive_skb(skb); | |
410 | /* Pass the packet to upper layers */ | 412 | dev->stats.rx_packets++; |
411 | netif_receive_skb(skb); | 413 | dev->stats.rx_bytes += pkt_len; |
412 | dev->stats.rx_packets++; | 414 | |
413 | dev->stats.rx_bytes += pkt_len; | 415 | /* Update the mcast stats */ |
414 | 416 | if (devcs & ETH_RX_MP) | |
415 | /* Update the mcast stats */ | 417 | dev->stats.multicast++; |
416 | if (devcs & ETH_RX_MP) | 418 | |
417 | dev->stats.multicast++; | 419 | lp->rx_skb[lp->rx_next_done] = skb_new; |
418 | |||
419 | lp->rx_skb[lp->rx_next_done] = skb_new; | ||
420 | } | ||
421 | |||
422 | rd->devcs = 0; | ||
423 | |||
424 | /* Restore descriptor's curr_addr */ | ||
425 | if (skb_new) | ||
426 | rd->ca = CPHYSADDR(skb_new->data); | ||
427 | else | ||
428 | rd->ca = CPHYSADDR(skb->data); | ||
429 | |||
430 | rd->control = DMA_COUNT(KORINA_RBSIZE) | | ||
431 | DMA_DESC_COD | DMA_DESC_IOD; | ||
432 | lp->rd_ring[(lp->rx_next_done - 1) & | ||
433 | KORINA_RDS_MASK].control &= | ||
434 | ~DMA_DESC_COD; | ||
435 | |||
436 | lp->rx_next_done = (lp->rx_next_done + 1) & KORINA_RDS_MASK; | ||
437 | dma_cache_wback((u32)rd, sizeof(*rd)); | ||
438 | rd = &lp->rd_ring[lp->rx_next_done]; | ||
439 | writel(~DMA_STAT_DONE, &lp->rx_dma_regs->dmas); | ||
440 | } | 420 | } |
421 | |||
422 | rd->devcs = 0; | ||
423 | |||
424 | /* Restore descriptor's curr_addr */ | ||
425 | if (skb_new) | ||
426 | rd->ca = CPHYSADDR(skb_new->data); | ||
427 | else | ||
428 | rd->ca = CPHYSADDR(skb->data); | ||
429 | |||
430 | rd->control = DMA_COUNT(KORINA_RBSIZE) | | ||
431 | DMA_DESC_COD | DMA_DESC_IOD; | ||
432 | lp->rd_ring[(lp->rx_next_done - 1) & | ||
433 | KORINA_RDS_MASK].control &= | ||
434 | ~DMA_DESC_COD; | ||
435 | |||
436 | lp->rx_next_done = (lp->rx_next_done + 1) & KORINA_RDS_MASK; | ||
437 | dma_cache_wback((u32)rd, sizeof(*rd)); | ||
438 | rd = &lp->rd_ring[lp->rx_next_done]; | ||
439 | writel(~DMA_STAT_DONE, &lp->rx_dma_regs->dmas); | ||
441 | } | 440 | } |
442 | 441 | ||
443 | dmas = readl(&lp->rx_dma_regs->dmas); | 442 | dmas = readl(&lp->rx_dma_regs->dmas); |
@@ -623,12 +622,12 @@ korina_tx_dma_interrupt(int irq, void *dev_id) | |||
623 | dmas = readl(&lp->tx_dma_regs->dmas); | 622 | dmas = readl(&lp->tx_dma_regs->dmas); |
624 | 623 | ||
625 | if (dmas & (DMA_STAT_FINI | DMA_STAT_ERR)) { | 624 | if (dmas & (DMA_STAT_FINI | DMA_STAT_ERR)) { |
626 | korina_tx(dev); | ||
627 | |||
628 | dmasm = readl(&lp->tx_dma_regs->dmasm); | 625 | dmasm = readl(&lp->tx_dma_regs->dmasm); |
629 | writel(dmasm | (DMA_STAT_FINI | DMA_STAT_ERR), | 626 | writel(dmasm | (DMA_STAT_FINI | DMA_STAT_ERR), |
630 | &lp->tx_dma_regs->dmasm); | 627 | &lp->tx_dma_regs->dmasm); |
631 | 628 | ||
629 | korina_tx(dev); | ||
630 | |||
632 | if (lp->tx_chain_status == desc_filled && | 631 | if (lp->tx_chain_status == desc_filled && |
633 | (readl(&(lp->tx_dma_regs->dmandptr)) == 0)) { | 632 | (readl(&(lp->tx_dma_regs->dmandptr)) == 0)) { |
634 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), | 633 | writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), |
@@ -901,6 +900,8 @@ static int korina_restart(struct net_device *dev) | |||
901 | 900 | ||
902 | korina_free_ring(dev); | 901 | korina_free_ring(dev); |
903 | 902 | ||
903 | napi_disable(&lp->napi); | ||
904 | |||
904 | ret = korina_init(dev); | 905 | ret = korina_init(dev); |
905 | if (ret < 0) { | 906 | if (ret < 0) { |
906 | printk(KERN_ERR DRV_NAME "%s: cannot restart device\n", | 907 | printk(KERN_ERR DRV_NAME "%s: cannot restart device\n", |
@@ -999,14 +1000,14 @@ static int korina_open(struct net_device *dev) | |||
999 | * that handles the Done Finished | 1000 | * that handles the Done Finished |
1000 | * Ovr and Und Events */ | 1001 | * Ovr and Und Events */ |
1001 | ret = request_irq(lp->rx_irq, &korina_rx_dma_interrupt, | 1002 | ret = request_irq(lp->rx_irq, &korina_rx_dma_interrupt, |
1002 | IRQF_SHARED | IRQF_DISABLED, "Korina ethernet Rx", dev); | 1003 | IRQF_DISABLED, "Korina ethernet Rx", dev); |
1003 | if (ret < 0) { | 1004 | if (ret < 0) { |
1004 | printk(KERN_ERR DRV_NAME "%s: unable to get Rx DMA IRQ %d\n", | 1005 | printk(KERN_ERR DRV_NAME "%s: unable to get Rx DMA IRQ %d\n", |
1005 | dev->name, lp->rx_irq); | 1006 | dev->name, lp->rx_irq); |
1006 | goto err_release; | 1007 | goto err_release; |
1007 | } | 1008 | } |
1008 | ret = request_irq(lp->tx_irq, &korina_tx_dma_interrupt, | 1009 | ret = request_irq(lp->tx_irq, &korina_tx_dma_interrupt, |
1009 | IRQF_SHARED | IRQF_DISABLED, "Korina ethernet Tx", dev); | 1010 | IRQF_DISABLED, "Korina ethernet Tx", dev); |
1010 | if (ret < 0) { | 1011 | if (ret < 0) { |
1011 | printk(KERN_ERR DRV_NAME "%s: unable to get Tx DMA IRQ %d\n", | 1012 | printk(KERN_ERR DRV_NAME "%s: unable to get Tx DMA IRQ %d\n", |
1012 | dev->name, lp->tx_irq); | 1013 | dev->name, lp->tx_irq); |
@@ -1015,7 +1016,7 @@ static int korina_open(struct net_device *dev) | |||
1015 | 1016 | ||
1016 | /* Install handler for overrun error. */ | 1017 | /* Install handler for overrun error. */ |
1017 | ret = request_irq(lp->ovr_irq, &korina_ovr_interrupt, | 1018 | ret = request_irq(lp->ovr_irq, &korina_ovr_interrupt, |
1018 | IRQF_SHARED | IRQF_DISABLED, "Ethernet Overflow", dev); | 1019 | IRQF_DISABLED, "Ethernet Overflow", dev); |
1019 | if (ret < 0) { | 1020 | if (ret < 0) { |
1020 | printk(KERN_ERR DRV_NAME"%s: unable to get OVR IRQ %d\n", | 1021 | printk(KERN_ERR DRV_NAME"%s: unable to get OVR IRQ %d\n", |
1021 | dev->name, lp->ovr_irq); | 1022 | dev->name, lp->ovr_irq); |
@@ -1024,7 +1025,7 @@ static int korina_open(struct net_device *dev) | |||
1024 | 1025 | ||
1025 | /* Install handler for underflow error. */ | 1026 | /* Install handler for underflow error. */ |
1026 | ret = request_irq(lp->und_irq, &korina_und_interrupt, | 1027 | ret = request_irq(lp->und_irq, &korina_und_interrupt, |
1027 | IRQF_SHARED | IRQF_DISABLED, "Ethernet Underflow", dev); | 1028 | IRQF_DISABLED, "Ethernet Underflow", dev); |
1028 | if (ret < 0) { | 1029 | if (ret < 0) { |
1029 | printk(KERN_ERR DRV_NAME "%s: unable to get UND IRQ %d\n", | 1030 | printk(KERN_ERR DRV_NAME "%s: unable to get UND IRQ %d\n", |
1030 | dev->name, lp->und_irq); | 1031 | dev->name, lp->und_irq); |
@@ -1067,6 +1068,8 @@ static int korina_close(struct net_device *dev) | |||
1067 | 1068 | ||
1068 | korina_free_ring(dev); | 1069 | korina_free_ring(dev); |
1069 | 1070 | ||
1071 | napi_disable(&lp->napi); | ||
1072 | |||
1070 | free_irq(lp->rx_irq, dev); | 1073 | free_irq(lp->rx_irq, dev); |
1071 | free_irq(lp->tx_irq, dev); | 1074 | free_irq(lp->tx_irq, dev); |
1072 | free_irq(lp->ovr_irq, dev); | 1075 | free_irq(lp->ovr_irq, dev); |
@@ -1089,7 +1092,6 @@ static int korina_probe(struct platform_device *pdev) | |||
1089 | return -ENOMEM; | 1092 | return -ENOMEM; |
1090 | } | 1093 | } |
1091 | SET_NETDEV_DEV(dev, &pdev->dev); | 1094 | SET_NETDEV_DEV(dev, &pdev->dev); |
1092 | platform_set_drvdata(pdev, dev); | ||
1093 | lp = netdev_priv(dev); | 1095 | lp = netdev_priv(dev); |
1094 | 1096 | ||
1095 | bif->dev = dev; | 1097 | bif->dev = dev; |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index f8e601c51da..c11c568fd7d 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -308,27 +308,16 @@ struct netxen_ring_ctx { | |||
308 | #define netxen_set_cmd_desc_ctxid(cmd_desc, var) \ | 308 | #define netxen_set_cmd_desc_ctxid(cmd_desc, var) \ |
309 | ((cmd_desc)->port_ctxid |= ((var) << 4 & 0xF0)) | 309 | ((cmd_desc)->port_ctxid |= ((var) << 4 & 0xF0)) |
310 | 310 | ||
311 | #define netxen_set_cmd_desc_flags(cmd_desc, val) \ | 311 | #define netxen_set_tx_port(_desc, _port) \ |
312 | (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ | 312 | (_desc)->port_ctxid = ((_port) & 0xf) | (((_port) << 4) & 0xf0) |
313 | ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f) | 313 | |
314 | #define netxen_set_cmd_desc_opcode(cmd_desc, val) \ | 314 | #define netxen_set_tx_flags_opcode(_desc, _flags, _opcode) \ |
315 | (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ | 315 | (_desc)->flags_opcode = \ |
316 | ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7) | 316 | cpu_to_le16(((_flags) & 0x7f) | (((_opcode) & 0x3f) << 7)) |
317 | 317 | ||
318 | #define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ | 318 | #define netxen_set_tx_frags_len(_desc, _frags, _len) \ |
319 | (cmd_desc)->num_of_buffers_total_length = \ | 319 | (_desc)->num_of_buffers_total_length = \ |
320 | ((cmd_desc)->num_of_buffers_total_length & \ | 320 | cpu_to_le32(((_frags) & 0xff) | (((_len) & 0xffffff) << 8)) |
321 | ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff) | ||
322 | #define netxen_set_cmd_desc_totallength(cmd_desc, val) \ | ||
323 | (cmd_desc)->num_of_buffers_total_length = \ | ||
324 | ((cmd_desc)->num_of_buffers_total_length & \ | ||
325 | ~cpu_to_le32((u32)0xffffff << 8)) | \ | ||
326 | cpu_to_le32(((val) & 0xffffff) << 8) | ||
327 | |||
328 | #define netxen_get_cmd_desc_opcode(cmd_desc) \ | ||
329 | ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f) | ||
330 | #define netxen_get_cmd_desc_totallength(cmd_desc) \ | ||
331 | ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff) | ||
332 | 321 | ||
333 | struct cmd_desc_type0 { | 322 | struct cmd_desc_type0 { |
334 | u8 tcp_hdr_offset; /* For LSO only */ | 323 | u8 tcp_hdr_offset; /* For LSO only */ |
@@ -510,7 +499,8 @@ typedef enum { | |||
510 | NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a, | 499 | NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a, |
511 | NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b, | 500 | NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b, |
512 | NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031, | 501 | NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031, |
513 | NETXEN_BRDTYPE_P3_10G_XFP = 0x0032 | 502 | NETXEN_BRDTYPE_P3_10G_XFP = 0x0032, |
503 | NETXEN_BRDTYPE_P3_10G_TP = 0x0080 | ||
514 | 504 | ||
515 | } netxen_brdtype_t; | 505 | } netxen_brdtype_t; |
516 | 506 | ||
@@ -757,7 +747,7 @@ extern char netxen_nic_driver_name[]; | |||
757 | */ | 747 | */ |
758 | struct netxen_skb_frag { | 748 | struct netxen_skb_frag { |
759 | u64 dma; | 749 | u64 dma; |
760 | u32 length; | 750 | ulong length; |
761 | }; | 751 | }; |
762 | 752 | ||
763 | #define _netxen_set_bits(config_word, start, bits, val) {\ | 753 | #define _netxen_set_bits(config_word, start, bits, val) {\ |
@@ -783,13 +773,7 @@ struct netxen_skb_frag { | |||
783 | struct netxen_cmd_buffer { | 773 | struct netxen_cmd_buffer { |
784 | struct sk_buff *skb; | 774 | struct sk_buff *skb; |
785 | struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1]; | 775 | struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1]; |
786 | u32 total_length; | 776 | u32 frag_count; |
787 | u32 mss; | ||
788 | u16 port; | ||
789 | u8 cmd; | ||
790 | u8 frag_count; | ||
791 | unsigned long time_stamp; | ||
792 | u32 state; | ||
793 | }; | 777 | }; |
794 | 778 | ||
795 | /* In rx_buffer, we do not need multiple fragments as is a single buffer */ | 779 | /* In rx_buffer, we do not need multiple fragments as is a single buffer */ |
@@ -876,7 +860,6 @@ struct nx_host_rds_ring { | |||
876 | u32 skb_size; | 860 | u32 skb_size; |
877 | struct netxen_rx_buffer *rx_buf_arr; /* rx buffers for receive */ | 861 | struct netxen_rx_buffer *rx_buf_arr; /* rx buffers for receive */ |
878 | struct list_head free_list; | 862 | struct list_head free_list; |
879 | int begin_alloc; | ||
880 | }; | 863 | }; |
881 | 864 | ||
882 | /* | 865 | /* |
@@ -995,31 +978,31 @@ struct netxen_recv_context { | |||
995 | */ | 978 | */ |
996 | 979 | ||
997 | typedef struct { | 980 | typedef struct { |
998 | u64 host_phys_addr; /* Ring base addr */ | 981 | __le64 host_phys_addr; /* Ring base addr */ |
999 | u32 ring_size; /* Ring entries */ | 982 | __le32 ring_size; /* Ring entries */ |
1000 | u16 msi_index; | 983 | __le16 msi_index; |
1001 | u16 rsvd; /* Padding */ | 984 | __le16 rsvd; /* Padding */ |
1002 | } nx_hostrq_sds_ring_t; | 985 | } nx_hostrq_sds_ring_t; |
1003 | 986 | ||
1004 | typedef struct { | 987 | typedef struct { |
1005 | u64 host_phys_addr; /* Ring base addr */ | 988 | __le64 host_phys_addr; /* Ring base addr */ |
1006 | u64 buff_size; /* Packet buffer size */ | 989 | __le64 buff_size; /* Packet buffer size */ |
1007 | u32 ring_size; /* Ring entries */ | 990 | __le32 ring_size; /* Ring entries */ |
1008 | u32 ring_kind; /* Class of ring */ | 991 | __le32 ring_kind; /* Class of ring */ |
1009 | } nx_hostrq_rds_ring_t; | 992 | } nx_hostrq_rds_ring_t; |
1010 | 993 | ||
1011 | typedef struct { | 994 | typedef struct { |
1012 | u64 host_rsp_dma_addr; /* Response dma'd here */ | 995 | __le64 host_rsp_dma_addr; /* Response dma'd here */ |
1013 | u32 capabilities[4]; /* Flag bit vector */ | 996 | __le32 capabilities[4]; /* Flag bit vector */ |
1014 | u32 host_int_crb_mode; /* Interrupt crb usage */ | 997 | __le32 host_int_crb_mode; /* Interrupt crb usage */ |
1015 | u32 host_rds_crb_mode; /* RDS crb usage */ | 998 | __le32 host_rds_crb_mode; /* RDS crb usage */ |
1016 | /* These ring offsets are relative to data[0] below */ | 999 | /* These ring offsets are relative to data[0] below */ |
1017 | u32 rds_ring_offset; /* Offset to RDS config */ | 1000 | __le32 rds_ring_offset; /* Offset to RDS config */ |
1018 | u32 sds_ring_offset; /* Offset to SDS config */ | 1001 | __le32 sds_ring_offset; /* Offset to SDS config */ |
1019 | u16 num_rds_rings; /* Count of RDS rings */ | 1002 | __le16 num_rds_rings; /* Count of RDS rings */ |
1020 | u16 num_sds_rings; /* Count of SDS rings */ | 1003 | __le16 num_sds_rings; /* Count of SDS rings */ |
1021 | u16 rsvd1; /* Padding */ | 1004 | __le16 rsvd1; /* Padding */ |
1022 | u16 rsvd2; /* Padding */ | 1005 | __le16 rsvd2; /* Padding */ |
1023 | u8 reserved[128]; /* reserve space for future expansion*/ | 1006 | u8 reserved[128]; /* reserve space for future expansion*/ |
1024 | /* MUST BE 64-bit aligned. | 1007 | /* MUST BE 64-bit aligned. |
1025 | The following is packed: | 1008 | The following is packed: |
@@ -1029,24 +1012,24 @@ typedef struct { | |||
1029 | } nx_hostrq_rx_ctx_t; | 1012 | } nx_hostrq_rx_ctx_t; |
1030 | 1013 | ||
1031 | typedef struct { | 1014 | typedef struct { |
1032 | u32 host_producer_crb; /* Crb to use */ | 1015 | __le32 host_producer_crb; /* Crb to use */ |
1033 | u32 rsvd1; /* Padding */ | 1016 | __le32 rsvd1; /* Padding */ |
1034 | } nx_cardrsp_rds_ring_t; | 1017 | } nx_cardrsp_rds_ring_t; |
1035 | 1018 | ||
1036 | typedef struct { | 1019 | typedef struct { |
1037 | u32 host_consumer_crb; /* Crb to use */ | 1020 | __le32 host_consumer_crb; /* Crb to use */ |
1038 | u32 interrupt_crb; /* Crb to use */ | 1021 | __le32 interrupt_crb; /* Crb to use */ |
1039 | } nx_cardrsp_sds_ring_t; | 1022 | } nx_cardrsp_sds_ring_t; |
1040 | 1023 | ||
1041 | typedef struct { | 1024 | typedef struct { |
1042 | /* These ring offsets are relative to data[0] below */ | 1025 | /* These ring offsets are relative to data[0] below */ |
1043 | u32 rds_ring_offset; /* Offset to RDS config */ | 1026 | __le32 rds_ring_offset; /* Offset to RDS config */ |
1044 | u32 sds_ring_offset; /* Offset to SDS config */ | 1027 | __le32 sds_ring_offset; /* Offset to SDS config */ |
1045 | u32 host_ctx_state; /* Starting State */ | 1028 | __le32 host_ctx_state; /* Starting State */ |
1046 | u32 num_fn_per_port; /* How many PCI fn share the port */ | 1029 | __le32 num_fn_per_port; /* How many PCI fn share the port */ |
1047 | u16 num_rds_rings; /* Count of RDS rings */ | 1030 | __le16 num_rds_rings; /* Count of RDS rings */ |
1048 | u16 num_sds_rings; /* Count of SDS rings */ | 1031 | __le16 num_sds_rings; /* Count of SDS rings */ |
1049 | u16 context_id; /* Handle for context */ | 1032 | __le16 context_id; /* Handle for context */ |
1050 | u8 phys_port; /* Physical id of port */ | 1033 | u8 phys_port; /* Physical id of port */ |
1051 | u8 virt_port; /* Virtual/Logical id of port */ | 1034 | u8 virt_port; /* Virtual/Logical id of port */ |
1052 | u8 reserved[128]; /* save space for future expansion */ | 1035 | u8 reserved[128]; /* save space for future expansion */ |
@@ -1072,34 +1055,34 @@ typedef struct { | |||
1072 | */ | 1055 | */ |
1073 | 1056 | ||
1074 | typedef struct { | 1057 | typedef struct { |
1075 | u64 host_phys_addr; /* Ring base addr */ | 1058 | __le64 host_phys_addr; /* Ring base addr */ |
1076 | u32 ring_size; /* Ring entries */ | 1059 | __le32 ring_size; /* Ring entries */ |
1077 | u32 rsvd; /* Padding */ | 1060 | __le32 rsvd; /* Padding */ |
1078 | } nx_hostrq_cds_ring_t; | 1061 | } nx_hostrq_cds_ring_t; |
1079 | 1062 | ||
1080 | typedef struct { | 1063 | typedef struct { |
1081 | u64 host_rsp_dma_addr; /* Response dma'd here */ | 1064 | __le64 host_rsp_dma_addr; /* Response dma'd here */ |
1082 | u64 cmd_cons_dma_addr; /* */ | 1065 | __le64 cmd_cons_dma_addr; /* */ |
1083 | u64 dummy_dma_addr; /* */ | 1066 | __le64 dummy_dma_addr; /* */ |
1084 | u32 capabilities[4]; /* Flag bit vector */ | 1067 | __le32 capabilities[4]; /* Flag bit vector */ |
1085 | u32 host_int_crb_mode; /* Interrupt crb usage */ | 1068 | __le32 host_int_crb_mode; /* Interrupt crb usage */ |
1086 | u32 rsvd1; /* Padding */ | 1069 | __le32 rsvd1; /* Padding */ |
1087 | u16 rsvd2; /* Padding */ | 1070 | __le16 rsvd2; /* Padding */ |
1088 | u16 interrupt_ctl; | 1071 | __le16 interrupt_ctl; |
1089 | u16 msi_index; | 1072 | __le16 msi_index; |
1090 | u16 rsvd3; /* Padding */ | 1073 | __le16 rsvd3; /* Padding */ |
1091 | nx_hostrq_cds_ring_t cds_ring; /* Desc of cds ring */ | 1074 | nx_hostrq_cds_ring_t cds_ring; /* Desc of cds ring */ |
1092 | u8 reserved[128]; /* future expansion */ | 1075 | u8 reserved[128]; /* future expansion */ |
1093 | } nx_hostrq_tx_ctx_t; | 1076 | } nx_hostrq_tx_ctx_t; |
1094 | 1077 | ||
1095 | typedef struct { | 1078 | typedef struct { |
1096 | u32 host_producer_crb; /* Crb to use */ | 1079 | __le32 host_producer_crb; /* Crb to use */ |
1097 | u32 interrupt_crb; /* Crb to use */ | 1080 | __le32 interrupt_crb; /* Crb to use */ |
1098 | } nx_cardrsp_cds_ring_t; | 1081 | } nx_cardrsp_cds_ring_t; |
1099 | 1082 | ||
1100 | typedef struct { | 1083 | typedef struct { |
1101 | u32 host_ctx_state; /* Starting state */ | 1084 | __le32 host_ctx_state; /* Starting state */ |
1102 | u16 context_id; /* Handle for context */ | 1085 | __le16 context_id; /* Handle for context */ |
1103 | u8 phys_port; /* Physical id of port */ | 1086 | u8 phys_port; /* Physical id of port */ |
1104 | u8 virt_port; /* Virtual/Logical id of port */ | 1087 | u8 virt_port; /* Virtual/Logical id of port */ |
1105 | nx_cardrsp_cds_ring_t cds_ring; /* Card cds settings */ | 1088 | nx_cardrsp_cds_ring_t cds_ring; /* Card cds settings */ |
@@ -1202,9 +1185,9 @@ enum { | |||
1202 | #define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */ | 1185 | #define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */ |
1203 | 1186 | ||
1204 | typedef struct { | 1187 | typedef struct { |
1205 | u64 qhdr; | 1188 | __le64 qhdr; |
1206 | u64 req_hdr; | 1189 | __le64 req_hdr; |
1207 | u64 words[6]; | 1190 | __le64 words[6]; |
1208 | } nx_nic_req_t; | 1191 | } nx_nic_req_t; |
1209 | 1192 | ||
1210 | typedef struct { | 1193 | typedef struct { |
@@ -1486,8 +1469,6 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter); | |||
1486 | 1469 | ||
1487 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); | 1470 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); |
1488 | int netxen_init_firmware(struct netxen_adapter *adapter); | 1471 | int netxen_init_firmware(struct netxen_adapter *adapter); |
1489 | void netxen_tso_check(struct netxen_adapter *adapter, | ||
1490 | struct cmd_desc_type0 *desc, struct sk_buff *skb); | ||
1491 | void netxen_nic_clear_stats(struct netxen_adapter *adapter); | 1472 | void netxen_nic_clear_stats(struct netxen_adapter *adapter); |
1492 | void netxen_watchdog_task(struct work_struct *work); | 1473 | void netxen_watchdog_task(struct work_struct *work); |
1493 | void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, | 1474 | void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, |
@@ -1496,6 +1477,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter); | |||
1496 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); | 1477 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); |
1497 | void netxen_p2_nic_set_multi(struct net_device *netdev); | 1478 | void netxen_p2_nic_set_multi(struct net_device *netdev); |
1498 | void netxen_p3_nic_set_multi(struct net_device *netdev); | 1479 | void netxen_p3_nic_set_multi(struct net_device *netdev); |
1480 | void netxen_p3_free_mac_list(struct netxen_adapter *adapter); | ||
1499 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32); | 1481 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32); |
1500 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter); | 1482 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter); |
1501 | 1483 | ||
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c index 64b51643c62..746bdb47041 100644 --- a/drivers/net/netxen/netxen_nic_ctx.c +++ b/drivers/net/netxen/netxen_nic_ctx.c | |||
@@ -76,7 +76,7 @@ netxen_api_unlock(struct netxen_adapter *adapter) | |||
76 | static u32 | 76 | static u32 |
77 | netxen_poll_rsp(struct netxen_adapter *adapter) | 77 | netxen_poll_rsp(struct netxen_adapter *adapter) |
78 | { | 78 | { |
79 | u32 raw_rsp, rsp = NX_CDRP_RSP_OK; | 79 | u32 rsp = NX_CDRP_RSP_OK; |
80 | int timeout = 0; | 80 | int timeout = 0; |
81 | 81 | ||
82 | do { | 82 | do { |
@@ -86,10 +86,7 @@ netxen_poll_rsp(struct netxen_adapter *adapter) | |||
86 | if (++timeout > NX_OS_CRB_RETRY_COUNT) | 86 | if (++timeout > NX_OS_CRB_RETRY_COUNT) |
87 | return NX_CDRP_RSP_TIMEOUT; | 87 | return NX_CDRP_RSP_TIMEOUT; |
88 | 88 | ||
89 | netxen_nic_read_w1(adapter, NX_CDRP_CRB_OFFSET, | 89 | netxen_nic_read_w1(adapter, NX_CDRP_CRB_OFFSET, &rsp); |
90 | &raw_rsp); | ||
91 | |||
92 | rsp = le32_to_cpu(raw_rsp); | ||
93 | } while (!NX_CDRP_IS_RSP(rsp)); | 90 | } while (!NX_CDRP_IS_RSP(rsp)); |
94 | 91 | ||
95 | return rsp; | 92 | return rsp; |
@@ -109,20 +106,16 @@ netxen_issue_cmd(struct netxen_adapter *adapter, | |||
109 | if (netxen_api_lock(adapter)) | 106 | if (netxen_api_lock(adapter)) |
110 | return NX_RCODE_TIMEOUT; | 107 | return NX_RCODE_TIMEOUT; |
111 | 108 | ||
112 | netxen_nic_write_w1(adapter, NX_SIGN_CRB_OFFSET, | 109 | netxen_nic_write_w1(adapter, NX_SIGN_CRB_OFFSET, signature); |
113 | cpu_to_le32(signature)); | ||
114 | 110 | ||
115 | netxen_nic_write_w1(adapter, NX_ARG1_CRB_OFFSET, | 111 | netxen_nic_write_w1(adapter, NX_ARG1_CRB_OFFSET, arg1); |
116 | cpu_to_le32(arg1)); | ||
117 | 112 | ||
118 | netxen_nic_write_w1(adapter, NX_ARG2_CRB_OFFSET, | 113 | netxen_nic_write_w1(adapter, NX_ARG2_CRB_OFFSET, arg2); |
119 | cpu_to_le32(arg2)); | ||
120 | 114 | ||
121 | netxen_nic_write_w1(adapter, NX_ARG3_CRB_OFFSET, | 115 | netxen_nic_write_w1(adapter, NX_ARG3_CRB_OFFSET, arg3); |
122 | cpu_to_le32(arg3)); | ||
123 | 116 | ||
124 | netxen_nic_write_w1(adapter, NX_CDRP_CRB_OFFSET, | 117 | netxen_nic_write_w1(adapter, NX_CDRP_CRB_OFFSET, |
125 | cpu_to_le32(NX_CDRP_FORM_CMD(cmd))); | 118 | NX_CDRP_FORM_CMD(cmd)); |
126 | 119 | ||
127 | rsp = netxen_poll_rsp(adapter); | 120 | rsp = netxen_poll_rsp(adapter); |
128 | 121 | ||
@@ -133,7 +126,6 @@ netxen_issue_cmd(struct netxen_adapter *adapter, | |||
133 | rcode = NX_RCODE_TIMEOUT; | 126 | rcode = NX_RCODE_TIMEOUT; |
134 | } else if (rsp == NX_CDRP_RSP_FAIL) { | 127 | } else if (rsp == NX_CDRP_RSP_FAIL) { |
135 | netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &rcode); | 128 | netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &rcode); |
136 | rcode = le32_to_cpu(rcode); | ||
137 | 129 | ||
138 | printk(KERN_ERR "%s: failed card response code:0x%x\n", | 130 | printk(KERN_ERR "%s: failed card response code:0x%x\n", |
139 | netxen_nic_driver_name, rcode); | 131 | netxen_nic_driver_name, rcode); |
@@ -183,7 +175,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
183 | 175 | ||
184 | int i, nrds_rings, nsds_rings; | 176 | int i, nrds_rings, nsds_rings; |
185 | size_t rq_size, rsp_size; | 177 | size_t rq_size, rsp_size; |
186 | u32 cap, reg; | 178 | u32 cap, reg, val; |
187 | 179 | ||
188 | int err; | 180 | int err; |
189 | 181 | ||
@@ -225,11 +217,14 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
225 | 217 | ||
226 | prq->num_rds_rings = cpu_to_le16(nrds_rings); | 218 | prq->num_rds_rings = cpu_to_le16(nrds_rings); |
227 | prq->num_sds_rings = cpu_to_le16(nsds_rings); | 219 | prq->num_sds_rings = cpu_to_le16(nsds_rings); |
228 | prq->rds_ring_offset = 0; | 220 | prq->rds_ring_offset = cpu_to_le32(0); |
229 | prq->sds_ring_offset = prq->rds_ring_offset + | 221 | |
222 | val = le32_to_cpu(prq->rds_ring_offset) + | ||
230 | (sizeof(nx_hostrq_rds_ring_t) * nrds_rings); | 223 | (sizeof(nx_hostrq_rds_ring_t) * nrds_rings); |
224 | prq->sds_ring_offset = cpu_to_le32(val); | ||
231 | 225 | ||
232 | prq_rds = (nx_hostrq_rds_ring_t *)(prq->data + prq->rds_ring_offset); | 226 | prq_rds = (nx_hostrq_rds_ring_t *)(prq->data + |
227 | le32_to_cpu(prq->rds_ring_offset)); | ||
233 | 228 | ||
234 | for (i = 0; i < nrds_rings; i++) { | 229 | for (i = 0; i < nrds_rings; i++) { |
235 | 230 | ||
@@ -241,17 +236,14 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
241 | prq_rds[i].buff_size = cpu_to_le64(rds_ring->dma_size); | 236 | prq_rds[i].buff_size = cpu_to_le64(rds_ring->dma_size); |
242 | } | 237 | } |
243 | 238 | ||
244 | prq_sds = (nx_hostrq_sds_ring_t *)(prq->data + prq->sds_ring_offset); | 239 | prq_sds = (nx_hostrq_sds_ring_t *)(prq->data + |
240 | le32_to_cpu(prq->sds_ring_offset)); | ||
245 | 241 | ||
246 | prq_sds[0].host_phys_addr = | 242 | prq_sds[0].host_phys_addr = |
247 | cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr); | 243 | cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr); |
248 | prq_sds[0].ring_size = cpu_to_le32(adapter->max_rx_desc_count); | 244 | prq_sds[0].ring_size = cpu_to_le32(adapter->max_rx_desc_count); |
249 | /* only one msix vector for now */ | 245 | /* only one msix vector for now */ |
250 | prq_sds[0].msi_index = cpu_to_le32(0); | 246 | prq_sds[0].msi_index = cpu_to_le16(0); |
251 | |||
252 | /* now byteswap offsets */ | ||
253 | prq->rds_ring_offset = cpu_to_le32(prq->rds_ring_offset); | ||
254 | prq->sds_ring_offset = cpu_to_le32(prq->sds_ring_offset); | ||
255 | 247 | ||
256 | phys_addr = hostrq_phys_addr; | 248 | phys_addr = hostrq_phys_addr; |
257 | err = netxen_issue_cmd(adapter, | 249 | err = netxen_issue_cmd(adapter, |
@@ -269,9 +261,9 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
269 | 261 | ||
270 | 262 | ||
271 | prsp_rds = ((nx_cardrsp_rds_ring_t *) | 263 | prsp_rds = ((nx_cardrsp_rds_ring_t *) |
272 | &prsp->data[prsp->rds_ring_offset]); | 264 | &prsp->data[le32_to_cpu(prsp->rds_ring_offset)]); |
273 | 265 | ||
274 | for (i = 0; i < le32_to_cpu(prsp->num_rds_rings); i++) { | 266 | for (i = 0; i < le16_to_cpu(prsp->num_rds_rings); i++) { |
275 | rds_ring = &recv_ctx->rds_rings[i]; | 267 | rds_ring = &recv_ctx->rds_rings[i]; |
276 | 268 | ||
277 | reg = le32_to_cpu(prsp_rds[i].host_producer_crb); | 269 | reg = le32_to_cpu(prsp_rds[i].host_producer_crb); |
@@ -279,7 +271,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
279 | } | 271 | } |
280 | 272 | ||
281 | prsp_sds = ((nx_cardrsp_sds_ring_t *) | 273 | prsp_sds = ((nx_cardrsp_sds_ring_t *) |
282 | &prsp->data[prsp->sds_ring_offset]); | 274 | &prsp->data[le32_to_cpu(prsp->sds_ring_offset)]); |
283 | reg = le32_to_cpu(prsp_sds[0].host_consumer_crb); | 275 | reg = le32_to_cpu(prsp_sds[0].host_consumer_crb); |
284 | recv_ctx->crb_sts_consumer = NETXEN_NIC_REG(reg - 0x200); | 276 | recv_ctx->crb_sts_consumer = NETXEN_NIC_REG(reg - 0x200); |
285 | 277 | ||
@@ -288,7 +280,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
288 | 280 | ||
289 | recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); | 281 | recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); |
290 | recv_ctx->context_id = le16_to_cpu(prsp->context_id); | 282 | recv_ctx->context_id = le16_to_cpu(prsp->context_id); |
291 | recv_ctx->virt_port = le16_to_cpu(prsp->virt_port); | 283 | recv_ctx->virt_port = prsp->virt_port; |
292 | 284 | ||
293 | out_free_rsp: | 285 | out_free_rsp: |
294 | pci_free_consistent(adapter->pdev, rsp_size, prsp, cardrsp_phys_addr); | 286 | pci_free_consistent(adapter->pdev, rsp_size, prsp, cardrsp_phys_addr); |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index e45ce295172..c0bd40fcf70 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -136,11 +136,9 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
136 | 136 | ||
137 | ecmd->port = PORT_TP; | 137 | ecmd->port = PORT_TP; |
138 | 138 | ||
139 | if (netif_running(dev)) { | 139 | ecmd->speed = adapter->link_speed; |
140 | ecmd->speed = adapter->link_speed; | 140 | ecmd->duplex = adapter->link_duplex; |
141 | ecmd->duplex = adapter->link_duplex; | 141 | ecmd->autoneg = adapter->link_autoneg; |
142 | ecmd->autoneg = adapter->link_autoneg; | ||
143 | } | ||
144 | 142 | ||
145 | } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { | 143 | } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { |
146 | u32 val; | 144 | u32 val; |
@@ -171,7 +169,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
171 | } else | 169 | } else |
172 | return -EIO; | 170 | return -EIO; |
173 | 171 | ||
174 | ecmd->phy_address = adapter->portnum; | 172 | ecmd->phy_address = adapter->physical_port; |
175 | ecmd->transceiver = XCVR_EXTERNAL; | 173 | ecmd->transceiver = XCVR_EXTERNAL; |
176 | 174 | ||
177 | switch ((netxen_brdtype_t) boardinfo->board_type) { | 175 | switch ((netxen_brdtype_t) boardinfo->board_type) { |
@@ -180,13 +178,13 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
180 | case NETXEN_BRDTYPE_P3_REF_QG: | 178 | case NETXEN_BRDTYPE_P3_REF_QG: |
181 | case NETXEN_BRDTYPE_P3_4_GB: | 179 | case NETXEN_BRDTYPE_P3_4_GB: |
182 | case NETXEN_BRDTYPE_P3_4_GB_MM: | 180 | case NETXEN_BRDTYPE_P3_4_GB_MM: |
183 | case NETXEN_BRDTYPE_P3_10000_BASE_T: | ||
184 | 181 | ||
185 | ecmd->supported |= SUPPORTED_Autoneg; | 182 | ecmd->supported |= SUPPORTED_Autoneg; |
186 | ecmd->advertising |= ADVERTISED_Autoneg; | 183 | ecmd->advertising |= ADVERTISED_Autoneg; |
187 | case NETXEN_BRDTYPE_P2_SB31_10G_CX4: | 184 | case NETXEN_BRDTYPE_P2_SB31_10G_CX4: |
188 | case NETXEN_BRDTYPE_P3_10G_CX4: | 185 | case NETXEN_BRDTYPE_P3_10G_CX4: |
189 | case NETXEN_BRDTYPE_P3_10G_CX4_LP: | 186 | case NETXEN_BRDTYPE_P3_10G_CX4_LP: |
187 | case NETXEN_BRDTYPE_P3_10000_BASE_T: | ||
190 | ecmd->supported |= SUPPORTED_TP; | 188 | ecmd->supported |= SUPPORTED_TP; |
191 | ecmd->advertising |= ADVERTISED_TP; | 189 | ecmd->advertising |= ADVERTISED_TP; |
192 | ecmd->port = PORT_TP; | 190 | ecmd->port = PORT_TP; |
@@ -204,16 +202,33 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
204 | ecmd->port = PORT_FIBRE; | 202 | ecmd->port = PORT_FIBRE; |
205 | ecmd->autoneg = AUTONEG_DISABLE; | 203 | ecmd->autoneg = AUTONEG_DISABLE; |
206 | break; | 204 | break; |
207 | case NETXEN_BRDTYPE_P2_SB31_10G: | ||
208 | case NETXEN_BRDTYPE_P3_10G_SFP_PLUS: | 205 | case NETXEN_BRDTYPE_P3_10G_SFP_PLUS: |
209 | case NETXEN_BRDTYPE_P3_10G_SFP_CT: | 206 | case NETXEN_BRDTYPE_P3_10G_SFP_CT: |
210 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: | 207 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: |
208 | ecmd->advertising |= ADVERTISED_TP; | ||
209 | ecmd->supported |= SUPPORTED_TP; | ||
210 | case NETXEN_BRDTYPE_P2_SB31_10G: | ||
211 | case NETXEN_BRDTYPE_P3_10G_XFP: | 211 | case NETXEN_BRDTYPE_P3_10G_XFP: |
212 | ecmd->supported |= SUPPORTED_FIBRE; | 212 | ecmd->supported |= SUPPORTED_FIBRE; |
213 | ecmd->advertising |= ADVERTISED_FIBRE; | 213 | ecmd->advertising |= ADVERTISED_FIBRE; |
214 | ecmd->port = PORT_FIBRE; | 214 | ecmd->port = PORT_FIBRE; |
215 | ecmd->autoneg = AUTONEG_DISABLE; | 215 | ecmd->autoneg = AUTONEG_DISABLE; |
216 | break; | 216 | break; |
217 | case NETXEN_BRDTYPE_P3_10G_TP: | ||
218 | if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { | ||
219 | ecmd->autoneg = AUTONEG_DISABLE; | ||
220 | ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP); | ||
221 | ecmd->advertising |= | ||
222 | (ADVERTISED_FIBRE | ADVERTISED_TP); | ||
223 | ecmd->port = PORT_FIBRE; | ||
224 | } else { | ||
225 | ecmd->autoneg = AUTONEG_ENABLE; | ||
226 | ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg); | ||
227 | ecmd->advertising |= | ||
228 | (ADVERTISED_TP | ADVERTISED_Autoneg); | ||
229 | ecmd->port = PORT_TP; | ||
230 | } | ||
231 | break; | ||
217 | default: | 232 | default: |
218 | printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", | 233 | printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", |
219 | (netxen_brdtype_t) boardinfo->board_type); | 234 | (netxen_brdtype_t) boardinfo->board_type); |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index aa6e603bfcb..821cff68b3f 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -503,17 +503,15 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter, | |||
503 | 503 | ||
504 | i = 0; | 504 | i = 0; |
505 | 505 | ||
506 | netif_tx_lock_bh(adapter->netdev); | ||
507 | |||
506 | producer = adapter->cmd_producer; | 508 | producer = adapter->cmd_producer; |
507 | do { | 509 | do { |
508 | cmd_desc = &cmd_desc_arr[i]; | 510 | cmd_desc = &cmd_desc_arr[i]; |
509 | 511 | ||
510 | pbuf = &adapter->cmd_buf_arr[producer]; | 512 | pbuf = &adapter->cmd_buf_arr[producer]; |
511 | pbuf->mss = 0; | ||
512 | pbuf->total_length = 0; | ||
513 | pbuf->skb = NULL; | 513 | pbuf->skb = NULL; |
514 | pbuf->cmd = 0; | ||
515 | pbuf->frag_count = 0; | 514 | pbuf->frag_count = 0; |
516 | pbuf->port = 0; | ||
517 | 515 | ||
518 | /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */ | 516 | /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */ |
519 | memcpy(&adapter->ahw.cmd_desc_head[producer], | 517 | memcpy(&adapter->ahw.cmd_desc_head[producer], |
@@ -531,6 +529,8 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter, | |||
531 | 529 | ||
532 | netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); | 530 | netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); |
533 | 531 | ||
532 | netif_tx_unlock_bh(adapter->netdev); | ||
533 | |||
534 | return 0; | 534 | return 0; |
535 | } | 535 | } |
536 | 536 | ||
@@ -539,16 +539,19 @@ static int nx_p3_sre_macaddr_change(struct net_device *dev, | |||
539 | { | 539 | { |
540 | struct netxen_adapter *adapter = netdev_priv(dev); | 540 | struct netxen_adapter *adapter = netdev_priv(dev); |
541 | nx_nic_req_t req; | 541 | nx_nic_req_t req; |
542 | nx_mac_req_t mac_req; | 542 | nx_mac_req_t *mac_req; |
543 | u64 word; | ||
543 | int rv; | 544 | int rv; |
544 | 545 | ||
545 | memset(&req, 0, sizeof(nx_nic_req_t)); | 546 | memset(&req, 0, sizeof(nx_nic_req_t)); |
546 | req.qhdr |= (NX_NIC_REQUEST << 23); | 547 | req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23); |
547 | req.req_hdr |= NX_MAC_EVENT; | 548 | |
548 | req.req_hdr |= ((u64)adapter->portnum << 16); | 549 | word = NX_MAC_EVENT | ((u64)adapter->portnum << 16); |
549 | mac_req.op = op; | 550 | req.req_hdr = cpu_to_le64(word); |
550 | memcpy(&mac_req.mac_addr, addr, 6); | 551 | |
551 | req.words[0] = cpu_to_le64(*(u64 *)&mac_req); | 552 | mac_req = (nx_mac_req_t *)&req.words[0]; |
553 | mac_req->op = op; | ||
554 | memcpy(mac_req->mac_addr, addr, 6); | ||
552 | 555 | ||
553 | rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); | 556 | rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); |
554 | if (rv != 0) { | 557 | if (rv != 0) { |
@@ -612,18 +615,35 @@ send_fw_cmd: | |||
612 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | 615 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) |
613 | { | 616 | { |
614 | nx_nic_req_t req; | 617 | nx_nic_req_t req; |
618 | u64 word; | ||
615 | 619 | ||
616 | memset(&req, 0, sizeof(nx_nic_req_t)); | 620 | memset(&req, 0, sizeof(nx_nic_req_t)); |
617 | 621 | ||
618 | req.qhdr |= (NX_HOST_REQUEST << 23); | 622 | req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23); |
619 | req.req_hdr |= NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE; | 623 | |
620 | req.req_hdr |= ((u64)adapter->portnum << 16); | 624 | word = NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE | |
625 | ((u64)adapter->portnum << 16); | ||
626 | req.req_hdr = cpu_to_le64(word); | ||
627 | |||
621 | req.words[0] = cpu_to_le64(mode); | 628 | req.words[0] = cpu_to_le64(mode); |
622 | 629 | ||
623 | return netxen_send_cmd_descs(adapter, | 630 | return netxen_send_cmd_descs(adapter, |
624 | (struct cmd_desc_type0 *)&req, 1); | 631 | (struct cmd_desc_type0 *)&req, 1); |
625 | } | 632 | } |
626 | 633 | ||
634 | void netxen_p3_free_mac_list(struct netxen_adapter *adapter) | ||
635 | { | ||
636 | nx_mac_list_t *cur, *next; | ||
637 | |||
638 | cur = adapter->mac_list; | ||
639 | |||
640 | while (cur) { | ||
641 | next = cur->next; | ||
642 | kfree(cur); | ||
643 | cur = next; | ||
644 | } | ||
645 | } | ||
646 | |||
627 | #define NETXEN_CONFIG_INTR_COALESCE 3 | 647 | #define NETXEN_CONFIG_INTR_COALESCE 3 |
628 | 648 | ||
629 | /* | 649 | /* |
@@ -632,13 +652,15 @@ int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | |||
632 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter) | 652 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter) |
633 | { | 653 | { |
634 | nx_nic_req_t req; | 654 | nx_nic_req_t req; |
655 | u64 word; | ||
635 | int rv; | 656 | int rv; |
636 | 657 | ||
637 | memset(&req, 0, sizeof(nx_nic_req_t)); | 658 | memset(&req, 0, sizeof(nx_nic_req_t)); |
638 | 659 | ||
639 | req.qhdr |= (NX_NIC_REQUEST << 23); | 660 | req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23); |
640 | req.req_hdr |= NETXEN_CONFIG_INTR_COALESCE; | 661 | |
641 | req.req_hdr |= ((u64)adapter->portnum << 16); | 662 | word = NETXEN_CONFIG_INTR_COALESCE | ((u64)adapter->portnum << 16); |
663 | req.req_hdr = cpu_to_le64(word); | ||
642 | 664 | ||
643 | memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal)); | 665 | memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal)); |
644 | 666 | ||
@@ -772,13 +794,10 @@ int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac) | |||
772 | adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4); | 794 | adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4); |
773 | adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4); | 795 | adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4); |
774 | 796 | ||
775 | mac_hi = cpu_to_le32(mac_hi); | ||
776 | mac_lo = cpu_to_le32(mac_lo); | ||
777 | |||
778 | if (pci_func & 1) | 797 | if (pci_func & 1) |
779 | *mac = ((mac_lo >> 16) | ((u64)mac_hi << 16)); | 798 | *mac = le64_to_cpu((mac_lo >> 16) | ((u64)mac_hi << 16)); |
780 | else | 799 | else |
781 | *mac = ((mac_lo) | ((u64)mac_hi << 32)); | 800 | *mac = le64_to_cpu((u64)mac_lo | ((u64)mac_hi << 32)); |
782 | 801 | ||
783 | return 0; | 802 | return 0; |
784 | } | 803 | } |
@@ -937,7 +956,7 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
937 | { | 956 | { |
938 | int i; | 957 | int i; |
939 | u32 data, size = 0; | 958 | u32 data, size = 0; |
940 | u32 flashaddr = NETXEN_BOOTLD_START, memaddr = NETXEN_BOOTLD_START; | 959 | u32 flashaddr = NETXEN_BOOTLD_START; |
941 | 960 | ||
942 | size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; | 961 | size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; |
943 | 962 | ||
@@ -949,10 +968,8 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
949 | if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) | 968 | if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) |
950 | return -EIO; | 969 | return -EIO; |
951 | 970 | ||
952 | adapter->pci_mem_write(adapter, memaddr, &data, 4); | 971 | adapter->pci_mem_write(adapter, flashaddr, &data, 4); |
953 | flashaddr += 4; | 972 | flashaddr += 4; |
954 | memaddr += 4; | ||
955 | cond_resched(); | ||
956 | } | 973 | } |
957 | msleep(1); | 974 | msleep(1); |
958 | 975 | ||
@@ -2034,7 +2051,13 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
2034 | rv = -1; | 2051 | rv = -1; |
2035 | } | 2052 | } |
2036 | 2053 | ||
2037 | DPRINTK(INFO, "Discovered board type:0x%x ", boardinfo->board_type); | 2054 | if (boardinfo->board_type == NETXEN_BRDTYPE_P3_4_GB_MM) { |
2055 | u32 gpio = netxen_nic_reg_read(adapter, | ||
2056 | NETXEN_ROMUSB_GLB_PAD_GPIO_I); | ||
2057 | if ((gpio & 0x8000) == 0) | ||
2058 | boardinfo->board_type = NETXEN_BRDTYPE_P3_10G_TP; | ||
2059 | } | ||
2060 | |||
2038 | switch ((netxen_brdtype_t) boardinfo->board_type) { | 2061 | switch ((netxen_brdtype_t) boardinfo->board_type) { |
2039 | case NETXEN_BRDTYPE_P2_SB35_4G: | 2062 | case NETXEN_BRDTYPE_P2_SB35_4G: |
2040 | adapter->ahw.board_type = NETXEN_NIC_GBE; | 2063 | adapter->ahw.board_type = NETXEN_NIC_GBE; |
@@ -2053,7 +2076,6 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
2053 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: | 2076 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: |
2054 | case NETXEN_BRDTYPE_P3_10G_XFP: | 2077 | case NETXEN_BRDTYPE_P3_10G_XFP: |
2055 | case NETXEN_BRDTYPE_P3_10000_BASE_T: | 2078 | case NETXEN_BRDTYPE_P3_10000_BASE_T: |
2056 | |||
2057 | adapter->ahw.board_type = NETXEN_NIC_XGBE; | 2079 | adapter->ahw.board_type = NETXEN_NIC_XGBE; |
2058 | break; | 2080 | break; |
2059 | case NETXEN_BRDTYPE_P1_BD: | 2081 | case NETXEN_BRDTYPE_P1_BD: |
@@ -2063,9 +2085,12 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
2063 | case NETXEN_BRDTYPE_P3_REF_QG: | 2085 | case NETXEN_BRDTYPE_P3_REF_QG: |
2064 | case NETXEN_BRDTYPE_P3_4_GB: | 2086 | case NETXEN_BRDTYPE_P3_4_GB: |
2065 | case NETXEN_BRDTYPE_P3_4_GB_MM: | 2087 | case NETXEN_BRDTYPE_P3_4_GB_MM: |
2066 | |||
2067 | adapter->ahw.board_type = NETXEN_NIC_GBE; | 2088 | adapter->ahw.board_type = NETXEN_NIC_GBE; |
2068 | break; | 2089 | break; |
2090 | case NETXEN_BRDTYPE_P3_10G_TP: | ||
2091 | adapter->ahw.board_type = (adapter->portnum < 2) ? | ||
2092 | NETXEN_NIC_XGBE : NETXEN_NIC_GBE; | ||
2093 | break; | ||
2069 | default: | 2094 | default: |
2070 | printk("%s: Unknown(%x)\n", netxen_nic_driver_name, | 2095 | printk("%s: Unknown(%x)\n", netxen_nic_driver_name, |
2071 | boardinfo->board_type); | 2096 | boardinfo->board_type); |
@@ -2110,12 +2135,16 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
2110 | { | 2135 | { |
2111 | __u32 status; | 2136 | __u32 status; |
2112 | __u32 autoneg; | 2137 | __u32 autoneg; |
2113 | __u32 mode; | ||
2114 | __u32 port_mode; | 2138 | __u32 port_mode; |
2115 | 2139 | ||
2116 | netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); | 2140 | if (!netif_carrier_ok(adapter->netdev)) { |
2117 | if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ | 2141 | adapter->link_speed = 0; |
2142 | adapter->link_duplex = -1; | ||
2143 | adapter->link_autoneg = AUTONEG_ENABLE; | ||
2144 | return; | ||
2145 | } | ||
2118 | 2146 | ||
2147 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | ||
2119 | adapter->hw_read_wx(adapter, | 2148 | adapter->hw_read_wx(adapter, |
2120 | NETXEN_PORT_MODE_ADDR, &port_mode, 4); | 2149 | NETXEN_PORT_MODE_ADDR, &port_mode, 4); |
2121 | if (port_mode == NETXEN_PORT_MODE_802_3_AP) { | 2150 | if (port_mode == NETXEN_PORT_MODE_802_3_AP) { |
@@ -2141,7 +2170,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
2141 | adapter->link_speed = SPEED_1000; | 2170 | adapter->link_speed = SPEED_1000; |
2142 | break; | 2171 | break; |
2143 | default: | 2172 | default: |
2144 | adapter->link_speed = -1; | 2173 | adapter->link_speed = 0; |
2145 | break; | 2174 | break; |
2146 | } | 2175 | } |
2147 | switch (netxen_get_phy_duplex(status)) { | 2176 | switch (netxen_get_phy_duplex(status)) { |
@@ -2164,7 +2193,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
2164 | goto link_down; | 2193 | goto link_down; |
2165 | } else { | 2194 | } else { |
2166 | link_down: | 2195 | link_down: |
2167 | adapter->link_speed = -1; | 2196 | adapter->link_speed = 0; |
2168 | adapter->link_duplex = -1; | 2197 | adapter->link_duplex = -1; |
2169 | } | 2198 | } |
2170 | } | 2199 | } |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index d924468e506..ca7c8d8050c 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -308,7 +308,6 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter) | |||
308 | } | 308 | } |
309 | memset(rds_ring->rx_buf_arr, 0, RCV_BUFFSIZE); | 309 | memset(rds_ring->rx_buf_arr, 0, RCV_BUFFSIZE); |
310 | INIT_LIST_HEAD(&rds_ring->free_list); | 310 | INIT_LIST_HEAD(&rds_ring->free_list); |
311 | rds_ring->begin_alloc = 0; | ||
312 | /* | 311 | /* |
313 | * Now go through all of them, set reference handles | 312 | * Now go through all of them, set reference handles |
314 | * and put them in the queues. | 313 | * and put them in the queues. |
@@ -439,6 +438,8 @@ static int netxen_wait_rom_done(struct netxen_adapter *adapter) | |||
439 | long timeout = 0; | 438 | long timeout = 0; |
440 | long done = 0; | 439 | long done = 0; |
441 | 440 | ||
441 | cond_resched(); | ||
442 | |||
442 | while (done == 0) { | 443 | while (done == 0) { |
443 | done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS); | 444 | done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS); |
444 | done &= 2; | 445 | done &= 2; |
@@ -533,12 +534,9 @@ static int do_rom_fast_write(struct netxen_adapter *adapter, int addr, | |||
533 | static int do_rom_fast_read(struct netxen_adapter *adapter, | 534 | static int do_rom_fast_read(struct netxen_adapter *adapter, |
534 | int addr, int *valp) | 535 | int addr, int *valp) |
535 | { | 536 | { |
536 | cond_resched(); | ||
537 | |||
538 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); | 537 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); |
539 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); | ||
540 | udelay(100); /* prevent bursting on CRB */ | ||
541 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 538 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
539 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); | ||
542 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); | 540 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); |
543 | if (netxen_wait_rom_done(adapter)) { | 541 | if (netxen_wait_rom_done(adapter)) { |
544 | printk("Error waiting for rom done\n"); | 542 | printk("Error waiting for rom done\n"); |
@@ -546,7 +544,7 @@ static int do_rom_fast_read(struct netxen_adapter *adapter, | |||
546 | } | 544 | } |
547 | /* reset abyte_cnt and dummy_byte_cnt */ | 545 | /* reset abyte_cnt and dummy_byte_cnt */ |
548 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); | 546 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); |
549 | udelay(100); /* prevent bursting on CRB */ | 547 | udelay(10); |
550 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 548 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
551 | 549 | ||
552 | *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); | 550 | *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); |
@@ -884,14 +882,16 @@ int netxen_flash_unlock(struct netxen_adapter *adapter) | |||
884 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | 882 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) |
885 | { | 883 | { |
886 | int addr, val; | 884 | int addr, val; |
887 | int i, init_delay = 0; | 885 | int i, n, init_delay = 0; |
888 | struct crb_addr_pair *buf; | 886 | struct crb_addr_pair *buf; |
889 | unsigned offset, n; | 887 | unsigned offset; |
890 | u32 off; | 888 | u32 off; |
891 | 889 | ||
892 | /* resetall */ | 890 | /* resetall */ |
891 | rom_lock(adapter); | ||
893 | netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, | 892 | netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, |
894 | 0xffffffff); | 893 | 0xffffffff); |
894 | netxen_rom_unlock(adapter); | ||
895 | 895 | ||
896 | if (verbose) { | 896 | if (verbose) { |
897 | if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0) | 897 | if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0) |
@@ -910,7 +910,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
910 | 910 | ||
911 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | 911 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { |
912 | if (netxen_rom_fast_read(adapter, 0, &n) != 0 || | 912 | if (netxen_rom_fast_read(adapter, 0, &n) != 0 || |
913 | (n != 0xcafecafeUL) || | 913 | (n != 0xcafecafe) || |
914 | netxen_rom_fast_read(adapter, 4, &n) != 0) { | 914 | netxen_rom_fast_read(adapter, 4, &n) != 0) { |
915 | printk(KERN_ERR "%s: ERROR Reading crb_init area: " | 915 | printk(KERN_ERR "%s: ERROR Reading crb_init area: " |
916 | "n: %08x\n", netxen_nic_driver_name, n); | 916 | "n: %08x\n", netxen_nic_driver_name, n); |
@@ -975,6 +975,14 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
975 | /* do not reset PCI */ | 975 | /* do not reset PCI */ |
976 | if (off == (ROMUSB_GLB + 0xbc)) | 976 | if (off == (ROMUSB_GLB + 0xbc)) |
977 | continue; | 977 | continue; |
978 | if (off == (ROMUSB_GLB + 0xa8)) | ||
979 | continue; | ||
980 | if (off == (ROMUSB_GLB + 0xc8)) /* core clock */ | ||
981 | continue; | ||
982 | if (off == (ROMUSB_GLB + 0x24)) /* MN clock */ | ||
983 | continue; | ||
984 | if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */ | ||
985 | continue; | ||
978 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) | 986 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) |
979 | buf[i].data = 0x1020; | 987 | buf[i].data = 0x1020; |
980 | /* skip the function enable register */ | 988 | /* skip the function enable register */ |
@@ -992,23 +1000,21 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
992 | continue; | 1000 | continue; |
993 | } | 1001 | } |
994 | 1002 | ||
1003 | init_delay = 1; | ||
995 | /* After writing this register, HW needs time for CRB */ | 1004 | /* After writing this register, HW needs time for CRB */ |
996 | /* to quiet down (else crb_window returns 0xffffffff) */ | 1005 | /* to quiet down (else crb_window returns 0xffffffff) */ |
997 | if (off == NETXEN_ROMUSB_GLB_SW_RESET) { | 1006 | if (off == NETXEN_ROMUSB_GLB_SW_RESET) { |
998 | init_delay = 1; | 1007 | init_delay = 1000; |
999 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 1008 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
1000 | /* hold xdma in reset also */ | 1009 | /* hold xdma in reset also */ |
1001 | buf[i].data = NETXEN_NIC_XDMA_RESET; | 1010 | buf[i].data = NETXEN_NIC_XDMA_RESET; |
1011 | buf[i].data = 0x8000ff; | ||
1002 | } | 1012 | } |
1003 | } | 1013 | } |
1004 | 1014 | ||
1005 | adapter->hw_write_wx(adapter, off, &buf[i].data, 4); | 1015 | adapter->hw_write_wx(adapter, off, &buf[i].data, 4); |
1006 | 1016 | ||
1007 | if (init_delay == 1) { | 1017 | msleep(init_delay); |
1008 | msleep(1000); | ||
1009 | init_delay = 0; | ||
1010 | } | ||
1011 | msleep(1); | ||
1012 | } | 1018 | } |
1013 | kfree(buf); | 1019 | kfree(buf); |
1014 | 1020 | ||
@@ -1277,7 +1283,7 @@ static void netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, | |||
1277 | 1283 | ||
1278 | dev_kfree_skb_any(skb); | 1284 | dev_kfree_skb_any(skb); |
1279 | for (i = 0; i < nr_frags; i++) { | 1285 | for (i = 0; i < nr_frags; i++) { |
1280 | index = frag_desc->frag_handles[i]; | 1286 | index = le16_to_cpu(frag_desc->frag_handles[i]); |
1281 | skb = netxen_process_rxbuf(adapter, | 1287 | skb = netxen_process_rxbuf(adapter, |
1282 | rds_ring, index, cksum); | 1288 | rds_ring, index, cksum); |
1283 | if (skb) | 1289 | if (skb) |
@@ -1428,7 +1434,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1428 | struct rcv_desc *pdesc; | 1434 | struct rcv_desc *pdesc; |
1429 | struct netxen_rx_buffer *buffer; | 1435 | struct netxen_rx_buffer *buffer; |
1430 | int count = 0; | 1436 | int count = 0; |
1431 | int index = 0; | ||
1432 | netxen_ctx_msg msg = 0; | 1437 | netxen_ctx_msg msg = 0; |
1433 | dma_addr_t dma; | 1438 | dma_addr_t dma; |
1434 | struct list_head *head; | 1439 | struct list_head *head; |
@@ -1436,7 +1441,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1436 | rds_ring = &recv_ctx->rds_rings[ringid]; | 1441 | rds_ring = &recv_ctx->rds_rings[ringid]; |
1437 | 1442 | ||
1438 | producer = rds_ring->producer; | 1443 | producer = rds_ring->producer; |
1439 | index = rds_ring->begin_alloc; | ||
1440 | head = &rds_ring->free_list; | 1444 | head = &rds_ring->free_list; |
1441 | 1445 | ||
1442 | /* We can start writing rx descriptors into the phantom memory. */ | 1446 | /* We can start writing rx descriptors into the phantom memory. */ |
@@ -1444,39 +1448,37 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1444 | 1448 | ||
1445 | skb = dev_alloc_skb(rds_ring->skb_size); | 1449 | skb = dev_alloc_skb(rds_ring->skb_size); |
1446 | if (unlikely(!skb)) { | 1450 | if (unlikely(!skb)) { |
1447 | rds_ring->begin_alloc = index; | ||
1448 | break; | 1451 | break; |
1449 | } | 1452 | } |
1450 | 1453 | ||
1454 | if (!adapter->ahw.cut_through) | ||
1455 | skb_reserve(skb, 2); | ||
1456 | |||
1457 | dma = pci_map_single(pdev, skb->data, | ||
1458 | rds_ring->dma_size, PCI_DMA_FROMDEVICE); | ||
1459 | if (pci_dma_mapping_error(pdev, dma)) { | ||
1460 | dev_kfree_skb_any(skb); | ||
1461 | break; | ||
1462 | } | ||
1463 | |||
1464 | count++; | ||
1451 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); | 1465 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); |
1452 | list_del(&buffer->list); | 1466 | list_del(&buffer->list); |
1453 | 1467 | ||
1454 | count++; /* now there should be no failure */ | ||
1455 | pdesc = &rds_ring->desc_head[producer]; | ||
1456 | |||
1457 | if (!adapter->ahw.cut_through) | ||
1458 | skb_reserve(skb, 2); | ||
1459 | /* This will be setup when we receive the | ||
1460 | * buffer after it has been filled FSL TBD TBD | ||
1461 | * skb->dev = netdev; | ||
1462 | */ | ||
1463 | dma = pci_map_single(pdev, skb->data, rds_ring->dma_size, | ||
1464 | PCI_DMA_FROMDEVICE); | ||
1465 | pdesc->addr_buffer = cpu_to_le64(dma); | ||
1466 | buffer->skb = skb; | 1468 | buffer->skb = skb; |
1467 | buffer->state = NETXEN_BUFFER_BUSY; | 1469 | buffer->state = NETXEN_BUFFER_BUSY; |
1468 | buffer->dma = dma; | 1470 | buffer->dma = dma; |
1471 | |||
1469 | /* make a rcv descriptor */ | 1472 | /* make a rcv descriptor */ |
1473 | pdesc = &rds_ring->desc_head[producer]; | ||
1474 | pdesc->addr_buffer = cpu_to_le64(dma); | ||
1470 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); | 1475 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); |
1471 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); | 1476 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); |
1472 | DPRINTK(INFO, "done writing descripter\n"); | 1477 | |
1473 | producer = | 1478 | producer = get_next_index(producer, rds_ring->max_rx_desc_count); |
1474 | get_next_index(producer, rds_ring->max_rx_desc_count); | ||
1475 | index = get_next_index(index, rds_ring->max_rx_desc_count); | ||
1476 | } | 1479 | } |
1477 | /* if we did allocate buffers, then write the count to Phantom */ | 1480 | /* if we did allocate buffers, then write the count to Phantom */ |
1478 | if (count) { | 1481 | if (count) { |
1479 | rds_ring->begin_alloc = index; | ||
1480 | rds_ring->producer = producer; | 1482 | rds_ring->producer = producer; |
1481 | /* Window = 1 */ | 1483 | /* Window = 1 */ |
1482 | adapter->pci_write_normalize(adapter, | 1484 | adapter->pci_write_normalize(adapter, |
@@ -1515,49 +1517,50 @@ static void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, | |||
1515 | struct rcv_desc *pdesc; | 1517 | struct rcv_desc *pdesc; |
1516 | struct netxen_rx_buffer *buffer; | 1518 | struct netxen_rx_buffer *buffer; |
1517 | int count = 0; | 1519 | int count = 0; |
1518 | int index = 0; | ||
1519 | struct list_head *head; | 1520 | struct list_head *head; |
1521 | dma_addr_t dma; | ||
1520 | 1522 | ||
1521 | rds_ring = &recv_ctx->rds_rings[ringid]; | 1523 | rds_ring = &recv_ctx->rds_rings[ringid]; |
1522 | 1524 | ||
1523 | producer = rds_ring->producer; | 1525 | producer = rds_ring->producer; |
1524 | index = rds_ring->begin_alloc; | ||
1525 | head = &rds_ring->free_list; | 1526 | head = &rds_ring->free_list; |
1526 | /* We can start writing rx descriptors into the phantom memory. */ | 1527 | /* We can start writing rx descriptors into the phantom memory. */ |
1527 | while (!list_empty(head)) { | 1528 | while (!list_empty(head)) { |
1528 | 1529 | ||
1529 | skb = dev_alloc_skb(rds_ring->skb_size); | 1530 | skb = dev_alloc_skb(rds_ring->skb_size); |
1530 | if (unlikely(!skb)) { | 1531 | if (unlikely(!skb)) { |
1531 | rds_ring->begin_alloc = index; | ||
1532 | break; | 1532 | break; |
1533 | } | 1533 | } |
1534 | 1534 | ||
1535 | if (!adapter->ahw.cut_through) | ||
1536 | skb_reserve(skb, 2); | ||
1537 | |||
1538 | dma = pci_map_single(pdev, skb->data, | ||
1539 | rds_ring->dma_size, PCI_DMA_FROMDEVICE); | ||
1540 | if (pci_dma_mapping_error(pdev, dma)) { | ||
1541 | dev_kfree_skb_any(skb); | ||
1542 | break; | ||
1543 | } | ||
1544 | |||
1545 | count++; | ||
1535 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); | 1546 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); |
1536 | list_del(&buffer->list); | 1547 | list_del(&buffer->list); |
1537 | 1548 | ||
1538 | count++; /* now there should be no failure */ | ||
1539 | pdesc = &rds_ring->desc_head[producer]; | ||
1540 | if (!adapter->ahw.cut_through) | ||
1541 | skb_reserve(skb, 2); | ||
1542 | buffer->skb = skb; | 1549 | buffer->skb = skb; |
1543 | buffer->state = NETXEN_BUFFER_BUSY; | 1550 | buffer->state = NETXEN_BUFFER_BUSY; |
1544 | buffer->dma = pci_map_single(pdev, skb->data, | 1551 | buffer->dma = dma; |
1545 | rds_ring->dma_size, | ||
1546 | PCI_DMA_FROMDEVICE); | ||
1547 | 1552 | ||
1548 | /* make a rcv descriptor */ | 1553 | /* make a rcv descriptor */ |
1554 | pdesc = &rds_ring->desc_head[producer]; | ||
1549 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); | 1555 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); |
1550 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); | 1556 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); |
1551 | pdesc->addr_buffer = cpu_to_le64(buffer->dma); | 1557 | pdesc->addr_buffer = cpu_to_le64(buffer->dma); |
1552 | producer = | 1558 | |
1553 | get_next_index(producer, rds_ring->max_rx_desc_count); | 1559 | producer = get_next_index(producer, rds_ring->max_rx_desc_count); |
1554 | index = get_next_index(index, rds_ring->max_rx_desc_count); | ||
1555 | buffer = &rds_ring->rx_buf_arr[index]; | ||
1556 | } | 1560 | } |
1557 | 1561 | ||
1558 | /* if we did allocate buffers, then write the count to Phantom */ | 1562 | /* if we did allocate buffers, then write the count to Phantom */ |
1559 | if (count) { | 1563 | if (count) { |
1560 | rds_ring->begin_alloc = index; | ||
1561 | rds_ring->producer = producer; | 1564 | rds_ring->producer = producer; |
1562 | /* Window = 1 */ | 1565 | /* Window = 1 */ |
1563 | adapter->pci_write_normalize(adapter, | 1566 | adapter->pci_write_normalize(adapter, |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index ba01524b553..d854f07ef4d 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -39,7 +39,9 @@ | |||
39 | #include "netxen_nic_phan_reg.h" | 39 | #include "netxen_nic_phan_reg.h" |
40 | 40 | ||
41 | #include <linux/dma-mapping.h> | 41 | #include <linux/dma-mapping.h> |
42 | #include <linux/if_vlan.h> | ||
42 | #include <net/ip.h> | 43 | #include <net/ip.h> |
44 | #include <linux/ipv6.h> | ||
43 | 45 | ||
44 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); | 46 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); |
45 | MODULE_LICENSE("GPL"); | 47 | MODULE_LICENSE("GPL"); |
@@ -242,7 +244,7 @@ static void netxen_check_options(struct netxen_adapter *adapter) | |||
242 | case NETXEN_BRDTYPE_P3_4_GB: | 244 | case NETXEN_BRDTYPE_P3_4_GB: |
243 | case NETXEN_BRDTYPE_P3_4_GB_MM: | 245 | case NETXEN_BRDTYPE_P3_4_GB_MM: |
244 | adapter->msix_supported = !!use_msi_x; | 246 | adapter->msix_supported = !!use_msi_x; |
245 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G; | 247 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; |
246 | break; | 248 | break; |
247 | 249 | ||
248 | case NETXEN_BRDTYPE_P2_SB35_4G: | 250 | case NETXEN_BRDTYPE_P2_SB35_4G: |
@@ -251,6 +253,14 @@ static void netxen_check_options(struct netxen_adapter *adapter) | |||
251 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; | 253 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; |
252 | break; | 254 | break; |
253 | 255 | ||
256 | case NETXEN_BRDTYPE_P3_10G_TP: | ||
257 | adapter->msix_supported = !!use_msi_x; | ||
258 | if (adapter->ahw.board_type == NETXEN_NIC_XGBE) | ||
259 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G; | ||
260 | else | ||
261 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; | ||
262 | break; | ||
263 | |||
254 | default: | 264 | default: |
255 | adapter->msix_supported = 0; | 265 | adapter->msix_supported = 0; |
256 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; | 266 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; |
@@ -271,10 +281,15 @@ static void netxen_check_options(struct netxen_adapter *adapter) | |||
271 | static int | 281 | static int |
272 | netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) | 282 | netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) |
273 | { | 283 | { |
274 | int ret = 0; | 284 | u32 val, timeout; |
275 | 285 | ||
276 | if (first_boot == 0x55555555) { | 286 | if (first_boot == 0x55555555) { |
277 | /* This is the first boot after power up */ | 287 | /* This is the first boot after power up */ |
288 | adapter->pci_write_normalize(adapter, | ||
289 | NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); | ||
290 | |||
291 | if (!NX_IS_REVISION_P2(adapter->ahw.revision_id)) | ||
292 | return 0; | ||
278 | 293 | ||
279 | /* PCI bus master workaround */ | 294 | /* PCI bus master workaround */ |
280 | adapter->hw_read_wx(adapter, | 295 | adapter->hw_read_wx(adapter, |
@@ -294,18 +309,26 @@ netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) | |||
294 | /* clear the register for future unloads/loads */ | 309 | /* clear the register for future unloads/loads */ |
295 | adapter->pci_write_normalize(adapter, | 310 | adapter->pci_write_normalize(adapter, |
296 | NETXEN_CAM_RAM(0x1fc), 0); | 311 | NETXEN_CAM_RAM(0x1fc), 0); |
297 | ret = -1; | 312 | return -EIO; |
298 | } | 313 | } |
299 | 314 | ||
300 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 315 | /* Start P2 boot loader */ |
301 | /* Start P2 boot loader */ | 316 | val = adapter->pci_read_normalize(adapter, |
302 | adapter->pci_write_normalize(adapter, | 317 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE); |
303 | NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); | 318 | adapter->pci_write_normalize(adapter, |
304 | adapter->pci_write_normalize(adapter, | 319 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, val | 0x1); |
305 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1); | 320 | timeout = 0; |
306 | } | 321 | do { |
322 | msleep(1); | ||
323 | val = adapter->pci_read_normalize(adapter, | ||
324 | NETXEN_CAM_RAM(0x1fc)); | ||
325 | |||
326 | if (++timeout > 5000) | ||
327 | return -EIO; | ||
328 | |||
329 | } while (val == NETXEN_BDINFO_MAGIC); | ||
307 | } | 330 | } |
308 | return ret; | 331 | return 0; |
309 | } | 332 | } |
310 | 333 | ||
311 | static void netxen_set_port_mode(struct netxen_adapter *adapter) | 334 | static void netxen_set_port_mode(struct netxen_adapter *adapter) |
@@ -784,8 +807,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
784 | CRB_CMDPEG_STATE, 0); | 807 | CRB_CMDPEG_STATE, 0); |
785 | netxen_pinit_from_rom(adapter, 0); | 808 | netxen_pinit_from_rom(adapter, 0); |
786 | msleep(1); | 809 | msleep(1); |
787 | netxen_load_firmware(adapter); | ||
788 | } | 810 | } |
811 | netxen_load_firmware(adapter); | ||
789 | 812 | ||
790 | if (NX_IS_REVISION_P3(revision_id)) | 813 | if (NX_IS_REVISION_P3(revision_id)) |
791 | netxen_pcie_strap_init(adapter); | 814 | netxen_pcie_strap_init(adapter); |
@@ -801,13 +824,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
801 | 824 | ||
802 | } | 825 | } |
803 | 826 | ||
804 | if ((first_boot == 0x55555555) && | ||
805 | (NX_IS_REVISION_P2(revision_id))) { | ||
806 | /* Unlock the HW, prompting the boot sequence */ | ||
807 | adapter->pci_write_normalize(adapter, | ||
808 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1); | ||
809 | } | ||
810 | |||
811 | err = netxen_initialize_adapter_offload(adapter); | 827 | err = netxen_initialize_adapter_offload(adapter); |
812 | if (err) | 828 | if (err) |
813 | goto err_out_iounmap; | 829 | goto err_out_iounmap; |
@@ -821,7 +837,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
821 | adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i); | 837 | adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i); |
822 | 838 | ||
823 | /* Handshake with the card before we register the devices. */ | 839 | /* Handshake with the card before we register the devices. */ |
824 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 840 | err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
841 | if (err) | ||
842 | goto err_out_free_offload; | ||
825 | 843 | ||
826 | } /* first_driver */ | 844 | } /* first_driver */ |
827 | 845 | ||
@@ -925,6 +943,7 @@ err_out_disable_msi: | |||
925 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) | 943 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) |
926 | pci_disable_msi(pdev); | 944 | pci_disable_msi(pdev); |
927 | 945 | ||
946 | err_out_free_offload: | ||
928 | if (first_driver) | 947 | if (first_driver) |
929 | netxen_free_adapter_offload(adapter); | 948 | netxen_free_adapter_offload(adapter); |
930 | 949 | ||
@@ -968,6 +987,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
968 | netxen_free_hw_resources(adapter); | 987 | netxen_free_hw_resources(adapter); |
969 | netxen_release_rx_buffers(adapter); | 988 | netxen_release_rx_buffers(adapter); |
970 | netxen_free_sw_resources(adapter); | 989 | netxen_free_sw_resources(adapter); |
990 | |||
991 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
992 | netxen_p3_free_mac_list(adapter); | ||
971 | } | 993 | } |
972 | 994 | ||
973 | if (adapter->portnum == 0) | 995 | if (adapter->portnum == 0) |
@@ -983,8 +1005,10 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
983 | 1005 | ||
984 | iounmap(adapter->ahw.db_base); | 1006 | iounmap(adapter->ahw.db_base); |
985 | iounmap(adapter->ahw.pci_base0); | 1007 | iounmap(adapter->ahw.pci_base0); |
986 | iounmap(adapter->ahw.pci_base1); | 1008 | if (adapter->ahw.pci_base1 != NULL) |
987 | iounmap(adapter->ahw.pci_base2); | 1009 | iounmap(adapter->ahw.pci_base1); |
1010 | if (adapter->ahw.pci_base2 != NULL) | ||
1011 | iounmap(adapter->ahw.pci_base2); | ||
988 | 1012 | ||
989 | pci_release_regions(pdev); | 1013 | pci_release_regions(pdev); |
990 | pci_disable_device(pdev); | 1014 | pci_disable_device(pdev); |
@@ -1137,29 +1161,64 @@ static int netxen_nic_close(struct net_device *netdev) | |||
1137 | return 0; | 1161 | return 0; |
1138 | } | 1162 | } |
1139 | 1163 | ||
1140 | void netxen_tso_check(struct netxen_adapter *adapter, | 1164 | static bool netxen_tso_check(struct net_device *netdev, |
1141 | struct cmd_desc_type0 *desc, struct sk_buff *skb) | 1165 | struct cmd_desc_type0 *desc, struct sk_buff *skb) |
1142 | { | 1166 | { |
1143 | if (desc->mss) { | 1167 | bool tso = false; |
1144 | desc->total_hdr_length = (sizeof(struct ethhdr) + | 1168 | u8 opcode = TX_ETHER_PKT; |
1145 | ip_hdrlen(skb) + tcp_hdrlen(skb)); | ||
1146 | 1169 | ||
1147 | if ((NX_IS_REVISION_P3(adapter->ahw.revision_id)) && | 1170 | if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && |
1148 | (skb->protocol == htons(ETH_P_IPV6))) | 1171 | skb_shinfo(skb)->gso_size > 0) { |
1149 | netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO6); | 1172 | |
1150 | else | 1173 | desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
1151 | netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); | 1174 | desc->total_hdr_length = |
1175 | skb_transport_offset(skb) + tcp_hdrlen(skb); | ||
1176 | |||
1177 | opcode = (skb->protocol == htons(ETH_P_IPV6)) ? | ||
1178 | TX_TCP_LSO6 : TX_TCP_LSO; | ||
1179 | tso = true; | ||
1152 | 1180 | ||
1153 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1181 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1154 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) | 1182 | u8 l4proto; |
1155 | netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT); | 1183 | |
1156 | else if (ip_hdr(skb)->protocol == IPPROTO_UDP) | 1184 | if (skb->protocol == htons(ETH_P_IP)) { |
1157 | netxen_set_cmd_desc_opcode(desc, TX_UDP_PKT); | 1185 | l4proto = ip_hdr(skb)->protocol; |
1158 | else | 1186 | |
1159 | return; | 1187 | if (l4proto == IPPROTO_TCP) |
1188 | opcode = TX_TCP_PKT; | ||
1189 | else if(l4proto == IPPROTO_UDP) | ||
1190 | opcode = TX_UDP_PKT; | ||
1191 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | ||
1192 | l4proto = ipv6_hdr(skb)->nexthdr; | ||
1193 | |||
1194 | if (l4proto == IPPROTO_TCP) | ||
1195 | opcode = TX_TCPV6_PKT; | ||
1196 | else if(l4proto == IPPROTO_UDP) | ||
1197 | opcode = TX_UDPV6_PKT; | ||
1198 | } | ||
1160 | } | 1199 | } |
1161 | desc->tcp_hdr_offset = skb_transport_offset(skb); | 1200 | desc->tcp_hdr_offset = skb_transport_offset(skb); |
1162 | desc->ip_hdr_offset = skb_network_offset(skb); | 1201 | desc->ip_hdr_offset = skb_network_offset(skb); |
1202 | netxen_set_tx_flags_opcode(desc, 0, opcode); | ||
1203 | return tso; | ||
1204 | } | ||
1205 | |||
1206 | static void | ||
1207 | netxen_clean_tx_dma_mapping(struct pci_dev *pdev, | ||
1208 | struct netxen_cmd_buffer *pbuf, int last) | ||
1209 | { | ||
1210 | int k; | ||
1211 | struct netxen_skb_frag *buffrag; | ||
1212 | |||
1213 | buffrag = &pbuf->frag_array[0]; | ||
1214 | pci_unmap_single(pdev, buffrag->dma, | ||
1215 | buffrag->length, PCI_DMA_TODEVICE); | ||
1216 | |||
1217 | for (k = 1; k < last; k++) { | ||
1218 | buffrag = &pbuf->frag_array[k]; | ||
1219 | pci_unmap_page(pdev, buffrag->dma, | ||
1220 | buffrag->length, PCI_DMA_TODEVICE); | ||
1221 | } | ||
1163 | } | 1222 | } |
1164 | 1223 | ||
1165 | static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | 1224 | static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
@@ -1167,33 +1226,22 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1167 | struct netxen_adapter *adapter = netdev_priv(netdev); | 1226 | struct netxen_adapter *adapter = netdev_priv(netdev); |
1168 | struct netxen_hardware_context *hw = &adapter->ahw; | 1227 | struct netxen_hardware_context *hw = &adapter->ahw; |
1169 | unsigned int first_seg_len = skb->len - skb->data_len; | 1228 | unsigned int first_seg_len = skb->len - skb->data_len; |
1229 | struct netxen_cmd_buffer *pbuf; | ||
1170 | struct netxen_skb_frag *buffrag; | 1230 | struct netxen_skb_frag *buffrag; |
1171 | unsigned int i; | 1231 | struct cmd_desc_type0 *hwdesc; |
1232 | struct pci_dev *pdev = adapter->pdev; | ||
1233 | dma_addr_t temp_dma; | ||
1234 | int i, k; | ||
1172 | 1235 | ||
1173 | u32 producer, consumer; | 1236 | u32 producer, consumer; |
1174 | u32 saved_producer = 0; | 1237 | int frag_count, no_of_desc; |
1175 | struct cmd_desc_type0 *hwdesc; | ||
1176 | int k; | ||
1177 | struct netxen_cmd_buffer *pbuf = NULL; | ||
1178 | int frag_count; | ||
1179 | int no_of_desc; | ||
1180 | u32 num_txd = adapter->max_tx_desc_count; | 1238 | u32 num_txd = adapter->max_tx_desc_count; |
1239 | bool is_tso = false; | ||
1181 | 1240 | ||
1182 | frag_count = skb_shinfo(skb)->nr_frags + 1; | 1241 | frag_count = skb_shinfo(skb)->nr_frags + 1; |
1183 | 1242 | ||
1184 | /* There 4 fragments per descriptor */ | 1243 | /* There 4 fragments per descriptor */ |
1185 | no_of_desc = (frag_count + 3) >> 2; | 1244 | no_of_desc = (frag_count + 3) >> 2; |
1186 | if (netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) { | ||
1187 | if (skb_shinfo(skb)->gso_size > 0) { | ||
1188 | |||
1189 | no_of_desc++; | ||
1190 | if ((ip_hdrlen(skb) + tcp_hdrlen(skb) + | ||
1191 | sizeof(struct ethhdr)) > | ||
1192 | (sizeof(struct cmd_desc_type0) - 2)) { | ||
1193 | no_of_desc++; | ||
1194 | } | ||
1195 | } | ||
1196 | } | ||
1197 | 1245 | ||
1198 | producer = adapter->cmd_producer; | 1246 | producer = adapter->cmd_producer; |
1199 | smp_mb(); | 1247 | smp_mb(); |
@@ -1205,34 +1253,26 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1205 | } | 1253 | } |
1206 | 1254 | ||
1207 | /* Copy the descriptors into the hardware */ | 1255 | /* Copy the descriptors into the hardware */ |
1208 | saved_producer = producer; | ||
1209 | hwdesc = &hw->cmd_desc_head[producer]; | 1256 | hwdesc = &hw->cmd_desc_head[producer]; |
1210 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); | 1257 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); |
1211 | /* Take skb->data itself */ | 1258 | /* Take skb->data itself */ |
1212 | pbuf = &adapter->cmd_buf_arr[producer]; | 1259 | pbuf = &adapter->cmd_buf_arr[producer]; |
1213 | if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && | 1260 | |
1214 | skb_shinfo(skb)->gso_size > 0) { | 1261 | is_tso = netxen_tso_check(netdev, hwdesc, skb); |
1215 | pbuf->mss = skb_shinfo(skb)->gso_size; | 1262 | |
1216 | hwdesc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); | ||
1217 | } else { | ||
1218 | pbuf->mss = 0; | ||
1219 | hwdesc->mss = 0; | ||
1220 | } | ||
1221 | pbuf->total_length = skb->len; | ||
1222 | pbuf->skb = skb; | 1263 | pbuf->skb = skb; |
1223 | pbuf->cmd = TX_ETHER_PKT; | ||
1224 | pbuf->frag_count = frag_count; | 1264 | pbuf->frag_count = frag_count; |
1225 | pbuf->port = adapter->portnum; | ||
1226 | buffrag = &pbuf->frag_array[0]; | 1265 | buffrag = &pbuf->frag_array[0]; |
1227 | buffrag->dma = pci_map_single(adapter->pdev, skb->data, first_seg_len, | 1266 | temp_dma = pci_map_single(pdev, skb->data, first_seg_len, |
1228 | PCI_DMA_TODEVICE); | 1267 | PCI_DMA_TODEVICE); |
1268 | if (pci_dma_mapping_error(pdev, temp_dma)) | ||
1269 | goto drop_packet; | ||
1270 | |||
1271 | buffrag->dma = temp_dma; | ||
1229 | buffrag->length = first_seg_len; | 1272 | buffrag->length = first_seg_len; |
1230 | netxen_set_cmd_desc_totallength(hwdesc, skb->len); | 1273 | netxen_set_tx_frags_len(hwdesc, frag_count, skb->len); |
1231 | netxen_set_cmd_desc_num_of_buff(hwdesc, frag_count); | 1274 | netxen_set_tx_port(hwdesc, adapter->portnum); |
1232 | netxen_set_cmd_desc_opcode(hwdesc, TX_ETHER_PKT); | ||
1233 | 1275 | ||
1234 | netxen_set_cmd_desc_port(hwdesc, adapter->portnum); | ||
1235 | netxen_set_cmd_desc_ctxid(hwdesc, adapter->portnum); | ||
1236 | hwdesc->buffer1_length = cpu_to_le16(first_seg_len); | 1276 | hwdesc->buffer1_length = cpu_to_le16(first_seg_len); |
1237 | hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); | 1277 | hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); |
1238 | 1278 | ||
@@ -1240,7 +1280,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1240 | struct skb_frag_struct *frag; | 1280 | struct skb_frag_struct *frag; |
1241 | int len, temp_len; | 1281 | int len, temp_len; |
1242 | unsigned long offset; | 1282 | unsigned long offset; |
1243 | dma_addr_t temp_dma; | ||
1244 | 1283 | ||
1245 | /* move to next desc. if there is a need */ | 1284 | /* move to next desc. if there is a need */ |
1246 | if ((i & 0x3) == 0) { | 1285 | if ((i & 0x3) == 0) { |
@@ -1256,8 +1295,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1256 | offset = frag->page_offset; | 1295 | offset = frag->page_offset; |
1257 | 1296 | ||
1258 | temp_len = len; | 1297 | temp_len = len; |
1259 | temp_dma = pci_map_page(adapter->pdev, frag->page, offset, | 1298 | temp_dma = pci_map_page(pdev, frag->page, offset, |
1260 | len, PCI_DMA_TODEVICE); | 1299 | len, PCI_DMA_TODEVICE); |
1300 | if (pci_dma_mapping_error(pdev, temp_dma)) { | ||
1301 | netxen_clean_tx_dma_mapping(pdev, pbuf, i); | ||
1302 | goto drop_packet; | ||
1303 | } | ||
1261 | 1304 | ||
1262 | buffrag++; | 1305 | buffrag++; |
1263 | buffrag->dma = temp_dma; | 1306 | buffrag->dma = temp_dma; |
@@ -1285,16 +1328,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1285 | } | 1328 | } |
1286 | producer = get_next_index(producer, num_txd); | 1329 | producer = get_next_index(producer, num_txd); |
1287 | 1330 | ||
1288 | /* might change opcode to TX_TCP_LSO */ | ||
1289 | netxen_tso_check(adapter, &hw->cmd_desc_head[saved_producer], skb); | ||
1290 | |||
1291 | /* For LSO, we need to copy the MAC/IP/TCP headers into | 1331 | /* For LSO, we need to copy the MAC/IP/TCP headers into |
1292 | * the descriptor ring | 1332 | * the descriptor ring |
1293 | */ | 1333 | */ |
1294 | if (netxen_get_cmd_desc_opcode(&hw->cmd_desc_head[saved_producer]) | 1334 | if (is_tso) { |
1295 | == TX_TCP_LSO) { | ||
1296 | int hdr_len, first_hdr_len, more_hdr; | 1335 | int hdr_len, first_hdr_len, more_hdr; |
1297 | hdr_len = hw->cmd_desc_head[saved_producer].total_hdr_length; | 1336 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
1298 | if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) { | 1337 | if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) { |
1299 | first_hdr_len = sizeof(struct cmd_desc_type0) - 2; | 1338 | first_hdr_len = sizeof(struct cmd_desc_type0) - 2; |
1300 | more_hdr = 1; | 1339 | more_hdr = 1; |
@@ -1336,6 +1375,11 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1336 | netdev->trans_start = jiffies; | 1375 | netdev->trans_start = jiffies; |
1337 | 1376 | ||
1338 | return NETDEV_TX_OK; | 1377 | return NETDEV_TX_OK; |
1378 | |||
1379 | drop_packet: | ||
1380 | adapter->stats.txdropped++; | ||
1381 | dev_kfree_skb_any(skb); | ||
1382 | return NETDEV_TX_OK; | ||
1339 | } | 1383 | } |
1340 | 1384 | ||
1341 | static int netxen_nic_check_temp(struct netxen_adapter *adapter) | 1385 | static int netxen_nic_check_temp(struct netxen_adapter *adapter) |
@@ -1407,6 +1451,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
1407 | netif_carrier_off(netdev); | 1451 | netif_carrier_off(netdev); |
1408 | netif_stop_queue(netdev); | 1452 | netif_stop_queue(netdev); |
1409 | } | 1453 | } |
1454 | |||
1455 | netxen_nic_set_link_parameters(adapter); | ||
1410 | } else if (!adapter->ahw.linkup && linkup) { | 1456 | } else if (!adapter->ahw.linkup && linkup) { |
1411 | printk(KERN_INFO "%s: %s NIC Link is up\n", | 1457 | printk(KERN_INFO "%s: %s NIC Link is up\n", |
1412 | netxen_nic_driver_name, netdev->name); | 1458 | netxen_nic_driver_name, netdev->name); |
@@ -1415,6 +1461,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
1415 | netif_carrier_on(netdev); | 1461 | netif_carrier_on(netdev); |
1416 | netif_wake_queue(netdev); | 1462 | netif_wake_queue(netdev); |
1417 | } | 1463 | } |
1464 | |||
1465 | netxen_nic_set_link_parameters(adapter); | ||
1418 | } | 1466 | } |
1419 | } | 1467 | } |
1420 | 1468 | ||
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 5b7a574ce57..d0349e7d73e 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -712,7 +712,7 @@ static inline void pasemi_mac_rx_error(const struct pasemi_mac *mac, | |||
712 | rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); | 712 | rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); |
713 | ccmdsta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno)); | 713 | ccmdsta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno)); |
714 | 714 | ||
715 | printk(KERN_ERR "pasemi_mac: rx error. macrx %016lx, rx status %lx\n", | 715 | printk(KERN_ERR "pasemi_mac: rx error. macrx %016llx, rx status %llx\n", |
716 | macrx, *chan->status); | 716 | macrx, *chan->status); |
717 | 717 | ||
718 | printk(KERN_ERR "pasemi_mac: rcmdsta %08x ccmdsta %08x\n", | 718 | printk(KERN_ERR "pasemi_mac: rcmdsta %08x ccmdsta %08x\n", |
@@ -730,8 +730,8 @@ static inline void pasemi_mac_tx_error(const struct pasemi_mac *mac, | |||
730 | 730 | ||
731 | cmdsta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno)); | 731 | cmdsta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno)); |
732 | 732 | ||
733 | printk(KERN_ERR "pasemi_mac: tx error. mactx 0x%016lx, "\ | 733 | printk(KERN_ERR "pasemi_mac: tx error. mactx 0x%016llx, "\ |
734 | "tx status 0x%016lx\n", mactx, *chan->status); | 734 | "tx status 0x%016llx\n", mactx, *chan->status); |
735 | 735 | ||
736 | printk(KERN_ERR "pasemi_mac: tcmdsta 0x%08x\n", cmdsta); | 736 | printk(KERN_ERR "pasemi_mac: tcmdsta 0x%08x\n", cmdsta); |
737 | } | 737 | } |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index e35460165bf..0a06e4fd37d 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -231,15 +231,6 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr) | |||
231 | if ((phy_id & 0x1fffffff) == 0x1fffffff) | 231 | if ((phy_id & 0x1fffffff) == 0x1fffffff) |
232 | return NULL; | 232 | return NULL; |
233 | 233 | ||
234 | /* | ||
235 | * Broken hardware is sometimes missing the pull-up resistor on the | ||
236 | * MDIO line, which results in reads to non-existent devices returning | ||
237 | * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent | ||
238 | * device as well. | ||
239 | */ | ||
240 | if (phy_id == 0) | ||
241 | return NULL; | ||
242 | |||
243 | dev = phy_device_create(bus, addr, phy_id); | 234 | dev = phy_device_create(bus, addr, phy_id); |
244 | 235 | ||
245 | return dev; | 236 | return dev; |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 06b448285eb..7b2728b8f1b 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -250,6 +250,7 @@ static int ppp_connect_channel(struct channel *pch, int unit); | |||
250 | static int ppp_disconnect_channel(struct channel *pch); | 250 | static int ppp_disconnect_channel(struct channel *pch); |
251 | static void ppp_destroy_channel(struct channel *pch); | 251 | static void ppp_destroy_channel(struct channel *pch); |
252 | static int unit_get(struct idr *p, void *ptr); | 252 | static int unit_get(struct idr *p, void *ptr); |
253 | static int unit_set(struct idr *p, void *ptr, int n); | ||
253 | static void unit_put(struct idr *p, int n); | 254 | static void unit_put(struct idr *p, int n); |
254 | static void *unit_find(struct idr *p, int n); | 255 | static void *unit_find(struct idr *p, int n); |
255 | 256 | ||
@@ -2432,11 +2433,18 @@ ppp_create_interface(int unit, int *retp) | |||
2432 | } else { | 2433 | } else { |
2433 | if (unit_find(&ppp_units_idr, unit)) | 2434 | if (unit_find(&ppp_units_idr, unit)) |
2434 | goto out2; /* unit already exists */ | 2435 | goto out2; /* unit already exists */ |
2435 | else { | 2436 | /* |
2436 | /* darn, someone is cheating us? */ | 2437 | * if caller need a specified unit number |
2437 | *retp = -EINVAL; | 2438 | * lets try to satisfy him, otherwise -- |
2439 | * he should better ask us for new unit number | ||
2440 | * | ||
2441 | * NOTE: yes I know that returning EEXIST it's not | ||
2442 | * fair but at least pppd will ask us to allocate | ||
2443 | * new unit in this case so user is happy :) | ||
2444 | */ | ||
2445 | unit = unit_set(&ppp_units_idr, ppp, unit); | ||
2446 | if (unit < 0) | ||
2438 | goto out2; | 2447 | goto out2; |
2439 | } | ||
2440 | } | 2448 | } |
2441 | 2449 | ||
2442 | /* Initialize the new ppp unit */ | 2450 | /* Initialize the new ppp unit */ |
@@ -2677,14 +2685,37 @@ static void __exit ppp_cleanup(void) | |||
2677 | * by holding all_ppp_mutex | 2685 | * by holding all_ppp_mutex |
2678 | */ | 2686 | */ |
2679 | 2687 | ||
2688 | /* associate pointer with specified number */ | ||
2689 | static int unit_set(struct idr *p, void *ptr, int n) | ||
2690 | { | ||
2691 | int unit, err; | ||
2692 | |||
2693 | again: | ||
2694 | if (!idr_pre_get(p, GFP_KERNEL)) { | ||
2695 | printk(KERN_ERR "PPP: No free memory for idr\n"); | ||
2696 | return -ENOMEM; | ||
2697 | } | ||
2698 | |||
2699 | err = idr_get_new_above(p, ptr, n, &unit); | ||
2700 | if (err == -EAGAIN) | ||
2701 | goto again; | ||
2702 | |||
2703 | if (unit != n) { | ||
2704 | idr_remove(p, unit); | ||
2705 | return -EINVAL; | ||
2706 | } | ||
2707 | |||
2708 | return unit; | ||
2709 | } | ||
2710 | |||
2680 | /* get new free unit number and associate pointer with it */ | 2711 | /* get new free unit number and associate pointer with it */ |
2681 | static int unit_get(struct idr *p, void *ptr) | 2712 | static int unit_get(struct idr *p, void *ptr) |
2682 | { | 2713 | { |
2683 | int unit, err; | 2714 | int unit, err; |
2684 | 2715 | ||
2685 | again: | 2716 | again: |
2686 | if (idr_pre_get(p, GFP_KERNEL) == 0) { | 2717 | if (!idr_pre_get(p, GFP_KERNEL)) { |
2687 | printk(KERN_ERR "Out of memory expanding drawable idr\n"); | 2718 | printk(KERN_ERR "PPP: No free memory for idr\n"); |
2688 | return -ENOMEM; | 2719 | return -ENOMEM; |
2689 | } | 2720 | } |
2690 | 2721 | ||
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index 6cbefcae9ac..be4465bc0a6 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c | |||
@@ -509,10 +509,10 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev, | |||
509 | else | 509 | else |
510 | ret = sis900_get_mac_addr(pci_dev, net_dev); | 510 | ret = sis900_get_mac_addr(pci_dev, net_dev); |
511 | 511 | ||
512 | if (ret == 0) { | 512 | if (!ret || !is_valid_ether_addr(net_dev->dev_addr)) { |
513 | printk(KERN_WARNING "%s: Cannot read MAC address.\n", dev_name); | 513 | random_ether_addr(net_dev->dev_addr); |
514 | ret = -ENODEV; | 514 | printk(KERN_WARNING "%s: Unreadable or invalid MAC address," |
515 | goto err_unmap_rx; | 515 | "using random generated one\n", dev_name); |
516 | } | 516 | } |
517 | 517 | ||
518 | /* 630ET : set the mii access mode as software-mode */ | 518 | /* 630ET : set the mii access mode as software-mode */ |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index c4918b86ed1..0d0fa91c025 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -1297,6 +1297,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp) | |||
1297 | /* setup */ | 1297 | /* setup */ |
1298 | spin_lock_irq(&serial->serial_lock); | 1298 | spin_lock_irq(&serial->serial_lock); |
1299 | tty->driver_data = serial; | 1299 | tty->driver_data = serial; |
1300 | tty_kref_put(serial->tty); | ||
1300 | serial->tty = tty_kref_get(tty); | 1301 | serial->tty = tty_kref_get(tty); |
1301 | spin_unlock_irq(&serial->serial_lock); | 1302 | spin_unlock_irq(&serial->serial_lock); |
1302 | 1303 | ||
@@ -1792,8 +1793,8 @@ static int mux_device_request(struct hso_serial *serial, u8 type, u16 port, | |||
1792 | 1793 | ||
1793 | /* initialize */ | 1794 | /* initialize */ |
1794 | ctrl_req->wValue = 0; | 1795 | ctrl_req->wValue = 0; |
1795 | ctrl_req->wIndex = hso_port_to_mux(port); | 1796 | ctrl_req->wIndex = cpu_to_le16(hso_port_to_mux(port)); |
1796 | ctrl_req->wLength = size; | 1797 | ctrl_req->wLength = cpu_to_le16(size); |
1797 | 1798 | ||
1798 | if (type == USB_CDC_GET_ENCAPSULATED_RESPONSE) { | 1799 | if (type == USB_CDC_GET_ENCAPSULATED_RESPONSE) { |
1799 | /* Reading command */ | 1800 | /* Reading command */ |
@@ -2043,9 +2044,8 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) | |||
2043 | return -2; | 2044 | return -2; |
2044 | } | 2045 | } |
2045 | 2046 | ||
2046 | spin_lock(&serial->serial_lock); | 2047 | /* All callers to put_rxbuf_data hold serial_lock */ |
2047 | tty = tty_kref_get(serial->tty); | 2048 | tty = tty_kref_get(serial->tty); |
2048 | spin_unlock(&serial->serial_lock); | ||
2049 | 2049 | ||
2050 | /* Push data to tty */ | 2050 | /* Push data to tty */ |
2051 | if (tty) { | 2051 | if (tty) { |
@@ -2053,8 +2053,10 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) | |||
2053 | serial->curr_rx_urb_offset; | 2053 | serial->curr_rx_urb_offset; |
2054 | D1("data to push to tty"); | 2054 | D1("data to push to tty"); |
2055 | while (write_length_remaining) { | 2055 | while (write_length_remaining) { |
2056 | if (test_bit(TTY_THROTTLED, &tty->flags)) | 2056 | if (test_bit(TTY_THROTTLED, &tty->flags)) { |
2057 | tty_kref_put(tty); | ||
2057 | return -1; | 2058 | return -1; |
2059 | } | ||
2058 | curr_write_len = tty_insert_flip_string | 2060 | curr_write_len = tty_insert_flip_string |
2059 | (tty, urb->transfer_buffer + | 2061 | (tty, urb->transfer_buffer + |
2060 | serial->curr_rx_urb_offset, | 2062 | serial->curr_rx_urb_offset, |
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c index 2dc241689d3..0dbd85b0162 100644 --- a/drivers/net/wan/ixp4xx_hss.c +++ b/drivers/net/wan/ixp4xx_hss.c | |||
@@ -622,7 +622,7 @@ static void hss_hdlc_rx_irq(void *pdev) | |||
622 | printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name); | 622 | printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name); |
623 | #endif | 623 | #endif |
624 | qmgr_disable_irq(queue_ids[port->id].rx); | 624 | qmgr_disable_irq(queue_ids[port->id].rx); |
625 | netif_rx_schedule(dev, &port->napi); | 625 | netif_rx_schedule(&port->napi); |
626 | } | 626 | } |
627 | 627 | ||
628 | static int hss_hdlc_poll(struct napi_struct *napi, int budget) | 628 | static int hss_hdlc_poll(struct napi_struct *napi, int budget) |
@@ -651,7 +651,7 @@ static int hss_hdlc_poll(struct napi_struct *napi, int budget) | |||
651 | printk(KERN_DEBUG "%s: hss_hdlc_poll" | 651 | printk(KERN_DEBUG "%s: hss_hdlc_poll" |
652 | " netif_rx_complete\n", dev->name); | 652 | " netif_rx_complete\n", dev->name); |
653 | #endif | 653 | #endif |
654 | netif_rx_complete(dev, napi); | 654 | netif_rx_complete(napi); |
655 | qmgr_enable_irq(rxq); | 655 | qmgr_enable_irq(rxq); |
656 | if (!qmgr_stat_empty(rxq) && | 656 | if (!qmgr_stat_empty(rxq) && |
657 | netif_rx_reschedule(napi)) { | 657 | netif_rx_reschedule(napi)) { |
@@ -1069,7 +1069,7 @@ static int hss_hdlc_open(struct net_device *dev) | |||
1069 | hss_start_hdlc(port); | 1069 | hss_start_hdlc(port); |
1070 | 1070 | ||
1071 | /* we may already have RX data, enables IRQ */ | 1071 | /* we may already have RX data, enables IRQ */ |
1072 | netif_rx_schedule(dev, &port->napi); | 1072 | netif_rx_schedule(&port->napi); |
1073 | return 0; | 1073 | return 0; |
1074 | 1074 | ||
1075 | err_unlock: | 1075 | err_unlock: |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index ea543fcf268..e4f9f747de8 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -111,7 +111,7 @@ config WLAN_80211 | |||
111 | lets you choose drivers. | 111 | lets you choose drivers. |
112 | 112 | ||
113 | config PCMCIA_RAYCS | 113 | config PCMCIA_RAYCS |
114 | tristate "Aviator/Raytheon 2.4MHz wireless support" | 114 | tristate "Aviator/Raytheon 2.4GHz wireless support" |
115 | depends on PCMCIA && WLAN_80211 | 115 | depends on PCMCIA && WLAN_80211 |
116 | select WIRELESS_EXT | 116 | select WIRELESS_EXT |
117 | ---help--- | 117 | ---help--- |
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index 4af2607deec..8ef87356e08 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c | |||
@@ -2644,7 +2644,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2644 | if (skb_headroom(skb) < padsize) { | 2644 | if (skb_headroom(skb) < padsize) { |
2645 | ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough" | 2645 | ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough" |
2646 | " headroom to pad %d\n", hdrlen, padsize); | 2646 | " headroom to pad %d\n", hdrlen, padsize); |
2647 | return -1; | 2647 | return NETDEV_TX_BUSY; |
2648 | } | 2648 | } |
2649 | skb_push(skb, padsize); | 2649 | skb_push(skb, padsize); |
2650 | memmove(skb->data, skb->data+padsize, hdrlen); | 2650 | memmove(skb->data, skb->data+padsize, hdrlen); |
@@ -2655,7 +2655,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2655 | ATH5K_ERR(sc, "no further txbuf available, dropping packet\n"); | 2655 | ATH5K_ERR(sc, "no further txbuf available, dropping packet\n"); |
2656 | spin_unlock_irqrestore(&sc->txbuflock, flags); | 2656 | spin_unlock_irqrestore(&sc->txbuflock, flags); |
2657 | ieee80211_stop_queue(hw, skb_get_queue_mapping(skb)); | 2657 | ieee80211_stop_queue(hw, skb_get_queue_mapping(skb)); |
2658 | return -1; | 2658 | return NETDEV_TX_BUSY; |
2659 | } | 2659 | } |
2660 | bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list); | 2660 | bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list); |
2661 | list_del(&bf->list); | 2661 | list_del(&bf->list); |
@@ -2673,10 +2673,10 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2673 | sc->txbuf_len++; | 2673 | sc->txbuf_len++; |
2674 | spin_unlock_irqrestore(&sc->txbuflock, flags); | 2674 | spin_unlock_irqrestore(&sc->txbuflock, flags); |
2675 | dev_kfree_skb_any(skb); | 2675 | dev_kfree_skb_any(skb); |
2676 | return 0; | 2676 | return NETDEV_TX_OK; |
2677 | } | 2677 | } |
2678 | 2678 | ||
2679 | return 0; | 2679 | return NETDEV_TX_OK; |
2680 | } | 2680 | } |
2681 | 2681 | ||
2682 | static int | 2682 | static int |
diff --git a/drivers/net/wireless/ath5k/pcu.c b/drivers/net/wireless/ath5k/pcu.c index 0cac05c6a9c..75eb9f43c74 100644 --- a/drivers/net/wireless/ath5k/pcu.c +++ b/drivers/net/wireless/ath5k/pcu.c | |||
@@ -65,7 +65,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah) | |||
65 | if (ah->ah_version == AR5K_AR5210) | 65 | if (ah->ah_version == AR5K_AR5210) |
66 | pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; | 66 | pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; |
67 | else | 67 | else |
68 | AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_ADHOC); | 68 | AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); |
69 | break; | 69 | break; |
70 | 70 | ||
71 | case NL80211_IFTYPE_AP: | 71 | case NL80211_IFTYPE_AP: |
@@ -75,7 +75,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah) | |||
75 | if (ah->ah_version == AR5K_AR5210) | 75 | if (ah->ah_version == AR5K_AR5210) |
76 | pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; | 76 | pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; |
77 | else | 77 | else |
78 | AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_ADHOC); | 78 | AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); |
79 | break; | 79 | break; |
80 | 80 | ||
81 | case NL80211_IFTYPE_STATION: | 81 | case NL80211_IFTYPE_STATION: |
diff --git a/drivers/net/wireless/ath5k/reg.h b/drivers/net/wireless/ath5k/reg.h index 91aaeaf8819..9189ab13286 100644 --- a/drivers/net/wireless/ath5k/reg.h +++ b/drivers/net/wireless/ath5k/reg.h | |||
@@ -73,7 +73,7 @@ | |||
73 | #define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */ | 73 | #define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */ |
74 | #define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */ | 74 | #define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */ |
75 | #define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */ | 75 | #define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */ |
76 | #define AR5K_CFG_ADHOC 0x00000020 /* AP/Adhoc indication [5211+] */ | 76 | #define AR5K_CFG_IBSS 0x00000020 /* 0-BSS, 1-IBSS [5211+] */ |
77 | #define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */ | 77 | #define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */ |
78 | #define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */ | 78 | #define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */ |
79 | #define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */ | 79 | #define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */ |
diff --git a/drivers/net/wireless/ath9k/Kconfig b/drivers/net/wireless/ath9k/Kconfig index c43bd321f97..90a8dd87378 100644 --- a/drivers/net/wireless/ath9k/Kconfig +++ b/drivers/net/wireless/ath9k/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config ATH9K | 1 | config ATH9K |
2 | tristate "Atheros 802.11n wireless cards support" | 2 | tristate "Atheros 802.11n wireless cards support" |
3 | depends on PCI && MAC80211 && WLAN_80211 | 3 | depends on PCI && MAC80211 && WLAN_80211 |
4 | depends on RFKILL || RFKILL=n | ||
4 | select MAC80211_LEDS | 5 | select MAC80211_LEDS |
5 | select LEDS_CLASS | 6 | select LEDS_CLASS |
6 | select NEW_LEDS | 7 | select NEW_LEDS |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 191eec50dc7..727f067aca4 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -2164,13 +2164,13 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
2164 | conf->ht.channel_type); | 2164 | conf->ht.channel_type); |
2165 | } | 2165 | } |
2166 | 2166 | ||
2167 | ath_update_chainmask(sc, conf->ht.enabled); | ||
2168 | |||
2167 | if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) { | 2169 | if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) { |
2168 | DPRINTF(sc, ATH_DBG_FATAL, "Unable to set channel\n"); | 2170 | DPRINTF(sc, ATH_DBG_FATAL, "Unable to set channel\n"); |
2169 | mutex_unlock(&sc->mutex); | 2171 | mutex_unlock(&sc->mutex); |
2170 | return -EINVAL; | 2172 | return -EINVAL; |
2171 | } | 2173 | } |
2172 | |||
2173 | ath_update_chainmask(sc, conf->ht.enabled); | ||
2174 | } | 2174 | } |
2175 | 2175 | ||
2176 | if (changed & IEEE80211_CONF_CHANGE_POWER) | 2176 | if (changed & IEEE80211_CONF_CHANGE_POWER) |
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c index 3bfc3b90f25..c92f0c6e4ad 100644 --- a/drivers/net/wireless/ath9k/xmit.c +++ b/drivers/net/wireless/ath9k/xmit.c | |||
@@ -126,15 +126,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
126 | tx_info->flags |= IEEE80211_TX_STAT_ACK; | 126 | tx_info->flags |= IEEE80211_TX_STAT_ACK; |
127 | } | 127 | } |
128 | 128 | ||
129 | tx_info->status.rates[0].count = tx_status->retries; | 129 | tx_info->status.rates[0].count = tx_status->retries + 1; |
130 | if (tx_info->status.rates[0].flags & IEEE80211_TX_RC_MCS) { | ||
131 | /* Change idx from internal table index to MCS index */ | ||
132 | int idx = tx_info->status.rates[0].idx; | ||
133 | struct ath_rate_table *rate_table = sc->cur_rate_table; | ||
134 | if (idx >= 0 && idx < rate_table->rate_cnt) | ||
135 | tx_info->status.rates[0].idx = | ||
136 | rate_table->info[idx].ratecode & 0x7f; | ||
137 | } | ||
138 | 130 | ||
139 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 131 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); |
140 | padsize = hdrlen & 3; | 132 | padsize = hdrlen & 3; |
@@ -264,25 +256,22 @@ static void assign_aggr_tid_seqno(struct sk_buff *skb, | |||
264 | } | 256 | } |
265 | 257 | ||
266 | /* Get seqno */ | 258 | /* Get seqno */ |
267 | 259 | /* For HT capable stations, we save tidno for later use. | |
268 | if (ieee80211_is_data(fc) && !is_pae(skb)) { | 260 | * We also override seqno set by upper layer with the one |
269 | /* For HT capable stations, we save tidno for later use. | 261 | * in tx aggregation state. |
270 | * We also override seqno set by upper layer with the one | 262 | * |
271 | * in tx aggregation state. | 263 | * If fragmentation is on, the sequence number is |
272 | * | 264 | * not overridden, since it has been |
273 | * If fragmentation is on, the sequence number is | 265 | * incremented by the fragmentation routine. |
274 | * not overridden, since it has been | 266 | * |
275 | * incremented by the fragmentation routine. | 267 | * FIXME: check if the fragmentation threshold exceeds |
276 | * | 268 | * IEEE80211 max. |
277 | * FIXME: check if the fragmentation threshold exceeds | 269 | */ |
278 | * IEEE80211 max. | 270 | tid = ATH_AN_2_TID(an, bf->bf_tidno); |
279 | */ | 271 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << |
280 | tid = ATH_AN_2_TID(an, bf->bf_tidno); | 272 | IEEE80211_SEQ_SEQ_SHIFT); |
281 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << | 273 | bf->bf_seqno = tid->seq_next; |
282 | IEEE80211_SEQ_SEQ_SHIFT); | 274 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); |
283 | bf->bf_seqno = tid->seq_next; | ||
284 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); | ||
285 | } | ||
286 | } | 275 | } |
287 | 276 | ||
288 | static int setup_tx_flags(struct ath_softc *sc, struct sk_buff *skb, | 277 | static int setup_tx_flags(struct ath_softc *sc, struct sk_buff *skb, |
@@ -1718,11 +1707,10 @@ static int ath_tx_setup_buffer(struct ath_softc *sc, struct ath_buf *bf, | |||
1718 | 1707 | ||
1719 | /* Assign seqno, tidno */ | 1708 | /* Assign seqno, tidno */ |
1720 | 1709 | ||
1721 | if (bf_isht(bf) && (sc->sc_flags & SC_OP_TXAGGR)) | 1710 | if (ieee80211_is_data_qos(fc) && (sc->sc_flags & SC_OP_TXAGGR)) |
1722 | assign_aggr_tid_seqno(skb, bf); | 1711 | assign_aggr_tid_seqno(skb, bf); |
1723 | 1712 | ||
1724 | /* DMA setup */ | 1713 | /* DMA setup */ |
1725 | |||
1726 | bf->bf_mpdu = skb; | 1714 | bf->bf_mpdu = skb; |
1727 | 1715 | ||
1728 | bf->bf_dmacontext = pci_map_single(sc->pdev, skb->data, | 1716 | bf->bf_dmacontext = pci_map_single(sc->pdev, skb->data, |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 7b31a327b24..c788bad1066 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -3261,7 +3261,7 @@ static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan) | |||
3261 | struct b43_wldev *down_dev; | 3261 | struct b43_wldev *down_dev; |
3262 | struct b43_wldev *d; | 3262 | struct b43_wldev *d; |
3263 | int err; | 3263 | int err; |
3264 | bool gmode; | 3264 | bool uninitialized_var(gmode); |
3265 | int prev_status; | 3265 | int prev_status; |
3266 | 3266 | ||
3267 | /* Find a device and PHY which supports the band. */ | 3267 | /* Find a device and PHY which supports the band. */ |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index c1324e31d2f..fb996c27a19 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -2465,7 +2465,7 @@ static void b43legacy_put_phy_into_reset(struct b43legacy_wldev *dev) | |||
2465 | static int b43legacy_switch_phymode(struct b43legacy_wl *wl, | 2465 | static int b43legacy_switch_phymode(struct b43legacy_wl *wl, |
2466 | unsigned int new_mode) | 2466 | unsigned int new_mode) |
2467 | { | 2467 | { |
2468 | struct b43legacy_wldev *up_dev; | 2468 | struct b43legacy_wldev *uninitialized_var(up_dev); |
2469 | struct b43legacy_wldev *down_dev; | 2469 | struct b43legacy_wldev *down_dev; |
2470 | int err; | 2470 | int err; |
2471 | bool gmode = 0; | 2471 | bool gmode = 0; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 8fdb34222c0..45cfa1cf194 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -2219,7 +2219,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv) | |||
2219 | /* set tx power value for all OFDM rates */ | 2219 | /* set tx power value for all OFDM rates */ |
2220 | for (rate_index = 0; rate_index < IWL_OFDM_RATES; | 2220 | for (rate_index = 0; rate_index < IWL_OFDM_RATES; |
2221 | rate_index++) { | 2221 | rate_index++) { |
2222 | s32 power_idx; | 2222 | s32 uninitialized_var(power_idx); |
2223 | int rc; | 2223 | int rc; |
2224 | 2224 | ||
2225 | /* use channel group's clip-power table, | 2225 | /* use channel group's clip-power table, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 52966ffbef6..ba997204c8d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -255,7 +255,7 @@ struct iwl_cmd_header { | |||
255 | * 0x3) 54 Mbps | 255 | * 0x3) 54 Mbps |
256 | * | 256 | * |
257 | * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): | 257 | * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): |
258 | * 3-0: 10) 1 Mbps | 258 | * 6-0: 10) 1 Mbps |
259 | * 20) 2 Mbps | 259 | * 20) 2 Mbps |
260 | * 55) 5.5 Mbps | 260 | * 55) 5.5 Mbps |
261 | * 110) 11 Mbps | 261 | * 110) 11 Mbps |
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index 01a2169cece..8c71ad4f88c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -51,6 +51,7 @@ const char *get_cmd_string(u8 cmd) | |||
51 | IWL_CMD(REPLY_REMOVE_STA); | 51 | IWL_CMD(REPLY_REMOVE_STA); |
52 | IWL_CMD(REPLY_REMOVE_ALL_STA); | 52 | IWL_CMD(REPLY_REMOVE_ALL_STA); |
53 | IWL_CMD(REPLY_WEPKEY); | 53 | IWL_CMD(REPLY_WEPKEY); |
54 | IWL_CMD(REPLY_3945_RX); | ||
54 | IWL_CMD(REPLY_TX); | 55 | IWL_CMD(REPLY_TX); |
55 | IWL_CMD(REPLY_RATE_SCALE); | 56 | IWL_CMD(REPLY_RATE_SCALE); |
56 | IWL_CMD(REPLY_LEDS_CMD); | 57 | IWL_CMD(REPLY_LEDS_CMD); |
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c index d1fc305de5f..e7289e2e7f1 100644 --- a/drivers/net/wireless/libertas_tf/main.c +++ b/drivers/net/wireless/libertas_tf/main.c | |||
@@ -206,7 +206,7 @@ static int lbtf_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
206 | * there are no buffered multicast frames to send | 206 | * there are no buffered multicast frames to send |
207 | */ | 207 | */ |
208 | ieee80211_stop_queues(priv->hw); | 208 | ieee80211_stop_queues(priv->hw); |
209 | return 0; | 209 | return NETDEV_TX_OK; |
210 | } | 210 | } |
211 | 211 | ||
212 | static void lbtf_tx_work(struct work_struct *work) | 212 | static void lbtf_tx_work(struct work_struct *work) |
diff --git a/drivers/net/wireless/orinoco/orinoco.c b/drivers/net/wireless/orinoco/orinoco.c index bc84e2792f8..c3bb85e0251 100644 --- a/drivers/net/wireless/orinoco/orinoco.c +++ b/drivers/net/wireless/orinoco/orinoco.c | |||
@@ -1610,6 +1610,16 @@ static void orinoco_rx_isr_tasklet(unsigned long data) | |||
1610 | struct orinoco_rx_data *rx_data, *temp; | 1610 | struct orinoco_rx_data *rx_data, *temp; |
1611 | struct hermes_rx_descriptor *desc; | 1611 | struct hermes_rx_descriptor *desc; |
1612 | struct sk_buff *skb; | 1612 | struct sk_buff *skb; |
1613 | unsigned long flags; | ||
1614 | |||
1615 | /* orinoco_rx requires the driver lock, and we also need to | ||
1616 | * protect priv->rx_list, so just hold the lock over the | ||
1617 | * lot. | ||
1618 | * | ||
1619 | * If orinoco_lock fails, we've unplugged the card. In this | ||
1620 | * case just abort. */ | ||
1621 | if (orinoco_lock(priv, &flags) != 0) | ||
1622 | return; | ||
1613 | 1623 | ||
1614 | /* extract desc and skb from queue */ | 1624 | /* extract desc and skb from queue */ |
1615 | list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) { | 1625 | list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) { |
@@ -1622,6 +1632,8 @@ static void orinoco_rx_isr_tasklet(unsigned long data) | |||
1622 | 1632 | ||
1623 | kfree(desc); | 1633 | kfree(desc); |
1624 | } | 1634 | } |
1635 | |||
1636 | orinoco_unlock(priv, &flags); | ||
1625 | } | 1637 | } |
1626 | 1638 | ||
1627 | /********************************************************************/ | 1639 | /********************************************************************/ |
@@ -3645,12 +3657,22 @@ struct net_device | |||
3645 | void free_orinocodev(struct net_device *dev) | 3657 | void free_orinocodev(struct net_device *dev) |
3646 | { | 3658 | { |
3647 | struct orinoco_private *priv = netdev_priv(dev); | 3659 | struct orinoco_private *priv = netdev_priv(dev); |
3660 | struct orinoco_rx_data *rx_data, *temp; | ||
3648 | 3661 | ||
3649 | /* No need to empty priv->rx_list: if the tasklet is scheduled | 3662 | /* If the tasklet is scheduled when we call tasklet_kill it |
3650 | * when we call tasklet_kill it will run one final time, | 3663 | * will run one final time. However the tasklet will only |
3651 | * emptying the list */ | 3664 | * drain priv->rx_list if the hw is still available. */ |
3652 | tasklet_kill(&priv->rx_tasklet); | 3665 | tasklet_kill(&priv->rx_tasklet); |
3653 | 3666 | ||
3667 | /* Explicitly drain priv->rx_list */ | ||
3668 | list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) { | ||
3669 | list_del(&rx_data->list); | ||
3670 | |||
3671 | dev_kfree_skb(rx_data->skb); | ||
3672 | kfree(rx_data->desc); | ||
3673 | kfree(rx_data); | ||
3674 | } | ||
3675 | |||
3654 | unregister_pm_notifier(&priv->pm_notifier); | 3676 | unregister_pm_notifier(&priv->pm_notifier); |
3655 | orinoco_uncache_fw(priv); | 3677 | orinoco_uncache_fw(priv); |
3656 | 3678 | ||
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index f127602670e..0b32215d3f5 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c | |||
@@ -435,6 +435,7 @@ static struct pcmcia_device_id orinoco_cs_ids[] = { | |||
435 | PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */ | 435 | PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */ |
436 | PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */ | 436 | PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */ |
437 | PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */ | 437 | PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */ |
438 | PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0003), /* ARtem Onair Comcard 11 */ | ||
438 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */ | 439 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */ |
439 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */ | 440 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */ |
440 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */ | 441 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */ |
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index 82354b974a0..c6a370fa9bc 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -138,6 +138,7 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
138 | u8 *fw_version = NULL; | 138 | u8 *fw_version = NULL; |
139 | size_t len; | 139 | size_t len; |
140 | int i; | 140 | int i; |
141 | int maxlen; | ||
141 | 142 | ||
142 | if (priv->rx_start) | 143 | if (priv->rx_start) |
143 | return 0; | 144 | return 0; |
@@ -195,6 +196,16 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
195 | else | 196 | else |
196 | priv->rx_mtu = (size_t) | 197 | priv->rx_mtu = (size_t) |
197 | 0x620 - priv->tx_hdr_len; | 198 | 0x620 - priv->tx_hdr_len; |
199 | maxlen = priv->tx_hdr_len + /* USB devices */ | ||
200 | sizeof(struct p54_rx_data) + | ||
201 | 4 + /* rx alignment */ | ||
202 | IEEE80211_MAX_FRAG_THRESHOLD; | ||
203 | if (priv->rx_mtu > maxlen && PAGE_SIZE == 4096) { | ||
204 | printk(KERN_INFO "p54: rx_mtu reduced from %d " | ||
205 | "to %d\n", priv->rx_mtu, | ||
206 | maxlen); | ||
207 | priv->rx_mtu = maxlen; | ||
208 | } | ||
198 | break; | 209 | break; |
199 | } | 210 | } |
200 | case BR_CODE_EXPOSED_IF: | 211 | case BR_CODE_EXPOSED_IF: |
@@ -575,6 +586,7 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
575 | u16 freq = le16_to_cpu(hdr->freq); | 586 | u16 freq = le16_to_cpu(hdr->freq); |
576 | size_t header_len = sizeof(*hdr); | 587 | size_t header_len = sizeof(*hdr); |
577 | u32 tsf32; | 588 | u32 tsf32; |
589 | u8 rate = hdr->rate & 0xf; | ||
578 | 590 | ||
579 | /* | 591 | /* |
580 | * If the device is in a unspecified state we have to | 592 | * If the device is in a unspecified state we have to |
@@ -603,8 +615,11 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
603 | rx_status.qual = (100 * hdr->rssi) / 127; | 615 | rx_status.qual = (100 * hdr->rssi) / 127; |
604 | if (hdr->rate & 0x10) | 616 | if (hdr->rate & 0x10) |
605 | rx_status.flag |= RX_FLAG_SHORTPRE; | 617 | rx_status.flag |= RX_FLAG_SHORTPRE; |
606 | rx_status.rate_idx = (dev->conf.channel->band == IEEE80211_BAND_2GHZ ? | 618 | if (dev->conf.channel->band == IEEE80211_BAND_5GHZ) |
607 | hdr->rate : (hdr->rate - 4)) & 0xf; | 619 | rx_status.rate_idx = (rate < 4) ? 0 : rate - 4; |
620 | else | ||
621 | rx_status.rate_idx = rate; | ||
622 | |||
608 | rx_status.freq = freq; | 623 | rx_status.freq = freq; |
609 | rx_status.band = dev->conf.channel->band; | 624 | rx_status.band = dev->conf.channel->band; |
610 | rx_status.antenna = hdr->antenna; | 625 | rx_status.antenna = hdr->antenna; |
@@ -798,6 +813,16 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
798 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; | 813 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; |
799 | info->status.ack_signal = p54_rssi_to_dbm(dev, | 814 | info->status.ack_signal = p54_rssi_to_dbm(dev, |
800 | (int)payload->ack_rssi); | 815 | (int)payload->ack_rssi); |
816 | |||
817 | if (entry_data->key_type == P54_CRYPTO_TKIPMICHAEL) { | ||
818 | u8 *iv = (u8 *)(entry_data->align + pad + | ||
819 | entry_data->crypt_offset); | ||
820 | |||
821 | /* Restore the original TKIP IV. */ | ||
822 | iv[2] = iv[0]; | ||
823 | iv[0] = iv[1]; | ||
824 | iv[1] = (iv[0] | 0x20) & 0x7f; /* WEPSeed - 8.3.2.2 */ | ||
825 | } | ||
801 | skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); | 826 | skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); |
802 | ieee80211_tx_status_irqsafe(dev, entry); | 827 | ieee80211_tx_status_irqsafe(dev, entry); |
803 | goto out; | 828 | goto out; |
@@ -1383,7 +1408,6 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
1383 | hdr->tries = ridx; | 1408 | hdr->tries = ridx; |
1384 | txhdr->rts_rate_idx = 0; | 1409 | txhdr->rts_rate_idx = 0; |
1385 | if (info->control.hw_key) { | 1410 | if (info->control.hw_key) { |
1386 | crypt_offset += info->control.hw_key->iv_len; | ||
1387 | txhdr->key_type = p54_convert_algo(info->control.hw_key->alg); | 1411 | txhdr->key_type = p54_convert_algo(info->control.hw_key->alg); |
1388 | txhdr->key_len = min((u8)16, info->control.hw_key->keylen); | 1412 | txhdr->key_len = min((u8)16, info->control.hw_key->keylen); |
1389 | memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); | 1413 | memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); |
@@ -1397,6 +1421,8 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
1397 | } | 1421 | } |
1398 | /* reserve some space for ICV */ | 1422 | /* reserve some space for ICV */ |
1399 | len += info->control.hw_key->icv_len; | 1423 | len += info->control.hw_key->icv_len; |
1424 | memset(skb_put(skb, info->control.hw_key->icv_len), 0, | ||
1425 | info->control.hw_key->icv_len); | ||
1400 | } else { | 1426 | } else { |
1401 | txhdr->key_type = 0; | 1427 | txhdr->key_type = 0; |
1402 | txhdr->key_len = 0; | 1428 | txhdr->key_len = 0; |
@@ -1824,7 +1850,7 @@ static void p54_remove_interface(struct ieee80211_hw *dev, | |||
1824 | 1850 | ||
1825 | static int p54_config(struct ieee80211_hw *dev, u32 changed) | 1851 | static int p54_config(struct ieee80211_hw *dev, u32 changed) |
1826 | { | 1852 | { |
1827 | int ret; | 1853 | int ret = 0; |
1828 | struct p54_common *priv = dev->priv; | 1854 | struct p54_common *priv = dev->priv; |
1829 | struct ieee80211_conf *conf = &dev->conf; | 1855 | struct ieee80211_conf *conf = &dev->conf; |
1830 | 1856 | ||
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index c44a200059d..6a6a72f6f82 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
@@ -56,6 +56,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
56 | {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ | 56 | {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ |
57 | {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ | 57 | {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ |
58 | {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ | 58 | {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ |
59 | {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ | ||
59 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ | 60 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ |
60 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ | 61 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ |
61 | {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ | 62 | {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ |
@@ -284,6 +285,7 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
284 | usb_fill_bulk_urb(data_urb, priv->udev, | 285 | usb_fill_bulk_urb(data_urb, priv->udev, |
285 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), | 286 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), |
286 | skb->data, skb->len, p54u_tx_cb, skb); | 287 | skb->data, skb->len, p54u_tx_cb, skb); |
288 | data_urb->transfer_flags |= URB_ZERO_PACKET; | ||
287 | 289 | ||
288 | usb_anchor_urb(data_urb, &priv->submitted); | 290 | usb_anchor_urb(data_urb, &priv->submitted); |
289 | if (usb_submit_urb(data_urb, GFP_ATOMIC)) { | 291 | if (usb_submit_urb(data_urb, GFP_ATOMIC)) { |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 30028e2422f..af6b5847be5 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -38,7 +38,7 @@ | |||
38 | /* | 38 | /* |
39 | * Allow hardware encryption to be disabled. | 39 | * Allow hardware encryption to be disabled. |
40 | */ | 40 | */ |
41 | static int modparam_nohwcrypt = 1; | 41 | static int modparam_nohwcrypt = 0; |
42 | module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); | 42 | module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); |
43 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); | 43 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); |
44 | 44 | ||
@@ -376,11 +376,11 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev, | |||
376 | 376 | ||
377 | /* | 377 | /* |
378 | * The driver does not support the IV/EIV generation | 378 | * The driver does not support the IV/EIV generation |
379 | * in hardware. However it doesn't support the IV/EIV | 379 | * in hardware. However it demands the data to be provided |
380 | * inside the ieee80211 frame either, but requires it | 380 | * both seperately as well as inside the frame. |
381 | * to be provided seperately for the descriptor. | 381 | * We already provided the CONFIG_CRYPTO_COPY_IV to rt2x00lib |
382 | * rt2x00lib will cut the IV/EIV data out of all frames | 382 | * to ensure rt2x00lib will not strip the data from the |
383 | * given to us by mac80211, but we must tell mac80211 | 383 | * frame after the copy, now we must tell mac80211 |
384 | * to generate the IV/EIV data. | 384 | * to generate the IV/EIV data. |
385 | */ | 385 | */ |
386 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | 386 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
@@ -1181,7 +1181,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1181 | test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)); | 1181 | test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)); |
1182 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); | 1182 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); |
1183 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len); | 1183 | rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len); |
1184 | rt2x00_set_field32(&word, TXD_W0_CIPHER, txdesc->cipher); | 1184 | rt2x00_set_field32(&word, TXD_W0_CIPHER, !!txdesc->cipher); |
1185 | rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx); | 1185 | rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx); |
1186 | rt2x00_desc_write(txd, 0, word); | 1186 | rt2x00_desc_write(txd, 0, word); |
1187 | } | 1187 | } |
@@ -1334,14 +1334,7 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry, | |||
1334 | 1334 | ||
1335 | /* ICV is located at the end of frame */ | 1335 | /* ICV is located at the end of frame */ |
1336 | 1336 | ||
1337 | /* | 1337 | rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; |
1338 | * Hardware has stripped IV/EIV data from 802.11 frame during | ||
1339 | * decryption. It has provided the data seperately but rt2x00lib | ||
1340 | * should decide if it should be reinserted. | ||
1341 | */ | ||
1342 | rxdesc->flags |= RX_FLAG_IV_STRIPPED; | ||
1343 | if (rxdesc->cipher != CIPHER_TKIP) | ||
1344 | rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; | ||
1345 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) | 1338 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) |
1346 | rxdesc->flags |= RX_FLAG_DECRYPTED; | 1339 | rxdesc->flags |= RX_FLAG_DECRYPTED; |
1347 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) | 1340 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 6d92542fcf0..87c0f2c8307 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -807,13 +807,11 @@ static void rt2x00lib_rate(struct ieee80211_rate *entry, | |||
807 | { | 807 | { |
808 | entry->flags = 0; | 808 | entry->flags = 0; |
809 | entry->bitrate = rate->bitrate; | 809 | entry->bitrate = rate->bitrate; |
810 | entry->hw_value = rt2x00_create_rate_hw_value(index, 0); | 810 | entry->hw_value =index; |
811 | entry->hw_value_short = entry->hw_value; | 811 | entry->hw_value_short = index; |
812 | 812 | ||
813 | if (rate->flags & DEV_RATE_SHORT_PREAMBLE) { | 813 | if (rate->flags & DEV_RATE_SHORT_PREAMBLE) |
814 | entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE; | 814 | entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE; |
815 | entry->hw_value_short |= rt2x00_create_rate_hw_value(index, 1); | ||
816 | } | ||
817 | } | 815 | } |
818 | 816 | ||
819 | static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, | 817 | static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00leds.c b/drivers/net/wireless/rt2x00/rt2x00leds.c index 68f4e0fc35b..a0cd35b6beb 100644 --- a/drivers/net/wireless/rt2x00/rt2x00leds.c +++ b/drivers/net/wireless/rt2x00/rt2x00leds.c | |||
@@ -97,7 +97,7 @@ void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled) | |||
97 | 97 | ||
98 | void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled) | 98 | void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled) |
99 | { | 99 | { |
100 | if (rt2x00dev->led_radio.type == LED_TYPE_ASSOC) | 100 | if (rt2x00dev->led_radio.type == LED_TYPE_RADIO) |
101 | rt2x00led_led_simple(&rt2x00dev->led_radio, enabled); | 101 | rt2x00led_led_simple(&rt2x00dev->led_radio, enabled); |
102 | } | 102 | } |
103 | 103 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 03024327767..86cd26fbf76 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -52,22 +52,11 @@ struct rt2x00_rate { | |||
52 | 52 | ||
53 | extern const struct rt2x00_rate rt2x00_supported_rates[12]; | 53 | extern const struct rt2x00_rate rt2x00_supported_rates[12]; |
54 | 54 | ||
55 | static inline u16 rt2x00_create_rate_hw_value(const u16 index, | ||
56 | const u16 short_preamble) | ||
57 | { | ||
58 | return (short_preamble << 8) | (index & 0xff); | ||
59 | } | ||
60 | |||
61 | static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value) | 55 | static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value) |
62 | { | 56 | { |
63 | return &rt2x00_supported_rates[hw_value & 0xff]; | 57 | return &rt2x00_supported_rates[hw_value & 0xff]; |
64 | } | 58 | } |
65 | 59 | ||
66 | static inline int rt2x00_get_rate_preamble(const u16 hw_value) | ||
67 | { | ||
68 | return (hw_value & 0xff00); | ||
69 | } | ||
70 | |||
71 | /* | 60 | /* |
72 | * Radio control handlers. | 61 | * Radio control handlers. |
73 | */ | 62 | */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index eaec6bd93ed..746a8f36b93 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -313,7 +313,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
313 | * When preamble is enabled we should set the | 313 | * When preamble is enabled we should set the |
314 | * preamble bit for the signal. | 314 | * preamble bit for the signal. |
315 | */ | 315 | */ |
316 | if (rt2x00_get_rate_preamble(rate->hw_value)) | 316 | if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) |
317 | txdesc->signal |= 0x08; | 317 | txdesc->signal |= 0x08; |
318 | } | 318 | } |
319 | } | 319 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 83df312ac56..0b29d767a25 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -434,11 +434,11 @@ static int rt2x00usb_find_endpoints(struct rt2x00_dev *rt2x00dev) | |||
434 | 434 | ||
435 | if (usb_endpoint_is_bulk_in(ep_desc)) { | 435 | if (usb_endpoint_is_bulk_in(ep_desc)) { |
436 | rt2x00usb_assign_endpoint(rt2x00dev->rx, ep_desc); | 436 | rt2x00usb_assign_endpoint(rt2x00dev->rx, ep_desc); |
437 | } else if (usb_endpoint_is_bulk_out(ep_desc)) { | 437 | } else if (usb_endpoint_is_bulk_out(ep_desc) && |
438 | (queue != queue_end(rt2x00dev))) { | ||
438 | rt2x00usb_assign_endpoint(queue, ep_desc); | 439 | rt2x00usb_assign_endpoint(queue, ep_desc); |
440 | queue = queue_next(queue); | ||
439 | 441 | ||
440 | if (queue != queue_end(rt2x00dev)) | ||
441 | queue = queue_next(queue); | ||
442 | tx_ep_desc = ep_desc; | 442 | tx_ep_desc = ep_desc; |
443 | } | 443 | } |
444 | } | 444 | } |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index d638a8a5937..96a8d69f879 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -2321,6 +2321,7 @@ static struct usb_device_id rt73usb_device_table[] = { | |||
2321 | /* Linksys */ | 2321 | /* Linksys */ |
2322 | { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) }, | 2322 | { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) }, |
2323 | { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) }, | 2323 | { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) }, |
2324 | { USB_DEVICE(0x13b1, 0x0028), USB_DEVICE_DATA(&rt73usb_ops) }, | ||
2324 | /* MSI */ | 2325 | /* MSI */ |
2325 | { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) }, | 2326 | { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) }, |
2326 | { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) }, | 2327 | { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) }, |
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c index 5f887fb137a..387c133ec0f 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c | |||
@@ -897,6 +897,7 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev, | |||
897 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | | 897 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | |
898 | IEEE80211_HW_RX_INCLUDES_FCS | | 898 | IEEE80211_HW_RX_INCLUDES_FCS | |
899 | IEEE80211_HW_SIGNAL_UNSPEC; | 899 | IEEE80211_HW_SIGNAL_UNSPEC; |
900 | dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); | ||
900 | dev->queues = 1; | 901 | dev->queues = 1; |
901 | dev->max_signal = 65; | 902 | dev->max_signal = 65; |
902 | 903 | ||
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c index 00ce3ef39ab..6ad6bac3770 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c | |||
@@ -213,7 +213,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
213 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 213 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
214 | if (!urb) { | 214 | if (!urb) { |
215 | kfree_skb(skb); | 215 | kfree_skb(skb); |
216 | return -ENOMEM; | 216 | return NETDEV_TX_OK; |
217 | } | 217 | } |
218 | 218 | ||
219 | flags = skb->len; | 219 | flags = skb->len; |
@@ -281,7 +281,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
281 | } | 281 | } |
282 | usb_free_urb(urb); | 282 | usb_free_urb(urb); |
283 | 283 | ||
284 | return rc; | 284 | return NETDEV_TX_OK; |
285 | } | 285 | } |
286 | 286 | ||
287 | static void rtl8187_rx_cb(struct urb *urb) | 287 | static void rtl8187_rx_cb(struct urb *urb) |
@@ -1471,6 +1471,7 @@ static void __devexit rtl8187_disconnect(struct usb_interface *intf) | |||
1471 | ieee80211_unregister_hw(dev); | 1471 | ieee80211_unregister_hw(dev); |
1472 | 1472 | ||
1473 | priv = dev->priv; | 1473 | priv = dev->priv; |
1474 | usb_reset_device(priv->udev); | ||
1474 | usb_put_dev(interface_to_usbdev(intf)); | 1475 | usb_put_dev(interface_to_usbdev(intf)); |
1475 | ieee80211_free_hw(dev); | 1476 | ieee80211_free_hw(dev); |
1476 | } | 1477 | } |
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c index e1b0ad6e918..fa65a2b2ae2 100644 --- a/drivers/of/of_i2c.c +++ b/drivers/of/of_i2c.c | |||
@@ -66,4 +66,23 @@ void of_register_i2c_devices(struct i2c_adapter *adap, | |||
66 | } | 66 | } |
67 | EXPORT_SYMBOL(of_register_i2c_devices); | 67 | EXPORT_SYMBOL(of_register_i2c_devices); |
68 | 68 | ||
69 | static int of_dev_node_match(struct device *dev, void *data) | ||
70 | { | ||
71 | return dev_archdata_get_node(&dev->archdata) == data; | ||
72 | } | ||
73 | |||
74 | /* must call put_device() when done with returned i2c_client device */ | ||
75 | struct i2c_client *of_find_i2c_device_by_node(struct device_node *node) | ||
76 | { | ||
77 | struct device *dev; | ||
78 | |||
79 | dev = bus_find_device(&i2c_bus_type, NULL, node, | ||
80 | of_dev_node_match); | ||
81 | if (!dev) | ||
82 | return NULL; | ||
83 | |||
84 | return to_i2c_client(dev); | ||
85 | } | ||
86 | EXPORT_SYMBOL(of_find_i2c_device_by_node); | ||
87 | |||
69 | MODULE_LICENSE("GPL"); | 88 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index f09b1010d47..803d9ddd6e7 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -266,6 +266,8 @@ static int detect_ejectable_slots(struct pci_bus *pbus) | |||
266 | int found = acpi_pci_detect_ejectable(pbus); | 266 | int found = acpi_pci_detect_ejectable(pbus); |
267 | if (!found) { | 267 | if (!found) { |
268 | acpi_handle bridge_handle = acpi_pci_get_bridge_handle(pbus); | 268 | acpi_handle bridge_handle = acpi_pci_get_bridge_handle(pbus); |
269 | if (!bridge_handle) | ||
270 | return 0; | ||
269 | acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge_handle, (u32)1, | 271 | acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge_handle, (u32)1, |
270 | is_pci_dock_device, (void *)&found, NULL); | 272 | is_pci_dock_device, (void *)&found, NULL); |
271 | } | 273 | } |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index c12f6c79069..e491fdedf70 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1260,15 +1260,14 @@ void pci_pm_init(struct pci_dev *dev) | |||
1260 | /* find PCI PM capability in list */ | 1260 | /* find PCI PM capability in list */ |
1261 | pm = pci_find_capability(dev, PCI_CAP_ID_PM); | 1261 | pm = pci_find_capability(dev, PCI_CAP_ID_PM); |
1262 | if (!pm) | 1262 | if (!pm) |
1263 | goto Exit; | 1263 | return; |
1264 | |||
1265 | /* Check device's ability to generate PME# */ | 1264 | /* Check device's ability to generate PME# */ |
1266 | pci_read_config_word(dev, pm + PCI_PM_PMC, &pmc); | 1265 | pci_read_config_word(dev, pm + PCI_PM_PMC, &pmc); |
1267 | 1266 | ||
1268 | if ((pmc & PCI_PM_CAP_VER_MASK) > 3) { | 1267 | if ((pmc & PCI_PM_CAP_VER_MASK) > 3) { |
1269 | dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n", | 1268 | dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n", |
1270 | pmc & PCI_PM_CAP_VER_MASK); | 1269 | pmc & PCI_PM_CAP_VER_MASK); |
1271 | goto Exit; | 1270 | return; |
1272 | } | 1271 | } |
1273 | 1272 | ||
1274 | dev->pm_cap = pm; | 1273 | dev->pm_cap = pm; |
@@ -1307,9 +1306,6 @@ void pci_pm_init(struct pci_dev *dev) | |||
1307 | } else { | 1306 | } else { |
1308 | dev->pme_support = 0; | 1307 | dev->pme_support = 0; |
1309 | } | 1308 | } |
1310 | |||
1311 | Exit: | ||
1312 | pci_update_current_state(dev, PCI_D0); | ||
1313 | } | 1309 | } |
1314 | 1310 | ||
1315 | /** | 1311 | /** |
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c index 645d7a60e41..ec22284eed3 100644 --- a/drivers/pci/syscall.c +++ b/drivers/pci/syscall.c | |||
@@ -14,10 +14,8 @@ | |||
14 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
15 | #include "pci.h" | 15 | #include "pci.h" |
16 | 16 | ||
17 | asmlinkage long | 17 | SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, |
18 | sys_pciconfig_read(unsigned long bus, unsigned long dfn, | 18 | unsigned long, off, unsigned long, len, void __user *, buf) |
19 | unsigned long off, unsigned long len, | ||
20 | void __user *buf) | ||
21 | { | 19 | { |
22 | struct pci_dev *dev; | 20 | struct pci_dev *dev; |
23 | u8 byte; | 21 | u8 byte; |
@@ -86,10 +84,8 @@ error: | |||
86 | return err; | 84 | return err; |
87 | } | 85 | } |
88 | 86 | ||
89 | asmlinkage long | 87 | SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn, |
90 | sys_pciconfig_write(unsigned long bus, unsigned long dfn, | 88 | unsigned long, off, unsigned long, len, void __user *, buf) |
91 | unsigned long off, unsigned long len, | ||
92 | void __user *buf) | ||
93 | { | 89 | { |
94 | struct pci_dev *dev; | 90 | struct pci_dev *dev; |
95 | u8 byte; | 91 | u8 byte; |
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c index a34284b1482..d187ba4c5e0 100644 --- a/drivers/pcmcia/electra_cf.c +++ b/drivers/pcmcia/electra_cf.c | |||
@@ -297,7 +297,7 @@ static int __devinit electra_cf_probe(struct of_device *ofdev, | |||
297 | goto fail3; | 297 | goto fail3; |
298 | } | 298 | } |
299 | 299 | ||
300 | dev_info(device, "at mem 0x%lx io 0x%lx irq %d\n", | 300 | dev_info(device, "at mem 0x%lx io 0x%llx irq %d\n", |
301 | cf->mem_phys, io.start, cf->irq); | 301 | cf->mem_phys, io.start, cf->irq); |
302 | 302 | ||
303 | cf->active = 1; | 303 | cf->active = 1; |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index e65448e99b4..1a266d4ab5f 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -54,6 +54,18 @@ config ASUS_LAPTOP | |||
54 | 54 | ||
55 | If you have an ACPI-compatible ASUS laptop, say Y or M here. | 55 | If you have an ACPI-compatible ASUS laptop, say Y or M here. |
56 | 56 | ||
57 | config DELL_LAPTOP | ||
58 | tristate "Dell Laptop Extras (EXPERIMENTAL)" | ||
59 | depends on X86 | ||
60 | depends on DCDBAS | ||
61 | depends on EXPERIMENTAL | ||
62 | depends on BACKLIGHT_CLASS_DEVICE | ||
63 | depends on RFKILL | ||
64 | default n | ||
65 | ---help--- | ||
66 | This driver adds support for rfkill and backlight control to Dell | ||
67 | laptops. | ||
68 | |||
57 | config FUJITSU_LAPTOP | 69 | config FUJITSU_LAPTOP |
58 | tristate "Fujitsu Laptop Extras" | 70 | tristate "Fujitsu Laptop Extras" |
59 | depends on ACPI | 71 | depends on ACPI |
@@ -192,6 +204,17 @@ config THINKPAD_ACPI | |||
192 | 204 | ||
193 | If you have an IBM or Lenovo ThinkPad laptop, say Y or M here. | 205 | If you have an IBM or Lenovo ThinkPad laptop, say Y or M here. |
194 | 206 | ||
207 | config THINKPAD_ACPI_DEBUGFACILITIES | ||
208 | bool "Maintainer debug facilities" | ||
209 | depends on THINKPAD_ACPI | ||
210 | default n | ||
211 | ---help--- | ||
212 | Enables extra stuff in the thinkpad-acpi which is completely useless | ||
213 | for normal use. Read the driver source to find out what it does. | ||
214 | |||
215 | Say N here, unless you were told by a kernel maintainer to do | ||
216 | otherwise. | ||
217 | |||
195 | config THINKPAD_ACPI_DEBUG | 218 | config THINKPAD_ACPI_DEBUG |
196 | bool "Verbose debug mode" | 219 | bool "Verbose debug mode" |
197 | depends on THINKPAD_ACPI | 220 | depends on THINKPAD_ACPI |
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile index 1e9de2ae0de..e29065120be 100644 --- a/drivers/platform/x86/Makefile +++ b/drivers/platform/x86/Makefile | |||
@@ -6,6 +6,7 @@ obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o | |||
6 | obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o | 6 | obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o |
7 | obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o | 7 | obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o |
8 | obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o | 8 | obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o |
9 | obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o | ||
9 | obj-$(CONFIG_ACER_WMI) += acer-wmi.o | 10 | obj-$(CONFIG_ACER_WMI) += acer-wmi.o |
10 | obj-$(CONFIG_HP_WMI) += hp-wmi.o | 11 | obj-$(CONFIG_HP_WMI) += hp-wmi.o |
11 | obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o | 12 | obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o |
diff --git a/drivers/misc/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index 4d33a2068b7..16e11c2ee19 100644 --- a/drivers/misc/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/rfkill.h> | 22 | #include <linux/rfkill.h> |
23 | #include <linux/power_supply.h> | 23 | #include <linux/power_supply.h> |
24 | #include <linux/acpi.h> | 24 | #include <linux/acpi.h> |
25 | #include "../firmware/dcdbas.h" | 25 | #include "../../firmware/dcdbas.h" |
26 | 26 | ||
27 | #define BRIGHTNESS_TOKEN 0x7d | 27 | #define BRIGHTNESS_TOKEN 0x7d |
28 | 28 | ||
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 02fe2b8b893..9d93cb971e5 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -90,7 +90,7 @@ enum { | |||
90 | }; | 90 | }; |
91 | 91 | ||
92 | static const char *cm_getv[] = { | 92 | static const char *cm_getv[] = { |
93 | "WLDG", NULL, NULL, NULL, | 93 | "WLDG", "BTHG", NULL, NULL, |
94 | "CAMG", NULL, NULL, NULL, | 94 | "CAMG", NULL, NULL, NULL, |
95 | NULL, "PBLG", NULL, NULL, | 95 | NULL, "PBLG", NULL, NULL, |
96 | "CFVG", NULL, NULL, NULL, | 96 | "CFVG", NULL, NULL, NULL, |
@@ -99,7 +99,7 @@ static const char *cm_getv[] = { | |||
99 | }; | 99 | }; |
100 | 100 | ||
101 | static const char *cm_setv[] = { | 101 | static const char *cm_setv[] = { |
102 | "WLDS", NULL, NULL, NULL, | 102 | "WLDS", "BTHS", NULL, NULL, |
103 | "CAMS", NULL, NULL, NULL, | 103 | "CAMS", NULL, NULL, NULL, |
104 | "SDSP", "PBLS", "HDPS", NULL, | 104 | "SDSP", "PBLS", "HDPS", NULL, |
105 | "CFVS", NULL, NULL, NULL, | 105 | "CFVS", NULL, NULL, NULL, |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 3478453eba7..bcbc05107ba 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * 02110-1301, USA. | 21 | * 02110-1301, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define TPACPI_VERSION "0.21" | 24 | #define TPACPI_VERSION "0.22" |
25 | #define TPACPI_SYSFS_VERSION 0x020200 | 25 | #define TPACPI_SYSFS_VERSION 0x020200 |
26 | 26 | ||
27 | /* | 27 | /* |
@@ -122,6 +122,27 @@ enum { | |||
122 | #define TPACPI_HKEY_INPUT_PRODUCT 0x5054 /* "TP" */ | 122 | #define TPACPI_HKEY_INPUT_PRODUCT 0x5054 /* "TP" */ |
123 | #define TPACPI_HKEY_INPUT_VERSION 0x4101 | 123 | #define TPACPI_HKEY_INPUT_VERSION 0x4101 |
124 | 124 | ||
125 | /* ACPI \WGSV commands */ | ||
126 | enum { | ||
127 | TP_ACPI_WGSV_GET_STATE = 0x01, /* Get state information */ | ||
128 | TP_ACPI_WGSV_PWR_ON_ON_RESUME = 0x02, /* Resume WWAN powered on */ | ||
129 | TP_ACPI_WGSV_PWR_OFF_ON_RESUME = 0x03, /* Resume WWAN powered off */ | ||
130 | TP_ACPI_WGSV_SAVE_STATE = 0x04, /* Save state for S4/S5 */ | ||
131 | }; | ||
132 | |||
133 | /* TP_ACPI_WGSV_GET_STATE bits */ | ||
134 | enum { | ||
135 | TP_ACPI_WGSV_STATE_WWANEXIST = 0x0001, /* WWAN hw available */ | ||
136 | TP_ACPI_WGSV_STATE_WWANPWR = 0x0002, /* WWAN radio enabled */ | ||
137 | TP_ACPI_WGSV_STATE_WWANPWRRES = 0x0004, /* WWAN state at resume */ | ||
138 | TP_ACPI_WGSV_STATE_WWANBIOSOFF = 0x0008, /* WWAN disabled in BIOS */ | ||
139 | TP_ACPI_WGSV_STATE_BLTHEXIST = 0x0001, /* BLTH hw available */ | ||
140 | TP_ACPI_WGSV_STATE_BLTHPWR = 0x0002, /* BLTH radio enabled */ | ||
141 | TP_ACPI_WGSV_STATE_BLTHPWRRES = 0x0004, /* BLTH state at resume */ | ||
142 | TP_ACPI_WGSV_STATE_BLTHBIOSOFF = 0x0008, /* BLTH disabled in BIOS */ | ||
143 | TP_ACPI_WGSV_STATE_UWBEXIST = 0x0010, /* UWB hw available */ | ||
144 | TP_ACPI_WGSV_STATE_UWBPWR = 0x0020, /* UWB radio enabled */ | ||
145 | }; | ||
125 | 146 | ||
126 | /**************************************************************************** | 147 | /**************************************************************************** |
127 | * Main driver | 148 | * Main driver |
@@ -148,14 +169,17 @@ enum { | |||
148 | enum { | 169 | enum { |
149 | TPACPI_RFK_BLUETOOTH_SW_ID = 0, | 170 | TPACPI_RFK_BLUETOOTH_SW_ID = 0, |
150 | TPACPI_RFK_WWAN_SW_ID, | 171 | TPACPI_RFK_WWAN_SW_ID, |
172 | TPACPI_RFK_UWB_SW_ID, | ||
151 | }; | 173 | }; |
152 | 174 | ||
153 | /* Debugging */ | 175 | /* Debugging */ |
154 | #define TPACPI_LOG TPACPI_FILE ": " | 176 | #define TPACPI_LOG TPACPI_FILE ": " |
155 | #define TPACPI_ERR KERN_ERR TPACPI_LOG | 177 | #define TPACPI_ALERT KERN_ALERT TPACPI_LOG |
156 | #define TPACPI_NOTICE KERN_NOTICE TPACPI_LOG | 178 | #define TPACPI_CRIT KERN_CRIT TPACPI_LOG |
157 | #define TPACPI_INFO KERN_INFO TPACPI_LOG | 179 | #define TPACPI_ERR KERN_ERR TPACPI_LOG |
158 | #define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG | 180 | #define TPACPI_NOTICE KERN_NOTICE TPACPI_LOG |
181 | #define TPACPI_INFO KERN_INFO TPACPI_LOG | ||
182 | #define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG | ||
159 | 183 | ||
160 | #define TPACPI_DBG_ALL 0xffff | 184 | #define TPACPI_DBG_ALL 0xffff |
161 | #define TPACPI_DBG_INIT 0x0001 | 185 | #define TPACPI_DBG_INIT 0x0001 |
@@ -201,6 +225,7 @@ struct ibm_struct { | |||
201 | void (*exit) (void); | 225 | void (*exit) (void); |
202 | void (*resume) (void); | 226 | void (*resume) (void); |
203 | void (*suspend) (pm_message_t state); | 227 | void (*suspend) (pm_message_t state); |
228 | void (*shutdown) (void); | ||
204 | 229 | ||
205 | struct list_head all_drivers; | 230 | struct list_head all_drivers; |
206 | 231 | ||
@@ -239,6 +264,7 @@ static struct { | |||
239 | u32 bright_16levels:1; | 264 | u32 bright_16levels:1; |
240 | u32 bright_acpimode:1; | 265 | u32 bright_acpimode:1; |
241 | u32 wan:1; | 266 | u32 wan:1; |
267 | u32 uwb:1; | ||
242 | u32 fan_ctrl_status_undef:1; | 268 | u32 fan_ctrl_status_undef:1; |
243 | u32 input_device_registered:1; | 269 | u32 input_device_registered:1; |
244 | u32 platform_drv_registered:1; | 270 | u32 platform_drv_registered:1; |
@@ -288,6 +314,18 @@ struct tpacpi_led_classdev { | |||
288 | unsigned int led; | 314 | unsigned int led; |
289 | }; | 315 | }; |
290 | 316 | ||
317 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
318 | static int dbg_wlswemul; | ||
319 | static int tpacpi_wlsw_emulstate; | ||
320 | static int dbg_bluetoothemul; | ||
321 | static int tpacpi_bluetooth_emulstate; | ||
322 | static int dbg_wwanemul; | ||
323 | static int tpacpi_wwan_emulstate; | ||
324 | static int dbg_uwbemul; | ||
325 | static int tpacpi_uwb_emulstate; | ||
326 | #endif | ||
327 | |||
328 | |||
291 | /**************************************************************************** | 329 | /**************************************************************************** |
292 | **************************************************************************** | 330 | **************************************************************************** |
293 | * | 331 | * |
@@ -728,6 +766,18 @@ static int tpacpi_resume_handler(struct platform_device *pdev) | |||
728 | return 0; | 766 | return 0; |
729 | } | 767 | } |
730 | 768 | ||
769 | static void tpacpi_shutdown_handler(struct platform_device *pdev) | ||
770 | { | ||
771 | struct ibm_struct *ibm, *itmp; | ||
772 | |||
773 | list_for_each_entry_safe(ibm, itmp, | ||
774 | &tpacpi_all_drivers, | ||
775 | all_drivers) { | ||
776 | if (ibm->shutdown) | ||
777 | (ibm->shutdown)(); | ||
778 | } | ||
779 | } | ||
780 | |||
731 | static struct platform_driver tpacpi_pdriver = { | 781 | static struct platform_driver tpacpi_pdriver = { |
732 | .driver = { | 782 | .driver = { |
733 | .name = TPACPI_DRVR_NAME, | 783 | .name = TPACPI_DRVR_NAME, |
@@ -735,6 +785,7 @@ static struct platform_driver tpacpi_pdriver = { | |||
735 | }, | 785 | }, |
736 | .suspend = tpacpi_suspend_handler, | 786 | .suspend = tpacpi_suspend_handler, |
737 | .resume = tpacpi_resume_handler, | 787 | .resume = tpacpi_resume_handler, |
788 | .shutdown = tpacpi_shutdown_handler, | ||
738 | }; | 789 | }; |
739 | 790 | ||
740 | static struct platform_driver tpacpi_hwmon_pdriver = { | 791 | static struct platform_driver tpacpi_hwmon_pdriver = { |
@@ -922,11 +973,27 @@ static int __init tpacpi_new_rfkill(const unsigned int id, | |||
922 | struct rfkill **rfk, | 973 | struct rfkill **rfk, |
923 | const enum rfkill_type rfktype, | 974 | const enum rfkill_type rfktype, |
924 | const char *name, | 975 | const char *name, |
976 | const bool set_default, | ||
925 | int (*toggle_radio)(void *, enum rfkill_state), | 977 | int (*toggle_radio)(void *, enum rfkill_state), |
926 | int (*get_state)(void *, enum rfkill_state *)) | 978 | int (*get_state)(void *, enum rfkill_state *)) |
927 | { | 979 | { |
928 | int res; | 980 | int res; |
929 | enum rfkill_state initial_state; | 981 | enum rfkill_state initial_state = RFKILL_STATE_SOFT_BLOCKED; |
982 | |||
983 | res = get_state(NULL, &initial_state); | ||
984 | if (res < 0) { | ||
985 | printk(TPACPI_ERR | ||
986 | "failed to read initial state for %s, error %d; " | ||
987 | "will turn radio off\n", name, res); | ||
988 | } else if (set_default) { | ||
989 | /* try to set the initial state as the default for the rfkill | ||
990 | * type, since we ask the firmware to preserve it across S5 in | ||
991 | * NVRAM */ | ||
992 | rfkill_set_default(rfktype, | ||
993 | (initial_state == RFKILL_STATE_UNBLOCKED) ? | ||
994 | RFKILL_STATE_UNBLOCKED : | ||
995 | RFKILL_STATE_SOFT_BLOCKED); | ||
996 | } | ||
930 | 997 | ||
931 | *rfk = rfkill_allocate(&tpacpi_pdev->dev, rfktype); | 998 | *rfk = rfkill_allocate(&tpacpi_pdev->dev, rfktype); |
932 | if (!*rfk) { | 999 | if (!*rfk) { |
@@ -938,9 +1005,7 @@ static int __init tpacpi_new_rfkill(const unsigned int id, | |||
938 | (*rfk)->name = name; | 1005 | (*rfk)->name = name; |
939 | (*rfk)->get_state = get_state; | 1006 | (*rfk)->get_state = get_state; |
940 | (*rfk)->toggle_radio = toggle_radio; | 1007 | (*rfk)->toggle_radio = toggle_radio; |
941 | 1008 | (*rfk)->state = initial_state; | |
942 | if (!get_state(NULL, &initial_state)) | ||
943 | (*rfk)->state = initial_state; | ||
944 | 1009 | ||
945 | res = rfkill_register(*rfk); | 1010 | res = rfkill_register(*rfk); |
946 | if (res < 0) { | 1011 | if (res < 0) { |
@@ -1006,6 +1071,119 @@ static DRIVER_ATTR(version, S_IRUGO, | |||
1006 | 1071 | ||
1007 | /* --------------------------------------------------------------------- */ | 1072 | /* --------------------------------------------------------------------- */ |
1008 | 1073 | ||
1074 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
1075 | |||
1076 | static void tpacpi_send_radiosw_update(void); | ||
1077 | |||
1078 | /* wlsw_emulstate ------------------------------------------------------ */ | ||
1079 | static ssize_t tpacpi_driver_wlsw_emulstate_show(struct device_driver *drv, | ||
1080 | char *buf) | ||
1081 | { | ||
1082 | return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_wlsw_emulstate); | ||
1083 | } | ||
1084 | |||
1085 | static ssize_t tpacpi_driver_wlsw_emulstate_store(struct device_driver *drv, | ||
1086 | const char *buf, size_t count) | ||
1087 | { | ||
1088 | unsigned long t; | ||
1089 | |||
1090 | if (parse_strtoul(buf, 1, &t)) | ||
1091 | return -EINVAL; | ||
1092 | |||
1093 | if (tpacpi_wlsw_emulstate != t) { | ||
1094 | tpacpi_wlsw_emulstate = !!t; | ||
1095 | tpacpi_send_radiosw_update(); | ||
1096 | } else | ||
1097 | tpacpi_wlsw_emulstate = !!t; | ||
1098 | |||
1099 | return count; | ||
1100 | } | ||
1101 | |||
1102 | static DRIVER_ATTR(wlsw_emulstate, S_IWUSR | S_IRUGO, | ||
1103 | tpacpi_driver_wlsw_emulstate_show, | ||
1104 | tpacpi_driver_wlsw_emulstate_store); | ||
1105 | |||
1106 | /* bluetooth_emulstate ------------------------------------------------- */ | ||
1107 | static ssize_t tpacpi_driver_bluetooth_emulstate_show( | ||
1108 | struct device_driver *drv, | ||
1109 | char *buf) | ||
1110 | { | ||
1111 | return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_bluetooth_emulstate); | ||
1112 | } | ||
1113 | |||
1114 | static ssize_t tpacpi_driver_bluetooth_emulstate_store( | ||
1115 | struct device_driver *drv, | ||
1116 | const char *buf, size_t count) | ||
1117 | { | ||
1118 | unsigned long t; | ||
1119 | |||
1120 | if (parse_strtoul(buf, 1, &t)) | ||
1121 | return -EINVAL; | ||
1122 | |||
1123 | tpacpi_bluetooth_emulstate = !!t; | ||
1124 | |||
1125 | return count; | ||
1126 | } | ||
1127 | |||
1128 | static DRIVER_ATTR(bluetooth_emulstate, S_IWUSR | S_IRUGO, | ||
1129 | tpacpi_driver_bluetooth_emulstate_show, | ||
1130 | tpacpi_driver_bluetooth_emulstate_store); | ||
1131 | |||
1132 | /* wwan_emulstate ------------------------------------------------- */ | ||
1133 | static ssize_t tpacpi_driver_wwan_emulstate_show( | ||
1134 | struct device_driver *drv, | ||
1135 | char *buf) | ||
1136 | { | ||
1137 | return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_wwan_emulstate); | ||
1138 | } | ||
1139 | |||
1140 | static ssize_t tpacpi_driver_wwan_emulstate_store( | ||
1141 | struct device_driver *drv, | ||
1142 | const char *buf, size_t count) | ||
1143 | { | ||
1144 | unsigned long t; | ||
1145 | |||
1146 | if (parse_strtoul(buf, 1, &t)) | ||
1147 | return -EINVAL; | ||
1148 | |||
1149 | tpacpi_wwan_emulstate = !!t; | ||
1150 | |||
1151 | return count; | ||
1152 | } | ||
1153 | |||
1154 | static DRIVER_ATTR(wwan_emulstate, S_IWUSR | S_IRUGO, | ||
1155 | tpacpi_driver_wwan_emulstate_show, | ||
1156 | tpacpi_driver_wwan_emulstate_store); | ||
1157 | |||
1158 | /* uwb_emulstate ------------------------------------------------- */ | ||
1159 | static ssize_t tpacpi_driver_uwb_emulstate_show( | ||
1160 | struct device_driver *drv, | ||
1161 | char *buf) | ||
1162 | { | ||
1163 | return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_uwb_emulstate); | ||
1164 | } | ||
1165 | |||
1166 | static ssize_t tpacpi_driver_uwb_emulstate_store( | ||
1167 | struct device_driver *drv, | ||
1168 | const char *buf, size_t count) | ||
1169 | { | ||
1170 | unsigned long t; | ||
1171 | |||
1172 | if (parse_strtoul(buf, 1, &t)) | ||
1173 | return -EINVAL; | ||
1174 | |||
1175 | tpacpi_uwb_emulstate = !!t; | ||
1176 | |||
1177 | return count; | ||
1178 | } | ||
1179 | |||
1180 | static DRIVER_ATTR(uwb_emulstate, S_IWUSR | S_IRUGO, | ||
1181 | tpacpi_driver_uwb_emulstate_show, | ||
1182 | tpacpi_driver_uwb_emulstate_store); | ||
1183 | #endif | ||
1184 | |||
1185 | /* --------------------------------------------------------------------- */ | ||
1186 | |||
1009 | static struct driver_attribute *tpacpi_driver_attributes[] = { | 1187 | static struct driver_attribute *tpacpi_driver_attributes[] = { |
1010 | &driver_attr_debug_level, &driver_attr_version, | 1188 | &driver_attr_debug_level, &driver_attr_version, |
1011 | &driver_attr_interface_version, | 1189 | &driver_attr_interface_version, |
@@ -1022,6 +1200,17 @@ static int __init tpacpi_create_driver_attributes(struct device_driver *drv) | |||
1022 | i++; | 1200 | i++; |
1023 | } | 1201 | } |
1024 | 1202 | ||
1203 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
1204 | if (!res && dbg_wlswemul) | ||
1205 | res = driver_create_file(drv, &driver_attr_wlsw_emulstate); | ||
1206 | if (!res && dbg_bluetoothemul) | ||
1207 | res = driver_create_file(drv, &driver_attr_bluetooth_emulstate); | ||
1208 | if (!res && dbg_wwanemul) | ||
1209 | res = driver_create_file(drv, &driver_attr_wwan_emulstate); | ||
1210 | if (!res && dbg_uwbemul) | ||
1211 | res = driver_create_file(drv, &driver_attr_uwb_emulstate); | ||
1212 | #endif | ||
1213 | |||
1025 | return res; | 1214 | return res; |
1026 | } | 1215 | } |
1027 | 1216 | ||
@@ -1031,6 +1220,13 @@ static void tpacpi_remove_driver_attributes(struct device_driver *drv) | |||
1031 | 1220 | ||
1032 | for (i = 0; i < ARRAY_SIZE(tpacpi_driver_attributes); i++) | 1221 | for (i = 0; i < ARRAY_SIZE(tpacpi_driver_attributes); i++) |
1033 | driver_remove_file(drv, tpacpi_driver_attributes[i]); | 1222 | driver_remove_file(drv, tpacpi_driver_attributes[i]); |
1223 | |||
1224 | #ifdef THINKPAD_ACPI_DEBUGFACILITIES | ||
1225 | driver_remove_file(drv, &driver_attr_wlsw_emulstate); | ||
1226 | driver_remove_file(drv, &driver_attr_bluetooth_emulstate); | ||
1227 | driver_remove_file(drv, &driver_attr_wwan_emulstate); | ||
1228 | driver_remove_file(drv, &driver_attr_uwb_emulstate); | ||
1229 | #endif | ||
1034 | } | 1230 | } |
1035 | 1231 | ||
1036 | /**************************************************************************** | 1232 | /**************************************************************************** |
@@ -1216,6 +1412,12 @@ static struct attribute_set *hotkey_dev_attributes; | |||
1216 | 1412 | ||
1217 | static int hotkey_get_wlsw(int *status) | 1413 | static int hotkey_get_wlsw(int *status) |
1218 | { | 1414 | { |
1415 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
1416 | if (dbg_wlswemul) { | ||
1417 | *status = !!tpacpi_wlsw_emulstate; | ||
1418 | return 0; | ||
1419 | } | ||
1420 | #endif | ||
1219 | if (!acpi_evalf(hkey_handle, status, "WLSW", "d")) | 1421 | if (!acpi_evalf(hkey_handle, status, "WLSW", "d")) |
1220 | return -EIO; | 1422 | return -EIO; |
1221 | return 0; | 1423 | return 0; |
@@ -1678,7 +1880,7 @@ static ssize_t hotkey_mask_show(struct device *dev, | |||
1678 | { | 1880 | { |
1679 | int res; | 1881 | int res; |
1680 | 1882 | ||
1681 | if (mutex_lock_interruptible(&hotkey_mutex)) | 1883 | if (mutex_lock_killable(&hotkey_mutex)) |
1682 | return -ERESTARTSYS; | 1884 | return -ERESTARTSYS; |
1683 | res = hotkey_mask_get(); | 1885 | res = hotkey_mask_get(); |
1684 | mutex_unlock(&hotkey_mutex); | 1886 | mutex_unlock(&hotkey_mutex); |
@@ -1697,7 +1899,7 @@ static ssize_t hotkey_mask_store(struct device *dev, | |||
1697 | if (parse_strtoul(buf, 0xffffffffUL, &t)) | 1899 | if (parse_strtoul(buf, 0xffffffffUL, &t)) |
1698 | return -EINVAL; | 1900 | return -EINVAL; |
1699 | 1901 | ||
1700 | if (mutex_lock_interruptible(&hotkey_mutex)) | 1902 | if (mutex_lock_killable(&hotkey_mutex)) |
1701 | return -ERESTARTSYS; | 1903 | return -ERESTARTSYS; |
1702 | 1904 | ||
1703 | res = hotkey_mask_set(t); | 1905 | res = hotkey_mask_set(t); |
@@ -1783,7 +1985,7 @@ static ssize_t hotkey_source_mask_store(struct device *dev, | |||
1783 | ((t & ~TPACPI_HKEY_NVRAM_KNOWN_MASK) != 0)) | 1985 | ((t & ~TPACPI_HKEY_NVRAM_KNOWN_MASK) != 0)) |
1784 | return -EINVAL; | 1986 | return -EINVAL; |
1785 | 1987 | ||
1786 | if (mutex_lock_interruptible(&hotkey_mutex)) | 1988 | if (mutex_lock_killable(&hotkey_mutex)) |
1787 | return -ERESTARTSYS; | 1989 | return -ERESTARTSYS; |
1788 | 1990 | ||
1789 | HOTKEY_CONFIG_CRITICAL_START | 1991 | HOTKEY_CONFIG_CRITICAL_START |
@@ -1818,7 +2020,7 @@ static ssize_t hotkey_poll_freq_store(struct device *dev, | |||
1818 | if (parse_strtoul(buf, 25, &t)) | 2020 | if (parse_strtoul(buf, 25, &t)) |
1819 | return -EINVAL; | 2021 | return -EINVAL; |
1820 | 2022 | ||
1821 | if (mutex_lock_interruptible(&hotkey_mutex)) | 2023 | if (mutex_lock_killable(&hotkey_mutex)) |
1822 | return -ERESTARTSYS; | 2024 | return -ERESTARTSYS; |
1823 | 2025 | ||
1824 | hotkey_poll_freq = t; | 2026 | hotkey_poll_freq = t; |
@@ -1958,6 +2160,7 @@ static struct attribute *hotkey_mask_attributes[] __initdata = { | |||
1958 | 2160 | ||
1959 | static void bluetooth_update_rfk(void); | 2161 | static void bluetooth_update_rfk(void); |
1960 | static void wan_update_rfk(void); | 2162 | static void wan_update_rfk(void); |
2163 | static void uwb_update_rfk(void); | ||
1961 | static void tpacpi_send_radiosw_update(void) | 2164 | static void tpacpi_send_radiosw_update(void) |
1962 | { | 2165 | { |
1963 | int wlsw; | 2166 | int wlsw; |
@@ -1967,6 +2170,8 @@ static void tpacpi_send_radiosw_update(void) | |||
1967 | bluetooth_update_rfk(); | 2170 | bluetooth_update_rfk(); |
1968 | if (tp_features.wan) | 2171 | if (tp_features.wan) |
1969 | wan_update_rfk(); | 2172 | wan_update_rfk(); |
2173 | if (tp_features.uwb) | ||
2174 | uwb_update_rfk(); | ||
1970 | 2175 | ||
1971 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) { | 2176 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) { |
1972 | mutex_lock(&tpacpi_inputdev_send_mutex); | 2177 | mutex_lock(&tpacpi_inputdev_send_mutex); |
@@ -2222,6 +2427,13 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
2222 | hotkey_source_mask, hotkey_poll_freq); | 2427 | hotkey_source_mask, hotkey_poll_freq); |
2223 | #endif | 2428 | #endif |
2224 | 2429 | ||
2430 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
2431 | if (dbg_wlswemul) { | ||
2432 | tp_features.hotkey_wlsw = 1; | ||
2433 | printk(TPACPI_INFO | ||
2434 | "radio switch emulation enabled\n"); | ||
2435 | } else | ||
2436 | #endif | ||
2225 | /* Not all thinkpads have a hardware radio switch */ | 2437 | /* Not all thinkpads have a hardware radio switch */ |
2226 | if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { | 2438 | if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { |
2227 | tp_features.hotkey_wlsw = 1; | 2439 | tp_features.hotkey_wlsw = 1; |
@@ -2361,13 +2573,154 @@ err_exit: | |||
2361 | return (res < 0)? res : 1; | 2573 | return (res < 0)? res : 1; |
2362 | } | 2574 | } |
2363 | 2575 | ||
2576 | static bool hotkey_notify_hotkey(const u32 hkey, | ||
2577 | bool *send_acpi_ev, | ||
2578 | bool *ignore_acpi_ev) | ||
2579 | { | ||
2580 | /* 0x1000-0x1FFF: key presses */ | ||
2581 | unsigned int scancode = hkey & 0xfff; | ||
2582 | *send_acpi_ev = true; | ||
2583 | *ignore_acpi_ev = false; | ||
2584 | |||
2585 | if (scancode > 0 && scancode < 0x21) { | ||
2586 | scancode--; | ||
2587 | if (!(hotkey_source_mask & (1 << scancode))) { | ||
2588 | tpacpi_input_send_key(scancode); | ||
2589 | *send_acpi_ev = false; | ||
2590 | } else { | ||
2591 | *ignore_acpi_ev = true; | ||
2592 | } | ||
2593 | return true; | ||
2594 | } | ||
2595 | return false; | ||
2596 | } | ||
2597 | |||
2598 | static bool hotkey_notify_wakeup(const u32 hkey, | ||
2599 | bool *send_acpi_ev, | ||
2600 | bool *ignore_acpi_ev) | ||
2601 | { | ||
2602 | /* 0x2000-0x2FFF: Wakeup reason */ | ||
2603 | *send_acpi_ev = true; | ||
2604 | *ignore_acpi_ev = false; | ||
2605 | |||
2606 | switch (hkey) { | ||
2607 | case 0x2304: /* suspend, undock */ | ||
2608 | case 0x2404: /* hibernation, undock */ | ||
2609 | hotkey_wakeup_reason = TP_ACPI_WAKEUP_UNDOCK; | ||
2610 | *ignore_acpi_ev = true; | ||
2611 | break; | ||
2612 | |||
2613 | case 0x2305: /* suspend, bay eject */ | ||
2614 | case 0x2405: /* hibernation, bay eject */ | ||
2615 | hotkey_wakeup_reason = TP_ACPI_WAKEUP_BAYEJ; | ||
2616 | *ignore_acpi_ev = true; | ||
2617 | break; | ||
2618 | |||
2619 | case 0x2313: /* Battery on critical low level (S3) */ | ||
2620 | case 0x2413: /* Battery on critical low level (S4) */ | ||
2621 | printk(TPACPI_ALERT | ||
2622 | "EMERGENCY WAKEUP: battery almost empty\n"); | ||
2623 | /* how to auto-heal: */ | ||
2624 | /* 2313: woke up from S3, go to S4/S5 */ | ||
2625 | /* 2413: woke up from S4, go to S5 */ | ||
2626 | break; | ||
2627 | |||
2628 | default: | ||
2629 | return false; | ||
2630 | } | ||
2631 | |||
2632 | if (hotkey_wakeup_reason != TP_ACPI_WAKEUP_NONE) { | ||
2633 | printk(TPACPI_INFO | ||
2634 | "woke up due to a hot-unplug " | ||
2635 | "request...\n"); | ||
2636 | hotkey_wakeup_reason_notify_change(); | ||
2637 | } | ||
2638 | return true; | ||
2639 | } | ||
2640 | |||
2641 | static bool hotkey_notify_usrevent(const u32 hkey, | ||
2642 | bool *send_acpi_ev, | ||
2643 | bool *ignore_acpi_ev) | ||
2644 | { | ||
2645 | /* 0x5000-0x5FFF: human interface helpers */ | ||
2646 | *send_acpi_ev = true; | ||
2647 | *ignore_acpi_ev = false; | ||
2648 | |||
2649 | switch (hkey) { | ||
2650 | case 0x5010: /* Lenovo new BIOS: brightness changed */ | ||
2651 | case 0x500b: /* X61t: tablet pen inserted into bay */ | ||
2652 | case 0x500c: /* X61t: tablet pen removed from bay */ | ||
2653 | return true; | ||
2654 | |||
2655 | case 0x5009: /* X41t-X61t: swivel up (tablet mode) */ | ||
2656 | case 0x500a: /* X41t-X61t: swivel down (normal mode) */ | ||
2657 | tpacpi_input_send_tabletsw(); | ||
2658 | hotkey_tablet_mode_notify_change(); | ||
2659 | *send_acpi_ev = false; | ||
2660 | return true; | ||
2661 | |||
2662 | case 0x5001: | ||
2663 | case 0x5002: | ||
2664 | /* LID switch events. Do not propagate */ | ||
2665 | *ignore_acpi_ev = true; | ||
2666 | return true; | ||
2667 | |||
2668 | default: | ||
2669 | return false; | ||
2670 | } | ||
2671 | } | ||
2672 | |||
2673 | static bool hotkey_notify_thermal(const u32 hkey, | ||
2674 | bool *send_acpi_ev, | ||
2675 | bool *ignore_acpi_ev) | ||
2676 | { | ||
2677 | /* 0x6000-0x6FFF: thermal alarms */ | ||
2678 | *send_acpi_ev = true; | ||
2679 | *ignore_acpi_ev = false; | ||
2680 | |||
2681 | switch (hkey) { | ||
2682 | case 0x6011: | ||
2683 | printk(TPACPI_CRIT | ||
2684 | "THERMAL ALARM: battery is too hot!\n"); | ||
2685 | /* recommended action: warn user through gui */ | ||
2686 | return true; | ||
2687 | case 0x6012: | ||
2688 | printk(TPACPI_ALERT | ||
2689 | "THERMAL EMERGENCY: battery is extremely hot!\n"); | ||
2690 | /* recommended action: immediate sleep/hibernate */ | ||
2691 | return true; | ||
2692 | case 0x6021: | ||
2693 | printk(TPACPI_CRIT | ||
2694 | "THERMAL ALARM: " | ||
2695 | "a sensor reports something is too hot!\n"); | ||
2696 | /* recommended action: warn user through gui, that */ | ||
2697 | /* some internal component is too hot */ | ||
2698 | return true; | ||
2699 | case 0x6022: | ||
2700 | printk(TPACPI_ALERT | ||
2701 | "THERMAL EMERGENCY: " | ||
2702 | "a sensor reports something is extremely hot!\n"); | ||
2703 | /* recommended action: immediate sleep/hibernate */ | ||
2704 | return true; | ||
2705 | case 0x6030: | ||
2706 | printk(TPACPI_INFO | ||
2707 | "EC reports that Thermal Table has changed\n"); | ||
2708 | /* recommended action: do nothing, we don't have | ||
2709 | * Lenovo ATM information */ | ||
2710 | return true; | ||
2711 | default: | ||
2712 | printk(TPACPI_ALERT | ||
2713 | "THERMAL ALERT: unknown thermal alarm received\n"); | ||
2714 | return false; | ||
2715 | } | ||
2716 | } | ||
2717 | |||
2364 | static void hotkey_notify(struct ibm_struct *ibm, u32 event) | 2718 | static void hotkey_notify(struct ibm_struct *ibm, u32 event) |
2365 | { | 2719 | { |
2366 | u32 hkey; | 2720 | u32 hkey; |
2367 | unsigned int scancode; | 2721 | bool send_acpi_ev; |
2368 | int send_acpi_ev; | 2722 | bool ignore_acpi_ev; |
2369 | int ignore_acpi_ev; | 2723 | bool known_ev; |
2370 | int unk_ev; | ||
2371 | 2724 | ||
2372 | if (event != 0x80) { | 2725 | if (event != 0x80) { |
2373 | printk(TPACPI_ERR | 2726 | printk(TPACPI_ERR |
@@ -2375,7 +2728,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
2375 | /* forward it to userspace, maybe it knows how to handle it */ | 2728 | /* forward it to userspace, maybe it knows how to handle it */ |
2376 | acpi_bus_generate_netlink_event( | 2729 | acpi_bus_generate_netlink_event( |
2377 | ibm->acpi->device->pnp.device_class, | 2730 | ibm->acpi->device->pnp.device_class, |
2378 | ibm->acpi->device->dev.bus_id, | 2731 | dev_name(&ibm->acpi->device->dev), |
2379 | event, 0); | 2732 | event, 0); |
2380 | return; | 2733 | return; |
2381 | } | 2734 | } |
@@ -2391,107 +2744,72 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
2391 | return; | 2744 | return; |
2392 | } | 2745 | } |
2393 | 2746 | ||
2394 | send_acpi_ev = 1; | 2747 | send_acpi_ev = true; |
2395 | ignore_acpi_ev = 0; | 2748 | ignore_acpi_ev = false; |
2396 | unk_ev = 0; | ||
2397 | 2749 | ||
2398 | switch (hkey >> 12) { | 2750 | switch (hkey >> 12) { |
2399 | case 1: | 2751 | case 1: |
2400 | /* 0x1000-0x1FFF: key presses */ | 2752 | /* 0x1000-0x1FFF: key presses */ |
2401 | scancode = hkey & 0xfff; | 2753 | known_ev = hotkey_notify_hotkey(hkey, &send_acpi_ev, |
2402 | if (scancode > 0 && scancode < 0x21) { | 2754 | &ignore_acpi_ev); |
2403 | scancode--; | ||
2404 | if (!(hotkey_source_mask & (1 << scancode))) { | ||
2405 | tpacpi_input_send_key(scancode); | ||
2406 | send_acpi_ev = 0; | ||
2407 | } else { | ||
2408 | ignore_acpi_ev = 1; | ||
2409 | } | ||
2410 | } else { | ||
2411 | unk_ev = 1; | ||
2412 | } | ||
2413 | break; | 2755 | break; |
2414 | case 2: | 2756 | case 2: |
2415 | /* Wakeup reason */ | 2757 | /* 0x2000-0x2FFF: Wakeup reason */ |
2416 | switch (hkey) { | 2758 | known_ev = hotkey_notify_wakeup(hkey, &send_acpi_ev, |
2417 | case 0x2304: /* suspend, undock */ | 2759 | &ignore_acpi_ev); |
2418 | case 0x2404: /* hibernation, undock */ | ||
2419 | hotkey_wakeup_reason = TP_ACPI_WAKEUP_UNDOCK; | ||
2420 | ignore_acpi_ev = 1; | ||
2421 | break; | ||
2422 | case 0x2305: /* suspend, bay eject */ | ||
2423 | case 0x2405: /* hibernation, bay eject */ | ||
2424 | hotkey_wakeup_reason = TP_ACPI_WAKEUP_BAYEJ; | ||
2425 | ignore_acpi_ev = 1; | ||
2426 | break; | ||
2427 | default: | ||
2428 | unk_ev = 1; | ||
2429 | } | ||
2430 | if (hotkey_wakeup_reason != TP_ACPI_WAKEUP_NONE) { | ||
2431 | printk(TPACPI_INFO | ||
2432 | "woke up due to a hot-unplug " | ||
2433 | "request...\n"); | ||
2434 | hotkey_wakeup_reason_notify_change(); | ||
2435 | } | ||
2436 | break; | 2760 | break; |
2437 | case 3: | 2761 | case 3: |
2438 | /* bay-related wakeups */ | 2762 | /* 0x3000-0x3FFF: bay-related wakeups */ |
2439 | if (hkey == 0x3003) { | 2763 | if (hkey == 0x3003) { |
2440 | hotkey_autosleep_ack = 1; | 2764 | hotkey_autosleep_ack = 1; |
2441 | printk(TPACPI_INFO | 2765 | printk(TPACPI_INFO |
2442 | "bay ejected\n"); | 2766 | "bay ejected\n"); |
2443 | hotkey_wakeup_hotunplug_complete_notify_change(); | 2767 | hotkey_wakeup_hotunplug_complete_notify_change(); |
2768 | known_ev = true; | ||
2444 | } else { | 2769 | } else { |
2445 | unk_ev = 1; | 2770 | known_ev = false; |
2446 | } | 2771 | } |
2447 | break; | 2772 | break; |
2448 | case 4: | 2773 | case 4: |
2449 | /* dock-related wakeups */ | 2774 | /* 0x4000-0x4FFF: dock-related wakeups */ |
2450 | if (hkey == 0x4003) { | 2775 | if (hkey == 0x4003) { |
2451 | hotkey_autosleep_ack = 1; | 2776 | hotkey_autosleep_ack = 1; |
2452 | printk(TPACPI_INFO | 2777 | printk(TPACPI_INFO |
2453 | "undocked\n"); | 2778 | "undocked\n"); |
2454 | hotkey_wakeup_hotunplug_complete_notify_change(); | 2779 | hotkey_wakeup_hotunplug_complete_notify_change(); |
2780 | known_ev = true; | ||
2455 | } else { | 2781 | } else { |
2456 | unk_ev = 1; | 2782 | known_ev = false; |
2457 | } | 2783 | } |
2458 | break; | 2784 | break; |
2459 | case 5: | 2785 | case 5: |
2460 | /* 0x5000-0x5FFF: human interface helpers */ | 2786 | /* 0x5000-0x5FFF: human interface helpers */ |
2461 | switch (hkey) { | 2787 | known_ev = hotkey_notify_usrevent(hkey, &send_acpi_ev, |
2462 | case 0x5010: /* Lenovo new BIOS: brightness changed */ | 2788 | &ignore_acpi_ev); |
2463 | case 0x500b: /* X61t: tablet pen inserted into bay */ | 2789 | break; |
2464 | case 0x500c: /* X61t: tablet pen removed from bay */ | 2790 | case 6: |
2465 | break; | 2791 | /* 0x6000-0x6FFF: thermal alarms */ |
2466 | case 0x5009: /* X41t-X61t: swivel up (tablet mode) */ | 2792 | known_ev = hotkey_notify_thermal(hkey, &send_acpi_ev, |
2467 | case 0x500a: /* X41t-X61t: swivel down (normal mode) */ | 2793 | &ignore_acpi_ev); |
2468 | tpacpi_input_send_tabletsw(); | ||
2469 | hotkey_tablet_mode_notify_change(); | ||
2470 | send_acpi_ev = 0; | ||
2471 | break; | ||
2472 | case 0x5001: | ||
2473 | case 0x5002: | ||
2474 | /* LID switch events. Do not propagate */ | ||
2475 | ignore_acpi_ev = 1; | ||
2476 | break; | ||
2477 | default: | ||
2478 | unk_ev = 1; | ||
2479 | } | ||
2480 | break; | 2794 | break; |
2481 | case 7: | 2795 | case 7: |
2482 | /* 0x7000-0x7FFF: misc */ | 2796 | /* 0x7000-0x7FFF: misc */ |
2483 | if (tp_features.hotkey_wlsw && hkey == 0x7000) { | 2797 | if (tp_features.hotkey_wlsw && hkey == 0x7000) { |
2484 | tpacpi_send_radiosw_update(); | 2798 | tpacpi_send_radiosw_update(); |
2485 | send_acpi_ev = 0; | 2799 | send_acpi_ev = 0; |
2800 | known_ev = true; | ||
2486 | break; | 2801 | break; |
2487 | } | 2802 | } |
2488 | /* fallthrough to default */ | 2803 | /* fallthrough to default */ |
2489 | default: | 2804 | default: |
2490 | unk_ev = 1; | 2805 | known_ev = false; |
2491 | } | 2806 | } |
2492 | if (unk_ev) { | 2807 | if (!known_ev) { |
2493 | printk(TPACPI_NOTICE | 2808 | printk(TPACPI_NOTICE |
2494 | "unhandled HKEY event 0x%04x\n", hkey); | 2809 | "unhandled HKEY event 0x%04x\n", hkey); |
2810 | printk(TPACPI_NOTICE | ||
2811 | "please report the conditions when this " | ||
2812 | "event happened to %s\n", TPACPI_MAIL); | ||
2495 | } | 2813 | } |
2496 | 2814 | ||
2497 | /* Legacy events */ | 2815 | /* Legacy events */ |
@@ -2505,7 +2823,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
2505 | if (!ignore_acpi_ev && send_acpi_ev) { | 2823 | if (!ignore_acpi_ev && send_acpi_ev) { |
2506 | acpi_bus_generate_netlink_event( | 2824 | acpi_bus_generate_netlink_event( |
2507 | ibm->acpi->device->pnp.device_class, | 2825 | ibm->acpi->device->pnp.device_class, |
2508 | ibm->acpi->device->dev.bus_id, | 2826 | dev_name(&ibm->acpi->device->dev), |
2509 | event, hkey); | 2827 | event, hkey); |
2510 | } | 2828 | } |
2511 | } | 2829 | } |
@@ -2544,7 +2862,7 @@ static int hotkey_read(char *p) | |||
2544 | return len; | 2862 | return len; |
2545 | } | 2863 | } |
2546 | 2864 | ||
2547 | if (mutex_lock_interruptible(&hotkey_mutex)) | 2865 | if (mutex_lock_killable(&hotkey_mutex)) |
2548 | return -ERESTARTSYS; | 2866 | return -ERESTARTSYS; |
2549 | res = hotkey_status_get(&status); | 2867 | res = hotkey_status_get(&status); |
2550 | if (!res) | 2868 | if (!res) |
@@ -2575,7 +2893,7 @@ static int hotkey_write(char *buf) | |||
2575 | if (!tp_features.hotkey) | 2893 | if (!tp_features.hotkey) |
2576 | return -ENODEV; | 2894 | return -ENODEV; |
2577 | 2895 | ||
2578 | if (mutex_lock_interruptible(&hotkey_mutex)) | 2896 | if (mutex_lock_killable(&hotkey_mutex)) |
2579 | return -ERESTARTSYS; | 2897 | return -ERESTARTSYS; |
2580 | 2898 | ||
2581 | status = -1; | 2899 | status = -1; |
@@ -2640,11 +2958,28 @@ enum { | |||
2640 | /* ACPI GBDC/SBDC bits */ | 2958 | /* ACPI GBDC/SBDC bits */ |
2641 | TP_ACPI_BLUETOOTH_HWPRESENT = 0x01, /* Bluetooth hw available */ | 2959 | TP_ACPI_BLUETOOTH_HWPRESENT = 0x01, /* Bluetooth hw available */ |
2642 | TP_ACPI_BLUETOOTH_RADIOSSW = 0x02, /* Bluetooth radio enabled */ | 2960 | TP_ACPI_BLUETOOTH_RADIOSSW = 0x02, /* Bluetooth radio enabled */ |
2643 | TP_ACPI_BLUETOOTH_UNK = 0x04, /* unknown function */ | 2961 | TP_ACPI_BLUETOOTH_RESUMECTRL = 0x04, /* Bluetooth state at resume: |
2962 | off / last state */ | ||
2963 | }; | ||
2964 | |||
2965 | enum { | ||
2966 | /* ACPI \BLTH commands */ | ||
2967 | TP_ACPI_BLTH_GET_ULTRAPORT_ID = 0x00, /* Get Ultraport BT ID */ | ||
2968 | TP_ACPI_BLTH_GET_PWR_ON_RESUME = 0x01, /* Get power-on-resume state */ | ||
2969 | TP_ACPI_BLTH_PWR_ON_ON_RESUME = 0x02, /* Resume powered on */ | ||
2970 | TP_ACPI_BLTH_PWR_OFF_ON_RESUME = 0x03, /* Resume powered off */ | ||
2971 | TP_ACPI_BLTH_SAVE_STATE = 0x05, /* Save state for S4/S5 */ | ||
2644 | }; | 2972 | }; |
2645 | 2973 | ||
2646 | static struct rfkill *tpacpi_bluetooth_rfkill; | 2974 | static struct rfkill *tpacpi_bluetooth_rfkill; |
2647 | 2975 | ||
2976 | static void bluetooth_suspend(pm_message_t state) | ||
2977 | { | ||
2978 | /* Try to make sure radio will resume powered off */ | ||
2979 | acpi_evalf(NULL, NULL, "\\BLTH", "vd", | ||
2980 | TP_ACPI_BLTH_PWR_OFF_ON_RESUME); | ||
2981 | } | ||
2982 | |||
2648 | static int bluetooth_get_radiosw(void) | 2983 | static int bluetooth_get_radiosw(void) |
2649 | { | 2984 | { |
2650 | int status; | 2985 | int status; |
@@ -2656,6 +2991,12 @@ static int bluetooth_get_radiosw(void) | |||
2656 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status) | 2991 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status) |
2657 | return RFKILL_STATE_HARD_BLOCKED; | 2992 | return RFKILL_STATE_HARD_BLOCKED; |
2658 | 2993 | ||
2994 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
2995 | if (dbg_bluetoothemul) | ||
2996 | return (tpacpi_bluetooth_emulstate) ? | ||
2997 | RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED; | ||
2998 | #endif | ||
2999 | |||
2659 | if (!acpi_evalf(hkey_handle, &status, "GBDC", "d")) | 3000 | if (!acpi_evalf(hkey_handle, &status, "GBDC", "d")) |
2660 | return -EIO; | 3001 | return -EIO; |
2661 | 3002 | ||
@@ -2689,12 +3030,20 @@ static int bluetooth_set_radiosw(int radio_on, int update_rfk) | |||
2689 | && radio_on) | 3030 | && radio_on) |
2690 | return -EPERM; | 3031 | return -EPERM; |
2691 | 3032 | ||
2692 | if (!acpi_evalf(hkey_handle, &status, "GBDC", "d")) | 3033 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES |
2693 | return -EIO; | 3034 | if (dbg_bluetoothemul) { |
3035 | tpacpi_bluetooth_emulstate = !!radio_on; | ||
3036 | if (update_rfk) | ||
3037 | bluetooth_update_rfk(); | ||
3038 | return 0; | ||
3039 | } | ||
3040 | #endif | ||
3041 | |||
3042 | /* We make sure to keep TP_ACPI_BLUETOOTH_RESUMECTRL off */ | ||
2694 | if (radio_on) | 3043 | if (radio_on) |
2695 | status |= TP_ACPI_BLUETOOTH_RADIOSSW; | 3044 | status = TP_ACPI_BLUETOOTH_RADIOSSW; |
2696 | else | 3045 | else |
2697 | status &= ~TP_ACPI_BLUETOOTH_RADIOSSW; | 3046 | status = 0; |
2698 | if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status)) | 3047 | if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status)) |
2699 | return -EIO; | 3048 | return -EIO; |
2700 | 3049 | ||
@@ -2765,8 +3114,19 @@ static int tpacpi_bluetooth_rfk_set(void *data, enum rfkill_state state) | |||
2765 | return bluetooth_set_radiosw((state == RFKILL_STATE_UNBLOCKED), 0); | 3114 | return bluetooth_set_radiosw((state == RFKILL_STATE_UNBLOCKED), 0); |
2766 | } | 3115 | } |
2767 | 3116 | ||
3117 | static void bluetooth_shutdown(void) | ||
3118 | { | ||
3119 | /* Order firmware to save current state to NVRAM */ | ||
3120 | if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd", | ||
3121 | TP_ACPI_BLTH_SAVE_STATE)) | ||
3122 | printk(TPACPI_NOTICE | ||
3123 | "failed to save bluetooth state to NVRAM\n"); | ||
3124 | } | ||
3125 | |||
2768 | static void bluetooth_exit(void) | 3126 | static void bluetooth_exit(void) |
2769 | { | 3127 | { |
3128 | bluetooth_shutdown(); | ||
3129 | |||
2770 | if (tpacpi_bluetooth_rfkill) | 3130 | if (tpacpi_bluetooth_rfkill) |
2771 | rfkill_unregister(tpacpi_bluetooth_rfkill); | 3131 | rfkill_unregister(tpacpi_bluetooth_rfkill); |
2772 | 3132 | ||
@@ -2792,6 +3152,13 @@ static int __init bluetooth_init(struct ibm_init_struct *iibm) | |||
2792 | str_supported(tp_features.bluetooth), | 3152 | str_supported(tp_features.bluetooth), |
2793 | status); | 3153 | status); |
2794 | 3154 | ||
3155 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
3156 | if (dbg_bluetoothemul) { | ||
3157 | tp_features.bluetooth = 1; | ||
3158 | printk(TPACPI_INFO | ||
3159 | "bluetooth switch emulation enabled\n"); | ||
3160 | } else | ||
3161 | #endif | ||
2795 | if (tp_features.bluetooth && | 3162 | if (tp_features.bluetooth && |
2796 | !(status & TP_ACPI_BLUETOOTH_HWPRESENT)) { | 3163 | !(status & TP_ACPI_BLUETOOTH_HWPRESENT)) { |
2797 | /* no bluetooth hardware present in system */ | 3164 | /* no bluetooth hardware present in system */ |
@@ -2812,6 +3179,7 @@ static int __init bluetooth_init(struct ibm_init_struct *iibm) | |||
2812 | &tpacpi_bluetooth_rfkill, | 3179 | &tpacpi_bluetooth_rfkill, |
2813 | RFKILL_TYPE_BLUETOOTH, | 3180 | RFKILL_TYPE_BLUETOOTH, |
2814 | "tpacpi_bluetooth_sw", | 3181 | "tpacpi_bluetooth_sw", |
3182 | true, | ||
2815 | tpacpi_bluetooth_rfk_set, | 3183 | tpacpi_bluetooth_rfk_set, |
2816 | tpacpi_bluetooth_rfk_get); | 3184 | tpacpi_bluetooth_rfk_get); |
2817 | if (res) { | 3185 | if (res) { |
@@ -2864,6 +3232,8 @@ static struct ibm_struct bluetooth_driver_data = { | |||
2864 | .read = bluetooth_read, | 3232 | .read = bluetooth_read, |
2865 | .write = bluetooth_write, | 3233 | .write = bluetooth_write, |
2866 | .exit = bluetooth_exit, | 3234 | .exit = bluetooth_exit, |
3235 | .suspend = bluetooth_suspend, | ||
3236 | .shutdown = bluetooth_shutdown, | ||
2867 | }; | 3237 | }; |
2868 | 3238 | ||
2869 | /************************************************************************* | 3239 | /************************************************************************* |
@@ -2874,11 +3244,19 @@ enum { | |||
2874 | /* ACPI GWAN/SWAN bits */ | 3244 | /* ACPI GWAN/SWAN bits */ |
2875 | TP_ACPI_WANCARD_HWPRESENT = 0x01, /* Wan hw available */ | 3245 | TP_ACPI_WANCARD_HWPRESENT = 0x01, /* Wan hw available */ |
2876 | TP_ACPI_WANCARD_RADIOSSW = 0x02, /* Wan radio enabled */ | 3246 | TP_ACPI_WANCARD_RADIOSSW = 0x02, /* Wan radio enabled */ |
2877 | TP_ACPI_WANCARD_UNK = 0x04, /* unknown function */ | 3247 | TP_ACPI_WANCARD_RESUMECTRL = 0x04, /* Wan state at resume: |
3248 | off / last state */ | ||
2878 | }; | 3249 | }; |
2879 | 3250 | ||
2880 | static struct rfkill *tpacpi_wan_rfkill; | 3251 | static struct rfkill *tpacpi_wan_rfkill; |
2881 | 3252 | ||
3253 | static void wan_suspend(pm_message_t state) | ||
3254 | { | ||
3255 | /* Try to make sure radio will resume powered off */ | ||
3256 | acpi_evalf(NULL, NULL, "\\WGSV", "qvd", | ||
3257 | TP_ACPI_WGSV_PWR_OFF_ON_RESUME); | ||
3258 | } | ||
3259 | |||
2882 | static int wan_get_radiosw(void) | 3260 | static int wan_get_radiosw(void) |
2883 | { | 3261 | { |
2884 | int status; | 3262 | int status; |
@@ -2890,6 +3268,12 @@ static int wan_get_radiosw(void) | |||
2890 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status) | 3268 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status) |
2891 | return RFKILL_STATE_HARD_BLOCKED; | 3269 | return RFKILL_STATE_HARD_BLOCKED; |
2892 | 3270 | ||
3271 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
3272 | if (dbg_wwanemul) | ||
3273 | return (tpacpi_wwan_emulstate) ? | ||
3274 | RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED; | ||
3275 | #endif | ||
3276 | |||
2893 | if (!acpi_evalf(hkey_handle, &status, "GWAN", "d")) | 3277 | if (!acpi_evalf(hkey_handle, &status, "GWAN", "d")) |
2894 | return -EIO; | 3278 | return -EIO; |
2895 | 3279 | ||
@@ -2923,12 +3307,20 @@ static int wan_set_radiosw(int radio_on, int update_rfk) | |||
2923 | && radio_on) | 3307 | && radio_on) |
2924 | return -EPERM; | 3308 | return -EPERM; |
2925 | 3309 | ||
2926 | if (!acpi_evalf(hkey_handle, &status, "GWAN", "d")) | 3310 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES |
2927 | return -EIO; | 3311 | if (dbg_wwanemul) { |
3312 | tpacpi_wwan_emulstate = !!radio_on; | ||
3313 | if (update_rfk) | ||
3314 | wan_update_rfk(); | ||
3315 | return 0; | ||
3316 | } | ||
3317 | #endif | ||
3318 | |||
3319 | /* We make sure to keep TP_ACPI_WANCARD_RESUMECTRL off */ | ||
2928 | if (radio_on) | 3320 | if (radio_on) |
2929 | status |= TP_ACPI_WANCARD_RADIOSSW; | 3321 | status = TP_ACPI_WANCARD_RADIOSSW; |
2930 | else | 3322 | else |
2931 | status &= ~TP_ACPI_WANCARD_RADIOSSW; | 3323 | status = 0; |
2932 | if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status)) | 3324 | if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status)) |
2933 | return -EIO; | 3325 | return -EIO; |
2934 | 3326 | ||
@@ -2999,8 +3391,19 @@ static int tpacpi_wan_rfk_set(void *data, enum rfkill_state state) | |||
2999 | return wan_set_radiosw((state == RFKILL_STATE_UNBLOCKED), 0); | 3391 | return wan_set_radiosw((state == RFKILL_STATE_UNBLOCKED), 0); |
3000 | } | 3392 | } |
3001 | 3393 | ||
3394 | static void wan_shutdown(void) | ||
3395 | { | ||
3396 | /* Order firmware to save current state to NVRAM */ | ||
3397 | if (!acpi_evalf(NULL, NULL, "\\WGSV", "vd", | ||
3398 | TP_ACPI_WGSV_SAVE_STATE)) | ||
3399 | printk(TPACPI_NOTICE | ||
3400 | "failed to save WWAN state to NVRAM\n"); | ||
3401 | } | ||
3402 | |||
3002 | static void wan_exit(void) | 3403 | static void wan_exit(void) |
3003 | { | 3404 | { |
3405 | wan_shutdown(); | ||
3406 | |||
3004 | if (tpacpi_wan_rfkill) | 3407 | if (tpacpi_wan_rfkill) |
3005 | rfkill_unregister(tpacpi_wan_rfkill); | 3408 | rfkill_unregister(tpacpi_wan_rfkill); |
3006 | 3409 | ||
@@ -3024,6 +3427,13 @@ static int __init wan_init(struct ibm_init_struct *iibm) | |||
3024 | str_supported(tp_features.wan), | 3427 | str_supported(tp_features.wan), |
3025 | status); | 3428 | status); |
3026 | 3429 | ||
3430 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
3431 | if (dbg_wwanemul) { | ||
3432 | tp_features.wan = 1; | ||
3433 | printk(TPACPI_INFO | ||
3434 | "wwan switch emulation enabled\n"); | ||
3435 | } else | ||
3436 | #endif | ||
3027 | if (tp_features.wan && | 3437 | if (tp_features.wan && |
3028 | !(status & TP_ACPI_WANCARD_HWPRESENT)) { | 3438 | !(status & TP_ACPI_WANCARD_HWPRESENT)) { |
3029 | /* no wan hardware present in system */ | 3439 | /* no wan hardware present in system */ |
@@ -3044,6 +3454,7 @@ static int __init wan_init(struct ibm_init_struct *iibm) | |||
3044 | &tpacpi_wan_rfkill, | 3454 | &tpacpi_wan_rfkill, |
3045 | RFKILL_TYPE_WWAN, | 3455 | RFKILL_TYPE_WWAN, |
3046 | "tpacpi_wwan_sw", | 3456 | "tpacpi_wwan_sw", |
3457 | true, | ||
3047 | tpacpi_wan_rfk_set, | 3458 | tpacpi_wan_rfk_set, |
3048 | tpacpi_wan_rfk_get); | 3459 | tpacpi_wan_rfk_get); |
3049 | if (res) { | 3460 | if (res) { |
@@ -3096,6 +3507,164 @@ static struct ibm_struct wan_driver_data = { | |||
3096 | .read = wan_read, | 3507 | .read = wan_read, |
3097 | .write = wan_write, | 3508 | .write = wan_write, |
3098 | .exit = wan_exit, | 3509 | .exit = wan_exit, |
3510 | .suspend = wan_suspend, | ||
3511 | .shutdown = wan_shutdown, | ||
3512 | }; | ||
3513 | |||
3514 | /************************************************************************* | ||
3515 | * UWB subdriver | ||
3516 | */ | ||
3517 | |||
3518 | enum { | ||
3519 | /* ACPI GUWB/SUWB bits */ | ||
3520 | TP_ACPI_UWB_HWPRESENT = 0x01, /* UWB hw available */ | ||
3521 | TP_ACPI_UWB_RADIOSSW = 0x02, /* UWB radio enabled */ | ||
3522 | }; | ||
3523 | |||
3524 | static struct rfkill *tpacpi_uwb_rfkill; | ||
3525 | |||
3526 | static int uwb_get_radiosw(void) | ||
3527 | { | ||
3528 | int status; | ||
3529 | |||
3530 | if (!tp_features.uwb) | ||
3531 | return -ENODEV; | ||
3532 | |||
3533 | /* WLSW overrides UWB in firmware/hardware, reflect that */ | ||
3534 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status) | ||
3535 | return RFKILL_STATE_HARD_BLOCKED; | ||
3536 | |||
3537 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
3538 | if (dbg_uwbemul) | ||
3539 | return (tpacpi_uwb_emulstate) ? | ||
3540 | RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED; | ||
3541 | #endif | ||
3542 | |||
3543 | if (!acpi_evalf(hkey_handle, &status, "GUWB", "d")) | ||
3544 | return -EIO; | ||
3545 | |||
3546 | return ((status & TP_ACPI_UWB_RADIOSSW) != 0) ? | ||
3547 | RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED; | ||
3548 | } | ||
3549 | |||
3550 | static void uwb_update_rfk(void) | ||
3551 | { | ||
3552 | int status; | ||
3553 | |||
3554 | if (!tpacpi_uwb_rfkill) | ||
3555 | return; | ||
3556 | |||
3557 | status = uwb_get_radiosw(); | ||
3558 | if (status < 0) | ||
3559 | return; | ||
3560 | rfkill_force_state(tpacpi_uwb_rfkill, status); | ||
3561 | } | ||
3562 | |||
3563 | static int uwb_set_radiosw(int radio_on, int update_rfk) | ||
3564 | { | ||
3565 | int status; | ||
3566 | |||
3567 | if (!tp_features.uwb) | ||
3568 | return -ENODEV; | ||
3569 | |||
3570 | /* WLSW overrides UWB in firmware/hardware, but there is no | ||
3571 | * reason to risk weird behaviour. */ | ||
3572 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status | ||
3573 | && radio_on) | ||
3574 | return -EPERM; | ||
3575 | |||
3576 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
3577 | if (dbg_uwbemul) { | ||
3578 | tpacpi_uwb_emulstate = !!radio_on; | ||
3579 | if (update_rfk) | ||
3580 | uwb_update_rfk(); | ||
3581 | return 0; | ||
3582 | } | ||
3583 | #endif | ||
3584 | |||
3585 | status = (radio_on) ? TP_ACPI_UWB_RADIOSSW : 0; | ||
3586 | if (!acpi_evalf(hkey_handle, NULL, "SUWB", "vd", status)) | ||
3587 | return -EIO; | ||
3588 | |||
3589 | if (update_rfk) | ||
3590 | uwb_update_rfk(); | ||
3591 | |||
3592 | return 0; | ||
3593 | } | ||
3594 | |||
3595 | /* --------------------------------------------------------------------- */ | ||
3596 | |||
3597 | static int tpacpi_uwb_rfk_get(void *data, enum rfkill_state *state) | ||
3598 | { | ||
3599 | int uwbs = uwb_get_radiosw(); | ||
3600 | |||
3601 | if (uwbs < 0) | ||
3602 | return uwbs; | ||
3603 | |||
3604 | *state = uwbs; | ||
3605 | return 0; | ||
3606 | } | ||
3607 | |||
3608 | static int tpacpi_uwb_rfk_set(void *data, enum rfkill_state state) | ||
3609 | { | ||
3610 | return uwb_set_radiosw((state == RFKILL_STATE_UNBLOCKED), 0); | ||
3611 | } | ||
3612 | |||
3613 | static void uwb_exit(void) | ||
3614 | { | ||
3615 | if (tpacpi_uwb_rfkill) | ||
3616 | rfkill_unregister(tpacpi_uwb_rfkill); | ||
3617 | } | ||
3618 | |||
3619 | static int __init uwb_init(struct ibm_init_struct *iibm) | ||
3620 | { | ||
3621 | int res; | ||
3622 | int status = 0; | ||
3623 | |||
3624 | vdbg_printk(TPACPI_DBG_INIT, "initializing uwb subdriver\n"); | ||
3625 | |||
3626 | TPACPI_ACPIHANDLE_INIT(hkey); | ||
3627 | |||
3628 | tp_features.uwb = hkey_handle && | ||
3629 | acpi_evalf(hkey_handle, &status, "GUWB", "qd"); | ||
3630 | |||
3631 | vdbg_printk(TPACPI_DBG_INIT, "uwb is %s, status 0x%02x\n", | ||
3632 | str_supported(tp_features.uwb), | ||
3633 | status); | ||
3634 | |||
3635 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
3636 | if (dbg_uwbemul) { | ||
3637 | tp_features.uwb = 1; | ||
3638 | printk(TPACPI_INFO | ||
3639 | "uwb switch emulation enabled\n"); | ||
3640 | } else | ||
3641 | #endif | ||
3642 | if (tp_features.uwb && | ||
3643 | !(status & TP_ACPI_UWB_HWPRESENT)) { | ||
3644 | /* no uwb hardware present in system */ | ||
3645 | tp_features.uwb = 0; | ||
3646 | dbg_printk(TPACPI_DBG_INIT, | ||
3647 | "uwb hardware not installed\n"); | ||
3648 | } | ||
3649 | |||
3650 | if (!tp_features.uwb) | ||
3651 | return 1; | ||
3652 | |||
3653 | res = tpacpi_new_rfkill(TPACPI_RFK_UWB_SW_ID, | ||
3654 | &tpacpi_uwb_rfkill, | ||
3655 | RFKILL_TYPE_UWB, | ||
3656 | "tpacpi_uwb_sw", | ||
3657 | false, | ||
3658 | tpacpi_uwb_rfk_set, | ||
3659 | tpacpi_uwb_rfk_get); | ||
3660 | |||
3661 | return res; | ||
3662 | } | ||
3663 | |||
3664 | static struct ibm_struct uwb_driver_data = { | ||
3665 | .name = "uwb", | ||
3666 | .exit = uwb_exit, | ||
3667 | .flags.experimental = 1, | ||
3099 | }; | 3668 | }; |
3100 | 3669 | ||
3101 | /************************************************************************* | 3670 | /************************************************************************* |
@@ -3724,7 +4293,7 @@ static void dock_notify(struct ibm_struct *ibm, u32 event) | |||
3724 | } | 4293 | } |
3725 | acpi_bus_generate_proc_event(ibm->acpi->device, event, data); | 4294 | acpi_bus_generate_proc_event(ibm->acpi->device, event, data); |
3726 | acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, | 4295 | acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, |
3727 | ibm->acpi->device->dev.bus_id, | 4296 | dev_name(&ibm->acpi->device->dev), |
3728 | event, data); | 4297 | event, data); |
3729 | } | 4298 | } |
3730 | 4299 | ||
@@ -3826,7 +4395,7 @@ static void bay_notify(struct ibm_struct *ibm, u32 event) | |||
3826 | { | 4395 | { |
3827 | acpi_bus_generate_proc_event(ibm->acpi->device, event, 0); | 4396 | acpi_bus_generate_proc_event(ibm->acpi->device, event, 0); |
3828 | acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, | 4397 | acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, |
3829 | ibm->acpi->device->dev.bus_id, | 4398 | dev_name(&ibm->acpi->device->dev), |
3830 | event, 0); | 4399 | event, 0); |
3831 | } | 4400 | } |
3832 | 4401 | ||
@@ -4850,7 +5419,7 @@ static int brightness_set(int value) | |||
4850 | value < 0) | 5419 | value < 0) |
4851 | return -EINVAL; | 5420 | return -EINVAL; |
4852 | 5421 | ||
4853 | res = mutex_lock_interruptible(&brightness_mutex); | 5422 | res = mutex_lock_killable(&brightness_mutex); |
4854 | if (res < 0) | 5423 | if (res < 0) |
4855 | return res; | 5424 | return res; |
4856 | 5425 | ||
@@ -5334,6 +5903,60 @@ TPACPI_HANDLE(sfan, ec, "SFAN", /* 570 */ | |||
5334 | ); /* all others */ | 5903 | ); /* all others */ |
5335 | 5904 | ||
5336 | /* | 5905 | /* |
5906 | * Unitialized HFSP quirk: ACPI DSDT and EC fail to initialize the | ||
5907 | * HFSP register at boot, so it contains 0x07 but the Thinkpad could | ||
5908 | * be in auto mode (0x80). | ||
5909 | * | ||
5910 | * This is corrected by any write to HFSP either by the driver, or | ||
5911 | * by the firmware. | ||
5912 | * | ||
5913 | * We assume 0x07 really means auto mode while this quirk is active, | ||
5914 | * as this is far more likely than the ThinkPad being in level 7, | ||
5915 | * which is only used by the firmware during thermal emergencies. | ||
5916 | */ | ||
5917 | |||
5918 | static void fan_quirk1_detect(void) | ||
5919 | { | ||
5920 | /* In some ThinkPads, neither the EC nor the ACPI | ||
5921 | * DSDT initialize the HFSP register, and it ends up | ||
5922 | * being initially set to 0x07 when it *could* be | ||
5923 | * either 0x07 or 0x80. | ||
5924 | * | ||
5925 | * Enable for TP-1Y (T43), TP-78 (R51e), | ||
5926 | * TP-76 (R52), TP-70 (T43, R52), which are known | ||
5927 | * to be buggy. */ | ||
5928 | if (fan_control_initial_status == 0x07) { | ||
5929 | switch (thinkpad_id.ec_model) { | ||
5930 | case 0x5931: /* TP-1Y */ | ||
5931 | case 0x3837: /* TP-78 */ | ||
5932 | case 0x3637: /* TP-76 */ | ||
5933 | case 0x3037: /* TP-70 */ | ||
5934 | printk(TPACPI_NOTICE | ||
5935 | "fan_init: initial fan status is unknown, " | ||
5936 | "assuming it is in auto mode\n"); | ||
5937 | tp_features.fan_ctrl_status_undef = 1; | ||
5938 | ;; | ||
5939 | } | ||
5940 | } | ||
5941 | } | ||
5942 | |||
5943 | static void fan_quirk1_handle(u8 *fan_status) | ||
5944 | { | ||
5945 | if (unlikely(tp_features.fan_ctrl_status_undef)) { | ||
5946 | if (*fan_status != fan_control_initial_status) { | ||
5947 | /* something changed the HFSP regisnter since | ||
5948 | * driver init time, so it is not undefined | ||
5949 | * anymore */ | ||
5950 | tp_features.fan_ctrl_status_undef = 0; | ||
5951 | } else { | ||
5952 | /* Return most likely status. In fact, it | ||
5953 | * might be the only possible status */ | ||
5954 | *fan_status = TP_EC_FAN_AUTO; | ||
5955 | } | ||
5956 | } | ||
5957 | } | ||
5958 | |||
5959 | /* | ||
5337 | * Call with fan_mutex held | 5960 | * Call with fan_mutex held |
5338 | */ | 5961 | */ |
5339 | static void fan_update_desired_level(u8 status) | 5962 | static void fan_update_desired_level(u8 status) |
@@ -5371,8 +5994,10 @@ static int fan_get_status(u8 *status) | |||
5371 | if (unlikely(!acpi_ec_read(fan_status_offset, &s))) | 5994 | if (unlikely(!acpi_ec_read(fan_status_offset, &s))) |
5372 | return -EIO; | 5995 | return -EIO; |
5373 | 5996 | ||
5374 | if (likely(status)) | 5997 | if (likely(status)) { |
5375 | *status = s; | 5998 | *status = s; |
5999 | fan_quirk1_handle(status); | ||
6000 | } | ||
5376 | 6001 | ||
5377 | break; | 6002 | break; |
5378 | 6003 | ||
@@ -5388,7 +6013,7 @@ static int fan_get_status_safe(u8 *status) | |||
5388 | int rc; | 6013 | int rc; |
5389 | u8 s; | 6014 | u8 s; |
5390 | 6015 | ||
5391 | if (mutex_lock_interruptible(&fan_mutex)) | 6016 | if (mutex_lock_killable(&fan_mutex)) |
5392 | return -ERESTARTSYS; | 6017 | return -ERESTARTSYS; |
5393 | rc = fan_get_status(&s); | 6018 | rc = fan_get_status(&s); |
5394 | if (!rc) | 6019 | if (!rc) |
@@ -5471,7 +6096,7 @@ static int fan_set_level_safe(int level) | |||
5471 | if (!fan_control_allowed) | 6096 | if (!fan_control_allowed) |
5472 | return -EPERM; | 6097 | return -EPERM; |
5473 | 6098 | ||
5474 | if (mutex_lock_interruptible(&fan_mutex)) | 6099 | if (mutex_lock_killable(&fan_mutex)) |
5475 | return -ERESTARTSYS; | 6100 | return -ERESTARTSYS; |
5476 | 6101 | ||
5477 | if (level == TPACPI_FAN_LAST_LEVEL) | 6102 | if (level == TPACPI_FAN_LAST_LEVEL) |
@@ -5493,7 +6118,7 @@ static int fan_set_enable(void) | |||
5493 | if (!fan_control_allowed) | 6118 | if (!fan_control_allowed) |
5494 | return -EPERM; | 6119 | return -EPERM; |
5495 | 6120 | ||
5496 | if (mutex_lock_interruptible(&fan_mutex)) | 6121 | if (mutex_lock_killable(&fan_mutex)) |
5497 | return -ERESTARTSYS; | 6122 | return -ERESTARTSYS; |
5498 | 6123 | ||
5499 | switch (fan_control_access_mode) { | 6124 | switch (fan_control_access_mode) { |
@@ -5548,7 +6173,7 @@ static int fan_set_disable(void) | |||
5548 | if (!fan_control_allowed) | 6173 | if (!fan_control_allowed) |
5549 | return -EPERM; | 6174 | return -EPERM; |
5550 | 6175 | ||
5551 | if (mutex_lock_interruptible(&fan_mutex)) | 6176 | if (mutex_lock_killable(&fan_mutex)) |
5552 | return -ERESTARTSYS; | 6177 | return -ERESTARTSYS; |
5553 | 6178 | ||
5554 | rc = 0; | 6179 | rc = 0; |
@@ -5586,7 +6211,7 @@ static int fan_set_speed(int speed) | |||
5586 | if (!fan_control_allowed) | 6211 | if (!fan_control_allowed) |
5587 | return -EPERM; | 6212 | return -EPERM; |
5588 | 6213 | ||
5589 | if (mutex_lock_interruptible(&fan_mutex)) | 6214 | if (mutex_lock_killable(&fan_mutex)) |
5590 | return -ERESTARTSYS; | 6215 | return -ERESTARTSYS; |
5591 | 6216 | ||
5592 | rc = 0; | 6217 | rc = 0; |
@@ -5682,16 +6307,6 @@ static ssize_t fan_pwm1_enable_show(struct device *dev, | |||
5682 | if (res) | 6307 | if (res) |
5683 | return res; | 6308 | return res; |
5684 | 6309 | ||
5685 | if (unlikely(tp_features.fan_ctrl_status_undef)) { | ||
5686 | if (status != fan_control_initial_status) { | ||
5687 | tp_features.fan_ctrl_status_undef = 0; | ||
5688 | } else { | ||
5689 | /* Return most likely status. In fact, it | ||
5690 | * might be the only possible status */ | ||
5691 | status = TP_EC_FAN_AUTO; | ||
5692 | } | ||
5693 | } | ||
5694 | |||
5695 | if (status & TP_EC_FAN_FULLSPEED) { | 6310 | if (status & TP_EC_FAN_FULLSPEED) { |
5696 | mode = 0; | 6311 | mode = 0; |
5697 | } else if (status & TP_EC_FAN_AUTO) { | 6312 | } else if (status & TP_EC_FAN_AUTO) { |
@@ -5756,14 +6371,6 @@ static ssize_t fan_pwm1_show(struct device *dev, | |||
5756 | if (res) | 6371 | if (res) |
5757 | return res; | 6372 | return res; |
5758 | 6373 | ||
5759 | if (unlikely(tp_features.fan_ctrl_status_undef)) { | ||
5760 | if (status != fan_control_initial_status) { | ||
5761 | tp_features.fan_ctrl_status_undef = 0; | ||
5762 | } else { | ||
5763 | status = TP_EC_FAN_AUTO; | ||
5764 | } | ||
5765 | } | ||
5766 | |||
5767 | if ((status & | 6374 | if ((status & |
5768 | (TP_EC_FAN_AUTO | TP_EC_FAN_FULLSPEED)) != 0) | 6375 | (TP_EC_FAN_AUTO | TP_EC_FAN_FULLSPEED)) != 0) |
5769 | status = fan_control_desired_level; | 6376 | status = fan_control_desired_level; |
@@ -5788,7 +6395,7 @@ static ssize_t fan_pwm1_store(struct device *dev, | |||
5788 | /* scale down from 0-255 to 0-7 */ | 6395 | /* scale down from 0-255 to 0-7 */ |
5789 | newlevel = (s >> 5) & 0x07; | 6396 | newlevel = (s >> 5) & 0x07; |
5790 | 6397 | ||
5791 | if (mutex_lock_interruptible(&fan_mutex)) | 6398 | if (mutex_lock_killable(&fan_mutex)) |
5792 | return -ERESTARTSYS; | 6399 | return -ERESTARTSYS; |
5793 | 6400 | ||
5794 | rc = fan_get_status(&status); | 6401 | rc = fan_get_status(&status); |
@@ -5895,29 +6502,7 @@ static int __init fan_init(struct ibm_init_struct *iibm) | |||
5895 | if (likely(acpi_ec_read(fan_status_offset, | 6502 | if (likely(acpi_ec_read(fan_status_offset, |
5896 | &fan_control_initial_status))) { | 6503 | &fan_control_initial_status))) { |
5897 | fan_status_access_mode = TPACPI_FAN_RD_TPEC; | 6504 | fan_status_access_mode = TPACPI_FAN_RD_TPEC; |
5898 | 6505 | fan_quirk1_detect(); | |
5899 | /* In some ThinkPads, neither the EC nor the ACPI | ||
5900 | * DSDT initialize the fan status, and it ends up | ||
5901 | * being set to 0x07 when it *could* be either | ||
5902 | * 0x07 or 0x80. | ||
5903 | * | ||
5904 | * Enable for TP-1Y (T43), TP-78 (R51e), | ||
5905 | * TP-76 (R52), TP-70 (T43, R52), which are known | ||
5906 | * to be buggy. */ | ||
5907 | if (fan_control_initial_status == 0x07) { | ||
5908 | switch (thinkpad_id.ec_model) { | ||
5909 | case 0x5931: /* TP-1Y */ | ||
5910 | case 0x3837: /* TP-78 */ | ||
5911 | case 0x3637: /* TP-76 */ | ||
5912 | case 0x3037: /* TP-70 */ | ||
5913 | printk(TPACPI_NOTICE | ||
5914 | "fan_init: initial fan status " | ||
5915 | "is unknown, assuming it is " | ||
5916 | "in auto mode\n"); | ||
5917 | tp_features.fan_ctrl_status_undef = 1; | ||
5918 | ;; | ||
5919 | } | ||
5920 | } | ||
5921 | } else { | 6506 | } else { |
5922 | printk(TPACPI_ERR | 6507 | printk(TPACPI_ERR |
5923 | "ThinkPad ACPI EC access misbehaving, " | 6508 | "ThinkPad ACPI EC access misbehaving, " |
@@ -6106,15 +6691,6 @@ static int fan_read(char *p) | |||
6106 | if (rc < 0) | 6691 | if (rc < 0) |
6107 | return rc; | 6692 | return rc; |
6108 | 6693 | ||
6109 | if (unlikely(tp_features.fan_ctrl_status_undef)) { | ||
6110 | if (status != fan_control_initial_status) | ||
6111 | tp_features.fan_ctrl_status_undef = 0; | ||
6112 | else | ||
6113 | /* Return most likely status. In fact, it | ||
6114 | * might be the only possible status */ | ||
6115 | status = TP_EC_FAN_AUTO; | ||
6116 | } | ||
6117 | |||
6118 | len += sprintf(p + len, "status:\t\t%s\n", | 6694 | len += sprintf(p + len, "status:\t\t%s\n", |
6119 | (status != 0) ? "enabled" : "disabled"); | 6695 | (status != 0) ? "enabled" : "disabled"); |
6120 | 6696 | ||
@@ -6563,6 +7139,10 @@ static struct ibm_init_struct ibms_init[] __initdata = { | |||
6563 | .init = wan_init, | 7139 | .init = wan_init, |
6564 | .data = &wan_driver_data, | 7140 | .data = &wan_driver_data, |
6565 | }, | 7141 | }, |
7142 | { | ||
7143 | .init = uwb_init, | ||
7144 | .data = &uwb_driver_data, | ||
7145 | }, | ||
6566 | #ifdef CONFIG_THINKPAD_ACPI_VIDEO | 7146 | #ifdef CONFIG_THINKPAD_ACPI_VIDEO |
6567 | { | 7147 | { |
6568 | .init = video_init, | 7148 | .init = video_init, |
@@ -6701,6 +7281,32 @@ TPACPI_PARAM(brightness); | |||
6701 | TPACPI_PARAM(volume); | 7281 | TPACPI_PARAM(volume); |
6702 | TPACPI_PARAM(fan); | 7282 | TPACPI_PARAM(fan); |
6703 | 7283 | ||
7284 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | ||
7285 | module_param(dbg_wlswemul, uint, 0); | ||
7286 | MODULE_PARM_DESC(dbg_wlswemul, "Enables WLSW emulation"); | ||
7287 | module_param_named(wlsw_state, tpacpi_wlsw_emulstate, bool, 0); | ||
7288 | MODULE_PARM_DESC(wlsw_state, | ||
7289 | "Initial state of the emulated WLSW switch"); | ||
7290 | |||
7291 | module_param(dbg_bluetoothemul, uint, 0); | ||
7292 | MODULE_PARM_DESC(dbg_bluetoothemul, "Enables bluetooth switch emulation"); | ||
7293 | module_param_named(bluetooth_state, tpacpi_bluetooth_emulstate, bool, 0); | ||
7294 | MODULE_PARM_DESC(bluetooth_state, | ||
7295 | "Initial state of the emulated bluetooth switch"); | ||
7296 | |||
7297 | module_param(dbg_wwanemul, uint, 0); | ||
7298 | MODULE_PARM_DESC(dbg_wwanemul, "Enables WWAN switch emulation"); | ||
7299 | module_param_named(wwan_state, tpacpi_wwan_emulstate, bool, 0); | ||
7300 | MODULE_PARM_DESC(wwan_state, | ||
7301 | "Initial state of the emulated WWAN switch"); | ||
7302 | |||
7303 | module_param(dbg_uwbemul, uint, 0); | ||
7304 | MODULE_PARM_DESC(dbg_uwbemul, "Enables UWB switch emulation"); | ||
7305 | module_param_named(uwb_state, tpacpi_uwb_emulstate, bool, 0); | ||
7306 | MODULE_PARM_DESC(uwb_state, | ||
7307 | "Initial state of the emulated UWB switch"); | ||
7308 | #endif | ||
7309 | |||
6704 | static void thinkpad_acpi_module_exit(void) | 7310 | static void thinkpad_acpi_module_exit(void) |
6705 | { | 7311 | { |
6706 | struct ibm_struct *ibm, *itmp; | 7312 | struct ibm_struct *ibm, *itmp; |
diff --git a/drivers/ps3/ps3-lpm.c b/drivers/ps3/ps3-lpm.c index 204158cf7a5..fe96793e3f0 100644 --- a/drivers/ps3/ps3-lpm.c +++ b/drivers/ps3/ps3-lpm.c | |||
@@ -732,7 +732,7 @@ static u64 pm_signal_group_to_ps3_lv1_signal_group(u64 group) | |||
732 | case 8: | 732 | case 8: |
733 | return pm_translate_signal_group_number_on_island8(subgroup); | 733 | return pm_translate_signal_group_number_on_island8(subgroup); |
734 | default: | 734 | default: |
735 | dev_dbg(sbd_core(), "%s:%u: island not found: %lu\n", __func__, | 735 | dev_dbg(sbd_core(), "%s:%u: island not found: %llu\n", __func__, |
736 | __LINE__, group); | 736 | __LINE__, group); |
737 | BUG(); | 737 | BUG(); |
738 | break; | 738 | break; |
@@ -765,7 +765,7 @@ static int __ps3_set_signal(u64 lv1_signal_group, u64 bus_select, | |||
765 | signal_select, attr1, attr2, attr3); | 765 | signal_select, attr1, attr2, attr3); |
766 | if (ret) | 766 | if (ret) |
767 | dev_err(sbd_core(), | 767 | dev_err(sbd_core(), |
768 | "%s:%u: error:%d 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", | 768 | "%s:%u: error:%d 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx\n", |
769 | __func__, __LINE__, ret, lv1_signal_group, bus_select, | 769 | __func__, __LINE__, ret, lv1_signal_group, bus_select, |
770 | signal_select, attr1, attr2, attr3); | 770 | signal_select, attr1, attr2, attr3); |
771 | 771 | ||
@@ -908,7 +908,7 @@ void ps3_disable_pm(u32 cpu) | |||
908 | 908 | ||
909 | lpm_priv->tb_count = tmp; | 909 | lpm_priv->tb_count = tmp; |
910 | 910 | ||
911 | dev_dbg(sbd_core(), "%s:%u: tb_count %lu (%lxh)\n", __func__, __LINE__, | 911 | dev_dbg(sbd_core(), "%s:%u: tb_count %llu (%llxh)\n", __func__, __LINE__, |
912 | lpm_priv->tb_count, lpm_priv->tb_count); | 912 | lpm_priv->tb_count, lpm_priv->tb_count); |
913 | } | 913 | } |
914 | EXPORT_SYMBOL_GPL(ps3_disable_pm); | 914 | EXPORT_SYMBOL_GPL(ps3_disable_pm); |
@@ -938,7 +938,7 @@ int ps3_lpm_copy_tb(unsigned long offset, void *buf, unsigned long count, | |||
938 | if (offset >= lpm_priv->tb_count) | 938 | if (offset >= lpm_priv->tb_count) |
939 | return 0; | 939 | return 0; |
940 | 940 | ||
941 | count = min(count, lpm_priv->tb_count - offset); | 941 | count = min_t(u64, count, lpm_priv->tb_count - offset); |
942 | 942 | ||
943 | while (*bytes_copied < count) { | 943 | while (*bytes_copied < count) { |
944 | const unsigned long request = count - *bytes_copied; | 944 | const unsigned long request = count - *bytes_copied; |
@@ -993,7 +993,7 @@ int ps3_lpm_copy_tb_to_user(unsigned long offset, void __user *buf, | |||
993 | if (offset >= lpm_priv->tb_count) | 993 | if (offset >= lpm_priv->tb_count) |
994 | return 0; | 994 | return 0; |
995 | 995 | ||
996 | count = min(count, lpm_priv->tb_count - offset); | 996 | count = min_t(u64, count, lpm_priv->tb_count - offset); |
997 | 997 | ||
998 | while (*bytes_copied < count) { | 998 | while (*bytes_copied < count) { |
999 | const unsigned long request = count - *bytes_copied; | 999 | const unsigned long request = count - *bytes_copied; |
@@ -1013,7 +1013,7 @@ int ps3_lpm_copy_tb_to_user(unsigned long offset, void __user *buf, | |||
1013 | result = copy_to_user(buf, lpm_priv->tb_cache, tmp); | 1013 | result = copy_to_user(buf, lpm_priv->tb_cache, tmp); |
1014 | 1014 | ||
1015 | if (result) { | 1015 | if (result) { |
1016 | dev_dbg(sbd_core(), "%s:%u: 0x%lx bytes at 0x%p\n", | 1016 | dev_dbg(sbd_core(), "%s:%u: 0x%llx bytes at 0x%p\n", |
1017 | __func__, __LINE__, tmp, buf); | 1017 | __func__, __LINE__, tmp, buf); |
1018 | dev_err(sbd_core(), "%s:%u: copy_to_user failed: %d\n", | 1018 | dev_err(sbd_core(), "%s:%u: copy_to_user failed: %d\n", |
1019 | __func__, __LINE__, result); | 1019 | __func__, __LINE__, result); |
@@ -1148,8 +1148,8 @@ int ps3_lpm_open(enum ps3_lpm_tb_type tb_type, void *tb_cache, | |||
1148 | lpm_priv->shadow.group_control = PS3_LPM_SHADOW_REG_INIT; | 1148 | lpm_priv->shadow.group_control = PS3_LPM_SHADOW_REG_INIT; |
1149 | lpm_priv->shadow.debug_bus_control = PS3_LPM_SHADOW_REG_INIT; | 1149 | lpm_priv->shadow.debug_bus_control = PS3_LPM_SHADOW_REG_INIT; |
1150 | 1150 | ||
1151 | dev_dbg(sbd_core(), "%s:%u: lpm_id 0x%lx, outlet_id 0x%lx, " | 1151 | dev_dbg(sbd_core(), "%s:%u: lpm_id 0x%llx, outlet_id 0x%llx, " |
1152 | "tb_size 0x%lx\n", __func__, __LINE__, lpm_priv->lpm_id, | 1152 | "tb_size 0x%llx\n", __func__, __LINE__, lpm_priv->lpm_id, |
1153 | lpm_priv->outlet_id, tb_size); | 1153 | lpm_priv->outlet_id, tb_size); |
1154 | 1154 | ||
1155 | return 0; | 1155 | return 0; |
diff --git a/drivers/ps3/ps3-vuart.c b/drivers/ps3/ps3-vuart.c index 90c097a7a47..e4ad5ba5d0a 100644 --- a/drivers/ps3/ps3-vuart.c +++ b/drivers/ps3/ps3-vuart.c | |||
@@ -114,7 +114,7 @@ struct ports_bmp { | |||
114 | static void __maybe_unused _dump_ports_bmp( | 114 | static void __maybe_unused _dump_ports_bmp( |
115 | const struct ports_bmp *bmp, const char *func, int line) | 115 | const struct ports_bmp *bmp, const char *func, int line) |
116 | { | 116 | { |
117 | pr_debug("%s:%d: ports_bmp: %016lxh\n", func, line, bmp->status); | 117 | pr_debug("%s:%d: ports_bmp: %016llxh\n", func, line, bmp->status); |
118 | } | 118 | } |
119 | 119 | ||
120 | #define dump_port_params(_b) _dump_port_params(_b, __func__, __LINE__) | 120 | #define dump_port_params(_b) _dump_port_params(_b, __func__, __LINE__) |
@@ -159,11 +159,13 @@ int ps3_vuart_get_triggers(struct ps3_system_bus_device *dev, | |||
159 | struct vuart_triggers *trig) | 159 | struct vuart_triggers *trig) |
160 | { | 160 | { |
161 | int result; | 161 | int result; |
162 | unsigned long size; | 162 | u64 size; |
163 | unsigned long val; | 163 | u64 val; |
164 | u64 tx; | ||
164 | 165 | ||
165 | result = lv1_get_virtual_uart_param(dev->port_number, | 166 | result = lv1_get_virtual_uart_param(dev->port_number, |
166 | PARAM_TX_TRIGGER, &trig->tx); | 167 | PARAM_TX_TRIGGER, &tx); |
168 | trig->tx = tx; | ||
167 | 169 | ||
168 | if (result) { | 170 | if (result) { |
169 | dev_dbg(&dev->core, "%s:%d: tx_trigger failed: %s\n", | 171 | dev_dbg(&dev->core, "%s:%d: tx_trigger failed: %s\n", |
@@ -201,7 +203,7 @@ int ps3_vuart_set_triggers(struct ps3_system_bus_device *dev, unsigned int tx, | |||
201 | unsigned int rx) | 203 | unsigned int rx) |
202 | { | 204 | { |
203 | int result; | 205 | int result; |
204 | unsigned long size; | 206 | u64 size; |
205 | 207 | ||
206 | result = lv1_set_virtual_uart_param(dev->port_number, | 208 | result = lv1_set_virtual_uart_param(dev->port_number, |
207 | PARAM_TX_TRIGGER, tx); | 209 | PARAM_TX_TRIGGER, tx); |
@@ -248,7 +250,7 @@ static int ps3_vuart_get_rx_bytes_waiting(struct ps3_system_bus_device *dev, | |||
248 | dev_dbg(&dev->core, "%s:%d: rx_bytes failed: %s\n", | 250 | dev_dbg(&dev->core, "%s:%d: rx_bytes failed: %s\n", |
249 | __func__, __LINE__, ps3_result(result)); | 251 | __func__, __LINE__, ps3_result(result)); |
250 | 252 | ||
251 | dev_dbg(&dev->core, "%s:%d: %lxh\n", __func__, __LINE__, | 253 | dev_dbg(&dev->core, "%s:%d: %llxh\n", __func__, __LINE__, |
252 | *bytes_waiting); | 254 | *bytes_waiting); |
253 | return result; | 255 | return result; |
254 | } | 256 | } |
@@ -295,7 +297,7 @@ static int ps3_vuart_get_interrupt_status(struct ps3_system_bus_device *dev, | |||
295 | 297 | ||
296 | *status = tmp & priv->interrupt_mask; | 298 | *status = tmp & priv->interrupt_mask; |
297 | 299 | ||
298 | dev_dbg(&dev->core, "%s:%d: m %lxh, s %lxh, m&s %lxh\n", | 300 | dev_dbg(&dev->core, "%s:%d: m %llxh, s %llxh, m&s %lxh\n", |
299 | __func__, __LINE__, priv->interrupt_mask, tmp, *status); | 301 | __func__, __LINE__, priv->interrupt_mask, tmp, *status); |
300 | 302 | ||
301 | return result; | 303 | return result; |
@@ -363,7 +365,7 @@ int ps3_vuart_disable_interrupt_disconnect(struct ps3_system_bus_device *dev) | |||
363 | */ | 365 | */ |
364 | 366 | ||
365 | static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev, | 367 | static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev, |
366 | const void *buf, unsigned int bytes, unsigned long *bytes_written) | 368 | const void *buf, unsigned int bytes, u64 *bytes_written) |
367 | { | 369 | { |
368 | int result; | 370 | int result; |
369 | struct ps3_vuart_port_priv *priv = to_port_priv(dev); | 371 | struct ps3_vuart_port_priv *priv = to_port_priv(dev); |
@@ -379,7 +381,7 @@ static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev, | |||
379 | 381 | ||
380 | priv->stats.bytes_written += *bytes_written; | 382 | priv->stats.bytes_written += *bytes_written; |
381 | 383 | ||
382 | dev_dbg(&dev->core, "%s:%d: wrote %lxh/%xh=>%lxh\n", __func__, __LINE__, | 384 | dev_dbg(&dev->core, "%s:%d: wrote %llxh/%xh=>%lxh\n", __func__, __LINE__, |
383 | *bytes_written, bytes, priv->stats.bytes_written); | 385 | *bytes_written, bytes, priv->stats.bytes_written); |
384 | 386 | ||
385 | return result; | 387 | return result; |
@@ -393,7 +395,7 @@ static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev, | |||
393 | */ | 395 | */ |
394 | 396 | ||
395 | static int ps3_vuart_raw_read(struct ps3_system_bus_device *dev, void *buf, | 397 | static int ps3_vuart_raw_read(struct ps3_system_bus_device *dev, void *buf, |
396 | unsigned int bytes, unsigned long *bytes_read) | 398 | unsigned int bytes, u64 *bytes_read) |
397 | { | 399 | { |
398 | int result; | 400 | int result; |
399 | struct ps3_vuart_port_priv *priv = to_port_priv(dev); | 401 | struct ps3_vuart_port_priv *priv = to_port_priv(dev); |
@@ -411,7 +413,7 @@ static int ps3_vuart_raw_read(struct ps3_system_bus_device *dev, void *buf, | |||
411 | 413 | ||
412 | priv->stats.bytes_read += *bytes_read; | 414 | priv->stats.bytes_read += *bytes_read; |
413 | 415 | ||
414 | dev_dbg(&dev->core, "%s:%d: read %lxh/%xh=>%lxh\n", __func__, __LINE__, | 416 | dev_dbg(&dev->core, "%s:%d: read %llxh/%xh=>%lxh\n", __func__, __LINE__, |
415 | *bytes_read, bytes, priv->stats.bytes_read); | 417 | *bytes_read, bytes, priv->stats.bytes_read); |
416 | 418 | ||
417 | return result; | 419 | return result; |
@@ -500,7 +502,7 @@ int ps3_vuart_write(struct ps3_system_bus_device *dev, const void *buf, | |||
500 | spin_lock_irqsave(&priv->tx_list.lock, flags); | 502 | spin_lock_irqsave(&priv->tx_list.lock, flags); |
501 | 503 | ||
502 | if (list_empty(&priv->tx_list.head)) { | 504 | if (list_empty(&priv->tx_list.head)) { |
503 | unsigned long bytes_written; | 505 | u64 bytes_written; |
504 | 506 | ||
505 | result = ps3_vuart_raw_write(dev, buf, bytes, &bytes_written); | 507 | result = ps3_vuart_raw_write(dev, buf, bytes, &bytes_written); |
506 | 508 | ||
@@ -592,7 +594,7 @@ static int ps3_vuart_queue_rx_bytes(struct ps3_system_bus_device *dev, | |||
592 | list_add_tail(&lb->link, &priv->rx_list.head); | 594 | list_add_tail(&lb->link, &priv->rx_list.head); |
593 | priv->rx_list.bytes_held += bytes; | 595 | priv->rx_list.bytes_held += bytes; |
594 | 596 | ||
595 | dev_dbg(&dev->core, "%s:%d: buf_%lu: queued %lxh bytes\n", | 597 | dev_dbg(&dev->core, "%s:%d: buf_%lu: queued %llxh bytes\n", |
596 | __func__, __LINE__, lb->dbg_number, bytes); | 598 | __func__, __LINE__, lb->dbg_number, bytes); |
597 | 599 | ||
598 | *bytes_queued = bytes; | 600 | *bytes_queued = bytes; |
@@ -745,7 +747,7 @@ static int ps3_vuart_handle_interrupt_tx(struct ps3_system_bus_device *dev) | |||
745 | 747 | ||
746 | list_for_each_entry_safe(lb, n, &priv->tx_list.head, link) { | 748 | list_for_each_entry_safe(lb, n, &priv->tx_list.head, link) { |
747 | 749 | ||
748 | unsigned long bytes_written; | 750 | u64 bytes_written; |
749 | 751 | ||
750 | result = ps3_vuart_raw_write(dev, lb->head, lb->tail - lb->head, | 752 | result = ps3_vuart_raw_write(dev, lb->head, lb->tail - lb->head, |
751 | &bytes_written); | 753 | &bytes_written); |
@@ -762,7 +764,7 @@ static int ps3_vuart_handle_interrupt_tx(struct ps3_system_bus_device *dev) | |||
762 | if (bytes_written < lb->tail - lb->head) { | 764 | if (bytes_written < lb->tail - lb->head) { |
763 | lb->head += bytes_written; | 765 | lb->head += bytes_written; |
764 | dev_dbg(&dev->core, | 766 | dev_dbg(&dev->core, |
765 | "%s:%d cleared buf_%lu, %lxh bytes\n", | 767 | "%s:%d cleared buf_%lu, %llxh bytes\n", |
766 | __func__, __LINE__, lb->dbg_number, | 768 | __func__, __LINE__, lb->dbg_number, |
767 | bytes_written); | 769 | bytes_written); |
768 | goto port_full; | 770 | goto port_full; |
diff --git a/drivers/ps3/ps3stor_lib.c b/drivers/ps3/ps3stor_lib.c index 55955f16ad9..18066d55539 100644 --- a/drivers/ps3/ps3stor_lib.c +++ b/drivers/ps3/ps3stor_lib.c | |||
@@ -70,7 +70,7 @@ static int ps3stor_probe_access(struct ps3_storage_device *dev) | |||
70 | __func__, __LINE__, n); | 70 | __func__, __LINE__, n); |
71 | dev->region_idx = __ffs(dev->accessible_regions); | 71 | dev->region_idx = __ffs(dev->accessible_regions); |
72 | dev_info(&dev->sbd.core, | 72 | dev_info(&dev->sbd.core, |
73 | "First accessible region has index %u start %lu size %lu\n", | 73 | "First accessible region has index %u start %llu size %llu\n", |
74 | dev->region_idx, dev->regions[dev->region_idx].start, | 74 | dev->region_idx, dev->regions[dev->region_idx].start, |
75 | dev->regions[dev->region_idx].size); | 75 | dev->regions[dev->region_idx].size); |
76 | 76 | ||
@@ -220,7 +220,7 @@ u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev, u64 lpar, | |||
220 | const char *op = write ? "write" : "read"; | 220 | const char *op = write ? "write" : "read"; |
221 | int res; | 221 | int res; |
222 | 222 | ||
223 | dev_dbg(&dev->sbd.core, "%s:%u: %s %lu sectors starting at %lu\n", | 223 | dev_dbg(&dev->sbd.core, "%s:%u: %s %llu sectors starting at %llu\n", |
224 | __func__, __LINE__, op, sectors, start_sector); | 224 | __func__, __LINE__, op, sectors, start_sector); |
225 | 225 | ||
226 | init_completion(&dev->done); | 226 | init_completion(&dev->done); |
@@ -238,7 +238,7 @@ u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev, u64 lpar, | |||
238 | 238 | ||
239 | wait_for_completion(&dev->done); | 239 | wait_for_completion(&dev->done); |
240 | if (dev->lv1_status) { | 240 | if (dev->lv1_status) { |
241 | dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__, | 241 | dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%llx\n", __func__, |
242 | __LINE__, op, dev->lv1_status); | 242 | __LINE__, op, dev->lv1_status); |
243 | return dev->lv1_status; | 243 | return dev->lv1_status; |
244 | } | 244 | } |
@@ -268,7 +268,7 @@ u64 ps3stor_send_command(struct ps3_storage_device *dev, u64 cmd, u64 arg1, | |||
268 | { | 268 | { |
269 | int res; | 269 | int res; |
270 | 270 | ||
271 | dev_dbg(&dev->sbd.core, "%s:%u: send device command 0x%lx\n", __func__, | 271 | dev_dbg(&dev->sbd.core, "%s:%u: send device command 0x%llx\n", __func__, |
272 | __LINE__, cmd); | 272 | __LINE__, cmd); |
273 | 273 | ||
274 | init_completion(&dev->done); | 274 | init_completion(&dev->done); |
@@ -277,19 +277,19 @@ u64 ps3stor_send_command(struct ps3_storage_device *dev, u64 cmd, u64 arg1, | |||
277 | arg2, arg3, arg4, &dev->tag); | 277 | arg2, arg3, arg4, &dev->tag); |
278 | if (res) { | 278 | if (res) { |
279 | dev_err(&dev->sbd.core, | 279 | dev_err(&dev->sbd.core, |
280 | "%s:%u: send_device_command 0x%lx failed %d\n", | 280 | "%s:%u: send_device_command 0x%llx failed %d\n", |
281 | __func__, __LINE__, cmd, res); | 281 | __func__, __LINE__, cmd, res); |
282 | return -1; | 282 | return -1; |
283 | } | 283 | } |
284 | 284 | ||
285 | wait_for_completion(&dev->done); | 285 | wait_for_completion(&dev->done); |
286 | if (dev->lv1_status) { | 286 | if (dev->lv1_status) { |
287 | dev_dbg(&dev->sbd.core, "%s:%u: command 0x%lx failed 0x%lx\n", | 287 | dev_dbg(&dev->sbd.core, "%s:%u: command 0x%llx failed 0x%llx\n", |
288 | __func__, __LINE__, cmd, dev->lv1_status); | 288 | __func__, __LINE__, cmd, dev->lv1_status); |
289 | return dev->lv1_status; | 289 | return dev->lv1_status; |
290 | } | 290 | } |
291 | 291 | ||
292 | dev_dbg(&dev->sbd.core, "%s:%u: command 0x%lx completed\n", __func__, | 292 | dev_dbg(&dev->sbd.core, "%s:%u: command 0x%llx completed\n", __func__, |
293 | __LINE__, cmd); | 293 | __LINE__, cmd); |
294 | 294 | ||
295 | return 0; | 295 | return 0; |
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c index cc7eb8767b8..bd56a033bfd 100644 --- a/drivers/rtc/rtc-pxa.c +++ b/drivers/rtc/rtc-pxa.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | 29 | ||
30 | #include <mach/hardware.h> | ||
31 | |||
30 | #define TIMER_FREQ CLOCK_TICK_RATE | 32 | #define TIMER_FREQ CLOCK_TICK_RATE |
31 | #define RTC_DEF_DIVIDER (32768 - 1) | 33 | #define RTC_DEF_DIVIDER (32768 - 1) |
32 | #define RTC_DEF_TRIM 0 | 34 | #define RTC_DEF_TRIM 0 |
diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c index 8ce5f74ee45..ad35f76c46b 100644 --- a/drivers/rtc/rtc-twl4030.c +++ b/drivers/rtc/rtc-twl4030.c | |||
@@ -120,7 +120,7 @@ static int twl4030_rtc_write_u8(u8 data, u8 reg) | |||
120 | static unsigned char rtc_irq_bits; | 120 | static unsigned char rtc_irq_bits; |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * Enable timer and/or alarm interrupts. | 123 | * Enable 1/second update and/or alarm interrupts. |
124 | */ | 124 | */ |
125 | static int set_rtc_irq_bit(unsigned char bit) | 125 | static int set_rtc_irq_bit(unsigned char bit) |
126 | { | 126 | { |
@@ -128,6 +128,7 @@ static int set_rtc_irq_bit(unsigned char bit) | |||
128 | int ret; | 128 | int ret; |
129 | 129 | ||
130 | val = rtc_irq_bits | bit; | 130 | val = rtc_irq_bits | bit; |
131 | val &= ~BIT_RTC_INTERRUPTS_REG_EVERY_M; | ||
131 | ret = twl4030_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG); | 132 | ret = twl4030_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG); |
132 | if (ret == 0) | 133 | if (ret == 0) |
133 | rtc_irq_bits = val; | 134 | rtc_irq_bits = val; |
@@ -136,7 +137,7 @@ static int set_rtc_irq_bit(unsigned char bit) | |||
136 | } | 137 | } |
137 | 138 | ||
138 | /* | 139 | /* |
139 | * Disable timer and/or alarm interrupts. | 140 | * Disable update and/or alarm interrupts. |
140 | */ | 141 | */ |
141 | static int mask_rtc_irq_bit(unsigned char bit) | 142 | static int mask_rtc_irq_bit(unsigned char bit) |
142 | { | 143 | { |
@@ -151,7 +152,7 @@ static int mask_rtc_irq_bit(unsigned char bit) | |||
151 | return ret; | 152 | return ret; |
152 | } | 153 | } |
153 | 154 | ||
154 | static inline int twl4030_rtc_alarm_irq_set_state(int enabled) | 155 | static int twl4030_rtc_alarm_irq_enable(struct device *dev, unsigned enabled) |
155 | { | 156 | { |
156 | int ret; | 157 | int ret; |
157 | 158 | ||
@@ -163,7 +164,7 @@ static inline int twl4030_rtc_alarm_irq_set_state(int enabled) | |||
163 | return ret; | 164 | return ret; |
164 | } | 165 | } |
165 | 166 | ||
166 | static inline int twl4030_rtc_irq_set_state(int enabled) | 167 | static int twl4030_rtc_update_irq_enable(struct device *dev, unsigned enabled) |
167 | { | 168 | { |
168 | int ret; | 169 | int ret; |
169 | 170 | ||
@@ -292,7 +293,7 @@ static int twl4030_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) | |||
292 | unsigned char alarm_data[ALL_TIME_REGS + 1]; | 293 | unsigned char alarm_data[ALL_TIME_REGS + 1]; |
293 | int ret; | 294 | int ret; |
294 | 295 | ||
295 | ret = twl4030_rtc_alarm_irq_set_state(0); | 296 | ret = twl4030_rtc_alarm_irq_enable(dev, 0); |
296 | if (ret) | 297 | if (ret) |
297 | goto out; | 298 | goto out; |
298 | 299 | ||
@@ -312,35 +313,11 @@ static int twl4030_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) | |||
312 | } | 313 | } |
313 | 314 | ||
314 | if (alm->enabled) | 315 | if (alm->enabled) |
315 | ret = twl4030_rtc_alarm_irq_set_state(1); | 316 | ret = twl4030_rtc_alarm_irq_enable(dev, 1); |
316 | out: | 317 | out: |
317 | return ret; | 318 | return ret; |
318 | } | 319 | } |
319 | 320 | ||
320 | #ifdef CONFIG_RTC_INTF_DEV | ||
321 | |||
322 | static int twl4030_rtc_ioctl(struct device *dev, unsigned int cmd, | ||
323 | unsigned long arg) | ||
324 | { | ||
325 | switch (cmd) { | ||
326 | case RTC_AIE_OFF: | ||
327 | return twl4030_rtc_alarm_irq_set_state(0); | ||
328 | case RTC_AIE_ON: | ||
329 | return twl4030_rtc_alarm_irq_set_state(1); | ||
330 | case RTC_UIE_OFF: | ||
331 | return twl4030_rtc_irq_set_state(0); | ||
332 | case RTC_UIE_ON: | ||
333 | return twl4030_rtc_irq_set_state(1); | ||
334 | |||
335 | default: | ||
336 | return -ENOIOCTLCMD; | ||
337 | } | ||
338 | } | ||
339 | |||
340 | #else | ||
341 | #define twl4030_rtc_ioctl NULL | ||
342 | #endif | ||
343 | |||
344 | static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc) | 321 | static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc) |
345 | { | 322 | { |
346 | unsigned long events = 0; | 323 | unsigned long events = 0; |
@@ -400,11 +377,12 @@ out: | |||
400 | } | 377 | } |
401 | 378 | ||
402 | static struct rtc_class_ops twl4030_rtc_ops = { | 379 | static struct rtc_class_ops twl4030_rtc_ops = { |
403 | .ioctl = twl4030_rtc_ioctl, | ||
404 | .read_time = twl4030_rtc_read_time, | 380 | .read_time = twl4030_rtc_read_time, |
405 | .set_time = twl4030_rtc_set_time, | 381 | .set_time = twl4030_rtc_set_time, |
406 | .read_alarm = twl4030_rtc_read_alarm, | 382 | .read_alarm = twl4030_rtc_read_alarm, |
407 | .set_alarm = twl4030_rtc_set_alarm, | 383 | .set_alarm = twl4030_rtc_set_alarm, |
384 | .alarm_irq_enable = twl4030_rtc_alarm_irq_enable, | ||
385 | .update_irq_enable = twl4030_rtc_update_irq_enable, | ||
408 | }; | 386 | }; |
409 | 387 | ||
410 | /*----------------------------------------------------------------------*/ | 388 | /*----------------------------------------------------------------------*/ |
@@ -422,7 +400,7 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) | |||
422 | rtc = rtc_device_register(pdev->name, | 400 | rtc = rtc_device_register(pdev->name, |
423 | &pdev->dev, &twl4030_rtc_ops, THIS_MODULE); | 401 | &pdev->dev, &twl4030_rtc_ops, THIS_MODULE); |
424 | if (IS_ERR(rtc)) { | 402 | if (IS_ERR(rtc)) { |
425 | ret = -EINVAL; | 403 | ret = PTR_ERR(rtc); |
426 | dev_err(&pdev->dev, "can't register RTC device, err %ld\n", | 404 | dev_err(&pdev->dev, "can't register RTC device, err %ld\n", |
427 | PTR_ERR(rtc)); | 405 | PTR_ERR(rtc)); |
428 | goto out0; | 406 | goto out0; |
@@ -432,7 +410,6 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) | |||
432 | platform_set_drvdata(pdev, rtc); | 410 | platform_set_drvdata(pdev, rtc); |
433 | 411 | ||
434 | ret = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); | 412 | ret = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); |
435 | |||
436 | if (ret < 0) | 413 | if (ret < 0) |
437 | goto out1; | 414 | goto out1; |
438 | 415 | ||
@@ -475,7 +452,6 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) | |||
475 | 452 | ||
476 | return ret; | 453 | return ret; |
477 | 454 | ||
478 | |||
479 | out2: | 455 | out2: |
480 | free_irq(irq, rtc); | 456 | free_irq(irq, rtc); |
481 | out1: | 457 | out1: |
@@ -506,8 +482,9 @@ static int __devexit twl4030_rtc_remove(struct platform_device *pdev) | |||
506 | 482 | ||
507 | static void twl4030_rtc_shutdown(struct platform_device *pdev) | 483 | static void twl4030_rtc_shutdown(struct platform_device *pdev) |
508 | { | 484 | { |
509 | mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M | | 485 | /* mask timer interrupts, but leave alarm interrupts on to enable |
510 | BIT_RTC_INTERRUPTS_REG_IT_ALARM_M); | 486 | power-on when alarm is triggered */ |
487 | mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M); | ||
511 | } | 488 | } |
512 | 489 | ||
513 | #ifdef CONFIG_PM | 490 | #ifdef CONFIG_PM |
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index ee0739b217b..91ef669d98f 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c | |||
@@ -933,7 +933,7 @@ static void ibmvfc_get_host_speed(struct Scsi_Host *shost) | |||
933 | fc_host_speed(shost) = FC_PORTSPEED_16GBIT; | 933 | fc_host_speed(shost) = FC_PORTSPEED_16GBIT; |
934 | break; | 934 | break; |
935 | default: | 935 | default: |
936 | ibmvfc_log(vhost, 3, "Unknown port speed: %ld Gbit\n", | 936 | ibmvfc_log(vhost, 3, "Unknown port speed: %lld Gbit\n", |
937 | vhost->login_buf->resp.link_speed / 100); | 937 | vhost->login_buf->resp.link_speed / 100); |
938 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; | 938 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; |
939 | break; | 939 | break; |
@@ -2149,8 +2149,8 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, | |||
2149 | { | 2149 | { |
2150 | const char *desc = ibmvfc_get_ae_desc(crq->event); | 2150 | const char *desc = ibmvfc_get_ae_desc(crq->event); |
2151 | 2151 | ||
2152 | ibmvfc_log(vhost, 3, "%s event received. scsi_id: %lx, wwpn: %lx," | 2152 | ibmvfc_log(vhost, 3, "%s event received. scsi_id: %llx, wwpn: %llx," |
2153 | " node_name: %lx\n", desc, crq->scsi_id, crq->wwpn, crq->node_name); | 2153 | " node_name: %llx\n", desc, crq->scsi_id, crq->wwpn, crq->node_name); |
2154 | 2154 | ||
2155 | switch (crq->event) { | 2155 | switch (crq->event) { |
2156 | case IBMVFC_AE_LINK_UP: | 2156 | case IBMVFC_AE_LINK_UP: |
@@ -2184,7 +2184,7 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, | |||
2184 | ibmvfc_link_down(vhost, IBMVFC_HALTED); | 2184 | ibmvfc_link_down(vhost, IBMVFC_HALTED); |
2185 | break; | 2185 | break; |
2186 | default: | 2186 | default: |
2187 | dev_err(vhost->dev, "Unknown async event received: %ld\n", crq->event); | 2187 | dev_err(vhost->dev, "Unknown async event received: %lld\n", crq->event); |
2188 | break; | 2188 | break; |
2189 | }; | 2189 | }; |
2190 | } | 2190 | } |
@@ -2261,13 +2261,13 @@ static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost) | |||
2261 | * actually sent | 2261 | * actually sent |
2262 | */ | 2262 | */ |
2263 | if (unlikely(!ibmvfc_valid_event(&vhost->pool, evt))) { | 2263 | if (unlikely(!ibmvfc_valid_event(&vhost->pool, evt))) { |
2264 | dev_err(vhost->dev, "Returned correlation_token 0x%08lx is invalid!\n", | 2264 | dev_err(vhost->dev, "Returned correlation_token 0x%08llx is invalid!\n", |
2265 | crq->ioba); | 2265 | crq->ioba); |
2266 | return; | 2266 | return; |
2267 | } | 2267 | } |
2268 | 2268 | ||
2269 | if (unlikely(atomic_read(&evt->free))) { | 2269 | if (unlikely(atomic_read(&evt->free))) { |
2270 | dev_err(vhost->dev, "Received duplicate correlation_token 0x%08lx!\n", | 2270 | dev_err(vhost->dev, "Received duplicate correlation_token 0x%08llx!\n", |
2271 | crq->ioba); | 2271 | crq->ioba); |
2272 | return; | 2272 | return; |
2273 | } | 2273 | } |
@@ -3259,7 +3259,7 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vhost, u64 scsi_id) | |||
3259 | 3259 | ||
3260 | tgt = mempool_alloc(vhost->tgt_pool, GFP_KERNEL); | 3260 | tgt = mempool_alloc(vhost->tgt_pool, GFP_KERNEL); |
3261 | if (!tgt) { | 3261 | if (!tgt) { |
3262 | dev_err(vhost->dev, "Target allocation failure for scsi id %08lx\n", | 3262 | dev_err(vhost->dev, "Target allocation failure for scsi id %08llx\n", |
3263 | scsi_id); | 3263 | scsi_id); |
3264 | return -ENOMEM; | 3264 | return -ENOMEM; |
3265 | } | 3265 | } |
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index babdf3db59d..87dafd0f8d4 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h | |||
@@ -691,13 +691,13 @@ struct ibmvfc_host { | |||
691 | #define DBG_CMD(CMD) do { if (ibmvfc_debug) CMD; } while (0) | 691 | #define DBG_CMD(CMD) do { if (ibmvfc_debug) CMD; } while (0) |
692 | 692 | ||
693 | #define tgt_dbg(t, fmt, ...) \ | 693 | #define tgt_dbg(t, fmt, ...) \ |
694 | DBG_CMD(dev_info((t)->vhost->dev, "%lX: " fmt, (t)->scsi_id, ##__VA_ARGS__)) | 694 | DBG_CMD(dev_info((t)->vhost->dev, "%llX: " fmt, (t)->scsi_id, ##__VA_ARGS__)) |
695 | 695 | ||
696 | #define tgt_info(t, fmt, ...) \ | 696 | #define tgt_info(t, fmt, ...) \ |
697 | dev_info((t)->vhost->dev, "%lX: " fmt, (t)->scsi_id, ##__VA_ARGS__) | 697 | dev_info((t)->vhost->dev, "%llX: " fmt, (t)->scsi_id, ##__VA_ARGS__) |
698 | 698 | ||
699 | #define tgt_err(t, fmt, ...) \ | 699 | #define tgt_err(t, fmt, ...) \ |
700 | dev_err((t)->vhost->dev, "%lX: " fmt, (t)->scsi_id, ##__VA_ARGS__) | 700 | dev_err((t)->vhost->dev, "%llX: " fmt, (t)->scsi_id, ##__VA_ARGS__) |
701 | 701 | ||
702 | #define ibmvfc_dbg(vhost, ...) \ | 702 | #define ibmvfc_dbg(vhost, ...) \ |
703 | DBG_CMD(dev_info((vhost)->dev, ##__VA_ARGS__)) | 703 | DBG_CMD(dev_info((vhost)->dev, ##__VA_ARGS__)) |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 5c541f7850f..74d07d137da 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -1061,7 +1061,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd) | |||
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | sdev_printk(KERN_INFO, cmd->device, | 1063 | sdev_printk(KERN_INFO, cmd->device, |
1064 | "aborting command. lun 0x%lx, tag 0x%lx\n", | 1064 | "aborting command. lun 0x%llx, tag 0x%llx\n", |
1065 | (((u64) lun) << 48), (u64) found_evt); | 1065 | (((u64) lun) << 48), (u64) found_evt); |
1066 | 1066 | ||
1067 | wait_for_completion(&evt->comp); | 1067 | wait_for_completion(&evt->comp); |
@@ -1082,7 +1082,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd) | |||
1082 | if (rsp_rc) { | 1082 | if (rsp_rc) { |
1083 | if (printk_ratelimit()) | 1083 | if (printk_ratelimit()) |
1084 | sdev_printk(KERN_WARNING, cmd->device, | 1084 | sdev_printk(KERN_WARNING, cmd->device, |
1085 | "abort code %d for task tag 0x%lx\n", | 1085 | "abort code %d for task tag 0x%llx\n", |
1086 | rsp_rc, tsk_mgmt->task_tag); | 1086 | rsp_rc, tsk_mgmt->task_tag); |
1087 | return FAILED; | 1087 | return FAILED; |
1088 | } | 1088 | } |
@@ -1102,12 +1102,12 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd) | |||
1102 | 1102 | ||
1103 | if (found_evt == NULL) { | 1103 | if (found_evt == NULL) { |
1104 | spin_unlock_irqrestore(hostdata->host->host_lock, flags); | 1104 | spin_unlock_irqrestore(hostdata->host->host_lock, flags); |
1105 | sdev_printk(KERN_INFO, cmd->device, "aborted task tag 0x%lx completed\n", | 1105 | sdev_printk(KERN_INFO, cmd->device, "aborted task tag 0x%llx completed\n", |
1106 | tsk_mgmt->task_tag); | 1106 | tsk_mgmt->task_tag); |
1107 | return SUCCESS; | 1107 | return SUCCESS; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | sdev_printk(KERN_INFO, cmd->device, "successfully aborted task tag 0x%lx\n", | 1110 | sdev_printk(KERN_INFO, cmd->device, "successfully aborted task tag 0x%llx\n", |
1111 | tsk_mgmt->task_tag); | 1111 | tsk_mgmt->task_tag); |
1112 | 1112 | ||
1113 | cmd->result = (DID_ABORT << 16); | 1113 | cmd->result = (DID_ABORT << 16); |
@@ -1182,7 +1182,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd) | |||
1182 | return FAILED; | 1182 | return FAILED; |
1183 | } | 1183 | } |
1184 | 1184 | ||
1185 | sdev_printk(KERN_INFO, cmd->device, "resetting device. lun 0x%lx\n", | 1185 | sdev_printk(KERN_INFO, cmd->device, "resetting device. lun 0x%llx\n", |
1186 | (((u64) lun) << 48)); | 1186 | (((u64) lun) << 48)); |
1187 | 1187 | ||
1188 | wait_for_completion(&evt->comp); | 1188 | wait_for_completion(&evt->comp); |
@@ -1203,7 +1203,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd) | |||
1203 | if (rsp_rc) { | 1203 | if (rsp_rc) { |
1204 | if (printk_ratelimit()) | 1204 | if (printk_ratelimit()) |
1205 | sdev_printk(KERN_WARNING, cmd->device, | 1205 | sdev_printk(KERN_WARNING, cmd->device, |
1206 | "reset code %d for task tag 0x%lx\n", | 1206 | "reset code %d for task tag 0x%llx\n", |
1207 | rsp_rc, tsk_mgmt->task_tag); | 1207 | rsp_rc, tsk_mgmt->task_tag); |
1208 | return FAILED; | 1208 | return FAILED; |
1209 | } | 1209 | } |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 841f460edbc..07829009a8b 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -4912,7 +4912,7 @@ static int ipr_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) | |||
4912 | if (res && ipr_is_gata(res)) { | 4912 | if (res && ipr_is_gata(res)) { |
4913 | if (cmd == HDIO_GET_IDENTITY) | 4913 | if (cmd == HDIO_GET_IDENTITY) |
4914 | return -ENOTTY; | 4914 | return -ENOTTY; |
4915 | return ata_scsi_ioctl(sdev, cmd, arg); | 4915 | return ata_sas_scsi_ioctl(res->sata_port->ap, sdev, cmd, arg); |
4916 | } | 4916 | } |
4917 | 4917 | ||
4918 | return -EINVAL; | 4918 | return -EINVAL; |
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c index a745f91d292..e7705d3532c 100644 --- a/drivers/scsi/libiscsi_tcp.c +++ b/drivers/scsi/libiscsi_tcp.c | |||
@@ -177,7 +177,6 @@ int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn, | |||
177 | struct iscsi_segment *segment, int recv, | 177 | struct iscsi_segment *segment, int recv, |
178 | unsigned copied) | 178 | unsigned copied) |
179 | { | 179 | { |
180 | static unsigned char padbuf[ISCSI_PAD_LEN]; | ||
181 | struct scatterlist sg; | 180 | struct scatterlist sg; |
182 | unsigned int pad; | 181 | unsigned int pad; |
183 | 182 | ||
@@ -233,7 +232,7 @@ int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn, | |||
233 | debug_tcp("consume %d pad bytes\n", pad); | 232 | debug_tcp("consume %d pad bytes\n", pad); |
234 | segment->total_size += pad; | 233 | segment->total_size += pad; |
235 | segment->size = pad; | 234 | segment->size = pad; |
236 | segment->data = padbuf; | 235 | segment->data = segment->padbuf; |
237 | return 0; | 236 | return 0; |
238 | } | 237 | } |
239 | } | 238 | } |
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 744838780ad..1c558d3bce1 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c | |||
@@ -717,7 +717,7 @@ int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) | |||
717 | struct domain_device *dev = sdev_to_domain_dev(sdev); | 717 | struct domain_device *dev = sdev_to_domain_dev(sdev); |
718 | 718 | ||
719 | if (dev_is_sata(dev)) | 719 | if (dev_is_sata(dev)) |
720 | return ata_scsi_ioctl(sdev, cmd, arg); | 720 | return ata_sas_scsi_ioctl(dev->sata_dev.ap, sdev, cmd, arg); |
721 | 721 | ||
722 | return -EINVAL; | 722 | return -EINVAL; |
723 | } | 723 | } |
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c index ce48e2d0193..ca0dd33497e 100644 --- a/drivers/scsi/ps3rom.c +++ b/drivers/scsi/ps3rom.c | |||
@@ -290,11 +290,11 @@ static irqreturn_t ps3rom_interrupt(int irq, void *data) | |||
290 | 290 | ||
291 | if (tag != dev->tag) | 291 | if (tag != dev->tag) |
292 | dev_err(&dev->sbd.core, | 292 | dev_err(&dev->sbd.core, |
293 | "%s:%u: tag mismatch, got %lx, expected %lx\n", | 293 | "%s:%u: tag mismatch, got %llx, expected %llx\n", |
294 | __func__, __LINE__, tag, dev->tag); | 294 | __func__, __LINE__, tag, dev->tag); |
295 | 295 | ||
296 | if (res) { | 296 | if (res) { |
297 | dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%lx\n", | 297 | dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%llx\n", |
298 | __func__, __LINE__, res, status); | 298 | __func__, __LINE__, res, status); |
299 | return IRQ_HANDLED; | 299 | return IRQ_HANDLED; |
300 | } | 300 | } |
@@ -364,7 +364,7 @@ static int __devinit ps3rom_probe(struct ps3_system_bus_device *_dev) | |||
364 | 364 | ||
365 | if (dev->blk_size != CD_FRAMESIZE) { | 365 | if (dev->blk_size != CD_FRAMESIZE) { |
366 | dev_err(&dev->sbd.core, | 366 | dev_err(&dev->sbd.core, |
367 | "%s:%u: cannot handle block size %lu\n", __func__, | 367 | "%s:%u: cannot handle block size %llu\n", __func__, |
368 | __LINE__, dev->blk_size); | 368 | __LINE__, dev->blk_size); |
369 | return -EINVAL; | 369 | return -EINVAL; |
370 | } | 370 | } |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 2d4f32b4df5..9ad4d0968e5 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -1258,35 +1258,48 @@ qla2x00_init_rings(scsi_qla_host_t *vha) | |||
1258 | { | 1258 | { |
1259 | int rval; | 1259 | int rval; |
1260 | unsigned long flags = 0; | 1260 | unsigned long flags = 0; |
1261 | int cnt; | 1261 | int cnt, que; |
1262 | struct qla_hw_data *ha = vha->hw; | 1262 | struct qla_hw_data *ha = vha->hw; |
1263 | struct req_que *req = ha->req_q_map[0]; | 1263 | struct req_que *req; |
1264 | struct rsp_que *rsp = ha->rsp_q_map[0]; | 1264 | struct rsp_que *rsp; |
1265 | struct scsi_qla_host *vp; | ||
1265 | struct mid_init_cb_24xx *mid_init_cb = | 1266 | struct mid_init_cb_24xx *mid_init_cb = |
1266 | (struct mid_init_cb_24xx *) ha->init_cb; | 1267 | (struct mid_init_cb_24xx *) ha->init_cb; |
1267 | 1268 | ||
1268 | spin_lock_irqsave(&ha->hardware_lock, flags); | 1269 | spin_lock_irqsave(&ha->hardware_lock, flags); |
1269 | 1270 | ||
1270 | /* Clear outstanding commands array. */ | 1271 | /* Clear outstanding commands array. */ |
1271 | for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) | 1272 | for (que = 0; que < ha->max_queues; que++) { |
1272 | req->outstanding_cmds[cnt] = NULL; | 1273 | req = ha->req_q_map[que]; |
1274 | if (!req) | ||
1275 | continue; | ||
1276 | for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) | ||
1277 | req->outstanding_cmds[cnt] = NULL; | ||
1273 | 1278 | ||
1274 | req->current_outstanding_cmd = 0; | 1279 | req->current_outstanding_cmd = 0; |
1275 | 1280 | ||
1276 | /* Clear RSCN queue. */ | 1281 | /* Initialize firmware. */ |
1277 | vha->rscn_in_ptr = 0; | 1282 | req->ring_ptr = req->ring; |
1278 | vha->rscn_out_ptr = 0; | 1283 | req->ring_index = 0; |
1284 | req->cnt = req->length; | ||
1285 | } | ||
1279 | 1286 | ||
1280 | /* Initialize firmware. */ | 1287 | for (que = 0; que < ha->max_queues; que++) { |
1281 | req->ring_ptr = req->ring; | 1288 | rsp = ha->rsp_q_map[que]; |
1282 | req->ring_index = 0; | 1289 | if (!rsp) |
1283 | req->cnt = req->length; | 1290 | continue; |
1284 | rsp->ring_ptr = rsp->ring; | 1291 | rsp->ring_ptr = rsp->ring; |
1285 | rsp->ring_index = 0; | 1292 | rsp->ring_index = 0; |
1286 | 1293 | ||
1287 | /* Initialize response queue entries */ | 1294 | /* Initialize response queue entries */ |
1288 | qla2x00_init_response_q_entries(rsp); | 1295 | qla2x00_init_response_q_entries(rsp); |
1296 | } | ||
1289 | 1297 | ||
1298 | /* Clear RSCN queue. */ | ||
1299 | list_for_each_entry(vp, &ha->vp_list, list) { | ||
1300 | vp->rscn_in_ptr = 0; | ||
1301 | vp->rscn_out_ptr = 0; | ||
1302 | } | ||
1290 | ha->isp_ops->config_rings(vha); | 1303 | ha->isp_ops->config_rings(vha); |
1291 | 1304 | ||
1292 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 1305 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
@@ -3212,8 +3225,8 @@ qla2x00_loop_resync(scsi_qla_host_t *vha) | |||
3212 | int rval = QLA_SUCCESS; | 3225 | int rval = QLA_SUCCESS; |
3213 | uint32_t wait_time; | 3226 | uint32_t wait_time; |
3214 | struct qla_hw_data *ha = vha->hw; | 3227 | struct qla_hw_data *ha = vha->hw; |
3215 | struct req_que *req = ha->req_q_map[0]; | 3228 | struct req_que *req = ha->req_q_map[vha->req_ques[0]]; |
3216 | struct rsp_que *rsp = ha->rsp_q_map[0]; | 3229 | struct rsp_que *rsp = req->rsp; |
3217 | 3230 | ||
3218 | atomic_set(&vha->loop_state, LOOP_UPDATE); | 3231 | atomic_set(&vha->loop_state, LOOP_UPDATE); |
3219 | clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); | 3232 | clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); |
@@ -3492,6 +3505,7 @@ qla25xx_init_queues(struct qla_hw_data *ha) | |||
3492 | } | 3505 | } |
3493 | req = ha->req_q_map[i]; | 3506 | req = ha->req_q_map[i]; |
3494 | if (req) { | 3507 | if (req) { |
3508 | /* Clear outstanding commands array. */ | ||
3495 | req->options &= ~BIT_0; | 3509 | req->options &= ~BIT_0; |
3496 | ret = qla25xx_init_req_que(base_vha, req, req->options); | 3510 | ret = qla25xx_init_req_que(base_vha, req, req->options); |
3497 | if (ret != QLA_SUCCESS) | 3511 | if (ret != QLA_SUCCESS) |
@@ -3500,7 +3514,7 @@ qla25xx_init_queues(struct qla_hw_data *ha) | |||
3500 | req->id)); | 3514 | req->id)); |
3501 | else | 3515 | else |
3502 | DEBUG2_17(printk(KERN_WARNING | 3516 | DEBUG2_17(printk(KERN_WARNING |
3503 | "%s Rsp que:%d inited\n", __func__, | 3517 | "%s Req que:%d inited\n", __func__, |
3504 | req->id)); | 3518 | req->id)); |
3505 | } | 3519 | } |
3506 | } | 3520 | } |
@@ -4151,8 +4165,8 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha) | |||
4151 | uint16_t mb[MAILBOX_REGISTER_COUNT]; | 4165 | uint16_t mb[MAILBOX_REGISTER_COUNT]; |
4152 | struct qla_hw_data *ha = vha->hw; | 4166 | struct qla_hw_data *ha = vha->hw; |
4153 | struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); | 4167 | struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); |
4154 | struct req_que *req = ha->req_q_map[0]; | 4168 | struct req_que *req = ha->req_q_map[vha->req_ques[0]]; |
4155 | struct rsp_que *rsp = ha->rsp_q_map[0]; | 4169 | struct rsp_que *rsp = req->rsp; |
4156 | 4170 | ||
4157 | if (!vha->vp_idx) | 4171 | if (!vha->vp_idx) |
4158 | return -EINVAL; | 4172 | return -EINVAL; |
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 886323130fc..f53179c4642 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
@@ -629,6 +629,7 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options, | |||
629 | req->ring_index = 0; | 629 | req->ring_index = 0; |
630 | req->cnt = req->length; | 630 | req->cnt = req->length; |
631 | req->id = que_id; | 631 | req->id = que_id; |
632 | req->max_q_depth = ha->req_q_map[0]->max_q_depth; | ||
632 | mutex_unlock(&ha->vport_lock); | 633 | mutex_unlock(&ha->vport_lock); |
633 | 634 | ||
634 | ret = qla25xx_init_req_que(base_vha, req, options); | 635 | ret = qla25xx_init_req_que(base_vha, req, options); |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 4a71f522f92..cf32653fe01 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -1158,8 +1158,8 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) | |||
1158 | struct req_que *req; | 1158 | struct req_que *req; |
1159 | 1159 | ||
1160 | spin_lock_irqsave(&ha->hardware_lock, flags); | 1160 | spin_lock_irqsave(&ha->hardware_lock, flags); |
1161 | for (que = 0; que < QLA_MAX_HOST_QUES; que++) { | 1161 | for (que = 0; que < ha->max_queues; que++) { |
1162 | req = ha->req_q_map[vha->req_ques[que]]; | 1162 | req = ha->req_q_map[que]; |
1163 | if (!req) | 1163 | if (!req) |
1164 | continue; | 1164 | continue; |
1165 | for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { | 1165 | for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { |
@@ -1193,7 +1193,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev) | |||
1193 | scsi_qla_host_t *vha = shost_priv(sdev->host); | 1193 | scsi_qla_host_t *vha = shost_priv(sdev->host); |
1194 | struct qla_hw_data *ha = vha->hw; | 1194 | struct qla_hw_data *ha = vha->hw; |
1195 | struct fc_rport *rport = starget_to_rport(sdev->sdev_target); | 1195 | struct fc_rport *rport = starget_to_rport(sdev->sdev_target); |
1196 | struct req_que *req = ha->req_q_map[0]; | 1196 | struct req_que *req = ha->req_q_map[vha->req_ques[0]]; |
1197 | 1197 | ||
1198 | if (sdev->tagged_supported) | 1198 | if (sdev->tagged_supported) |
1199 | scsi_activate_tcq(sdev, req->max_q_depth); | 1199 | scsi_activate_tcq(sdev, req->max_q_depth); |
@@ -1998,7 +1998,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1998 | return 0; | 1998 | return 0; |
1999 | 1999 | ||
2000 | probe_failed: | 2000 | probe_failed: |
2001 | qla2x00_free_que(ha, req, rsp); | ||
2002 | qla2x00_free_device(base_vha); | 2001 | qla2x00_free_device(base_vha); |
2003 | 2002 | ||
2004 | scsi_host_put(base_vha->host); | 2003 | scsi_host_put(base_vha->host); |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 42e72a2c1f9..cbcd3f681b6 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -1095,7 +1095,8 @@ EXPORT_SYMBOL(__starget_for_each_device); | |||
1095 | * Description: Looks up the scsi_device with the specified @lun for a given | 1095 | * Description: Looks up the scsi_device with the specified @lun for a given |
1096 | * @starget. The returned scsi_device does not have an additional | 1096 | * @starget. The returned scsi_device does not have an additional |
1097 | * reference. You must hold the host's host_lock over this call and | 1097 | * reference. You must hold the host's host_lock over this call and |
1098 | * any access to the returned scsi_device. | 1098 | * any access to the returned scsi_device. A scsi_device in state |
1099 | * SDEV_DEL is skipped. | ||
1099 | * | 1100 | * |
1100 | * Note: The only reason why drivers should use this is because | 1101 | * Note: The only reason why drivers should use this is because |
1101 | * they need to access the device list in irq context. Otherwise you | 1102 | * they need to access the device list in irq context. Otherwise you |
@@ -1107,6 +1108,8 @@ struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *starget, | |||
1107 | struct scsi_device *sdev; | 1108 | struct scsi_device *sdev; |
1108 | 1109 | ||
1109 | list_for_each_entry(sdev, &starget->devices, same_target_siblings) { | 1110 | list_for_each_entry(sdev, &starget->devices, same_target_siblings) { |
1111 | if (sdev->sdev_state == SDEV_DEL) | ||
1112 | continue; | ||
1110 | if (sdev->lun ==lun) | 1113 | if (sdev->lun ==lun) |
1111 | return sdev; | 1114 | return sdev; |
1112 | } | 1115 | } |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 4969e4ec75e..099b5455bbc 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -224,6 +224,7 @@ static struct { | |||
224 | {"SGI", "TP9100", "*", BLIST_REPORTLUN2}, | 224 | {"SGI", "TP9100", "*", BLIST_REPORTLUN2}, |
225 | {"SGI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | 225 | {"SGI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
226 | {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | 226 | {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
227 | {"SUN", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
227 | {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36}, | 228 | {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36}, |
228 | {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN}, | 229 | {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN}, |
229 | {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */ | 230 | {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */ |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index c088146b751..2a3671233b1 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -602,6 +602,10 @@ static int pci_netmos_init(struct pci_dev *dev) | |||
602 | /* subdevice 0x00PS means <P> parallel, <S> serial */ | 602 | /* subdevice 0x00PS means <P> parallel, <S> serial */ |
603 | unsigned int num_serial = dev->subsystem_device & 0xf; | 603 | unsigned int num_serial = dev->subsystem_device & 0xf; |
604 | 604 | ||
605 | if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM && | ||
606 | dev->subsystem_device == 0x0299) | ||
607 | return 0; | ||
608 | |||
605 | if (num_serial == 0) | 609 | if (num_serial == 0) |
606 | return -ENODEV; | 610 | return -ENODEV; |
607 | return num_serial; | 611 | return num_serial; |
@@ -3096,6 +3100,10 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
3096 | 0, | 3100 | 0, |
3097 | pbn_b0_8_115200 }, | 3101 | pbn_b0_8_115200 }, |
3098 | 3102 | ||
3103 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835, | ||
3104 | PCI_VENDOR_ID_IBM, 0x0299, | ||
3105 | 0, 0, pbn_b0_bt_2_115200 }, | ||
3106 | |||
3099 | /* | 3107 | /* |
3100 | * These entries match devices with class COMMUNICATION_SERIAL, | 3108 | * These entries match devices with class COMMUNICATION_SERIAL, |
3101 | * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL | 3109 | * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL |
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index fde7f9ccf57..bbcfc26a3b6 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
@@ -270,6 +270,8 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
270 | { "RSS0250", 0 }, | 270 | { "RSS0250", 0 }, |
271 | /* SupraExpress 28.8 Data/Fax PnP modem */ | 271 | /* SupraExpress 28.8 Data/Fax PnP modem */ |
272 | { "SUP1310", 0 }, | 272 | { "SUP1310", 0 }, |
273 | /* SupraExpress 336i PnP Voice Modem */ | ||
274 | { "SUP1381", 0 }, | ||
273 | /* SupraExpress 33.6 Data/Fax PnP modem */ | 275 | /* SupraExpress 33.6 Data/Fax PnP modem */ |
274 | { "SUP1421", 0 }, | 276 | { "SUP1421", 0 }, |
275 | /* SupraExpress 33.6 Data/Fax PnP modem */ | 277 | /* SupraExpress 33.6 Data/Fax PnP modem */ |
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index d5efd6c7790..89362d733d6 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -579,7 +579,7 @@ static void atmel_tx_dma(struct uart_port *port) | |||
579 | /* disable PDC transmit */ | 579 | /* disable PDC transmit */ |
580 | UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS); | 580 | UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS); |
581 | 581 | ||
582 | if (!uart_circ_empty(xmit)) { | 582 | if (!uart_circ_empty(xmit) && !uart_tx_stopped(port)) { |
583 | dma_sync_single_for_device(port->dev, | 583 | dma_sync_single_for_device(port->dev, |
584 | pdc->dma_addr, | 584 | pdc->dma_addr, |
585 | pdc->dma_size, | 585 | pdc->dma_size, |
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c index a821e3a3d66..14f8fa9135b 100644 --- a/drivers/serial/of_serial.c +++ b/drivers/serial/of_serial.c | |||
@@ -163,6 +163,7 @@ static struct of_device_id __devinitdata of_platform_serial_table[] = { | |||
163 | { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, }, | 163 | { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, }, |
164 | { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, }, | 164 | { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, }, |
165 | { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, }, | 165 | { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, }, |
166 | { .type = "serial", .compatible = "ns16850", .data = (void *)PORT_16850, }, | ||
166 | #ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL | 167 | #ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL |
167 | { .type = "serial", .compatible = "ibm,qpace-nwp-serial", | 168 | { .type = "serial", .compatible = "ibm,qpace-nwp-serial", |
168 | .data = (void *)PORT_NWPSERIAL, }, | 169 | .data = (void *)PORT_NWPSERIAL, }, |
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c index 22e30d21225..1bb8f1b4576 100644 --- a/drivers/serial/pnx8xxx_uart.c +++ b/drivers/serial/pnx8xxx_uart.c | |||
@@ -187,7 +187,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport) | |||
187 | status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | | 187 | status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | |
188 | ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT)); | 188 | ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT)); |
189 | while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) { | 189 | while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) { |
190 | ch = serial_in(sport, PNX8XXX_FIFO); | 190 | ch = serial_in(sport, PNX8XXX_FIFO) & 0xff; |
191 | 191 | ||
192 | sport->port.icount.rx++; | 192 | sport->port.icount.rx++; |
193 | 193 | ||
@@ -198,9 +198,16 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport) | |||
198 | * out of the main execution path | 198 | * out of the main execution path |
199 | */ | 199 | */ |
200 | if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE | | 200 | if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE | |
201 | PNX8XXX_UART_FIFO_RXPAR) | | 201 | PNX8XXX_UART_FIFO_RXPAR | |
202 | PNX8XXX_UART_FIFO_RXBRK) | | ||
202 | ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) { | 203 | ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) { |
203 | if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR)) | 204 | if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXBRK)) { |
205 | status &= ~(FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) | | ||
206 | FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR)); | ||
207 | sport->port.icount.brk++; | ||
208 | if (uart_handle_break(&sport->port)) | ||
209 | goto ignore_char; | ||
210 | } else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR)) | ||
204 | sport->port.icount.parity++; | 211 | sport->port.icount.parity++; |
205 | else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE)) | 212 | else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE)) |
206 | sport->port.icount.frame++; | 213 | sport->port.icount.frame++; |
@@ -284,14 +291,8 @@ static irqreturn_t pnx8xxx_int(int irq, void *dev_id) | |||
284 | /* Get the interrupts */ | 291 | /* Get the interrupts */ |
285 | status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN); | 292 | status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN); |
286 | 293 | ||
287 | /* Break signal received */ | 294 | /* Byte or break signal received */ |
288 | if (status & PNX8XXX_UART_INT_BREAK) { | 295 | if (status & (PNX8XXX_UART_INT_RX | PNX8XXX_UART_INT_BREAK)) |
289 | sport->port.icount.brk++; | ||
290 | uart_handle_break(&sport->port); | ||
291 | } | ||
292 | |||
293 | /* Byte received */ | ||
294 | if (status & PNX8XXX_UART_INT_RX) | ||
295 | pnx8xxx_rx_chars(sport); | 296 | pnx8xxx_rx_chars(sport); |
296 | 297 | ||
297 | /* TX holding register empty - transmit a byte */ | 298 | /* TX holding register empty - transmit a byte */ |
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 5e39bac9c51..56ff3e6864e 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
@@ -670,8 +670,7 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg) | |||
670 | dev_dbg(controller, "new message %p submitted for %s\n", | 670 | dev_dbg(controller, "new message %p submitted for %s\n", |
671 | msg, spi->dev.bus_id); | 671 | msg, spi->dev.bus_id); |
672 | 672 | ||
673 | if (unlikely(list_empty(&msg->transfers) | 673 | if (unlikely(list_empty(&msg->transfers))) |
674 | || !spi->max_speed_hz)) | ||
675 | return -EINVAL; | 674 | return -EINVAL; |
676 | 675 | ||
677 | if (as->stopping) | 676 | if (as->stopping) |
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index 68d6f4988fb..fe7e5f35e5d 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c | |||
@@ -15,12 +15,15 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | |||
19 | #include <linux/of_platform.h> | ||
20 | #include <linux/of_device.h> | ||
21 | #include <linux/of_spi.h> | ||
22 | |||
18 | #include <linux/spi/spi.h> | 23 | #include <linux/spi/spi.h> |
19 | #include <linux/spi/spi_bitbang.h> | 24 | #include <linux/spi/spi_bitbang.h> |
20 | #include <linux/io.h> | 25 | #include <linux/io.h> |
21 | 26 | ||
22 | #include <syslib/virtex_devices.h> | ||
23 | |||
24 | #define XILINX_SPI_NAME "xilinx_spi" | 27 | #define XILINX_SPI_NAME "xilinx_spi" |
25 | 28 | ||
26 | /* Register definitions as per "OPB Serial Peripheral Interface (SPI) (v1.00e) | 29 | /* Register definitions as per "OPB Serial Peripheral Interface (SPI) (v1.00e) |
@@ -144,23 +147,14 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi, | |||
144 | struct spi_transfer *t) | 147 | struct spi_transfer *t) |
145 | { | 148 | { |
146 | u8 bits_per_word; | 149 | u8 bits_per_word; |
147 | u32 hz; | ||
148 | struct xilinx_spi *xspi = spi_master_get_devdata(spi->master); | ||
149 | 150 | ||
150 | bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; | 151 | bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; |
151 | hz = (t) ? t->speed_hz : spi->max_speed_hz; | ||
152 | if (bits_per_word != 8) { | 152 | if (bits_per_word != 8) { |
153 | dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", | 153 | dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", |
154 | __func__, bits_per_word); | 154 | __func__, bits_per_word); |
155 | return -EINVAL; | 155 | return -EINVAL; |
156 | } | 156 | } |
157 | 157 | ||
158 | if (hz && xspi->speed_hz > hz) { | ||
159 | dev_err(&spi->dev, "%s, unsupported clock rate %uHz\n", | ||
160 | __func__, hz); | ||
161 | return -EINVAL; | ||
162 | } | ||
163 | |||
164 | return 0; | 158 | return 0; |
165 | } | 159 | } |
166 | 160 | ||
@@ -304,32 +298,38 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id) | |||
304 | return IRQ_HANDLED; | 298 | return IRQ_HANDLED; |
305 | } | 299 | } |
306 | 300 | ||
307 | static int __init xilinx_spi_probe(struct platform_device *dev) | 301 | static int __init xilinx_spi_of_probe(struct of_device *ofdev, |
302 | const struct of_device_id *match) | ||
308 | { | 303 | { |
309 | int ret = 0; | ||
310 | struct spi_master *master; | 304 | struct spi_master *master; |
311 | struct xilinx_spi *xspi; | 305 | struct xilinx_spi *xspi; |
312 | struct xspi_platform_data *pdata; | 306 | struct resource r_irq_struct; |
313 | struct resource *r; | 307 | struct resource r_mem_struct; |
308 | |||
309 | struct resource *r_irq = &r_irq_struct; | ||
310 | struct resource *r_mem = &r_mem_struct; | ||
311 | int rc = 0; | ||
312 | const u32 *prop; | ||
313 | int len; | ||
314 | 314 | ||
315 | /* Get resources(memory, IRQ) associated with the device */ | 315 | /* Get resources(memory, IRQ) associated with the device */ |
316 | master = spi_alloc_master(&dev->dev, sizeof(struct xilinx_spi)); | 316 | master = spi_alloc_master(&ofdev->dev, sizeof(struct xilinx_spi)); |
317 | 317 | ||
318 | if (master == NULL) { | 318 | if (master == NULL) { |
319 | return -ENOMEM; | 319 | return -ENOMEM; |
320 | } | 320 | } |
321 | 321 | ||
322 | platform_set_drvdata(dev, master); | 322 | dev_set_drvdata(&ofdev->dev, master); |
323 | pdata = dev->dev.platform_data; | ||
324 | 323 | ||
325 | if (pdata == NULL) { | 324 | rc = of_address_to_resource(ofdev->node, 0, r_mem); |
326 | ret = -ENODEV; | 325 | if (rc) { |
326 | dev_warn(&ofdev->dev, "invalid address\n"); | ||
327 | goto put_master; | 327 | goto put_master; |
328 | } | 328 | } |
329 | 329 | ||
330 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | 330 | rc = of_irq_to_resource(ofdev->node, 0, r_irq); |
331 | if (r == NULL) { | 331 | if (rc == NO_IRQ) { |
332 | ret = -ENODEV; | 332 | dev_warn(&ofdev->dev, "no IRQ found\n"); |
333 | goto put_master; | 333 | goto put_master; |
334 | } | 334 | } |
335 | 335 | ||
@@ -341,47 +341,57 @@ static int __init xilinx_spi_probe(struct platform_device *dev) | |||
341 | xspi->bitbang.master->setup = xilinx_spi_setup; | 341 | xspi->bitbang.master->setup = xilinx_spi_setup; |
342 | init_completion(&xspi->done); | 342 | init_completion(&xspi->done); |
343 | 343 | ||
344 | if (!request_mem_region(r->start, | 344 | xspi->irq = r_irq->start; |
345 | r->end - r->start + 1, XILINX_SPI_NAME)) { | 345 | |
346 | ret = -ENXIO; | 346 | if (!request_mem_region(r_mem->start, |
347 | r_mem->end - r_mem->start + 1, XILINX_SPI_NAME)) { | ||
348 | rc = -ENXIO; | ||
349 | dev_warn(&ofdev->dev, "memory request failure\n"); | ||
347 | goto put_master; | 350 | goto put_master; |
348 | } | 351 | } |
349 | 352 | ||
350 | xspi->regs = ioremap(r->start, r->end - r->start + 1); | 353 | xspi->regs = ioremap(r_mem->start, r_mem->end - r_mem->start + 1); |
351 | if (xspi->regs == NULL) { | 354 | if (xspi->regs == NULL) { |
352 | ret = -ENOMEM; | 355 | rc = -ENOMEM; |
356 | dev_warn(&ofdev->dev, "ioremap failure\n"); | ||
353 | goto put_master; | 357 | goto put_master; |
354 | } | 358 | } |
359 | xspi->irq = r_irq->start; | ||
355 | 360 | ||
356 | ret = platform_get_irq(dev, 0); | 361 | /* dynamic bus assignment */ |
357 | if (ret < 0) { | 362 | master->bus_num = -1; |
358 | ret = -ENXIO; | ||
359 | goto unmap_io; | ||
360 | } | ||
361 | xspi->irq = ret; | ||
362 | 363 | ||
363 | master->bus_num = pdata->bus_num; | 364 | /* number of slave select bits is required */ |
364 | master->num_chipselect = pdata->num_chipselect; | 365 | prop = of_get_property(ofdev->node, "xlnx,num-ss-bits", &len); |
365 | xspi->speed_hz = pdata->speed_hz; | 366 | if (!prop || len < sizeof(*prop)) { |
367 | dev_warn(&ofdev->dev, "no 'xlnx,num-ss-bits' property\n"); | ||
368 | goto put_master; | ||
369 | } | ||
370 | master->num_chipselect = *prop; | ||
366 | 371 | ||
367 | /* SPI controller initializations */ | 372 | /* SPI controller initializations */ |
368 | xspi_init_hw(xspi->regs); | 373 | xspi_init_hw(xspi->regs); |
369 | 374 | ||
370 | /* Register for SPI Interrupt */ | 375 | /* Register for SPI Interrupt */ |
371 | ret = request_irq(xspi->irq, xilinx_spi_irq, 0, XILINX_SPI_NAME, xspi); | 376 | rc = request_irq(xspi->irq, xilinx_spi_irq, 0, XILINX_SPI_NAME, xspi); |
372 | if (ret != 0) | 377 | if (rc != 0) { |
378 | dev_warn(&ofdev->dev, "irq request failure: %d\n", xspi->irq); | ||
373 | goto unmap_io; | 379 | goto unmap_io; |
380 | } | ||
374 | 381 | ||
375 | ret = spi_bitbang_start(&xspi->bitbang); | 382 | rc = spi_bitbang_start(&xspi->bitbang); |
376 | if (ret != 0) { | 383 | if (rc != 0) { |
377 | dev_err(&dev->dev, "spi_bitbang_start FAILED\n"); | 384 | dev_err(&ofdev->dev, "spi_bitbang_start FAILED\n"); |
378 | goto free_irq; | 385 | goto free_irq; |
379 | } | 386 | } |
380 | 387 | ||
381 | dev_info(&dev->dev, "at 0x%08X mapped to 0x%08X, irq=%d\n", | 388 | dev_info(&ofdev->dev, "at 0x%08X mapped to 0x%08X, irq=%d\n", |
382 | r->start, (u32)xspi->regs, xspi->irq); | 389 | (unsigned int)r_mem->start, (u32)xspi->regs, xspi->irq); |
383 | 390 | ||
384 | return ret; | 391 | /* Add any subnodes on the SPI bus */ |
392 | of_register_spi_devices(master, ofdev->node); | ||
393 | |||
394 | return rc; | ||
385 | 395 | ||
386 | free_irq: | 396 | free_irq: |
387 | free_irq(xspi->irq, xspi); | 397 | free_irq(xspi->irq, xspi); |
@@ -389,21 +399,21 @@ unmap_io: | |||
389 | iounmap(xspi->regs); | 399 | iounmap(xspi->regs); |
390 | put_master: | 400 | put_master: |
391 | spi_master_put(master); | 401 | spi_master_put(master); |
392 | return ret; | 402 | return rc; |
393 | } | 403 | } |
394 | 404 | ||
395 | static int __devexit xilinx_spi_remove(struct platform_device *dev) | 405 | static int __devexit xilinx_spi_remove(struct of_device *ofdev) |
396 | { | 406 | { |
397 | struct xilinx_spi *xspi; | 407 | struct xilinx_spi *xspi; |
398 | struct spi_master *master; | 408 | struct spi_master *master; |
399 | 409 | ||
400 | master = platform_get_drvdata(dev); | 410 | master = platform_get_drvdata(ofdev); |
401 | xspi = spi_master_get_devdata(master); | 411 | xspi = spi_master_get_devdata(master); |
402 | 412 | ||
403 | spi_bitbang_stop(&xspi->bitbang); | 413 | spi_bitbang_stop(&xspi->bitbang); |
404 | free_irq(xspi->irq, xspi); | 414 | free_irq(xspi->irq, xspi); |
405 | iounmap(xspi->regs); | 415 | iounmap(xspi->regs); |
406 | platform_set_drvdata(dev, 0); | 416 | dev_set_drvdata(&ofdev->dev, 0); |
407 | spi_master_put(xspi->bitbang.master); | 417 | spi_master_put(xspi->bitbang.master); |
408 | 418 | ||
409 | return 0; | 419 | return 0; |
@@ -412,27 +422,42 @@ static int __devexit xilinx_spi_remove(struct platform_device *dev) | |||
412 | /* work with hotplug and coldplug */ | 422 | /* work with hotplug and coldplug */ |
413 | MODULE_ALIAS("platform:" XILINX_SPI_NAME); | 423 | MODULE_ALIAS("platform:" XILINX_SPI_NAME); |
414 | 424 | ||
415 | static struct platform_driver xilinx_spi_driver = { | 425 | static int __exit xilinx_spi_of_remove(struct of_device *op) |
416 | .probe = xilinx_spi_probe, | 426 | { |
417 | .remove = __devexit_p(xilinx_spi_remove), | 427 | return xilinx_spi_remove(op); |
428 | } | ||
429 | |||
430 | static struct of_device_id xilinx_spi_of_match[] = { | ||
431 | { .compatible = "xlnx,xps-spi-2.00.a", }, | ||
432 | { .compatible = "xlnx,xps-spi-2.00.b", }, | ||
433 | {} | ||
434 | }; | ||
435 | |||
436 | MODULE_DEVICE_TABLE(of, xilinx_spi_of_match); | ||
437 | |||
438 | static struct of_platform_driver xilinx_spi_of_driver = { | ||
439 | .owner = THIS_MODULE, | ||
440 | .name = "xilinx-xps-spi", | ||
441 | .match_table = xilinx_spi_of_match, | ||
442 | .probe = xilinx_spi_of_probe, | ||
443 | .remove = __exit_p(xilinx_spi_of_remove), | ||
418 | .driver = { | 444 | .driver = { |
419 | .name = XILINX_SPI_NAME, | 445 | .name = "xilinx-xps-spi", |
420 | .owner = THIS_MODULE, | 446 | .owner = THIS_MODULE, |
421 | }, | 447 | }, |
422 | }; | 448 | }; |
423 | 449 | ||
424 | static int __init xilinx_spi_init(void) | 450 | static int __init xilinx_spi_init(void) |
425 | { | 451 | { |
426 | return platform_driver_register(&xilinx_spi_driver); | 452 | return of_register_platform_driver(&xilinx_spi_of_driver); |
427 | } | 453 | } |
428 | module_init(xilinx_spi_init); | 454 | module_init(xilinx_spi_init); |
429 | 455 | ||
430 | static void __exit xilinx_spi_exit(void) | 456 | static void __exit xilinx_spi_exit(void) |
431 | { | 457 | { |
432 | platform_driver_unregister(&xilinx_spi_driver); | 458 | of_unregister_platform_driver(&xilinx_spi_of_driver); |
433 | } | 459 | } |
434 | module_exit(xilinx_spi_exit); | 460 | module_exit(xilinx_spi_exit); |
435 | |||
436 | MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); | 461 | MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); |
437 | MODULE_DESCRIPTION("Xilinx SPI driver"); | 462 | MODULE_DESCRIPTION("Xilinx SPI driver"); |
438 | MODULE_LICENSE("GPL"); | 463 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index d5d0e40b1e2..94d5ee263c2 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1554,7 +1554,7 @@ static int usb_configure_device_otg(struct usb_device *udev) | |||
1554 | * (Includes HNP test device.) | 1554 | * (Includes HNP test device.) |
1555 | */ | 1555 | */ |
1556 | if (udev->bus->b_hnp_enable || udev->bus->is_b_host) { | 1556 | if (udev->bus->b_hnp_enable || udev->bus->is_b_host) { |
1557 | err = usb_port_suspend(udev); | 1557 | err = usb_port_suspend(udev, PMSG_SUSPEND); |
1558 | if (err < 0) | 1558 | if (err < 0) |
1559 | dev_dbg(&udev->dev, "HNP fail, %d\n", err); | 1559 | dev_dbg(&udev->dev, "HNP fail, %d\n", err); |
1560 | } | 1560 | } |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ef6cfa5a447..c70a8f667d8 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -2030,7 +2030,7 @@ static void ftdi_process_read(struct work_struct *work) | |||
2030 | spin_unlock_irqrestore(&priv->rx_lock, flags); | 2030 | spin_unlock_irqrestore(&priv->rx_lock, flags); |
2031 | dbg("%s - deferring remainder until unthrottled", | 2031 | dbg("%s - deferring remainder until unthrottled", |
2032 | __func__); | 2032 | __func__); |
2033 | return; | 2033 | goto out; |
2034 | } | 2034 | } |
2035 | spin_unlock_irqrestore(&priv->rx_lock, flags); | 2035 | spin_unlock_irqrestore(&priv->rx_lock, flags); |
2036 | /* if the port is closed stop trying to read */ | 2036 | /* if the port is closed stop trying to read */ |
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c index 7644ed24956..37e60b1d2ed 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/bf54x-lq043fb.c | |||
@@ -335,7 +335,20 @@ static int bfin_bf54x_fb_check_var(struct fb_var_screeninfo *var, | |||
335 | struct fb_info *info) | 335 | struct fb_info *info) |
336 | { | 336 | { |
337 | 337 | ||
338 | if (var->bits_per_pixel != LCD_BPP) { | 338 | switch (var->bits_per_pixel) { |
339 | case 24:/* TRUECOLOUR, 16m */ | ||
340 | var->red.offset = 16; | ||
341 | var->green.offset = 8; | ||
342 | var->blue.offset = 0; | ||
343 | var->red.length = var->green.length = var->blue.length = 8; | ||
344 | var->transp.offset = 0; | ||
345 | var->transp.length = 0; | ||
346 | var->transp.msb_right = 0; | ||
347 | var->red.msb_right = 0; | ||
348 | var->green.msb_right = 0; | ||
349 | var->blue.msb_right = 0; | ||
350 | break; | ||
351 | default: | ||
339 | pr_debug("%s: depth not supported: %u BPP\n", __func__, | 352 | pr_debug("%s: depth not supported: %u BPP\n", __func__, |
340 | var->bits_per_pixel); | 353 | var->bits_per_pixel); |
341 | return -EINVAL; | 354 | return -EINVAL; |
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c index a9b3ada05d9..2a423d3a2a8 100644 --- a/drivers/video/bfin-t350mcqb-fb.c +++ b/drivers/video/bfin-t350mcqb-fb.c | |||
@@ -254,7 +254,20 @@ static int bfin_t350mcqb_fb_check_var(struct fb_var_screeninfo *var, | |||
254 | struct fb_info *info) | 254 | struct fb_info *info) |
255 | { | 255 | { |
256 | 256 | ||
257 | if (var->bits_per_pixel != LCD_BPP) { | 257 | switch (var->bits_per_pixel) { |
258 | case 24:/* TRUECOLOUR, 16m */ | ||
259 | var->red.offset = 0; | ||
260 | var->green.offset = 8; | ||
261 | var->blue.offset = 16; | ||
262 | var->red.length = var->green.length = var->blue.length = 8; | ||
263 | var->transp.offset = 0; | ||
264 | var->transp.length = 0; | ||
265 | var->transp.msb_right = 0; | ||
266 | var->red.msb_right = 0; | ||
267 | var->green.msb_right = 0; | ||
268 | var->blue.msb_right = 0; | ||
269 | break; | ||
270 | default: | ||
258 | pr_debug("%s: depth not supported: %u BPP\n", __func__, | 271 | pr_debug("%s: depth not supported: %u BPP\n", __func__, |
259 | var->bits_per_pixel); | 272 | var->bits_per_pixel); |
260 | return -EINVAL; | 273 | return -EINVAL; |
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index 38ac805db97..87f826e4c95 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -1006,7 +1006,7 @@ static int ps3fb_xdr_settings(u64 xdr_lpar, struct device *dev) | |||
1006 | __func__, status); | 1006 | __func__, status); |
1007 | return -ENXIO; | 1007 | return -ENXIO; |
1008 | } | 1008 | } |
1009 | dev_dbg(dev, "video:%p ioif:%lx lpar:%lx size:%lx\n", | 1009 | dev_dbg(dev, "video:%p ioif:%lx lpar:%llx size:%lx\n", |
1010 | ps3fb_videomemory.address, GPU_IOIF, xdr_lpar, | 1010 | ps3fb_videomemory.address, GPU_IOIF, xdr_lpar, |
1011 | ps3fb_videomemory.size); | 1011 | ps3fb_videomemory.size); |
1012 | 1012 | ||
@@ -1133,7 +1133,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1133 | __func__, status); | 1133 | __func__, status); |
1134 | goto err; | 1134 | goto err; |
1135 | } | 1135 | } |
1136 | dev_dbg(&dev->core, "ddr:lpar:0x%lx\n", ddr_lpar); | 1136 | dev_dbg(&dev->core, "ddr:lpar:0x%llx\n", ddr_lpar); |
1137 | 1137 | ||
1138 | status = lv1_gpu_context_allocate(ps3fb.memory_handle, 0, | 1138 | status = lv1_gpu_context_allocate(ps3fb.memory_handle, 0, |
1139 | &ps3fb.context_handle, | 1139 | &ps3fb.context_handle, |