diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-12-07 16:35:17 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-12-07 16:35:17 -0500 |
commit | 21b4e736922f546e0f1aa7b9d6c442f309a2444a (patch) | |
tree | e1be8645297f8ebe87445251743ebcc52081a20d /drivers | |
parent | 34161db6b14d984fb9b06c735b7b42f8803f6851 (diff) | |
parent | 68380b581383c028830f79ec2670f4a193854aa6 (diff) |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/ into merge_linus
Diffstat (limited to 'drivers')
329 files changed, 7302 insertions, 3473 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 8816e30fb7a4..011c0a8a2dcc 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -2303,7 +2303,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, | |||
2303 | * DMA cycle timing is slower/equal than the fastest PIO timing. | 2303 | * DMA cycle timing is slower/equal than the fastest PIO timing. |
2304 | */ | 2304 | */ |
2305 | 2305 | ||
2306 | if (speed > XFER_PIO_4) { | 2306 | if (speed > XFER_PIO_6) { |
2307 | ata_timing_compute(adev, adev->pio_mode, &p, T, UT); | 2307 | ata_timing_compute(adev, adev->pio_mode, &p, T, UT); |
2308 | ata_timing_merge(&p, t, t, ATA_TIMING_ALL); | 2308 | ata_timing_merge(&p, t, t, ATA_TIMING_ALL); |
2309 | } | 2309 | } |
@@ -4960,6 +4960,7 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc) | |||
4960 | if (ap->flags & ATA_FLAG_PIO_POLLING) { | 4960 | if (ap->flags & ATA_FLAG_PIO_POLLING) { |
4961 | switch (qc->tf.protocol) { | 4961 | switch (qc->tf.protocol) { |
4962 | case ATA_PROT_PIO: | 4962 | case ATA_PROT_PIO: |
4963 | case ATA_PROT_NODATA: | ||
4963 | case ATA_PROT_ATAPI: | 4964 | case ATA_PROT_ATAPI: |
4964 | case ATA_PROT_ATAPI_NODATA: | 4965 | case ATA_PROT_ATAPI_NODATA: |
4965 | qc->tf.flags |= ATA_TFLAG_POLLING; | 4966 | qc->tf.flags |= ATA_TFLAG_POLLING; |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index a2778cf016bc..f055874a6ec5 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -66,15 +66,17 @@ enum { | |||
66 | board_2037x = 0, /* FastTrak S150 TX2plus */ | 66 | board_2037x = 0, /* FastTrak S150 TX2plus */ |
67 | board_20319 = 1, /* FastTrak S150 TX4 */ | 67 | board_20319 = 1, /* FastTrak S150 TX4 */ |
68 | board_20619 = 2, /* FastTrak TX4000 */ | 68 | board_20619 = 2, /* FastTrak TX4000 */ |
69 | board_20771 = 3, /* FastTrak TX2300 */ | 69 | board_2057x = 3, /* SATAII150 Tx2plus */ |
70 | board_2057x = 4, /* SATAII150 Tx2plus */ | 70 | board_40518 = 4, /* SATAII150 Tx4 */ |
71 | board_40518 = 5, /* SATAII150 Tx4 */ | ||
72 | 71 | ||
73 | PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */ | 72 | PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */ |
74 | 73 | ||
74 | /* PDC_CTLSTAT bit definitions */ | ||
75 | PDC_DMA_ENABLE = (1 << 7), | ||
76 | PDC_IRQ_DISABLE = (1 << 10), | ||
75 | PDC_RESET = (1 << 11), /* HDMA reset */ | 77 | PDC_RESET = (1 << 11), /* HDMA reset */ |
76 | 78 | ||
77 | PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | | 79 | PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | |
78 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | | 80 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | |
79 | ATA_FLAG_PIO_POLLING, | 81 | ATA_FLAG_PIO_POLLING, |
80 | 82 | ||
@@ -90,7 +92,6 @@ struct pdc_port_priv { | |||
90 | 92 | ||
91 | struct pdc_host_priv { | 93 | struct pdc_host_priv { |
92 | unsigned long flags; | 94 | unsigned long flags; |
93 | int hotplug_offset; | ||
94 | }; | 95 | }; |
95 | 96 | ||
96 | static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg); | 97 | static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg); |
@@ -101,13 +102,16 @@ static void pdc_eng_timeout(struct ata_port *ap); | |||
101 | static int pdc_port_start(struct ata_port *ap); | 102 | static int pdc_port_start(struct ata_port *ap); |
102 | static void pdc_port_stop(struct ata_port *ap); | 103 | static void pdc_port_stop(struct ata_port *ap); |
103 | static void pdc_pata_phy_reset(struct ata_port *ap); | 104 | static void pdc_pata_phy_reset(struct ata_port *ap); |
104 | static void pdc_sata_phy_reset(struct ata_port *ap); | ||
105 | static void pdc_qc_prep(struct ata_queued_cmd *qc); | 105 | static void pdc_qc_prep(struct ata_queued_cmd *qc); |
106 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); | 106 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
107 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); | 107 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
108 | static void pdc_irq_clear(struct ata_port *ap); | 108 | static void pdc_irq_clear(struct ata_port *ap); |
109 | static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); | 109 | static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); |
110 | static void pdc_host_stop(struct ata_host *host); | 110 | static void pdc_host_stop(struct ata_host *host); |
111 | static void pdc_freeze(struct ata_port *ap); | ||
112 | static void pdc_thaw(struct ata_port *ap); | ||
113 | static void pdc_error_handler(struct ata_port *ap); | ||
114 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); | ||
111 | 115 | ||
112 | 116 | ||
113 | static struct scsi_host_template pdc_ata_sht = { | 117 | static struct scsi_host_template pdc_ata_sht = { |
@@ -136,11 +140,12 @@ static const struct ata_port_operations pdc_sata_ops = { | |||
136 | .exec_command = pdc_exec_command_mmio, | 140 | .exec_command = pdc_exec_command_mmio, |
137 | .dev_select = ata_std_dev_select, | 141 | .dev_select = ata_std_dev_select, |
138 | 142 | ||
139 | .phy_reset = pdc_sata_phy_reset, | ||
140 | |||
141 | .qc_prep = pdc_qc_prep, | 143 | .qc_prep = pdc_qc_prep, |
142 | .qc_issue = pdc_qc_issue_prot, | 144 | .qc_issue = pdc_qc_issue_prot, |
143 | .eng_timeout = pdc_eng_timeout, | 145 | .freeze = pdc_freeze, |
146 | .thaw = pdc_thaw, | ||
147 | .error_handler = pdc_error_handler, | ||
148 | .post_internal_cmd = pdc_post_internal_cmd, | ||
144 | .data_xfer = ata_mmio_data_xfer, | 149 | .data_xfer = ata_mmio_data_xfer, |
145 | .irq_handler = pdc_interrupt, | 150 | .irq_handler = pdc_interrupt, |
146 | .irq_clear = pdc_irq_clear, | 151 | .irq_clear = pdc_irq_clear, |
@@ -198,23 +203,13 @@ static const struct ata_port_info pdc_port_info[] = { | |||
198 | /* board_20619 */ | 203 | /* board_20619 */ |
199 | { | 204 | { |
200 | .sht = &pdc_ata_sht, | 205 | .sht = &pdc_ata_sht, |
201 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS, | 206 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SRST | ATA_FLAG_SLAVE_POSS, |
202 | .pio_mask = 0x1f, /* pio0-4 */ | 207 | .pio_mask = 0x1f, /* pio0-4 */ |
203 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 208 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
204 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | 209 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ |
205 | .port_ops = &pdc_pata_ops, | 210 | .port_ops = &pdc_pata_ops, |
206 | }, | 211 | }, |
207 | 212 | ||
208 | /* board_20771 */ | ||
209 | { | ||
210 | .sht = &pdc_ata_sht, | ||
211 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, | ||
212 | .pio_mask = 0x1f, /* pio0-4 */ | ||
213 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
214 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | ||
215 | .port_ops = &pdc_sata_ops, | ||
216 | }, | ||
217 | |||
218 | /* board_2057x */ | 213 | /* board_2057x */ |
219 | { | 214 | { |
220 | .sht = &pdc_ata_sht, | 215 | .sht = &pdc_ata_sht, |
@@ -244,6 +239,7 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = { | |||
244 | { PCI_VDEVICE(PROMISE, 0x3570), board_2057x }, | 239 | { PCI_VDEVICE(PROMISE, 0x3570), board_2057x }, |
245 | { PCI_VDEVICE(PROMISE, 0x3571), board_2057x }, | 240 | { PCI_VDEVICE(PROMISE, 0x3571), board_2057x }, |
246 | { PCI_VDEVICE(PROMISE, 0x3574), board_2057x }, | 241 | { PCI_VDEVICE(PROMISE, 0x3574), board_2057x }, |
242 | { PCI_VDEVICE(PROMISE, 0x3577), board_2057x }, | ||
247 | { PCI_VDEVICE(PROMISE, 0x3d73), board_2057x }, | 243 | { PCI_VDEVICE(PROMISE, 0x3d73), board_2057x }, |
248 | { PCI_VDEVICE(PROMISE, 0x3d75), board_2057x }, | 244 | { PCI_VDEVICE(PROMISE, 0x3d75), board_2057x }, |
249 | 245 | ||
@@ -256,15 +252,6 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = { | |||
256 | 252 | ||
257 | { PCI_VDEVICE(PROMISE, 0x6629), board_20619 }, | 253 | { PCI_VDEVICE(PROMISE, 0x6629), board_20619 }, |
258 | 254 | ||
259 | /* TODO: remove all associated board_20771 code, as it completely | ||
260 | * duplicates board_2037x code, unless reason for separation can be | ||
261 | * divined. | ||
262 | */ | ||
263 | #if 0 | ||
264 | { PCI_VDEVICE(PROMISE, 0x3570), board_20771 }, | ||
265 | #endif | ||
266 | { PCI_VDEVICE(PROMISE, 0x3577), board_20771 }, | ||
267 | |||
268 | { } /* terminate list */ | 255 | { } /* terminate list */ |
269 | }; | 256 | }; |
270 | 257 | ||
@@ -366,12 +353,6 @@ static void pdc_reset_port(struct ata_port *ap) | |||
366 | readl(mmio); /* flush */ | 353 | readl(mmio); /* flush */ |
367 | } | 354 | } |
368 | 355 | ||
369 | static void pdc_sata_phy_reset(struct ata_port *ap) | ||
370 | { | ||
371 | pdc_reset_port(ap); | ||
372 | sata_phy_reset(ap); | ||
373 | } | ||
374 | |||
375 | static void pdc_pata_cbl_detect(struct ata_port *ap) | 356 | static void pdc_pata_cbl_detect(struct ata_port *ap) |
376 | { | 357 | { |
377 | u8 tmp; | 358 | u8 tmp; |
@@ -439,6 +420,61 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc) | |||
439 | } | 420 | } |
440 | } | 421 | } |
441 | 422 | ||
423 | static void pdc_freeze(struct ata_port *ap) | ||
424 | { | ||
425 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr; | ||
426 | u32 tmp; | ||
427 | |||
428 | tmp = readl(mmio + PDC_CTLSTAT); | ||
429 | tmp |= PDC_IRQ_DISABLE; | ||
430 | tmp &= ~PDC_DMA_ENABLE; | ||
431 | writel(tmp, mmio + PDC_CTLSTAT); | ||
432 | readl(mmio + PDC_CTLSTAT); /* flush */ | ||
433 | } | ||
434 | |||
435 | static void pdc_thaw(struct ata_port *ap) | ||
436 | { | ||
437 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr; | ||
438 | u32 tmp; | ||
439 | |||
440 | /* clear IRQ */ | ||
441 | readl(mmio + PDC_INT_SEQMASK); | ||
442 | |||
443 | /* turn IRQ back on */ | ||
444 | tmp = readl(mmio + PDC_CTLSTAT); | ||
445 | tmp &= ~PDC_IRQ_DISABLE; | ||
446 | writel(tmp, mmio + PDC_CTLSTAT); | ||
447 | readl(mmio + PDC_CTLSTAT); /* flush */ | ||
448 | } | ||
449 | |||
450 | static void pdc_error_handler(struct ata_port *ap) | ||
451 | { | ||
452 | ata_reset_fn_t hardreset; | ||
453 | |||
454 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) | ||
455 | pdc_reset_port(ap); | ||
456 | |||
457 | hardreset = NULL; | ||
458 | if (sata_scr_valid(ap)) | ||
459 | hardreset = sata_std_hardreset; | ||
460 | |||
461 | /* perform recovery */ | ||
462 | ata_do_eh(ap, ata_std_prereset, ata_std_softreset, hardreset, | ||
463 | ata_std_postreset); | ||
464 | } | ||
465 | |||
466 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc) | ||
467 | { | ||
468 | struct ata_port *ap = qc->ap; | ||
469 | |||
470 | if (qc->flags & ATA_QCFLAG_FAILED) | ||
471 | qc->err_mask |= AC_ERR_OTHER; | ||
472 | |||
473 | /* make DMA engine forget about the failed command */ | ||
474 | if (qc->err_mask) | ||
475 | pdc_reset_port(ap); | ||
476 | } | ||
477 | |||
442 | static void pdc_eng_timeout(struct ata_port *ap) | 478 | static void pdc_eng_timeout(struct ata_port *ap) |
443 | { | 479 | { |
444 | struct ata_host *host = ap->host; | 480 | struct ata_host *host = ap->host; |
@@ -645,9 +681,14 @@ static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe) | |||
645 | { | 681 | { |
646 | void __iomem *mmio = pe->mmio_base; | 682 | void __iomem *mmio = pe->mmio_base; |
647 | struct pdc_host_priv *hp = pe->private_data; | 683 | struct pdc_host_priv *hp = pe->private_data; |
648 | int hotplug_offset = hp->hotplug_offset; | 684 | int hotplug_offset; |
649 | u32 tmp; | 685 | u32 tmp; |
650 | 686 | ||
687 | if (hp->flags & PDC_FLAG_GEN_II) | ||
688 | hotplug_offset = PDC2_SATA_PLUG_CSR; | ||
689 | else | ||
690 | hotplug_offset = PDC_SATA_PLUG_CSR; | ||
691 | |||
651 | /* | 692 | /* |
652 | * Except for the hotplug stuff, this is voodoo from the | 693 | * Except for the hotplug stuff, this is voodoo from the |
653 | * Promise driver. Label this entire section | 694 | * Promise driver. Label this entire section |
@@ -742,8 +783,6 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
742 | goto err_out_free_ent; | 783 | goto err_out_free_ent; |
743 | } | 784 | } |
744 | 785 | ||
745 | /* Set default hotplug offset */ | ||
746 | hp->hotplug_offset = PDC_SATA_PLUG_CSR; | ||
747 | probe_ent->private_data = hp; | 786 | probe_ent->private_data = hp; |
748 | 787 | ||
749 | probe_ent->sht = pdc_port_info[board_idx].sht; | 788 | probe_ent->sht = pdc_port_info[board_idx].sht; |
@@ -767,8 +806,6 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
767 | switch (board_idx) { | 806 | switch (board_idx) { |
768 | case board_40518: | 807 | case board_40518: |
769 | hp->flags |= PDC_FLAG_GEN_II; | 808 | hp->flags |= PDC_FLAG_GEN_II; |
770 | /* Override hotplug offset for SATAII150 */ | ||
771 | hp->hotplug_offset = PDC2_SATA_PLUG_CSR; | ||
772 | /* Fall through */ | 809 | /* Fall through */ |
773 | case board_20319: | 810 | case board_20319: |
774 | probe_ent->n_ports = 4; | 811 | probe_ent->n_ports = 4; |
@@ -780,10 +817,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
780 | probe_ent->port[3].scr_addr = base + 0x700; | 817 | probe_ent->port[3].scr_addr = base + 0x700; |
781 | break; | 818 | break; |
782 | case board_2057x: | 819 | case board_2057x: |
783 | case board_20771: | ||
784 | hp->flags |= PDC_FLAG_GEN_II; | 820 | hp->flags |= PDC_FLAG_GEN_II; |
785 | /* Override hotplug offset for SATAII150 */ | ||
786 | hp->hotplug_offset = PDC2_SATA_PLUG_CSR; | ||
787 | /* Fall through */ | 821 | /* Fall through */ |
788 | case board_2037x: | 822 | case board_2037x: |
789 | probe_ent->n_ports = 2; | 823 | probe_ent->n_ports = 2; |
diff --git a/drivers/atm/Makefile b/drivers/atm/Makefile index b5077ce8cb40..1b16f8166b09 100644 --- a/drivers/atm/Makefile +++ b/drivers/atm/Makefile | |||
@@ -41,7 +41,7 @@ ifeq ($(CONFIG_ATM_FORE200E_PCA),y) | |||
41 | # guess the target endianess to choose the right PCA-200E firmware image | 41 | # guess the target endianess to choose the right PCA-200E firmware image |
42 | ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y) | 42 | ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y) |
43 | byteorder.h := include$(if $(patsubst $(srctree),,$(objtree)),2)/asm/byteorder.h | 43 | byteorder.h := include$(if $(patsubst $(srctree),,$(objtree)),2)/asm/byteorder.h |
44 | CONFIG_ATM_FORE200E_PCA_FW := $(obj)/pca200e$(if $(shell $(CC) -E -dM $(byteorder.h) | grep ' __LITTLE_ENDIAN '),.bin,_ecd.bin2) | 44 | CONFIG_ATM_FORE200E_PCA_FW := $(obj)/pca200e$(if $(shell $(CC) $(CPPFLAGS) -E -dM $(byteorder.h) | grep ' __LITTLE_ENDIAN '),.bin,_ecd.bin2) |
45 | endif | 45 | endif |
46 | endif | 46 | endif |
47 | 47 | ||
diff --git a/drivers/atm/he.c b/drivers/atm/he.c index c7314a79da0f..7d9b4e52f0bf 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c | |||
@@ -820,7 +820,7 @@ he_init_group(struct he_dev *he_dev, int group) | |||
820 | void *cpuaddr; | 820 | void *cpuaddr; |
821 | 821 | ||
822 | #ifdef USE_RBPS_POOL | 822 | #ifdef USE_RBPS_POOL |
823 | cpuaddr = pci_pool_alloc(he_dev->rbps_pool, SLAB_KERNEL|SLAB_DMA, &dma_handle); | 823 | cpuaddr = pci_pool_alloc(he_dev->rbps_pool, GFP_KERNEL|GFP_DMA, &dma_handle); |
824 | if (cpuaddr == NULL) | 824 | if (cpuaddr == NULL) |
825 | return -ENOMEM; | 825 | return -ENOMEM; |
826 | #else | 826 | #else |
@@ -884,7 +884,7 @@ he_init_group(struct he_dev *he_dev, int group) | |||
884 | void *cpuaddr; | 884 | void *cpuaddr; |
885 | 885 | ||
886 | #ifdef USE_RBPL_POOL | 886 | #ifdef USE_RBPL_POOL |
887 | cpuaddr = pci_pool_alloc(he_dev->rbpl_pool, SLAB_KERNEL|SLAB_DMA, &dma_handle); | 887 | cpuaddr = pci_pool_alloc(he_dev->rbpl_pool, GFP_KERNEL|GFP_DMA, &dma_handle); |
888 | if (cpuaddr == NULL) | 888 | if (cpuaddr == NULL) |
889 | return -ENOMEM; | 889 | return -ENOMEM; |
890 | #else | 890 | #else |
@@ -1724,7 +1724,7 @@ __alloc_tpd(struct he_dev *he_dev) | |||
1724 | struct he_tpd *tpd; | 1724 | struct he_tpd *tpd; |
1725 | dma_addr_t dma_handle; | 1725 | dma_addr_t dma_handle; |
1726 | 1726 | ||
1727 | tpd = pci_pool_alloc(he_dev->tpd_pool, SLAB_ATOMIC|SLAB_DMA, &dma_handle); | 1727 | tpd = pci_pool_alloc(he_dev->tpd_pool, GFP_ATOMIC|GFP_DMA, &dma_handle); |
1728 | if (tpd == NULL) | 1728 | if (tpd == NULL) |
1729 | return NULL; | 1729 | return NULL; |
1730 | 1730 | ||
diff --git a/drivers/base/core.c b/drivers/base/core.c index e4b530ef757d..67b79a7592a9 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -386,6 +386,7 @@ void device_initialize(struct device *dev) | |||
386 | INIT_LIST_HEAD(&dev->node); | 386 | INIT_LIST_HEAD(&dev->node); |
387 | init_MUTEX(&dev->sem); | 387 | init_MUTEX(&dev->sem); |
388 | device_init_wakeup(dev, 0); | 388 | device_init_wakeup(dev, 0); |
389 | set_dev_node(dev, -1); | ||
389 | } | 390 | } |
390 | 391 | ||
391 | #ifdef CONFIG_SYSFS_DEPRECATED | 392 | #ifdef CONFIG_SYSFS_DEPRECATED |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 1f745f12f94e..7fd095efaebd 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -104,8 +104,8 @@ static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL); | |||
104 | 104 | ||
105 | /* | 105 | /* |
106 | * register_cpu - Setup a driverfs device for a CPU. | 106 | * register_cpu - Setup a driverfs device for a CPU. |
107 | * @cpu - Callers can set the cpu->no_control field to 1, to indicate not to | 107 | * @cpu - cpu->hotpluggable field set to 1 will generate a control file in |
108 | * generate a control file in sysfs for this CPU. | 108 | * sysfs for this CPU. |
109 | * @num - CPU number to use when creating the device. | 109 | * @num - CPU number to use when creating the device. |
110 | * | 110 | * |
111 | * Initialize and register the CPU device. | 111 | * Initialize and register the CPU device. |
@@ -119,7 +119,7 @@ int __devinit register_cpu(struct cpu *cpu, int num) | |||
119 | 119 | ||
120 | error = sysdev_register(&cpu->sysdev); | 120 | error = sysdev_register(&cpu->sysdev); |
121 | 121 | ||
122 | if (!error && !cpu->no_control) | 122 | if (!error && cpu->hotpluggable) |
123 | register_cpu_control(cpu); | 123 | register_cpu_control(cpu); |
124 | if (!error) | 124 | if (!error) |
125 | cpu_sys_devices[num] = &cpu->sysdev; | 125 | cpu_sys_devices[num] = &cpu->sysdev; |
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c index b2efbd4cf710..dbe0735f8c9e 100644 --- a/drivers/base/dmapool.c +++ b/drivers/base/dmapool.c | |||
@@ -126,7 +126,7 @@ dma_pool_create (const char *name, struct device *dev, | |||
126 | } else if (allocation < size) | 126 | } else if (allocation < size) |
127 | return NULL; | 127 | return NULL; |
128 | 128 | ||
129 | if (!(retval = kmalloc (sizeof *retval, SLAB_KERNEL))) | 129 | if (!(retval = kmalloc (sizeof *retval, GFP_KERNEL))) |
130 | return retval; | 130 | return retval; |
131 | 131 | ||
132 | strlcpy (retval->name, name, sizeof retval->name); | 132 | strlcpy (retval->name, name, sizeof retval->name); |
@@ -297,7 +297,7 @@ restart: | |||
297 | } | 297 | } |
298 | } | 298 | } |
299 | } | 299 | } |
300 | if (!(page = pool_alloc_page (pool, SLAB_ATOMIC))) { | 300 | if (!(page = pool_alloc_page (pool, GFP_ATOMIC))) { |
301 | if (mem_flags & __GFP_WAIT) { | 301 | if (mem_flags & __GFP_WAIT) { |
302 | DECLARE_WAITQUEUE (wait, current); | 302 | DECLARE_WAITQUEUE (wait, current); |
303 | 303 | ||
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index c6b7d9c4b651..74b96795d2f5 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -290,9 +290,8 @@ static CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); | |||
290 | 290 | ||
291 | static int block_size_init(void) | 291 | static int block_size_init(void) |
292 | { | 292 | { |
293 | sysfs_create_file(&memory_sysdev_class.kset.kobj, | 293 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, |
294 | &class_attr_block_size_bytes.attr); | 294 | &class_attr_block_size_bytes.attr); |
295 | return 0; | ||
296 | } | 295 | } |
297 | 296 | ||
298 | /* | 297 | /* |
@@ -323,12 +322,14 @@ static CLASS_ATTR(probe, 0700, NULL, memory_probe_store); | |||
323 | 322 | ||
324 | static int memory_probe_init(void) | 323 | static int memory_probe_init(void) |
325 | { | 324 | { |
326 | sysfs_create_file(&memory_sysdev_class.kset.kobj, | 325 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, |
327 | &class_attr_probe.attr); | 326 | &class_attr_probe.attr); |
328 | return 0; | ||
329 | } | 327 | } |
330 | #else | 328 | #else |
331 | #define memory_probe_init(...) do {} while (0) | 329 | static inline int memory_probe_init(void) |
330 | { | ||
331 | return 0; | ||
332 | } | ||
332 | #endif | 333 | #endif |
333 | 334 | ||
334 | /* | 335 | /* |
@@ -431,9 +432,12 @@ int __init memory_dev_init(void) | |||
431 | { | 432 | { |
432 | unsigned int i; | 433 | unsigned int i; |
433 | int ret; | 434 | int ret; |
435 | int err; | ||
434 | 436 | ||
435 | memory_sysdev_class.kset.uevent_ops = &memory_uevent_ops; | 437 | memory_sysdev_class.kset.uevent_ops = &memory_uevent_ops; |
436 | ret = sysdev_class_register(&memory_sysdev_class); | 438 | ret = sysdev_class_register(&memory_sysdev_class); |
439 | if (ret) | ||
440 | goto out; | ||
437 | 441 | ||
438 | /* | 442 | /* |
439 | * Create entries for memory sections that were found | 443 | * Create entries for memory sections that were found |
@@ -442,11 +446,19 @@ int __init memory_dev_init(void) | |||
442 | for (i = 0; i < NR_MEM_SECTIONS; i++) { | 446 | for (i = 0; i < NR_MEM_SECTIONS; i++) { |
443 | if (!valid_section_nr(i)) | 447 | if (!valid_section_nr(i)) |
444 | continue; | 448 | continue; |
445 | add_memory_block(0, __nr_to_section(i), MEM_ONLINE, 0); | 449 | err = add_memory_block(0, __nr_to_section(i), MEM_ONLINE, 0); |
450 | if (!ret) | ||
451 | ret = err; | ||
446 | } | 452 | } |
447 | 453 | ||
448 | memory_probe_init(); | 454 | err = memory_probe_init(); |
449 | block_size_init(); | 455 | if (!ret) |
450 | 456 | ret = err; | |
457 | err = block_size_init(); | ||
458 | if (!ret) | ||
459 | ret = err; | ||
460 | out: | ||
461 | if (ret) | ||
462 | printk(KERN_ERR "%s() failed: %d\n", __FUNCTION__, ret); | ||
451 | return ret; | 463 | return ret; |
452 | } | 464 | } |
diff --git a/drivers/base/topology.c b/drivers/base/topology.c index 3d12b85b0962..067a9e8bc377 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c | |||
@@ -108,7 +108,6 @@ static int __cpuinit topology_add_dev(unsigned int cpu) | |||
108 | return rc; | 108 | return rc; |
109 | } | 109 | } |
110 | 110 | ||
111 | #ifdef CONFIG_HOTPLUG_CPU | ||
112 | static void __cpuinit topology_remove_dev(unsigned int cpu) | 111 | static void __cpuinit topology_remove_dev(unsigned int cpu) |
113 | { | 112 | { |
114 | struct sys_device *sys_dev = get_cpu_sysdev(cpu); | 113 | struct sys_device *sys_dev = get_cpu_sysdev(cpu); |
@@ -136,7 +135,6 @@ static int __cpuinit topology_cpu_callback(struct notifier_block *nfb, | |||
136 | } | 135 | } |
137 | return rc ? NOTIFY_BAD : NOTIFY_OK; | 136 | return rc ? NOTIFY_BAD : NOTIFY_OK; |
138 | } | 137 | } |
139 | #endif | ||
140 | 138 | ||
141 | static int __cpuinit topology_sysfs_init(void) | 139 | static int __cpuinit topology_sysfs_init(void) |
142 | { | 140 | { |
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 742d07403101..8d81a3a64c07 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -324,13 +324,13 @@ static boolean DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller) | |||
324 | Command->Next = Controller->FreeCommands; | 324 | Command->Next = Controller->FreeCommands; |
325 | Controller->FreeCommands = Command; | 325 | Controller->FreeCommands = Command; |
326 | Controller->Commands[CommandIdentifier-1] = Command; | 326 | Controller->Commands[CommandIdentifier-1] = Command; |
327 | ScatterGatherCPU = pci_pool_alloc(ScatterGatherPool, SLAB_ATOMIC, | 327 | ScatterGatherCPU = pci_pool_alloc(ScatterGatherPool, GFP_ATOMIC, |
328 | &ScatterGatherDMA); | 328 | &ScatterGatherDMA); |
329 | if (ScatterGatherCPU == NULL) | 329 | if (ScatterGatherCPU == NULL) |
330 | return DAC960_Failure(Controller, "AUXILIARY STRUCTURE CREATION"); | 330 | return DAC960_Failure(Controller, "AUXILIARY STRUCTURE CREATION"); |
331 | 331 | ||
332 | if (RequestSensePool != NULL) { | 332 | if (RequestSensePool != NULL) { |
333 | RequestSenseCPU = pci_pool_alloc(RequestSensePool, SLAB_ATOMIC, | 333 | RequestSenseCPU = pci_pool_alloc(RequestSensePool, GFP_ATOMIC, |
334 | &RequestSenseDMA); | 334 | &RequestSenseDMA); |
335 | if (RequestSenseCPU == NULL) { | 335 | if (RequestSenseCPU == NULL) { |
336 | pci_pool_free(ScatterGatherPool, ScatterGatherCPU, | 336 | pci_pool_free(ScatterGatherPool, ScatterGatherCPU, |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 17dc22282e14..85072446d772 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -168,7 +168,8 @@ config BLK_CPQ_CISS_DA | |||
168 | 168 | ||
169 | config CISS_SCSI_TAPE | 169 | config CISS_SCSI_TAPE |
170 | bool "SCSI tape drive support for Smart Array 5xxx" | 170 | bool "SCSI tape drive support for Smart Array 5xxx" |
171 | depends on BLK_CPQ_CISS_DA && SCSI && PROC_FS | 171 | depends on BLK_CPQ_CISS_DA && PROC_FS |
172 | depends on SCSI=y || SCSI=BLK_CPQ_CISS_DA | ||
172 | help | 173 | help |
173 | When enabled (Y), this option allows SCSI tape drives and SCSI medium | 174 | When enabled (Y), this option allows SCSI tape drives and SCSI medium |
174 | changers (tape robots) to be accessed via a Compaq 5xxx array | 175 | changers (tape robots) to be accessed via a Compaq 5xxx array |
@@ -305,6 +306,7 @@ config BLK_DEV_LOOP | |||
305 | config BLK_DEV_CRYPTOLOOP | 306 | config BLK_DEV_CRYPTOLOOP |
306 | tristate "Cryptoloop Support" | 307 | tristate "Cryptoloop Support" |
307 | select CRYPTO | 308 | select CRYPTO |
309 | select CRYPTO_CBC | ||
308 | depends on BLK_DEV_LOOP | 310 | depends on BLK_DEV_LOOP |
309 | ---help--- | 311 | ---help--- |
310 | Say Y here if you want to be able to use the ciphers that are | 312 | Say Y here if you want to be able to use the ciphers that are |
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c index aa25f8b09fe3..478489c568a4 100644 --- a/drivers/block/aoe/aoeblk.c +++ b/drivers/block/aoe/aoeblk.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/netdevice.h> | 12 | #include <linux/netdevice.h> |
13 | #include "aoe.h" | 13 | #include "aoe.h" |
14 | 14 | ||
15 | static kmem_cache_t *buf_pool_cache; | 15 | static struct kmem_cache *buf_pool_cache; |
16 | 16 | ||
17 | static ssize_t aoedisk_show_state(struct gendisk * disk, char *page) | 17 | static ssize_t aoedisk_show_state(struct gendisk * disk, char *page) |
18 | { | 18 | { |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 4105c3bf3476..892e092afe9a 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -47,14 +47,15 @@ | |||
47 | #include <linux/completion.h> | 47 | #include <linux/completion.h> |
48 | 48 | ||
49 | #define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) | 49 | #define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) |
50 | #define DRIVER_NAME "HP CISS Driver (v 3.6.10)" | 50 | #define DRIVER_NAME "HP CISS Driver (v 3.6.14)" |
51 | #define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,10) | 51 | #define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,14) |
52 | 52 | ||
53 | /* Embedded module documentation macros - see modules.h */ | 53 | /* Embedded module documentation macros - see modules.h */ |
54 | MODULE_AUTHOR("Hewlett-Packard Company"); | 54 | MODULE_AUTHOR("Hewlett-Packard Company"); |
55 | MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 3.6.10"); | 55 | MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 3.6.14"); |
56 | MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400" | 56 | MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400" |
57 | " SA6i P600 P800 P400 P400i E200 E200i E500"); | 57 | " SA6i P600 P800 P400 P400i E200 E200i E500"); |
58 | MODULE_VERSION("3.6.14"); | ||
58 | MODULE_LICENSE("GPL"); | 59 | MODULE_LICENSE("GPL"); |
59 | 60 | ||
60 | #include "cciss_cmd.h" | 61 | #include "cciss_cmd.h" |
@@ -81,7 +82,9 @@ static const struct pci_device_id cciss_pci_device_id[] = { | |||
81 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3213}, | 82 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3213}, |
82 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3214}, | 83 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3214}, |
83 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215}, | 84 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215}, |
84 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3233}, | 85 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3237}, |
86 | {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | ||
87 | PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, | ||
85 | {0,} | 88 | {0,} |
86 | }; | 89 | }; |
87 | 90 | ||
@@ -90,27 +93,29 @@ MODULE_DEVICE_TABLE(pci, cciss_pci_device_id); | |||
90 | /* board_id = Subsystem Device ID & Vendor ID | 93 | /* board_id = Subsystem Device ID & Vendor ID |
91 | * product = Marketing Name for the board | 94 | * product = Marketing Name for the board |
92 | * access = Address of the struct of function pointers | 95 | * access = Address of the struct of function pointers |
96 | * nr_cmds = Number of commands supported by controller | ||
93 | */ | 97 | */ |
94 | static struct board_type products[] = { | 98 | static struct board_type products[] = { |
95 | {0x40700E11, "Smart Array 5300", &SA5_access}, | 99 | {0x40700E11, "Smart Array 5300", &SA5_access, 512}, |
96 | {0x40800E11, "Smart Array 5i", &SA5B_access}, | 100 | {0x40800E11, "Smart Array 5i", &SA5B_access, 512}, |
97 | {0x40820E11, "Smart Array 532", &SA5B_access}, | 101 | {0x40820E11, "Smart Array 532", &SA5B_access, 512}, |
98 | {0x40830E11, "Smart Array 5312", &SA5B_access}, | 102 | {0x40830E11, "Smart Array 5312", &SA5B_access, 512}, |
99 | {0x409A0E11, "Smart Array 641", &SA5_access}, | 103 | {0x409A0E11, "Smart Array 641", &SA5_access, 512}, |
100 | {0x409B0E11, "Smart Array 642", &SA5_access}, | 104 | {0x409B0E11, "Smart Array 642", &SA5_access, 512}, |
101 | {0x409C0E11, "Smart Array 6400", &SA5_access}, | 105 | {0x409C0E11, "Smart Array 6400", &SA5_access, 512}, |
102 | {0x409D0E11, "Smart Array 6400 EM", &SA5_access}, | 106 | {0x409D0E11, "Smart Array 6400 EM", &SA5_access, 512}, |
103 | {0x40910E11, "Smart Array 6i", &SA5_access}, | 107 | {0x40910E11, "Smart Array 6i", &SA5_access, 512}, |
104 | {0x3225103C, "Smart Array P600", &SA5_access}, | 108 | {0x3225103C, "Smart Array P600", &SA5_access, 512}, |
105 | {0x3223103C, "Smart Array P800", &SA5_access}, | 109 | {0x3223103C, "Smart Array P800", &SA5_access, 512}, |
106 | {0x3234103C, "Smart Array P400", &SA5_access}, | 110 | {0x3234103C, "Smart Array P400", &SA5_access, 512}, |
107 | {0x3235103C, "Smart Array P400i", &SA5_access}, | 111 | {0x3235103C, "Smart Array P400i", &SA5_access, 512}, |
108 | {0x3211103C, "Smart Array E200i", &SA5_access}, | 112 | {0x3211103C, "Smart Array E200i", &SA5_access, 120}, |
109 | {0x3212103C, "Smart Array E200", &SA5_access}, | 113 | {0x3212103C, "Smart Array E200", &SA5_access, 120}, |
110 | {0x3213103C, "Smart Array E200i", &SA5_access}, | 114 | {0x3213103C, "Smart Array E200i", &SA5_access, 120}, |
111 | {0x3214103C, "Smart Array E200i", &SA5_access}, | 115 | {0x3214103C, "Smart Array E200i", &SA5_access, 120}, |
112 | {0x3215103C, "Smart Array E200i", &SA5_access}, | 116 | {0x3215103C, "Smart Array E200i", &SA5_access, 120}, |
113 | {0x3233103C, "Smart Array E500", &SA5_access}, | 117 | {0x3237103C, "Smart Array E500", &SA5_access, 512}, |
118 | {0xFFFF103C, "Unknown Smart Array", &SA5_access, 120}, | ||
114 | }; | 119 | }; |
115 | 120 | ||
116 | /* How long to wait (in milliseconds) for board to go into simple mode */ | 121 | /* How long to wait (in milliseconds) for board to go into simple mode */ |
@@ -121,7 +126,6 @@ static struct board_type products[] = { | |||
121 | #define MAX_CMD_RETRIES 3 | 126 | #define MAX_CMD_RETRIES 3 |
122 | 127 | ||
123 | #define READ_AHEAD 1024 | 128 | #define READ_AHEAD 1024 |
124 | #define NR_CMDS 384 /* #commands that can be outstanding */ | ||
125 | #define MAX_CTLR 32 | 129 | #define MAX_CTLR 32 |
126 | 130 | ||
127 | /* Originally cciss driver only supports 8 major numbers */ | 131 | /* Originally cciss driver only supports 8 major numbers */ |
@@ -137,7 +141,6 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, | |||
137 | unsigned int cmd, unsigned long arg); | 141 | unsigned int cmd, unsigned long arg); |
138 | static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); | 142 | static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); |
139 | 143 | ||
140 | static int revalidate_allvol(ctlr_info_t *host); | ||
141 | static int cciss_revalidate(struct gendisk *disk); | 144 | static int cciss_revalidate(struct gendisk *disk); |
142 | static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk); | 145 | static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk); |
143 | static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | 146 | static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, |
@@ -265,6 +268,7 @@ static int cciss_proc_get_info(char *buffer, char **start, off_t offset, | |||
265 | "Firmware Version: %c%c%c%c\n" | 268 | "Firmware Version: %c%c%c%c\n" |
266 | "IRQ: %d\n" | 269 | "IRQ: %d\n" |
267 | "Logical drives: %d\n" | 270 | "Logical drives: %d\n" |
271 | "Max sectors: %d\n" | ||
268 | "Current Q depth: %d\n" | 272 | "Current Q depth: %d\n" |
269 | "Current # commands on controller: %d\n" | 273 | "Current # commands on controller: %d\n" |
270 | "Max Q depth since init: %d\n" | 274 | "Max Q depth since init: %d\n" |
@@ -275,7 +279,9 @@ static int cciss_proc_get_info(char *buffer, char **start, off_t offset, | |||
275 | (unsigned long)h->board_id, | 279 | (unsigned long)h->board_id, |
276 | h->firm_ver[0], h->firm_ver[1], h->firm_ver[2], | 280 | h->firm_ver[0], h->firm_ver[1], h->firm_ver[2], |
277 | h->firm_ver[3], (unsigned int)h->intr[SIMPLE_MODE_INT], | 281 | h->firm_ver[3], (unsigned int)h->intr[SIMPLE_MODE_INT], |
278 | h->num_luns, h->Qdepth, h->commands_outstanding, | 282 | h->num_luns, |
283 | h->cciss_max_sectors, | ||
284 | h->Qdepth, h->commands_outstanding, | ||
279 | h->maxQsinceinit, h->max_outstanding, h->maxSG); | 285 | h->maxQsinceinit, h->max_outstanding, h->maxSG); |
280 | 286 | ||
281 | pos += size; | 287 | pos += size; |
@@ -400,8 +406,8 @@ static CommandList_struct *cmd_alloc(ctlr_info_t *h, int get_from_pool) | |||
400 | } else { /* get it out of the controllers pool */ | 406 | } else { /* get it out of the controllers pool */ |
401 | 407 | ||
402 | do { | 408 | do { |
403 | i = find_first_zero_bit(h->cmd_pool_bits, NR_CMDS); | 409 | i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds); |
404 | if (i == NR_CMDS) | 410 | if (i == h->nr_cmds) |
405 | return NULL; | 411 | return NULL; |
406 | } while (test_and_set_bit | 412 | } while (test_and_set_bit |
407 | (i & (BITS_PER_LONG - 1), | 413 | (i & (BITS_PER_LONG - 1), |
@@ -487,7 +493,7 @@ static int cciss_open(struct inode *inode, struct file *filep) | |||
487 | * but I'm already using way to many device nodes to claim another one | 493 | * but I'm already using way to many device nodes to claim another one |
488 | * for "raw controller". | 494 | * for "raw controller". |
489 | */ | 495 | */ |
490 | if (drv->nr_blocks == 0) { | 496 | if (drv->heads == 0) { |
491 | if (iminor(inode) != 0) { /* not node 0? */ | 497 | if (iminor(inode) != 0) { /* not node 0? */ |
492 | /* if not node 0 make sure it is a partition = 0 */ | 498 | /* if not node 0 make sure it is a partition = 0 */ |
493 | if (iminor(inode) & 0x0f) { | 499 | if (iminor(inode) & 0x0f) { |
@@ -850,9 +856,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, | |||
850 | } | 856 | } |
851 | 857 | ||
852 | case CCISS_REVALIDVOLS: | 858 | case CCISS_REVALIDVOLS: |
853 | if (bdev != bdev->bd_contains || drv != host->drv) | 859 | return rebuild_lun_table(host, NULL); |
854 | return -ENXIO; | ||
855 | return revalidate_allvol(host); | ||
856 | 860 | ||
857 | case CCISS_GETLUNINFO:{ | 861 | case CCISS_GETLUNINFO:{ |
858 | LogvolInfo_struct luninfo; | 862 | LogvolInfo_struct luninfo; |
@@ -1152,75 +1156,6 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, | |||
1152 | } | 1156 | } |
1153 | } | 1157 | } |
1154 | 1158 | ||
1155 | /* | ||
1156 | * revalidate_allvol is for online array config utilities. After a | ||
1157 | * utility reconfigures the drives in the array, it can use this function | ||
1158 | * (through an ioctl) to make the driver zap any previous disk structs for | ||
1159 | * that controller and get new ones. | ||
1160 | * | ||
1161 | * Right now I'm using the getgeometry() function to do this, but this | ||
1162 | * function should probably be finer grained and allow you to revalidate one | ||
1163 | * particular logical volume (instead of all of them on a particular | ||
1164 | * controller). | ||
1165 | */ | ||
1166 | static int revalidate_allvol(ctlr_info_t *host) | ||
1167 | { | ||
1168 | int ctlr = host->ctlr, i; | ||
1169 | unsigned long flags; | ||
1170 | |||
1171 | spin_lock_irqsave(CCISS_LOCK(ctlr), flags); | ||
1172 | if (host->usage_count > 1) { | ||
1173 | spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); | ||
1174 | printk(KERN_WARNING "cciss: Device busy for volume" | ||
1175 | " revalidation (usage=%d)\n", host->usage_count); | ||
1176 | return -EBUSY; | ||
1177 | } | ||
1178 | host->usage_count++; | ||
1179 | spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); | ||
1180 | |||
1181 | for (i = 0; i < NWD; i++) { | ||
1182 | struct gendisk *disk = host->gendisk[i]; | ||
1183 | if (disk) { | ||
1184 | request_queue_t *q = disk->queue; | ||
1185 | |||
1186 | if (disk->flags & GENHD_FL_UP) | ||
1187 | del_gendisk(disk); | ||
1188 | if (q) | ||
1189 | blk_cleanup_queue(q); | ||
1190 | } | ||
1191 | } | ||
1192 | |||
1193 | /* | ||
1194 | * Set the partition and block size structures for all volumes | ||
1195 | * on this controller to zero. We will reread all of this data | ||
1196 | */ | ||
1197 | memset(host->drv, 0, sizeof(drive_info_struct) | ||
1198 | * CISS_MAX_LUN); | ||
1199 | /* | ||
1200 | * Tell the array controller not to give us any interrupts while | ||
1201 | * we check the new geometry. Then turn interrupts back on when | ||
1202 | * we're done. | ||
1203 | */ | ||
1204 | host->access.set_intr_mask(host, CCISS_INTR_OFF); | ||
1205 | cciss_getgeometry(ctlr); | ||
1206 | host->access.set_intr_mask(host, CCISS_INTR_ON); | ||
1207 | |||
1208 | /* Loop through each real device */ | ||
1209 | for (i = 0; i < NWD; i++) { | ||
1210 | struct gendisk *disk = host->gendisk[i]; | ||
1211 | drive_info_struct *drv = &(host->drv[i]); | ||
1212 | /* we must register the controller even if no disks exist */ | ||
1213 | /* this is for the online array utilities */ | ||
1214 | if (!drv->heads && i) | ||
1215 | continue; | ||
1216 | blk_queue_hardsect_size(drv->queue, drv->block_size); | ||
1217 | set_capacity(disk, drv->nr_blocks); | ||
1218 | add_disk(disk); | ||
1219 | } | ||
1220 | host->usage_count--; | ||
1221 | return 0; | ||
1222 | } | ||
1223 | |||
1224 | static inline void complete_buffers(struct bio *bio, int status) | 1159 | static inline void complete_buffers(struct bio *bio, int status) |
1225 | { | 1160 | { |
1226 | while (bio) { | 1161 | while (bio) { |
@@ -1243,7 +1178,7 @@ static void cciss_check_queues(ctlr_info_t *h) | |||
1243 | * in case the interrupt we serviced was from an ioctl and did not | 1178 | * in case the interrupt we serviced was from an ioctl and did not |
1244 | * free any new commands. | 1179 | * free any new commands. |
1245 | */ | 1180 | */ |
1246 | if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) | 1181 | if ((find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds)) == h->nr_cmds) |
1247 | return; | 1182 | return; |
1248 | 1183 | ||
1249 | /* We have room on the queue for more commands. Now we need to queue | 1184 | /* We have room on the queue for more commands. Now we need to queue |
@@ -1262,7 +1197,7 @@ static void cciss_check_queues(ctlr_info_t *h) | |||
1262 | /* check to see if we have maxed out the number of commands | 1197 | /* check to see if we have maxed out the number of commands |
1263 | * that can be placed on the queue. | 1198 | * that can be placed on the queue. |
1264 | */ | 1199 | */ |
1265 | if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) { | 1200 | if ((find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds)) == h->nr_cmds) { |
1266 | if (curr_queue == start_queue) { | 1201 | if (curr_queue == start_queue) { |
1267 | h->next_to_run = | 1202 | h->next_to_run = |
1268 | (start_queue + 1) % (h->highest_lun + 1); | 1203 | (start_queue + 1) % (h->highest_lun + 1); |
@@ -1380,6 +1315,11 @@ static void cciss_update_drive_info(int ctlr, int drv_index) | |||
1380 | /* if it's the controller it's already added */ | 1315 | /* if it's the controller it's already added */ |
1381 | if (drv_index) { | 1316 | if (drv_index) { |
1382 | disk->queue = blk_init_queue(do_cciss_request, &h->lock); | 1317 | disk->queue = blk_init_queue(do_cciss_request, &h->lock); |
1318 | sprintf(disk->disk_name, "cciss/c%dd%d", ctlr, drv_index); | ||
1319 | disk->major = h->major; | ||
1320 | disk->first_minor = drv_index << NWD_SHIFT; | ||
1321 | disk->fops = &cciss_fops; | ||
1322 | disk->private_data = &h->drv[drv_index]; | ||
1383 | 1323 | ||
1384 | /* Set up queue information */ | 1324 | /* Set up queue information */ |
1385 | disk->queue->backing_dev_info.ra_pages = READ_AHEAD; | 1325 | disk->queue->backing_dev_info.ra_pages = READ_AHEAD; |
@@ -1391,7 +1331,7 @@ static void cciss_update_drive_info(int ctlr, int drv_index) | |||
1391 | /* This is a limit in the driver and could be eliminated. */ | 1331 | /* This is a limit in the driver and could be eliminated. */ |
1392 | blk_queue_max_phys_segments(disk->queue, MAXSGENTRIES); | 1332 | blk_queue_max_phys_segments(disk->queue, MAXSGENTRIES); |
1393 | 1333 | ||
1394 | blk_queue_max_sectors(disk->queue, 512); | 1334 | blk_queue_max_sectors(disk->queue, h->cciss_max_sectors); |
1395 | 1335 | ||
1396 | blk_queue_softirq_done(disk->queue, cciss_softirq_done); | 1336 | blk_queue_softirq_done(disk->queue, cciss_softirq_done); |
1397 | 1337 | ||
@@ -1458,11 +1398,6 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk) | |||
1458 | 1398 | ||
1459 | /* Set busy_configuring flag for this operation */ | 1399 | /* Set busy_configuring flag for this operation */ |
1460 | spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); | 1400 | spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); |
1461 | if (h->num_luns >= CISS_MAX_LUN) { | ||
1462 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | ||
1463 | return -EINVAL; | ||
1464 | } | ||
1465 | |||
1466 | if (h->busy_configuring) { | 1401 | if (h->busy_configuring) { |
1467 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | 1402 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); |
1468 | return -EBUSY; | 1403 | return -EBUSY; |
@@ -1495,17 +1430,8 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk) | |||
1495 | 0, 0, TYPE_CMD); | 1430 | 0, 0, TYPE_CMD); |
1496 | 1431 | ||
1497 | if (return_code == IO_OK) { | 1432 | if (return_code == IO_OK) { |
1498 | listlength |= | 1433 | listlength = |
1499 | (0xff & (unsigned int)(ld_buff->LUNListLength[0])) | 1434 | be32_to_cpu(*(__u32 *) ld_buff->LUNListLength); |
1500 | << 24; | ||
1501 | listlength |= | ||
1502 | (0xff & (unsigned int)(ld_buff->LUNListLength[1])) | ||
1503 | << 16; | ||
1504 | listlength |= | ||
1505 | (0xff & (unsigned int)(ld_buff->LUNListLength[2])) | ||
1506 | << 8; | ||
1507 | listlength |= | ||
1508 | 0xff & (unsigned int)(ld_buff->LUNListLength[3]); | ||
1509 | } else { /* reading number of logical volumes failed */ | 1435 | } else { /* reading number of logical volumes failed */ |
1510 | printk(KERN_WARNING "cciss: report logical volume" | 1436 | printk(KERN_WARNING "cciss: report logical volume" |
1511 | " command failed\n"); | 1437 | " command failed\n"); |
@@ -1556,6 +1482,14 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk) | |||
1556 | if (drv_index == -1) | 1482 | if (drv_index == -1) |
1557 | goto freeret; | 1483 | goto freeret; |
1558 | 1484 | ||
1485 | /*Check if the gendisk needs to be allocated */ | ||
1486 | if (!h->gendisk[drv_index]){ | ||
1487 | h->gendisk[drv_index] = alloc_disk(1 << NWD_SHIFT); | ||
1488 | if (!h->gendisk[drv_index]){ | ||
1489 | printk(KERN_ERR "cciss: could not allocate new disk %d\n", drv_index); | ||
1490 | goto mem_msg; | ||
1491 | } | ||
1492 | } | ||
1559 | } | 1493 | } |
1560 | h->drv[drv_index].LunID = lunid; | 1494 | h->drv[drv_index].LunID = lunid; |
1561 | cciss_update_drive_info(ctlr, drv_index); | 1495 | cciss_update_drive_info(ctlr, drv_index); |
@@ -1593,6 +1527,7 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk) | |||
1593 | static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | 1527 | static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, |
1594 | int clear_all) | 1528 | int clear_all) |
1595 | { | 1529 | { |
1530 | int i; | ||
1596 | ctlr_info_t *h = get_host(disk); | 1531 | ctlr_info_t *h = get_host(disk); |
1597 | 1532 | ||
1598 | if (!capable(CAP_SYS_RAWIO)) | 1533 | if (!capable(CAP_SYS_RAWIO)) |
@@ -1616,9 +1551,35 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | |||
1616 | del_gendisk(disk); | 1551 | del_gendisk(disk); |
1617 | if (q) { | 1552 | if (q) { |
1618 | blk_cleanup_queue(q); | 1553 | blk_cleanup_queue(q); |
1554 | /* Set drv->queue to NULL so that we do not try | ||
1555 | * to call blk_start_queue on this queue in the | ||
1556 | * interrupt handler | ||
1557 | */ | ||
1619 | drv->queue = NULL; | 1558 | drv->queue = NULL; |
1620 | } | 1559 | } |
1560 | /* If clear_all is set then we are deleting the logical | ||
1561 | * drive, not just refreshing its info. For drives | ||
1562 | * other than disk 0 we will call put_disk. We do not | ||
1563 | * do this for disk 0 as we need it to be able to | ||
1564 | * configure the controller. | ||
1565 | */ | ||
1566 | if (clear_all){ | ||
1567 | /* This isn't pretty, but we need to find the | ||
1568 | * disk in our array and NULL our the pointer. | ||
1569 | * This is so that we will call alloc_disk if | ||
1570 | * this index is used again later. | ||
1571 | */ | ||
1572 | for (i=0; i < CISS_MAX_LUN; i++){ | ||
1573 | if(h->gendisk[i] == disk){ | ||
1574 | h->gendisk[i] = NULL; | ||
1575 | break; | ||
1576 | } | ||
1577 | } | ||
1578 | put_disk(disk); | ||
1579 | } | ||
1621 | } | 1580 | } |
1581 | } else { | ||
1582 | set_capacity(disk, 0); | ||
1622 | } | 1583 | } |
1623 | 1584 | ||
1624 | --h->num_luns; | 1585 | --h->num_luns; |
@@ -2136,7 +2097,7 @@ static int add_sendcmd_reject(__u8 cmd, int ctlr, unsigned long complete) | |||
2136 | 2097 | ||
2137 | /* We've sent down an abort or reset, but something else | 2098 | /* We've sent down an abort or reset, but something else |
2138 | has completed */ | 2099 | has completed */ |
2139 | if (srl->ncompletions >= (NR_CMDS + 2)) { | 2100 | if (srl->ncompletions >= (hba[ctlr]->nr_cmds + 2)) { |
2140 | /* Uh oh. No room to save it for later... */ | 2101 | /* Uh oh. No room to save it for later... */ |
2141 | printk(KERN_WARNING "cciss%d: Sendcmd: Invalid command addr, " | 2102 | printk(KERN_WARNING "cciss%d: Sendcmd: Invalid command addr, " |
2142 | "reject list overflow, command lost!\n", ctlr); | 2103 | "reject list overflow, command lost!\n", ctlr); |
@@ -2673,7 +2634,7 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id) | |||
2673 | a1 = a; | 2634 | a1 = a; |
2674 | if ((a & 0x04)) { | 2635 | if ((a & 0x04)) { |
2675 | a2 = (a >> 3); | 2636 | a2 = (a >> 3); |
2676 | if (a2 >= NR_CMDS) { | 2637 | if (a2 >= h->nr_cmds) { |
2677 | printk(KERN_WARNING | 2638 | printk(KERN_WARNING |
2678 | "cciss: controller cciss%d failed, stopping.\n", | 2639 | "cciss: controller cciss%d failed, stopping.\n", |
2679 | h->ctlr); | 2640 | h->ctlr); |
@@ -2827,23 +2788,21 @@ static void __devinit cciss_interrupt_mode(ctlr_info_t *c, | |||
2827 | if (err > 0) { | 2788 | if (err > 0) { |
2828 | printk(KERN_WARNING "cciss: only %d MSI-X vectors " | 2789 | printk(KERN_WARNING "cciss: only %d MSI-X vectors " |
2829 | "available\n", err); | 2790 | "available\n", err); |
2791 | goto default_int_mode; | ||
2830 | } else { | 2792 | } else { |
2831 | printk(KERN_WARNING "cciss: MSI-X init failed %d\n", | 2793 | printk(KERN_WARNING "cciss: MSI-X init failed %d\n", |
2832 | err); | 2794 | err); |
2795 | goto default_int_mode; | ||
2833 | } | 2796 | } |
2834 | } | 2797 | } |
2835 | if (pci_find_capability(pdev, PCI_CAP_ID_MSI)) { | 2798 | if (pci_find_capability(pdev, PCI_CAP_ID_MSI)) { |
2836 | if (!pci_enable_msi(pdev)) { | 2799 | if (!pci_enable_msi(pdev)) { |
2837 | c->intr[SIMPLE_MODE_INT] = pdev->irq; | ||
2838 | c->msi_vector = 1; | 2800 | c->msi_vector = 1; |
2839 | return; | ||
2840 | } else { | 2801 | } else { |
2841 | printk(KERN_WARNING "cciss: MSI init failed\n"); | 2802 | printk(KERN_WARNING "cciss: MSI init failed\n"); |
2842 | c->intr[SIMPLE_MODE_INT] = pdev->irq; | ||
2843 | return; | ||
2844 | } | 2803 | } |
2845 | } | 2804 | } |
2846 | default_int_mode: | 2805 | default_int_mode: |
2847 | #endif /* CONFIG_PCI_MSI */ | 2806 | #endif /* CONFIG_PCI_MSI */ |
2848 | /* if we get here we're going to use the default interrupt mode */ | 2807 | /* if we get here we're going to use the default interrupt mode */ |
2849 | c->intr[SIMPLE_MODE_INT] = pdev->irq; | 2808 | c->intr[SIMPLE_MODE_INT] = pdev->irq; |
@@ -2956,16 +2915,10 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
2956 | if (board_id == products[i].board_id) { | 2915 | if (board_id == products[i].board_id) { |
2957 | c->product_name = products[i].product_name; | 2916 | c->product_name = products[i].product_name; |
2958 | c->access = *(products[i].access); | 2917 | c->access = *(products[i].access); |
2918 | c->nr_cmds = products[i].nr_cmds; | ||
2959 | break; | 2919 | break; |
2960 | } | 2920 | } |
2961 | } | 2921 | } |
2962 | if (i == ARRAY_SIZE(products)) { | ||
2963 | printk(KERN_WARNING "cciss: Sorry, I don't know how" | ||
2964 | " to access the Smart Array controller %08lx\n", | ||
2965 | (unsigned long)board_id); | ||
2966 | err = -ENODEV; | ||
2967 | goto err_out_free_res; | ||
2968 | } | ||
2969 | if ((readb(&c->cfgtable->Signature[0]) != 'C') || | 2922 | if ((readb(&c->cfgtable->Signature[0]) != 'C') || |
2970 | (readb(&c->cfgtable->Signature[1]) != 'I') || | 2923 | (readb(&c->cfgtable->Signature[1]) != 'I') || |
2971 | (readb(&c->cfgtable->Signature[2]) != 'S') || | 2924 | (readb(&c->cfgtable->Signature[2]) != 'S') || |
@@ -2974,6 +2927,27 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
2974 | err = -ENODEV; | 2927 | err = -ENODEV; |
2975 | goto err_out_free_res; | 2928 | goto err_out_free_res; |
2976 | } | 2929 | } |
2930 | /* We didn't find the controller in our list. We know the | ||
2931 | * signature is valid. If it's an HP device let's try to | ||
2932 | * bind to the device and fire it up. Otherwise we bail. | ||
2933 | */ | ||
2934 | if (i == ARRAY_SIZE(products)) { | ||
2935 | if (subsystem_vendor_id == PCI_VENDOR_ID_HP) { | ||
2936 | c->product_name = products[i-1].product_name; | ||
2937 | c->access = *(products[i-1].access); | ||
2938 | c->nr_cmds = products[i-1].nr_cmds; | ||
2939 | printk(KERN_WARNING "cciss: This is an unknown " | ||
2940 | "Smart Array controller.\n" | ||
2941 | "cciss: Please update to the latest driver " | ||
2942 | "available from www.hp.com.\n"); | ||
2943 | } else { | ||
2944 | printk(KERN_WARNING "cciss: Sorry, I don't know how" | ||
2945 | " to access the Smart Array controller %08lx\n" | ||
2946 | , (unsigned long)board_id); | ||
2947 | err = -ENODEV; | ||
2948 | goto err_out_free_res; | ||
2949 | } | ||
2950 | } | ||
2977 | #ifdef CONFIG_X86 | 2951 | #ifdef CONFIG_X86 |
2978 | { | 2952 | { |
2979 | /* Need to enable prefetch in the SCSI core for 6400 in x86 */ | 2953 | /* Need to enable prefetch in the SCSI core for 6400 in x86 */ |
@@ -2984,6 +2958,17 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
2984 | } | 2958 | } |
2985 | #endif | 2959 | #endif |
2986 | 2960 | ||
2961 | /* Disabling DMA prefetch for the P600 | ||
2962 | * An ASIC bug may result in a prefetch beyond | ||
2963 | * physical memory. | ||
2964 | */ | ||
2965 | if(board_id == 0x3225103C) { | ||
2966 | __u32 dma_prefetch; | ||
2967 | dma_prefetch = readl(c->vaddr + I2O_DMA1_CFG); | ||
2968 | dma_prefetch |= 0x8000; | ||
2969 | writel(dma_prefetch, c->vaddr + I2O_DMA1_CFG); | ||
2970 | } | ||
2971 | |||
2987 | #ifdef CCISS_DEBUG | 2972 | #ifdef CCISS_DEBUG |
2988 | printk("Trying to put board into Simple mode\n"); | 2973 | printk("Trying to put board into Simple mode\n"); |
2989 | #endif /* CCISS_DEBUG */ | 2974 | #endif /* CCISS_DEBUG */ |
@@ -3158,13 +3143,7 @@ geo_inq: | |||
3158 | /* Returns -1 if no free entries are left. */ | 3143 | /* Returns -1 if no free entries are left. */ |
3159 | static int alloc_cciss_hba(void) | 3144 | static int alloc_cciss_hba(void) |
3160 | { | 3145 | { |
3161 | struct gendisk *disk[NWD]; | 3146 | int i; |
3162 | int i, n; | ||
3163 | for (n = 0; n < NWD; n++) { | ||
3164 | disk[n] = alloc_disk(1 << NWD_SHIFT); | ||
3165 | if (!disk[n]) | ||
3166 | goto out; | ||
3167 | } | ||
3168 | 3147 | ||
3169 | for (i = 0; i < MAX_CTLR; i++) { | 3148 | for (i = 0; i < MAX_CTLR; i++) { |
3170 | if (!hba[i]) { | 3149 | if (!hba[i]) { |
@@ -3172,20 +3151,18 @@ static int alloc_cciss_hba(void) | |||
3172 | p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL); | 3151 | p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL); |
3173 | if (!p) | 3152 | if (!p) |
3174 | goto Enomem; | 3153 | goto Enomem; |
3175 | for (n = 0; n < NWD; n++) | 3154 | p->gendisk[0] = alloc_disk(1 << NWD_SHIFT); |
3176 | p->gendisk[n] = disk[n]; | 3155 | if (!p->gendisk[0]) |
3156 | goto Enomem; | ||
3177 | hba[i] = p; | 3157 | hba[i] = p; |
3178 | return i; | 3158 | return i; |
3179 | } | 3159 | } |
3180 | } | 3160 | } |
3181 | printk(KERN_WARNING "cciss: This driver supports a maximum" | 3161 | printk(KERN_WARNING "cciss: This driver supports a maximum" |
3182 | " of %d controllers.\n", MAX_CTLR); | 3162 | " of %d controllers.\n", MAX_CTLR); |
3183 | goto out; | 3163 | return -1; |
3184 | Enomem: | 3164 | Enomem: |
3185 | printk(KERN_ERR "cciss: out of memory.\n"); | 3165 | printk(KERN_ERR "cciss: out of memory.\n"); |
3186 | out: | ||
3187 | while (n--) | ||
3188 | put_disk(disk[n]); | ||
3189 | return -1; | 3166 | return -1; |
3190 | } | 3167 | } |
3191 | 3168 | ||
@@ -3195,7 +3172,7 @@ static void free_hba(int i) | |||
3195 | int n; | 3172 | int n; |
3196 | 3173 | ||
3197 | hba[i] = NULL; | 3174 | hba[i] = NULL; |
3198 | for (n = 0; n < NWD; n++) | 3175 | for (n = 0; n < CISS_MAX_LUN; n++) |
3199 | put_disk(p->gendisk[n]); | 3176 | put_disk(p->gendisk[n]); |
3200 | kfree(p); | 3177 | kfree(p); |
3201 | } | 3178 | } |
@@ -3208,9 +3185,8 @@ static void free_hba(int i) | |||
3208 | static int __devinit cciss_init_one(struct pci_dev *pdev, | 3185 | static int __devinit cciss_init_one(struct pci_dev *pdev, |
3209 | const struct pci_device_id *ent) | 3186 | const struct pci_device_id *ent) |
3210 | { | 3187 | { |
3211 | request_queue_t *q; | ||
3212 | int i; | 3188 | int i; |
3213 | int j; | 3189 | int j = 0; |
3214 | int rc; | 3190 | int rc; |
3215 | int dac; | 3191 | int dac; |
3216 | 3192 | ||
@@ -3269,15 +3245,15 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3269 | hba[i]->intr[SIMPLE_MODE_INT], dac ? "" : " not"); | 3245 | hba[i]->intr[SIMPLE_MODE_INT], dac ? "" : " not"); |
3270 | 3246 | ||
3271 | hba[i]->cmd_pool_bits = | 3247 | hba[i]->cmd_pool_bits = |
3272 | kmalloc(((NR_CMDS + BITS_PER_LONG - | 3248 | kmalloc(((hba[i]->nr_cmds + BITS_PER_LONG - |
3273 | 1) / BITS_PER_LONG) * sizeof(unsigned long), GFP_KERNEL); | 3249 | 1) / BITS_PER_LONG) * sizeof(unsigned long), GFP_KERNEL); |
3274 | hba[i]->cmd_pool = (CommandList_struct *) | 3250 | hba[i]->cmd_pool = (CommandList_struct *) |
3275 | pci_alloc_consistent(hba[i]->pdev, | 3251 | pci_alloc_consistent(hba[i]->pdev, |
3276 | NR_CMDS * sizeof(CommandList_struct), | 3252 | hba[i]->nr_cmds * sizeof(CommandList_struct), |
3277 | &(hba[i]->cmd_pool_dhandle)); | 3253 | &(hba[i]->cmd_pool_dhandle)); |
3278 | hba[i]->errinfo_pool = (ErrorInfo_struct *) | 3254 | hba[i]->errinfo_pool = (ErrorInfo_struct *) |
3279 | pci_alloc_consistent(hba[i]->pdev, | 3255 | pci_alloc_consistent(hba[i]->pdev, |
3280 | NR_CMDS * sizeof(ErrorInfo_struct), | 3256 | hba[i]->nr_cmds * sizeof(ErrorInfo_struct), |
3281 | &(hba[i]->errinfo_pool_dhandle)); | 3257 | &(hba[i]->errinfo_pool_dhandle)); |
3282 | if ((hba[i]->cmd_pool_bits == NULL) | 3258 | if ((hba[i]->cmd_pool_bits == NULL) |
3283 | || (hba[i]->cmd_pool == NULL) | 3259 | || (hba[i]->cmd_pool == NULL) |
@@ -3288,7 +3264,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3288 | #ifdef CONFIG_CISS_SCSI_TAPE | 3264 | #ifdef CONFIG_CISS_SCSI_TAPE |
3289 | hba[i]->scsi_rejects.complete = | 3265 | hba[i]->scsi_rejects.complete = |
3290 | kmalloc(sizeof(hba[i]->scsi_rejects.complete[0]) * | 3266 | kmalloc(sizeof(hba[i]->scsi_rejects.complete[0]) * |
3291 | (NR_CMDS + 5), GFP_KERNEL); | 3267 | (hba[i]->nr_cmds + 5), GFP_KERNEL); |
3292 | if (hba[i]->scsi_rejects.complete == NULL) { | 3268 | if (hba[i]->scsi_rejects.complete == NULL) { |
3293 | printk(KERN_ERR "cciss: out of memory"); | 3269 | printk(KERN_ERR "cciss: out of memory"); |
3294 | goto clean4; | 3270 | goto clean4; |
@@ -3302,7 +3278,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3302 | /* command and error info recs zeroed out before | 3278 | /* command and error info recs zeroed out before |
3303 | they are used */ | 3279 | they are used */ |
3304 | memset(hba[i]->cmd_pool_bits, 0, | 3280 | memset(hba[i]->cmd_pool_bits, 0, |
3305 | ((NR_CMDS + BITS_PER_LONG - | 3281 | ((hba[i]->nr_cmds + BITS_PER_LONG - |
3306 | 1) / BITS_PER_LONG) * sizeof(unsigned long)); | 3282 | 1) / BITS_PER_LONG) * sizeof(unsigned long)); |
3307 | 3283 | ||
3308 | #ifdef CCISS_DEBUG | 3284 | #ifdef CCISS_DEBUG |
@@ -3317,18 +3293,34 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3317 | hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON); | 3293 | hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON); |
3318 | 3294 | ||
3319 | cciss_procinit(i); | 3295 | cciss_procinit(i); |
3296 | |||
3297 | hba[i]->cciss_max_sectors = 2048; | ||
3298 | |||
3320 | hba[i]->busy_initializing = 0; | 3299 | hba[i]->busy_initializing = 0; |
3321 | 3300 | ||
3322 | for (j = 0; j < NWD; j++) { /* mfm */ | 3301 | do { |
3323 | drive_info_struct *drv = &(hba[i]->drv[j]); | 3302 | drive_info_struct *drv = &(hba[i]->drv[j]); |
3324 | struct gendisk *disk = hba[i]->gendisk[j]; | 3303 | struct gendisk *disk = hba[i]->gendisk[j]; |
3304 | request_queue_t *q; | ||
3305 | |||
3306 | /* Check if the disk was allocated already */ | ||
3307 | if (!disk){ | ||
3308 | hba[i]->gendisk[j] = alloc_disk(1 << NWD_SHIFT); | ||
3309 | disk = hba[i]->gendisk[j]; | ||
3310 | } | ||
3311 | |||
3312 | /* Check that the disk was able to be allocated */ | ||
3313 | if (!disk) { | ||
3314 | printk(KERN_ERR "cciss: unable to allocate memory for disk %d\n", j); | ||
3315 | goto clean4; | ||
3316 | } | ||
3325 | 3317 | ||
3326 | q = blk_init_queue(do_cciss_request, &hba[i]->lock); | 3318 | q = blk_init_queue(do_cciss_request, &hba[i]->lock); |
3327 | if (!q) { | 3319 | if (!q) { |
3328 | printk(KERN_ERR | 3320 | printk(KERN_ERR |
3329 | "cciss: unable to allocate queue for disk %d\n", | 3321 | "cciss: unable to allocate queue for disk %d\n", |
3330 | j); | 3322 | j); |
3331 | break; | 3323 | goto clean4; |
3332 | } | 3324 | } |
3333 | drv->queue = q; | 3325 | drv->queue = q; |
3334 | 3326 | ||
@@ -3341,7 +3333,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3341 | /* This is a limit in the driver and could be eliminated. */ | 3333 | /* This is a limit in the driver and could be eliminated. */ |
3342 | blk_queue_max_phys_segments(q, MAXSGENTRIES); | 3334 | blk_queue_max_phys_segments(q, MAXSGENTRIES); |
3343 | 3335 | ||
3344 | blk_queue_max_sectors(q, 512); | 3336 | blk_queue_max_sectors(q, hba[i]->cciss_max_sectors); |
3345 | 3337 | ||
3346 | blk_queue_softirq_done(q, cciss_softirq_done); | 3338 | blk_queue_softirq_done(q, cciss_softirq_done); |
3347 | 3339 | ||
@@ -3360,7 +3352,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3360 | blk_queue_hardsect_size(q, drv->block_size); | 3352 | blk_queue_hardsect_size(q, drv->block_size); |
3361 | set_capacity(disk, drv->nr_blocks); | 3353 | set_capacity(disk, drv->nr_blocks); |
3362 | add_disk(disk); | 3354 | add_disk(disk); |
3363 | } | 3355 | j++; |
3356 | } while (j <= hba[i]->highest_lun); | ||
3364 | 3357 | ||
3365 | return 1; | 3358 | return 1; |
3366 | 3359 | ||
@@ -3371,11 +3364,11 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3371 | kfree(hba[i]->cmd_pool_bits); | 3364 | kfree(hba[i]->cmd_pool_bits); |
3372 | if (hba[i]->cmd_pool) | 3365 | if (hba[i]->cmd_pool) |
3373 | pci_free_consistent(hba[i]->pdev, | 3366 | pci_free_consistent(hba[i]->pdev, |
3374 | NR_CMDS * sizeof(CommandList_struct), | 3367 | hba[i]->nr_cmds * sizeof(CommandList_struct), |
3375 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); | 3368 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); |
3376 | if (hba[i]->errinfo_pool) | 3369 | if (hba[i]->errinfo_pool) |
3377 | pci_free_consistent(hba[i]->pdev, | 3370 | pci_free_consistent(hba[i]->pdev, |
3378 | NR_CMDS * sizeof(ErrorInfo_struct), | 3371 | hba[i]->nr_cmds * sizeof(ErrorInfo_struct), |
3379 | hba[i]->errinfo_pool, | 3372 | hba[i]->errinfo_pool, |
3380 | hba[i]->errinfo_pool_dhandle); | 3373 | hba[i]->errinfo_pool_dhandle); |
3381 | free_irq(hba[i]->intr[SIMPLE_MODE_INT], hba[i]); | 3374 | free_irq(hba[i]->intr[SIMPLE_MODE_INT], hba[i]); |
@@ -3383,6 +3376,15 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3383 | unregister_blkdev(hba[i]->major, hba[i]->devname); | 3376 | unregister_blkdev(hba[i]->major, hba[i]->devname); |
3384 | clean1: | 3377 | clean1: |
3385 | hba[i]->busy_initializing = 0; | 3378 | hba[i]->busy_initializing = 0; |
3379 | /* cleanup any queues that may have been initialized */ | ||
3380 | for (j=0; j <= hba[i]->highest_lun; j++){ | ||
3381 | drive_info_struct *drv = &(hba[i]->drv[j]); | ||
3382 | if (drv->queue) | ||
3383 | blk_cleanup_queue(drv->queue); | ||
3384 | } | ||
3385 | pci_release_regions(pdev); | ||
3386 | pci_disable_device(pdev); | ||
3387 | pci_set_drvdata(pdev, NULL); | ||
3386 | free_hba(i); | 3388 | free_hba(i); |
3387 | return -1; | 3389 | return -1; |
3388 | } | 3390 | } |
@@ -3430,7 +3432,7 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev) | |||
3430 | remove_proc_entry(hba[i]->devname, proc_cciss); | 3432 | remove_proc_entry(hba[i]->devname, proc_cciss); |
3431 | 3433 | ||
3432 | /* remove it from the disk list */ | 3434 | /* remove it from the disk list */ |
3433 | for (j = 0; j < NWD; j++) { | 3435 | for (j = 0; j < CISS_MAX_LUN; j++) { |
3434 | struct gendisk *disk = hba[i]->gendisk[j]; | 3436 | struct gendisk *disk = hba[i]->gendisk[j]; |
3435 | if (disk) { | 3437 | if (disk) { |
3436 | request_queue_t *q = disk->queue; | 3438 | request_queue_t *q = disk->queue; |
@@ -3442,9 +3444,9 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev) | |||
3442 | } | 3444 | } |
3443 | } | 3445 | } |
3444 | 3446 | ||
3445 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct), | 3447 | pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(CommandList_struct), |
3446 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); | 3448 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); |
3447 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(ErrorInfo_struct), | 3449 | pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(ErrorInfo_struct), |
3448 | hba[i]->errinfo_pool, hba[i]->errinfo_pool_dhandle); | 3450 | hba[i]->errinfo_pool, hba[i]->errinfo_pool_dhandle); |
3449 | kfree(hba[i]->cmd_pool_bits); | 3451 | kfree(hba[i]->cmd_pool_bits); |
3450 | #ifdef CONFIG_CISS_SCSI_TAPE | 3452 | #ifdef CONFIG_CISS_SCSI_TAPE |
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h index 562235c1445a..b70988dd33ec 100644 --- a/drivers/block/cciss.h +++ b/drivers/block/cciss.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #include "cciss_cmd.h" | 6 | #include "cciss_cmd.h" |
7 | 7 | ||
8 | 8 | ||
9 | #define NWD 16 | ||
10 | #define NWD_SHIFT 4 | 9 | #define NWD_SHIFT 4 |
11 | #define MAX_PART (1 << NWD_SHIFT) | 10 | #define MAX_PART (1 << NWD_SHIFT) |
12 | 11 | ||
@@ -60,6 +59,7 @@ struct ctlr_info | |||
60 | __u32 board_id; | 59 | __u32 board_id; |
61 | void __iomem *vaddr; | 60 | void __iomem *vaddr; |
62 | unsigned long paddr; | 61 | unsigned long paddr; |
62 | int nr_cmds; /* Number of commands allowed on this controller */ | ||
63 | CfgTable_struct __iomem *cfgtable; | 63 | CfgTable_struct __iomem *cfgtable; |
64 | int interrupts_enabled; | 64 | int interrupts_enabled; |
65 | int major; | 65 | int major; |
@@ -76,6 +76,7 @@ struct ctlr_info | |||
76 | unsigned int intr[4]; | 76 | unsigned int intr[4]; |
77 | unsigned int msix_vector; | 77 | unsigned int msix_vector; |
78 | unsigned int msi_vector; | 78 | unsigned int msi_vector; |
79 | int cciss_max_sectors; | ||
79 | BYTE cciss_read; | 80 | BYTE cciss_read; |
80 | BYTE cciss_write; | 81 | BYTE cciss_write; |
81 | BYTE cciss_read_capacity; | 82 | BYTE cciss_read_capacity; |
@@ -110,7 +111,7 @@ struct ctlr_info | |||
110 | int next_to_run; | 111 | int next_to_run; |
111 | 112 | ||
112 | // Disk structures we need to pass back | 113 | // Disk structures we need to pass back |
113 | struct gendisk *gendisk[NWD]; | 114 | struct gendisk *gendisk[CISS_MAX_LUN]; |
114 | #ifdef CONFIG_CISS_SCSI_TAPE | 115 | #ifdef CONFIG_CISS_SCSI_TAPE |
115 | void *scsi_ctlr; /* ptr to structure containing scsi related stuff */ | 116 | void *scsi_ctlr; /* ptr to structure containing scsi related stuff */ |
116 | /* list of block side commands the scsi error handling sucked up */ | 117 | /* list of block side commands the scsi error handling sucked up */ |
@@ -282,6 +283,7 @@ struct board_type { | |||
282 | __u32 board_id; | 283 | __u32 board_id; |
283 | char *product_name; | 284 | char *product_name; |
284 | struct access_method *access; | 285 | struct access_method *access; |
286 | int nr_cmds; /* Max cmds this kind of ctlr can handle. */ | ||
285 | }; | 287 | }; |
286 | 288 | ||
287 | #define CCISS_LOCK(i) (&hba[i]->lock) | 289 | #define CCISS_LOCK(i) (&hba[i]->lock) |
diff --git a/drivers/block/cciss_cmd.h b/drivers/block/cciss_cmd.h index 4af7c4c0c7af..43bf5593b59b 100644 --- a/drivers/block/cciss_cmd.h +++ b/drivers/block/cciss_cmd.h | |||
@@ -55,6 +55,7 @@ | |||
55 | #define I2O_INT_MASK 0x34 | 55 | #define I2O_INT_MASK 0x34 |
56 | #define I2O_IBPOST_Q 0x40 | 56 | #define I2O_IBPOST_Q 0x40 |
57 | #define I2O_OBPOST_Q 0x44 | 57 | #define I2O_OBPOST_Q 0x44 |
58 | #define I2O_DMA1_CFG 0x214 | ||
58 | 59 | ||
59 | //Configuration Table | 60 | //Configuration Table |
60 | #define CFGTBL_ChangeReq 0x00000001l | 61 | #define CFGTBL_ChangeReq 0x00000001l |
@@ -88,7 +89,7 @@ typedef union _u64bit | |||
88 | //########################################################################### | 89 | //########################################################################### |
89 | //STRUCTURES | 90 | //STRUCTURES |
90 | //########################################################################### | 91 | //########################################################################### |
91 | #define CISS_MAX_LUN 16 | 92 | #define CISS_MAX_LUN 1024 |
92 | #define CISS_MAX_PHYS_LUN 1024 | 93 | #define CISS_MAX_PHYS_LUN 1024 |
93 | // SCSI-3 Cmmands | 94 | // SCSI-3 Cmmands |
94 | 95 | ||
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 9d1035e8d9d8..7bf2cfbd6285 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -355,14 +355,30 @@ harderror: | |||
355 | return NULL; | 355 | return NULL; |
356 | } | 356 | } |
357 | 357 | ||
358 | static ssize_t pid_show(struct gendisk *disk, char *page) | ||
359 | { | ||
360 | return sprintf(page, "%ld\n", | ||
361 | (long) ((struct nbd_device *)disk->private_data)->pid); | ||
362 | } | ||
363 | |||
364 | static struct disk_attribute pid_attr = { | ||
365 | .attr = { .name = "pid", .mode = S_IRUGO }, | ||
366 | .show = pid_show, | ||
367 | }; | ||
368 | |||
358 | static void nbd_do_it(struct nbd_device *lo) | 369 | static void nbd_do_it(struct nbd_device *lo) |
359 | { | 370 | { |
360 | struct request *req; | 371 | struct request *req; |
361 | 372 | ||
362 | BUG_ON(lo->magic != LO_MAGIC); | 373 | BUG_ON(lo->magic != LO_MAGIC); |
363 | 374 | ||
375 | lo->pid = current->pid; | ||
376 | sysfs_create_file(&lo->disk->kobj, &pid_attr.attr); | ||
377 | |||
364 | while ((req = nbd_read_stat(lo)) != NULL) | 378 | while ((req = nbd_read_stat(lo)) != NULL) |
365 | nbd_end_request(req); | 379 | nbd_end_request(req); |
380 | |||
381 | sysfs_remove_file(&lo->disk->kobj, &pid_attr.attr); | ||
366 | return; | 382 | return; |
367 | } | 383 | } |
368 | 384 | ||
diff --git a/drivers/block/paride/aten.c b/drivers/block/paride/aten.c index c4d696d43dc1..2695465568ad 100644 --- a/drivers/block/paride/aten.c +++ b/drivers/block/paride/aten.c | |||
@@ -149,12 +149,12 @@ static struct pi_protocol aten = { | |||
149 | 149 | ||
150 | static int __init aten_init(void) | 150 | static int __init aten_init(void) |
151 | { | 151 | { |
152 | return pi_register(&aten)-1; | 152 | return paride_register(&aten); |
153 | } | 153 | } |
154 | 154 | ||
155 | static void __exit aten_exit(void) | 155 | static void __exit aten_exit(void) |
156 | { | 156 | { |
157 | pi_unregister( &aten ); | 157 | paride_unregister( &aten ); |
158 | } | 158 | } |
159 | 159 | ||
160 | MODULE_LICENSE("GPL"); | 160 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/bpck.c b/drivers/block/paride/bpck.c index d462ff6b139d..4f27e7392e38 100644 --- a/drivers/block/paride/bpck.c +++ b/drivers/block/paride/bpck.c | |||
@@ -464,12 +464,12 @@ static struct pi_protocol bpck = { | |||
464 | 464 | ||
465 | static int __init bpck_init(void) | 465 | static int __init bpck_init(void) |
466 | { | 466 | { |
467 | return pi_register(&bpck)-1; | 467 | return paride_register(&bpck); |
468 | } | 468 | } |
469 | 469 | ||
470 | static void __exit bpck_exit(void) | 470 | static void __exit bpck_exit(void) |
471 | { | 471 | { |
472 | pi_unregister(&bpck); | 472 | paride_unregister(&bpck); |
473 | } | 473 | } |
474 | 474 | ||
475 | MODULE_LICENSE("GPL"); | 475 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/bpck6.c b/drivers/block/paride/bpck6.c index 41a237c5957d..ad124525ac23 100644 --- a/drivers/block/paride/bpck6.c +++ b/drivers/block/paride/bpck6.c | |||
@@ -31,10 +31,7 @@ static int verbose; /* set this to 1 to see debugging messages and whatnot */ | |||
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <asm/io.h> | 33 | #include <asm/io.h> |
34 | |||
35 | #if defined(CONFIG_PARPORT_MODULE)||defined(CONFIG_PARPORT) | ||
36 | #include <linux/parport.h> | 34 | #include <linux/parport.h> |
37 | #endif | ||
38 | 35 | ||
39 | #include "ppc6lnx.c" | 36 | #include "ppc6lnx.c" |
40 | #include "paride.h" | 37 | #include "paride.h" |
@@ -139,11 +136,6 @@ static int bpck6_test_port ( PIA *pi ) /* check for 8-bit port */ | |||
139 | PPCSTRUCT(pi)->ppc_id=pi->unit; | 136 | PPCSTRUCT(pi)->ppc_id=pi->unit; |
140 | PPCSTRUCT(pi)->lpt_addr=pi->port; | 137 | PPCSTRUCT(pi)->lpt_addr=pi->port; |
141 | 138 | ||
142 | #ifdef CONFIG_PARPORT_PC_MODULE | ||
143 | #define CONFIG_PARPORT_PC | ||
144 | #endif | ||
145 | |||
146 | #ifdef CONFIG_PARPORT_PC | ||
147 | /* look at the parport device to see if what modes we can use */ | 139 | /* look at the parport device to see if what modes we can use */ |
148 | if(((struct pardevice *)(pi->pardev))->port->modes & | 140 | if(((struct pardevice *)(pi->pardev))->port->modes & |
149 | (PARPORT_MODE_EPP) | 141 | (PARPORT_MODE_EPP) |
@@ -161,11 +153,6 @@ static int bpck6_test_port ( PIA *pi ) /* check for 8-bit port */ | |||
161 | { | 153 | { |
162 | return 1; | 154 | return 1; |
163 | } | 155 | } |
164 | #else | ||
165 | /* there is no way of knowing what kind of port we have | ||
166 | default to the highest mode possible */ | ||
167 | return 5; | ||
168 | #endif | ||
169 | } | 156 | } |
170 | 157 | ||
171 | static int bpck6_probe_unit ( PIA *pi ) | 158 | static int bpck6_probe_unit ( PIA *pi ) |
@@ -265,12 +252,12 @@ static int __init bpck6_init(void) | |||
265 | printk(KERN_INFO "bpck6: Copyright 2001 by Micro Solutions, Inc., DeKalb IL. USA\n"); | 252 | printk(KERN_INFO "bpck6: Copyright 2001 by Micro Solutions, Inc., DeKalb IL. USA\n"); |
266 | if(verbose) | 253 | if(verbose) |
267 | printk(KERN_DEBUG "bpck6: verbose debug enabled.\n"); | 254 | printk(KERN_DEBUG "bpck6: verbose debug enabled.\n"); |
268 | return pi_register(&bpck6) - 1; | 255 | return paride_register(&bpck6); |
269 | } | 256 | } |
270 | 257 | ||
271 | static void __exit bpck6_exit(void) | 258 | static void __exit bpck6_exit(void) |
272 | { | 259 | { |
273 | pi_unregister(&bpck6); | 260 | paride_unregister(&bpck6); |
274 | } | 261 | } |
275 | 262 | ||
276 | MODULE_LICENSE("GPL"); | 263 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/comm.c b/drivers/block/paride/comm.c index 43d61359d8ec..9bcd35495323 100644 --- a/drivers/block/paride/comm.c +++ b/drivers/block/paride/comm.c | |||
@@ -205,12 +205,12 @@ static struct pi_protocol comm = { | |||
205 | 205 | ||
206 | static int __init comm_init(void) | 206 | static int __init comm_init(void) |
207 | { | 207 | { |
208 | return pi_register(&comm)-1; | 208 | return paride_register(&comm); |
209 | } | 209 | } |
210 | 210 | ||
211 | static void __exit comm_exit(void) | 211 | static void __exit comm_exit(void) |
212 | { | 212 | { |
213 | pi_unregister(&comm); | 213 | paride_unregister(&comm); |
214 | } | 214 | } |
215 | 215 | ||
216 | MODULE_LICENSE("GPL"); | 216 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/dstr.c b/drivers/block/paride/dstr.c index 04d53bf58e8c..accc5c777cbb 100644 --- a/drivers/block/paride/dstr.c +++ b/drivers/block/paride/dstr.c | |||
@@ -220,12 +220,12 @@ static struct pi_protocol dstr = { | |||
220 | 220 | ||
221 | static int __init dstr_init(void) | 221 | static int __init dstr_init(void) |
222 | { | 222 | { |
223 | return pi_register(&dstr)-1; | 223 | return paride_register(&dstr); |
224 | } | 224 | } |
225 | 225 | ||
226 | static void __exit dstr_exit(void) | 226 | static void __exit dstr_exit(void) |
227 | { | 227 | { |
228 | pi_unregister(&dstr); | 228 | paride_unregister(&dstr); |
229 | } | 229 | } |
230 | 230 | ||
231 | MODULE_LICENSE("GPL"); | 231 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/epat.c b/drivers/block/paride/epat.c index 55d1c0a1fb90..1bcdff77322e 100644 --- a/drivers/block/paride/epat.c +++ b/drivers/block/paride/epat.c | |||
@@ -327,12 +327,12 @@ static int __init epat_init(void) | |||
327 | #ifdef CONFIG_PARIDE_EPATC8 | 327 | #ifdef CONFIG_PARIDE_EPATC8 |
328 | epatc8 = 1; | 328 | epatc8 = 1; |
329 | #endif | 329 | #endif |
330 | return pi_register(&epat)-1; | 330 | return paride_register(&epat); |
331 | } | 331 | } |
332 | 332 | ||
333 | static void __exit epat_exit(void) | 333 | static void __exit epat_exit(void) |
334 | { | 334 | { |
335 | pi_unregister(&epat); | 335 | paride_unregister(&epat); |
336 | } | 336 | } |
337 | 337 | ||
338 | MODULE_LICENSE("GPL"); | 338 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/epia.c b/drivers/block/paride/epia.c index 0f2e0c292d82..fb0e782d055e 100644 --- a/drivers/block/paride/epia.c +++ b/drivers/block/paride/epia.c | |||
@@ -303,12 +303,12 @@ static struct pi_protocol epia = { | |||
303 | 303 | ||
304 | static int __init epia_init(void) | 304 | static int __init epia_init(void) |
305 | { | 305 | { |
306 | return pi_register(&epia)-1; | 306 | return paride_register(&epia); |
307 | } | 307 | } |
308 | 308 | ||
309 | static void __exit epia_exit(void) | 309 | static void __exit epia_exit(void) |
310 | { | 310 | { |
311 | pi_unregister(&epia); | 311 | paride_unregister(&epia); |
312 | } | 312 | } |
313 | 313 | ||
314 | MODULE_LICENSE("GPL"); | 314 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/fit2.c b/drivers/block/paride/fit2.c index e0f0691d8bc2..381283753ae4 100644 --- a/drivers/block/paride/fit2.c +++ b/drivers/block/paride/fit2.c | |||
@@ -138,12 +138,12 @@ static struct pi_protocol fit2 = { | |||
138 | 138 | ||
139 | static int __init fit2_init(void) | 139 | static int __init fit2_init(void) |
140 | { | 140 | { |
141 | return pi_register(&fit2)-1; | 141 | return paride_register(&fit2); |
142 | } | 142 | } |
143 | 143 | ||
144 | static void __exit fit2_exit(void) | 144 | static void __exit fit2_exit(void) |
145 | { | 145 | { |
146 | pi_unregister(&fit2); | 146 | paride_unregister(&fit2); |
147 | } | 147 | } |
148 | 148 | ||
149 | MODULE_LICENSE("GPL"); | 149 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/fit3.c b/drivers/block/paride/fit3.c index 15400e7bc666..275d269458eb 100644 --- a/drivers/block/paride/fit3.c +++ b/drivers/block/paride/fit3.c | |||
@@ -198,12 +198,12 @@ static struct pi_protocol fit3 = { | |||
198 | 198 | ||
199 | static int __init fit3_init(void) | 199 | static int __init fit3_init(void) |
200 | { | 200 | { |
201 | return pi_register(&fit3)-1; | 201 | return paride_register(&fit3); |
202 | } | 202 | } |
203 | 203 | ||
204 | static void __exit fit3_exit(void) | 204 | static void __exit fit3_exit(void) |
205 | { | 205 | { |
206 | pi_unregister(&fit3); | 206 | paride_unregister(&fit3); |
207 | } | 207 | } |
208 | 208 | ||
209 | MODULE_LICENSE("GPL"); | 209 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/friq.c b/drivers/block/paride/friq.c index 5ea2904d2815..4f2ba244689b 100644 --- a/drivers/block/paride/friq.c +++ b/drivers/block/paride/friq.c | |||
@@ -263,12 +263,12 @@ static struct pi_protocol friq = { | |||
263 | 263 | ||
264 | static int __init friq_init(void) | 264 | static int __init friq_init(void) |
265 | { | 265 | { |
266 | return pi_register(&friq)-1; | 266 | return paride_register(&friq); |
267 | } | 267 | } |
268 | 268 | ||
269 | static void __exit friq_exit(void) | 269 | static void __exit friq_exit(void) |
270 | { | 270 | { |
271 | pi_unregister(&friq); | 271 | paride_unregister(&friq); |
272 | } | 272 | } |
273 | 273 | ||
274 | MODULE_LICENSE("GPL"); | 274 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/frpw.c b/drivers/block/paride/frpw.c index 56b3824b1538..c3cde364603a 100644 --- a/drivers/block/paride/frpw.c +++ b/drivers/block/paride/frpw.c | |||
@@ -300,12 +300,12 @@ static struct pi_protocol frpw = { | |||
300 | 300 | ||
301 | static int __init frpw_init(void) | 301 | static int __init frpw_init(void) |
302 | { | 302 | { |
303 | return pi_register(&frpw)-1; | 303 | return paride_register(&frpw); |
304 | } | 304 | } |
305 | 305 | ||
306 | static void __exit frpw_exit(void) | 306 | static void __exit frpw_exit(void) |
307 | { | 307 | { |
308 | pi_unregister(&frpw); | 308 | paride_unregister(&frpw); |
309 | } | 309 | } |
310 | 310 | ||
311 | MODULE_LICENSE("GPL"); | 311 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/jumbo b/drivers/block/paride/jumbo deleted file mode 100644 index e793b9cb7e72..000000000000 --- a/drivers/block/paride/jumbo +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # This script can be used to build "jumbo" modules that contain the | ||
4 | # base PARIDE support, one protocol module and one high-level driver. | ||
5 | # | ||
6 | echo -n "High level driver [pcd] : " | ||
7 | read X | ||
8 | HLD=${X:-pcd} | ||
9 | # | ||
10 | echo -n "Protocol module [bpck] : " | ||
11 | read X | ||
12 | PROTO=${X:-bpck} | ||
13 | # | ||
14 | echo -n "Use MODVERSIONS [y] ? " | ||
15 | read X | ||
16 | UMODV=${X:-y} | ||
17 | # | ||
18 | echo -n "For SMP kernel [n] ? " | ||
19 | read X | ||
20 | USMP=${X:-n} | ||
21 | # | ||
22 | echo -n "Support PARPORT [n] ? " | ||
23 | read X | ||
24 | UPARP=${X:-n} | ||
25 | # | ||
26 | echo | ||
27 | # | ||
28 | case $USMP in | ||
29 | y* | Y* ) FSMP="-DCONFIG_SMP" | ||
30 | ;; | ||
31 | *) FSMP="" | ||
32 | ;; | ||
33 | esac | ||
34 | # | ||
35 | MODI="-include ../../../include/linux/modversions.h" | ||
36 | # | ||
37 | case $UMODV in | ||
38 | y* | Y* ) FMODV="-DMODVERSIONS $MODI" | ||
39 | ;; | ||
40 | *) FMODV="" | ||
41 | ;; | ||
42 | esac | ||
43 | # | ||
44 | case $UPARP in | ||
45 | y* | Y* ) FPARP="-DCONFIG_PARPORT" | ||
46 | ;; | ||
47 | *) FPARP="" | ||
48 | ;; | ||
49 | esac | ||
50 | # | ||
51 | TARG=$HLD-$PROTO.o | ||
52 | FPROTO=-DCONFIG_PARIDE_`echo "$PROTO" | tr [a-z] [A-Z]` | ||
53 | FK="-D__KERNEL__ -I ../../../include" | ||
54 | FLCH=-D_LINUX_CONFIG_H | ||
55 | # | ||
56 | echo cc $FK $FSMP $FLCH $FPARP $FPROTO $FMODV -Wall -O2 -o Jb.o -c paride.c | ||
57 | cc $FK $FSMP $FLCH $FPARP $FPROTO $FMODV -Wall -O2 -o Jb.o -c paride.c | ||
58 | # | ||
59 | echo cc $FK $FSMP $FMODV -Wall -O2 -o Jp.o -c $PROTO.c | ||
60 | cc $FK $FSMP $FMODV -Wall -O2 -o Jp.o -c $PROTO.c | ||
61 | # | ||
62 | echo cc $FK $FSMP $FMODV -DMODULE -DPARIDE_JUMBO -Wall -O2 -o Jd.o -c $HLD.c | ||
63 | cc $FK $FSMP $FMODV -DMODULE -DPARIDE_JUMBO -Wall -O2 -o Jd.o -c $HLD.c | ||
64 | # | ||
65 | echo ld -r -o $TARG Jp.o Jb.o Jd.o | ||
66 | ld -r -o $TARG Jp.o Jb.o Jd.o | ||
67 | # | ||
68 | # | ||
69 | rm Jp.o Jb.o Jd.o | ||
70 | # | ||
diff --git a/drivers/block/paride/kbic.c b/drivers/block/paride/kbic.c index d983bcea76fe..35999c415ee3 100644 --- a/drivers/block/paride/kbic.c +++ b/drivers/block/paride/kbic.c | |||
@@ -283,13 +283,21 @@ static struct pi_protocol k971 = { | |||
283 | 283 | ||
284 | static int __init kbic_init(void) | 284 | static int __init kbic_init(void) |
285 | { | 285 | { |
286 | return (pi_register(&k951)||pi_register(&k971))-1; | 286 | int rv; |
287 | |||
288 | rv = paride_register(&k951); | ||
289 | if (rv < 0) | ||
290 | return rv; | ||
291 | rv = paride_register(&k971); | ||
292 | if (rv < 0) | ||
293 | paride_unregister(&k951); | ||
294 | return rv; | ||
287 | } | 295 | } |
288 | 296 | ||
289 | static void __exit kbic_exit(void) | 297 | static void __exit kbic_exit(void) |
290 | { | 298 | { |
291 | pi_unregister(&k951); | 299 | paride_unregister(&k951); |
292 | pi_unregister(&k971); | 300 | paride_unregister(&k971); |
293 | } | 301 | } |
294 | 302 | ||
295 | MODULE_LICENSE("GPL"); | 303 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/ktti.c b/drivers/block/paride/ktti.c index 6c7edbfba9a0..117ab0e8ccf0 100644 --- a/drivers/block/paride/ktti.c +++ b/drivers/block/paride/ktti.c | |||
@@ -115,12 +115,12 @@ static struct pi_protocol ktti = { | |||
115 | 115 | ||
116 | static int __init ktti_init(void) | 116 | static int __init ktti_init(void) |
117 | { | 117 | { |
118 | return pi_register(&ktti)-1; | 118 | return paride_register(&ktti); |
119 | } | 119 | } |
120 | 120 | ||
121 | static void __exit ktti_exit(void) | 121 | static void __exit ktti_exit(void) |
122 | { | 122 | { |
123 | pi_unregister(&ktti); | 123 | paride_unregister(&ktti); |
124 | } | 124 | } |
125 | 125 | ||
126 | MODULE_LICENSE("GPL"); | 126 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/on20.c b/drivers/block/paride/on20.c index 9f8e01096809..0173697a1a4d 100644 --- a/drivers/block/paride/on20.c +++ b/drivers/block/paride/on20.c | |||
@@ -140,12 +140,12 @@ static struct pi_protocol on20 = { | |||
140 | 140 | ||
141 | static int __init on20_init(void) | 141 | static int __init on20_init(void) |
142 | { | 142 | { |
143 | return pi_register(&on20)-1; | 143 | return paride_register(&on20); |
144 | } | 144 | } |
145 | 145 | ||
146 | static void __exit on20_exit(void) | 146 | static void __exit on20_exit(void) |
147 | { | 147 | { |
148 | pi_unregister(&on20); | 148 | paride_unregister(&on20); |
149 | } | 149 | } |
150 | 150 | ||
151 | MODULE_LICENSE("GPL"); | 151 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/on26.c b/drivers/block/paride/on26.c index 0f833caa2101..95ba256921f2 100644 --- a/drivers/block/paride/on26.c +++ b/drivers/block/paride/on26.c | |||
@@ -306,12 +306,12 @@ static struct pi_protocol on26 = { | |||
306 | 306 | ||
307 | static int __init on26_init(void) | 307 | static int __init on26_init(void) |
308 | { | 308 | { |
309 | return pi_register(&on26)-1; | 309 | return paride_register(&on26); |
310 | } | 310 | } |
311 | 311 | ||
312 | static void __exit on26_exit(void) | 312 | static void __exit on26_exit(void) |
313 | { | 313 | { |
314 | pi_unregister(&on26); | 314 | paride_unregister(&on26); |
315 | } | 315 | } |
316 | 316 | ||
317 | MODULE_LICENSE("GPL"); | 317 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c index 4b258f7836f3..48c50f11f63b 100644 --- a/drivers/block/paride/paride.c +++ b/drivers/block/paride/paride.c | |||
@@ -29,14 +29,7 @@ | |||
29 | #include <linux/spinlock.h> | 29 | #include <linux/spinlock.h> |
30 | #include <linux/wait.h> | 30 | #include <linux/wait.h> |
31 | #include <linux/sched.h> /* TASK_* */ | 31 | #include <linux/sched.h> /* TASK_* */ |
32 | |||
33 | #ifdef CONFIG_PARPORT_MODULE | ||
34 | #define CONFIG_PARPORT | ||
35 | #endif | ||
36 | |||
37 | #ifdef CONFIG_PARPORT | ||
38 | #include <linux/parport.h> | 32 | #include <linux/parport.h> |
39 | #endif | ||
40 | 33 | ||
41 | #include "paride.h" | 34 | #include "paride.h" |
42 | 35 | ||
@@ -76,8 +69,6 @@ void pi_read_block(PIA * pi, char *buf, int count) | |||
76 | 69 | ||
77 | EXPORT_SYMBOL(pi_read_block); | 70 | EXPORT_SYMBOL(pi_read_block); |
78 | 71 | ||
79 | #ifdef CONFIG_PARPORT | ||
80 | |||
81 | static void pi_wake_up(void *p) | 72 | static void pi_wake_up(void *p) |
82 | { | 73 | { |
83 | PIA *pi = (PIA *) p; | 74 | PIA *pi = (PIA *) p; |
@@ -100,11 +91,8 @@ static void pi_wake_up(void *p) | |||
100 | cont(); | 91 | cont(); |
101 | } | 92 | } |
102 | 93 | ||
103 | #endif | ||
104 | |||
105 | int pi_schedule_claimed(PIA * pi, void (*cont) (void)) | 94 | int pi_schedule_claimed(PIA * pi, void (*cont) (void)) |
106 | { | 95 | { |
107 | #ifdef CONFIG_PARPORT | ||
108 | unsigned long flags; | 96 | unsigned long flags; |
109 | 97 | ||
110 | spin_lock_irqsave(&pi_spinlock, flags); | 98 | spin_lock_irqsave(&pi_spinlock, flags); |
@@ -115,7 +103,6 @@ int pi_schedule_claimed(PIA * pi, void (*cont) (void)) | |||
115 | } | 103 | } |
116 | pi->claimed = 1; | 104 | pi->claimed = 1; |
117 | spin_unlock_irqrestore(&pi_spinlock, flags); | 105 | spin_unlock_irqrestore(&pi_spinlock, flags); |
118 | #endif | ||
119 | return 1; | 106 | return 1; |
120 | } | 107 | } |
121 | EXPORT_SYMBOL(pi_schedule_claimed); | 108 | EXPORT_SYMBOL(pi_schedule_claimed); |
@@ -133,20 +120,16 @@ static void pi_claim(PIA * pi) | |||
133 | if (pi->claimed) | 120 | if (pi->claimed) |
134 | return; | 121 | return; |
135 | pi->claimed = 1; | 122 | pi->claimed = 1; |
136 | #ifdef CONFIG_PARPORT | ||
137 | if (pi->pardev) | 123 | if (pi->pardev) |
138 | wait_event(pi->parq, | 124 | wait_event(pi->parq, |
139 | !parport_claim((struct pardevice *) pi->pardev)); | 125 | !parport_claim((struct pardevice *) pi->pardev)); |
140 | #endif | ||
141 | } | 126 | } |
142 | 127 | ||
143 | static void pi_unclaim(PIA * pi) | 128 | static void pi_unclaim(PIA * pi) |
144 | { | 129 | { |
145 | pi->claimed = 0; | 130 | pi->claimed = 0; |
146 | #ifdef CONFIG_PARPORT | ||
147 | if (pi->pardev) | 131 | if (pi->pardev) |
148 | parport_release((struct pardevice *) (pi->pardev)); | 132 | parport_release((struct pardevice *) (pi->pardev)); |
149 | #endif | ||
150 | } | 133 | } |
151 | 134 | ||
152 | void pi_connect(PIA * pi) | 135 | void pi_connect(PIA * pi) |
@@ -167,21 +150,15 @@ EXPORT_SYMBOL(pi_disconnect); | |||
167 | 150 | ||
168 | static void pi_unregister_parport(PIA * pi) | 151 | static void pi_unregister_parport(PIA * pi) |
169 | { | 152 | { |
170 | #ifdef CONFIG_PARPORT | ||
171 | if (pi->pardev) { | 153 | if (pi->pardev) { |
172 | parport_unregister_device((struct pardevice *) (pi->pardev)); | 154 | parport_unregister_device((struct pardevice *) (pi->pardev)); |
173 | pi->pardev = NULL; | 155 | pi->pardev = NULL; |
174 | } | 156 | } |
175 | #endif | ||
176 | } | 157 | } |
177 | 158 | ||
178 | void pi_release(PIA * pi) | 159 | void pi_release(PIA * pi) |
179 | { | 160 | { |
180 | pi_unregister_parport(pi); | 161 | pi_unregister_parport(pi); |
181 | #ifndef CONFIG_PARPORT | ||
182 | if (pi->reserved) | ||
183 | release_region(pi->port, pi->reserved); | ||
184 | #endif /* !CONFIG_PARPORT */ | ||
185 | if (pi->proto->release_proto) | 162 | if (pi->proto->release_proto) |
186 | pi->proto->release_proto(pi); | 163 | pi->proto->release_proto(pi); |
187 | module_put(pi->proto->owner); | 164 | module_put(pi->proto->owner); |
@@ -229,7 +206,7 @@ static int pi_test_proto(PIA * pi, char *scratch, int verbose) | |||
229 | return res; | 206 | return res; |
230 | } | 207 | } |
231 | 208 | ||
232 | int pi_register(PIP * pr) | 209 | int paride_register(PIP * pr) |
233 | { | 210 | { |
234 | int k; | 211 | int k; |
235 | 212 | ||
@@ -237,24 +214,24 @@ int pi_register(PIP * pr) | |||
237 | if (protocols[k] && !strcmp(pr->name, protocols[k]->name)) { | 214 | if (protocols[k] && !strcmp(pr->name, protocols[k]->name)) { |
238 | printk("paride: %s protocol already registered\n", | 215 | printk("paride: %s protocol already registered\n", |
239 | pr->name); | 216 | pr->name); |
240 | return 0; | 217 | return -1; |
241 | } | 218 | } |
242 | k = 0; | 219 | k = 0; |
243 | while ((k < MAX_PROTOS) && (protocols[k])) | 220 | while ((k < MAX_PROTOS) && (protocols[k])) |
244 | k++; | 221 | k++; |
245 | if (k == MAX_PROTOS) { | 222 | if (k == MAX_PROTOS) { |
246 | printk("paride: protocol table full\n"); | 223 | printk("paride: protocol table full\n"); |
247 | return 0; | 224 | return -1; |
248 | } | 225 | } |
249 | protocols[k] = pr; | 226 | protocols[k] = pr; |
250 | pr->index = k; | 227 | pr->index = k; |
251 | printk("paride: %s registered as protocol %d\n", pr->name, k); | 228 | printk("paride: %s registered as protocol %d\n", pr->name, k); |
252 | return 1; | 229 | return 0; |
253 | } | 230 | } |
254 | 231 | ||
255 | EXPORT_SYMBOL(pi_register); | 232 | EXPORT_SYMBOL(paride_register); |
256 | 233 | ||
257 | void pi_unregister(PIP * pr) | 234 | void paride_unregister(PIP * pr) |
258 | { | 235 | { |
259 | if (!pr) | 236 | if (!pr) |
260 | return; | 237 | return; |
@@ -265,12 +242,10 @@ void pi_unregister(PIP * pr) | |||
265 | protocols[pr->index] = NULL; | 242 | protocols[pr->index] = NULL; |
266 | } | 243 | } |
267 | 244 | ||
268 | EXPORT_SYMBOL(pi_unregister); | 245 | EXPORT_SYMBOL(paride_unregister); |
269 | 246 | ||
270 | static int pi_register_parport(PIA * pi, int verbose) | 247 | static int pi_register_parport(PIA * pi, int verbose) |
271 | { | 248 | { |
272 | #ifdef CONFIG_PARPORT | ||
273 | |||
274 | struct parport *port; | 249 | struct parport *port; |
275 | 250 | ||
276 | port = parport_find_base(pi->port); | 251 | port = parport_find_base(pi->port); |
@@ -290,7 +265,6 @@ static int pi_register_parport(PIA * pi, int verbose) | |||
290 | printk("%s: 0x%x is %s\n", pi->device, pi->port, port->name); | 265 | printk("%s: 0x%x is %s\n", pi->device, pi->port, port->name); |
291 | 266 | ||
292 | pi->parname = (char *) port->name; | 267 | pi->parname = (char *) port->name; |
293 | #endif | ||
294 | 268 | ||
295 | return 1; | 269 | return 1; |
296 | } | 270 | } |
@@ -447,13 +421,6 @@ int pi_init(PIA * pi, int autoprobe, int port, int mode, | |||
447 | printk("%s: Adapter not found\n", device); | 421 | printk("%s: Adapter not found\n", device); |
448 | return 0; | 422 | return 0; |
449 | } | 423 | } |
450 | #ifndef CONFIG_PARPORT | ||
451 | if (!request_region(pi->port, pi->reserved, pi->device)) { | ||
452 | printk(KERN_WARNING "paride: Unable to request region 0x%x\n", | ||
453 | pi->port); | ||
454 | return 0; | ||
455 | } | ||
456 | #endif /* !CONFIG_PARPORT */ | ||
457 | 424 | ||
458 | if (pi->parname) | 425 | if (pi->parname) |
459 | printk("%s: Sharing %s at 0x%x\n", pi->device, | 426 | printk("%s: Sharing %s at 0x%x\n", pi->device, |
diff --git a/drivers/block/paride/paride.h b/drivers/block/paride/paride.h index c6d98ef09e48..2bddbf45518b 100644 --- a/drivers/block/paride/paride.h +++ b/drivers/block/paride/paride.h | |||
@@ -163,8 +163,8 @@ struct pi_protocol { | |||
163 | 163 | ||
164 | typedef struct pi_protocol PIP; | 164 | typedef struct pi_protocol PIP; |
165 | 165 | ||
166 | extern int pi_register( PIP * ); | 166 | extern int paride_register( PIP * ); |
167 | extern void pi_unregister ( PIP * ); | 167 | extern void paride_unregister ( PIP * ); |
168 | 168 | ||
169 | #endif /* __DRIVERS_PARIDE_H__ */ | 169 | #endif /* __DRIVERS_PARIDE_H__ */ |
170 | /* end of paride.h */ | 170 | /* end of paride.h */ |
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index ac5ba462710b..c852eed91e4b 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c | |||
@@ -912,12 +912,12 @@ static int __init pcd_init(void) | |||
912 | int unit; | 912 | int unit; |
913 | 913 | ||
914 | if (disable) | 914 | if (disable) |
915 | return -1; | 915 | return -EINVAL; |
916 | 916 | ||
917 | pcd_init_units(); | 917 | pcd_init_units(); |
918 | 918 | ||
919 | if (pcd_detect()) | 919 | if (pcd_detect()) |
920 | return -1; | 920 | return -ENODEV; |
921 | 921 | ||
922 | /* get the atapi capabilities page */ | 922 | /* get the atapi capabilities page */ |
923 | pcd_probe_capabilities(); | 923 | pcd_probe_capabilities(); |
@@ -925,7 +925,7 @@ static int __init pcd_init(void) | |||
925 | if (register_blkdev(major, name)) { | 925 | if (register_blkdev(major, name)) { |
926 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) | 926 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) |
927 | put_disk(cd->disk); | 927 | put_disk(cd->disk); |
928 | return -1; | 928 | return -EBUSY; |
929 | } | 929 | } |
930 | 930 | ||
931 | pcd_queue = blk_init_queue(do_pcd_request, &pcd_lock); | 931 | pcd_queue = blk_init_queue(do_pcd_request, &pcd_lock); |
@@ -933,7 +933,7 @@ static int __init pcd_init(void) | |||
933 | unregister_blkdev(major, name); | 933 | unregister_blkdev(major, name); |
934 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) | 934 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) |
935 | put_disk(cd->disk); | 935 | put_disk(cd->disk); |
936 | return -1; | 936 | return -ENOMEM; |
937 | } | 937 | } |
938 | 938 | ||
939 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) { | 939 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) { |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index 1a9dee19efcf..7cdaa1951260 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -933,25 +933,25 @@ static int __init pf_init(void) | |||
933 | int unit; | 933 | int unit; |
934 | 934 | ||
935 | if (disable) | 935 | if (disable) |
936 | return -1; | 936 | return -EINVAL; |
937 | 937 | ||
938 | pf_init_units(); | 938 | pf_init_units(); |
939 | 939 | ||
940 | if (pf_detect()) | 940 | if (pf_detect()) |
941 | return -1; | 941 | return -ENODEV; |
942 | pf_busy = 0; | 942 | pf_busy = 0; |
943 | 943 | ||
944 | if (register_blkdev(major, name)) { | 944 | if (register_blkdev(major, name)) { |
945 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) | 945 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) |
946 | put_disk(pf->disk); | 946 | put_disk(pf->disk); |
947 | return -1; | 947 | return -EBUSY; |
948 | } | 948 | } |
949 | pf_queue = blk_init_queue(do_pf_request, &pf_spin_lock); | 949 | pf_queue = blk_init_queue(do_pf_request, &pf_spin_lock); |
950 | if (!pf_queue) { | 950 | if (!pf_queue) { |
951 | unregister_blkdev(major, name); | 951 | unregister_blkdev(major, name); |
952 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) | 952 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) |
953 | put_disk(pf->disk); | 953 | put_disk(pf->disk); |
954 | return -1; | 954 | return -ENOMEM; |
955 | } | 955 | } |
956 | 956 | ||
957 | blk_queue_max_phys_segments(pf_queue, cluster); | 957 | blk_queue_max_phys_segments(pf_queue, cluster); |
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 13f998aa1cd3..9970aedbb5d9 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
@@ -646,14 +646,14 @@ static int __init pg_init(void) | |||
646 | int err; | 646 | int err; |
647 | 647 | ||
648 | if (disable){ | 648 | if (disable){ |
649 | err = -1; | 649 | err = -EINVAL; |
650 | goto out; | 650 | goto out; |
651 | } | 651 | } |
652 | 652 | ||
653 | pg_init_units(); | 653 | pg_init_units(); |
654 | 654 | ||
655 | if (pg_detect()) { | 655 | if (pg_detect()) { |
656 | err = -1; | 656 | err = -ENODEV; |
657 | goto out; | 657 | goto out; |
658 | } | 658 | } |
659 | 659 | ||
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index 35fb26636721..c902b25e4869 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c | |||
@@ -946,12 +946,12 @@ static int __init pt_init(void) | |||
946 | int err; | 946 | int err; |
947 | 947 | ||
948 | if (disable) { | 948 | if (disable) { |
949 | err = -1; | 949 | err = -EINVAL; |
950 | goto out; | 950 | goto out; |
951 | } | 951 | } |
952 | 952 | ||
953 | if (pt_detect()) { | 953 | if (pt_detect()) { |
954 | err = -1; | 954 | err = -ENODEV; |
955 | goto out; | 955 | goto out; |
956 | } | 956 | } |
957 | 957 | ||
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index f2904f67af47..e45eaa264119 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #include <linux/proc_fs.h> | 54 | #include <linux/proc_fs.h> |
55 | #include <linux/seq_file.h> | 55 | #include <linux/seq_file.h> |
56 | #include <linux/miscdevice.h> | 56 | #include <linux/miscdevice.h> |
57 | #include <linux/suspend.h> | 57 | #include <linux/freezer.h> |
58 | #include <linux/mutex.h> | 58 | #include <linux/mutex.h> |
59 | #include <scsi/scsi_cmnd.h> | 59 | #include <scsi/scsi_cmnd.h> |
60 | #include <scsi/scsi_ioctl.h> | 60 | #include <scsi/scsi_ioctl.h> |
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c index d0cface535fb..5e2c31882003 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c | |||
@@ -330,7 +330,7 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu) | |||
330 | reliable packet if the number of packets sent but not yet ack'ed | 330 | reliable packet if the number of packets sent but not yet ack'ed |
331 | is < than the winsize */ | 331 | is < than the winsize */ |
332 | 332 | ||
333 | spin_lock_irqsave(&bcsp->unack.lock, flags); | 333 | spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING); |
334 | 334 | ||
335 | if (bcsp->unack.qlen < BCSP_TXWINSIZE && (skb = skb_dequeue(&bcsp->rel)) != NULL) { | 335 | if (bcsp->unack.qlen < BCSP_TXWINSIZE && (skb = skb_dequeue(&bcsp->rel)) != NULL) { |
336 | struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type); | 336 | struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type); |
@@ -696,7 +696,7 @@ static void bcsp_timed_event(unsigned long arg) | |||
696 | 696 | ||
697 | BT_DBG("hu %p retransmitting %u pkts", hu, bcsp->unack.qlen); | 697 | BT_DBG("hu %p retransmitting %u pkts", hu, bcsp->unack.qlen); |
698 | 698 | ||
699 | spin_lock_irqsave(&bcsp->unack.lock, flags); | 699 | spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING); |
700 | 700 | ||
701 | while ((skb = __skb_dequeue_tail(&bcsp->unack)) != NULL) { | 701 | while ((skb = __skb_dequeue_tail(&bcsp->unack)) != NULL) { |
702 | bcsp->msgq_txseq = (bcsp->msgq_txseq - 1) & 0x07; | 702 | bcsp->msgq_txseq = (bcsp->msgq_txseq - 1) & 0x07; |
diff --git a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c index 25032d7edc55..3541690a77d4 100644 --- a/drivers/cdrom/optcd.c +++ b/drivers/cdrom/optcd.c | |||
@@ -101,7 +101,7 @@ static void debug(int debug_this, const char* fmt, ...) | |||
101 | return; | 101 | return; |
102 | 102 | ||
103 | va_start(args, fmt); | 103 | va_start(args, fmt); |
104 | vsprintf(s, fmt, args); | 104 | vsnprintf(s, sizeof(s), fmt, args); |
105 | printk(KERN_DEBUG "optcd: %s\n", s); | 105 | printk(KERN_DEBUG "optcd: %s\n", s); |
106 | va_end(args); | 106 | va_end(args); |
107 | } | 107 | } |
diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index ba50e5a712f2..a1283b1ef989 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c | |||
@@ -770,11 +770,10 @@ static void msg(int level, const char *fmt, ...) | |||
770 | 770 | ||
771 | msgnum++; | 771 | msgnum++; |
772 | if (msgnum>99) msgnum=0; | 772 | if (msgnum>99) msgnum=0; |
773 | sprintf(buf, MSG_LEVEL "%s-%d [%02d]: ", major_name, current_drive - D_S, msgnum); | ||
774 | va_start(args, fmt); | 773 | va_start(args, fmt); |
775 | vsprintf(&buf[18], fmt, args); | 774 | vsnprintf(buf, sizeof(buf), fmt, args); |
776 | va_end(args); | 775 | va_end(args); |
777 | printk(buf); | 776 | printk(MSG_LEVEL "%s-%d [%02d]: %s", major_name, current_drive - D_S, msgnum, buf); |
778 | #if KLOGD_PAUSE | 777 | #if KLOGD_PAUSE |
779 | sbp_sleep(KLOGD_PAUSE); /* else messages get lost */ | 778 | sbp_sleep(KLOGD_PAUSE); /* else messages get lost */ |
780 | #endif /* KLOGD_PAUSE */ | 779 | #endif /* KLOGD_PAUSE */ |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 00b17ae39736..2f2c4efff8a3 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -459,7 +459,7 @@ static const struct aper_size_info_32 nforce3_sizes[5] = | |||
459 | 459 | ||
460 | /* Handle shadow device of the Nvidia NForce3 */ | 460 | /* Handle shadow device of the Nvidia NForce3 */ |
461 | /* CHECK-ME original 2.4 version set up some IORRs. Check if that is needed. */ | 461 | /* CHECK-ME original 2.4 version set up some IORRs. Check if that is needed. */ |
462 | static int __devinit nforce3_agp_init(struct pci_dev *pdev) | 462 | static int nforce3_agp_init(struct pci_dev *pdev) |
463 | { | 463 | { |
464 | u32 tmp, apbase, apbar, aplimit; | 464 | u32 tmp, apbase, apbar, aplimit; |
465 | struct pci_dev *dev1; | 465 | struct pci_dev *dev1; |
diff --git a/drivers/char/decserial.c b/drivers/char/decserial.c index 85f404e25c73..8ea2bea2b183 100644 --- a/drivers/char/decserial.c +++ b/drivers/char/decserial.c | |||
@@ -23,20 +23,12 @@ | |||
23 | extern int zs_init(void); | 23 | extern int zs_init(void); |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #ifdef CONFIG_DZ | ||
27 | extern int dz_init(void); | ||
28 | #endif | ||
29 | |||
30 | #ifdef CONFIG_SERIAL_CONSOLE | 26 | #ifdef CONFIG_SERIAL_CONSOLE |
31 | 27 | ||
32 | #ifdef CONFIG_ZS | 28 | #ifdef CONFIG_ZS |
33 | extern void zs_serial_console_init(void); | 29 | extern void zs_serial_console_init(void); |
34 | #endif | 30 | #endif |
35 | 31 | ||
36 | #ifdef CONFIG_DZ | ||
37 | extern void dz_serial_console_init(void); | ||
38 | #endif | ||
39 | |||
40 | #endif | 32 | #endif |
41 | 33 | ||
42 | /* rs_init - starts up the serial interface - | 34 | /* rs_init - starts up the serial interface - |
@@ -46,23 +38,11 @@ extern void dz_serial_console_init(void); | |||
46 | 38 | ||
47 | int __init rs_init(void) | 39 | int __init rs_init(void) |
48 | { | 40 | { |
49 | 41 | #ifdef CONFIG_ZS | |
50 | #if defined(CONFIG_ZS) && defined(CONFIG_DZ) | ||
51 | if (IOASIC) | 42 | if (IOASIC) |
52 | return zs_init(); | 43 | return zs_init(); |
53 | else | ||
54 | return dz_init(); | ||
55 | #else | ||
56 | |||
57 | #ifdef CONFIG_ZS | ||
58 | return zs_init(); | ||
59 | #endif | ||
60 | |||
61 | #ifdef CONFIG_DZ | ||
62 | return dz_init(); | ||
63 | #endif | ||
64 | |||
65 | #endif | 44 | #endif |
45 | return -ENXIO; | ||
66 | } | 46 | } |
67 | 47 | ||
68 | __initcall(rs_init); | 48 | __initcall(rs_init); |
@@ -76,21 +56,9 @@ __initcall(rs_init); | |||
76 | */ | 56 | */ |
77 | static int __init decserial_console_init(void) | 57 | static int __init decserial_console_init(void) |
78 | { | 58 | { |
79 | #if defined(CONFIG_ZS) && defined(CONFIG_DZ) | 59 | #ifdef CONFIG_ZS |
80 | if (IOASIC) | 60 | if (IOASIC) |
81 | zs_serial_console_init(); | 61 | zs_serial_console_init(); |
82 | else | ||
83 | dz_serial_console_init(); | ||
84 | #else | ||
85 | |||
86 | #ifdef CONFIG_ZS | ||
87 | zs_serial_console_init(); | ||
88 | #endif | ||
89 | |||
90 | #ifdef CONFIG_DZ | ||
91 | dz_serial_console_init(); | ||
92 | #endif | ||
93 | |||
94 | #endif | 62 | #endif |
95 | return 0; | 63 | return 0; |
96 | } | 64 | } |
diff --git a/drivers/char/drm/drm_sman.c b/drivers/char/drm/drm_sman.c index 425c82336ee0..19c81d2e13d0 100644 --- a/drivers/char/drm/drm_sman.c +++ b/drivers/char/drm/drm_sman.c | |||
@@ -162,6 +162,7 @@ drm_sman_set_manager(drm_sman_t * sman, unsigned int manager, | |||
162 | 162 | ||
163 | return 0; | 163 | return 0; |
164 | } | 164 | } |
165 | EXPORT_SYMBOL(drm_sman_set_manager); | ||
165 | 166 | ||
166 | static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman, | 167 | static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman, |
167 | unsigned long owner) | 168 | unsigned long owner) |
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c index b40ae438f531..ae2691942ddb 100644 --- a/drivers/char/drm/drm_vm.c +++ b/drivers/char/drm/drm_vm.c | |||
@@ -147,14 +147,14 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, | |||
147 | if (address > vma->vm_end) | 147 | if (address > vma->vm_end) |
148 | return NOPAGE_SIGBUS; /* Disallow mremap */ | 148 | return NOPAGE_SIGBUS; /* Disallow mremap */ |
149 | if (!map) | 149 | if (!map) |
150 | return NOPAGE_OOM; /* Nothing allocated */ | 150 | return NOPAGE_SIGBUS; /* Nothing allocated */ |
151 | 151 | ||
152 | offset = address - vma->vm_start; | 152 | offset = address - vma->vm_start; |
153 | i = (unsigned long)map->handle + offset; | 153 | i = (unsigned long)map->handle + offset; |
154 | page = (map->type == _DRM_CONSISTENT) ? | 154 | page = (map->type == _DRM_CONSISTENT) ? |
155 | virt_to_page((void *)i) : vmalloc_to_page((void *)i); | 155 | virt_to_page((void *)i) : vmalloc_to_page((void *)i); |
156 | if (!page) | 156 | if (!page) |
157 | return NOPAGE_OOM; | 157 | return NOPAGE_SIGBUS; |
158 | get_page(page); | 158 | get_page(page); |
159 | 159 | ||
160 | DRM_DEBUG("shm_nopage 0x%lx\n", address); | 160 | DRM_DEBUG("shm_nopage 0x%lx\n", address); |
@@ -272,7 +272,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, | |||
272 | if (address > vma->vm_end) | 272 | if (address > vma->vm_end) |
273 | return NOPAGE_SIGBUS; /* Disallow mremap */ | 273 | return NOPAGE_SIGBUS; /* Disallow mremap */ |
274 | if (!dma->pagelist) | 274 | if (!dma->pagelist) |
275 | return NOPAGE_OOM; /* Nothing allocated */ | 275 | return NOPAGE_SIGBUS; /* Nothing allocated */ |
276 | 276 | ||
277 | offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ | 277 | offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ |
278 | page_nr = offset >> PAGE_SHIFT; | 278 | page_nr = offset >> PAGE_SHIFT; |
@@ -310,7 +310,7 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma, | |||
310 | if (address > vma->vm_end) | 310 | if (address > vma->vm_end) |
311 | return NOPAGE_SIGBUS; /* Disallow mremap */ | 311 | return NOPAGE_SIGBUS; /* Disallow mremap */ |
312 | if (!entry->pagelist) | 312 | if (!entry->pagelist) |
313 | return NOPAGE_OOM; /* Nothing allocated */ | 313 | return NOPAGE_SIGBUS; /* Nothing allocated */ |
314 | 314 | ||
315 | offset = address - vma->vm_start; | 315 | offset = address - vma->vm_start; |
316 | map_offset = map->offset - (unsigned long)dev->sg->virtual; | 316 | map_offset = map->offset - (unsigned long)dev->sg->virtual; |
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 9902ffad3b12..cc2cd46bedc6 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
39 | #include <linux/spinlock.h> | 39 | #include <linux/spinlock.h> |
40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
41 | #include <linux/freezer.h> | ||
41 | 42 | ||
42 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
43 | 44 | ||
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index 8728255c9463..d090622f1dea 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c | |||
@@ -337,11 +337,6 @@ static int hvcs_open(struct tty_struct *tty, struct file *filp); | |||
337 | static void hvcs_close(struct tty_struct *tty, struct file *filp); | 337 | static void hvcs_close(struct tty_struct *tty, struct file *filp); |
338 | static void hvcs_hangup(struct tty_struct * tty); | 338 | static void hvcs_hangup(struct tty_struct * tty); |
339 | 339 | ||
340 | static void hvcs_create_device_attrs(struct hvcs_struct *hvcsd); | ||
341 | static void hvcs_remove_device_attrs(struct vio_dev *vdev); | ||
342 | static void hvcs_create_driver_attrs(void); | ||
343 | static void hvcs_remove_driver_attrs(void); | ||
344 | |||
345 | static int __devinit hvcs_probe(struct vio_dev *dev, | 340 | static int __devinit hvcs_probe(struct vio_dev *dev, |
346 | const struct vio_device_id *id); | 341 | const struct vio_device_id *id); |
347 | static int __devexit hvcs_remove(struct vio_dev *dev); | 342 | static int __devexit hvcs_remove(struct vio_dev *dev); |
@@ -353,6 +348,172 @@ static void __exit hvcs_module_exit(void); | |||
353 | #define HVCS_TRY_WRITE 0x00000004 | 348 | #define HVCS_TRY_WRITE 0x00000004 |
354 | #define HVCS_READ_MASK (HVCS_SCHED_READ | HVCS_QUICK_READ) | 349 | #define HVCS_READ_MASK (HVCS_SCHED_READ | HVCS_QUICK_READ) |
355 | 350 | ||
351 | static inline struct hvcs_struct *from_vio_dev(struct vio_dev *viod) | ||
352 | { | ||
353 | return viod->dev.driver_data; | ||
354 | } | ||
355 | /* The sysfs interface for the driver and devices */ | ||
356 | |||
357 | static ssize_t hvcs_partner_vtys_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
358 | { | ||
359 | struct vio_dev *viod = to_vio_dev(dev); | ||
360 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
361 | unsigned long flags; | ||
362 | int retval; | ||
363 | |||
364 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
365 | retval = sprintf(buf, "%X\n", hvcsd->p_unit_address); | ||
366 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
367 | return retval; | ||
368 | } | ||
369 | static DEVICE_ATTR(partner_vtys, S_IRUGO, hvcs_partner_vtys_show, NULL); | ||
370 | |||
371 | static ssize_t hvcs_partner_clcs_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
372 | { | ||
373 | struct vio_dev *viod = to_vio_dev(dev); | ||
374 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
375 | unsigned long flags; | ||
376 | int retval; | ||
377 | |||
378 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
379 | retval = sprintf(buf, "%s\n", &hvcsd->p_location_code[0]); | ||
380 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
381 | return retval; | ||
382 | } | ||
383 | static DEVICE_ATTR(partner_clcs, S_IRUGO, hvcs_partner_clcs_show, NULL); | ||
384 | |||
385 | static ssize_t hvcs_current_vty_store(struct device *dev, struct device_attribute *attr, const char * buf, | ||
386 | size_t count) | ||
387 | { | ||
388 | /* | ||
389 | * Don't need this feature at the present time because firmware doesn't | ||
390 | * yet support multiple partners. | ||
391 | */ | ||
392 | printk(KERN_INFO "HVCS: Denied current_vty change: -EPERM.\n"); | ||
393 | return -EPERM; | ||
394 | } | ||
395 | |||
396 | static ssize_t hvcs_current_vty_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
397 | { | ||
398 | struct vio_dev *viod = to_vio_dev(dev); | ||
399 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
400 | unsigned long flags; | ||
401 | int retval; | ||
402 | |||
403 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
404 | retval = sprintf(buf, "%s\n", &hvcsd->p_location_code[0]); | ||
405 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
406 | return retval; | ||
407 | } | ||
408 | |||
409 | static DEVICE_ATTR(current_vty, | ||
410 | S_IRUGO | S_IWUSR, hvcs_current_vty_show, hvcs_current_vty_store); | ||
411 | |||
412 | static ssize_t hvcs_vterm_state_store(struct device *dev, struct device_attribute *attr, const char *buf, | ||
413 | size_t count) | ||
414 | { | ||
415 | struct vio_dev *viod = to_vio_dev(dev); | ||
416 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
417 | unsigned long flags; | ||
418 | |||
419 | /* writing a '0' to this sysfs entry will result in the disconnect. */ | ||
420 | if (simple_strtol(buf, NULL, 0) != 0) | ||
421 | return -EINVAL; | ||
422 | |||
423 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
424 | |||
425 | if (hvcsd->open_count > 0) { | ||
426 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
427 | printk(KERN_INFO "HVCS: vterm state unchanged. " | ||
428 | "The hvcs device node is still in use.\n"); | ||
429 | return -EPERM; | ||
430 | } | ||
431 | |||
432 | if (hvcsd->connected == 0) { | ||
433 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
434 | printk(KERN_INFO "HVCS: vterm state unchanged. The" | ||
435 | " vty-server is not connected to a vty.\n"); | ||
436 | return -EPERM; | ||
437 | } | ||
438 | |||
439 | hvcs_partner_free(hvcsd); | ||
440 | printk(KERN_INFO "HVCS: Closed vty-server@%X and" | ||
441 | " partner vty@%X:%d connection.\n", | ||
442 | hvcsd->vdev->unit_address, | ||
443 | hvcsd->p_unit_address, | ||
444 | (uint32_t)hvcsd->p_partition_ID); | ||
445 | |||
446 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
447 | return count; | ||
448 | } | ||
449 | |||
450 | static ssize_t hvcs_vterm_state_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
451 | { | ||
452 | struct vio_dev *viod = to_vio_dev(dev); | ||
453 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
454 | unsigned long flags; | ||
455 | int retval; | ||
456 | |||
457 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
458 | retval = sprintf(buf, "%d\n", hvcsd->connected); | ||
459 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
460 | return retval; | ||
461 | } | ||
462 | static DEVICE_ATTR(vterm_state, S_IRUGO | S_IWUSR, | ||
463 | hvcs_vterm_state_show, hvcs_vterm_state_store); | ||
464 | |||
465 | static ssize_t hvcs_index_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
466 | { | ||
467 | struct vio_dev *viod = to_vio_dev(dev); | ||
468 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
469 | unsigned long flags; | ||
470 | int retval; | ||
471 | |||
472 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
473 | retval = sprintf(buf, "%d\n", hvcsd->index); | ||
474 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
475 | return retval; | ||
476 | } | ||
477 | |||
478 | static DEVICE_ATTR(index, S_IRUGO, hvcs_index_show, NULL); | ||
479 | |||
480 | static struct attribute *hvcs_attrs[] = { | ||
481 | &dev_attr_partner_vtys.attr, | ||
482 | &dev_attr_partner_clcs.attr, | ||
483 | &dev_attr_current_vty.attr, | ||
484 | &dev_attr_vterm_state.attr, | ||
485 | &dev_attr_index.attr, | ||
486 | NULL, | ||
487 | }; | ||
488 | |||
489 | static struct attribute_group hvcs_attr_group = { | ||
490 | .attrs = hvcs_attrs, | ||
491 | }; | ||
492 | |||
493 | static ssize_t hvcs_rescan_show(struct device_driver *ddp, char *buf) | ||
494 | { | ||
495 | /* A 1 means it is updating, a 0 means it is done updating */ | ||
496 | return snprintf(buf, PAGE_SIZE, "%d\n", hvcs_rescan_status); | ||
497 | } | ||
498 | |||
499 | static ssize_t hvcs_rescan_store(struct device_driver *ddp, const char * buf, | ||
500 | size_t count) | ||
501 | { | ||
502 | if ((simple_strtol(buf, NULL, 0) != 1) | ||
503 | && (hvcs_rescan_status != 0)) | ||
504 | return -EINVAL; | ||
505 | |||
506 | hvcs_rescan_status = 1; | ||
507 | printk(KERN_INFO "HVCS: rescanning partner info for all" | ||
508 | " vty-servers.\n"); | ||
509 | hvcs_rescan_devices_list(); | ||
510 | hvcs_rescan_status = 0; | ||
511 | return count; | ||
512 | } | ||
513 | |||
514 | static DRIVER_ATTR(rescan, | ||
515 | S_IRUGO | S_IWUSR, hvcs_rescan_show, hvcs_rescan_store); | ||
516 | |||
356 | static void hvcs_kick(void) | 517 | static void hvcs_kick(void) |
357 | { | 518 | { |
358 | hvcs_kicked = 1; | 519 | hvcs_kicked = 1; |
@@ -575,7 +736,7 @@ static void destroy_hvcs_struct(struct kobject *kobj) | |||
575 | spin_unlock_irqrestore(&hvcsd->lock, flags); | 736 | spin_unlock_irqrestore(&hvcsd->lock, flags); |
576 | spin_unlock(&hvcs_structs_lock); | 737 | spin_unlock(&hvcs_structs_lock); |
577 | 738 | ||
578 | hvcs_remove_device_attrs(vdev); | 739 | sysfs_remove_group(&vdev->dev.kobj, &hvcs_attr_group); |
579 | 740 | ||
580 | kfree(hvcsd); | 741 | kfree(hvcsd); |
581 | } | 742 | } |
@@ -608,6 +769,7 @@ static int __devinit hvcs_probe( | |||
608 | { | 769 | { |
609 | struct hvcs_struct *hvcsd; | 770 | struct hvcs_struct *hvcsd; |
610 | int index; | 771 | int index; |
772 | int retval; | ||
611 | 773 | ||
612 | if (!dev || !id) { | 774 | if (!dev || !id) { |
613 | printk(KERN_ERR "HVCS: probed with invalid parameter.\n"); | 775 | printk(KERN_ERR "HVCS: probed with invalid parameter.\n"); |
@@ -658,14 +820,16 @@ static int __devinit hvcs_probe( | |||
658 | * the hvcs_struct has been added to the devices list then the user app | 820 | * the hvcs_struct has been added to the devices list then the user app |
659 | * will get -ENODEV. | 821 | * will get -ENODEV. |
660 | */ | 822 | */ |
661 | |||
662 | spin_lock(&hvcs_structs_lock); | 823 | spin_lock(&hvcs_structs_lock); |
663 | |||
664 | list_add_tail(&(hvcsd->next), &hvcs_structs); | 824 | list_add_tail(&(hvcsd->next), &hvcs_structs); |
665 | |||
666 | spin_unlock(&hvcs_structs_lock); | 825 | spin_unlock(&hvcs_structs_lock); |
667 | 826 | ||
668 | hvcs_create_device_attrs(hvcsd); | 827 | retval = sysfs_create_group(&dev->dev.kobj, &hvcs_attr_group); |
828 | if (retval) { | ||
829 | printk(KERN_ERR "HVCS: Can't create sysfs attrs for vty-server@%X\n", | ||
830 | hvcsd->vdev->unit_address); | ||
831 | return retval; | ||
832 | } | ||
669 | 833 | ||
670 | printk(KERN_INFO "HVCS: vty-server@%X added to the vio bus.\n", dev->unit_address); | 834 | printk(KERN_INFO "HVCS: vty-server@%X added to the vio bus.\n", dev->unit_address); |
671 | 835 | ||
@@ -1354,8 +1518,10 @@ static int __init hvcs_module_init(void) | |||
1354 | if (!hvcs_tty_driver) | 1518 | if (!hvcs_tty_driver) |
1355 | return -ENOMEM; | 1519 | return -ENOMEM; |
1356 | 1520 | ||
1357 | if (hvcs_alloc_index_list(num_ttys_to_alloc)) | 1521 | if (hvcs_alloc_index_list(num_ttys_to_alloc)) { |
1358 | return -ENOMEM; | 1522 | rc = -ENOMEM; |
1523 | goto index_fail; | ||
1524 | } | ||
1359 | 1525 | ||
1360 | hvcs_tty_driver->owner = THIS_MODULE; | 1526 | hvcs_tty_driver->owner = THIS_MODULE; |
1361 | 1527 | ||
@@ -1385,41 +1551,57 @@ static int __init hvcs_module_init(void) | |||
1385 | * dynamically assigned major and minor numbers for our devices. | 1551 | * dynamically assigned major and minor numbers for our devices. |
1386 | */ | 1552 | */ |
1387 | if (tty_register_driver(hvcs_tty_driver)) { | 1553 | if (tty_register_driver(hvcs_tty_driver)) { |
1388 | printk(KERN_ERR "HVCS: registration " | 1554 | printk(KERN_ERR "HVCS: registration as a tty driver failed.\n"); |
1389 | " as a tty driver failed.\n"); | 1555 | rc = -EIO; |
1390 | hvcs_free_index_list(); | 1556 | goto register_fail; |
1391 | put_tty_driver(hvcs_tty_driver); | ||
1392 | return -EIO; | ||
1393 | } | 1557 | } |
1394 | 1558 | ||
1395 | hvcs_pi_buff = kmalloc(PAGE_SIZE, GFP_KERNEL); | 1559 | hvcs_pi_buff = kmalloc(PAGE_SIZE, GFP_KERNEL); |
1396 | if (!hvcs_pi_buff) { | 1560 | if (!hvcs_pi_buff) { |
1397 | tty_unregister_driver(hvcs_tty_driver); | 1561 | rc = -ENOMEM; |
1398 | hvcs_free_index_list(); | 1562 | goto buff_alloc_fail; |
1399 | put_tty_driver(hvcs_tty_driver); | ||
1400 | return -ENOMEM; | ||
1401 | } | 1563 | } |
1402 | 1564 | ||
1403 | hvcs_task = kthread_run(khvcsd, NULL, "khvcsd"); | 1565 | hvcs_task = kthread_run(khvcsd, NULL, "khvcsd"); |
1404 | if (IS_ERR(hvcs_task)) { | 1566 | if (IS_ERR(hvcs_task)) { |
1405 | printk(KERN_ERR "HVCS: khvcsd creation failed. Driver not loaded.\n"); | 1567 | printk(KERN_ERR "HVCS: khvcsd creation failed. Driver not loaded.\n"); |
1406 | kfree(hvcs_pi_buff); | 1568 | rc = -EIO; |
1407 | tty_unregister_driver(hvcs_tty_driver); | 1569 | goto kthread_fail; |
1408 | hvcs_free_index_list(); | ||
1409 | put_tty_driver(hvcs_tty_driver); | ||
1410 | return -EIO; | ||
1411 | } | 1570 | } |
1412 | 1571 | ||
1413 | rc = vio_register_driver(&hvcs_vio_driver); | 1572 | rc = vio_register_driver(&hvcs_vio_driver); |
1573 | if (rc) { | ||
1574 | printk(KERN_ERR "HVCS: can't register vio driver\n"); | ||
1575 | goto vio_fail; | ||
1576 | } | ||
1414 | 1577 | ||
1415 | /* | 1578 | /* |
1416 | * This needs to be done AFTER the vio_register_driver() call or else | 1579 | * This needs to be done AFTER the vio_register_driver() call or else |
1417 | * the kobjects won't be initialized properly. | 1580 | * the kobjects won't be initialized properly. |
1418 | */ | 1581 | */ |
1419 | hvcs_create_driver_attrs(); | 1582 | rc = driver_create_file(&(hvcs_vio_driver.driver), &driver_attr_rescan); |
1583 | if (rc) { | ||
1584 | printk(KERN_ERR "HVCS: sysfs attr create failed\n"); | ||
1585 | goto attr_fail; | ||
1586 | } | ||
1420 | 1587 | ||
1421 | printk(KERN_INFO "HVCS: driver module inserted.\n"); | 1588 | printk(KERN_INFO "HVCS: driver module inserted.\n"); |
1422 | 1589 | ||
1590 | return 0; | ||
1591 | |||
1592 | attr_fail: | ||
1593 | vio_unregister_driver(&hvcs_vio_driver); | ||
1594 | vio_fail: | ||
1595 | kthread_stop(hvcs_task); | ||
1596 | kthread_fail: | ||
1597 | kfree(hvcs_pi_buff); | ||
1598 | buff_alloc_fail: | ||
1599 | tty_unregister_driver(hvcs_tty_driver); | ||
1600 | register_fail: | ||
1601 | hvcs_free_index_list(); | ||
1602 | index_fail: | ||
1603 | put_tty_driver(hvcs_tty_driver); | ||
1604 | hvcs_tty_driver = NULL; | ||
1423 | return rc; | 1605 | return rc; |
1424 | } | 1606 | } |
1425 | 1607 | ||
@@ -1441,7 +1623,7 @@ static void __exit hvcs_module_exit(void) | |||
1441 | hvcs_pi_buff = NULL; | 1623 | hvcs_pi_buff = NULL; |
1442 | spin_unlock(&hvcs_pi_lock); | 1624 | spin_unlock(&hvcs_pi_lock); |
1443 | 1625 | ||
1444 | hvcs_remove_driver_attrs(); | 1626 | driver_remove_file(&hvcs_vio_driver.driver, &driver_attr_rescan); |
1445 | 1627 | ||
1446 | vio_unregister_driver(&hvcs_vio_driver); | 1628 | vio_unregister_driver(&hvcs_vio_driver); |
1447 | 1629 | ||
@@ -1456,191 +1638,3 @@ static void __exit hvcs_module_exit(void) | |||
1456 | 1638 | ||
1457 | module_init(hvcs_module_init); | 1639 | module_init(hvcs_module_init); |
1458 | module_exit(hvcs_module_exit); | 1640 | module_exit(hvcs_module_exit); |
1459 | |||
1460 | static inline struct hvcs_struct *from_vio_dev(struct vio_dev *viod) | ||
1461 | { | ||
1462 | return viod->dev.driver_data; | ||
1463 | } | ||
1464 | /* The sysfs interface for the driver and devices */ | ||
1465 | |||
1466 | static ssize_t hvcs_partner_vtys_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
1467 | { | ||
1468 | struct vio_dev *viod = to_vio_dev(dev); | ||
1469 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
1470 | unsigned long flags; | ||
1471 | int retval; | ||
1472 | |||
1473 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
1474 | retval = sprintf(buf, "%X\n", hvcsd->p_unit_address); | ||
1475 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
1476 | return retval; | ||
1477 | } | ||
1478 | static DEVICE_ATTR(partner_vtys, S_IRUGO, hvcs_partner_vtys_show, NULL); | ||
1479 | |||
1480 | static ssize_t hvcs_partner_clcs_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
1481 | { | ||
1482 | struct vio_dev *viod = to_vio_dev(dev); | ||
1483 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
1484 | unsigned long flags; | ||
1485 | int retval; | ||
1486 | |||
1487 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
1488 | retval = sprintf(buf, "%s\n", &hvcsd->p_location_code[0]); | ||
1489 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
1490 | return retval; | ||
1491 | } | ||
1492 | static DEVICE_ATTR(partner_clcs, S_IRUGO, hvcs_partner_clcs_show, NULL); | ||
1493 | |||
1494 | static ssize_t hvcs_current_vty_store(struct device *dev, struct device_attribute *attr, const char * buf, | ||
1495 | size_t count) | ||
1496 | { | ||
1497 | /* | ||
1498 | * Don't need this feature at the present time because firmware doesn't | ||
1499 | * yet support multiple partners. | ||
1500 | */ | ||
1501 | printk(KERN_INFO "HVCS: Denied current_vty change: -EPERM.\n"); | ||
1502 | return -EPERM; | ||
1503 | } | ||
1504 | |||
1505 | static ssize_t hvcs_current_vty_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
1506 | { | ||
1507 | struct vio_dev *viod = to_vio_dev(dev); | ||
1508 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
1509 | unsigned long flags; | ||
1510 | int retval; | ||
1511 | |||
1512 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
1513 | retval = sprintf(buf, "%s\n", &hvcsd->p_location_code[0]); | ||
1514 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
1515 | return retval; | ||
1516 | } | ||
1517 | |||
1518 | static DEVICE_ATTR(current_vty, | ||
1519 | S_IRUGO | S_IWUSR, hvcs_current_vty_show, hvcs_current_vty_store); | ||
1520 | |||
1521 | static ssize_t hvcs_vterm_state_store(struct device *dev, struct device_attribute *attr, const char *buf, | ||
1522 | size_t count) | ||
1523 | { | ||
1524 | struct vio_dev *viod = to_vio_dev(dev); | ||
1525 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
1526 | unsigned long flags; | ||
1527 | |||
1528 | /* writing a '0' to this sysfs entry will result in the disconnect. */ | ||
1529 | if (simple_strtol(buf, NULL, 0) != 0) | ||
1530 | return -EINVAL; | ||
1531 | |||
1532 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
1533 | |||
1534 | if (hvcsd->open_count > 0) { | ||
1535 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
1536 | printk(KERN_INFO "HVCS: vterm state unchanged. " | ||
1537 | "The hvcs device node is still in use.\n"); | ||
1538 | return -EPERM; | ||
1539 | } | ||
1540 | |||
1541 | if (hvcsd->connected == 0) { | ||
1542 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
1543 | printk(KERN_INFO "HVCS: vterm state unchanged. The" | ||
1544 | " vty-server is not connected to a vty.\n"); | ||
1545 | return -EPERM; | ||
1546 | } | ||
1547 | |||
1548 | hvcs_partner_free(hvcsd); | ||
1549 | printk(KERN_INFO "HVCS: Closed vty-server@%X and" | ||
1550 | " partner vty@%X:%d connection.\n", | ||
1551 | hvcsd->vdev->unit_address, | ||
1552 | hvcsd->p_unit_address, | ||
1553 | (uint32_t)hvcsd->p_partition_ID); | ||
1554 | |||
1555 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
1556 | return count; | ||
1557 | } | ||
1558 | |||
1559 | static ssize_t hvcs_vterm_state_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
1560 | { | ||
1561 | struct vio_dev *viod = to_vio_dev(dev); | ||
1562 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
1563 | unsigned long flags; | ||
1564 | int retval; | ||
1565 | |||
1566 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
1567 | retval = sprintf(buf, "%d\n", hvcsd->connected); | ||
1568 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
1569 | return retval; | ||
1570 | } | ||
1571 | static DEVICE_ATTR(vterm_state, S_IRUGO | S_IWUSR, | ||
1572 | hvcs_vterm_state_show, hvcs_vterm_state_store); | ||
1573 | |||
1574 | static ssize_t hvcs_index_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
1575 | { | ||
1576 | struct vio_dev *viod = to_vio_dev(dev); | ||
1577 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | ||
1578 | unsigned long flags; | ||
1579 | int retval; | ||
1580 | |||
1581 | spin_lock_irqsave(&hvcsd->lock, flags); | ||
1582 | retval = sprintf(buf, "%d\n", hvcsd->index); | ||
1583 | spin_unlock_irqrestore(&hvcsd->lock, flags); | ||
1584 | return retval; | ||
1585 | } | ||
1586 | |||
1587 | static DEVICE_ATTR(index, S_IRUGO, hvcs_index_show, NULL); | ||
1588 | |||
1589 | static struct attribute *hvcs_attrs[] = { | ||
1590 | &dev_attr_partner_vtys.attr, | ||
1591 | &dev_attr_partner_clcs.attr, | ||
1592 | &dev_attr_current_vty.attr, | ||
1593 | &dev_attr_vterm_state.attr, | ||
1594 | &dev_attr_index.attr, | ||
1595 | NULL, | ||
1596 | }; | ||
1597 | |||
1598 | static struct attribute_group hvcs_attr_group = { | ||
1599 | .attrs = hvcs_attrs, | ||
1600 | }; | ||
1601 | |||
1602 | static void hvcs_create_device_attrs(struct hvcs_struct *hvcsd) | ||
1603 | { | ||
1604 | struct vio_dev *vdev = hvcsd->vdev; | ||
1605 | sysfs_create_group(&vdev->dev.kobj, &hvcs_attr_group); | ||
1606 | } | ||
1607 | |||
1608 | static void hvcs_remove_device_attrs(struct vio_dev *vdev) | ||
1609 | { | ||
1610 | sysfs_remove_group(&vdev->dev.kobj, &hvcs_attr_group); | ||
1611 | } | ||
1612 | |||
1613 | static ssize_t hvcs_rescan_show(struct device_driver *ddp, char *buf) | ||
1614 | { | ||
1615 | /* A 1 means it is updating, a 0 means it is done updating */ | ||
1616 | return snprintf(buf, PAGE_SIZE, "%d\n", hvcs_rescan_status); | ||
1617 | } | ||
1618 | |||
1619 | static ssize_t hvcs_rescan_store(struct device_driver *ddp, const char * buf, | ||
1620 | size_t count) | ||
1621 | { | ||
1622 | if ((simple_strtol(buf, NULL, 0) != 1) | ||
1623 | && (hvcs_rescan_status != 0)) | ||
1624 | return -EINVAL; | ||
1625 | |||
1626 | hvcs_rescan_status = 1; | ||
1627 | printk(KERN_INFO "HVCS: rescanning partner info for all" | ||
1628 | " vty-servers.\n"); | ||
1629 | hvcs_rescan_devices_list(); | ||
1630 | hvcs_rescan_status = 0; | ||
1631 | return count; | ||
1632 | } | ||
1633 | static DRIVER_ATTR(rescan, | ||
1634 | S_IRUGO | S_IWUSR, hvcs_rescan_show, hvcs_rescan_store); | ||
1635 | |||
1636 | static void hvcs_create_driver_attrs(void) | ||
1637 | { | ||
1638 | struct device_driver *driverfs = &(hvcs_vio_driver.driver); | ||
1639 | driver_create_file(driverfs, &driver_attr_rescan); | ||
1640 | } | ||
1641 | |||
1642 | static void hvcs_remove_driver_attrs(void) | ||
1643 | { | ||
1644 | struct device_driver *driverfs = &(hvcs_vio_driver.driver); | ||
1645 | driver_remove_file(driverfs, &driver_attr_rescan); | ||
1646 | } | ||
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 9f7635f75178..5f3acd8e64b8 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig | |||
@@ -3,17 +3,20 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | config HW_RANDOM | 5 | config HW_RANDOM |
6 | bool "Hardware Random Number Generator Core support" | 6 | tristate "Hardware Random Number Generator Core support" |
7 | default y | 7 | default m |
8 | ---help--- | 8 | ---help--- |
9 | Hardware Random Number Generator Core infrastructure. | 9 | Hardware Random Number Generator Core infrastructure. |
10 | 10 | ||
11 | To compile this driver as a module, choose M here: the | ||
12 | module will be called rng-core. | ||
13 | |||
11 | If unsure, say Y. | 14 | If unsure, say Y. |
12 | 15 | ||
13 | config HW_RANDOM_INTEL | 16 | config HW_RANDOM_INTEL |
14 | tristate "Intel HW Random Number Generator support" | 17 | tristate "Intel HW Random Number Generator support" |
15 | depends on HW_RANDOM && (X86 || IA64) && PCI | 18 | depends on HW_RANDOM && (X86 || IA64) && PCI |
16 | default y | 19 | default HW_RANDOM |
17 | ---help--- | 20 | ---help--- |
18 | This driver provides kernel-side support for the Random Number | 21 | This driver provides kernel-side support for the Random Number |
19 | Generator hardware found on Intel i8xx-based motherboards. | 22 | Generator hardware found on Intel i8xx-based motherboards. |
@@ -26,7 +29,7 @@ config HW_RANDOM_INTEL | |||
26 | config HW_RANDOM_AMD | 29 | config HW_RANDOM_AMD |
27 | tristate "AMD HW Random Number Generator support" | 30 | tristate "AMD HW Random Number Generator support" |
28 | depends on HW_RANDOM && X86 && PCI | 31 | depends on HW_RANDOM && X86 && PCI |
29 | default y | 32 | default HW_RANDOM |
30 | ---help--- | 33 | ---help--- |
31 | This driver provides kernel-side support for the Random Number | 34 | This driver provides kernel-side support for the Random Number |
32 | Generator hardware found on AMD 76x-based motherboards. | 35 | Generator hardware found on AMD 76x-based motherboards. |
@@ -39,7 +42,7 @@ config HW_RANDOM_AMD | |||
39 | config HW_RANDOM_GEODE | 42 | config HW_RANDOM_GEODE |
40 | tristate "AMD Geode HW Random Number Generator support" | 43 | tristate "AMD Geode HW Random Number Generator support" |
41 | depends on HW_RANDOM && X86 && PCI | 44 | depends on HW_RANDOM && X86 && PCI |
42 | default y | 45 | default HW_RANDOM |
43 | ---help--- | 46 | ---help--- |
44 | This driver provides kernel-side support for the Random Number | 47 | This driver provides kernel-side support for the Random Number |
45 | Generator hardware found on the AMD Geode LX. | 48 | Generator hardware found on the AMD Geode LX. |
@@ -52,7 +55,7 @@ config HW_RANDOM_GEODE | |||
52 | config HW_RANDOM_VIA | 55 | config HW_RANDOM_VIA |
53 | tristate "VIA HW Random Number Generator support" | 56 | tristate "VIA HW Random Number Generator support" |
54 | depends on HW_RANDOM && X86_32 | 57 | depends on HW_RANDOM && X86_32 |
55 | default y | 58 | default HW_RANDOM |
56 | ---help--- | 59 | ---help--- |
57 | This driver provides kernel-side support for the Random Number | 60 | This driver provides kernel-side support for the Random Number |
58 | Generator hardware found on VIA based motherboards. | 61 | Generator hardware found on VIA based motherboards. |
@@ -65,7 +68,7 @@ config HW_RANDOM_VIA | |||
65 | config HW_RANDOM_IXP4XX | 68 | config HW_RANDOM_IXP4XX |
66 | tristate "Intel IXP4xx NPU HW Random Number Generator support" | 69 | tristate "Intel IXP4xx NPU HW Random Number Generator support" |
67 | depends on HW_RANDOM && ARCH_IXP4XX | 70 | depends on HW_RANDOM && ARCH_IXP4XX |
68 | default y | 71 | default HW_RANDOM |
69 | ---help--- | 72 | ---help--- |
70 | This driver provides kernel-side support for the Random | 73 | This driver provides kernel-side support for the Random |
71 | Number Generator hardware found on the Intel IXP4xx NPU. | 74 | Number Generator hardware found on the Intel IXP4xx NPU. |
@@ -78,7 +81,7 @@ config HW_RANDOM_IXP4XX | |||
78 | config HW_RANDOM_OMAP | 81 | config HW_RANDOM_OMAP |
79 | tristate "OMAP Random Number Generator support" | 82 | tristate "OMAP Random Number Generator support" |
80 | depends on HW_RANDOM && (ARCH_OMAP16XX || ARCH_OMAP24XX) | 83 | depends on HW_RANDOM && (ARCH_OMAP16XX || ARCH_OMAP24XX) |
81 | default y | 84 | default HW_RANDOM |
82 | ---help--- | 85 | ---help--- |
83 | This driver provides kernel-side support for the Random Number | 86 | This driver provides kernel-side support for the Random Number |
84 | Generator hardware found on OMAP16xx and OMAP24xx multimedia | 87 | Generator hardware found on OMAP16xx and OMAP24xx multimedia |
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile index e263ae96f940..c41fa19454e3 100644 --- a/drivers/char/hw_random/Makefile +++ b/drivers/char/hw_random/Makefile | |||
@@ -2,7 +2,8 @@ | |||
2 | # Makefile for HW Random Number Generator (RNG) device drivers. | 2 | # Makefile for HW Random Number Generator (RNG) device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_HW_RANDOM) += core.o | 5 | obj-$(CONFIG_HW_RANDOM) += rng-core.o |
6 | rng-core-y := core.o | ||
6 | obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o | 7 | obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o |
7 | obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o | 8 | obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o |
8 | obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o | 9 | obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o |
diff --git a/drivers/char/ip2/i2cmd.h b/drivers/char/ip2/i2cmd.h index baa4e721b758..29277ec6b8ed 100644 --- a/drivers/char/ip2/i2cmd.h +++ b/drivers/char/ip2/i2cmd.h | |||
@@ -367,11 +367,6 @@ static UCHAR cc02[]; | |||
367 | #define CSE_NULL 3 // Replace with a null | 367 | #define CSE_NULL 3 // Replace with a null |
368 | #define CSE_MARK 4 // Replace with a 3-character sequence (as Unix) | 368 | #define CSE_MARK 4 // Replace with a 3-character sequence (as Unix) |
369 | 369 | ||
370 | #define CMD_SET_REPLACEMENT(arg,ch) \ | ||
371 | (((cmdSyntaxPtr)(ct36a))->cmd[1] = (arg), \ | ||
372 | (((cmdSyntaxPtr)(ct36a))->cmd[2] = (ch), \ | ||
373 | (cmdSyntaxPtr)(ct36a)) | ||
374 | |||
375 | #define CSE_REPLACE 0x8 // Replace the errored character with the | 370 | #define CSE_REPLACE 0x8 // Replace the errored character with the |
376 | // replacement character defined here | 371 | // replacement character defined here |
377 | 372 | ||
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c index c213fdbdb2b0..78045767ec33 100644 --- a/drivers/char/ip2/i2lib.c +++ b/drivers/char/ip2/i2lib.c | |||
@@ -1016,7 +1016,6 @@ i2Output(i2ChanStrPtr pCh, const char *pSource, int count) | |||
1016 | unsigned short channel; | 1016 | unsigned short channel; |
1017 | unsigned short stuffIndex; | 1017 | unsigned short stuffIndex; |
1018 | unsigned long flags; | 1018 | unsigned long flags; |
1019 | int rc = 0; | ||
1020 | 1019 | ||
1021 | int bailout = 10; | 1020 | int bailout = 10; |
1022 | 1021 | ||
diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c index 0030cd8e2e95..6c59baa887a8 100644 --- a/drivers/char/ipmi/ipmi_bt_sm.c +++ b/drivers/char/ipmi/ipmi_bt_sm.c | |||
@@ -33,11 +33,13 @@ | |||
33 | #include <linux/ipmi_msgdefs.h> /* for completion codes */ | 33 | #include <linux/ipmi_msgdefs.h> /* for completion codes */ |
34 | #include "ipmi_si_sm.h" | 34 | #include "ipmi_si_sm.h" |
35 | 35 | ||
36 | static int bt_debug = 0x00; /* Production value 0, see following flags */ | 36 | #define BT_DEBUG_OFF 0 /* Used in production */ |
37 | #define BT_DEBUG_ENABLE 1 /* Generic messages */ | ||
38 | #define BT_DEBUG_MSG 2 /* Prints all request/response buffers */ | ||
39 | #define BT_DEBUG_STATES 4 /* Verbose look at state changes */ | ||
40 | |||
41 | static int bt_debug = BT_DEBUG_OFF; | ||
37 | 42 | ||
38 | #define BT_DEBUG_ENABLE 1 | ||
39 | #define BT_DEBUG_MSG 2 | ||
40 | #define BT_DEBUG_STATES 4 | ||
41 | module_param(bt_debug, int, 0644); | 43 | module_param(bt_debug, int, 0644); |
42 | MODULE_PARM_DESC(bt_debug, "debug bitmask, 1=enable, 2=messages, 4=states"); | 44 | MODULE_PARM_DESC(bt_debug, "debug bitmask, 1=enable, 2=messages, 4=states"); |
43 | 45 | ||
@@ -47,38 +49,54 @@ MODULE_PARM_DESC(bt_debug, "debug bitmask, 1=enable, 2=messages, 4=states"); | |||
47 | Since the Open IPMI architecture is single-message oriented at this | 49 | Since the Open IPMI architecture is single-message oriented at this |
48 | stage, the queue depth of BT is of no concern. */ | 50 | stage, the queue depth of BT is of no concern. */ |
49 | 51 | ||
50 | #define BT_NORMAL_TIMEOUT 5000000 /* seconds in microseconds */ | 52 | #define BT_NORMAL_TIMEOUT 5 /* seconds */ |
51 | #define BT_RETRY_LIMIT 2 | 53 | #define BT_NORMAL_RETRY_LIMIT 2 |
52 | #define BT_RESET_DELAY 6000000 /* 6 seconds after warm reset */ | 54 | #define BT_RESET_DELAY 6 /* seconds after warm reset */ |
55 | |||
56 | /* States are written in chronological order and usually cover | ||
57 | multiple rows of the state table discussion in the IPMI spec. */ | ||
53 | 58 | ||
54 | enum bt_states { | 59 | enum bt_states { |
55 | BT_STATE_IDLE, | 60 | BT_STATE_IDLE = 0, /* Order is critical in this list */ |
56 | BT_STATE_XACTION_START, | 61 | BT_STATE_XACTION_START, |
57 | BT_STATE_WRITE_BYTES, | 62 | BT_STATE_WRITE_BYTES, |
58 | BT_STATE_WRITE_END, | ||
59 | BT_STATE_WRITE_CONSUME, | 63 | BT_STATE_WRITE_CONSUME, |
60 | BT_STATE_B2H_WAIT, | 64 | BT_STATE_READ_WAIT, |
61 | BT_STATE_READ_END, | 65 | BT_STATE_CLEAR_B2H, |
62 | BT_STATE_RESET1, /* These must come last */ | 66 | BT_STATE_READ_BYTES, |
67 | BT_STATE_RESET1, /* These must come last */ | ||
63 | BT_STATE_RESET2, | 68 | BT_STATE_RESET2, |
64 | BT_STATE_RESET3, | 69 | BT_STATE_RESET3, |
65 | BT_STATE_RESTART, | 70 | BT_STATE_RESTART, |
66 | BT_STATE_HOSED | 71 | BT_STATE_PRINTME, |
72 | BT_STATE_CAPABILITIES_BEGIN, | ||
73 | BT_STATE_CAPABILITIES_END, | ||
74 | BT_STATE_LONG_BUSY /* BT doesn't get hosed :-) */ | ||
67 | }; | 75 | }; |
68 | 76 | ||
77 | /* Macros seen at the end of state "case" blocks. They help with legibility | ||
78 | and debugging. */ | ||
79 | |||
80 | #define BT_STATE_CHANGE(X,Y) { bt->state = X; return Y; } | ||
81 | |||
82 | #define BT_SI_SM_RETURN(Y) { last_printed = BT_STATE_PRINTME; return Y; } | ||
83 | |||
69 | struct si_sm_data { | 84 | struct si_sm_data { |
70 | enum bt_states state; | 85 | enum bt_states state; |
71 | enum bt_states last_state; /* assist printing and resets */ | ||
72 | unsigned char seq; /* BT sequence number */ | 86 | unsigned char seq; /* BT sequence number */ |
73 | struct si_sm_io *io; | 87 | struct si_sm_io *io; |
74 | unsigned char write_data[IPMI_MAX_MSG_LENGTH]; | 88 | unsigned char write_data[IPMI_MAX_MSG_LENGTH]; |
75 | int write_count; | 89 | int write_count; |
76 | unsigned char read_data[IPMI_MAX_MSG_LENGTH]; | 90 | unsigned char read_data[IPMI_MAX_MSG_LENGTH]; |
77 | int read_count; | 91 | int read_count; |
78 | int truncated; | 92 | int truncated; |
79 | long timeout; | 93 | long timeout; /* microseconds countdown */ |
80 | unsigned int error_retries; /* end of "common" fields */ | 94 | int error_retries; /* end of "common" fields */ |
81 | int nonzero_status; /* hung BMCs stay all 0 */ | 95 | int nonzero_status; /* hung BMCs stay all 0 */ |
96 | enum bt_states complete; /* to divert the state machine */ | ||
97 | int BT_CAP_outreqs; | ||
98 | long BT_CAP_req2rsp; | ||
99 | int BT_CAP_retries; /* Recommended retries */ | ||
82 | }; | 100 | }; |
83 | 101 | ||
84 | #define BT_CLR_WR_PTR 0x01 /* See IPMI 1.5 table 11.6.4 */ | 102 | #define BT_CLR_WR_PTR 0x01 /* See IPMI 1.5 table 11.6.4 */ |
@@ -111,86 +129,118 @@ struct si_sm_data { | |||
111 | static char *state2txt(unsigned char state) | 129 | static char *state2txt(unsigned char state) |
112 | { | 130 | { |
113 | switch (state) { | 131 | switch (state) { |
114 | case BT_STATE_IDLE: return("IDLE"); | 132 | case BT_STATE_IDLE: return("IDLE"); |
115 | case BT_STATE_XACTION_START: return("XACTION"); | 133 | case BT_STATE_XACTION_START: return("XACTION"); |
116 | case BT_STATE_WRITE_BYTES: return("WR_BYTES"); | 134 | case BT_STATE_WRITE_BYTES: return("WR_BYTES"); |
117 | case BT_STATE_WRITE_END: return("WR_END"); | 135 | case BT_STATE_WRITE_CONSUME: return("WR_CONSUME"); |
118 | case BT_STATE_WRITE_CONSUME: return("WR_CONSUME"); | 136 | case BT_STATE_READ_WAIT: return("RD_WAIT"); |
119 | case BT_STATE_B2H_WAIT: return("B2H_WAIT"); | 137 | case BT_STATE_CLEAR_B2H: return("CLEAR_B2H"); |
120 | case BT_STATE_READ_END: return("RD_END"); | 138 | case BT_STATE_READ_BYTES: return("RD_BYTES"); |
121 | case BT_STATE_RESET1: return("RESET1"); | 139 | case BT_STATE_RESET1: return("RESET1"); |
122 | case BT_STATE_RESET2: return("RESET2"); | 140 | case BT_STATE_RESET2: return("RESET2"); |
123 | case BT_STATE_RESET3: return("RESET3"); | 141 | case BT_STATE_RESET3: return("RESET3"); |
124 | case BT_STATE_RESTART: return("RESTART"); | 142 | case BT_STATE_RESTART: return("RESTART"); |
125 | case BT_STATE_HOSED: return("HOSED"); | 143 | case BT_STATE_LONG_BUSY: return("LONG_BUSY"); |
144 | case BT_STATE_CAPABILITIES_BEGIN: return("CAP_BEGIN"); | ||
145 | case BT_STATE_CAPABILITIES_END: return("CAP_END"); | ||
126 | } | 146 | } |
127 | return("BAD STATE"); | 147 | return("BAD STATE"); |
128 | } | 148 | } |
129 | #define STATE2TXT state2txt(bt->state) | 149 | #define STATE2TXT state2txt(bt->state) |
130 | 150 | ||
131 | static char *status2txt(unsigned char status, char *buf) | 151 | static char *status2txt(unsigned char status) |
132 | { | 152 | { |
153 | /* | ||
154 | * This cannot be called by two threads at the same time and | ||
155 | * the buffer is always consumed immediately, so the static is | ||
156 | * safe to use. | ||
157 | */ | ||
158 | static char buf[40]; | ||
159 | |||
133 | strcpy(buf, "[ "); | 160 | strcpy(buf, "[ "); |
134 | if (status & BT_B_BUSY) strcat(buf, "B_BUSY "); | 161 | if (status & BT_B_BUSY) |
135 | if (status & BT_H_BUSY) strcat(buf, "H_BUSY "); | 162 | strcat(buf, "B_BUSY "); |
136 | if (status & BT_OEM0) strcat(buf, "OEM0 "); | 163 | if (status & BT_H_BUSY) |
137 | if (status & BT_SMS_ATN) strcat(buf, "SMS "); | 164 | strcat(buf, "H_BUSY "); |
138 | if (status & BT_B2H_ATN) strcat(buf, "B2H "); | 165 | if (status & BT_OEM0) |
139 | if (status & BT_H2B_ATN) strcat(buf, "H2B "); | 166 | strcat(buf, "OEM0 "); |
167 | if (status & BT_SMS_ATN) | ||
168 | strcat(buf, "SMS "); | ||
169 | if (status & BT_B2H_ATN) | ||
170 | strcat(buf, "B2H "); | ||
171 | if (status & BT_H2B_ATN) | ||
172 | strcat(buf, "H2B "); | ||
140 | strcat(buf, "]"); | 173 | strcat(buf, "]"); |
141 | return buf; | 174 | return buf; |
142 | } | 175 | } |
143 | #define STATUS2TXT(buf) status2txt(status, buf) | 176 | #define STATUS2TXT status2txt(status) |
177 | |||
178 | /* called externally at insmod time, and internally on cleanup */ | ||
144 | 179 | ||
145 | /* This will be called from within this module on a hosed condition */ | ||
146 | #define FIRST_SEQ 0 | ||
147 | static unsigned int bt_init_data(struct si_sm_data *bt, struct si_sm_io *io) | 180 | static unsigned int bt_init_data(struct si_sm_data *bt, struct si_sm_io *io) |
148 | { | 181 | { |
149 | bt->state = BT_STATE_IDLE; | 182 | memset(bt, 0, sizeof(struct si_sm_data)); |
150 | bt->last_state = BT_STATE_IDLE; | 183 | if (bt->io != io) { /* external: one-time only things */ |
151 | bt->seq = FIRST_SEQ; | 184 | bt->io = io; |
152 | bt->io = io; | 185 | bt->seq = 0; |
153 | bt->write_count = 0; | 186 | } |
154 | bt->read_count = 0; | 187 | bt->state = BT_STATE_IDLE; /* start here */ |
155 | bt->error_retries = 0; | 188 | bt->complete = BT_STATE_IDLE; /* end here */ |
156 | bt->nonzero_status = 0; | 189 | bt->BT_CAP_req2rsp = BT_NORMAL_TIMEOUT * 1000000; |
157 | bt->truncated = 0; | 190 | bt->BT_CAP_retries = BT_NORMAL_RETRY_LIMIT; |
158 | bt->timeout = BT_NORMAL_TIMEOUT; | 191 | /* BT_CAP_outreqs == zero is a flag to read BT Capabilities */ |
159 | return 3; /* We claim 3 bytes of space; ought to check SPMI table */ | 192 | return 3; /* We claim 3 bytes of space; ought to check SPMI table */ |
160 | } | 193 | } |
161 | 194 | ||
195 | /* Jam a completion code (probably an error) into a response */ | ||
196 | |||
197 | static void force_result(struct si_sm_data *bt, unsigned char completion_code) | ||
198 | { | ||
199 | bt->read_data[0] = 4; /* # following bytes */ | ||
200 | bt->read_data[1] = bt->write_data[1] | 4; /* Odd NetFn/LUN */ | ||
201 | bt->read_data[2] = bt->write_data[2]; /* seq (ignored) */ | ||
202 | bt->read_data[3] = bt->write_data[3]; /* Command */ | ||
203 | bt->read_data[4] = completion_code; | ||
204 | bt->read_count = 5; | ||
205 | } | ||
206 | |||
207 | /* The upper state machine starts here */ | ||
208 | |||
162 | static int bt_start_transaction(struct si_sm_data *bt, | 209 | static int bt_start_transaction(struct si_sm_data *bt, |
163 | unsigned char *data, | 210 | unsigned char *data, |
164 | unsigned int size) | 211 | unsigned int size) |
165 | { | 212 | { |
166 | unsigned int i; | 213 | unsigned int i; |
167 | 214 | ||
168 | if ((size < 2) || (size > (IPMI_MAX_MSG_LENGTH - 2))) | 215 | if (size < 2) |
169 | return -1; | 216 | return IPMI_REQ_LEN_INVALID_ERR; |
217 | if (size > IPMI_MAX_MSG_LENGTH) | ||
218 | return IPMI_REQ_LEN_EXCEEDED_ERR; | ||
170 | 219 | ||
171 | if ((bt->state != BT_STATE_IDLE) && (bt->state != BT_STATE_HOSED)) | 220 | if (bt->state == BT_STATE_LONG_BUSY) |
172 | return -2; | 221 | return IPMI_NODE_BUSY_ERR; |
222 | |||
223 | if (bt->state != BT_STATE_IDLE) | ||
224 | return IPMI_NOT_IN_MY_STATE_ERR; | ||
173 | 225 | ||
174 | if (bt_debug & BT_DEBUG_MSG) { | 226 | if (bt_debug & BT_DEBUG_MSG) { |
175 | printk(KERN_WARNING "+++++++++++++++++++++++++++++++++++++\n"); | 227 | printk(KERN_WARNING "BT: +++++++++++++++++ New command\n"); |
176 | printk(KERN_WARNING "BT: write seq=0x%02X:", bt->seq); | 228 | printk(KERN_WARNING "BT: NetFn/LUN CMD [%d data]:", size - 2); |
177 | for (i = 0; i < size; i ++) | 229 | for (i = 0; i < size; i ++) |
178 | printk (" %02x", data[i]); | 230 | printk (" %02x", data[i]); |
179 | printk("\n"); | 231 | printk("\n"); |
180 | } | 232 | } |
181 | bt->write_data[0] = size + 1; /* all data plus seq byte */ | 233 | bt->write_data[0] = size + 1; /* all data plus seq byte */ |
182 | bt->write_data[1] = *data; /* NetFn/LUN */ | 234 | bt->write_data[1] = *data; /* NetFn/LUN */ |
183 | bt->write_data[2] = bt->seq; | 235 | bt->write_data[2] = bt->seq++; |
184 | memcpy(bt->write_data + 3, data + 1, size - 1); | 236 | memcpy(bt->write_data + 3, data + 1, size - 1); |
185 | bt->write_count = size + 2; | 237 | bt->write_count = size + 2; |
186 | |||
187 | bt->error_retries = 0; | 238 | bt->error_retries = 0; |
188 | bt->nonzero_status = 0; | 239 | bt->nonzero_status = 0; |
189 | bt->read_count = 0; | ||
190 | bt->truncated = 0; | 240 | bt->truncated = 0; |
191 | bt->state = BT_STATE_XACTION_START; | 241 | bt->state = BT_STATE_XACTION_START; |
192 | bt->last_state = BT_STATE_IDLE; | 242 | bt->timeout = bt->BT_CAP_req2rsp; |
193 | bt->timeout = BT_NORMAL_TIMEOUT; | 243 | force_result(bt, IPMI_ERR_UNSPECIFIED); |
194 | return 0; | 244 | return 0; |
195 | } | 245 | } |
196 | 246 | ||
@@ -198,38 +248,30 @@ static int bt_start_transaction(struct si_sm_data *bt, | |||
198 | it calls this. Strip out the length and seq bytes. */ | 248 | it calls this. Strip out the length and seq bytes. */ |
199 | 249 | ||
200 | static int bt_get_result(struct si_sm_data *bt, | 250 | static int bt_get_result(struct si_sm_data *bt, |
201 | unsigned char *data, | 251 | unsigned char *data, |
202 | unsigned int length) | 252 | unsigned int length) |
203 | { | 253 | { |
204 | int i, msg_len; | 254 | int i, msg_len; |
205 | 255 | ||
206 | msg_len = bt->read_count - 2; /* account for length & seq */ | 256 | msg_len = bt->read_count - 2; /* account for length & seq */ |
207 | /* Always NetFn, Cmd, cCode */ | ||
208 | if (msg_len < 3 || msg_len > IPMI_MAX_MSG_LENGTH) { | 257 | if (msg_len < 3 || msg_len > IPMI_MAX_MSG_LENGTH) { |
209 | printk(KERN_DEBUG "BT results: bad msg_len = %d\n", msg_len); | 258 | force_result(bt, IPMI_ERR_UNSPECIFIED); |
210 | data[0] = bt->write_data[1] | 0x4; /* Kludge a response */ | ||
211 | data[1] = bt->write_data[3]; | ||
212 | data[2] = IPMI_ERR_UNSPECIFIED; | ||
213 | msg_len = 3; | 259 | msg_len = 3; |
214 | } else { | 260 | } |
215 | data[0] = bt->read_data[1]; | 261 | data[0] = bt->read_data[1]; |
216 | data[1] = bt->read_data[3]; | 262 | data[1] = bt->read_data[3]; |
217 | if (length < msg_len) | 263 | if (length < msg_len || bt->truncated) { |
218 | bt->truncated = 1; | 264 | data[2] = IPMI_ERR_MSG_TRUNCATED; |
219 | if (bt->truncated) { /* can be set in read_all_bytes() */ | 265 | msg_len = 3; |
220 | data[2] = IPMI_ERR_MSG_TRUNCATED; | 266 | } else |
221 | msg_len = 3; | 267 | memcpy(data + 2, bt->read_data + 4, msg_len - 2); |
222 | } else | ||
223 | memcpy(data + 2, bt->read_data + 4, msg_len - 2); | ||
224 | 268 | ||
225 | if (bt_debug & BT_DEBUG_MSG) { | 269 | if (bt_debug & BT_DEBUG_MSG) { |
226 | printk (KERN_WARNING "BT: res (raw)"); | 270 | printk (KERN_WARNING "BT: result %d bytes:", msg_len); |
227 | for (i = 0; i < msg_len; i++) | 271 | for (i = 0; i < msg_len; i++) |
228 | printk(" %02x", data[i]); | 272 | printk(" %02x", data[i]); |
229 | printk ("\n"); | 273 | printk ("\n"); |
230 | } | ||
231 | } | 274 | } |
232 | bt->read_count = 0; /* paranoia */ | ||
233 | return msg_len; | 275 | return msg_len; |
234 | } | 276 | } |
235 | 277 | ||
@@ -238,22 +280,40 @@ static int bt_get_result(struct si_sm_data *bt, | |||
238 | 280 | ||
239 | static void reset_flags(struct si_sm_data *bt) | 281 | static void reset_flags(struct si_sm_data *bt) |
240 | { | 282 | { |
283 | if (bt_debug) | ||
284 | printk(KERN_WARNING "IPMI BT: flag reset %s\n", | ||
285 | status2txt(BT_STATUS)); | ||
241 | if (BT_STATUS & BT_H_BUSY) | 286 | if (BT_STATUS & BT_H_BUSY) |
242 | BT_CONTROL(BT_H_BUSY); | 287 | BT_CONTROL(BT_H_BUSY); /* force clear */ |
243 | if (BT_STATUS & BT_B_BUSY) | 288 | BT_CONTROL(BT_CLR_WR_PTR); /* always reset */ |
244 | BT_CONTROL(BT_B_BUSY); | 289 | BT_CONTROL(BT_SMS_ATN); /* always clear */ |
245 | BT_CONTROL(BT_CLR_WR_PTR); | 290 | BT_INTMASK_W(BT_BMC_HWRST); |
246 | BT_CONTROL(BT_SMS_ATN); | 291 | } |
247 | 292 | ||
248 | if (BT_STATUS & BT_B2H_ATN) { | 293 | /* Get rid of an unwanted/stale response. This should only be needed for |
249 | int i; | 294 | BMCs that support multiple outstanding requests. */ |
250 | BT_CONTROL(BT_H_BUSY); | 295 | |
251 | BT_CONTROL(BT_B2H_ATN); | 296 | static void drain_BMC2HOST(struct si_sm_data *bt) |
252 | BT_CONTROL(BT_CLR_RD_PTR); | 297 | { |
253 | for (i = 0; i < IPMI_MAX_MSG_LENGTH + 2; i++) | 298 | int i, size; |
254 | BMC2HOST; | 299 | |
255 | BT_CONTROL(BT_H_BUSY); | 300 | if (!(BT_STATUS & BT_B2H_ATN)) /* Not signalling a response */ |
256 | } | 301 | return; |
302 | |||
303 | BT_CONTROL(BT_H_BUSY); /* now set */ | ||
304 | BT_CONTROL(BT_B2H_ATN); /* always clear */ | ||
305 | BT_STATUS; /* pause */ | ||
306 | BT_CONTROL(BT_B2H_ATN); /* some BMCs are stubborn */ | ||
307 | BT_CONTROL(BT_CLR_RD_PTR); /* always reset */ | ||
308 | if (bt_debug) | ||
309 | printk(KERN_WARNING "IPMI BT: stale response %s; ", | ||
310 | status2txt(BT_STATUS)); | ||
311 | size = BMC2HOST; | ||
312 | for (i = 0; i < size ; i++) | ||
313 | BMC2HOST; | ||
314 | BT_CONTROL(BT_H_BUSY); /* now clear */ | ||
315 | if (bt_debug) | ||
316 | printk("drained %d bytes\n", size + 1); | ||
257 | } | 317 | } |
258 | 318 | ||
259 | static inline void write_all_bytes(struct si_sm_data *bt) | 319 | static inline void write_all_bytes(struct si_sm_data *bt) |
@@ -261,201 +321,256 @@ static inline void write_all_bytes(struct si_sm_data *bt) | |||
261 | int i; | 321 | int i; |
262 | 322 | ||
263 | if (bt_debug & BT_DEBUG_MSG) { | 323 | if (bt_debug & BT_DEBUG_MSG) { |
264 | printk(KERN_WARNING "BT: write %d bytes seq=0x%02X", | 324 | printk(KERN_WARNING "BT: write %d bytes seq=0x%02X", |
265 | bt->write_count, bt->seq); | 325 | bt->write_count, bt->seq); |
266 | for (i = 0; i < bt->write_count; i++) | 326 | for (i = 0; i < bt->write_count; i++) |
267 | printk (" %02x", bt->write_data[i]); | 327 | printk (" %02x", bt->write_data[i]); |
268 | printk ("\n"); | 328 | printk ("\n"); |
269 | } | 329 | } |
270 | for (i = 0; i < bt->write_count; i++) | 330 | for (i = 0; i < bt->write_count; i++) |
271 | HOST2BMC(bt->write_data[i]); | 331 | HOST2BMC(bt->write_data[i]); |
272 | } | 332 | } |
273 | 333 | ||
274 | static inline int read_all_bytes(struct si_sm_data *bt) | 334 | static inline int read_all_bytes(struct si_sm_data *bt) |
275 | { | 335 | { |
276 | unsigned char i; | 336 | unsigned char i; |
277 | 337 | ||
338 | /* length is "framing info", minimum = 4: NetFn, Seq, Cmd, cCode. | ||
339 | Keep layout of first four bytes aligned with write_data[] */ | ||
340 | |||
278 | bt->read_data[0] = BMC2HOST; | 341 | bt->read_data[0] = BMC2HOST; |
279 | bt->read_count = bt->read_data[0]; | 342 | bt->read_count = bt->read_data[0]; |
280 | if (bt_debug & BT_DEBUG_MSG) | ||
281 | printk(KERN_WARNING "BT: read %d bytes:", bt->read_count); | ||
282 | 343 | ||
283 | /* minimum: length, NetFn, Seq, Cmd, cCode == 5 total, or 4 more | ||
284 | following the length byte. */ | ||
285 | if (bt->read_count < 4 || bt->read_count >= IPMI_MAX_MSG_LENGTH) { | 344 | if (bt->read_count < 4 || bt->read_count >= IPMI_MAX_MSG_LENGTH) { |
286 | if (bt_debug & BT_DEBUG_MSG) | 345 | if (bt_debug & BT_DEBUG_MSG) |
287 | printk("bad length %d\n", bt->read_count); | 346 | printk(KERN_WARNING "BT: bad raw rsp len=%d\n", |
347 | bt->read_count); | ||
288 | bt->truncated = 1; | 348 | bt->truncated = 1; |
289 | return 1; /* let next XACTION START clean it up */ | 349 | return 1; /* let next XACTION START clean it up */ |
290 | } | 350 | } |
291 | for (i = 1; i <= bt->read_count; i++) | 351 | for (i = 1; i <= bt->read_count; i++) |
292 | bt->read_data[i] = BMC2HOST; | 352 | bt->read_data[i] = BMC2HOST; |
293 | bt->read_count++; /* account for the length byte */ | 353 | bt->read_count++; /* Account internally for length byte */ |
294 | 354 | ||
295 | if (bt_debug & BT_DEBUG_MSG) { | 355 | if (bt_debug & BT_DEBUG_MSG) { |
296 | for (i = 0; i < bt->read_count; i++) | 356 | int max = bt->read_count; |
357 | |||
358 | printk(KERN_WARNING "BT: got %d bytes seq=0x%02X", | ||
359 | max, bt->read_data[2]); | ||
360 | if (max > 16) | ||
361 | max = 16; | ||
362 | for (i = 0; i < max; i++) | ||
297 | printk (" %02x", bt->read_data[i]); | 363 | printk (" %02x", bt->read_data[i]); |
298 | printk ("\n"); | 364 | printk ("%s\n", bt->read_count == max ? "" : " ..."); |
299 | } | 365 | } |
300 | if (bt->seq != bt->write_data[2]) /* idiot check */ | ||
301 | printk(KERN_DEBUG "BT: internal error: sequence mismatch\n"); | ||
302 | 366 | ||
303 | /* per the spec, the (NetFn, Seq, Cmd) tuples should match */ | 367 | /* per the spec, the (NetFn[1], Seq[2], Cmd[3]) tuples must match */ |
304 | if ((bt->read_data[3] == bt->write_data[3]) && /* Cmd */ | 368 | if ((bt->read_data[3] == bt->write_data[3]) && |
305 | (bt->read_data[2] == bt->write_data[2]) && /* Sequence */ | 369 | (bt->read_data[2] == bt->write_data[2]) && |
306 | ((bt->read_data[1] & 0xF8) == (bt->write_data[1] & 0xF8))) | 370 | ((bt->read_data[1] & 0xF8) == (bt->write_data[1] & 0xF8))) |
307 | return 1; | 371 | return 1; |
308 | 372 | ||
309 | if (bt_debug & BT_DEBUG_MSG) | 373 | if (bt_debug & BT_DEBUG_MSG) |
310 | printk(KERN_WARNING "BT: bad packet: " | 374 | printk(KERN_WARNING "IPMI BT: bad packet: " |
311 | "want 0x(%02X, %02X, %02X) got (%02X, %02X, %02X)\n", | 375 | "want 0x(%02X, %02X, %02X) got (%02X, %02X, %02X)\n", |
312 | bt->write_data[1], bt->write_data[2], bt->write_data[3], | 376 | bt->write_data[1] | 0x04, bt->write_data[2], bt->write_data[3], |
313 | bt->read_data[1], bt->read_data[2], bt->read_data[3]); | 377 | bt->read_data[1], bt->read_data[2], bt->read_data[3]); |
314 | return 0; | 378 | return 0; |
315 | } | 379 | } |
316 | 380 | ||
317 | /* Modifies bt->state appropriately, need to get into the bt_event() switch */ | 381 | /* Restart if retries are left, or return an error completion code */ |
318 | 382 | ||
319 | static void error_recovery(struct si_sm_data *bt, char *reason) | 383 | static enum si_sm_result error_recovery(struct si_sm_data *bt, |
384 | unsigned char status, | ||
385 | unsigned char cCode) | ||
320 | { | 386 | { |
321 | unsigned char status; | 387 | char *reason; |
322 | char buf[40]; /* For getting status */ | ||
323 | 388 | ||
324 | bt->timeout = BT_NORMAL_TIMEOUT; /* various places want to retry */ | 389 | bt->timeout = bt->BT_CAP_req2rsp; |
325 | 390 | ||
326 | status = BT_STATUS; | 391 | switch (cCode) { |
327 | printk(KERN_DEBUG "BT: %s in %s %s\n", reason, STATE2TXT, | 392 | case IPMI_TIMEOUT_ERR: |
328 | STATUS2TXT(buf)); | 393 | reason = "timeout"; |
394 | break; | ||
395 | default: | ||
396 | reason = "internal error"; | ||
397 | break; | ||
398 | } | ||
399 | |||
400 | printk(KERN_WARNING "IPMI BT: %s in %s %s ", /* open-ended line */ | ||
401 | reason, STATE2TXT, STATUS2TXT); | ||
329 | 402 | ||
403 | /* Per the IPMI spec, retries are based on the sequence number | ||
404 | known only to this module, so manage a restart here. */ | ||
330 | (bt->error_retries)++; | 405 | (bt->error_retries)++; |
331 | if (bt->error_retries > BT_RETRY_LIMIT) { | 406 | if (bt->error_retries < bt->BT_CAP_retries) { |
332 | printk(KERN_DEBUG "retry limit (%d) exceeded\n", BT_RETRY_LIMIT); | 407 | printk("%d retries left\n", |
333 | bt->state = BT_STATE_HOSED; | 408 | bt->BT_CAP_retries - bt->error_retries); |
334 | if (!bt->nonzero_status) | 409 | bt->state = BT_STATE_RESTART; |
335 | printk(KERN_ERR "IPMI: BT stuck, try power cycle\n"); | 410 | return SI_SM_CALL_WITHOUT_DELAY; |
336 | else if (bt->error_retries <= BT_RETRY_LIMIT + 1) { | ||
337 | printk(KERN_DEBUG "IPMI: BT reset (takes 5 secs)\n"); | ||
338 | bt->state = BT_STATE_RESET1; | ||
339 | } | ||
340 | return; | ||
341 | } | 411 | } |
342 | 412 | ||
343 | /* Sometimes the BMC queues get in an "off-by-one" state...*/ | 413 | printk("failed %d retries, sending error response\n", |
344 | if ((bt->state == BT_STATE_B2H_WAIT) && (status & BT_B2H_ATN)) { | 414 | bt->BT_CAP_retries); |
345 | printk(KERN_DEBUG "retry B2H_WAIT\n"); | 415 | if (!bt->nonzero_status) |
346 | return; | 416 | printk(KERN_ERR "IPMI BT: stuck, try power cycle\n"); |
417 | |||
418 | /* this is most likely during insmod */ | ||
419 | else if (bt->seq <= (unsigned char)(bt->BT_CAP_retries & 0xFF)) { | ||
420 | printk(KERN_WARNING "IPMI: BT reset (takes 5 secs)\n"); | ||
421 | bt->state = BT_STATE_RESET1; | ||
422 | return SI_SM_CALL_WITHOUT_DELAY; | ||
347 | } | 423 | } |
348 | 424 | ||
349 | printk(KERN_DEBUG "restart command\n"); | 425 | /* Concoct a useful error message, set up the next state, and |
350 | bt->state = BT_STATE_RESTART; | 426 | be done with this sequence. */ |
427 | |||
428 | bt->state = BT_STATE_IDLE; | ||
429 | switch (cCode) { | ||
430 | case IPMI_TIMEOUT_ERR: | ||
431 | if (status & BT_B_BUSY) { | ||
432 | cCode = IPMI_NODE_BUSY_ERR; | ||
433 | bt->state = BT_STATE_LONG_BUSY; | ||
434 | } | ||
435 | break; | ||
436 | default: | ||
437 | break; | ||
438 | } | ||
439 | force_result(bt, cCode); | ||
440 | return SI_SM_TRANSACTION_COMPLETE; | ||
351 | } | 441 | } |
352 | 442 | ||
353 | /* Check the status and (possibly) advance the BT state machine. The | 443 | /* Check status and (usually) take action and change this state machine. */ |
354 | default return is SI_SM_CALL_WITH_DELAY. */ | ||
355 | 444 | ||
356 | static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | 445 | static enum si_sm_result bt_event(struct si_sm_data *bt, long time) |
357 | { | 446 | { |
358 | unsigned char status; | 447 | unsigned char status, BT_CAP[8]; |
359 | char buf[40]; /* For getting status */ | 448 | static enum bt_states last_printed = BT_STATE_PRINTME; |
360 | int i; | 449 | int i; |
361 | 450 | ||
362 | status = BT_STATUS; | 451 | status = BT_STATUS; |
363 | bt->nonzero_status |= status; | 452 | bt->nonzero_status |= status; |
364 | 453 | if ((bt_debug & BT_DEBUG_STATES) && (bt->state != last_printed)) { | |
365 | if ((bt_debug & BT_DEBUG_STATES) && (bt->state != bt->last_state)) | ||
366 | printk(KERN_WARNING "BT: %s %s TO=%ld - %ld \n", | 454 | printk(KERN_WARNING "BT: %s %s TO=%ld - %ld \n", |
367 | STATE2TXT, | 455 | STATE2TXT, |
368 | STATUS2TXT(buf), | 456 | STATUS2TXT, |
369 | bt->timeout, | 457 | bt->timeout, |
370 | time); | 458 | time); |
371 | bt->last_state = bt->state; | 459 | last_printed = bt->state; |
460 | } | ||
372 | 461 | ||
373 | if (bt->state == BT_STATE_HOSED) | 462 | /* Commands that time out may still (eventually) provide a response. |
374 | return SI_SM_HOSED; | 463 | This stale response will get in the way of a new response so remove |
464 | it if possible (hopefully during IDLE). Even if it comes up later | ||
465 | it will be rejected by its (now-forgotten) seq number. */ | ||
466 | |||
467 | if ((bt->state < BT_STATE_WRITE_BYTES) && (status & BT_B2H_ATN)) { | ||
468 | drain_BMC2HOST(bt); | ||
469 | BT_SI_SM_RETURN(SI_SM_CALL_WITH_DELAY); | ||
470 | } | ||
375 | 471 | ||
376 | if (bt->state != BT_STATE_IDLE) { /* do timeout test */ | 472 | if ((bt->state != BT_STATE_IDLE) && |
473 | (bt->state < BT_STATE_PRINTME)) { /* check timeout */ | ||
377 | bt->timeout -= time; | 474 | bt->timeout -= time; |
378 | if ((bt->timeout < 0) && (bt->state < BT_STATE_RESET1)) { | 475 | if ((bt->timeout < 0) && (bt->state < BT_STATE_RESET1)) |
379 | error_recovery(bt, "timed out"); | 476 | return error_recovery(bt, |
380 | return SI_SM_CALL_WITHOUT_DELAY; | 477 | status, |
381 | } | 478 | IPMI_TIMEOUT_ERR); |
382 | } | 479 | } |
383 | 480 | ||
384 | switch (bt->state) { | 481 | switch (bt->state) { |
385 | 482 | ||
386 | case BT_STATE_IDLE: /* check for asynchronous messages */ | 483 | /* Idle state first checks for asynchronous messages from another |
484 | channel, then does some opportunistic housekeeping. */ | ||
485 | |||
486 | case BT_STATE_IDLE: | ||
387 | if (status & BT_SMS_ATN) { | 487 | if (status & BT_SMS_ATN) { |
388 | BT_CONTROL(BT_SMS_ATN); /* clear it */ | 488 | BT_CONTROL(BT_SMS_ATN); /* clear it */ |
389 | return SI_SM_ATTN; | 489 | return SI_SM_ATTN; |
390 | } | 490 | } |
391 | return SI_SM_IDLE; | ||
392 | 491 | ||
393 | case BT_STATE_XACTION_START: | 492 | if (status & BT_H_BUSY) /* clear a leftover H_BUSY */ |
394 | if (status & BT_H_BUSY) { | ||
395 | BT_CONTROL(BT_H_BUSY); | 493 | BT_CONTROL(BT_H_BUSY); |
396 | break; | ||
397 | } | ||
398 | if (status & BT_B2H_ATN) | ||
399 | break; | ||
400 | bt->state = BT_STATE_WRITE_BYTES; | ||
401 | return SI_SM_CALL_WITHOUT_DELAY; /* for logging */ | ||
402 | 494 | ||
403 | case BT_STATE_WRITE_BYTES: | 495 | /* Read BT capabilities if it hasn't been done yet */ |
496 | if (!bt->BT_CAP_outreqs) | ||
497 | BT_STATE_CHANGE(BT_STATE_CAPABILITIES_BEGIN, | ||
498 | SI_SM_CALL_WITHOUT_DELAY); | ||
499 | bt->timeout = bt->BT_CAP_req2rsp; | ||
500 | BT_SI_SM_RETURN(SI_SM_IDLE); | ||
501 | |||
502 | case BT_STATE_XACTION_START: | ||
404 | if (status & (BT_B_BUSY | BT_H2B_ATN)) | 503 | if (status & (BT_B_BUSY | BT_H2B_ATN)) |
405 | break; | 504 | BT_SI_SM_RETURN(SI_SM_CALL_WITH_DELAY); |
505 | if (BT_STATUS & BT_H_BUSY) | ||
506 | BT_CONTROL(BT_H_BUSY); /* force clear */ | ||
507 | BT_STATE_CHANGE(BT_STATE_WRITE_BYTES, | ||
508 | SI_SM_CALL_WITHOUT_DELAY); | ||
509 | |||
510 | case BT_STATE_WRITE_BYTES: | ||
511 | if (status & BT_H_BUSY) | ||
512 | BT_CONTROL(BT_H_BUSY); /* clear */ | ||
406 | BT_CONTROL(BT_CLR_WR_PTR); | 513 | BT_CONTROL(BT_CLR_WR_PTR); |
407 | write_all_bytes(bt); | 514 | write_all_bytes(bt); |
408 | BT_CONTROL(BT_H2B_ATN); /* clears too fast to catch? */ | 515 | BT_CONTROL(BT_H2B_ATN); /* can clear too fast to catch */ |
409 | bt->state = BT_STATE_WRITE_CONSUME; | 516 | BT_STATE_CHANGE(BT_STATE_WRITE_CONSUME, |
410 | return SI_SM_CALL_WITHOUT_DELAY; /* it MIGHT sail through */ | 517 | SI_SM_CALL_WITHOUT_DELAY); |
411 | |||
412 | case BT_STATE_WRITE_CONSUME: /* BMCs usually blow right thru here */ | ||
413 | if (status & (BT_H2B_ATN | BT_B_BUSY)) | ||
414 | break; | ||
415 | bt->state = BT_STATE_B2H_WAIT; | ||
416 | /* fall through with status */ | ||
417 | |||
418 | /* Stay in BT_STATE_B2H_WAIT until a packet matches. However, spinning | ||
419 | hard here, constantly reading status, seems to hold off the | ||
420 | generation of B2H_ATN so ALWAYS return CALL_WITH_DELAY. */ | ||
421 | |||
422 | case BT_STATE_B2H_WAIT: | ||
423 | if (!(status & BT_B2H_ATN)) | ||
424 | break; | ||
425 | |||
426 | /* Assume ordered, uncached writes: no need to wait */ | ||
427 | if (!(status & BT_H_BUSY)) | ||
428 | BT_CONTROL(BT_H_BUSY); /* set */ | ||
429 | BT_CONTROL(BT_B2H_ATN); /* clear it, ACK to the BMC */ | ||
430 | BT_CONTROL(BT_CLR_RD_PTR); /* reset the queue */ | ||
431 | i = read_all_bytes(bt); | ||
432 | BT_CONTROL(BT_H_BUSY); /* clear */ | ||
433 | if (!i) /* Try this state again */ | ||
434 | break; | ||
435 | bt->state = BT_STATE_READ_END; | ||
436 | return SI_SM_CALL_WITHOUT_DELAY; /* for logging */ | ||
437 | |||
438 | case BT_STATE_READ_END: | ||
439 | |||
440 | /* I could wait on BT_H_BUSY to go clear for a truly clean | ||
441 | exit. However, this is already done in XACTION_START | ||
442 | and the (possible) extra loop/status/possible wait affects | ||
443 | performance. So, as long as it works, just ignore H_BUSY */ | ||
444 | |||
445 | #ifdef MAKE_THIS_TRUE_IF_NECESSARY | ||
446 | 518 | ||
447 | if (status & BT_H_BUSY) | 519 | case BT_STATE_WRITE_CONSUME: |
448 | break; | 520 | if (status & (BT_B_BUSY | BT_H2B_ATN)) |
449 | #endif | 521 | BT_SI_SM_RETURN(SI_SM_CALL_WITH_DELAY); |
450 | bt->seq++; | 522 | BT_STATE_CHANGE(BT_STATE_READ_WAIT, |
451 | bt->state = BT_STATE_IDLE; | 523 | SI_SM_CALL_WITHOUT_DELAY); |
452 | return SI_SM_TRANSACTION_COMPLETE; | 524 | |
525 | /* Spinning hard can suppress B2H_ATN and force a timeout */ | ||
526 | |||
527 | case BT_STATE_READ_WAIT: | ||
528 | if (!(status & BT_B2H_ATN)) | ||
529 | BT_SI_SM_RETURN(SI_SM_CALL_WITH_DELAY); | ||
530 | BT_CONTROL(BT_H_BUSY); /* set */ | ||
531 | |||
532 | /* Uncached, ordered writes should just proceeed serially but | ||
533 | some BMCs don't clear B2H_ATN with one hit. Fast-path a | ||
534 | workaround without too much penalty to the general case. */ | ||
535 | |||
536 | BT_CONTROL(BT_B2H_ATN); /* clear it to ACK the BMC */ | ||
537 | BT_STATE_CHANGE(BT_STATE_CLEAR_B2H, | ||
538 | SI_SM_CALL_WITHOUT_DELAY); | ||
539 | |||
540 | case BT_STATE_CLEAR_B2H: | ||
541 | if (status & BT_B2H_ATN) { /* keep hitting it */ | ||
542 | BT_CONTROL(BT_B2H_ATN); | ||
543 | BT_SI_SM_RETURN(SI_SM_CALL_WITH_DELAY); | ||
544 | } | ||
545 | BT_STATE_CHANGE(BT_STATE_READ_BYTES, | ||
546 | SI_SM_CALL_WITHOUT_DELAY); | ||
547 | |||
548 | case BT_STATE_READ_BYTES: | ||
549 | if (!(status & BT_H_BUSY)) /* check in case of retry */ | ||
550 | BT_CONTROL(BT_H_BUSY); | ||
551 | BT_CONTROL(BT_CLR_RD_PTR); /* start of BMC2HOST buffer */ | ||
552 | i = read_all_bytes(bt); /* true == packet seq match */ | ||
553 | BT_CONTROL(BT_H_BUSY); /* NOW clear */ | ||
554 | if (!i) /* Not my message */ | ||
555 | BT_STATE_CHANGE(BT_STATE_READ_WAIT, | ||
556 | SI_SM_CALL_WITHOUT_DELAY); | ||
557 | bt->state = bt->complete; | ||
558 | return bt->state == BT_STATE_IDLE ? /* where to next? */ | ||
559 | SI_SM_TRANSACTION_COMPLETE : /* normal */ | ||
560 | SI_SM_CALL_WITHOUT_DELAY; /* Startup magic */ | ||
561 | |||
562 | case BT_STATE_LONG_BUSY: /* For example: after FW update */ | ||
563 | if (!(status & BT_B_BUSY)) { | ||
564 | reset_flags(bt); /* next state is now IDLE */ | ||
565 | bt_init_data(bt, bt->io); | ||
566 | } | ||
567 | return SI_SM_CALL_WITH_DELAY; /* No repeat printing */ | ||
453 | 568 | ||
454 | case BT_STATE_RESET1: | 569 | case BT_STATE_RESET1: |
455 | reset_flags(bt); | 570 | reset_flags(bt); |
456 | bt->timeout = BT_RESET_DELAY; | 571 | drain_BMC2HOST(bt); |
457 | bt->state = BT_STATE_RESET2; | 572 | BT_STATE_CHANGE(BT_STATE_RESET2, |
458 | break; | 573 | SI_SM_CALL_WITH_DELAY); |
459 | 574 | ||
460 | case BT_STATE_RESET2: /* Send a soft reset */ | 575 | case BT_STATE_RESET2: /* Send a soft reset */ |
461 | BT_CONTROL(BT_CLR_WR_PTR); | 576 | BT_CONTROL(BT_CLR_WR_PTR); |
@@ -464,29 +579,59 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | |||
464 | HOST2BMC(42); /* Sequence number */ | 579 | HOST2BMC(42); /* Sequence number */ |
465 | HOST2BMC(3); /* Cmd == Soft reset */ | 580 | HOST2BMC(3); /* Cmd == Soft reset */ |
466 | BT_CONTROL(BT_H2B_ATN); | 581 | BT_CONTROL(BT_H2B_ATN); |
467 | bt->state = BT_STATE_RESET3; | 582 | bt->timeout = BT_RESET_DELAY * 1000000; |
468 | break; | 583 | BT_STATE_CHANGE(BT_STATE_RESET3, |
584 | SI_SM_CALL_WITH_DELAY); | ||
469 | 585 | ||
470 | case BT_STATE_RESET3: | 586 | case BT_STATE_RESET3: /* Hold off everything for a bit */ |
471 | if (bt->timeout > 0) | 587 | if (bt->timeout > 0) |
472 | return SI_SM_CALL_WITH_DELAY; | 588 | return SI_SM_CALL_WITH_DELAY; |
473 | bt->state = BT_STATE_RESTART; /* printk in debug modes */ | 589 | drain_BMC2HOST(bt); |
474 | break; | 590 | BT_STATE_CHANGE(BT_STATE_RESTART, |
591 | SI_SM_CALL_WITH_DELAY); | ||
475 | 592 | ||
476 | case BT_STATE_RESTART: /* don't reset retries! */ | 593 | case BT_STATE_RESTART: /* don't reset retries or seq! */ |
477 | reset_flags(bt); | ||
478 | bt->write_data[2] = ++bt->seq; | ||
479 | bt->read_count = 0; | 594 | bt->read_count = 0; |
480 | bt->nonzero_status = 0; | 595 | bt->nonzero_status = 0; |
481 | bt->timeout = BT_NORMAL_TIMEOUT; | 596 | bt->timeout = bt->BT_CAP_req2rsp; |
482 | bt->state = BT_STATE_XACTION_START; | 597 | BT_STATE_CHANGE(BT_STATE_XACTION_START, |
483 | break; | 598 | SI_SM_CALL_WITH_DELAY); |
484 | 599 | ||
485 | default: /* HOSED is supposed to be caught much earlier */ | 600 | /* Get BT Capabilities, using timing of upper level state machine. |
486 | error_recovery(bt, "internal logic error"); | 601 | Set outreqs to prevent infinite loop on timeout. */ |
487 | break; | 602 | case BT_STATE_CAPABILITIES_BEGIN: |
488 | } | 603 | bt->BT_CAP_outreqs = 1; |
489 | return SI_SM_CALL_WITH_DELAY; | 604 | { |
605 | unsigned char GetBT_CAP[] = { 0x18, 0x36 }; | ||
606 | bt->state = BT_STATE_IDLE; | ||
607 | bt_start_transaction(bt, GetBT_CAP, sizeof(GetBT_CAP)); | ||
608 | } | ||
609 | bt->complete = BT_STATE_CAPABILITIES_END; | ||
610 | BT_STATE_CHANGE(BT_STATE_XACTION_START, | ||
611 | SI_SM_CALL_WITH_DELAY); | ||
612 | |||
613 | case BT_STATE_CAPABILITIES_END: | ||
614 | i = bt_get_result(bt, BT_CAP, sizeof(BT_CAP)); | ||
615 | bt_init_data(bt, bt->io); | ||
616 | if ((i == 8) && !BT_CAP[2]) { | ||
617 | bt->BT_CAP_outreqs = BT_CAP[3]; | ||
618 | bt->BT_CAP_req2rsp = BT_CAP[6] * 1000000; | ||
619 | bt->BT_CAP_retries = BT_CAP[7]; | ||
620 | } else | ||
621 | printk(KERN_WARNING "IPMI BT: using default values\n"); | ||
622 | if (!bt->BT_CAP_outreqs) | ||
623 | bt->BT_CAP_outreqs = 1; | ||
624 | printk(KERN_WARNING "IPMI BT: req2rsp=%ld secs retries=%d\n", | ||
625 | bt->BT_CAP_req2rsp / 1000000L, bt->BT_CAP_retries); | ||
626 | bt->timeout = bt->BT_CAP_req2rsp; | ||
627 | return SI_SM_CALL_WITHOUT_DELAY; | ||
628 | |||
629 | default: /* should never occur */ | ||
630 | return error_recovery(bt, | ||
631 | status, | ||
632 | IPMI_ERR_UNSPECIFIED); | ||
633 | } | ||
634 | return SI_SM_CALL_WITH_DELAY; | ||
490 | } | 635 | } |
491 | 636 | ||
492 | static int bt_detect(struct si_sm_data *bt) | 637 | static int bt_detect(struct si_sm_data *bt) |
@@ -497,7 +642,7 @@ static int bt_detect(struct si_sm_data *bt) | |||
497 | test that first. The calling routine uses negative logic. */ | 642 | test that first. The calling routine uses negative logic. */ |
498 | 643 | ||
499 | if ((BT_STATUS == 0xFF) && (BT_INTMASK_R == 0xFF)) | 644 | if ((BT_STATUS == 0xFF) && (BT_INTMASK_R == 0xFF)) |
500 | return 1; | 645 | return 1; |
501 | reset_flags(bt); | 646 | reset_flags(bt); |
502 | return 0; | 647 | return 0; |
503 | } | 648 | } |
@@ -513,11 +658,11 @@ static int bt_size(void) | |||
513 | 658 | ||
514 | struct si_sm_handlers bt_smi_handlers = | 659 | struct si_sm_handlers bt_smi_handlers = |
515 | { | 660 | { |
516 | .init_data = bt_init_data, | 661 | .init_data = bt_init_data, |
517 | .start_transaction = bt_start_transaction, | 662 | .start_transaction = bt_start_transaction, |
518 | .get_result = bt_get_result, | 663 | .get_result = bt_get_result, |
519 | .event = bt_event, | 664 | .event = bt_event, |
520 | .detect = bt_detect, | 665 | .detect = bt_detect, |
521 | .cleanup = bt_cleanup, | 666 | .cleanup = bt_cleanup, |
522 | .size = bt_size, | 667 | .size = bt_size, |
523 | }; | 668 | }; |
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index 81fcf0ce21d1..375d3378eecd 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -596,6 +596,31 @@ static int ipmi_ioctl(struct inode *inode, | |||
596 | rv = 0; | 596 | rv = 0; |
597 | break; | 597 | break; |
598 | } | 598 | } |
599 | |||
600 | case IPMICTL_GET_MAINTENANCE_MODE_CMD: | ||
601 | { | ||
602 | int mode; | ||
603 | |||
604 | mode = ipmi_get_maintenance_mode(priv->user); | ||
605 | if (copy_to_user(arg, &mode, sizeof(mode))) { | ||
606 | rv = -EFAULT; | ||
607 | break; | ||
608 | } | ||
609 | rv = 0; | ||
610 | break; | ||
611 | } | ||
612 | |||
613 | case IPMICTL_SET_MAINTENANCE_MODE_CMD: | ||
614 | { | ||
615 | int mode; | ||
616 | |||
617 | if (copy_from_user(&mode, arg, sizeof(mode))) { | ||
618 | rv = -EFAULT; | ||
619 | break; | ||
620 | } | ||
621 | rv = ipmi_set_maintenance_mode(priv->user, mode); | ||
622 | break; | ||
623 | } | ||
599 | } | 624 | } |
600 | 625 | ||
601 | return rv; | 626 | return rv; |
diff --git a/drivers/char/ipmi/ipmi_kcs_sm.c b/drivers/char/ipmi/ipmi_kcs_sm.c index 2062675f9e99..c1b8228cb7b6 100644 --- a/drivers/char/ipmi/ipmi_kcs_sm.c +++ b/drivers/char/ipmi/ipmi_kcs_sm.c | |||
@@ -93,8 +93,8 @@ enum kcs_states { | |||
93 | state machine. */ | 93 | state machine. */ |
94 | }; | 94 | }; |
95 | 95 | ||
96 | #define MAX_KCS_READ_SIZE 80 | 96 | #define MAX_KCS_READ_SIZE IPMI_MAX_MSG_LENGTH |
97 | #define MAX_KCS_WRITE_SIZE 80 | 97 | #define MAX_KCS_WRITE_SIZE IPMI_MAX_MSG_LENGTH |
98 | 98 | ||
99 | /* Timeouts in microseconds. */ | 99 | /* Timeouts in microseconds. */ |
100 | #define IBF_RETRY_TIMEOUT 1000000 | 100 | #define IBF_RETRY_TIMEOUT 1000000 |
@@ -261,12 +261,14 @@ static int start_kcs_transaction(struct si_sm_data *kcs, unsigned char *data, | |||
261 | { | 261 | { |
262 | unsigned int i; | 262 | unsigned int i; |
263 | 263 | ||
264 | if ((size < 2) || (size > MAX_KCS_WRITE_SIZE)) { | 264 | if (size < 2) |
265 | return -1; | 265 | return IPMI_REQ_LEN_INVALID_ERR; |
266 | } | 266 | if (size > MAX_KCS_WRITE_SIZE) |
267 | if ((kcs->state != KCS_IDLE) && (kcs->state != KCS_HOSED)) { | 267 | return IPMI_REQ_LEN_EXCEEDED_ERR; |
268 | return -2; | 268 | |
269 | } | 269 | if ((kcs->state != KCS_IDLE) && (kcs->state != KCS_HOSED)) |
270 | return IPMI_NOT_IN_MY_STATE_ERR; | ||
271 | |||
270 | if (kcs_debug & KCS_DEBUG_MSG) { | 272 | if (kcs_debug & KCS_DEBUG_MSG) { |
271 | printk(KERN_DEBUG "start_kcs_transaction -"); | 273 | printk(KERN_DEBUG "start_kcs_transaction -"); |
272 | for (i = 0; i < size; i ++) { | 274 | for (i = 0; i < size; i ++) { |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index c47add8e47df..5703ee28e1cc 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -48,7 +48,7 @@ | |||
48 | 48 | ||
49 | #define PFX "IPMI message handler: " | 49 | #define PFX "IPMI message handler: " |
50 | 50 | ||
51 | #define IPMI_DRIVER_VERSION "39.0" | 51 | #define IPMI_DRIVER_VERSION "39.1" |
52 | 52 | ||
53 | static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void); | 53 | static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void); |
54 | static int ipmi_init_msghandler(void); | 54 | static int ipmi_init_msghandler(void); |
@@ -59,6 +59,9 @@ static int initialized = 0; | |||
59 | static struct proc_dir_entry *proc_ipmi_root = NULL; | 59 | static struct proc_dir_entry *proc_ipmi_root = NULL; |
60 | #endif /* CONFIG_PROC_FS */ | 60 | #endif /* CONFIG_PROC_FS */ |
61 | 61 | ||
62 | /* Remain in auto-maintenance mode for this amount of time (in ms). */ | ||
63 | #define IPMI_MAINTENANCE_MODE_TIMEOUT 30000 | ||
64 | |||
62 | #define MAX_EVENTS_IN_QUEUE 25 | 65 | #define MAX_EVENTS_IN_QUEUE 25 |
63 | 66 | ||
64 | /* Don't let a message sit in a queue forever, always time it with at lest | 67 | /* Don't let a message sit in a queue forever, always time it with at lest |
@@ -193,17 +196,28 @@ struct ipmi_smi | |||
193 | 196 | ||
194 | struct kref refcount; | 197 | struct kref refcount; |
195 | 198 | ||
199 | /* Used for a list of interfaces. */ | ||
200 | struct list_head link; | ||
201 | |||
196 | /* The list of upper layers that are using me. seq_lock | 202 | /* The list of upper layers that are using me. seq_lock |
197 | * protects this. */ | 203 | * protects this. */ |
198 | struct list_head users; | 204 | struct list_head users; |
199 | 205 | ||
206 | /* Information to supply to users. */ | ||
207 | unsigned char ipmi_version_major; | ||
208 | unsigned char ipmi_version_minor; | ||
209 | |||
200 | /* Used for wake ups at startup. */ | 210 | /* Used for wake ups at startup. */ |
201 | wait_queue_head_t waitq; | 211 | wait_queue_head_t waitq; |
202 | 212 | ||
203 | struct bmc_device *bmc; | 213 | struct bmc_device *bmc; |
204 | char *my_dev_name; | 214 | char *my_dev_name; |
215 | char *sysfs_name; | ||
205 | 216 | ||
206 | /* This is the lower-layer's sender routine. */ | 217 | /* This is the lower-layer's sender routine. Note that you |
218 | * must either be holding the ipmi_interfaces_mutex or be in | ||
219 | * an umpreemptible region to use this. You must fetch the | ||
220 | * value into a local variable and make sure it is not NULL. */ | ||
207 | struct ipmi_smi_handlers *handlers; | 221 | struct ipmi_smi_handlers *handlers; |
208 | void *send_info; | 222 | void *send_info; |
209 | 223 | ||
@@ -242,6 +256,7 @@ struct ipmi_smi | |||
242 | spinlock_t events_lock; /* For dealing with event stuff. */ | 256 | spinlock_t events_lock; /* For dealing with event stuff. */ |
243 | struct list_head waiting_events; | 257 | struct list_head waiting_events; |
244 | unsigned int waiting_events_count; /* How many events in queue? */ | 258 | unsigned int waiting_events_count; /* How many events in queue? */ |
259 | int delivering_events; | ||
245 | 260 | ||
246 | /* The event receiver for my BMC, only really used at panic | 261 | /* The event receiver for my BMC, only really used at panic |
247 | shutdown as a place to store this. */ | 262 | shutdown as a place to store this. */ |
@@ -250,6 +265,12 @@ struct ipmi_smi | |||
250 | unsigned char local_sel_device; | 265 | unsigned char local_sel_device; |
251 | unsigned char local_event_generator; | 266 | unsigned char local_event_generator; |
252 | 267 | ||
268 | /* For handling of maintenance mode. */ | ||
269 | int maintenance_mode; | ||
270 | int maintenance_mode_enable; | ||
271 | int auto_maintenance_timeout; | ||
272 | spinlock_t maintenance_mode_lock; /* Used in a timer... */ | ||
273 | |||
253 | /* A cheap hack, if this is non-null and a message to an | 274 | /* A cheap hack, if this is non-null and a message to an |
254 | interface comes in with a NULL user, call this routine with | 275 | interface comes in with a NULL user, call this routine with |
255 | it. Note that the message will still be freed by the | 276 | it. Note that the message will still be freed by the |
@@ -338,13 +359,6 @@ struct ipmi_smi | |||
338 | }; | 359 | }; |
339 | #define to_si_intf_from_dev(device) container_of(device, struct ipmi_smi, dev) | 360 | #define to_si_intf_from_dev(device) container_of(device, struct ipmi_smi, dev) |
340 | 361 | ||
341 | /* Used to mark an interface entry that cannot be used but is not a | ||
342 | * free entry, either, primarily used at creation and deletion time so | ||
343 | * a slot doesn't get reused too quickly. */ | ||
344 | #define IPMI_INVALID_INTERFACE_ENTRY ((ipmi_smi_t) ((long) 1)) | ||
345 | #define IPMI_INVALID_INTERFACE(i) (((i) == NULL) \ | ||
346 | || (i == IPMI_INVALID_INTERFACE_ENTRY)) | ||
347 | |||
348 | /** | 362 | /** |
349 | * The driver model view of the IPMI messaging driver. | 363 | * The driver model view of the IPMI messaging driver. |
350 | */ | 364 | */ |
@@ -354,16 +368,13 @@ static struct device_driver ipmidriver = { | |||
354 | }; | 368 | }; |
355 | static DEFINE_MUTEX(ipmidriver_mutex); | 369 | static DEFINE_MUTEX(ipmidriver_mutex); |
356 | 370 | ||
357 | #define MAX_IPMI_INTERFACES 4 | 371 | static struct list_head ipmi_interfaces = LIST_HEAD_INIT(ipmi_interfaces); |
358 | static ipmi_smi_t ipmi_interfaces[MAX_IPMI_INTERFACES]; | 372 | static DEFINE_MUTEX(ipmi_interfaces_mutex); |
359 | |||
360 | /* Directly protects the ipmi_interfaces data structure. */ | ||
361 | static DEFINE_SPINLOCK(interfaces_lock); | ||
362 | 373 | ||
363 | /* List of watchers that want to know when smi's are added and | 374 | /* List of watchers that want to know when smi's are added and |
364 | deleted. */ | 375 | deleted. */ |
365 | static struct list_head smi_watchers = LIST_HEAD_INIT(smi_watchers); | 376 | static struct list_head smi_watchers = LIST_HEAD_INIT(smi_watchers); |
366 | static DECLARE_RWSEM(smi_watchers_sem); | 377 | static DEFINE_MUTEX(smi_watchers_mutex); |
367 | 378 | ||
368 | 379 | ||
369 | static void free_recv_msg_list(struct list_head *q) | 380 | static void free_recv_msg_list(struct list_head *q) |
@@ -423,48 +434,84 @@ static void intf_free(struct kref *ref) | |||
423 | kfree(intf); | 434 | kfree(intf); |
424 | } | 435 | } |
425 | 436 | ||
437 | struct watcher_entry { | ||
438 | int intf_num; | ||
439 | ipmi_smi_t intf; | ||
440 | struct list_head link; | ||
441 | }; | ||
442 | |||
426 | int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher) | 443 | int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher) |
427 | { | 444 | { |
428 | int i; | 445 | ipmi_smi_t intf; |
429 | unsigned long flags; | 446 | struct list_head to_deliver = LIST_HEAD_INIT(to_deliver); |
447 | struct watcher_entry *e, *e2; | ||
448 | |||
449 | mutex_lock(&smi_watchers_mutex); | ||
450 | |||
451 | mutex_lock(&ipmi_interfaces_mutex); | ||
430 | 452 | ||
431 | down_write(&smi_watchers_sem); | 453 | /* Build a list of things to deliver. */ |
432 | list_add(&(watcher->link), &smi_watchers); | 454 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { |
433 | up_write(&smi_watchers_sem); | 455 | if (intf->intf_num == -1) |
434 | spin_lock_irqsave(&interfaces_lock, flags); | ||
435 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { | ||
436 | ipmi_smi_t intf = ipmi_interfaces[i]; | ||
437 | if (IPMI_INVALID_INTERFACE(intf)) | ||
438 | continue; | 456 | continue; |
439 | spin_unlock_irqrestore(&interfaces_lock, flags); | 457 | e = kmalloc(sizeof(*e), GFP_KERNEL); |
440 | watcher->new_smi(i, intf->si_dev); | 458 | if (!e) |
441 | spin_lock_irqsave(&interfaces_lock, flags); | 459 | goto out_err; |
460 | kref_get(&intf->refcount); | ||
461 | e->intf = intf; | ||
462 | e->intf_num = intf->intf_num; | ||
463 | list_add_tail(&e->link, &to_deliver); | ||
442 | } | 464 | } |
443 | spin_unlock_irqrestore(&interfaces_lock, flags); | 465 | |
466 | /* We will succeed, so add it to the list. */ | ||
467 | list_add(&watcher->link, &smi_watchers); | ||
468 | |||
469 | mutex_unlock(&ipmi_interfaces_mutex); | ||
470 | |||
471 | list_for_each_entry_safe(e, e2, &to_deliver, link) { | ||
472 | list_del(&e->link); | ||
473 | watcher->new_smi(e->intf_num, e->intf->si_dev); | ||
474 | kref_put(&e->intf->refcount, intf_free); | ||
475 | kfree(e); | ||
476 | } | ||
477 | |||
478 | mutex_unlock(&smi_watchers_mutex); | ||
479 | |||
444 | return 0; | 480 | return 0; |
481 | |||
482 | out_err: | ||
483 | mutex_unlock(&ipmi_interfaces_mutex); | ||
484 | mutex_unlock(&smi_watchers_mutex); | ||
485 | list_for_each_entry_safe(e, e2, &to_deliver, link) { | ||
486 | list_del(&e->link); | ||
487 | kref_put(&e->intf->refcount, intf_free); | ||
488 | kfree(e); | ||
489 | } | ||
490 | return -ENOMEM; | ||
445 | } | 491 | } |
446 | 492 | ||
447 | int ipmi_smi_watcher_unregister(struct ipmi_smi_watcher *watcher) | 493 | int ipmi_smi_watcher_unregister(struct ipmi_smi_watcher *watcher) |
448 | { | 494 | { |
449 | down_write(&smi_watchers_sem); | 495 | mutex_lock(&smi_watchers_mutex); |
450 | list_del(&(watcher->link)); | 496 | list_del(&(watcher->link)); |
451 | up_write(&smi_watchers_sem); | 497 | mutex_unlock(&smi_watchers_mutex); |
452 | return 0; | 498 | return 0; |
453 | } | 499 | } |
454 | 500 | ||
501 | /* | ||
502 | * Must be called with smi_watchers_mutex held. | ||
503 | */ | ||
455 | static void | 504 | static void |
456 | call_smi_watchers(int i, struct device *dev) | 505 | call_smi_watchers(int i, struct device *dev) |
457 | { | 506 | { |
458 | struct ipmi_smi_watcher *w; | 507 | struct ipmi_smi_watcher *w; |
459 | 508 | ||
460 | down_read(&smi_watchers_sem); | ||
461 | list_for_each_entry(w, &smi_watchers, link) { | 509 | list_for_each_entry(w, &smi_watchers, link) { |
462 | if (try_module_get(w->owner)) { | 510 | if (try_module_get(w->owner)) { |
463 | w->new_smi(i, dev); | 511 | w->new_smi(i, dev); |
464 | module_put(w->owner); | 512 | module_put(w->owner); |
465 | } | 513 | } |
466 | } | 514 | } |
467 | up_read(&smi_watchers_sem); | ||
468 | } | 515 | } |
469 | 516 | ||
470 | static int | 517 | static int |
@@ -590,6 +637,17 @@ static void deliver_response(struct ipmi_recv_msg *msg) | |||
590 | } | 637 | } |
591 | } | 638 | } |
592 | 639 | ||
640 | static void | ||
641 | deliver_err_response(struct ipmi_recv_msg *msg, int err) | ||
642 | { | ||
643 | msg->recv_type = IPMI_RESPONSE_RECV_TYPE; | ||
644 | msg->msg_data[0] = err; | ||
645 | msg->msg.netfn |= 1; /* Convert to a response. */ | ||
646 | msg->msg.data_len = 1; | ||
647 | msg->msg.data = msg->msg_data; | ||
648 | deliver_response(msg); | ||
649 | } | ||
650 | |||
593 | /* Find the next sequence number not being used and add the given | 651 | /* Find the next sequence number not being used and add the given |
594 | message with the given timeout to the sequence table. This must be | 652 | message with the given timeout to the sequence table. This must be |
595 | called with the interface's seq_lock held. */ | 653 | called with the interface's seq_lock held. */ |
@@ -727,14 +785,8 @@ static int intf_err_seq(ipmi_smi_t intf, | |||
727 | } | 785 | } |
728 | spin_unlock_irqrestore(&(intf->seq_lock), flags); | 786 | spin_unlock_irqrestore(&(intf->seq_lock), flags); |
729 | 787 | ||
730 | if (msg) { | 788 | if (msg) |
731 | msg->recv_type = IPMI_RESPONSE_RECV_TYPE; | 789 | deliver_err_response(msg, err); |
732 | msg->msg_data[0] = err; | ||
733 | msg->msg.netfn |= 1; /* Convert to a response. */ | ||
734 | msg->msg.data_len = 1; | ||
735 | msg->msg.data = msg->msg_data; | ||
736 | deliver_response(msg); | ||
737 | } | ||
738 | 790 | ||
739 | return rv; | 791 | return rv; |
740 | } | 792 | } |
@@ -776,17 +828,18 @@ int ipmi_create_user(unsigned int if_num, | |||
776 | if (!new_user) | 828 | if (!new_user) |
777 | return -ENOMEM; | 829 | return -ENOMEM; |
778 | 830 | ||
779 | spin_lock_irqsave(&interfaces_lock, flags); | 831 | mutex_lock(&ipmi_interfaces_mutex); |
780 | intf = ipmi_interfaces[if_num]; | 832 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { |
781 | if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) { | 833 | if (intf->intf_num == if_num) |
782 | spin_unlock_irqrestore(&interfaces_lock, flags); | 834 | goto found; |
783 | rv = -EINVAL; | ||
784 | goto out_kfree; | ||
785 | } | 835 | } |
836 | /* Not found, return an error */ | ||
837 | rv = -EINVAL; | ||
838 | goto out_kfree; | ||
786 | 839 | ||
840 | found: | ||
787 | /* Note that each existing user holds a refcount to the interface. */ | 841 | /* Note that each existing user holds a refcount to the interface. */ |
788 | kref_get(&intf->refcount); | 842 | kref_get(&intf->refcount); |
789 | spin_unlock_irqrestore(&interfaces_lock, flags); | ||
790 | 843 | ||
791 | kref_init(&new_user->refcount); | 844 | kref_init(&new_user->refcount); |
792 | new_user->handler = handler; | 845 | new_user->handler = handler; |
@@ -807,6 +860,10 @@ int ipmi_create_user(unsigned int if_num, | |||
807 | } | 860 | } |
808 | } | 861 | } |
809 | 862 | ||
863 | /* Hold the lock so intf->handlers is guaranteed to be good | ||
864 | * until now */ | ||
865 | mutex_unlock(&ipmi_interfaces_mutex); | ||
866 | |||
810 | new_user->valid = 1; | 867 | new_user->valid = 1; |
811 | spin_lock_irqsave(&intf->seq_lock, flags); | 868 | spin_lock_irqsave(&intf->seq_lock, flags); |
812 | list_add_rcu(&new_user->link, &intf->users); | 869 | list_add_rcu(&new_user->link, &intf->users); |
@@ -817,6 +874,7 @@ int ipmi_create_user(unsigned int if_num, | |||
817 | out_kref: | 874 | out_kref: |
818 | kref_put(&intf->refcount, intf_free); | 875 | kref_put(&intf->refcount, intf_free); |
819 | out_kfree: | 876 | out_kfree: |
877 | mutex_unlock(&ipmi_interfaces_mutex); | ||
820 | kfree(new_user); | 878 | kfree(new_user); |
821 | return rv; | 879 | return rv; |
822 | } | 880 | } |
@@ -846,6 +904,7 @@ int ipmi_destroy_user(ipmi_user_t user) | |||
846 | && (intf->seq_table[i].recv_msg->user == user)) | 904 | && (intf->seq_table[i].recv_msg->user == user)) |
847 | { | 905 | { |
848 | intf->seq_table[i].inuse = 0; | 906 | intf->seq_table[i].inuse = 0; |
907 | ipmi_free_recv_msg(intf->seq_table[i].recv_msg); | ||
849 | } | 908 | } |
850 | } | 909 | } |
851 | spin_unlock_irqrestore(&intf->seq_lock, flags); | 910 | spin_unlock_irqrestore(&intf->seq_lock, flags); |
@@ -872,9 +931,13 @@ int ipmi_destroy_user(ipmi_user_t user) | |||
872 | kfree(rcvr); | 931 | kfree(rcvr); |
873 | } | 932 | } |
874 | 933 | ||
875 | module_put(intf->handlers->owner); | 934 | mutex_lock(&ipmi_interfaces_mutex); |
876 | if (intf->handlers->dec_usecount) | 935 | if (intf->handlers) { |
877 | intf->handlers->dec_usecount(intf->send_info); | 936 | module_put(intf->handlers->owner); |
937 | if (intf->handlers->dec_usecount) | ||
938 | intf->handlers->dec_usecount(intf->send_info); | ||
939 | } | ||
940 | mutex_unlock(&ipmi_interfaces_mutex); | ||
878 | 941 | ||
879 | kref_put(&intf->refcount, intf_free); | 942 | kref_put(&intf->refcount, intf_free); |
880 | 943 | ||
@@ -887,8 +950,8 @@ void ipmi_get_version(ipmi_user_t user, | |||
887 | unsigned char *major, | 950 | unsigned char *major, |
888 | unsigned char *minor) | 951 | unsigned char *minor) |
889 | { | 952 | { |
890 | *major = ipmi_version_major(&user->intf->bmc->id); | 953 | *major = user->intf->ipmi_version_major; |
891 | *minor = ipmi_version_minor(&user->intf->bmc->id); | 954 | *minor = user->intf->ipmi_version_minor; |
892 | } | 955 | } |
893 | 956 | ||
894 | int ipmi_set_my_address(ipmi_user_t user, | 957 | int ipmi_set_my_address(ipmi_user_t user, |
@@ -931,6 +994,65 @@ int ipmi_get_my_LUN(ipmi_user_t user, | |||
931 | return 0; | 994 | return 0; |
932 | } | 995 | } |
933 | 996 | ||
997 | int ipmi_get_maintenance_mode(ipmi_user_t user) | ||
998 | { | ||
999 | int mode; | ||
1000 | unsigned long flags; | ||
1001 | |||
1002 | spin_lock_irqsave(&user->intf->maintenance_mode_lock, flags); | ||
1003 | mode = user->intf->maintenance_mode; | ||
1004 | spin_unlock_irqrestore(&user->intf->maintenance_mode_lock, flags); | ||
1005 | |||
1006 | return mode; | ||
1007 | } | ||
1008 | EXPORT_SYMBOL(ipmi_get_maintenance_mode); | ||
1009 | |||
1010 | static void maintenance_mode_update(ipmi_smi_t intf) | ||
1011 | { | ||
1012 | if (intf->handlers->set_maintenance_mode) | ||
1013 | intf->handlers->set_maintenance_mode( | ||
1014 | intf->send_info, intf->maintenance_mode_enable); | ||
1015 | } | ||
1016 | |||
1017 | int ipmi_set_maintenance_mode(ipmi_user_t user, int mode) | ||
1018 | { | ||
1019 | int rv = 0; | ||
1020 | unsigned long flags; | ||
1021 | ipmi_smi_t intf = user->intf; | ||
1022 | |||
1023 | spin_lock_irqsave(&intf->maintenance_mode_lock, flags); | ||
1024 | if (intf->maintenance_mode != mode) { | ||
1025 | switch (mode) { | ||
1026 | case IPMI_MAINTENANCE_MODE_AUTO: | ||
1027 | intf->maintenance_mode = mode; | ||
1028 | intf->maintenance_mode_enable | ||
1029 | = (intf->auto_maintenance_timeout > 0); | ||
1030 | break; | ||
1031 | |||
1032 | case IPMI_MAINTENANCE_MODE_OFF: | ||
1033 | intf->maintenance_mode = mode; | ||
1034 | intf->maintenance_mode_enable = 0; | ||
1035 | break; | ||
1036 | |||
1037 | case IPMI_MAINTENANCE_MODE_ON: | ||
1038 | intf->maintenance_mode = mode; | ||
1039 | intf->maintenance_mode_enable = 1; | ||
1040 | break; | ||
1041 | |||
1042 | default: | ||
1043 | rv = -EINVAL; | ||
1044 | goto out_unlock; | ||
1045 | } | ||
1046 | |||
1047 | maintenance_mode_update(intf); | ||
1048 | } | ||
1049 | out_unlock: | ||
1050 | spin_unlock_irqrestore(&intf->maintenance_mode_lock, flags); | ||
1051 | |||
1052 | return rv; | ||
1053 | } | ||
1054 | EXPORT_SYMBOL(ipmi_set_maintenance_mode); | ||
1055 | |||
934 | int ipmi_set_gets_events(ipmi_user_t user, int val) | 1056 | int ipmi_set_gets_events(ipmi_user_t user, int val) |
935 | { | 1057 | { |
936 | unsigned long flags; | 1058 | unsigned long flags; |
@@ -943,20 +1065,33 @@ int ipmi_set_gets_events(ipmi_user_t user, int val) | |||
943 | spin_lock_irqsave(&intf->events_lock, flags); | 1065 | spin_lock_irqsave(&intf->events_lock, flags); |
944 | user->gets_events = val; | 1066 | user->gets_events = val; |
945 | 1067 | ||
946 | if (val) { | 1068 | if (intf->delivering_events) |
947 | /* Deliver any queued events. */ | 1069 | /* |
1070 | * Another thread is delivering events for this, so | ||
1071 | * let it handle any new events. | ||
1072 | */ | ||
1073 | goto out; | ||
1074 | |||
1075 | /* Deliver any queued events. */ | ||
1076 | while (user->gets_events && !list_empty(&intf->waiting_events)) { | ||
948 | list_for_each_entry_safe(msg, msg2, &intf->waiting_events, link) | 1077 | list_for_each_entry_safe(msg, msg2, &intf->waiting_events, link) |
949 | list_move_tail(&msg->link, &msgs); | 1078 | list_move_tail(&msg->link, &msgs); |
950 | intf->waiting_events_count = 0; | 1079 | intf->waiting_events_count = 0; |
951 | } | ||
952 | 1080 | ||
953 | /* Hold the events lock while doing this to preserve order. */ | 1081 | intf->delivering_events = 1; |
954 | list_for_each_entry_safe(msg, msg2, &msgs, link) { | 1082 | spin_unlock_irqrestore(&intf->events_lock, flags); |
955 | msg->user = user; | 1083 | |
956 | kref_get(&user->refcount); | 1084 | list_for_each_entry_safe(msg, msg2, &msgs, link) { |
957 | deliver_response(msg); | 1085 | msg->user = user; |
1086 | kref_get(&user->refcount); | ||
1087 | deliver_response(msg); | ||
1088 | } | ||
1089 | |||
1090 | spin_lock_irqsave(&intf->events_lock, flags); | ||
1091 | intf->delivering_events = 0; | ||
958 | } | 1092 | } |
959 | 1093 | ||
1094 | out: | ||
960 | spin_unlock_irqrestore(&intf->events_lock, flags); | 1095 | spin_unlock_irqrestore(&intf->events_lock, flags); |
961 | 1096 | ||
962 | return 0; | 1097 | return 0; |
@@ -1067,7 +1202,8 @@ int ipmi_unregister_for_cmd(ipmi_user_t user, | |||
1067 | void ipmi_user_set_run_to_completion(ipmi_user_t user, int val) | 1202 | void ipmi_user_set_run_to_completion(ipmi_user_t user, int val) |
1068 | { | 1203 | { |
1069 | ipmi_smi_t intf = user->intf; | 1204 | ipmi_smi_t intf = user->intf; |
1070 | intf->handlers->set_run_to_completion(intf->send_info, val); | 1205 | if (intf->handlers) |
1206 | intf->handlers->set_run_to_completion(intf->send_info, val); | ||
1071 | } | 1207 | } |
1072 | 1208 | ||
1073 | static unsigned char | 1209 | static unsigned char |
@@ -1178,10 +1314,11 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1178 | int retries, | 1314 | int retries, |
1179 | unsigned int retry_time_ms) | 1315 | unsigned int retry_time_ms) |
1180 | { | 1316 | { |
1181 | int rv = 0; | 1317 | int rv = 0; |
1182 | struct ipmi_smi_msg *smi_msg; | 1318 | struct ipmi_smi_msg *smi_msg; |
1183 | struct ipmi_recv_msg *recv_msg; | 1319 | struct ipmi_recv_msg *recv_msg; |
1184 | unsigned long flags; | 1320 | unsigned long flags; |
1321 | struct ipmi_smi_handlers *handlers; | ||
1185 | 1322 | ||
1186 | 1323 | ||
1187 | if (supplied_recv) { | 1324 | if (supplied_recv) { |
@@ -1204,6 +1341,13 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1204 | } | 1341 | } |
1205 | } | 1342 | } |
1206 | 1343 | ||
1344 | rcu_read_lock(); | ||
1345 | handlers = intf->handlers; | ||
1346 | if (!handlers) { | ||
1347 | rv = -ENODEV; | ||
1348 | goto out_err; | ||
1349 | } | ||
1350 | |||
1207 | recv_msg->user = user; | 1351 | recv_msg->user = user; |
1208 | if (user) | 1352 | if (user) |
1209 | kref_get(&user->refcount); | 1353 | kref_get(&user->refcount); |
@@ -1246,6 +1390,24 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1246 | goto out_err; | 1390 | goto out_err; |
1247 | } | 1391 | } |
1248 | 1392 | ||
1393 | if (((msg->netfn == IPMI_NETFN_APP_REQUEST) | ||
1394 | && ((msg->cmd == IPMI_COLD_RESET_CMD) | ||
1395 | || (msg->cmd == IPMI_WARM_RESET_CMD))) | ||
1396 | || (msg->netfn == IPMI_NETFN_FIRMWARE_REQUEST)) | ||
1397 | { | ||
1398 | spin_lock_irqsave(&intf->maintenance_mode_lock, flags); | ||
1399 | intf->auto_maintenance_timeout | ||
1400 | = IPMI_MAINTENANCE_MODE_TIMEOUT; | ||
1401 | if (!intf->maintenance_mode | ||
1402 | && !intf->maintenance_mode_enable) | ||
1403 | { | ||
1404 | intf->maintenance_mode_enable = 1; | ||
1405 | maintenance_mode_update(intf); | ||
1406 | } | ||
1407 | spin_unlock_irqrestore(&intf->maintenance_mode_lock, | ||
1408 | flags); | ||
1409 | } | ||
1410 | |||
1249 | if ((msg->data_len + 2) > IPMI_MAX_MSG_LENGTH) { | 1411 | if ((msg->data_len + 2) > IPMI_MAX_MSG_LENGTH) { |
1250 | spin_lock_irqsave(&intf->counter_lock, flags); | 1412 | spin_lock_irqsave(&intf->counter_lock, flags); |
1251 | intf->sent_invalid_commands++; | 1413 | intf->sent_invalid_commands++; |
@@ -1520,11 +1682,14 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1520 | printk("\n"); | 1682 | printk("\n"); |
1521 | } | 1683 | } |
1522 | #endif | 1684 | #endif |
1523 | intf->handlers->sender(intf->send_info, smi_msg, priority); | 1685 | |
1686 | handlers->sender(intf->send_info, smi_msg, priority); | ||
1687 | rcu_read_unlock(); | ||
1524 | 1688 | ||
1525 | return 0; | 1689 | return 0; |
1526 | 1690 | ||
1527 | out_err: | 1691 | out_err: |
1692 | rcu_read_unlock(); | ||
1528 | ipmi_free_smi_msg(smi_msg); | 1693 | ipmi_free_smi_msg(smi_msg); |
1529 | ipmi_free_recv_msg(recv_msg); | 1694 | ipmi_free_recv_msg(recv_msg); |
1530 | return rv; | 1695 | return rv; |
@@ -1604,6 +1769,7 @@ int ipmi_request_supply_msgs(ipmi_user_t user, | |||
1604 | -1, 0); | 1769 | -1, 0); |
1605 | } | 1770 | } |
1606 | 1771 | ||
1772 | #ifdef CONFIG_PROC_FS | ||
1607 | static int ipmb_file_read_proc(char *page, char **start, off_t off, | 1773 | static int ipmb_file_read_proc(char *page, char **start, off_t off, |
1608 | int count, int *eof, void *data) | 1774 | int count, int *eof, void *data) |
1609 | { | 1775 | { |
@@ -1692,6 +1858,7 @@ static int stat_file_read_proc(char *page, char **start, off_t off, | |||
1692 | 1858 | ||
1693 | return (out - ((char *) page)); | 1859 | return (out - ((char *) page)); |
1694 | } | 1860 | } |
1861 | #endif /* CONFIG_PROC_FS */ | ||
1695 | 1862 | ||
1696 | int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, | 1863 | int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, |
1697 | read_proc_t *read_proc, write_proc_t *write_proc, | 1864 | read_proc_t *read_proc, write_proc_t *write_proc, |
@@ -1817,13 +1984,12 @@ static int __find_bmc_prod_dev_id(struct device *dev, void *data) | |||
1817 | struct bmc_device *bmc = dev_get_drvdata(dev); | 1984 | struct bmc_device *bmc = dev_get_drvdata(dev); |
1818 | 1985 | ||
1819 | return (bmc->id.product_id == id->product_id | 1986 | return (bmc->id.product_id == id->product_id |
1820 | && bmc->id.product_id == id->product_id | ||
1821 | && bmc->id.device_id == id->device_id); | 1987 | && bmc->id.device_id == id->device_id); |
1822 | } | 1988 | } |
1823 | 1989 | ||
1824 | static struct bmc_device *ipmi_find_bmc_prod_dev_id( | 1990 | static struct bmc_device *ipmi_find_bmc_prod_dev_id( |
1825 | struct device_driver *drv, | 1991 | struct device_driver *drv, |
1826 | unsigned char product_id, unsigned char device_id) | 1992 | unsigned int product_id, unsigned char device_id) |
1827 | { | 1993 | { |
1828 | struct prod_dev_id id = { | 1994 | struct prod_dev_id id = { |
1829 | .product_id = product_id, | 1995 | .product_id = product_id, |
@@ -1940,6 +2106,9 @@ static ssize_t guid_show(struct device *dev, struct device_attribute *attr, | |||
1940 | 2106 | ||
1941 | static void remove_files(struct bmc_device *bmc) | 2107 | static void remove_files(struct bmc_device *bmc) |
1942 | { | 2108 | { |
2109 | if (!bmc->dev) | ||
2110 | return; | ||
2111 | |||
1943 | device_remove_file(&bmc->dev->dev, | 2112 | device_remove_file(&bmc->dev->dev, |
1944 | &bmc->device_id_attr); | 2113 | &bmc->device_id_attr); |
1945 | device_remove_file(&bmc->dev->dev, | 2114 | device_remove_file(&bmc->dev->dev, |
@@ -1973,7 +2142,8 @@ cleanup_bmc_device(struct kref *ref) | |||
1973 | bmc = container_of(ref, struct bmc_device, refcount); | 2142 | bmc = container_of(ref, struct bmc_device, refcount); |
1974 | 2143 | ||
1975 | remove_files(bmc); | 2144 | remove_files(bmc); |
1976 | platform_device_unregister(bmc->dev); | 2145 | if (bmc->dev) |
2146 | platform_device_unregister(bmc->dev); | ||
1977 | kfree(bmc); | 2147 | kfree(bmc); |
1978 | } | 2148 | } |
1979 | 2149 | ||
@@ -1981,7 +2151,11 @@ static void ipmi_bmc_unregister(ipmi_smi_t intf) | |||
1981 | { | 2151 | { |
1982 | struct bmc_device *bmc = intf->bmc; | 2152 | struct bmc_device *bmc = intf->bmc; |
1983 | 2153 | ||
1984 | sysfs_remove_link(&intf->si_dev->kobj, "bmc"); | 2154 | if (intf->sysfs_name) { |
2155 | sysfs_remove_link(&intf->si_dev->kobj, intf->sysfs_name); | ||
2156 | kfree(intf->sysfs_name); | ||
2157 | intf->sysfs_name = NULL; | ||
2158 | } | ||
1985 | if (intf->my_dev_name) { | 2159 | if (intf->my_dev_name) { |
1986 | sysfs_remove_link(&bmc->dev->dev.kobj, intf->my_dev_name); | 2160 | sysfs_remove_link(&bmc->dev->dev.kobj, intf->my_dev_name); |
1987 | kfree(intf->my_dev_name); | 2161 | kfree(intf->my_dev_name); |
@@ -1990,6 +2164,7 @@ static void ipmi_bmc_unregister(ipmi_smi_t intf) | |||
1990 | 2164 | ||
1991 | mutex_lock(&ipmidriver_mutex); | 2165 | mutex_lock(&ipmidriver_mutex); |
1992 | kref_put(&bmc->refcount, cleanup_bmc_device); | 2166 | kref_put(&bmc->refcount, cleanup_bmc_device); |
2167 | intf->bmc = NULL; | ||
1993 | mutex_unlock(&ipmidriver_mutex); | 2168 | mutex_unlock(&ipmidriver_mutex); |
1994 | } | 2169 | } |
1995 | 2170 | ||
@@ -1997,6 +2172,56 @@ static int create_files(struct bmc_device *bmc) | |||
1997 | { | 2172 | { |
1998 | int err; | 2173 | int err; |
1999 | 2174 | ||
2175 | bmc->device_id_attr.attr.name = "device_id"; | ||
2176 | bmc->device_id_attr.attr.owner = THIS_MODULE; | ||
2177 | bmc->device_id_attr.attr.mode = S_IRUGO; | ||
2178 | bmc->device_id_attr.show = device_id_show; | ||
2179 | |||
2180 | bmc->provides_dev_sdrs_attr.attr.name = "provides_device_sdrs"; | ||
2181 | bmc->provides_dev_sdrs_attr.attr.owner = THIS_MODULE; | ||
2182 | bmc->provides_dev_sdrs_attr.attr.mode = S_IRUGO; | ||
2183 | bmc->provides_dev_sdrs_attr.show = provides_dev_sdrs_show; | ||
2184 | |||
2185 | bmc->revision_attr.attr.name = "revision"; | ||
2186 | bmc->revision_attr.attr.owner = THIS_MODULE; | ||
2187 | bmc->revision_attr.attr.mode = S_IRUGO; | ||
2188 | bmc->revision_attr.show = revision_show; | ||
2189 | |||
2190 | bmc->firmware_rev_attr.attr.name = "firmware_revision"; | ||
2191 | bmc->firmware_rev_attr.attr.owner = THIS_MODULE; | ||
2192 | bmc->firmware_rev_attr.attr.mode = S_IRUGO; | ||
2193 | bmc->firmware_rev_attr.show = firmware_rev_show; | ||
2194 | |||
2195 | bmc->version_attr.attr.name = "ipmi_version"; | ||
2196 | bmc->version_attr.attr.owner = THIS_MODULE; | ||
2197 | bmc->version_attr.attr.mode = S_IRUGO; | ||
2198 | bmc->version_attr.show = ipmi_version_show; | ||
2199 | |||
2200 | bmc->add_dev_support_attr.attr.name = "additional_device_support"; | ||
2201 | bmc->add_dev_support_attr.attr.owner = THIS_MODULE; | ||
2202 | bmc->add_dev_support_attr.attr.mode = S_IRUGO; | ||
2203 | bmc->add_dev_support_attr.show = add_dev_support_show; | ||
2204 | |||
2205 | bmc->manufacturer_id_attr.attr.name = "manufacturer_id"; | ||
2206 | bmc->manufacturer_id_attr.attr.owner = THIS_MODULE; | ||
2207 | bmc->manufacturer_id_attr.attr.mode = S_IRUGO; | ||
2208 | bmc->manufacturer_id_attr.show = manufacturer_id_show; | ||
2209 | |||
2210 | bmc->product_id_attr.attr.name = "product_id"; | ||
2211 | bmc->product_id_attr.attr.owner = THIS_MODULE; | ||
2212 | bmc->product_id_attr.attr.mode = S_IRUGO; | ||
2213 | bmc->product_id_attr.show = product_id_show; | ||
2214 | |||
2215 | bmc->guid_attr.attr.name = "guid"; | ||
2216 | bmc->guid_attr.attr.owner = THIS_MODULE; | ||
2217 | bmc->guid_attr.attr.mode = S_IRUGO; | ||
2218 | bmc->guid_attr.show = guid_show; | ||
2219 | |||
2220 | bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision"; | ||
2221 | bmc->aux_firmware_rev_attr.attr.owner = THIS_MODULE; | ||
2222 | bmc->aux_firmware_rev_attr.attr.mode = S_IRUGO; | ||
2223 | bmc->aux_firmware_rev_attr.show = aux_firmware_rev_show; | ||
2224 | |||
2000 | err = device_create_file(&bmc->dev->dev, | 2225 | err = device_create_file(&bmc->dev->dev, |
2001 | &bmc->device_id_attr); | 2226 | &bmc->device_id_attr); |
2002 | if (err) goto out; | 2227 | if (err) goto out; |
@@ -2066,7 +2291,8 @@ out: | |||
2066 | return err; | 2291 | return err; |
2067 | } | 2292 | } |
2068 | 2293 | ||
2069 | static int ipmi_bmc_register(ipmi_smi_t intf) | 2294 | static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum, |
2295 | const char *sysfs_name) | ||
2070 | { | 2296 | { |
2071 | int rv; | 2297 | int rv; |
2072 | struct bmc_device *bmc = intf->bmc; | 2298 | struct bmc_device *bmc = intf->bmc; |
@@ -2106,9 +2332,39 @@ static int ipmi_bmc_register(ipmi_smi_t intf) | |||
2106 | bmc->id.product_id, | 2332 | bmc->id.product_id, |
2107 | bmc->id.device_id); | 2333 | bmc->id.device_id); |
2108 | } else { | 2334 | } else { |
2109 | bmc->dev = platform_device_alloc("ipmi_bmc", | 2335 | char name[14]; |
2110 | bmc->id.device_id); | 2336 | unsigned char orig_dev_id = bmc->id.device_id; |
2337 | int warn_printed = 0; | ||
2338 | |||
2339 | snprintf(name, sizeof(name), | ||
2340 | "ipmi_bmc.%4.4x", bmc->id.product_id); | ||
2341 | |||
2342 | while (ipmi_find_bmc_prod_dev_id(&ipmidriver, | ||
2343 | bmc->id.product_id, | ||
2344 | bmc->id.device_id)) | ||
2345 | { | ||
2346 | if (!warn_printed) { | ||
2347 | printk(KERN_WARNING PFX | ||
2348 | "This machine has two different BMCs" | ||
2349 | " with the same product id and device" | ||
2350 | " id. This is an error in the" | ||
2351 | " firmware, but incrementing the" | ||
2352 | " device id to work around the problem." | ||
2353 | " Prod ID = 0x%x, Dev ID = 0x%x\n", | ||
2354 | bmc->id.product_id, bmc->id.device_id); | ||
2355 | warn_printed = 1; | ||
2356 | } | ||
2357 | bmc->id.device_id++; /* Wraps at 255 */ | ||
2358 | if (bmc->id.device_id == orig_dev_id) { | ||
2359 | printk(KERN_ERR PFX | ||
2360 | "Out of device ids!\n"); | ||
2361 | break; | ||
2362 | } | ||
2363 | } | ||
2364 | |||
2365 | bmc->dev = platform_device_alloc(name, bmc->id.device_id); | ||
2111 | if (!bmc->dev) { | 2366 | if (!bmc->dev) { |
2367 | mutex_unlock(&ipmidriver_mutex); | ||
2112 | printk(KERN_ERR | 2368 | printk(KERN_ERR |
2113 | "ipmi_msghandler:" | 2369 | "ipmi_msghandler:" |
2114 | " Unable to allocate platform device\n"); | 2370 | " Unable to allocate platform device\n"); |
@@ -2121,6 +2377,8 @@ static int ipmi_bmc_register(ipmi_smi_t intf) | |||
2121 | rv = platform_device_add(bmc->dev); | 2377 | rv = platform_device_add(bmc->dev); |
2122 | mutex_unlock(&ipmidriver_mutex); | 2378 | mutex_unlock(&ipmidriver_mutex); |
2123 | if (rv) { | 2379 | if (rv) { |
2380 | platform_device_put(bmc->dev); | ||
2381 | bmc->dev = NULL; | ||
2124 | printk(KERN_ERR | 2382 | printk(KERN_ERR |
2125 | "ipmi_msghandler:" | 2383 | "ipmi_msghandler:" |
2126 | " Unable to register bmc device: %d\n", | 2384 | " Unable to register bmc device: %d\n", |
@@ -2130,57 +2388,6 @@ static int ipmi_bmc_register(ipmi_smi_t intf) | |||
2130 | return rv; | 2388 | return rv; |
2131 | } | 2389 | } |
2132 | 2390 | ||
2133 | bmc->device_id_attr.attr.name = "device_id"; | ||
2134 | bmc->device_id_attr.attr.owner = THIS_MODULE; | ||
2135 | bmc->device_id_attr.attr.mode = S_IRUGO; | ||
2136 | bmc->device_id_attr.show = device_id_show; | ||
2137 | |||
2138 | bmc->provides_dev_sdrs_attr.attr.name = "provides_device_sdrs"; | ||
2139 | bmc->provides_dev_sdrs_attr.attr.owner = THIS_MODULE; | ||
2140 | bmc->provides_dev_sdrs_attr.attr.mode = S_IRUGO; | ||
2141 | bmc->provides_dev_sdrs_attr.show = provides_dev_sdrs_show; | ||
2142 | |||
2143 | bmc->revision_attr.attr.name = "revision"; | ||
2144 | bmc->revision_attr.attr.owner = THIS_MODULE; | ||
2145 | bmc->revision_attr.attr.mode = S_IRUGO; | ||
2146 | bmc->revision_attr.show = revision_show; | ||
2147 | |||
2148 | bmc->firmware_rev_attr.attr.name = "firmware_revision"; | ||
2149 | bmc->firmware_rev_attr.attr.owner = THIS_MODULE; | ||
2150 | bmc->firmware_rev_attr.attr.mode = S_IRUGO; | ||
2151 | bmc->firmware_rev_attr.show = firmware_rev_show; | ||
2152 | |||
2153 | bmc->version_attr.attr.name = "ipmi_version"; | ||
2154 | bmc->version_attr.attr.owner = THIS_MODULE; | ||
2155 | bmc->version_attr.attr.mode = S_IRUGO; | ||
2156 | bmc->version_attr.show = ipmi_version_show; | ||
2157 | |||
2158 | bmc->add_dev_support_attr.attr.name | ||
2159 | = "additional_device_support"; | ||
2160 | bmc->add_dev_support_attr.attr.owner = THIS_MODULE; | ||
2161 | bmc->add_dev_support_attr.attr.mode = S_IRUGO; | ||
2162 | bmc->add_dev_support_attr.show = add_dev_support_show; | ||
2163 | |||
2164 | bmc->manufacturer_id_attr.attr.name = "manufacturer_id"; | ||
2165 | bmc->manufacturer_id_attr.attr.owner = THIS_MODULE; | ||
2166 | bmc->manufacturer_id_attr.attr.mode = S_IRUGO; | ||
2167 | bmc->manufacturer_id_attr.show = manufacturer_id_show; | ||
2168 | |||
2169 | bmc->product_id_attr.attr.name = "product_id"; | ||
2170 | bmc->product_id_attr.attr.owner = THIS_MODULE; | ||
2171 | bmc->product_id_attr.attr.mode = S_IRUGO; | ||
2172 | bmc->product_id_attr.show = product_id_show; | ||
2173 | |||
2174 | bmc->guid_attr.attr.name = "guid"; | ||
2175 | bmc->guid_attr.attr.owner = THIS_MODULE; | ||
2176 | bmc->guid_attr.attr.mode = S_IRUGO; | ||
2177 | bmc->guid_attr.show = guid_show; | ||
2178 | |||
2179 | bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision"; | ||
2180 | bmc->aux_firmware_rev_attr.attr.owner = THIS_MODULE; | ||
2181 | bmc->aux_firmware_rev_attr.attr.mode = S_IRUGO; | ||
2182 | bmc->aux_firmware_rev_attr.show = aux_firmware_rev_show; | ||
2183 | |||
2184 | rv = create_files(bmc); | 2391 | rv = create_files(bmc); |
2185 | if (rv) { | 2392 | if (rv) { |
2186 | mutex_lock(&ipmidriver_mutex); | 2393 | mutex_lock(&ipmidriver_mutex); |
@@ -2202,29 +2409,44 @@ static int ipmi_bmc_register(ipmi_smi_t intf) | |||
2202 | * create symlink from system interface device to bmc device | 2409 | * create symlink from system interface device to bmc device |
2203 | * and back. | 2410 | * and back. |
2204 | */ | 2411 | */ |
2412 | intf->sysfs_name = kstrdup(sysfs_name, GFP_KERNEL); | ||
2413 | if (!intf->sysfs_name) { | ||
2414 | rv = -ENOMEM; | ||
2415 | printk(KERN_ERR | ||
2416 | "ipmi_msghandler: allocate link to BMC: %d\n", | ||
2417 | rv); | ||
2418 | goto out_err; | ||
2419 | } | ||
2420 | |||
2205 | rv = sysfs_create_link(&intf->si_dev->kobj, | 2421 | rv = sysfs_create_link(&intf->si_dev->kobj, |
2206 | &bmc->dev->dev.kobj, "bmc"); | 2422 | &bmc->dev->dev.kobj, intf->sysfs_name); |
2207 | if (rv) { | 2423 | if (rv) { |
2424 | kfree(intf->sysfs_name); | ||
2425 | intf->sysfs_name = NULL; | ||
2208 | printk(KERN_ERR | 2426 | printk(KERN_ERR |
2209 | "ipmi_msghandler: Unable to create bmc symlink: %d\n", | 2427 | "ipmi_msghandler: Unable to create bmc symlink: %d\n", |
2210 | rv); | 2428 | rv); |
2211 | goto out_err; | 2429 | goto out_err; |
2212 | } | 2430 | } |
2213 | 2431 | ||
2214 | size = snprintf(dummy, 0, "ipmi%d", intf->intf_num); | 2432 | size = snprintf(dummy, 0, "ipmi%d", ifnum); |
2215 | intf->my_dev_name = kmalloc(size+1, GFP_KERNEL); | 2433 | intf->my_dev_name = kmalloc(size+1, GFP_KERNEL); |
2216 | if (!intf->my_dev_name) { | 2434 | if (!intf->my_dev_name) { |
2435 | kfree(intf->sysfs_name); | ||
2436 | intf->sysfs_name = NULL; | ||
2217 | rv = -ENOMEM; | 2437 | rv = -ENOMEM; |
2218 | printk(KERN_ERR | 2438 | printk(KERN_ERR |
2219 | "ipmi_msghandler: allocate link from BMC: %d\n", | 2439 | "ipmi_msghandler: allocate link from BMC: %d\n", |
2220 | rv); | 2440 | rv); |
2221 | goto out_err; | 2441 | goto out_err; |
2222 | } | 2442 | } |
2223 | snprintf(intf->my_dev_name, size+1, "ipmi%d", intf->intf_num); | 2443 | snprintf(intf->my_dev_name, size+1, "ipmi%d", ifnum); |
2224 | 2444 | ||
2225 | rv = sysfs_create_link(&bmc->dev->dev.kobj, &intf->si_dev->kobj, | 2445 | rv = sysfs_create_link(&bmc->dev->dev.kobj, &intf->si_dev->kobj, |
2226 | intf->my_dev_name); | 2446 | intf->my_dev_name); |
2227 | if (rv) { | 2447 | if (rv) { |
2448 | kfree(intf->sysfs_name); | ||
2449 | intf->sysfs_name = NULL; | ||
2228 | kfree(intf->my_dev_name); | 2450 | kfree(intf->my_dev_name); |
2229 | intf->my_dev_name = NULL; | 2451 | intf->my_dev_name = NULL; |
2230 | printk(KERN_ERR | 2452 | printk(KERN_ERR |
@@ -2409,17 +2631,14 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
2409 | void *send_info, | 2631 | void *send_info, |
2410 | struct ipmi_device_id *device_id, | 2632 | struct ipmi_device_id *device_id, |
2411 | struct device *si_dev, | 2633 | struct device *si_dev, |
2634 | const char *sysfs_name, | ||
2412 | unsigned char slave_addr) | 2635 | unsigned char slave_addr) |
2413 | { | 2636 | { |
2414 | int i, j; | 2637 | int i, j; |
2415 | int rv; | 2638 | int rv; |
2416 | ipmi_smi_t intf; | 2639 | ipmi_smi_t intf; |
2417 | unsigned long flags; | 2640 | ipmi_smi_t tintf; |
2418 | int version_major; | 2641 | struct list_head *link; |
2419 | int version_minor; | ||
2420 | |||
2421 | version_major = ipmi_version_major(device_id); | ||
2422 | version_minor = ipmi_version_minor(device_id); | ||
2423 | 2642 | ||
2424 | /* Make sure the driver is actually initialized, this handles | 2643 | /* Make sure the driver is actually initialized, this handles |
2425 | problems with initialization order. */ | 2644 | problems with initialization order. */ |
@@ -2437,12 +2656,16 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
2437 | if (!intf) | 2656 | if (!intf) |
2438 | return -ENOMEM; | 2657 | return -ENOMEM; |
2439 | memset(intf, 0, sizeof(*intf)); | 2658 | memset(intf, 0, sizeof(*intf)); |
2659 | |||
2660 | intf->ipmi_version_major = ipmi_version_major(device_id); | ||
2661 | intf->ipmi_version_minor = ipmi_version_minor(device_id); | ||
2662 | |||
2440 | intf->bmc = kzalloc(sizeof(*intf->bmc), GFP_KERNEL); | 2663 | intf->bmc = kzalloc(sizeof(*intf->bmc), GFP_KERNEL); |
2441 | if (!intf->bmc) { | 2664 | if (!intf->bmc) { |
2442 | kfree(intf); | 2665 | kfree(intf); |
2443 | return -ENOMEM; | 2666 | return -ENOMEM; |
2444 | } | 2667 | } |
2445 | intf->intf_num = -1; | 2668 | intf->intf_num = -1; /* Mark it invalid for now. */ |
2446 | kref_init(&intf->refcount); | 2669 | kref_init(&intf->refcount); |
2447 | intf->bmc->id = *device_id; | 2670 | intf->bmc->id = *device_id; |
2448 | intf->si_dev = si_dev; | 2671 | intf->si_dev = si_dev; |
@@ -2470,26 +2693,30 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
2470 | INIT_LIST_HEAD(&intf->waiting_events); | 2693 | INIT_LIST_HEAD(&intf->waiting_events); |
2471 | intf->waiting_events_count = 0; | 2694 | intf->waiting_events_count = 0; |
2472 | mutex_init(&intf->cmd_rcvrs_mutex); | 2695 | mutex_init(&intf->cmd_rcvrs_mutex); |
2696 | spin_lock_init(&intf->maintenance_mode_lock); | ||
2473 | INIT_LIST_HEAD(&intf->cmd_rcvrs); | 2697 | INIT_LIST_HEAD(&intf->cmd_rcvrs); |
2474 | init_waitqueue_head(&intf->waitq); | 2698 | init_waitqueue_head(&intf->waitq); |
2475 | 2699 | ||
2476 | spin_lock_init(&intf->counter_lock); | 2700 | spin_lock_init(&intf->counter_lock); |
2477 | intf->proc_dir = NULL; | 2701 | intf->proc_dir = NULL; |
2478 | 2702 | ||
2479 | rv = -ENOMEM; | 2703 | mutex_lock(&smi_watchers_mutex); |
2480 | spin_lock_irqsave(&interfaces_lock, flags); | 2704 | mutex_lock(&ipmi_interfaces_mutex); |
2481 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { | 2705 | /* Look for a hole in the numbers. */ |
2482 | if (ipmi_interfaces[i] == NULL) { | 2706 | i = 0; |
2483 | intf->intf_num = i; | 2707 | link = &ipmi_interfaces; |
2484 | /* Reserve the entry till we are done. */ | 2708 | list_for_each_entry_rcu(tintf, &ipmi_interfaces, link) { |
2485 | ipmi_interfaces[i] = IPMI_INVALID_INTERFACE_ENTRY; | 2709 | if (tintf->intf_num != i) { |
2486 | rv = 0; | 2710 | link = &tintf->link; |
2487 | break; | 2711 | break; |
2488 | } | 2712 | } |
2713 | i++; | ||
2489 | } | 2714 | } |
2490 | spin_unlock_irqrestore(&interfaces_lock, flags); | 2715 | /* Add the new interface in numeric order. */ |
2491 | if (rv) | 2716 | if (i == 0) |
2492 | goto out; | 2717 | list_add_rcu(&intf->link, &ipmi_interfaces); |
2718 | else | ||
2719 | list_add_tail_rcu(&intf->link, link); | ||
2493 | 2720 | ||
2494 | rv = handlers->start_processing(send_info, intf); | 2721 | rv = handlers->start_processing(send_info, intf); |
2495 | if (rv) | 2722 | if (rv) |
@@ -2497,8 +2724,9 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
2497 | 2724 | ||
2498 | get_guid(intf); | 2725 | get_guid(intf); |
2499 | 2726 | ||
2500 | if ((version_major > 1) | 2727 | if ((intf->ipmi_version_major > 1) |
2501 | || ((version_major == 1) && (version_minor >= 5))) | 2728 | || ((intf->ipmi_version_major == 1) |
2729 | && (intf->ipmi_version_minor >= 5))) | ||
2502 | { | 2730 | { |
2503 | /* Start scanning the channels to see what is | 2731 | /* Start scanning the channels to see what is |
2504 | available. */ | 2732 | available. */ |
@@ -2521,64 +2749,67 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
2521 | if (rv == 0) | 2749 | if (rv == 0) |
2522 | rv = add_proc_entries(intf, i); | 2750 | rv = add_proc_entries(intf, i); |
2523 | 2751 | ||
2524 | rv = ipmi_bmc_register(intf); | 2752 | rv = ipmi_bmc_register(intf, i, sysfs_name); |
2525 | 2753 | ||
2526 | out: | 2754 | out: |
2527 | if (rv) { | 2755 | if (rv) { |
2528 | if (intf->proc_dir) | 2756 | if (intf->proc_dir) |
2529 | remove_proc_entries(intf); | 2757 | remove_proc_entries(intf); |
2758 | intf->handlers = NULL; | ||
2759 | list_del_rcu(&intf->link); | ||
2760 | mutex_unlock(&ipmi_interfaces_mutex); | ||
2761 | mutex_unlock(&smi_watchers_mutex); | ||
2762 | synchronize_rcu(); | ||
2530 | kref_put(&intf->refcount, intf_free); | 2763 | kref_put(&intf->refcount, intf_free); |
2531 | if (i < MAX_IPMI_INTERFACES) { | ||
2532 | spin_lock_irqsave(&interfaces_lock, flags); | ||
2533 | ipmi_interfaces[i] = NULL; | ||
2534 | spin_unlock_irqrestore(&interfaces_lock, flags); | ||
2535 | } | ||
2536 | } else { | 2764 | } else { |
2537 | spin_lock_irqsave(&interfaces_lock, flags); | 2765 | /* After this point the interface is legal to use. */ |
2538 | ipmi_interfaces[i] = intf; | 2766 | intf->intf_num = i; |
2539 | spin_unlock_irqrestore(&interfaces_lock, flags); | 2767 | mutex_unlock(&ipmi_interfaces_mutex); |
2540 | call_smi_watchers(i, intf->si_dev); | 2768 | call_smi_watchers(i, intf->si_dev); |
2769 | mutex_unlock(&smi_watchers_mutex); | ||
2541 | } | 2770 | } |
2542 | 2771 | ||
2543 | return rv; | 2772 | return rv; |
2544 | } | 2773 | } |
2545 | 2774 | ||
2775 | static void cleanup_smi_msgs(ipmi_smi_t intf) | ||
2776 | { | ||
2777 | int i; | ||
2778 | struct seq_table *ent; | ||
2779 | |||
2780 | /* No need for locks, the interface is down. */ | ||
2781 | for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) { | ||
2782 | ent = &(intf->seq_table[i]); | ||
2783 | if (!ent->inuse) | ||
2784 | continue; | ||
2785 | deliver_err_response(ent->recv_msg, IPMI_ERR_UNSPECIFIED); | ||
2786 | } | ||
2787 | } | ||
2788 | |||
2546 | int ipmi_unregister_smi(ipmi_smi_t intf) | 2789 | int ipmi_unregister_smi(ipmi_smi_t intf) |
2547 | { | 2790 | { |
2548 | int i; | ||
2549 | struct ipmi_smi_watcher *w; | 2791 | struct ipmi_smi_watcher *w; |
2550 | unsigned long flags; | 2792 | int intf_num = intf->intf_num; |
2551 | 2793 | ||
2552 | ipmi_bmc_unregister(intf); | 2794 | ipmi_bmc_unregister(intf); |
2553 | 2795 | ||
2554 | spin_lock_irqsave(&interfaces_lock, flags); | 2796 | mutex_lock(&smi_watchers_mutex); |
2555 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { | 2797 | mutex_lock(&ipmi_interfaces_mutex); |
2556 | if (ipmi_interfaces[i] == intf) { | 2798 | intf->intf_num = -1; |
2557 | /* Set the interface number reserved until we | 2799 | intf->handlers = NULL; |
2558 | * are done. */ | 2800 | list_del_rcu(&intf->link); |
2559 | ipmi_interfaces[i] = IPMI_INVALID_INTERFACE_ENTRY; | 2801 | mutex_unlock(&ipmi_interfaces_mutex); |
2560 | intf->intf_num = -1; | 2802 | synchronize_rcu(); |
2561 | break; | ||
2562 | } | ||
2563 | } | ||
2564 | spin_unlock_irqrestore(&interfaces_lock,flags); | ||
2565 | 2803 | ||
2566 | if (i == MAX_IPMI_INTERFACES) | 2804 | cleanup_smi_msgs(intf); |
2567 | return -ENODEV; | ||
2568 | 2805 | ||
2569 | remove_proc_entries(intf); | 2806 | remove_proc_entries(intf); |
2570 | 2807 | ||
2571 | /* Call all the watcher interfaces to tell them that | 2808 | /* Call all the watcher interfaces to tell them that |
2572 | an interface is gone. */ | 2809 | an interface is gone. */ |
2573 | down_read(&smi_watchers_sem); | ||
2574 | list_for_each_entry(w, &smi_watchers, link) | 2810 | list_for_each_entry(w, &smi_watchers, link) |
2575 | w->smi_gone(i); | 2811 | w->smi_gone(intf_num); |
2576 | up_read(&smi_watchers_sem); | 2812 | mutex_unlock(&smi_watchers_mutex); |
2577 | |||
2578 | /* Allow the entry to be reused now. */ | ||
2579 | spin_lock_irqsave(&interfaces_lock, flags); | ||
2580 | ipmi_interfaces[i] = NULL; | ||
2581 | spin_unlock_irqrestore(&interfaces_lock,flags); | ||
2582 | 2813 | ||
2583 | kref_put(&intf->refcount, intf_free); | 2814 | kref_put(&intf->refcount, intf_free); |
2584 | return 0; | 2815 | return 0; |
@@ -2660,6 +2891,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf, | |||
2660 | struct ipmi_ipmb_addr *ipmb_addr; | 2891 | struct ipmi_ipmb_addr *ipmb_addr; |
2661 | struct ipmi_recv_msg *recv_msg; | 2892 | struct ipmi_recv_msg *recv_msg; |
2662 | unsigned long flags; | 2893 | unsigned long flags; |
2894 | struct ipmi_smi_handlers *handlers; | ||
2663 | 2895 | ||
2664 | if (msg->rsp_size < 10) { | 2896 | if (msg->rsp_size < 10) { |
2665 | /* Message not big enough, just ignore it. */ | 2897 | /* Message not big enough, just ignore it. */ |
@@ -2716,10 +2948,16 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf, | |||
2716 | printk("\n"); | 2948 | printk("\n"); |
2717 | } | 2949 | } |
2718 | #endif | 2950 | #endif |
2719 | intf->handlers->sender(intf->send_info, msg, 0); | 2951 | rcu_read_lock(); |
2720 | 2952 | handlers = intf->handlers; | |
2721 | rv = -1; /* We used the message, so return the value that | 2953 | if (handlers) { |
2722 | causes it to not be freed or queued. */ | 2954 | handlers->sender(intf->send_info, msg, 0); |
2955 | /* We used the message, so return the value | ||
2956 | that causes it to not be freed or | ||
2957 | queued. */ | ||
2958 | rv = -1; | ||
2959 | } | ||
2960 | rcu_read_unlock(); | ||
2723 | } else { | 2961 | } else { |
2724 | /* Deliver the message to the user. */ | 2962 | /* Deliver the message to the user. */ |
2725 | spin_lock_irqsave(&intf->counter_lock, flags); | 2963 | spin_lock_irqsave(&intf->counter_lock, flags); |
@@ -3309,16 +3547,6 @@ void ipmi_smi_watchdog_pretimeout(ipmi_smi_t intf) | |||
3309 | rcu_read_unlock(); | 3547 | rcu_read_unlock(); |
3310 | } | 3548 | } |
3311 | 3549 | ||
3312 | static void | ||
3313 | handle_msg_timeout(struct ipmi_recv_msg *msg) | ||
3314 | { | ||
3315 | msg->recv_type = IPMI_RESPONSE_RECV_TYPE; | ||
3316 | msg->msg_data[0] = IPMI_TIMEOUT_COMPLETION_CODE; | ||
3317 | msg->msg.netfn |= 1; /* Convert to a response. */ | ||
3318 | msg->msg.data_len = 1; | ||
3319 | msg->msg.data = msg->msg_data; | ||
3320 | deliver_response(msg); | ||
3321 | } | ||
3322 | 3550 | ||
3323 | static struct ipmi_smi_msg * | 3551 | static struct ipmi_smi_msg * |
3324 | smi_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg, | 3552 | smi_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg, |
@@ -3350,7 +3578,11 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
3350 | struct list_head *timeouts, long timeout_period, | 3578 | struct list_head *timeouts, long timeout_period, |
3351 | int slot, unsigned long *flags) | 3579 | int slot, unsigned long *flags) |
3352 | { | 3580 | { |
3353 | struct ipmi_recv_msg *msg; | 3581 | struct ipmi_recv_msg *msg; |
3582 | struct ipmi_smi_handlers *handlers; | ||
3583 | |||
3584 | if (intf->intf_num == -1) | ||
3585 | return; | ||
3354 | 3586 | ||
3355 | if (!ent->inuse) | 3587 | if (!ent->inuse) |
3356 | return; | 3588 | return; |
@@ -3393,13 +3625,19 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
3393 | return; | 3625 | return; |
3394 | 3626 | ||
3395 | spin_unlock_irqrestore(&intf->seq_lock, *flags); | 3627 | spin_unlock_irqrestore(&intf->seq_lock, *flags); |
3628 | |||
3396 | /* Send the new message. We send with a zero | 3629 | /* Send the new message. We send with a zero |
3397 | * priority. It timed out, I doubt time is | 3630 | * priority. It timed out, I doubt time is |
3398 | * that critical now, and high priority | 3631 | * that critical now, and high priority |
3399 | * messages are really only for messages to the | 3632 | * messages are really only for messages to the |
3400 | * local MC, which don't get resent. */ | 3633 | * local MC, which don't get resent. */ |
3401 | intf->handlers->sender(intf->send_info, | 3634 | handlers = intf->handlers; |
3402 | smi_msg, 0); | 3635 | if (handlers) |
3636 | intf->handlers->sender(intf->send_info, | ||
3637 | smi_msg, 0); | ||
3638 | else | ||
3639 | ipmi_free_smi_msg(smi_msg); | ||
3640 | |||
3403 | spin_lock_irqsave(&intf->seq_lock, *flags); | 3641 | spin_lock_irqsave(&intf->seq_lock, *flags); |
3404 | } | 3642 | } |
3405 | } | 3643 | } |
@@ -3411,18 +3649,12 @@ static void ipmi_timeout_handler(long timeout_period) | |||
3411 | struct ipmi_recv_msg *msg, *msg2; | 3649 | struct ipmi_recv_msg *msg, *msg2; |
3412 | struct ipmi_smi_msg *smi_msg, *smi_msg2; | 3650 | struct ipmi_smi_msg *smi_msg, *smi_msg2; |
3413 | unsigned long flags; | 3651 | unsigned long flags; |
3414 | int i, j; | 3652 | int i; |
3415 | 3653 | ||
3416 | INIT_LIST_HEAD(&timeouts); | 3654 | INIT_LIST_HEAD(&timeouts); |
3417 | 3655 | ||
3418 | spin_lock(&interfaces_lock); | 3656 | rcu_read_lock(); |
3419 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { | 3657 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { |
3420 | intf = ipmi_interfaces[i]; | ||
3421 | if (IPMI_INVALID_INTERFACE(intf)) | ||
3422 | continue; | ||
3423 | kref_get(&intf->refcount); | ||
3424 | spin_unlock(&interfaces_lock); | ||
3425 | |||
3426 | /* See if any waiting messages need to be processed. */ | 3658 | /* See if any waiting messages need to be processed. */ |
3427 | spin_lock_irqsave(&intf->waiting_msgs_lock, flags); | 3659 | spin_lock_irqsave(&intf->waiting_msgs_lock, flags); |
3428 | list_for_each_entry_safe(smi_msg, smi_msg2, | 3660 | list_for_each_entry_safe(smi_msg, smi_msg2, |
@@ -3442,35 +3674,60 @@ static void ipmi_timeout_handler(long timeout_period) | |||
3442 | have timed out, putting them in the timeouts | 3674 | have timed out, putting them in the timeouts |
3443 | list. */ | 3675 | list. */ |
3444 | spin_lock_irqsave(&intf->seq_lock, flags); | 3676 | spin_lock_irqsave(&intf->seq_lock, flags); |
3445 | for (j = 0; j < IPMI_IPMB_NUM_SEQ; j++) | 3677 | for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) |
3446 | check_msg_timeout(intf, &(intf->seq_table[j]), | 3678 | check_msg_timeout(intf, &(intf->seq_table[i]), |
3447 | &timeouts, timeout_period, j, | 3679 | &timeouts, timeout_period, i, |
3448 | &flags); | 3680 | &flags); |
3449 | spin_unlock_irqrestore(&intf->seq_lock, flags); | 3681 | spin_unlock_irqrestore(&intf->seq_lock, flags); |
3450 | 3682 | ||
3451 | list_for_each_entry_safe(msg, msg2, &timeouts, link) | 3683 | list_for_each_entry_safe(msg, msg2, &timeouts, link) |
3452 | handle_msg_timeout(msg); | 3684 | deliver_err_response(msg, IPMI_TIMEOUT_COMPLETION_CODE); |
3453 | 3685 | ||
3454 | kref_put(&intf->refcount, intf_free); | 3686 | /* |
3455 | spin_lock(&interfaces_lock); | 3687 | * Maintenance mode handling. Check the timeout |
3688 | * optimistically before we claim the lock. It may | ||
3689 | * mean a timeout gets missed occasionally, but that | ||
3690 | * only means the timeout gets extended by one period | ||
3691 | * in that case. No big deal, and it avoids the lock | ||
3692 | * most of the time. | ||
3693 | */ | ||
3694 | if (intf->auto_maintenance_timeout > 0) { | ||
3695 | spin_lock_irqsave(&intf->maintenance_mode_lock, flags); | ||
3696 | if (intf->auto_maintenance_timeout > 0) { | ||
3697 | intf->auto_maintenance_timeout | ||
3698 | -= timeout_period; | ||
3699 | if (!intf->maintenance_mode | ||
3700 | && (intf->auto_maintenance_timeout <= 0)) | ||
3701 | { | ||
3702 | intf->maintenance_mode_enable = 0; | ||
3703 | maintenance_mode_update(intf); | ||
3704 | } | ||
3705 | } | ||
3706 | spin_unlock_irqrestore(&intf->maintenance_mode_lock, | ||
3707 | flags); | ||
3708 | } | ||
3456 | } | 3709 | } |
3457 | spin_unlock(&interfaces_lock); | 3710 | rcu_read_unlock(); |
3458 | } | 3711 | } |
3459 | 3712 | ||
3460 | static void ipmi_request_event(void) | 3713 | static void ipmi_request_event(void) |
3461 | { | 3714 | { |
3462 | ipmi_smi_t intf; | 3715 | ipmi_smi_t intf; |
3463 | int i; | 3716 | struct ipmi_smi_handlers *handlers; |
3464 | 3717 | ||
3465 | spin_lock(&interfaces_lock); | 3718 | rcu_read_lock(); |
3466 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { | 3719 | /* Called from the timer, no need to check if handlers is |
3467 | intf = ipmi_interfaces[i]; | 3720 | * valid. */ |
3468 | if (IPMI_INVALID_INTERFACE(intf)) | 3721 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { |
3722 | /* No event requests when in maintenance mode. */ | ||
3723 | if (intf->maintenance_mode_enable) | ||
3469 | continue; | 3724 | continue; |
3470 | 3725 | ||
3471 | intf->handlers->request_events(intf->send_info); | 3726 | handlers = intf->handlers; |
3727 | if (handlers) | ||
3728 | handlers->request_events(intf->send_info); | ||
3472 | } | 3729 | } |
3473 | spin_unlock(&interfaces_lock); | 3730 | rcu_read_unlock(); |
3474 | } | 3731 | } |
3475 | 3732 | ||
3476 | static struct timer_list ipmi_timer; | 3733 | static struct timer_list ipmi_timer; |
@@ -3599,7 +3856,6 @@ static void send_panic_events(char *str) | |||
3599 | struct kernel_ipmi_msg msg; | 3856 | struct kernel_ipmi_msg msg; |
3600 | ipmi_smi_t intf; | 3857 | ipmi_smi_t intf; |
3601 | unsigned char data[16]; | 3858 | unsigned char data[16]; |
3602 | int i; | ||
3603 | struct ipmi_system_interface_addr *si; | 3859 | struct ipmi_system_interface_addr *si; |
3604 | struct ipmi_addr addr; | 3860 | struct ipmi_addr addr; |
3605 | struct ipmi_smi_msg smi_msg; | 3861 | struct ipmi_smi_msg smi_msg; |
@@ -3633,9 +3889,9 @@ static void send_panic_events(char *str) | |||
3633 | recv_msg.done = dummy_recv_done_handler; | 3889 | recv_msg.done = dummy_recv_done_handler; |
3634 | 3890 | ||
3635 | /* For every registered interface, send the event. */ | 3891 | /* For every registered interface, send the event. */ |
3636 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { | 3892 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { |
3637 | intf = ipmi_interfaces[i]; | 3893 | if (!intf->handlers) |
3638 | if (IPMI_INVALID_INTERFACE(intf)) | 3894 | /* Interface is not ready. */ |
3639 | continue; | 3895 | continue; |
3640 | 3896 | ||
3641 | /* Send the event announcing the panic. */ | 3897 | /* Send the event announcing the panic. */ |
@@ -3660,13 +3916,14 @@ static void send_panic_events(char *str) | |||
3660 | if (!str) | 3916 | if (!str) |
3661 | return; | 3917 | return; |
3662 | 3918 | ||
3663 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { | 3919 | /* For every registered interface, send the event. */ |
3920 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { | ||
3664 | char *p = str; | 3921 | char *p = str; |
3665 | struct ipmi_ipmb_addr *ipmb; | 3922 | struct ipmi_ipmb_addr *ipmb; |
3666 | int j; | 3923 | int j; |
3667 | 3924 | ||
3668 | intf = ipmi_interfaces[i]; | 3925 | if (intf->intf_num == -1) |
3669 | if (IPMI_INVALID_INTERFACE(intf)) | 3926 | /* Interface was not ready yet. */ |
3670 | continue; | 3927 | continue; |
3671 | 3928 | ||
3672 | /* First job here is to figure out where to send the | 3929 | /* First job here is to figure out where to send the |
@@ -3792,7 +4049,6 @@ static int panic_event(struct notifier_block *this, | |||
3792 | unsigned long event, | 4049 | unsigned long event, |
3793 | void *ptr) | 4050 | void *ptr) |
3794 | { | 4051 | { |
3795 | int i; | ||
3796 | ipmi_smi_t intf; | 4052 | ipmi_smi_t intf; |
3797 | 4053 | ||
3798 | if (has_panicked) | 4054 | if (has_panicked) |
@@ -3800,9 +4056,9 @@ static int panic_event(struct notifier_block *this, | |||
3800 | has_panicked = 1; | 4056 | has_panicked = 1; |
3801 | 4057 | ||
3802 | /* For every registered interface, set it to run to completion. */ | 4058 | /* For every registered interface, set it to run to completion. */ |
3803 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { | 4059 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { |
3804 | intf = ipmi_interfaces[i]; | 4060 | if (!intf->handlers) |
3805 | if (IPMI_INVALID_INTERFACE(intf)) | 4061 | /* Interface is not ready. */ |
3806 | continue; | 4062 | continue; |
3807 | 4063 | ||
3808 | intf->handlers->set_run_to_completion(intf->send_info, 1); | 4064 | intf->handlers->set_run_to_completion(intf->send_info, 1); |
@@ -3823,7 +4079,6 @@ static struct notifier_block panic_block = { | |||
3823 | 4079 | ||
3824 | static int ipmi_init_msghandler(void) | 4080 | static int ipmi_init_msghandler(void) |
3825 | { | 4081 | { |
3826 | int i; | ||
3827 | int rv; | 4082 | int rv; |
3828 | 4083 | ||
3829 | if (initialized) | 4084 | if (initialized) |
@@ -3838,9 +4093,6 @@ static int ipmi_init_msghandler(void) | |||
3838 | printk(KERN_INFO "ipmi message handler version " | 4093 | printk(KERN_INFO "ipmi message handler version " |
3839 | IPMI_DRIVER_VERSION "\n"); | 4094 | IPMI_DRIVER_VERSION "\n"); |
3840 | 4095 | ||
3841 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) | ||
3842 | ipmi_interfaces[i] = NULL; | ||
3843 | |||
3844 | #ifdef CONFIG_PROC_FS | 4096 | #ifdef CONFIG_PROC_FS |
3845 | proc_ipmi_root = proc_mkdir("ipmi", NULL); | 4097 | proc_ipmi_root = proc_mkdir("ipmi", NULL); |
3846 | if (!proc_ipmi_root) { | 4098 | if (!proc_ipmi_root) { |
diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c index 8d941db83457..597eb4f88b84 100644 --- a/drivers/char/ipmi/ipmi_poweroff.c +++ b/drivers/char/ipmi/ipmi_poweroff.c | |||
@@ -43,6 +43,9 @@ | |||
43 | 43 | ||
44 | #define PFX "IPMI poweroff: " | 44 | #define PFX "IPMI poweroff: " |
45 | 45 | ||
46 | static void ipmi_po_smi_gone(int if_num); | ||
47 | static void ipmi_po_new_smi(int if_num, struct device *device); | ||
48 | |||
46 | /* Definitions for controlling power off (if the system supports it). It | 49 | /* Definitions for controlling power off (if the system supports it). It |
47 | * conveniently matches the IPMI chassis control values. */ | 50 | * conveniently matches the IPMI chassis control values. */ |
48 | #define IPMI_CHASSIS_POWER_DOWN 0 /* power down, the default. */ | 51 | #define IPMI_CHASSIS_POWER_DOWN 0 /* power down, the default. */ |
@@ -51,6 +54,37 @@ | |||
51 | /* the IPMI data command */ | 54 | /* the IPMI data command */ |
52 | static int poweroff_powercycle; | 55 | static int poweroff_powercycle; |
53 | 56 | ||
57 | /* Which interface to use, -1 means the first we see. */ | ||
58 | static int ifnum_to_use = -1; | ||
59 | |||
60 | /* Our local state. */ | ||
61 | static int ready = 0; | ||
62 | static ipmi_user_t ipmi_user; | ||
63 | static int ipmi_ifnum; | ||
64 | static void (*specific_poweroff_func)(ipmi_user_t user) = NULL; | ||
65 | |||
66 | /* Holds the old poweroff function so we can restore it on removal. */ | ||
67 | static void (*old_poweroff_func)(void); | ||
68 | |||
69 | static int set_param_ifnum(const char *val, struct kernel_param *kp) | ||
70 | { | ||
71 | int rv = param_set_int(val, kp); | ||
72 | if (rv) | ||
73 | return rv; | ||
74 | if ((ifnum_to_use < 0) || (ifnum_to_use == ipmi_ifnum)) | ||
75 | return 0; | ||
76 | |||
77 | ipmi_po_smi_gone(ipmi_ifnum); | ||
78 | ipmi_po_new_smi(ifnum_to_use, NULL); | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | module_param_call(ifnum_to_use, set_param_ifnum, param_get_int, | ||
83 | &ifnum_to_use, 0644); | ||
84 | MODULE_PARM_DESC(ifnum_to_use, "The interface number to use for the watchdog " | ||
85 | "timer. Setting to -1 defaults to the first registered " | ||
86 | "interface"); | ||
87 | |||
54 | /* parameter definition to allow user to flag power cycle */ | 88 | /* parameter definition to allow user to flag power cycle */ |
55 | module_param(poweroff_powercycle, int, 0644); | 89 | module_param(poweroff_powercycle, int, 0644); |
56 | MODULE_PARM_DESC(poweroff_powercycle, " Set to non-zero to enable power cycle instead of power down. Power cycle is contingent on hardware support, otherwise it defaults back to power down."); | 90 | MODULE_PARM_DESC(poweroff_powercycle, " Set to non-zero to enable power cycle instead of power down. Power cycle is contingent on hardware support, otherwise it defaults back to power down."); |
@@ -142,6 +176,42 @@ static int ipmi_request_in_rc_mode(ipmi_user_t user, | |||
142 | #define IPMI_ATCA_GET_ADDR_INFO_CMD 0x01 | 176 | #define IPMI_ATCA_GET_ADDR_INFO_CMD 0x01 |
143 | #define IPMI_PICMG_ID 0 | 177 | #define IPMI_PICMG_ID 0 |
144 | 178 | ||
179 | #define IPMI_NETFN_OEM 0x2e | ||
180 | #define IPMI_ATCA_PPS_GRACEFUL_RESTART 0x11 | ||
181 | #define IPMI_ATCA_PPS_IANA "\x00\x40\x0A" | ||
182 | #define IPMI_MOTOROLA_MANUFACTURER_ID 0x0000A1 | ||
183 | #define IPMI_MOTOROLA_PPS_IPMC_PRODUCT_ID 0x0051 | ||
184 | |||
185 | static void (*atca_oem_poweroff_hook)(ipmi_user_t user) = NULL; | ||
186 | |||
187 | static void pps_poweroff_atca (ipmi_user_t user) | ||
188 | { | ||
189 | struct ipmi_system_interface_addr smi_addr; | ||
190 | struct kernel_ipmi_msg send_msg; | ||
191 | int rv; | ||
192 | /* | ||
193 | * Configure IPMI address for local access | ||
194 | */ | ||
195 | smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; | ||
196 | smi_addr.channel = IPMI_BMC_CHANNEL; | ||
197 | smi_addr.lun = 0; | ||
198 | |||
199 | printk(KERN_INFO PFX "PPS powerdown hook used"); | ||
200 | |||
201 | send_msg.netfn = IPMI_NETFN_OEM; | ||
202 | send_msg.cmd = IPMI_ATCA_PPS_GRACEFUL_RESTART; | ||
203 | send_msg.data = IPMI_ATCA_PPS_IANA; | ||
204 | send_msg.data_len = 3; | ||
205 | rv = ipmi_request_in_rc_mode(user, | ||
206 | (struct ipmi_addr *) &smi_addr, | ||
207 | &send_msg); | ||
208 | if (rv && rv != IPMI_UNKNOWN_ERR_COMPLETION_CODE) { | ||
209 | printk(KERN_ERR PFX "Unable to send ATCA ," | ||
210 | " IPMI error 0x%x\n", rv); | ||
211 | } | ||
212 | return; | ||
213 | } | ||
214 | |||
145 | static int ipmi_atca_detect (ipmi_user_t user) | 215 | static int ipmi_atca_detect (ipmi_user_t user) |
146 | { | 216 | { |
147 | struct ipmi_system_interface_addr smi_addr; | 217 | struct ipmi_system_interface_addr smi_addr; |
@@ -167,6 +237,13 @@ static int ipmi_atca_detect (ipmi_user_t user) | |||
167 | rv = ipmi_request_wait_for_response(user, | 237 | rv = ipmi_request_wait_for_response(user, |
168 | (struct ipmi_addr *) &smi_addr, | 238 | (struct ipmi_addr *) &smi_addr, |
169 | &send_msg); | 239 | &send_msg); |
240 | |||
241 | printk(KERN_INFO PFX "ATCA Detect mfg 0x%X prod 0x%X\n", mfg_id, prod_id); | ||
242 | if((mfg_id == IPMI_MOTOROLA_MANUFACTURER_ID) | ||
243 | && (prod_id == IPMI_MOTOROLA_PPS_IPMC_PRODUCT_ID)) { | ||
244 | printk(KERN_INFO PFX "Installing Pigeon Point Systems Poweroff Hook\n"); | ||
245 | atca_oem_poweroff_hook = pps_poweroff_atca; | ||
246 | } | ||
170 | return !rv; | 247 | return !rv; |
171 | } | 248 | } |
172 | 249 | ||
@@ -200,12 +277,19 @@ static void ipmi_poweroff_atca (ipmi_user_t user) | |||
200 | rv = ipmi_request_in_rc_mode(user, | 277 | rv = ipmi_request_in_rc_mode(user, |
201 | (struct ipmi_addr *) &smi_addr, | 278 | (struct ipmi_addr *) &smi_addr, |
202 | &send_msg); | 279 | &send_msg); |
203 | if (rv) { | 280 | /** At this point, the system may be shutting down, and most |
281 | ** serial drivers (if used) will have interrupts turned off | ||
282 | ** it may be better to ignore IPMI_UNKNOWN_ERR_COMPLETION_CODE | ||
283 | ** return code | ||
284 | **/ | ||
285 | if (rv && rv != IPMI_UNKNOWN_ERR_COMPLETION_CODE) { | ||
204 | printk(KERN_ERR PFX "Unable to send ATCA powerdown message," | 286 | printk(KERN_ERR PFX "Unable to send ATCA powerdown message," |
205 | " IPMI error 0x%x\n", rv); | 287 | " IPMI error 0x%x\n", rv); |
206 | goto out; | 288 | goto out; |
207 | } | 289 | } |
208 | 290 | ||
291 | if(atca_oem_poweroff_hook) | ||
292 | return atca_oem_poweroff_hook(user); | ||
209 | out: | 293 | out: |
210 | return; | 294 | return; |
211 | } | 295 | } |
@@ -440,15 +524,6 @@ static struct poweroff_function poweroff_functions[] = { | |||
440 | / sizeof(struct poweroff_function)) | 524 | / sizeof(struct poweroff_function)) |
441 | 525 | ||
442 | 526 | ||
443 | /* Our local state. */ | ||
444 | static int ready = 0; | ||
445 | static ipmi_user_t ipmi_user; | ||
446 | static void (*specific_poweroff_func)(ipmi_user_t user) = NULL; | ||
447 | |||
448 | /* Holds the old poweroff function so we can restore it on removal. */ | ||
449 | static void (*old_poweroff_func)(void); | ||
450 | |||
451 | |||
452 | /* Called on a powerdown request. */ | 527 | /* Called on a powerdown request. */ |
453 | static void ipmi_poweroff_function (void) | 528 | static void ipmi_poweroff_function (void) |
454 | { | 529 | { |
@@ -473,6 +548,9 @@ static void ipmi_po_new_smi(int if_num, struct device *device) | |||
473 | if (ready) | 548 | if (ready) |
474 | return; | 549 | return; |
475 | 550 | ||
551 | if ((ifnum_to_use >= 0) && (ifnum_to_use != if_num)) | ||
552 | return; | ||
553 | |||
476 | rv = ipmi_create_user(if_num, &ipmi_poweroff_handler, NULL, | 554 | rv = ipmi_create_user(if_num, &ipmi_poweroff_handler, NULL, |
477 | &ipmi_user); | 555 | &ipmi_user); |
478 | if (rv) { | 556 | if (rv) { |
@@ -481,6 +559,8 @@ static void ipmi_po_new_smi(int if_num, struct device *device) | |||
481 | return; | 559 | return; |
482 | } | 560 | } |
483 | 561 | ||
562 | ipmi_ifnum = if_num; | ||
563 | |||
484 | /* | 564 | /* |
485 | * Do a get device ide and store some results, since this is | 565 | * Do a get device ide and store some results, since this is |
486 | * used by several functions. | 566 | * used by several functions. |
@@ -541,9 +621,15 @@ static void ipmi_po_new_smi(int if_num, struct device *device) | |||
541 | 621 | ||
542 | static void ipmi_po_smi_gone(int if_num) | 622 | static void ipmi_po_smi_gone(int if_num) |
543 | { | 623 | { |
544 | /* This can never be called, because once poweroff driver is | 624 | if (!ready) |
545 | registered, the interface can't go away until the power | 625 | return; |
546 | driver is unregistered. */ | 626 | |
627 | if (ipmi_ifnum != if_num) | ||
628 | return; | ||
629 | |||
630 | ready = 0; | ||
631 | ipmi_destroy_user(ipmi_user); | ||
632 | pm_power_off = old_poweroff_func; | ||
547 | } | 633 | } |
548 | 634 | ||
549 | static struct ipmi_smi_watcher smi_watcher = | 635 | static struct ipmi_smi_watcher smi_watcher = |
@@ -616,9 +702,9 @@ static int ipmi_poweroff_init (void) | |||
616 | printk(KERN_ERR PFX "Unable to register SMI watcher: %d\n", rv); | 702 | printk(KERN_ERR PFX "Unable to register SMI watcher: %d\n", rv); |
617 | goto out_err; | 703 | goto out_err; |
618 | } | 704 | } |
619 | #endif | ||
620 | 705 | ||
621 | out_err: | 706 | out_err: |
707 | #endif | ||
622 | return rv; | 708 | return rv; |
623 | } | 709 | } |
624 | 710 | ||
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index bb1fac104fda..81a0c89598e7 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -61,6 +61,10 @@ | |||
61 | #include "ipmi_si_sm.h" | 61 | #include "ipmi_si_sm.h" |
62 | #include <linux/init.h> | 62 | #include <linux/init.h> |
63 | #include <linux/dmi.h> | 63 | #include <linux/dmi.h> |
64 | #include <linux/string.h> | ||
65 | #include <linux/ctype.h> | ||
66 | |||
67 | #define PFX "ipmi_si: " | ||
64 | 68 | ||
65 | /* Measure times between events in the driver. */ | 69 | /* Measure times between events in the driver. */ |
66 | #undef DEBUG_TIMING | 70 | #undef DEBUG_TIMING |
@@ -92,7 +96,7 @@ enum si_intf_state { | |||
92 | enum si_type { | 96 | enum si_type { |
93 | SI_KCS, SI_SMIC, SI_BT | 97 | SI_KCS, SI_SMIC, SI_BT |
94 | }; | 98 | }; |
95 | static char *si_to_str[] = { "KCS", "SMIC", "BT" }; | 99 | static char *si_to_str[] = { "kcs", "smic", "bt" }; |
96 | 100 | ||
97 | #define DEVICE_NAME "ipmi_si" | 101 | #define DEVICE_NAME "ipmi_si" |
98 | 102 | ||
@@ -222,7 +226,10 @@ struct smi_info | |||
222 | static int force_kipmid[SI_MAX_PARMS]; | 226 | static int force_kipmid[SI_MAX_PARMS]; |
223 | static int num_force_kipmid; | 227 | static int num_force_kipmid; |
224 | 228 | ||
229 | static int unload_when_empty = 1; | ||
230 | |||
225 | static int try_smi_init(struct smi_info *smi); | 231 | static int try_smi_init(struct smi_info *smi); |
232 | static void cleanup_one_si(struct smi_info *to_clean); | ||
226 | 233 | ||
227 | static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list); | 234 | static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list); |
228 | static int register_xaction_notifier(struct notifier_block * nb) | 235 | static int register_xaction_notifier(struct notifier_block * nb) |
@@ -240,14 +247,18 @@ static void deliver_recv_msg(struct smi_info *smi_info, | |||
240 | spin_lock(&(smi_info->si_lock)); | 247 | spin_lock(&(smi_info->si_lock)); |
241 | } | 248 | } |
242 | 249 | ||
243 | static void return_hosed_msg(struct smi_info *smi_info) | 250 | static void return_hosed_msg(struct smi_info *smi_info, int cCode) |
244 | { | 251 | { |
245 | struct ipmi_smi_msg *msg = smi_info->curr_msg; | 252 | struct ipmi_smi_msg *msg = smi_info->curr_msg; |
246 | 253 | ||
254 | if (cCode < 0 || cCode > IPMI_ERR_UNSPECIFIED) | ||
255 | cCode = IPMI_ERR_UNSPECIFIED; | ||
256 | /* else use it as is */ | ||
257 | |||
247 | /* Make it a reponse */ | 258 | /* Make it a reponse */ |
248 | msg->rsp[0] = msg->data[0] | 4; | 259 | msg->rsp[0] = msg->data[0] | 4; |
249 | msg->rsp[1] = msg->data[1]; | 260 | msg->rsp[1] = msg->data[1]; |
250 | msg->rsp[2] = 0xFF; /* Unknown error. */ | 261 | msg->rsp[2] = cCode; |
251 | msg->rsp_size = 3; | 262 | msg->rsp_size = 3; |
252 | 263 | ||
253 | smi_info->curr_msg = NULL; | 264 | smi_info->curr_msg = NULL; |
@@ -298,7 +309,7 @@ static enum si_sm_result start_next_msg(struct smi_info *smi_info) | |||
298 | smi_info->curr_msg->data, | 309 | smi_info->curr_msg->data, |
299 | smi_info->curr_msg->data_size); | 310 | smi_info->curr_msg->data_size); |
300 | if (err) { | 311 | if (err) { |
301 | return_hosed_msg(smi_info); | 312 | return_hosed_msg(smi_info, err); |
302 | } | 313 | } |
303 | 314 | ||
304 | rv = SI_SM_CALL_WITHOUT_DELAY; | 315 | rv = SI_SM_CALL_WITHOUT_DELAY; |
@@ -640,7 +651,7 @@ static enum si_sm_result smi_event_handler(struct smi_info *smi_info, | |||
640 | /* If we were handling a user message, format | 651 | /* If we were handling a user message, format |
641 | a response to send to the upper layer to | 652 | a response to send to the upper layer to |
642 | tell it about the error. */ | 653 | tell it about the error. */ |
643 | return_hosed_msg(smi_info); | 654 | return_hosed_msg(smi_info, IPMI_ERR_UNSPECIFIED); |
644 | } | 655 | } |
645 | si_sm_result = smi_info->handlers->event(smi_info->si_sm, 0); | 656 | si_sm_result = smi_info->handlers->event(smi_info->si_sm, 0); |
646 | } | 657 | } |
@@ -684,22 +695,24 @@ static enum si_sm_result smi_event_handler(struct smi_info *smi_info, | |||
684 | { | 695 | { |
685 | /* We are idle and the upper layer requested that I fetch | 696 | /* We are idle and the upper layer requested that I fetch |
686 | events, so do so. */ | 697 | events, so do so. */ |
687 | unsigned char msg[2]; | 698 | atomic_set(&smi_info->req_events, 0); |
688 | 699 | ||
689 | spin_lock(&smi_info->count_lock); | 700 | smi_info->curr_msg = ipmi_alloc_smi_msg(); |
690 | smi_info->flag_fetches++; | 701 | if (!smi_info->curr_msg) |
691 | spin_unlock(&smi_info->count_lock); | 702 | goto out; |
692 | 703 | ||
693 | atomic_set(&smi_info->req_events, 0); | 704 | smi_info->curr_msg->data[0] = (IPMI_NETFN_APP_REQUEST << 2); |
694 | msg[0] = (IPMI_NETFN_APP_REQUEST << 2); | 705 | smi_info->curr_msg->data[1] = IPMI_READ_EVENT_MSG_BUFFER_CMD; |
695 | msg[1] = IPMI_GET_MSG_FLAGS_CMD; | 706 | smi_info->curr_msg->data_size = 2; |
696 | 707 | ||
697 | smi_info->handlers->start_transaction( | 708 | smi_info->handlers->start_transaction( |
698 | smi_info->si_sm, msg, 2); | 709 | smi_info->si_sm, |
699 | smi_info->si_state = SI_GETTING_FLAGS; | 710 | smi_info->curr_msg->data, |
711 | smi_info->curr_msg->data_size); | ||
712 | smi_info->si_state = SI_GETTING_EVENTS; | ||
700 | goto restart; | 713 | goto restart; |
701 | } | 714 | } |
702 | 715 | out: | |
703 | return si_sm_result; | 716 | return si_sm_result; |
704 | } | 717 | } |
705 | 718 | ||
@@ -714,6 +727,15 @@ static void sender(void *send_info, | |||
714 | struct timeval t; | 727 | struct timeval t; |
715 | #endif | 728 | #endif |
716 | 729 | ||
730 | if (atomic_read(&smi_info->stop_operation)) { | ||
731 | msg->rsp[0] = msg->data[0] | 4; | ||
732 | msg->rsp[1] = msg->data[1]; | ||
733 | msg->rsp[2] = IPMI_ERR_UNSPECIFIED; | ||
734 | msg->rsp_size = 3; | ||
735 | deliver_recv_msg(smi_info, msg); | ||
736 | return; | ||
737 | } | ||
738 | |||
717 | spin_lock_irqsave(&(smi_info->msg_lock), flags); | 739 | spin_lock_irqsave(&(smi_info->msg_lock), flags); |
718 | #ifdef DEBUG_TIMING | 740 | #ifdef DEBUG_TIMING |
719 | do_gettimeofday(&t); | 741 | do_gettimeofday(&t); |
@@ -805,13 +827,21 @@ static void poll(void *send_info) | |||
805 | { | 827 | { |
806 | struct smi_info *smi_info = send_info; | 828 | struct smi_info *smi_info = send_info; |
807 | 829 | ||
808 | smi_event_handler(smi_info, 0); | 830 | /* |
831 | * Make sure there is some delay in the poll loop so we can | ||
832 | * drive time forward and timeout things. | ||
833 | */ | ||
834 | udelay(10); | ||
835 | smi_event_handler(smi_info, 10); | ||
809 | } | 836 | } |
810 | 837 | ||
811 | static void request_events(void *send_info) | 838 | static void request_events(void *send_info) |
812 | { | 839 | { |
813 | struct smi_info *smi_info = send_info; | 840 | struct smi_info *smi_info = send_info; |
814 | 841 | ||
842 | if (atomic_read(&smi_info->stop_operation)) | ||
843 | return; | ||
844 | |||
815 | atomic_set(&smi_info->req_events, 1); | 845 | atomic_set(&smi_info->req_events, 1); |
816 | } | 846 | } |
817 | 847 | ||
@@ -949,12 +979,21 @@ static int smi_start_processing(void *send_info, | |||
949 | return 0; | 979 | return 0; |
950 | } | 980 | } |
951 | 981 | ||
982 | static void set_maintenance_mode(void *send_info, int enable) | ||
983 | { | ||
984 | struct smi_info *smi_info = send_info; | ||
985 | |||
986 | if (!enable) | ||
987 | atomic_set(&smi_info->req_events, 0); | ||
988 | } | ||
989 | |||
952 | static struct ipmi_smi_handlers handlers = | 990 | static struct ipmi_smi_handlers handlers = |
953 | { | 991 | { |
954 | .owner = THIS_MODULE, | 992 | .owner = THIS_MODULE, |
955 | .start_processing = smi_start_processing, | 993 | .start_processing = smi_start_processing, |
956 | .sender = sender, | 994 | .sender = sender, |
957 | .request_events = request_events, | 995 | .request_events = request_events, |
996 | .set_maintenance_mode = set_maintenance_mode, | ||
958 | .set_run_to_completion = set_run_to_completion, | 997 | .set_run_to_completion = set_run_to_completion, |
959 | .poll = poll, | 998 | .poll = poll, |
960 | }; | 999 | }; |
@@ -987,6 +1026,16 @@ static int num_regshifts = 0; | |||
987 | static int slave_addrs[SI_MAX_PARMS]; | 1026 | static int slave_addrs[SI_MAX_PARMS]; |
988 | static int num_slave_addrs = 0; | 1027 | static int num_slave_addrs = 0; |
989 | 1028 | ||
1029 | #define IPMI_IO_ADDR_SPACE 0 | ||
1030 | #define IPMI_MEM_ADDR_SPACE 1 | ||
1031 | static char *addr_space_to_str[] = { "I/O", "mem" }; | ||
1032 | |||
1033 | static int hotmod_handler(const char *val, struct kernel_param *kp); | ||
1034 | |||
1035 | module_param_call(hotmod, hotmod_handler, NULL, NULL, 0200); | ||
1036 | MODULE_PARM_DESC(hotmod, "Add and remove interfaces. See" | ||
1037 | " Documentation/IPMI.txt in the kernel sources for the" | ||
1038 | " gory details."); | ||
990 | 1039 | ||
991 | module_param_named(trydefaults, si_trydefaults, bool, 0); | 1040 | module_param_named(trydefaults, si_trydefaults, bool, 0); |
992 | MODULE_PARM_DESC(trydefaults, "Setting this to 'false' will disable the" | 1041 | MODULE_PARM_DESC(trydefaults, "Setting this to 'false' will disable the" |
@@ -1038,12 +1087,12 @@ module_param_array(force_kipmid, int, &num_force_kipmid, 0); | |||
1038 | MODULE_PARM_DESC(force_kipmid, "Force the kipmi daemon to be enabled (1) or" | 1087 | MODULE_PARM_DESC(force_kipmid, "Force the kipmi daemon to be enabled (1) or" |
1039 | " disabled(0). Normally the IPMI driver auto-detects" | 1088 | " disabled(0). Normally the IPMI driver auto-detects" |
1040 | " this, but the value may be overridden by this parm."); | 1089 | " this, but the value may be overridden by this parm."); |
1090 | module_param(unload_when_empty, int, 0); | ||
1091 | MODULE_PARM_DESC(unload_when_empty, "Unload the module if no interfaces are" | ||
1092 | " specified or found, default is 1. Setting to 0" | ||
1093 | " is useful for hot add of devices using hotmod."); | ||
1041 | 1094 | ||
1042 | 1095 | ||
1043 | #define IPMI_IO_ADDR_SPACE 0 | ||
1044 | #define IPMI_MEM_ADDR_SPACE 1 | ||
1045 | static char *addr_space_to_str[] = { "I/O", "memory" }; | ||
1046 | |||
1047 | static void std_irq_cleanup(struct smi_info *info) | 1096 | static void std_irq_cleanup(struct smi_info *info) |
1048 | { | 1097 | { |
1049 | if (info->si_type == SI_BT) | 1098 | if (info->si_type == SI_BT) |
@@ -1317,6 +1366,234 @@ static int mem_setup(struct smi_info *info) | |||
1317 | return 0; | 1366 | return 0; |
1318 | } | 1367 | } |
1319 | 1368 | ||
1369 | /* | ||
1370 | * Parms come in as <op1>[:op2[:op3...]]. ops are: | ||
1371 | * add|remove,kcs|bt|smic,mem|i/o,<address>[,<opt1>[,<opt2>[,...]]] | ||
1372 | * Options are: | ||
1373 | * rsp=<regspacing> | ||
1374 | * rsi=<regsize> | ||
1375 | * rsh=<regshift> | ||
1376 | * irq=<irq> | ||
1377 | * ipmb=<ipmb addr> | ||
1378 | */ | ||
1379 | enum hotmod_op { HM_ADD, HM_REMOVE }; | ||
1380 | struct hotmod_vals { | ||
1381 | char *name; | ||
1382 | int val; | ||
1383 | }; | ||
1384 | static struct hotmod_vals hotmod_ops[] = { | ||
1385 | { "add", HM_ADD }, | ||
1386 | { "remove", HM_REMOVE }, | ||
1387 | { NULL } | ||
1388 | }; | ||
1389 | static struct hotmod_vals hotmod_si[] = { | ||
1390 | { "kcs", SI_KCS }, | ||
1391 | { "smic", SI_SMIC }, | ||
1392 | { "bt", SI_BT }, | ||
1393 | { NULL } | ||
1394 | }; | ||
1395 | static struct hotmod_vals hotmod_as[] = { | ||
1396 | { "mem", IPMI_MEM_ADDR_SPACE }, | ||
1397 | { "i/o", IPMI_IO_ADDR_SPACE }, | ||
1398 | { NULL } | ||
1399 | }; | ||
1400 | static int ipmi_strcasecmp(const char *s1, const char *s2) | ||
1401 | { | ||
1402 | while (*s1 || *s2) { | ||
1403 | if (!*s1) | ||
1404 | return -1; | ||
1405 | if (!*s2) | ||
1406 | return 1; | ||
1407 | if (*s1 != *s2) | ||
1408 | return *s1 - *s2; | ||
1409 | s1++; | ||
1410 | s2++; | ||
1411 | } | ||
1412 | return 0; | ||
1413 | } | ||
1414 | static int parse_str(struct hotmod_vals *v, int *val, char *name, char **curr) | ||
1415 | { | ||
1416 | char *s; | ||
1417 | int i; | ||
1418 | |||
1419 | s = strchr(*curr, ','); | ||
1420 | if (!s) { | ||
1421 | printk(KERN_WARNING PFX "No hotmod %s given.\n", name); | ||
1422 | return -EINVAL; | ||
1423 | } | ||
1424 | *s = '\0'; | ||
1425 | s++; | ||
1426 | for (i = 0; hotmod_ops[i].name; i++) { | ||
1427 | if (ipmi_strcasecmp(*curr, v[i].name) == 0) { | ||
1428 | *val = v[i].val; | ||
1429 | *curr = s; | ||
1430 | return 0; | ||
1431 | } | ||
1432 | } | ||
1433 | |||
1434 | printk(KERN_WARNING PFX "Invalid hotmod %s '%s'\n", name, *curr); | ||
1435 | return -EINVAL; | ||
1436 | } | ||
1437 | |||
1438 | static int hotmod_handler(const char *val, struct kernel_param *kp) | ||
1439 | { | ||
1440 | char *str = kstrdup(val, GFP_KERNEL); | ||
1441 | int rv = -EINVAL; | ||
1442 | char *next, *curr, *s, *n, *o; | ||
1443 | enum hotmod_op op; | ||
1444 | enum si_type si_type; | ||
1445 | int addr_space; | ||
1446 | unsigned long addr; | ||
1447 | int regspacing; | ||
1448 | int regsize; | ||
1449 | int regshift; | ||
1450 | int irq; | ||
1451 | int ipmb; | ||
1452 | int ival; | ||
1453 | struct smi_info *info; | ||
1454 | |||
1455 | if (!str) | ||
1456 | return -ENOMEM; | ||
1457 | |||
1458 | /* Kill any trailing spaces, as we can get a "\n" from echo. */ | ||
1459 | ival = strlen(str) - 1; | ||
1460 | while ((ival >= 0) && isspace(str[ival])) { | ||
1461 | str[ival] = '\0'; | ||
1462 | ival--; | ||
1463 | } | ||
1464 | |||
1465 | for (curr = str; curr; curr = next) { | ||
1466 | regspacing = 1; | ||
1467 | regsize = 1; | ||
1468 | regshift = 0; | ||
1469 | irq = 0; | ||
1470 | ipmb = 0x20; | ||
1471 | |||
1472 | next = strchr(curr, ':'); | ||
1473 | if (next) { | ||
1474 | *next = '\0'; | ||
1475 | next++; | ||
1476 | } | ||
1477 | |||
1478 | rv = parse_str(hotmod_ops, &ival, "operation", &curr); | ||
1479 | if (rv) | ||
1480 | break; | ||
1481 | op = ival; | ||
1482 | |||
1483 | rv = parse_str(hotmod_si, &ival, "interface type", &curr); | ||
1484 | if (rv) | ||
1485 | break; | ||
1486 | si_type = ival; | ||
1487 | |||
1488 | rv = parse_str(hotmod_as, &addr_space, "address space", &curr); | ||
1489 | if (rv) | ||
1490 | break; | ||
1491 | |||
1492 | s = strchr(curr, ','); | ||
1493 | if (s) { | ||
1494 | *s = '\0'; | ||
1495 | s++; | ||
1496 | } | ||
1497 | addr = simple_strtoul(curr, &n, 0); | ||
1498 | if ((*n != '\0') || (*curr == '\0')) { | ||
1499 | printk(KERN_WARNING PFX "Invalid hotmod address" | ||
1500 | " '%s'\n", curr); | ||
1501 | break; | ||
1502 | } | ||
1503 | |||
1504 | while (s) { | ||
1505 | curr = s; | ||
1506 | s = strchr(curr, ','); | ||
1507 | if (s) { | ||
1508 | *s = '\0'; | ||
1509 | s++; | ||
1510 | } | ||
1511 | o = strchr(curr, '='); | ||
1512 | if (o) { | ||
1513 | *o = '\0'; | ||
1514 | o++; | ||
1515 | } | ||
1516 | #define HOTMOD_INT_OPT(name, val) \ | ||
1517 | if (ipmi_strcasecmp(curr, name) == 0) { \ | ||
1518 | if (!o) { \ | ||
1519 | printk(KERN_WARNING PFX \ | ||
1520 | "No option given for '%s'\n", \ | ||
1521 | curr); \ | ||
1522 | goto out; \ | ||
1523 | } \ | ||
1524 | val = simple_strtoul(o, &n, 0); \ | ||
1525 | if ((*n != '\0') || (*o == '\0')) { \ | ||
1526 | printk(KERN_WARNING PFX \ | ||
1527 | "Bad option given for '%s'\n", \ | ||
1528 | curr); \ | ||
1529 | goto out; \ | ||
1530 | } \ | ||
1531 | } | ||
1532 | |||
1533 | HOTMOD_INT_OPT("rsp", regspacing) | ||
1534 | else HOTMOD_INT_OPT("rsi", regsize) | ||
1535 | else HOTMOD_INT_OPT("rsh", regshift) | ||
1536 | else HOTMOD_INT_OPT("irq", irq) | ||
1537 | else HOTMOD_INT_OPT("ipmb", ipmb) | ||
1538 | else { | ||
1539 | printk(KERN_WARNING PFX | ||
1540 | "Invalid hotmod option '%s'\n", | ||
1541 | curr); | ||
1542 | goto out; | ||
1543 | } | ||
1544 | #undef HOTMOD_INT_OPT | ||
1545 | } | ||
1546 | |||
1547 | if (op == HM_ADD) { | ||
1548 | info = kzalloc(sizeof(*info), GFP_KERNEL); | ||
1549 | if (!info) { | ||
1550 | rv = -ENOMEM; | ||
1551 | goto out; | ||
1552 | } | ||
1553 | |||
1554 | info->addr_source = "hotmod"; | ||
1555 | info->si_type = si_type; | ||
1556 | info->io.addr_data = addr; | ||
1557 | info->io.addr_type = addr_space; | ||
1558 | if (addr_space == IPMI_MEM_ADDR_SPACE) | ||
1559 | info->io_setup = mem_setup; | ||
1560 | else | ||
1561 | info->io_setup = port_setup; | ||
1562 | |||
1563 | info->io.addr = NULL; | ||
1564 | info->io.regspacing = regspacing; | ||
1565 | if (!info->io.regspacing) | ||
1566 | info->io.regspacing = DEFAULT_REGSPACING; | ||
1567 | info->io.regsize = regsize; | ||
1568 | if (!info->io.regsize) | ||
1569 | info->io.regsize = DEFAULT_REGSPACING; | ||
1570 | info->io.regshift = regshift; | ||
1571 | info->irq = irq; | ||
1572 | if (info->irq) | ||
1573 | info->irq_setup = std_irq_setup; | ||
1574 | info->slave_addr = ipmb; | ||
1575 | |||
1576 | try_smi_init(info); | ||
1577 | } else { | ||
1578 | /* remove */ | ||
1579 | struct smi_info *e, *tmp_e; | ||
1580 | |||
1581 | mutex_lock(&smi_infos_lock); | ||
1582 | list_for_each_entry_safe(e, tmp_e, &smi_infos, link) { | ||
1583 | if (e->io.addr_type != addr_space) | ||
1584 | continue; | ||
1585 | if (e->si_type != si_type) | ||
1586 | continue; | ||
1587 | if (e->io.addr_data == addr) | ||
1588 | cleanup_one_si(e); | ||
1589 | } | ||
1590 | mutex_unlock(&smi_infos_lock); | ||
1591 | } | ||
1592 | } | ||
1593 | out: | ||
1594 | kfree(str); | ||
1595 | return rv; | ||
1596 | } | ||
1320 | 1597 | ||
1321 | static __devinit void hardcode_find_bmc(void) | 1598 | static __devinit void hardcode_find_bmc(void) |
1322 | { | 1599 | { |
@@ -1333,11 +1610,11 @@ static __devinit void hardcode_find_bmc(void) | |||
1333 | 1610 | ||
1334 | info->addr_source = "hardcoded"; | 1611 | info->addr_source = "hardcoded"; |
1335 | 1612 | ||
1336 | if (!si_type[i] || strcmp(si_type[i], "kcs") == 0) { | 1613 | if (!si_type[i] || ipmi_strcasecmp(si_type[i], "kcs") == 0) { |
1337 | info->si_type = SI_KCS; | 1614 | info->si_type = SI_KCS; |
1338 | } else if (strcmp(si_type[i], "smic") == 0) { | 1615 | } else if (ipmi_strcasecmp(si_type[i], "smic") == 0) { |
1339 | info->si_type = SI_SMIC; | 1616 | info->si_type = SI_SMIC; |
1340 | } else if (strcmp(si_type[i], "bt") == 0) { | 1617 | } else if (ipmi_strcasecmp(si_type[i], "bt") == 0) { |
1341 | info->si_type = SI_BT; | 1618 | info->si_type = SI_BT; |
1342 | } else { | 1619 | } else { |
1343 | printk(KERN_WARNING | 1620 | printk(KERN_WARNING |
@@ -1952,19 +2229,9 @@ static int try_get_dev_id(struct smi_info *smi_info) | |||
1952 | static int type_file_read_proc(char *page, char **start, off_t off, | 2229 | static int type_file_read_proc(char *page, char **start, off_t off, |
1953 | int count, int *eof, void *data) | 2230 | int count, int *eof, void *data) |
1954 | { | 2231 | { |
1955 | char *out = (char *) page; | ||
1956 | struct smi_info *smi = data; | 2232 | struct smi_info *smi = data; |
1957 | 2233 | ||
1958 | switch (smi->si_type) { | 2234 | return sprintf(page, "%s\n", si_to_str[smi->si_type]); |
1959 | case SI_KCS: | ||
1960 | return sprintf(out, "kcs\n"); | ||
1961 | case SI_SMIC: | ||
1962 | return sprintf(out, "smic\n"); | ||
1963 | case SI_BT: | ||
1964 | return sprintf(out, "bt\n"); | ||
1965 | default: | ||
1966 | return 0; | ||
1967 | } | ||
1968 | } | 2235 | } |
1969 | 2236 | ||
1970 | static int stat_file_read_proc(char *page, char **start, off_t off, | 2237 | static int stat_file_read_proc(char *page, char **start, off_t off, |
@@ -2000,7 +2267,24 @@ static int stat_file_read_proc(char *page, char **start, off_t off, | |||
2000 | out += sprintf(out, "incoming_messages: %ld\n", | 2267 | out += sprintf(out, "incoming_messages: %ld\n", |
2001 | smi->incoming_messages); | 2268 | smi->incoming_messages); |
2002 | 2269 | ||
2003 | return (out - ((char *) page)); | 2270 | return out - page; |
2271 | } | ||
2272 | |||
2273 | static int param_read_proc(char *page, char **start, off_t off, | ||
2274 | int count, int *eof, void *data) | ||
2275 | { | ||
2276 | struct smi_info *smi = data; | ||
2277 | |||
2278 | return sprintf(page, | ||
2279 | "%s,%s,0x%lx,rsp=%d,rsi=%d,rsh=%d,irq=%d,ipmb=%d\n", | ||
2280 | si_to_str[smi->si_type], | ||
2281 | addr_space_to_str[smi->io.addr_type], | ||
2282 | smi->io.addr_data, | ||
2283 | smi->io.regspacing, | ||
2284 | smi->io.regsize, | ||
2285 | smi->io.regshift, | ||
2286 | smi->irq, | ||
2287 | smi->slave_addr); | ||
2004 | } | 2288 | } |
2005 | 2289 | ||
2006 | /* | 2290 | /* |
@@ -2362,6 +2646,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2362 | new_smi, | 2646 | new_smi, |
2363 | &new_smi->device_id, | 2647 | &new_smi->device_id, |
2364 | new_smi->dev, | 2648 | new_smi->dev, |
2649 | "bmc", | ||
2365 | new_smi->slave_addr); | 2650 | new_smi->slave_addr); |
2366 | if (rv) { | 2651 | if (rv) { |
2367 | printk(KERN_ERR | 2652 | printk(KERN_ERR |
@@ -2390,6 +2675,16 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2390 | goto out_err_stop_timer; | 2675 | goto out_err_stop_timer; |
2391 | } | 2676 | } |
2392 | 2677 | ||
2678 | rv = ipmi_smi_add_proc_entry(new_smi->intf, "params", | ||
2679 | param_read_proc, NULL, | ||
2680 | new_smi, THIS_MODULE); | ||
2681 | if (rv) { | ||
2682 | printk(KERN_ERR | ||
2683 | "ipmi_si: Unable to create proc entry: %d\n", | ||
2684 | rv); | ||
2685 | goto out_err_stop_timer; | ||
2686 | } | ||
2687 | |||
2393 | list_add_tail(&new_smi->link, &smi_infos); | 2688 | list_add_tail(&new_smi->link, &smi_infos); |
2394 | 2689 | ||
2395 | mutex_unlock(&smi_infos_lock); | 2690 | mutex_unlock(&smi_infos_lock); |
@@ -2483,7 +2778,12 @@ static __devinit int init_ipmi_si(void) | |||
2483 | #endif | 2778 | #endif |
2484 | 2779 | ||
2485 | #ifdef CONFIG_PCI | 2780 | #ifdef CONFIG_PCI |
2486 | pci_module_init(&ipmi_pci_driver); | 2781 | rv = pci_register_driver(&ipmi_pci_driver); |
2782 | if (rv){ | ||
2783 | printk(KERN_ERR | ||
2784 | "init_ipmi_si: Unable to register PCI driver: %d\n", | ||
2785 | rv); | ||
2786 | } | ||
2487 | #endif | 2787 | #endif |
2488 | 2788 | ||
2489 | if (si_trydefaults) { | 2789 | if (si_trydefaults) { |
@@ -2498,7 +2798,7 @@ static __devinit int init_ipmi_si(void) | |||
2498 | } | 2798 | } |
2499 | 2799 | ||
2500 | mutex_lock(&smi_infos_lock); | 2800 | mutex_lock(&smi_infos_lock); |
2501 | if (list_empty(&smi_infos)) { | 2801 | if (unload_when_empty && list_empty(&smi_infos)) { |
2502 | mutex_unlock(&smi_infos_lock); | 2802 | mutex_unlock(&smi_infos_lock); |
2503 | #ifdef CONFIG_PCI | 2803 | #ifdef CONFIG_PCI |
2504 | pci_unregister_driver(&ipmi_pci_driver); | 2804 | pci_unregister_driver(&ipmi_pci_driver); |
@@ -2513,7 +2813,7 @@ static __devinit int init_ipmi_si(void) | |||
2513 | } | 2813 | } |
2514 | module_init(init_ipmi_si); | 2814 | module_init(init_ipmi_si); |
2515 | 2815 | ||
2516 | static void __devexit cleanup_one_si(struct smi_info *to_clean) | 2816 | static void cleanup_one_si(struct smi_info *to_clean) |
2517 | { | 2817 | { |
2518 | int rv; | 2818 | int rv; |
2519 | unsigned long flags; | 2819 | unsigned long flags; |
diff --git a/drivers/char/ipmi/ipmi_smic_sm.c b/drivers/char/ipmi/ipmi_smic_sm.c index 39d7e5ef1a2b..e64ea7d25d24 100644 --- a/drivers/char/ipmi/ipmi_smic_sm.c +++ b/drivers/char/ipmi/ipmi_smic_sm.c | |||
@@ -141,12 +141,14 @@ static int start_smic_transaction(struct si_sm_data *smic, | |||
141 | { | 141 | { |
142 | unsigned int i; | 142 | unsigned int i; |
143 | 143 | ||
144 | if ((size < 2) || (size > MAX_SMIC_WRITE_SIZE)) { | 144 | if (size < 2) |
145 | return -1; | 145 | return IPMI_REQ_LEN_INVALID_ERR; |
146 | } | 146 | if (size > MAX_SMIC_WRITE_SIZE) |
147 | if ((smic->state != SMIC_IDLE) && (smic->state != SMIC_HOSED)) { | 147 | return IPMI_REQ_LEN_EXCEEDED_ERR; |
148 | return -2; | 148 | |
149 | } | 149 | if ((smic->state != SMIC_IDLE) && (smic->state != SMIC_HOSED)) |
150 | return IPMI_NOT_IN_MY_STATE_ERR; | ||
151 | |||
150 | if (smic_debug & SMIC_DEBUG_MSG) { | 152 | if (smic_debug & SMIC_DEBUG_MSG) { |
151 | printk(KERN_INFO "start_smic_transaction -"); | 153 | printk(KERN_INFO "start_smic_transaction -"); |
152 | for (i = 0; i < size; i ++) { | 154 | for (i = 0; i < size; i ++) { |
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 73f759eaa5a6..90fb2a541916 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -135,6 +135,7 @@ | |||
135 | static int nowayout = WATCHDOG_NOWAYOUT; | 135 | static int nowayout = WATCHDOG_NOWAYOUT; |
136 | 136 | ||
137 | static ipmi_user_t watchdog_user = NULL; | 137 | static ipmi_user_t watchdog_user = NULL; |
138 | static int watchdog_ifnum; | ||
138 | 139 | ||
139 | /* Default the timeout to 10 seconds. */ | 140 | /* Default the timeout to 10 seconds. */ |
140 | static int timeout = 10; | 141 | static int timeout = 10; |
@@ -161,6 +162,8 @@ static struct fasync_struct *fasync_q = NULL; | |||
161 | static char pretimeout_since_last_heartbeat = 0; | 162 | static char pretimeout_since_last_heartbeat = 0; |
162 | static char expect_close; | 163 | static char expect_close; |
163 | 164 | ||
165 | static int ifnum_to_use = -1; | ||
166 | |||
164 | static DECLARE_RWSEM(register_sem); | 167 | static DECLARE_RWSEM(register_sem); |
165 | 168 | ||
166 | /* Parameters to ipmi_set_timeout */ | 169 | /* Parameters to ipmi_set_timeout */ |
@@ -169,6 +172,8 @@ static DECLARE_RWSEM(register_sem); | |||
169 | #define IPMI_SET_TIMEOUT_FORCE_HB 2 | 172 | #define IPMI_SET_TIMEOUT_FORCE_HB 2 |
170 | 173 | ||
171 | static int ipmi_set_timeout(int do_heartbeat); | 174 | static int ipmi_set_timeout(int do_heartbeat); |
175 | static void ipmi_register_watchdog(int ipmi_intf); | ||
176 | static void ipmi_unregister_watchdog(int ipmi_intf); | ||
172 | 177 | ||
173 | /* If true, the driver will start running as soon as it is configured | 178 | /* If true, the driver will start running as soon as it is configured |
174 | and ready. */ | 179 | and ready. */ |
@@ -245,6 +250,26 @@ static int get_param_str(char *buffer, struct kernel_param *kp) | |||
245 | return strlen(buffer); | 250 | return strlen(buffer); |
246 | } | 251 | } |
247 | 252 | ||
253 | |||
254 | static int set_param_wdog_ifnum(const char *val, struct kernel_param *kp) | ||
255 | { | ||
256 | int rv = param_set_int(val, kp); | ||
257 | if (rv) | ||
258 | return rv; | ||
259 | if ((ifnum_to_use < 0) || (ifnum_to_use == watchdog_ifnum)) | ||
260 | return 0; | ||
261 | |||
262 | ipmi_unregister_watchdog(watchdog_ifnum); | ||
263 | ipmi_register_watchdog(ifnum_to_use); | ||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | module_param_call(ifnum_to_use, set_param_wdog_ifnum, get_param_int, | ||
268 | &ifnum_to_use, 0644); | ||
269 | MODULE_PARM_DESC(ifnum_to_use, "The interface number to use for the watchdog " | ||
270 | "timer. Setting to -1 defaults to the first registered " | ||
271 | "interface"); | ||
272 | |||
248 | module_param_call(timeout, set_param_int, get_param_int, &timeout, 0644); | 273 | module_param_call(timeout, set_param_int, get_param_int, &timeout, 0644); |
249 | MODULE_PARM_DESC(timeout, "Timeout value in seconds."); | 274 | MODULE_PARM_DESC(timeout, "Timeout value in seconds."); |
250 | 275 | ||
@@ -263,12 +288,13 @@ module_param_call(preop, set_param_str, get_param_str, preop_op, 0644); | |||
263 | MODULE_PARM_DESC(preop, "Pretimeout driver operation. One of: " | 288 | MODULE_PARM_DESC(preop, "Pretimeout driver operation. One of: " |
264 | "preop_none, preop_panic, preop_give_data."); | 289 | "preop_none, preop_panic, preop_give_data."); |
265 | 290 | ||
266 | module_param(start_now, int, 0); | 291 | module_param(start_now, int, 0444); |
267 | MODULE_PARM_DESC(start_now, "Set to 1 to start the watchdog as" | 292 | MODULE_PARM_DESC(start_now, "Set to 1 to start the watchdog as" |
268 | "soon as the driver is loaded."); | 293 | "soon as the driver is loaded."); |
269 | 294 | ||
270 | module_param(nowayout, int, 0644); | 295 | module_param(nowayout, int, 0644); |
271 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); | 296 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
297 | "(default=CONFIG_WATCHDOG_NOWAYOUT)"); | ||
272 | 298 | ||
273 | /* Default state of the timer. */ | 299 | /* Default state of the timer. */ |
274 | static unsigned char ipmi_watchdog_state = WDOG_TIMEOUT_NONE; | 300 | static unsigned char ipmi_watchdog_state = WDOG_TIMEOUT_NONE; |
@@ -872,6 +898,11 @@ static void ipmi_register_watchdog(int ipmi_intf) | |||
872 | if (watchdog_user) | 898 | if (watchdog_user) |
873 | goto out; | 899 | goto out; |
874 | 900 | ||
901 | if ((ifnum_to_use >= 0) && (ifnum_to_use != ipmi_intf)) | ||
902 | goto out; | ||
903 | |||
904 | watchdog_ifnum = ipmi_intf; | ||
905 | |||
875 | rv = ipmi_create_user(ipmi_intf, &ipmi_hndlrs, NULL, &watchdog_user); | 906 | rv = ipmi_create_user(ipmi_intf, &ipmi_hndlrs, NULL, &watchdog_user); |
876 | if (rv < 0) { | 907 | if (rv < 0) { |
877 | printk(KERN_CRIT PFX "Unable to register with ipmi\n"); | 908 | printk(KERN_CRIT PFX "Unable to register with ipmi\n"); |
@@ -901,6 +932,39 @@ static void ipmi_register_watchdog(int ipmi_intf) | |||
901 | } | 932 | } |
902 | } | 933 | } |
903 | 934 | ||
935 | static void ipmi_unregister_watchdog(int ipmi_intf) | ||
936 | { | ||
937 | int rv; | ||
938 | |||
939 | down_write(®ister_sem); | ||
940 | |||
941 | if (!watchdog_user) | ||
942 | goto out; | ||
943 | |||
944 | if (watchdog_ifnum != ipmi_intf) | ||
945 | goto out; | ||
946 | |||
947 | /* Make sure no one can call us any more. */ | ||
948 | misc_deregister(&ipmi_wdog_miscdev); | ||
949 | |||
950 | /* Wait to make sure the message makes it out. The lower layer has | ||
951 | pointers to our buffers, we want to make sure they are done before | ||
952 | we release our memory. */ | ||
953 | while (atomic_read(&set_timeout_tofree)) | ||
954 | schedule_timeout_uninterruptible(1); | ||
955 | |||
956 | /* Disconnect from IPMI. */ | ||
957 | rv = ipmi_destroy_user(watchdog_user); | ||
958 | if (rv) { | ||
959 | printk(KERN_WARNING PFX "error unlinking from IPMI: %d\n", | ||
960 | rv); | ||
961 | } | ||
962 | watchdog_user = NULL; | ||
963 | |||
964 | out: | ||
965 | up_write(®ister_sem); | ||
966 | } | ||
967 | |||
904 | #ifdef HAVE_NMI_HANDLER | 968 | #ifdef HAVE_NMI_HANDLER |
905 | static int | 969 | static int |
906 | ipmi_nmi(void *dev_id, int cpu, int handled) | 970 | ipmi_nmi(void *dev_id, int cpu, int handled) |
@@ -1004,9 +1068,7 @@ static void ipmi_new_smi(int if_num, struct device *device) | |||
1004 | 1068 | ||
1005 | static void ipmi_smi_gone(int if_num) | 1069 | static void ipmi_smi_gone(int if_num) |
1006 | { | 1070 | { |
1007 | /* This can never be called, because once the watchdog is | 1071 | ipmi_unregister_watchdog(if_num); |
1008 | registered, the interface can't go away until the watchdog | ||
1009 | is unregistered. */ | ||
1010 | } | 1072 | } |
1011 | 1073 | ||
1012 | static struct ipmi_smi_watcher smi_watcher = | 1074 | static struct ipmi_smi_watcher smi_watcher = |
@@ -1148,30 +1210,32 @@ static int __init ipmi_wdog_init(void) | |||
1148 | 1210 | ||
1149 | check_parms(); | 1211 | check_parms(); |
1150 | 1212 | ||
1213 | register_reboot_notifier(&wdog_reboot_notifier); | ||
1214 | atomic_notifier_chain_register(&panic_notifier_list, | ||
1215 | &wdog_panic_notifier); | ||
1216 | |||
1151 | rv = ipmi_smi_watcher_register(&smi_watcher); | 1217 | rv = ipmi_smi_watcher_register(&smi_watcher); |
1152 | if (rv) { | 1218 | if (rv) { |
1153 | #ifdef HAVE_NMI_HANDLER | 1219 | #ifdef HAVE_NMI_HANDLER |
1154 | if (preaction_val == WDOG_PRETIMEOUT_NMI) | 1220 | if (preaction_val == WDOG_PRETIMEOUT_NMI) |
1155 | release_nmi(&ipmi_nmi_handler); | 1221 | release_nmi(&ipmi_nmi_handler); |
1156 | #endif | 1222 | #endif |
1223 | atomic_notifier_chain_unregister(&panic_notifier_list, | ||
1224 | &wdog_panic_notifier); | ||
1225 | unregister_reboot_notifier(&wdog_reboot_notifier); | ||
1157 | printk(KERN_WARNING PFX "can't register smi watcher\n"); | 1226 | printk(KERN_WARNING PFX "can't register smi watcher\n"); |
1158 | return rv; | 1227 | return rv; |
1159 | } | 1228 | } |
1160 | 1229 | ||
1161 | register_reboot_notifier(&wdog_reboot_notifier); | ||
1162 | atomic_notifier_chain_register(&panic_notifier_list, | ||
1163 | &wdog_panic_notifier); | ||
1164 | |||
1165 | printk(KERN_INFO PFX "driver initialized\n"); | 1230 | printk(KERN_INFO PFX "driver initialized\n"); |
1166 | 1231 | ||
1167 | return 0; | 1232 | return 0; |
1168 | } | 1233 | } |
1169 | 1234 | ||
1170 | static __exit void ipmi_unregister_watchdog(void) | 1235 | static void __exit ipmi_wdog_exit(void) |
1171 | { | 1236 | { |
1172 | int rv; | 1237 | ipmi_smi_watcher_unregister(&smi_watcher); |
1173 | 1238 | ipmi_unregister_watchdog(watchdog_ifnum); | |
1174 | down_write(®ister_sem); | ||
1175 | 1239 | ||
1176 | #ifdef HAVE_NMI_HANDLER | 1240 | #ifdef HAVE_NMI_HANDLER |
1177 | if (nmi_handler_registered) | 1241 | if (nmi_handler_registered) |
@@ -1179,37 +1243,8 @@ static __exit void ipmi_unregister_watchdog(void) | |||
1179 | #endif | 1243 | #endif |
1180 | 1244 | ||
1181 | atomic_notifier_chain_unregister(&panic_notifier_list, | 1245 | atomic_notifier_chain_unregister(&panic_notifier_list, |
1182 | &wdog_panic_notifier); | 1246 | &wdog_panic_notifier); |
1183 | unregister_reboot_notifier(&wdog_reboot_notifier); | 1247 | unregister_reboot_notifier(&wdog_reboot_notifier); |
1184 | |||
1185 | if (! watchdog_user) | ||
1186 | goto out; | ||
1187 | |||
1188 | /* Make sure no one can call us any more. */ | ||
1189 | misc_deregister(&ipmi_wdog_miscdev); | ||
1190 | |||
1191 | /* Wait to make sure the message makes it out. The lower layer has | ||
1192 | pointers to our buffers, we want to make sure they are done before | ||
1193 | we release our memory. */ | ||
1194 | while (atomic_read(&set_timeout_tofree)) | ||
1195 | schedule_timeout_uninterruptible(1); | ||
1196 | |||
1197 | /* Disconnect from IPMI. */ | ||
1198 | rv = ipmi_destroy_user(watchdog_user); | ||
1199 | if (rv) { | ||
1200 | printk(KERN_WARNING PFX "error unlinking from IPMI: %d\n", | ||
1201 | rv); | ||
1202 | } | ||
1203 | watchdog_user = NULL; | ||
1204 | |||
1205 | out: | ||
1206 | up_write(®ister_sem); | ||
1207 | } | ||
1208 | |||
1209 | static void __exit ipmi_wdog_exit(void) | ||
1210 | { | ||
1211 | ipmi_smi_watcher_unregister(&smi_watcher); | ||
1212 | ipmi_unregister_watchdog(); | ||
1213 | } | 1248 | } |
1214 | module_exit(ipmi_wdog_exit); | 1249 | module_exit(ipmi_wdog_exit); |
1215 | module_init(ipmi_wdog_init); | 1250 | module_init(ipmi_wdog_init); |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index bd9195e17956..8f591945ebd9 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -3476,6 +3476,8 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3476 | if (sig.magic != cpu_to_le32(ECP_MAGIC)) | 3476 | if (sig.magic != cpu_to_le32(ECP_MAGIC)) |
3477 | { | 3477 | { |
3478 | release_region(brdp->iobase, brdp->iosize); | 3478 | release_region(brdp->iobase, brdp->iosize); |
3479 | iounmap(brdp->membase); | ||
3480 | brdp->membase = NULL; | ||
3479 | return -ENODEV; | 3481 | return -ENODEV; |
3480 | } | 3482 | } |
3481 | 3483 | ||
@@ -3632,6 +3634,8 @@ static int stli_initonb(stlibrd_t *brdp) | |||
3632 | sig.magic3 != cpu_to_le16(ONB_MAGIC3)) | 3634 | sig.magic3 != cpu_to_le16(ONB_MAGIC3)) |
3633 | { | 3635 | { |
3634 | release_region(brdp->iobase, brdp->iosize); | 3636 | release_region(brdp->iobase, brdp->iosize); |
3637 | iounmap(brdp->membase); | ||
3638 | brdp->membase = NULL; | ||
3635 | return -ENODEV; | 3639 | return -ENODEV; |
3636 | } | 3640 | } |
3637 | 3641 | ||
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 7a484fc7cb9e..7e975f606924 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -199,6 +199,8 @@ int misc_register(struct miscdevice * misc) | |||
199 | dev_t dev; | 199 | dev_t dev; |
200 | int err = 0; | 200 | int err = 0; |
201 | 201 | ||
202 | INIT_LIST_HEAD(&misc->list); | ||
203 | |||
202 | down(&misc_sem); | 204 | down(&misc_sem); |
203 | list_for_each_entry(c, &misc_list, list) { | 205 | list_for_each_entry(c, &misc_list, list) { |
204 | if (c->minor == misc->minor) { | 206 | if (c->minor == misc->minor) { |
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index 22b9905c1e52..c09160383a53 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c | |||
@@ -680,7 +680,7 @@ static int __init mmtimer_init(void) | |||
680 | if (sn_rtc_cycles_per_second < 100000) { | 680 | if (sn_rtc_cycles_per_second < 100000) { |
681 | printk(KERN_ERR "%s: unable to determine clock frequency\n", | 681 | printk(KERN_ERR "%s: unable to determine clock frequency\n", |
682 | MMTIMER_NAME); | 682 | MMTIMER_NAME); |
683 | return -1; | 683 | goto out1; |
684 | } | 684 | } |
685 | 685 | ||
686 | mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second / | 686 | mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second / |
@@ -689,13 +689,13 @@ static int __init mmtimer_init(void) | |||
689 | if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, IRQF_PERCPU, MMTIMER_NAME, NULL)) { | 689 | if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, IRQF_PERCPU, MMTIMER_NAME, NULL)) { |
690 | printk(KERN_WARNING "%s: unable to allocate interrupt.", | 690 | printk(KERN_WARNING "%s: unable to allocate interrupt.", |
691 | MMTIMER_NAME); | 691 | MMTIMER_NAME); |
692 | return -1; | 692 | goto out1; |
693 | } | 693 | } |
694 | 694 | ||
695 | if (misc_register(&mmtimer_miscdev)) { | 695 | if (misc_register(&mmtimer_miscdev)) { |
696 | printk(KERN_ERR "%s: failed to register device\n", | 696 | printk(KERN_ERR "%s: failed to register device\n", |
697 | MMTIMER_NAME); | 697 | MMTIMER_NAME); |
698 | return -1; | 698 | goto out2; |
699 | } | 699 | } |
700 | 700 | ||
701 | /* Get max numbered node, calculate slots needed */ | 701 | /* Get max numbered node, calculate slots needed */ |
@@ -709,16 +709,18 @@ static int __init mmtimer_init(void) | |||
709 | if (timers == NULL) { | 709 | if (timers == NULL) { |
710 | printk(KERN_ERR "%s: failed to allocate memory for device\n", | 710 | printk(KERN_ERR "%s: failed to allocate memory for device\n", |
711 | MMTIMER_NAME); | 711 | MMTIMER_NAME); |
712 | return -1; | 712 | goto out3; |
713 | } | 713 | } |
714 | 714 | ||
715 | memset(timers,0,(sizeof(mmtimer_t *)*maxn)); | ||
716 | |||
715 | /* Allocate mmtimer_t's for each online node */ | 717 | /* Allocate mmtimer_t's for each online node */ |
716 | for_each_online_node(node) { | 718 | for_each_online_node(node) { |
717 | timers[node] = kmalloc_node(sizeof(mmtimer_t)*NUM_COMPARATORS, GFP_KERNEL, node); | 719 | timers[node] = kmalloc_node(sizeof(mmtimer_t)*NUM_COMPARATORS, GFP_KERNEL, node); |
718 | if (timers[node] == NULL) { | 720 | if (timers[node] == NULL) { |
719 | printk(KERN_ERR "%s: failed to allocate memory for device\n", | 721 | printk(KERN_ERR "%s: failed to allocate memory for device\n", |
720 | MMTIMER_NAME); | 722 | MMTIMER_NAME); |
721 | return -1; | 723 | goto out4; |
722 | } | 724 | } |
723 | for (i=0; i< NUM_COMPARATORS; i++) { | 725 | for (i=0; i< NUM_COMPARATORS; i++) { |
724 | mmtimer_t * base = timers[node] + i; | 726 | mmtimer_t * base = timers[node] + i; |
@@ -739,6 +741,17 @@ static int __init mmtimer_init(void) | |||
739 | sn_rtc_cycles_per_second/(unsigned long)1E6); | 741 | sn_rtc_cycles_per_second/(unsigned long)1E6); |
740 | 742 | ||
741 | return 0; | 743 | return 0; |
744 | |||
745 | out4: | ||
746 | for_each_online_node(node) { | ||
747 | kfree(timers[node]); | ||
748 | } | ||
749 | out3: | ||
750 | misc_deregister(&mmtimer_miscdev); | ||
751 | out2: | ||
752 | free_irq(SGI_MMTIMER_VECTOR, NULL); | ||
753 | out1: | ||
754 | return -1; | ||
742 | } | 755 | } |
743 | 756 | ||
744 | module_init(mmtimer_init); | 757 | module_init(mmtimer_init); |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 2d025a9fd14d..8b316953173d 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -498,9 +498,12 @@ static void __exit moxa_exit(void) | |||
498 | printk("Couldn't unregister MOXA Intellio family serial driver\n"); | 498 | printk("Couldn't unregister MOXA Intellio family serial driver\n"); |
499 | put_tty_driver(moxaDriver); | 499 | put_tty_driver(moxaDriver); |
500 | 500 | ||
501 | for (i = 0; i < MAX_BOARDS; i++) | 501 | for (i = 0; i < MAX_BOARDS; i++) { |
502 | if (moxaBaseAddr[i]) | ||
503 | iounmap(moxaBaseAddr[i]); | ||
502 | if (moxa_boards[i].busType == MOXA_BUS_TYPE_PCI) | 504 | if (moxa_boards[i].busType == MOXA_BUS_TYPE_PCI) |
503 | pci_dev_put(moxa_boards[i].pciInfo.pdev); | 505 | pci_dev_put(moxa_boards[i].pciInfo.pdev); |
506 | } | ||
504 | 507 | ||
505 | if (verbose) | 508 | if (verbose) |
506 | printk("Done\n"); | 509 | printk("Done\n"); |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 1bd12296dca5..74d21c1c104f 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -75,8 +75,10 @@ | |||
75 | #include <pcmcia/cisreg.h> | 75 | #include <pcmcia/cisreg.h> |
76 | #include <pcmcia/ds.h> | 76 | #include <pcmcia/ds.h> |
77 | 77 | ||
78 | #ifdef CONFIG_HDLC_MODULE | 78 | #if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINK_CS_MODULE)) |
79 | #define CONFIG_HDLC 1 | 79 | #define SYNCLINK_GENERIC_HDLC 1 |
80 | #else | ||
81 | #define SYNCLINK_GENERIC_HDLC 0 | ||
80 | #endif | 82 | #endif |
81 | 83 | ||
82 | #define GET_USER(error,value,addr) error = get_user(value,addr) | 84 | #define GET_USER(error,value,addr) error = get_user(value,addr) |
@@ -235,7 +237,7 @@ typedef struct _mgslpc_info { | |||
235 | int dosyncppp; | 237 | int dosyncppp; |
236 | spinlock_t netlock; | 238 | spinlock_t netlock; |
237 | 239 | ||
238 | #ifdef CONFIG_HDLC | 240 | #if SYNCLINK_GENERIC_HDLC |
239 | struct net_device *netdev; | 241 | struct net_device *netdev; |
240 | #endif | 242 | #endif |
241 | 243 | ||
@@ -392,7 +394,7 @@ static void tx_timeout(unsigned long context); | |||
392 | 394 | ||
393 | static int ioctl_common(MGSLPC_INFO *info, unsigned int cmd, unsigned long arg); | 395 | static int ioctl_common(MGSLPC_INFO *info, unsigned int cmd, unsigned long arg); |
394 | 396 | ||
395 | #ifdef CONFIG_HDLC | 397 | #if SYNCLINK_GENERIC_HDLC |
396 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) | 398 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) |
397 | static void hdlcdev_tx_done(MGSLPC_INFO *info); | 399 | static void hdlcdev_tx_done(MGSLPC_INFO *info); |
398 | static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size); | 400 | static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size); |
@@ -1053,7 +1055,7 @@ static void tx_done(MGSLPC_INFO *info) | |||
1053 | info->drop_rts_on_tx_done = 0; | 1055 | info->drop_rts_on_tx_done = 0; |
1054 | } | 1056 | } |
1055 | 1057 | ||
1056 | #ifdef CONFIG_HDLC | 1058 | #if SYNCLINK_GENERIC_HDLC |
1057 | if (info->netcount) | 1059 | if (info->netcount) |
1058 | hdlcdev_tx_done(info); | 1060 | hdlcdev_tx_done(info); |
1059 | else | 1061 | else |
@@ -1164,7 +1166,7 @@ static void dcd_change(MGSLPC_INFO *info) | |||
1164 | } | 1166 | } |
1165 | else | 1167 | else |
1166 | info->input_signal_events.dcd_down++; | 1168 | info->input_signal_events.dcd_down++; |
1167 | #ifdef CONFIG_HDLC | 1169 | #if SYNCLINK_GENERIC_HDLC |
1168 | if (info->netcount) { | 1170 | if (info->netcount) { |
1169 | if (info->serial_signals & SerialSignal_DCD) | 1171 | if (info->serial_signals & SerialSignal_DCD) |
1170 | netif_carrier_on(info->netdev); | 1172 | netif_carrier_on(info->netdev); |
@@ -2953,7 +2955,7 @@ static void mgslpc_add_device(MGSLPC_INFO *info) | |||
2953 | printk( "SyncLink PC Card %s:IO=%04X IRQ=%d\n", | 2955 | printk( "SyncLink PC Card %s:IO=%04X IRQ=%d\n", |
2954 | info->device_name, info->io_base, info->irq_level); | 2956 | info->device_name, info->io_base, info->irq_level); |
2955 | 2957 | ||
2956 | #ifdef CONFIG_HDLC | 2958 | #if SYNCLINK_GENERIC_HDLC |
2957 | hdlcdev_init(info); | 2959 | hdlcdev_init(info); |
2958 | #endif | 2960 | #endif |
2959 | } | 2961 | } |
@@ -2969,7 +2971,7 @@ static void mgslpc_remove_device(MGSLPC_INFO *remove_info) | |||
2969 | last->next_device = info->next_device; | 2971 | last->next_device = info->next_device; |
2970 | else | 2972 | else |
2971 | mgslpc_device_list = info->next_device; | 2973 | mgslpc_device_list = info->next_device; |
2972 | #ifdef CONFIG_HDLC | 2974 | #if SYNCLINK_GENERIC_HDLC |
2973 | hdlcdev_exit(info); | 2975 | hdlcdev_exit(info); |
2974 | #endif | 2976 | #endif |
2975 | release_resources(info); | 2977 | release_resources(info); |
@@ -3901,7 +3903,7 @@ static int rx_get_frame(MGSLPC_INFO *info) | |||
3901 | return_frame = 1; | 3903 | return_frame = 1; |
3902 | } | 3904 | } |
3903 | framesize = 0; | 3905 | framesize = 0; |
3904 | #ifdef CONFIG_HDLC | 3906 | #if SYNCLINK_GENERIC_HDLC |
3905 | { | 3907 | { |
3906 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 3908 | struct net_device_stats *stats = hdlc_stats(info->netdev); |
3907 | stats->rx_errors++; | 3909 | stats->rx_errors++; |
@@ -3935,7 +3937,7 @@ static int rx_get_frame(MGSLPC_INFO *info) | |||
3935 | ++framesize; | 3937 | ++framesize; |
3936 | } | 3938 | } |
3937 | 3939 | ||
3938 | #ifdef CONFIG_HDLC | 3940 | #if SYNCLINK_GENERIC_HDLC |
3939 | if (info->netcount) | 3941 | if (info->netcount) |
3940 | hdlcdev_rx(info, buf->data, framesize); | 3942 | hdlcdev_rx(info, buf->data, framesize); |
3941 | else | 3943 | else |
@@ -4091,7 +4093,7 @@ static void tx_timeout(unsigned long context) | |||
4091 | 4093 | ||
4092 | spin_unlock_irqrestore(&info->lock,flags); | 4094 | spin_unlock_irqrestore(&info->lock,flags); |
4093 | 4095 | ||
4094 | #ifdef CONFIG_HDLC | 4096 | #if SYNCLINK_GENERIC_HDLC |
4095 | if (info->netcount) | 4097 | if (info->netcount) |
4096 | hdlcdev_tx_done(info); | 4098 | hdlcdev_tx_done(info); |
4097 | else | 4099 | else |
@@ -4099,7 +4101,7 @@ static void tx_timeout(unsigned long context) | |||
4099 | bh_transmit(info); | 4101 | bh_transmit(info); |
4100 | } | 4102 | } |
4101 | 4103 | ||
4102 | #ifdef CONFIG_HDLC | 4104 | #if SYNCLINK_GENERIC_HDLC |
4103 | 4105 | ||
4104 | /** | 4106 | /** |
4105 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) | 4107 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 7ac68cb3bedd..e79b2ede8510 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -1026,6 +1026,7 @@ static int __init rio_init(void) | |||
1026 | found++; | 1026 | found++; |
1027 | } else { | 1027 | } else { |
1028 | iounmap(p->RIOHosts[p->RIONumHosts].Caddr); | 1028 | iounmap(p->RIOHosts[p->RIONumHosts].Caddr); |
1029 | p->RIOHosts[p->RIONumHosts].Caddr = NULL; | ||
1029 | } | 1030 | } |
1030 | } | 1031 | } |
1031 | 1032 | ||
@@ -1078,6 +1079,7 @@ static int __init rio_init(void) | |||
1078 | found++; | 1079 | found++; |
1079 | } else { | 1080 | } else { |
1080 | iounmap(p->RIOHosts[p->RIONumHosts].Caddr); | 1081 | iounmap(p->RIOHosts[p->RIONumHosts].Caddr); |
1082 | p->RIOHosts[p->RIONumHosts].Caddr = NULL; | ||
1081 | } | 1083 | } |
1082 | #else | 1084 | #else |
1083 | printk(KERN_ERR "Found an older RIO PCI card, but the driver is not " "compiled to support it.\n"); | 1085 | printk(KERN_ERR "Found an older RIO PCI card, but the driver is not " "compiled to support it.\n"); |
@@ -1117,8 +1119,10 @@ static int __init rio_init(void) | |||
1117 | } | 1119 | } |
1118 | } | 1120 | } |
1119 | 1121 | ||
1120 | if (!okboard) | 1122 | if (!okboard) { |
1121 | iounmap(hp->Caddr); | 1123 | iounmap(hp->Caddr); |
1124 | hp->Caddr = NULL; | ||
1125 | } | ||
1122 | } | 1126 | } |
1123 | } | 1127 | } |
1124 | 1128 | ||
@@ -1188,6 +1192,8 @@ static void __exit rio_exit(void) | |||
1188 | } | 1192 | } |
1189 | /* It is safe/allowed to del_timer a non-active timer */ | 1193 | /* It is safe/allowed to del_timer a non-active timer */ |
1190 | del_timer(&hp->timer); | 1194 | del_timer(&hp->timer); |
1195 | if (hp->Caddr) | ||
1196 | iounmap(hp->Caddr); | ||
1191 | if (hp->Type == RIO_PCI) | 1197 | if (hp->Type == RIO_PCI) |
1192 | pci_dev_put(hp->pdev); | 1198 | pci_dev_put(hp->pdev); |
1193 | } | 1199 | } |
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 722dd3e74185..0a77bfcd5b5e 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -82,11 +82,6 @@ | |||
82 | static struct riscom_board * IRQ_to_board[16]; | 82 | static struct riscom_board * IRQ_to_board[16]; |
83 | static struct tty_driver *riscom_driver; | 83 | static struct tty_driver *riscom_driver; |
84 | 84 | ||
85 | static unsigned long baud_table[] = { | ||
86 | 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, | ||
87 | 9600, 19200, 38400, 57600, 76800, 0, | ||
88 | }; | ||
89 | |||
90 | static struct riscom_board rc_board[RC_NBOARD] = { | 85 | static struct riscom_board rc_board[RC_NBOARD] = { |
91 | { | 86 | { |
92 | .base = RC_IOBASE1, | 87 | .base = RC_IOBASE1, |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 147c30da81ea..645187b9141e 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -101,8 +101,10 @@ | |||
101 | #include <linux/hdlc.h> | 101 | #include <linux/hdlc.h> |
102 | #include <linux/dma-mapping.h> | 102 | #include <linux/dma-mapping.h> |
103 | 103 | ||
104 | #ifdef CONFIG_HDLC_MODULE | 104 | #if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINK_MODULE)) |
105 | #define CONFIG_HDLC 1 | 105 | #define SYNCLINK_GENERIC_HDLC 1 |
106 | #else | ||
107 | #define SYNCLINK_GENERIC_HDLC 0 | ||
106 | #endif | 108 | #endif |
107 | 109 | ||
108 | #define GET_USER(error,value,addr) error = get_user(value,addr) | 110 | #define GET_USER(error,value,addr) error = get_user(value,addr) |
@@ -320,7 +322,7 @@ struct mgsl_struct { | |||
320 | int dosyncppp; | 322 | int dosyncppp; |
321 | spinlock_t netlock; | 323 | spinlock_t netlock; |
322 | 324 | ||
323 | #ifdef CONFIG_HDLC | 325 | #if SYNCLINK_GENERIC_HDLC |
324 | struct net_device *netdev; | 326 | struct net_device *netdev; |
325 | #endif | 327 | #endif |
326 | }; | 328 | }; |
@@ -728,7 +730,7 @@ static void usc_loopmode_send_done( struct mgsl_struct * info ); | |||
728 | 730 | ||
729 | static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg); | 731 | static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg); |
730 | 732 | ||
731 | #ifdef CONFIG_HDLC | 733 | #if SYNCLINK_GENERIC_HDLC |
732 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) | 734 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) |
733 | static void hdlcdev_tx_done(struct mgsl_struct *info); | 735 | static void hdlcdev_tx_done(struct mgsl_struct *info); |
734 | static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size); | 736 | static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size); |
@@ -1277,7 +1279,7 @@ static void mgsl_isr_transmit_status( struct mgsl_struct *info ) | |||
1277 | info->drop_rts_on_tx_done = 0; | 1279 | info->drop_rts_on_tx_done = 0; |
1278 | } | 1280 | } |
1279 | 1281 | ||
1280 | #ifdef CONFIG_HDLC | 1282 | #if SYNCLINK_GENERIC_HDLC |
1281 | if (info->netcount) | 1283 | if (info->netcount) |
1282 | hdlcdev_tx_done(info); | 1284 | hdlcdev_tx_done(info); |
1283 | else | 1285 | else |
@@ -1342,7 +1344,7 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info ) | |||
1342 | info->input_signal_events.dcd_up++; | 1344 | info->input_signal_events.dcd_up++; |
1343 | } else | 1345 | } else |
1344 | info->input_signal_events.dcd_down++; | 1346 | info->input_signal_events.dcd_down++; |
1345 | #ifdef CONFIG_HDLC | 1347 | #if SYNCLINK_GENERIC_HDLC |
1346 | if (info->netcount) { | 1348 | if (info->netcount) { |
1347 | if (status & MISCSTATUS_DCD) | 1349 | if (status & MISCSTATUS_DCD) |
1348 | netif_carrier_on(info->netdev); | 1350 | netif_carrier_on(info->netdev); |
@@ -4313,7 +4315,7 @@ static void mgsl_add_device( struct mgsl_struct *info ) | |||
4313 | info->max_frame_size ); | 4315 | info->max_frame_size ); |
4314 | } | 4316 | } |
4315 | 4317 | ||
4316 | #ifdef CONFIG_HDLC | 4318 | #if SYNCLINK_GENERIC_HDLC |
4317 | hdlcdev_init(info); | 4319 | hdlcdev_init(info); |
4318 | #endif | 4320 | #endif |
4319 | 4321 | ||
@@ -4471,7 +4473,7 @@ static void synclink_cleanup(void) | |||
4471 | 4473 | ||
4472 | info = mgsl_device_list; | 4474 | info = mgsl_device_list; |
4473 | while(info) { | 4475 | while(info) { |
4474 | #ifdef CONFIG_HDLC | 4476 | #if SYNCLINK_GENERIC_HDLC |
4475 | hdlcdev_exit(info); | 4477 | hdlcdev_exit(info); |
4476 | #endif | 4478 | #endif |
4477 | mgsl_release_resources(info); | 4479 | mgsl_release_resources(info); |
@@ -6645,7 +6647,7 @@ static int mgsl_get_rx_frame(struct mgsl_struct *info) | |||
6645 | return_frame = 1; | 6647 | return_frame = 1; |
6646 | } | 6648 | } |
6647 | framesize = 0; | 6649 | framesize = 0; |
6648 | #ifdef CONFIG_HDLC | 6650 | #if SYNCLINK_GENERIC_HDLC |
6649 | { | 6651 | { |
6650 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 6652 | struct net_device_stats *stats = hdlc_stats(info->netdev); |
6651 | stats->rx_errors++; | 6653 | stats->rx_errors++; |
@@ -6721,7 +6723,7 @@ static int mgsl_get_rx_frame(struct mgsl_struct *info) | |||
6721 | *ptmp); | 6723 | *ptmp); |
6722 | } | 6724 | } |
6723 | 6725 | ||
6724 | #ifdef CONFIG_HDLC | 6726 | #if SYNCLINK_GENERIC_HDLC |
6725 | if (info->netcount) | 6727 | if (info->netcount) |
6726 | hdlcdev_rx(info,info->intermediate_rxbuffer,framesize); | 6728 | hdlcdev_rx(info,info->intermediate_rxbuffer,framesize); |
6727 | else | 6729 | else |
@@ -7625,7 +7627,7 @@ static void mgsl_tx_timeout(unsigned long context) | |||
7625 | 7627 | ||
7626 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | 7628 | spin_unlock_irqrestore(&info->irq_spinlock,flags); |
7627 | 7629 | ||
7628 | #ifdef CONFIG_HDLC | 7630 | #if SYNCLINK_GENERIC_HDLC |
7629 | if (info->netcount) | 7631 | if (info->netcount) |
7630 | hdlcdev_tx_done(info); | 7632 | hdlcdev_tx_done(info); |
7631 | else | 7633 | else |
@@ -7701,7 +7703,7 @@ static int usc_loopmode_active( struct mgsl_struct * info) | |||
7701 | return usc_InReg( info, CCSR ) & BIT7 ? 1 : 0 ; | 7703 | return usc_InReg( info, CCSR ) & BIT7 ? 1 : 0 ; |
7702 | } | 7704 | } |
7703 | 7705 | ||
7704 | #ifdef CONFIG_HDLC | 7706 | #if SYNCLINK_GENERIC_HDLC |
7705 | 7707 | ||
7706 | /** | 7708 | /** |
7707 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) | 7709 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 07f34d43dc7f..e4730a7312b5 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -83,8 +83,10 @@ | |||
83 | 83 | ||
84 | #include "linux/synclink.h" | 84 | #include "linux/synclink.h" |
85 | 85 | ||
86 | #ifdef CONFIG_HDLC_MODULE | 86 | #if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINK_GT_MODULE)) |
87 | #define CONFIG_HDLC 1 | 87 | #define SYNCLINK_GENERIC_HDLC 1 |
88 | #else | ||
89 | #define SYNCLINK_GENERIC_HDLC 0 | ||
88 | #endif | 90 | #endif |
89 | 91 | ||
90 | /* | 92 | /* |
@@ -171,7 +173,7 @@ static void set_break(struct tty_struct *tty, int break_state); | |||
171 | /* | 173 | /* |
172 | * generic HDLC support and callbacks | 174 | * generic HDLC support and callbacks |
173 | */ | 175 | */ |
174 | #ifdef CONFIG_HDLC | 176 | #if SYNCLINK_GENERIC_HDLC |
175 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) | 177 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) |
176 | static void hdlcdev_tx_done(struct slgt_info *info); | 178 | static void hdlcdev_tx_done(struct slgt_info *info); |
177 | static void hdlcdev_rx(struct slgt_info *info, char *buf, int size); | 179 | static void hdlcdev_rx(struct slgt_info *info, char *buf, int size); |
@@ -359,7 +361,7 @@ struct slgt_info { | |||
359 | int netcount; | 361 | int netcount; |
360 | int dosyncppp; | 362 | int dosyncppp; |
361 | spinlock_t netlock; | 363 | spinlock_t netlock; |
362 | #ifdef CONFIG_HDLC | 364 | #if SYNCLINK_GENERIC_HDLC |
363 | struct net_device *netdev; | 365 | struct net_device *netdev; |
364 | #endif | 366 | #endif |
365 | 367 | ||
@@ -1354,7 +1356,7 @@ static void set_break(struct tty_struct *tty, int break_state) | |||
1354 | spin_unlock_irqrestore(&info->lock,flags); | 1356 | spin_unlock_irqrestore(&info->lock,flags); |
1355 | } | 1357 | } |
1356 | 1358 | ||
1357 | #ifdef CONFIG_HDLC | 1359 | #if SYNCLINK_GENERIC_HDLC |
1358 | 1360 | ||
1359 | /** | 1361 | /** |
1360 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) | 1362 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) |
@@ -2002,7 +2004,7 @@ static void dcd_change(struct slgt_info *info) | |||
2002 | } else { | 2004 | } else { |
2003 | info->input_signal_events.dcd_down++; | 2005 | info->input_signal_events.dcd_down++; |
2004 | } | 2006 | } |
2005 | #ifdef CONFIG_HDLC | 2007 | #if SYNCLINK_GENERIC_HDLC |
2006 | if (info->netcount) { | 2008 | if (info->netcount) { |
2007 | if (info->signals & SerialSignal_DCD) | 2009 | if (info->signals & SerialSignal_DCD) |
2008 | netif_carrier_on(info->netdev); | 2010 | netif_carrier_on(info->netdev); |
@@ -2180,7 +2182,7 @@ static void isr_txeom(struct slgt_info *info, unsigned short status) | |||
2180 | set_signals(info); | 2182 | set_signals(info); |
2181 | } | 2183 | } |
2182 | 2184 | ||
2183 | #ifdef CONFIG_HDLC | 2185 | #if SYNCLINK_GENERIC_HDLC |
2184 | if (info->netcount) | 2186 | if (info->netcount) |
2185 | hdlcdev_tx_done(info); | 2187 | hdlcdev_tx_done(info); |
2186 | else | 2188 | else |
@@ -3306,7 +3308,7 @@ static void add_device(struct slgt_info *info) | |||
3306 | devstr, info->device_name, info->phys_reg_addr, | 3308 | devstr, info->device_name, info->phys_reg_addr, |
3307 | info->irq_level, info->max_frame_size); | 3309 | info->irq_level, info->max_frame_size); |
3308 | 3310 | ||
3309 | #ifdef CONFIG_HDLC | 3311 | #if SYNCLINK_GENERIC_HDLC |
3310 | hdlcdev_init(info); | 3312 | hdlcdev_init(info); |
3311 | #endif | 3313 | #endif |
3312 | } | 3314 | } |
@@ -3488,7 +3490,7 @@ static void slgt_cleanup(void) | |||
3488 | /* release devices */ | 3490 | /* release devices */ |
3489 | info = slgt_device_list; | 3491 | info = slgt_device_list; |
3490 | while(info) { | 3492 | while(info) { |
3491 | #ifdef CONFIG_HDLC | 3493 | #if SYNCLINK_GENERIC_HDLC |
3492 | hdlcdev_exit(info); | 3494 | hdlcdev_exit(info); |
3493 | #endif | 3495 | #endif |
3494 | free_dma_bufs(info); | 3496 | free_dma_bufs(info); |
@@ -3522,6 +3524,7 @@ static int __init slgt_init(void) | |||
3522 | 3524 | ||
3523 | if (!slgt_device_list) { | 3525 | if (!slgt_device_list) { |
3524 | printk("%s no devices found\n",driver_name); | 3526 | printk("%s no devices found\n",driver_name); |
3527 | pci_unregister_driver(&pci_driver); | ||
3525 | return -ENODEV; | 3528 | return -ENODEV; |
3526 | } | 3529 | } |
3527 | 3530 | ||
@@ -4433,7 +4436,7 @@ check_again: | |||
4433 | framesize = 0; | 4436 | framesize = 0; |
4434 | } | 4437 | } |
4435 | 4438 | ||
4436 | #ifdef CONFIG_HDLC | 4439 | #if SYNCLINK_GENERIC_HDLC |
4437 | if (framesize == 0) { | 4440 | if (framesize == 0) { |
4438 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 4441 | struct net_device_stats *stats = hdlc_stats(info->netdev); |
4439 | stats->rx_errors++; | 4442 | stats->rx_errors++; |
@@ -4476,7 +4479,7 @@ check_again: | |||
4476 | framesize++; | 4479 | framesize++; |
4477 | } | 4480 | } |
4478 | 4481 | ||
4479 | #ifdef CONFIG_HDLC | 4482 | #if SYNCLINK_GENERIC_HDLC |
4480 | if (info->netcount) | 4483 | if (info->netcount) |
4481 | hdlcdev_rx(info,info->tmp_rbuf, framesize); | 4484 | hdlcdev_rx(info,info->tmp_rbuf, framesize); |
4482 | else | 4485 | else |
@@ -4779,7 +4782,7 @@ static void tx_timeout(unsigned long context) | |||
4779 | info->tx_count = 0; | 4782 | info->tx_count = 0; |
4780 | spin_unlock_irqrestore(&info->lock,flags); | 4783 | spin_unlock_irqrestore(&info->lock,flags); |
4781 | 4784 | ||
4782 | #ifdef CONFIG_HDLC | 4785 | #if SYNCLINK_GENERIC_HDLC |
4783 | if (info->netcount) | 4786 | if (info->netcount) |
4784 | hdlcdev_tx_done(info); | 4787 | hdlcdev_tx_done(info); |
4785 | else | 4788 | else |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 13a57245cf2e..20a96ef250be 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -67,8 +67,10 @@ | |||
67 | #include <linux/workqueue.h> | 67 | #include <linux/workqueue.h> |
68 | #include <linux/hdlc.h> | 68 | #include <linux/hdlc.h> |
69 | 69 | ||
70 | #ifdef CONFIG_HDLC_MODULE | 70 | #if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINKMP_MODULE)) |
71 | #define CONFIG_HDLC 1 | 71 | #define SYNCLINK_GENERIC_HDLC 1 |
72 | #else | ||
73 | #define SYNCLINK_GENERIC_HDLC 0 | ||
72 | #endif | 74 | #endif |
73 | 75 | ||
74 | #define GET_USER(error,value,addr) error = get_user(value,addr) | 76 | #define GET_USER(error,value,addr) error = get_user(value,addr) |
@@ -280,7 +282,7 @@ typedef struct _synclinkmp_info { | |||
280 | int dosyncppp; | 282 | int dosyncppp; |
281 | spinlock_t netlock; | 283 | spinlock_t netlock; |
282 | 284 | ||
283 | #ifdef CONFIG_HDLC | 285 | #if SYNCLINK_GENERIC_HDLC |
284 | struct net_device *netdev; | 286 | struct net_device *netdev; |
285 | #endif | 287 | #endif |
286 | 288 | ||
@@ -536,7 +538,7 @@ static void throttle(struct tty_struct * tty); | |||
536 | static void unthrottle(struct tty_struct * tty); | 538 | static void unthrottle(struct tty_struct * tty); |
537 | static void set_break(struct tty_struct *tty, int break_state); | 539 | static void set_break(struct tty_struct *tty, int break_state); |
538 | 540 | ||
539 | #ifdef CONFIG_HDLC | 541 | #if SYNCLINK_GENERIC_HDLC |
540 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) | 542 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) |
541 | static void hdlcdev_tx_done(SLMP_INFO *info); | 543 | static void hdlcdev_tx_done(SLMP_INFO *info); |
542 | static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size); | 544 | static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size); |
@@ -1607,7 +1609,7 @@ static void set_break(struct tty_struct *tty, int break_state) | |||
1607 | spin_unlock_irqrestore(&info->lock,flags); | 1609 | spin_unlock_irqrestore(&info->lock,flags); |
1608 | } | 1610 | } |
1609 | 1611 | ||
1610 | #ifdef CONFIG_HDLC | 1612 | #if SYNCLINK_GENERIC_HDLC |
1611 | 1613 | ||
1612 | /** | 1614 | /** |
1613 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) | 1615 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) |
@@ -2339,7 +2341,7 @@ static void isr_txeom(SLMP_INFO * info, unsigned char status) | |||
2339 | set_signals(info); | 2341 | set_signals(info); |
2340 | } | 2342 | } |
2341 | 2343 | ||
2342 | #ifdef CONFIG_HDLC | 2344 | #if SYNCLINK_GENERIC_HDLC |
2343 | if (info->netcount) | 2345 | if (info->netcount) |
2344 | hdlcdev_tx_done(info); | 2346 | hdlcdev_tx_done(info); |
2345 | else | 2347 | else |
@@ -2523,7 +2525,7 @@ void isr_io_pin( SLMP_INFO *info, u16 status ) | |||
2523 | info->input_signal_events.dcd_up++; | 2525 | info->input_signal_events.dcd_up++; |
2524 | } else | 2526 | } else |
2525 | info->input_signal_events.dcd_down++; | 2527 | info->input_signal_events.dcd_down++; |
2526 | #ifdef CONFIG_HDLC | 2528 | #if SYNCLINK_GENERIC_HDLC |
2527 | if (info->netcount) { | 2529 | if (info->netcount) { |
2528 | if (status & SerialSignal_DCD) | 2530 | if (status & SerialSignal_DCD) |
2529 | netif_carrier_on(info->netdev); | 2531 | netif_carrier_on(info->netdev); |
@@ -3783,7 +3785,7 @@ void add_device(SLMP_INFO *info) | |||
3783 | info->irq_level, | 3785 | info->irq_level, |
3784 | info->max_frame_size ); | 3786 | info->max_frame_size ); |
3785 | 3787 | ||
3786 | #ifdef CONFIG_HDLC | 3788 | #if SYNCLINK_GENERIC_HDLC |
3787 | hdlcdev_init(info); | 3789 | hdlcdev_init(info); |
3788 | #endif | 3790 | #endif |
3789 | } | 3791 | } |
@@ -3977,7 +3979,7 @@ static void synclinkmp_cleanup(void) | |||
3977 | /* release devices */ | 3979 | /* release devices */ |
3978 | info = synclinkmp_device_list; | 3980 | info = synclinkmp_device_list; |
3979 | while(info) { | 3981 | while(info) { |
3980 | #ifdef CONFIG_HDLC | 3982 | #if SYNCLINK_GENERIC_HDLC |
3981 | hdlcdev_exit(info); | 3983 | hdlcdev_exit(info); |
3982 | #endif | 3984 | #endif |
3983 | free_dma_bufs(info); | 3985 | free_dma_bufs(info); |
@@ -4979,7 +4981,7 @@ CheckAgain: | |||
4979 | info->icount.rxcrc++; | 4981 | info->icount.rxcrc++; |
4980 | 4982 | ||
4981 | framesize = 0; | 4983 | framesize = 0; |
4982 | #ifdef CONFIG_HDLC | 4984 | #if SYNCLINK_GENERIC_HDLC |
4983 | { | 4985 | { |
4984 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 4986 | struct net_device_stats *stats = hdlc_stats(info->netdev); |
4985 | stats->rx_errors++; | 4987 | stats->rx_errors++; |
@@ -5020,7 +5022,7 @@ CheckAgain: | |||
5020 | index = 0; | 5022 | index = 0; |
5021 | } | 5023 | } |
5022 | 5024 | ||
5023 | #ifdef CONFIG_HDLC | 5025 | #if SYNCLINK_GENERIC_HDLC |
5024 | if (info->netcount) | 5026 | if (info->netcount) |
5025 | hdlcdev_rx(info,info->tmp_rx_buf,framesize); | 5027 | hdlcdev_rx(info,info->tmp_rx_buf,framesize); |
5026 | else | 5028 | else |
@@ -5531,7 +5533,7 @@ void tx_timeout(unsigned long context) | |||
5531 | 5533 | ||
5532 | spin_unlock_irqrestore(&info->lock,flags); | 5534 | spin_unlock_irqrestore(&info->lock,flags); |
5533 | 5535 | ||
5534 | #ifdef CONFIG_HDLC | 5536 | #if SYNCLINK_GENERIC_HDLC |
5535 | if (info->netcount) | 5537 | if (info->netcount) |
5536 | hdlcdev_tx_done(info); | 5538 | hdlcdev_tx_done(info); |
5537 | else | 5539 | else |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index c64f5bcff947..05810c8d20bc 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -182,6 +182,18 @@ static struct sysrq_key_op sysrq_showstate_op = { | |||
182 | .enable_mask = SYSRQ_ENABLE_DUMP, | 182 | .enable_mask = SYSRQ_ENABLE_DUMP, |
183 | }; | 183 | }; |
184 | 184 | ||
185 | static void sysrq_handle_showstate_blocked(int key, struct tty_struct *tty) | ||
186 | { | ||
187 | show_state_filter(TASK_UNINTERRUPTIBLE); | ||
188 | } | ||
189 | static struct sysrq_key_op sysrq_showstate_blocked_op = { | ||
190 | .handler = sysrq_handle_showstate_blocked, | ||
191 | .help_msg = "showBlockedTasks", | ||
192 | .action_msg = "Show Blocked State", | ||
193 | .enable_mask = SYSRQ_ENABLE_DUMP, | ||
194 | }; | ||
195 | |||
196 | |||
185 | static void sysrq_handle_showmem(int key, struct tty_struct *tty) | 197 | static void sysrq_handle_showmem(int key, struct tty_struct *tty) |
186 | { | 198 | { |
187 | show_mem(); | 199 | show_mem(); |
@@ -304,7 +316,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = { | |||
304 | /* May be assigned at init time by SMP VOYAGER */ | 316 | /* May be assigned at init time by SMP VOYAGER */ |
305 | NULL, /* v */ | 317 | NULL, /* v */ |
306 | NULL, /* w */ | 318 | NULL, /* w */ |
307 | NULL, /* x */ | 319 | &sysrq_showstate_blocked_op, /* x */ |
308 | NULL, /* y */ | 320 | NULL, /* y */ |
309 | NULL /* z */ | 321 | NULL /* z */ |
310 | }; | 322 | }; |
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c index dd36fd04a842..07067c31c4ec 100644 --- a/drivers/char/toshiba.c +++ b/drivers/char/toshiba.c | |||
@@ -249,6 +249,7 @@ int tosh_smm(SMMRegisters *regs) | |||
249 | 249 | ||
250 | return eax; | 250 | return eax; |
251 | } | 251 | } |
252 | EXPORT_SYMBOL(tosh_smm); | ||
252 | 253 | ||
253 | 254 | ||
254 | static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, | 255 | static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 774fa861169a..33e1f66e39cb 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -1155,6 +1155,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend | |||
1155 | 1155 | ||
1156 | if (sysfs_create_group(&dev->kobj, chip->vendor.attr_group)) { | 1156 | if (sysfs_create_group(&dev->kobj, chip->vendor.attr_group)) { |
1157 | list_del(&chip->list); | 1157 | list_del(&chip->list); |
1158 | misc_deregister(&chip->vendor.miscdev); | ||
1158 | put_device(dev); | 1159 | put_device(dev); |
1159 | clear_bit(chip->dev_num, dev_mask); | 1160 | clear_bit(chip->dev_num, dev_mask); |
1160 | kfree(chip); | 1161 | kfree(chip); |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 75ff0286e1ad..a8239dac994f 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -152,7 +152,7 @@ static void gotoxy(struct vc_data *vc, int new_x, int new_y); | |||
152 | static void save_cur(struct vc_data *vc); | 152 | static void save_cur(struct vc_data *vc); |
153 | static void reset_terminal(struct vc_data *vc, int do_clear); | 153 | static void reset_terminal(struct vc_data *vc, int do_clear); |
154 | static void con_flush_chars(struct tty_struct *tty); | 154 | static void con_flush_chars(struct tty_struct *tty); |
155 | static void set_vesa_blanking(char __user *p); | 155 | static int set_vesa_blanking(char __user *p); |
156 | static void set_cursor(struct vc_data *vc); | 156 | static void set_cursor(struct vc_data *vc); |
157 | static void hide_cursor(struct vc_data *vc); | 157 | static void hide_cursor(struct vc_data *vc); |
158 | static void console_callback(struct work_struct *ignored); | 158 | static void console_callback(struct work_struct *ignored); |
@@ -2369,7 +2369,7 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) | |||
2369 | ret = __put_user(data, p); | 2369 | ret = __put_user(data, p); |
2370 | break; | 2370 | break; |
2371 | case TIOCL_SETVESABLANK: | 2371 | case TIOCL_SETVESABLANK: |
2372 | set_vesa_blanking(p); | 2372 | ret = set_vesa_blanking(p); |
2373 | break; | 2373 | break; |
2374 | case TIOCL_GETKMSGREDIRECT: | 2374 | case TIOCL_GETKMSGREDIRECT: |
2375 | data = kmsg_redirect; | 2375 | data = kmsg_redirect; |
@@ -3313,11 +3313,15 @@ postcore_initcall(vtconsole_class_init); | |||
3313 | * Screen blanking | 3313 | * Screen blanking |
3314 | */ | 3314 | */ |
3315 | 3315 | ||
3316 | static void set_vesa_blanking(char __user *p) | 3316 | static int set_vesa_blanking(char __user *p) |
3317 | { | 3317 | { |
3318 | unsigned int mode; | 3318 | unsigned int mode; |
3319 | get_user(mode, p + 1); | 3319 | |
3320 | vesa_blank_mode = (mode < 4) ? mode : 0; | 3320 | if (get_user(mode, p + 1)) |
3321 | return -EFAULT; | ||
3322 | |||
3323 | vesa_blank_mode = (mode < 4) ? mode : 0; | ||
3324 | return 0; | ||
3321 | } | 3325 | } |
3322 | 3326 | ||
3323 | void do_blank_screen(int entering_gfx) | 3327 | void do_blank_screen(int entering_gfx) |
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index e275dd4a705d..61138726b501 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c | |||
@@ -634,7 +634,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi | |||
634 | usb_pcwd->intr_size = (le16_to_cpu(endpoint->wMaxPacketSize) > 8 ? le16_to_cpu(endpoint->wMaxPacketSize) : 8); | 634 | usb_pcwd->intr_size = (le16_to_cpu(endpoint->wMaxPacketSize) > 8 ? le16_to_cpu(endpoint->wMaxPacketSize) : 8); |
635 | 635 | ||
636 | /* set up the memory buffer's */ | 636 | /* set up the memory buffer's */ |
637 | if (!(usb_pcwd->intr_buffer = usb_buffer_alloc(udev, usb_pcwd->intr_size, SLAB_ATOMIC, &usb_pcwd->intr_dma))) { | 637 | if (!(usb_pcwd->intr_buffer = usb_buffer_alloc(udev, usb_pcwd->intr_size, GFP_ATOMIC, &usb_pcwd->intr_dma))) { |
638 | printk(KERN_ERR PFX "Out of memory\n"); | 638 | printk(KERN_ERR PFX "Out of memory\n"); |
639 | goto error; | 639 | goto error; |
640 | } | 640 | } |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 7a7c6e6dfe4f..47ab42db122a 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1537,7 +1537,6 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1537 | } | 1537 | } |
1538 | EXPORT_SYMBOL(cpufreq_update_policy); | 1538 | EXPORT_SYMBOL(cpufreq_update_policy); |
1539 | 1539 | ||
1540 | #ifdef CONFIG_HOTPLUG_CPU | ||
1541 | static int cpufreq_cpu_callback(struct notifier_block *nfb, | 1540 | static int cpufreq_cpu_callback(struct notifier_block *nfb, |
1542 | unsigned long action, void *hcpu) | 1541 | unsigned long action, void *hcpu) |
1543 | { | 1542 | { |
@@ -1577,7 +1576,6 @@ static struct notifier_block __cpuinitdata cpufreq_cpu_notifier = | |||
1577 | { | 1576 | { |
1578 | .notifier_call = cpufreq_cpu_callback, | 1577 | .notifier_call = cpufreq_cpu_callback, |
1579 | }; | 1578 | }; |
1580 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
1581 | 1579 | ||
1582 | /********************************************************************* | 1580 | /********************************************************************* |
1583 | * REGISTER / UNREGISTER CPUFREQ DRIVER * | 1581 | * REGISTER / UNREGISTER CPUFREQ DRIVER * |
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index adb554153f67..e816535ab305 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig | |||
@@ -51,4 +51,17 @@ config CRYPTO_DEV_PADLOCK_SHA | |||
51 | If unsure say M. The compiled module will be | 51 | If unsure say M. The compiled module will be |
52 | called padlock-sha.ko | 52 | called padlock-sha.ko |
53 | 53 | ||
54 | config CRYPTO_DEV_GEODE | ||
55 | tristate "Support for the Geode LX AES engine" | ||
56 | depends on CRYPTO && X86_32 | ||
57 | select CRYPTO_ALGAPI | ||
58 | select CRYPTO_BLKCIPHER | ||
59 | default m | ||
60 | help | ||
61 | Say 'Y' here to use the AMD Geode LX processor on-board AES | ||
62 | engine for the CryptoAPI AES alogrithm. | ||
63 | |||
64 | To compile this driver as a module, choose M here: the module | ||
65 | will be called geode-aes. | ||
66 | |||
54 | endmenu | 67 | endmenu |
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile index 4c3d0ec1cf80..6059cf869414 100644 --- a/drivers/crypto/Makefile +++ b/drivers/crypto/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK) += padlock.o | 1 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK) += padlock.o |
2 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o | 2 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o |
3 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o | 3 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o |
4 | obj-$(CONFIG_CRYPTO_DEV_GEODE) += geode-aes.o | ||
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c new file mode 100644 index 000000000000..43a68398656f --- /dev/null +++ b/drivers/crypto/geode-aes.c | |||
@@ -0,0 +1,474 @@ | |||
1 | /* Copyright (C) 2004-2006, Advanced Micro Devices, Inc. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation; either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/sched.h> | ||
12 | #include <linux/pci.h> | ||
13 | #include <linux/pci_ids.h> | ||
14 | #include <linux/crypto.h> | ||
15 | #include <linux/spinlock.h> | ||
16 | #include <crypto/algapi.h> | ||
17 | |||
18 | #include <asm/io.h> | ||
19 | #include <asm/delay.h> | ||
20 | |||
21 | #include "geode-aes.h" | ||
22 | |||
23 | /* Register definitions */ | ||
24 | |||
25 | #define AES_CTRLA_REG 0x0000 | ||
26 | |||
27 | #define AES_CTRL_START 0x01 | ||
28 | #define AES_CTRL_DECRYPT 0x00 | ||
29 | #define AES_CTRL_ENCRYPT 0x02 | ||
30 | #define AES_CTRL_WRKEY 0x04 | ||
31 | #define AES_CTRL_DCA 0x08 | ||
32 | #define AES_CTRL_SCA 0x10 | ||
33 | #define AES_CTRL_CBC 0x20 | ||
34 | |||
35 | #define AES_INTR_REG 0x0008 | ||
36 | |||
37 | #define AES_INTRA_PENDING (1 << 16) | ||
38 | #define AES_INTRB_PENDING (1 << 17) | ||
39 | |||
40 | #define AES_INTR_PENDING (AES_INTRA_PENDING | AES_INTRB_PENDING) | ||
41 | #define AES_INTR_MASK 0x07 | ||
42 | |||
43 | #define AES_SOURCEA_REG 0x0010 | ||
44 | #define AES_DSTA_REG 0x0014 | ||
45 | #define AES_LENA_REG 0x0018 | ||
46 | #define AES_WRITEKEY0_REG 0x0030 | ||
47 | #define AES_WRITEIV0_REG 0x0040 | ||
48 | |||
49 | /* A very large counter that is used to gracefully bail out of an | ||
50 | * operation in case of trouble | ||
51 | */ | ||
52 | |||
53 | #define AES_OP_TIMEOUT 0x50000 | ||
54 | |||
55 | /* Static structures */ | ||
56 | |||
57 | static void __iomem * _iobase; | ||
58 | static spinlock_t lock; | ||
59 | |||
60 | /* Write a 128 bit field (either a writable key or IV) */ | ||
61 | static inline void | ||
62 | _writefield(u32 offset, void *value) | ||
63 | { | ||
64 | int i; | ||
65 | for(i = 0; i < 4; i++) | ||
66 | iowrite32(((u32 *) value)[i], _iobase + offset + (i * 4)); | ||
67 | } | ||
68 | |||
69 | /* Read a 128 bit field (either a writable key or IV) */ | ||
70 | static inline void | ||
71 | _readfield(u32 offset, void *value) | ||
72 | { | ||
73 | int i; | ||
74 | for(i = 0; i < 4; i++) | ||
75 | ((u32 *) value)[i] = ioread32(_iobase + offset + (i * 4)); | ||
76 | } | ||
77 | |||
78 | static int | ||
79 | do_crypt(void *src, void *dst, int len, u32 flags) | ||
80 | { | ||
81 | u32 status; | ||
82 | u32 counter = AES_OP_TIMEOUT; | ||
83 | |||
84 | iowrite32(virt_to_phys(src), _iobase + AES_SOURCEA_REG); | ||
85 | iowrite32(virt_to_phys(dst), _iobase + AES_DSTA_REG); | ||
86 | iowrite32(len, _iobase + AES_LENA_REG); | ||
87 | |||
88 | /* Start the operation */ | ||
89 | iowrite32(AES_CTRL_START | flags, _iobase + AES_CTRLA_REG); | ||
90 | |||
91 | do | ||
92 | status = ioread32(_iobase + AES_INTR_REG); | ||
93 | while(!(status & AES_INTRA_PENDING) && --counter); | ||
94 | |||
95 | /* Clear the event */ | ||
96 | iowrite32((status & 0xFF) | AES_INTRA_PENDING, _iobase + AES_INTR_REG); | ||
97 | return counter ? 0 : 1; | ||
98 | } | ||
99 | |||
100 | static unsigned int | ||
101 | geode_aes_crypt(struct geode_aes_op *op) | ||
102 | { | ||
103 | |||
104 | u32 flags = 0; | ||
105 | int iflags; | ||
106 | |||
107 | if (op->len == 0 || op->src == op->dst) | ||
108 | return 0; | ||
109 | |||
110 | if (op->flags & AES_FLAGS_COHERENT) | ||
111 | flags |= (AES_CTRL_DCA | AES_CTRL_SCA); | ||
112 | |||
113 | if (op->dir == AES_DIR_ENCRYPT) | ||
114 | flags |= AES_CTRL_ENCRYPT; | ||
115 | |||
116 | /* Start the critical section */ | ||
117 | |||
118 | spin_lock_irqsave(&lock, iflags); | ||
119 | |||
120 | if (op->mode == AES_MODE_CBC) { | ||
121 | flags |= AES_CTRL_CBC; | ||
122 | _writefield(AES_WRITEIV0_REG, op->iv); | ||
123 | } | ||
124 | |||
125 | if (op->flags & AES_FLAGS_USRKEY) { | ||
126 | flags |= AES_CTRL_WRKEY; | ||
127 | _writefield(AES_WRITEKEY0_REG, op->key); | ||
128 | } | ||
129 | |||
130 | do_crypt(op->src, op->dst, op->len, flags); | ||
131 | |||
132 | if (op->mode == AES_MODE_CBC) | ||
133 | _readfield(AES_WRITEIV0_REG, op->iv); | ||
134 | |||
135 | spin_unlock_irqrestore(&lock, iflags); | ||
136 | |||
137 | return op->len; | ||
138 | } | ||
139 | |||
140 | /* CRYPTO-API Functions */ | ||
141 | |||
142 | static int | ||
143 | geode_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int len) | ||
144 | { | ||
145 | struct geode_aes_op *op = crypto_tfm_ctx(tfm); | ||
146 | |||
147 | if (len != AES_KEY_LENGTH) { | ||
148 | tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; | ||
149 | return -EINVAL; | ||
150 | } | ||
151 | |||
152 | memcpy(op->key, key, len); | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | static void | ||
157 | geode_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | ||
158 | { | ||
159 | struct geode_aes_op *op = crypto_tfm_ctx(tfm); | ||
160 | |||
161 | if ((out == NULL) || (in == NULL)) | ||
162 | return; | ||
163 | |||
164 | op->src = (void *) in; | ||
165 | op->dst = (void *) out; | ||
166 | op->mode = AES_MODE_ECB; | ||
167 | op->flags = 0; | ||
168 | op->len = AES_MIN_BLOCK_SIZE; | ||
169 | op->dir = AES_DIR_ENCRYPT; | ||
170 | |||
171 | geode_aes_crypt(op); | ||
172 | } | ||
173 | |||
174 | |||
175 | static void | ||
176 | geode_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | ||
177 | { | ||
178 | struct geode_aes_op *op = crypto_tfm_ctx(tfm); | ||
179 | |||
180 | if ((out == NULL) || (in == NULL)) | ||
181 | return; | ||
182 | |||
183 | op->src = (void *) in; | ||
184 | op->dst = (void *) out; | ||
185 | op->mode = AES_MODE_ECB; | ||
186 | op->flags = 0; | ||
187 | op->len = AES_MIN_BLOCK_SIZE; | ||
188 | op->dir = AES_DIR_DECRYPT; | ||
189 | |||
190 | geode_aes_crypt(op); | ||
191 | } | ||
192 | |||
193 | |||
194 | static struct crypto_alg geode_alg = { | ||
195 | .cra_name = "aes", | ||
196 | .cra_driver_name = "geode-aes-128", | ||
197 | .cra_priority = 300, | ||
198 | .cra_alignmask = 15, | ||
199 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
200 | .cra_blocksize = AES_MIN_BLOCK_SIZE, | ||
201 | .cra_ctxsize = sizeof(struct geode_aes_op), | ||
202 | .cra_module = THIS_MODULE, | ||
203 | .cra_list = LIST_HEAD_INIT(geode_alg.cra_list), | ||
204 | .cra_u = { | ||
205 | .cipher = { | ||
206 | .cia_min_keysize = AES_KEY_LENGTH, | ||
207 | .cia_max_keysize = AES_KEY_LENGTH, | ||
208 | .cia_setkey = geode_setkey, | ||
209 | .cia_encrypt = geode_encrypt, | ||
210 | .cia_decrypt = geode_decrypt | ||
211 | } | ||
212 | } | ||
213 | }; | ||
214 | |||
215 | static int | ||
216 | geode_cbc_decrypt(struct blkcipher_desc *desc, | ||
217 | struct scatterlist *dst, struct scatterlist *src, | ||
218 | unsigned int nbytes) | ||
219 | { | ||
220 | struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); | ||
221 | struct blkcipher_walk walk; | ||
222 | int err, ret; | ||
223 | |||
224 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
225 | err = blkcipher_walk_virt(desc, &walk); | ||
226 | |||
227 | while((nbytes = walk.nbytes)) { | ||
228 | op->src = walk.src.virt.addr, | ||
229 | op->dst = walk.dst.virt.addr; | ||
230 | op->mode = AES_MODE_CBC; | ||
231 | op->len = nbytes - (nbytes % AES_MIN_BLOCK_SIZE); | ||
232 | op->dir = AES_DIR_DECRYPT; | ||
233 | |||
234 | memcpy(op->iv, walk.iv, AES_IV_LENGTH); | ||
235 | |||
236 | ret = geode_aes_crypt(op); | ||
237 | |||
238 | memcpy(walk.iv, op->iv, AES_IV_LENGTH); | ||
239 | nbytes -= ret; | ||
240 | |||
241 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
242 | } | ||
243 | |||
244 | return err; | ||
245 | } | ||
246 | |||
247 | static int | ||
248 | geode_cbc_encrypt(struct blkcipher_desc *desc, | ||
249 | struct scatterlist *dst, struct scatterlist *src, | ||
250 | unsigned int nbytes) | ||
251 | { | ||
252 | struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); | ||
253 | struct blkcipher_walk walk; | ||
254 | int err, ret; | ||
255 | |||
256 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
257 | err = blkcipher_walk_virt(desc, &walk); | ||
258 | |||
259 | while((nbytes = walk.nbytes)) { | ||
260 | op->src = walk.src.virt.addr, | ||
261 | op->dst = walk.dst.virt.addr; | ||
262 | op->mode = AES_MODE_CBC; | ||
263 | op->len = nbytes - (nbytes % AES_MIN_BLOCK_SIZE); | ||
264 | op->dir = AES_DIR_ENCRYPT; | ||
265 | |||
266 | memcpy(op->iv, walk.iv, AES_IV_LENGTH); | ||
267 | |||
268 | ret = geode_aes_crypt(op); | ||
269 | nbytes -= ret; | ||
270 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
271 | } | ||
272 | |||
273 | return err; | ||
274 | } | ||
275 | |||
276 | static struct crypto_alg geode_cbc_alg = { | ||
277 | .cra_name = "cbc(aes)", | ||
278 | .cra_driver_name = "cbc-aes-geode-128", | ||
279 | .cra_priority = 400, | ||
280 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
281 | .cra_blocksize = AES_MIN_BLOCK_SIZE, | ||
282 | .cra_ctxsize = sizeof(struct geode_aes_op), | ||
283 | .cra_alignmask = 15, | ||
284 | .cra_type = &crypto_blkcipher_type, | ||
285 | .cra_module = THIS_MODULE, | ||
286 | .cra_list = LIST_HEAD_INIT(geode_cbc_alg.cra_list), | ||
287 | .cra_u = { | ||
288 | .blkcipher = { | ||
289 | .min_keysize = AES_KEY_LENGTH, | ||
290 | .max_keysize = AES_KEY_LENGTH, | ||
291 | .setkey = geode_setkey, | ||
292 | .encrypt = geode_cbc_encrypt, | ||
293 | .decrypt = geode_cbc_decrypt, | ||
294 | } | ||
295 | } | ||
296 | }; | ||
297 | |||
298 | static int | ||
299 | geode_ecb_decrypt(struct blkcipher_desc *desc, | ||
300 | struct scatterlist *dst, struct scatterlist *src, | ||
301 | unsigned int nbytes) | ||
302 | { | ||
303 | struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); | ||
304 | struct blkcipher_walk walk; | ||
305 | int err, ret; | ||
306 | |||
307 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
308 | err = blkcipher_walk_virt(desc, &walk); | ||
309 | |||
310 | while((nbytes = walk.nbytes)) { | ||
311 | op->src = walk.src.virt.addr, | ||
312 | op->dst = walk.dst.virt.addr; | ||
313 | op->mode = AES_MODE_ECB; | ||
314 | op->len = nbytes - (nbytes % AES_MIN_BLOCK_SIZE); | ||
315 | op->dir = AES_DIR_DECRYPT; | ||
316 | |||
317 | ret = geode_aes_crypt(op); | ||
318 | nbytes -= ret; | ||
319 | err = blkcipher_walk_done(desc, &walk, nbytes); | ||
320 | } | ||
321 | |||
322 | return err; | ||
323 | } | ||
324 | |||
325 | static int | ||
326 | geode_ecb_encrypt(struct blkcipher_desc *desc, | ||
327 | struct scatterlist *dst, struct scatterlist *src, | ||
328 | unsigned int nbytes) | ||
329 | { | ||
330 | struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); | ||
331 | struct blkcipher_walk walk; | ||
332 | int err, ret; | ||
333 | |||
334 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
335 | err = blkcipher_walk_virt(desc, &walk); | ||
336 | |||
337 | while((nbytes = walk.nbytes)) { | ||
338 | op->src = walk.src.virt.addr, | ||
339 | op->dst = walk.dst.virt.addr; | ||
340 | op->mode = AES_MODE_ECB; | ||
341 | op->len = nbytes - (nbytes % AES_MIN_BLOCK_SIZE); | ||
342 | op->dir = AES_DIR_ENCRYPT; | ||
343 | |||
344 | ret = geode_aes_crypt(op); | ||
345 | nbytes -= ret; | ||
346 | ret = blkcipher_walk_done(desc, &walk, nbytes); | ||
347 | } | ||
348 | |||
349 | return err; | ||
350 | } | ||
351 | |||
352 | static struct crypto_alg geode_ecb_alg = { | ||
353 | .cra_name = "ecb(aes)", | ||
354 | .cra_driver_name = "ecb-aes-geode-128", | ||
355 | .cra_priority = 400, | ||
356 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
357 | .cra_blocksize = AES_MIN_BLOCK_SIZE, | ||
358 | .cra_ctxsize = sizeof(struct geode_aes_op), | ||
359 | .cra_alignmask = 15, | ||
360 | .cra_type = &crypto_blkcipher_type, | ||
361 | .cra_module = THIS_MODULE, | ||
362 | .cra_list = LIST_HEAD_INIT(geode_ecb_alg.cra_list), | ||
363 | .cra_u = { | ||
364 | .blkcipher = { | ||
365 | .min_keysize = AES_KEY_LENGTH, | ||
366 | .max_keysize = AES_KEY_LENGTH, | ||
367 | .setkey = geode_setkey, | ||
368 | .encrypt = geode_ecb_encrypt, | ||
369 | .decrypt = geode_ecb_decrypt, | ||
370 | } | ||
371 | } | ||
372 | }; | ||
373 | |||
374 | static void | ||
375 | geode_aes_remove(struct pci_dev *dev) | ||
376 | { | ||
377 | crypto_unregister_alg(&geode_alg); | ||
378 | crypto_unregister_alg(&geode_ecb_alg); | ||
379 | crypto_unregister_alg(&geode_cbc_alg); | ||
380 | |||
381 | pci_iounmap(dev, _iobase); | ||
382 | _iobase = NULL; | ||
383 | |||
384 | pci_release_regions(dev); | ||
385 | pci_disable_device(dev); | ||
386 | } | ||
387 | |||
388 | |||
389 | static int | ||
390 | geode_aes_probe(struct pci_dev *dev, const struct pci_device_id *id) | ||
391 | { | ||
392 | int ret; | ||
393 | |||
394 | if ((ret = pci_enable_device(dev))) | ||
395 | return ret; | ||
396 | |||
397 | if ((ret = pci_request_regions(dev, "geode-aes-128"))) | ||
398 | goto eenable; | ||
399 | |||
400 | _iobase = pci_iomap(dev, 0, 0); | ||
401 | |||
402 | if (_iobase == NULL) { | ||
403 | ret = -ENOMEM; | ||
404 | goto erequest; | ||
405 | } | ||
406 | |||
407 | spin_lock_init(&lock); | ||
408 | |||
409 | /* Clear any pending activity */ | ||
410 | iowrite32(AES_INTR_PENDING | AES_INTR_MASK, _iobase + AES_INTR_REG); | ||
411 | |||
412 | if ((ret = crypto_register_alg(&geode_alg))) | ||
413 | goto eiomap; | ||
414 | |||
415 | if ((ret = crypto_register_alg(&geode_ecb_alg))) | ||
416 | goto ealg; | ||
417 | |||
418 | if ((ret = crypto_register_alg(&geode_cbc_alg))) | ||
419 | goto eecb; | ||
420 | |||
421 | printk(KERN_NOTICE "geode-aes: GEODE AES engine enabled.\n"); | ||
422 | return 0; | ||
423 | |||
424 | eecb: | ||
425 | crypto_unregister_alg(&geode_ecb_alg); | ||
426 | |||
427 | ealg: | ||
428 | crypto_unregister_alg(&geode_alg); | ||
429 | |||
430 | eiomap: | ||
431 | pci_iounmap(dev, _iobase); | ||
432 | |||
433 | erequest: | ||
434 | pci_release_regions(dev); | ||
435 | |||
436 | eenable: | ||
437 | pci_disable_device(dev); | ||
438 | |||
439 | printk(KERN_ERR "geode-aes: GEODE AES initialization failed.\n"); | ||
440 | return ret; | ||
441 | } | ||
442 | |||
443 | static struct pci_device_id geode_aes_tbl[] = { | ||
444 | { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LX_AES, PCI_ANY_ID, PCI_ANY_ID} , | ||
445 | { 0, } | ||
446 | }; | ||
447 | |||
448 | MODULE_DEVICE_TABLE(pci, geode_aes_tbl); | ||
449 | |||
450 | static struct pci_driver geode_aes_driver = { | ||
451 | .name = "Geode LX AES", | ||
452 | .id_table = geode_aes_tbl, | ||
453 | .probe = geode_aes_probe, | ||
454 | .remove = __devexit_p(geode_aes_remove) | ||
455 | }; | ||
456 | |||
457 | static int __init | ||
458 | geode_aes_init(void) | ||
459 | { | ||
460 | return pci_module_init(&geode_aes_driver); | ||
461 | } | ||
462 | |||
463 | static void __exit | ||
464 | geode_aes_exit(void) | ||
465 | { | ||
466 | pci_unregister_driver(&geode_aes_driver); | ||
467 | } | ||
468 | |||
469 | MODULE_AUTHOR("Advanced Micro Devices, Inc."); | ||
470 | MODULE_DESCRIPTION("Geode LX Hardware AES driver"); | ||
471 | MODULE_LICENSE("GPL"); | ||
472 | |||
473 | module_init(geode_aes_init); | ||
474 | module_exit(geode_aes_exit); | ||
diff --git a/drivers/crypto/geode-aes.h b/drivers/crypto/geode-aes.h new file mode 100644 index 000000000000..8003a36f3a83 --- /dev/null +++ b/drivers/crypto/geode-aes.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* Copyright (C) 2003-2006, Advanced Micro Devices, Inc. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation; either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | */ | ||
8 | |||
9 | #ifndef _GEODE_AES_H_ | ||
10 | #define _GEODE_AES_H_ | ||
11 | |||
12 | #define AES_KEY_LENGTH 16 | ||
13 | #define AES_IV_LENGTH 16 | ||
14 | |||
15 | #define AES_MIN_BLOCK_SIZE 16 | ||
16 | |||
17 | #define AES_MODE_ECB 0 | ||
18 | #define AES_MODE_CBC 1 | ||
19 | |||
20 | #define AES_DIR_DECRYPT 0 | ||
21 | #define AES_DIR_ENCRYPT 1 | ||
22 | |||
23 | #define AES_FLAGS_USRKEY (1 << 0) | ||
24 | #define AES_FLAGS_COHERENT (1 << 1) | ||
25 | |||
26 | struct geode_aes_op { | ||
27 | |||
28 | void *src; | ||
29 | void *dst; | ||
30 | |||
31 | u32 mode; | ||
32 | u32 dir; | ||
33 | u32 flags; | ||
34 | int len; | ||
35 | |||
36 | u8 key[AES_KEY_LENGTH]; | ||
37 | u8 iv[AES_IV_LENGTH]; | ||
38 | }; | ||
39 | |||
40 | #endif | ||
diff --git a/drivers/dma/ioatdma.c b/drivers/dma/ioatdma.c index 0358419a0e48..8e8726104619 100644 --- a/drivers/dma/ioatdma.c +++ b/drivers/dma/ioatdma.c | |||
@@ -636,10 +636,10 @@ static int ioat_self_test(struct ioat_device *device) | |||
636 | dma_cookie_t cookie; | 636 | dma_cookie_t cookie; |
637 | int err = 0; | 637 | int err = 0; |
638 | 638 | ||
639 | src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, SLAB_KERNEL); | 639 | src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); |
640 | if (!src) | 640 | if (!src) |
641 | return -ENOMEM; | 641 | return -ENOMEM; |
642 | dest = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, SLAB_KERNEL); | 642 | dest = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); |
643 | if (!dest) { | 643 | if (!dest) { |
644 | kfree(src); | 644 | kfree(src); |
645 | return -ENOMEM; | 645 | return -ENOMEM; |
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 75e9e38330ff..1b4fc9221803 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/sysdev.h> | 28 | #include <linux/sysdev.h> |
29 | #include <linux/ctype.h> | 29 | #include <linux/ctype.h> |
30 | #include <linux/kthread.h> | 30 | #include <linux/kthread.h> |
31 | #include <linux/freezer.h> | ||
31 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
32 | #include <asm/page.h> | 33 | #include <asm/page.h> |
33 | #include <asm/edac.h> | 34 | #include <asm/edac.h> |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 0c68d0f0d8e5..e23bc0d62159 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -389,14 +389,6 @@ config BLK_DEV_RZ1000 | |||
389 | Linux. This may slow disk throughput by a few percent, but at least | 389 | Linux. This may slow disk throughput by a few percent, but at least |
390 | things will operate 100% reliably. | 390 | things will operate 100% reliably. |
391 | 391 | ||
392 | config BLK_DEV_SL82C105 | ||
393 | tristate "Winbond SL82c105 support" | ||
394 | depends on PCI && (PPC || ARM) && BLK_DEV_IDEPCI | ||
395 | help | ||
396 | If you have a Winbond SL82c105 IDE controller, say Y here to enable | ||
397 | special configuration for this chip. This is common on various CHRP | ||
398 | motherboards, but could be used elsewhere. If in doubt, say Y. | ||
399 | |||
400 | config BLK_DEV_IDEDMA_PCI | 392 | config BLK_DEV_IDEDMA_PCI |
401 | bool "Generic PCI bus-master DMA support" | 393 | bool "Generic PCI bus-master DMA support" |
402 | depends on PCI && BLK_DEV_IDEPCI | 394 | depends on PCI && BLK_DEV_IDEPCI |
@@ -712,6 +704,14 @@ config BLK_DEV_SIS5513 | |||
712 | 704 | ||
713 | Please read the comments at the top of <file:drivers/ide/pci/sis5513.c>. | 705 | Please read the comments at the top of <file:drivers/ide/pci/sis5513.c>. |
714 | 706 | ||
707 | config BLK_DEV_SL82C105 | ||
708 | tristate "Winbond SL82c105 support" | ||
709 | depends on (PPC || ARM) | ||
710 | help | ||
711 | If you have a Winbond SL82c105 IDE controller, say Y here to enable | ||
712 | special configuration for this chip. This is common on various CHRP | ||
713 | motherboards, but could be used elsewhere. If in doubt, say Y. | ||
714 | |||
715 | config BLK_DEV_SLC90E66 | 715 | config BLK_DEV_SLC90E66 |
716 | tristate "SLC90E66 chipset support" | 716 | tristate "SLC90E66 chipset support" |
717 | help | 717 | help |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 287a66201150..16890769dca6 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -973,8 +973,8 @@ ide_settings_t *ide_find_setting_by_name (ide_drive_t *drive, char *name) | |||
973 | * @drive: drive | 973 | * @drive: drive |
974 | * | 974 | * |
975 | * Automatically remove all the driver specific settings for this | 975 | * Automatically remove all the driver specific settings for this |
976 | * drive. This function may sleep and must not be called from IRQ | 976 | * drive. This function may not be called from IRQ context. The |
977 | * context. The caller must hold ide_setting_sem. | 977 | * caller must hold ide_setting_sem. |
978 | */ | 978 | */ |
979 | 979 | ||
980 | static void auto_remove_settings (ide_drive_t *drive) | 980 | static void auto_remove_settings (ide_drive_t *drive) |
@@ -1874,11 +1874,22 @@ void ide_unregister_subdriver(ide_drive_t *drive, ide_driver_t *driver) | |||
1874 | { | 1874 | { |
1875 | unsigned long flags; | 1875 | unsigned long flags; |
1876 | 1876 | ||
1877 | down(&ide_setting_sem); | ||
1878 | spin_lock_irqsave(&ide_lock, flags); | ||
1879 | #ifdef CONFIG_PROC_FS | 1877 | #ifdef CONFIG_PROC_FS |
1880 | ide_remove_proc_entries(drive->proc, driver->proc); | 1878 | ide_remove_proc_entries(drive->proc, driver->proc); |
1881 | #endif | 1879 | #endif |
1880 | down(&ide_setting_sem); | ||
1881 | spin_lock_irqsave(&ide_lock, flags); | ||
1882 | /* | ||
1883 | * ide_setting_sem protects the settings list | ||
1884 | * ide_lock protects the use of settings | ||
1885 | * | ||
1886 | * so we need to hold both, ide_settings_sem because we want to | ||
1887 | * modify the settings list, and ide_lock because we cannot take | ||
1888 | * a setting out that is being used. | ||
1889 | * | ||
1890 | * OTOH both ide_{read,write}_setting are only ever used under | ||
1891 | * ide_setting_sem. | ||
1892 | */ | ||
1882 | auto_remove_settings(drive); | 1893 | auto_remove_settings(drive); |
1883 | spin_unlock_irqrestore(&ide_lock, flags); | 1894 | spin_unlock_irqrestore(&ide_lock, flags); |
1884 | up(&ide_setting_sem); | 1895 | up(&ide_setting_sem); |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index eb7ab112c050..61f1a9665a7f 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -282,11 +282,11 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const | |||
282 | * Find the ISA bridge to see how good the IDE is. | 282 | * Find the ISA bridge to see how good the IDE is. |
283 | */ | 283 | */ |
284 | via_config = via_config_find(&isa); | 284 | via_config = via_config_find(&isa); |
285 | if (!via_config->id) { | 285 | |
286 | printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); | 286 | /* We checked this earlier so if it fails here deeep badness |
287 | pci_dev_put(isa); | 287 | is involved */ |
288 | return -ENODEV; | 288 | |
289 | } | 289 | BUG_ON(!via_config->id); |
290 | 290 | ||
291 | /* | 291 | /* |
292 | * Setup or disable Clk66 if appropriate | 292 | * Setup or disable Clk66 if appropriate |
@@ -494,6 +494,17 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { | |||
494 | 494 | ||
495 | static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 495 | static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
496 | { | 496 | { |
497 | struct pci_dev *isa = NULL; | ||
498 | struct via_isa_bridge *via_config; | ||
499 | /* | ||
500 | * Find the ISA bridge and check we know what it is. | ||
501 | */ | ||
502 | via_config = via_config_find(&isa); | ||
503 | pci_dev_put(isa); | ||
504 | if (!via_config->id) { | ||
505 | printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); | ||
506 | return -ENODEV; | ||
507 | } | ||
497 | return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); | 508 | return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); |
498 | } | 509 | } |
499 | 510 | ||
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 31e5cc49d61a..27d6c642415d 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -133,7 +133,7 @@ struct eth1394_node_info { | |||
133 | #define ETH1394_DRIVER_NAME "eth1394" | 133 | #define ETH1394_DRIVER_NAME "eth1394" |
134 | static const char driver_name[] = ETH1394_DRIVER_NAME; | 134 | static const char driver_name[] = ETH1394_DRIVER_NAME; |
135 | 135 | ||
136 | static kmem_cache_t *packet_task_cache; | 136 | static struct kmem_cache *packet_task_cache; |
137 | 137 | ||
138 | static struct hpsb_highlevel eth1394_highlevel; | 138 | static struct hpsb_highlevel eth1394_highlevel; |
139 | 139 | ||
diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c index 8f4378a1631c..b935e08695a9 100644 --- a/drivers/ieee1394/hosts.c +++ b/drivers/ieee1394/hosts.c | |||
@@ -123,7 +123,7 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, | |||
123 | int i; | 123 | int i; |
124 | int hostnum = 0; | 124 | int hostnum = 0; |
125 | 125 | ||
126 | h = kzalloc(sizeof(*h) + extra, SLAB_KERNEL); | 126 | h = kzalloc(sizeof(*h) + extra, GFP_KERNEL); |
127 | if (!h) | 127 | if (!h) |
128 | return NULL; | 128 | return NULL; |
129 | 129 | ||
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 8e7b83f84485..e829c9336b3c 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/kthread.h> | 16 | #include <linux/kthread.h> |
17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
18 | #include <linux/freezer.h> | ||
18 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
19 | 20 | ||
20 | #include "csr.h" | 21 | #include "csr.h" |
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 6e8ea9110c46..eae97d8dcf03 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c | |||
@@ -1225,7 +1225,7 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso) | |||
1225 | int ctx; | 1225 | int ctx; |
1226 | int ret = -ENOMEM; | 1226 | int ret = -ENOMEM; |
1227 | 1227 | ||
1228 | recv = kmalloc(sizeof(*recv), SLAB_KERNEL); | 1228 | recv = kmalloc(sizeof(*recv), GFP_KERNEL); |
1229 | if (!recv) | 1229 | if (!recv) |
1230 | return -ENOMEM; | 1230 | return -ENOMEM; |
1231 | 1231 | ||
@@ -1918,7 +1918,7 @@ static int ohci_iso_xmit_init(struct hpsb_iso *iso) | |||
1918 | int ctx; | 1918 | int ctx; |
1919 | int ret = -ENOMEM; | 1919 | int ret = -ENOMEM; |
1920 | 1920 | ||
1921 | xmit = kmalloc(sizeof(*xmit), SLAB_KERNEL); | 1921 | xmit = kmalloc(sizeof(*xmit), GFP_KERNEL); |
1922 | if (!xmit) | 1922 | if (!xmit) |
1923 | return -ENOMEM; | 1923 | return -ENOMEM; |
1924 | 1924 | ||
@@ -3021,7 +3021,7 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d, | |||
3021 | return -ENOMEM; | 3021 | return -ENOMEM; |
3022 | } | 3022 | } |
3023 | 3023 | ||
3024 | d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, SLAB_KERNEL, d->prg_bus+i); | 3024 | d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, GFP_KERNEL, d->prg_bus+i); |
3025 | OHCI_DMA_ALLOC("pool dma_rcv prg[%d]", i); | 3025 | OHCI_DMA_ALLOC("pool dma_rcv prg[%d]", i); |
3026 | 3026 | ||
3027 | if (d->prg_cpu[i] != NULL) { | 3027 | if (d->prg_cpu[i] != NULL) { |
@@ -3117,7 +3117,7 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d, | |||
3117 | OHCI_DMA_ALLOC("dma_rcv prg pool"); | 3117 | OHCI_DMA_ALLOC("dma_rcv prg pool"); |
3118 | 3118 | ||
3119 | for (i = 0; i < d->num_desc; i++) { | 3119 | for (i = 0; i < d->num_desc; i++) { |
3120 | d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, SLAB_KERNEL, d->prg_bus+i); | 3120 | d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, GFP_KERNEL, d->prg_bus+i); |
3121 | OHCI_DMA_ALLOC("pool dma_trm prg[%d]", i); | 3121 | OHCI_DMA_ALLOC("pool dma_trm prg[%d]", i); |
3122 | 3122 | ||
3123 | if (d->prg_cpu[i] != NULL) { | 3123 | if (d->prg_cpu[i] != NULL) { |
diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c index 0a7412e27eb4..9cab1d661472 100644 --- a/drivers/ieee1394/pcilynx.c +++ b/drivers/ieee1394/pcilynx.c | |||
@@ -1428,7 +1428,7 @@ static int __devinit add_card(struct pci_dev *dev, | |||
1428 | struct i2c_algo_bit_data i2c_adapter_data; | 1428 | struct i2c_algo_bit_data i2c_adapter_data; |
1429 | 1429 | ||
1430 | error = -ENOMEM; | 1430 | error = -ENOMEM; |
1431 | i2c_ad = kmalloc(sizeof(*i2c_ad), SLAB_KERNEL); | 1431 | i2c_ad = kmalloc(sizeof(*i2c_ad), GFP_KERNEL); |
1432 | if (!i2c_ad) FAIL("failed to allocate I2C adapter memory"); | 1432 | if (!i2c_ad) FAIL("failed to allocate I2C adapter memory"); |
1433 | 1433 | ||
1434 | memcpy(i2c_ad, &bit_ops, sizeof(struct i2c_adapter)); | 1434 | memcpy(i2c_ad, &bit_ops, sizeof(struct i2c_adapter)); |
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 5ec4f5eb6b19..bf71e069eaf5 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -112,7 +112,7 @@ static struct pending_request *__alloc_pending_request(gfp_t flags) | |||
112 | 112 | ||
113 | static inline struct pending_request *alloc_pending_request(void) | 113 | static inline struct pending_request *alloc_pending_request(void) |
114 | { | 114 | { |
115 | return __alloc_pending_request(SLAB_KERNEL); | 115 | return __alloc_pending_request(GFP_KERNEL); |
116 | } | 116 | } |
117 | 117 | ||
118 | static void free_pending_request(struct pending_request *req) | 118 | static void free_pending_request(struct pending_request *req) |
@@ -259,7 +259,7 @@ static void host_reset(struct hpsb_host *host) | |||
259 | if (hi != NULL) { | 259 | if (hi != NULL) { |
260 | list_for_each_entry(fi, &hi->file_info_list, list) { | 260 | list_for_each_entry(fi, &hi->file_info_list, list) { |
261 | if (fi->notification == RAW1394_NOTIFY_ON) { | 261 | if (fi->notification == RAW1394_NOTIFY_ON) { |
262 | req = __alloc_pending_request(SLAB_ATOMIC); | 262 | req = __alloc_pending_request(GFP_ATOMIC); |
263 | 263 | ||
264 | if (req != NULL) { | 264 | if (req != NULL) { |
265 | req->file_info = fi; | 265 | req->file_info = fi; |
@@ -306,13 +306,13 @@ static void iso_receive(struct hpsb_host *host, int channel, quadlet_t * data, | |||
306 | if (!(fi->listen_channels & (1ULL << channel))) | 306 | if (!(fi->listen_channels & (1ULL << channel))) |
307 | continue; | 307 | continue; |
308 | 308 | ||
309 | req = __alloc_pending_request(SLAB_ATOMIC); | 309 | req = __alloc_pending_request(GFP_ATOMIC); |
310 | if (!req) | 310 | if (!req) |
311 | break; | 311 | break; |
312 | 312 | ||
313 | if (!ibs) { | 313 | if (!ibs) { |
314 | ibs = kmalloc(sizeof(*ibs) + length, | 314 | ibs = kmalloc(sizeof(*ibs) + length, |
315 | SLAB_ATOMIC); | 315 | GFP_ATOMIC); |
316 | if (!ibs) { | 316 | if (!ibs) { |
317 | kfree(req); | 317 | kfree(req); |
318 | break; | 318 | break; |
@@ -367,13 +367,13 @@ static void fcp_request(struct hpsb_host *host, int nodeid, int direction, | |||
367 | if (!fi->fcp_buffer) | 367 | if (!fi->fcp_buffer) |
368 | continue; | 368 | continue; |
369 | 369 | ||
370 | req = __alloc_pending_request(SLAB_ATOMIC); | 370 | req = __alloc_pending_request(GFP_ATOMIC); |
371 | if (!req) | 371 | if (!req) |
372 | break; | 372 | break; |
373 | 373 | ||
374 | if (!ibs) { | 374 | if (!ibs) { |
375 | ibs = kmalloc(sizeof(*ibs) + length, | 375 | ibs = kmalloc(sizeof(*ibs) + length, |
376 | SLAB_ATOMIC); | 376 | GFP_ATOMIC); |
377 | if (!ibs) { | 377 | if (!ibs) { |
378 | kfree(req); | 378 | kfree(req); |
379 | break; | 379 | break; |
@@ -593,7 +593,7 @@ static int state_initialized(struct file_info *fi, struct pending_request *req) | |||
593 | switch (req->req.type) { | 593 | switch (req->req.type) { |
594 | case RAW1394_REQ_LIST_CARDS: | 594 | case RAW1394_REQ_LIST_CARDS: |
595 | spin_lock_irqsave(&host_info_lock, flags); | 595 | spin_lock_irqsave(&host_info_lock, flags); |
596 | khl = kmalloc(sizeof(*khl) * host_count, SLAB_ATOMIC); | 596 | khl = kmalloc(sizeof(*khl) * host_count, GFP_ATOMIC); |
597 | 597 | ||
598 | if (khl) { | 598 | if (khl) { |
599 | req->req.misc = host_count; | 599 | req->req.misc = host_count; |
@@ -1045,7 +1045,7 @@ static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer, | |||
1045 | } | 1045 | } |
1046 | if (arm_addr->notification_options & ARM_READ) { | 1046 | if (arm_addr->notification_options & ARM_READ) { |
1047 | DBGMSG("arm_read -> entering notification-section"); | 1047 | DBGMSG("arm_read -> entering notification-section"); |
1048 | req = __alloc_pending_request(SLAB_ATOMIC); | 1048 | req = __alloc_pending_request(GFP_ATOMIC); |
1049 | if (!req) { | 1049 | if (!req) { |
1050 | DBGMSG("arm_read -> rcode_conflict_error"); | 1050 | DBGMSG("arm_read -> rcode_conflict_error"); |
1051 | spin_unlock_irqrestore(&host_info_lock, irqflags); | 1051 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
@@ -1064,7 +1064,7 @@ static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer, | |||
1064 | sizeof(struct arm_response) + | 1064 | sizeof(struct arm_response) + |
1065 | sizeof(struct arm_request_response); | 1065 | sizeof(struct arm_request_response); |
1066 | } | 1066 | } |
1067 | req->data = kmalloc(size, SLAB_ATOMIC); | 1067 | req->data = kmalloc(size, GFP_ATOMIC); |
1068 | if (!(req->data)) { | 1068 | if (!(req->data)) { |
1069 | free_pending_request(req); | 1069 | free_pending_request(req); |
1070 | DBGMSG("arm_read -> rcode_conflict_error"); | 1070 | DBGMSG("arm_read -> rcode_conflict_error"); |
@@ -1198,7 +1198,7 @@ static int arm_write(struct hpsb_host *host, int nodeid, int destid, | |||
1198 | } | 1198 | } |
1199 | if (arm_addr->notification_options & ARM_WRITE) { | 1199 | if (arm_addr->notification_options & ARM_WRITE) { |
1200 | DBGMSG("arm_write -> entering notification-section"); | 1200 | DBGMSG("arm_write -> entering notification-section"); |
1201 | req = __alloc_pending_request(SLAB_ATOMIC); | 1201 | req = __alloc_pending_request(GFP_ATOMIC); |
1202 | if (!req) { | 1202 | if (!req) { |
1203 | DBGMSG("arm_write -> rcode_conflict_error"); | 1203 | DBGMSG("arm_write -> rcode_conflict_error"); |
1204 | spin_unlock_irqrestore(&host_info_lock, irqflags); | 1204 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
@@ -1209,7 +1209,7 @@ static int arm_write(struct hpsb_host *host, int nodeid, int destid, | |||
1209 | sizeof(struct arm_request) + sizeof(struct arm_response) + | 1209 | sizeof(struct arm_request) + sizeof(struct arm_response) + |
1210 | (length) * sizeof(byte_t) + | 1210 | (length) * sizeof(byte_t) + |
1211 | sizeof(struct arm_request_response); | 1211 | sizeof(struct arm_request_response); |
1212 | req->data = kmalloc(size, SLAB_ATOMIC); | 1212 | req->data = kmalloc(size, GFP_ATOMIC); |
1213 | if (!(req->data)) { | 1213 | if (!(req->data)) { |
1214 | free_pending_request(req); | 1214 | free_pending_request(req); |
1215 | DBGMSG("arm_write -> rcode_conflict_error"); | 1215 | DBGMSG("arm_write -> rcode_conflict_error"); |
@@ -1400,7 +1400,7 @@ static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store, | |||
1400 | if (arm_addr->notification_options & ARM_LOCK) { | 1400 | if (arm_addr->notification_options & ARM_LOCK) { |
1401 | byte_t *buf1, *buf2; | 1401 | byte_t *buf1, *buf2; |
1402 | DBGMSG("arm_lock -> entering notification-section"); | 1402 | DBGMSG("arm_lock -> entering notification-section"); |
1403 | req = __alloc_pending_request(SLAB_ATOMIC); | 1403 | req = __alloc_pending_request(GFP_ATOMIC); |
1404 | if (!req) { | 1404 | if (!req) { |
1405 | DBGMSG("arm_lock -> rcode_conflict_error"); | 1405 | DBGMSG("arm_lock -> rcode_conflict_error"); |
1406 | spin_unlock_irqrestore(&host_info_lock, irqflags); | 1406 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
@@ -1408,7 +1408,7 @@ static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store, | |||
1408 | The request may be retried */ | 1408 | The request may be retried */ |
1409 | } | 1409 | } |
1410 | size = sizeof(struct arm_request) + sizeof(struct arm_response) + 3 * sizeof(*store) + sizeof(struct arm_request_response); /* maximum */ | 1410 | size = sizeof(struct arm_request) + sizeof(struct arm_response) + 3 * sizeof(*store) + sizeof(struct arm_request_response); /* maximum */ |
1411 | req->data = kmalloc(size, SLAB_ATOMIC); | 1411 | req->data = kmalloc(size, GFP_ATOMIC); |
1412 | if (!(req->data)) { | 1412 | if (!(req->data)) { |
1413 | free_pending_request(req); | 1413 | free_pending_request(req); |
1414 | DBGMSG("arm_lock -> rcode_conflict_error"); | 1414 | DBGMSG("arm_lock -> rcode_conflict_error"); |
@@ -1628,7 +1628,7 @@ static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store, | |||
1628 | if (arm_addr->notification_options & ARM_LOCK) { | 1628 | if (arm_addr->notification_options & ARM_LOCK) { |
1629 | byte_t *buf1, *buf2; | 1629 | byte_t *buf1, *buf2; |
1630 | DBGMSG("arm_lock64 -> entering notification-section"); | 1630 | DBGMSG("arm_lock64 -> entering notification-section"); |
1631 | req = __alloc_pending_request(SLAB_ATOMIC); | 1631 | req = __alloc_pending_request(GFP_ATOMIC); |
1632 | if (!req) { | 1632 | if (!req) { |
1633 | spin_unlock_irqrestore(&host_info_lock, irqflags); | 1633 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1634 | DBGMSG("arm_lock64 -> rcode_conflict_error"); | 1634 | DBGMSG("arm_lock64 -> rcode_conflict_error"); |
@@ -1636,7 +1636,7 @@ static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store, | |||
1636 | The request may be retried */ | 1636 | The request may be retried */ |
1637 | } | 1637 | } |
1638 | size = sizeof(struct arm_request) + sizeof(struct arm_response) + 3 * sizeof(*store) + sizeof(struct arm_request_response); /* maximum */ | 1638 | size = sizeof(struct arm_request) + sizeof(struct arm_response) + 3 * sizeof(*store) + sizeof(struct arm_request_response); /* maximum */ |
1639 | req->data = kmalloc(size, SLAB_ATOMIC); | 1639 | req->data = kmalloc(size, GFP_ATOMIC); |
1640 | if (!(req->data)) { | 1640 | if (!(req->data)) { |
1641 | free_pending_request(req); | 1641 | free_pending_request(req); |
1642 | spin_unlock_irqrestore(&host_info_lock, irqflags); | 1642 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
@@ -1737,7 +1737,7 @@ static int arm_register(struct file_info *fi, struct pending_request *req) | |||
1737 | return (-EINVAL); | 1737 | return (-EINVAL); |
1738 | } | 1738 | } |
1739 | /* addr-list-entry for fileinfo */ | 1739 | /* addr-list-entry for fileinfo */ |
1740 | addr = kmalloc(sizeof(*addr), SLAB_KERNEL); | 1740 | addr = kmalloc(sizeof(*addr), GFP_KERNEL); |
1741 | if (!addr) { | 1741 | if (!addr) { |
1742 | req->req.length = 0; | 1742 | req->req.length = 0; |
1743 | return (-ENOMEM); | 1743 | return (-ENOMEM); |
@@ -2103,7 +2103,7 @@ static int write_phypacket(struct file_info *fi, struct pending_request *req) | |||
2103 | static int get_config_rom(struct file_info *fi, struct pending_request *req) | 2103 | static int get_config_rom(struct file_info *fi, struct pending_request *req) |
2104 | { | 2104 | { |
2105 | int ret = sizeof(struct raw1394_request); | 2105 | int ret = sizeof(struct raw1394_request); |
2106 | quadlet_t *data = kmalloc(req->req.length, SLAB_KERNEL); | 2106 | quadlet_t *data = kmalloc(req->req.length, GFP_KERNEL); |
2107 | int status; | 2107 | int status; |
2108 | 2108 | ||
2109 | if (!data) | 2109 | if (!data) |
@@ -2133,7 +2133,7 @@ static int get_config_rom(struct file_info *fi, struct pending_request *req) | |||
2133 | static int update_config_rom(struct file_info *fi, struct pending_request *req) | 2133 | static int update_config_rom(struct file_info *fi, struct pending_request *req) |
2134 | { | 2134 | { |
2135 | int ret = sizeof(struct raw1394_request); | 2135 | int ret = sizeof(struct raw1394_request); |
2136 | quadlet_t *data = kmalloc(req->req.length, SLAB_KERNEL); | 2136 | quadlet_t *data = kmalloc(req->req.length, GFP_KERNEL); |
2137 | if (!data) | 2137 | if (!data) |
2138 | return -ENOMEM; | 2138 | return -ENOMEM; |
2139 | if (copy_from_user(data, int2ptr(req->req.sendb), req->req.length)) { | 2139 | if (copy_from_user(data, int2ptr(req->req.sendb), req->req.length)) { |
@@ -2443,7 +2443,7 @@ static void queue_rawiso_event(struct file_info *fi) | |||
2443 | /* only one ISO activity event may be in the queue */ | 2443 | /* only one ISO activity event may be in the queue */ |
2444 | if (!__rawiso_event_in_queue(fi)) { | 2444 | if (!__rawiso_event_in_queue(fi)) { |
2445 | struct pending_request *req = | 2445 | struct pending_request *req = |
2446 | __alloc_pending_request(SLAB_ATOMIC); | 2446 | __alloc_pending_request(GFP_ATOMIC); |
2447 | 2447 | ||
2448 | if (req) { | 2448 | if (req) { |
2449 | req->file_info = fi; | 2449 | req->file_info = fi; |
@@ -2779,7 +2779,7 @@ static int raw1394_open(struct inode *inode, struct file *file) | |||
2779 | { | 2779 | { |
2780 | struct file_info *fi; | 2780 | struct file_info *fi; |
2781 | 2781 | ||
2782 | fi = kzalloc(sizeof(*fi), SLAB_KERNEL); | 2782 | fi = kzalloc(sizeof(*fi), GFP_KERNEL); |
2783 | if (!fi) | 2783 | if (!fi) |
2784 | return -ENOMEM; | 2784 | return -ENOMEM; |
2785 | 2785 | ||
diff --git a/drivers/infiniband/hw/amso1100/c2_vq.c b/drivers/infiniband/hw/amso1100/c2_vq.c index 40caeb5f41b4..36620a22413c 100644 --- a/drivers/infiniband/hw/amso1100/c2_vq.c +++ b/drivers/infiniband/hw/amso1100/c2_vq.c | |||
@@ -164,7 +164,7 @@ void vq_req_put(struct c2_dev *c2dev, struct c2_vq_req *r) | |||
164 | */ | 164 | */ |
165 | void *vq_repbuf_alloc(struct c2_dev *c2dev) | 165 | void *vq_repbuf_alloc(struct c2_dev *c2dev) |
166 | { | 166 | { |
167 | return kmem_cache_alloc(c2dev->host_msg_cache, SLAB_ATOMIC); | 167 | return kmem_cache_alloc(c2dev->host_msg_cache, GFP_ATOMIC); |
168 | } | 168 | } |
169 | 169 | ||
170 | /* | 170 | /* |
diff --git a/drivers/infiniband/hw/ehca/ehca_av.c b/drivers/infiniband/hw/ehca/ehca_av.c index 214e2fdddeef..0d6e2c4bb245 100644 --- a/drivers/infiniband/hw/ehca/ehca_av.c +++ b/drivers/infiniband/hw/ehca/ehca_av.c | |||
@@ -57,7 +57,7 @@ struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) | |||
57 | struct ehca_shca *shca = container_of(pd->device, struct ehca_shca, | 57 | struct ehca_shca *shca = container_of(pd->device, struct ehca_shca, |
58 | ib_device); | 58 | ib_device); |
59 | 59 | ||
60 | av = kmem_cache_alloc(av_cache, SLAB_KERNEL); | 60 | av = kmem_cache_alloc(av_cache, GFP_KERNEL); |
61 | if (!av) { | 61 | if (!av) { |
62 | ehca_err(pd->device, "Out of memory pd=%p ah_attr=%p", | 62 | ehca_err(pd->device, "Out of memory pd=%p ah_attr=%p", |
63 | pd, ah_attr); | 63 | pd, ah_attr); |
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c index 458fe19648a1..93995b658d94 100644 --- a/drivers/infiniband/hw/ehca/ehca_cq.c +++ b/drivers/infiniband/hw/ehca/ehca_cq.c | |||
@@ -134,7 +134,7 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, | |||
134 | if (cqe >= 0xFFFFFFFF - 64 - additional_cqe) | 134 | if (cqe >= 0xFFFFFFFF - 64 - additional_cqe) |
135 | return ERR_PTR(-EINVAL); | 135 | return ERR_PTR(-EINVAL); |
136 | 136 | ||
137 | my_cq = kmem_cache_alloc(cq_cache, SLAB_KERNEL); | 137 | my_cq = kmem_cache_alloc(cq_cache, GFP_KERNEL); |
138 | if (!my_cq) { | 138 | if (!my_cq) { |
139 | ehca_err(device, "Out of memory for ehca_cq struct device=%p", | 139 | ehca_err(device, "Out of memory for ehca_cq struct device=%p", |
140 | device); | 140 | device); |
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index 3d1c1c535038..cc47e4c13a18 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
@@ -108,7 +108,7 @@ static struct kmem_cache *ctblk_cache = NULL; | |||
108 | 108 | ||
109 | void *ehca_alloc_fw_ctrlblock(void) | 109 | void *ehca_alloc_fw_ctrlblock(void) |
110 | { | 110 | { |
111 | void *ret = kmem_cache_zalloc(ctblk_cache, SLAB_KERNEL); | 111 | void *ret = kmem_cache_zalloc(ctblk_cache, GFP_KERNEL); |
112 | if (!ret) | 112 | if (!ret) |
113 | ehca_gen_err("Out of memory for ctblk"); | 113 | ehca_gen_err("Out of memory for ctblk"); |
114 | return ret; | 114 | return ret; |
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c index abce676c0ae0..0a5e2214cc5f 100644 --- a/drivers/infiniband/hw/ehca/ehca_mrmw.c +++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c | |||
@@ -53,7 +53,7 @@ static struct ehca_mr *ehca_mr_new(void) | |||
53 | { | 53 | { |
54 | struct ehca_mr *me; | 54 | struct ehca_mr *me; |
55 | 55 | ||
56 | me = kmem_cache_alloc(mr_cache, SLAB_KERNEL); | 56 | me = kmem_cache_alloc(mr_cache, GFP_KERNEL); |
57 | if (me) { | 57 | if (me) { |
58 | memset(me, 0, sizeof(struct ehca_mr)); | 58 | memset(me, 0, sizeof(struct ehca_mr)); |
59 | spin_lock_init(&me->mrlock); | 59 | spin_lock_init(&me->mrlock); |
@@ -72,7 +72,7 @@ static struct ehca_mw *ehca_mw_new(void) | |||
72 | { | 72 | { |
73 | struct ehca_mw *me; | 73 | struct ehca_mw *me; |
74 | 74 | ||
75 | me = kmem_cache_alloc(mw_cache, SLAB_KERNEL); | 75 | me = kmem_cache_alloc(mw_cache, GFP_KERNEL); |
76 | if (me) { | 76 | if (me) { |
77 | memset(me, 0, sizeof(struct ehca_mw)); | 77 | memset(me, 0, sizeof(struct ehca_mw)); |
78 | spin_lock_init(&me->mwlock); | 78 | spin_lock_init(&me->mwlock); |
diff --git a/drivers/infiniband/hw/ehca/ehca_pd.c b/drivers/infiniband/hw/ehca/ehca_pd.c index 2c3cdc6f7b39..d5345e5b3cd6 100644 --- a/drivers/infiniband/hw/ehca/ehca_pd.c +++ b/drivers/infiniband/hw/ehca/ehca_pd.c | |||
@@ -50,7 +50,7 @@ struct ib_pd *ehca_alloc_pd(struct ib_device *device, | |||
50 | { | 50 | { |
51 | struct ehca_pd *pd; | 51 | struct ehca_pd *pd; |
52 | 52 | ||
53 | pd = kmem_cache_alloc(pd_cache, SLAB_KERNEL); | 53 | pd = kmem_cache_alloc(pd_cache, GFP_KERNEL); |
54 | if (!pd) { | 54 | if (!pd) { |
55 | ehca_err(device, "device=%p context=%p out of memory", | 55 | ehca_err(device, "device=%p context=%p out of memory", |
56 | device, context); | 56 | device, context); |
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c index 8682aa50c707..c6c9cef203e3 100644 --- a/drivers/infiniband/hw/ehca/ehca_qp.c +++ b/drivers/infiniband/hw/ehca/ehca_qp.c | |||
@@ -450,7 +450,7 @@ struct ib_qp *ehca_create_qp(struct ib_pd *pd, | |||
450 | if (pd->uobject && udata) | 450 | if (pd->uobject && udata) |
451 | context = pd->uobject->context; | 451 | context = pd->uobject->context; |
452 | 452 | ||
453 | my_qp = kmem_cache_alloc(qp_cache, SLAB_KERNEL); | 453 | my_qp = kmem_cache_alloc(qp_cache, GFP_KERNEL); |
454 | if (!my_qp) { | 454 | if (!my_qp) { |
455 | ehca_err(pd->device, "pd=%p not enough memory to alloc qp", pd); | 455 | ehca_err(pd->device, "pd=%p not enough memory to alloc qp", pd); |
456 | return ERR_PTR(-ENOMEM); | 456 | return ERR_PTR(-ENOMEM); |
diff --git a/drivers/infiniband/hw/mthca/mthca_av.c b/drivers/infiniband/hw/mthca/mthca_av.c index 57cdc1bc5f50..27caf3b0648a 100644 --- a/drivers/infiniband/hw/mthca/mthca_av.c +++ b/drivers/infiniband/hw/mthca/mthca_av.c | |||
@@ -189,7 +189,7 @@ int mthca_create_ah(struct mthca_dev *dev, | |||
189 | on_hca_fail: | 189 | on_hca_fail: |
190 | if (ah->type == MTHCA_AH_PCI_POOL) { | 190 | if (ah->type == MTHCA_AH_PCI_POOL) { |
191 | ah->av = pci_pool_alloc(dev->av_table.pool, | 191 | ah->av = pci_pool_alloc(dev->av_table.pool, |
192 | SLAB_ATOMIC, &ah->avdma); | 192 | GFP_ATOMIC, &ah->avdma); |
193 | if (!ah->av) | 193 | if (!ah->av) |
194 | return -ENOMEM; | 194 | return -ENOMEM; |
195 | 195 | ||
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index a0af97efe6ac..79dfb4b25c97 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/kthread.h> | 23 | #include <linux/kthread.h> |
24 | #include <linux/sched.h> /* HZ */ | 24 | #include <linux/sched.h> /* HZ */ |
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/freezer.h> | ||
26 | 27 | ||
27 | /*#include <asm/io.h>*/ | 28 | /*#include <asm/io.h>*/ |
28 | 29 | ||
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c index ab4da79ee560..31d5a13bfd6b 100644 --- a/drivers/input/misc/hp_sdc_rtc.c +++ b/drivers/input/misc/hp_sdc_rtc.c | |||
@@ -695,7 +695,9 @@ static int __init hp_sdc_rtc_init(void) | |||
695 | 695 | ||
696 | if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr))) | 696 | if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr))) |
697 | return ret; | 697 | return ret; |
698 | misc_register(&hp_sdc_rtc_dev); | 698 | if (misc_register(&hp_sdc_rtc_dev) != 0) |
699 | printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n"); | ||
700 | |||
699 | create_proc_read_entry ("driver/rtc", 0, NULL, | 701 | create_proc_read_entry ("driver/rtc", 0, NULL, |
700 | hp_sdc_rtc_read_proc, NULL); | 702 | hp_sdc_rtc_read_proc, NULL); |
701 | 703 | ||
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 211943f85cb6..5f1d4032fd57 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/kthread.h> | 36 | #include <linux/kthread.h> |
37 | #include <linux/mutex.h> | 37 | #include <linux/mutex.h> |
38 | #include <linux/freezer.h> | ||
38 | 39 | ||
39 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | 40 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); |
40 | MODULE_DESCRIPTION("Serio abstraction core"); | 41 | MODULE_DESCRIPTION("Serio abstraction core"); |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index f56d6a0f0624..0517c7387d67 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -189,7 +189,7 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) | |||
189 | { | 189 | { |
190 | struct spi_device *spi = to_spi_device(dev); | 190 | struct spi_device *spi = to_spi_device(dev); |
191 | struct ads7846 *ts = dev_get_drvdata(dev); | 191 | struct ads7846 *ts = dev_get_drvdata(dev); |
192 | struct ser_req *req = kzalloc(sizeof *req, SLAB_KERNEL); | 192 | struct ser_req *req = kzalloc(sizeof *req, GFP_KERNEL); |
193 | int status; | 193 | int status; |
194 | int sample; | 194 | int sample; |
195 | int i; | 195 | int i; |
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 0c937325a1b3..63b629b1cdb2 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -572,7 +572,7 @@ static int atread_submit(struct cardstate *cs, int timeout) | |||
572 | ucs->rcvbuf, ucs->rcvbuf_size, | 572 | ucs->rcvbuf, ucs->rcvbuf_size, |
573 | read_ctrl_callback, cs->inbuf); | 573 | read_ctrl_callback, cs->inbuf); |
574 | 574 | ||
575 | if ((ret = usb_submit_urb(ucs->urb_cmd_in, SLAB_ATOMIC)) != 0) { | 575 | if ((ret = usb_submit_urb(ucs->urb_cmd_in, GFP_ATOMIC)) != 0) { |
576 | update_basstate(ucs, 0, BS_ATRDPEND); | 576 | update_basstate(ucs, 0, BS_ATRDPEND); |
577 | dev_err(cs->dev, "could not submit HD_READ_ATMESSAGE: %s\n", | 577 | dev_err(cs->dev, "could not submit HD_READ_ATMESSAGE: %s\n", |
578 | get_usb_rcmsg(ret)); | 578 | get_usb_rcmsg(ret)); |
@@ -747,7 +747,7 @@ static void read_int_callback(struct urb *urb) | |||
747 | check_pending(ucs); | 747 | check_pending(ucs); |
748 | 748 | ||
749 | resubmit: | 749 | resubmit: |
750 | rc = usb_submit_urb(urb, SLAB_ATOMIC); | 750 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
751 | if (unlikely(rc != 0 && rc != -ENODEV)) { | 751 | if (unlikely(rc != 0 && rc != -ENODEV)) { |
752 | dev_err(cs->dev, "could not resubmit interrupt URB: %s\n", | 752 | dev_err(cs->dev, "could not resubmit interrupt URB: %s\n", |
753 | get_usb_rcmsg(rc)); | 753 | get_usb_rcmsg(rc)); |
@@ -807,7 +807,7 @@ static void read_iso_callback(struct urb *urb) | |||
807 | urb->number_of_packets = BAS_NUMFRAMES; | 807 | urb->number_of_packets = BAS_NUMFRAMES; |
808 | gig_dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit", | 808 | gig_dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit", |
809 | __func__); | 809 | __func__); |
810 | rc = usb_submit_urb(urb, SLAB_ATOMIC); | 810 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
811 | if (unlikely(rc != 0 && rc != -ENODEV)) { | 811 | if (unlikely(rc != 0 && rc != -ENODEV)) { |
812 | dev_err(bcs->cs->dev, | 812 | dev_err(bcs->cs->dev, |
813 | "could not resubmit isochronous read " | 813 | "could not resubmit isochronous read " |
@@ -900,7 +900,7 @@ static int starturbs(struct bc_state *bcs) | |||
900 | } | 900 | } |
901 | 901 | ||
902 | dump_urb(DEBUG_ISO, "Initial isoc read", urb); | 902 | dump_urb(DEBUG_ISO, "Initial isoc read", urb); |
903 | if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) | 903 | if ((rc = usb_submit_urb(urb, GFP_ATOMIC)) != 0) |
904 | goto error; | 904 | goto error; |
905 | } | 905 | } |
906 | 906 | ||
@@ -935,7 +935,7 @@ static int starturbs(struct bc_state *bcs) | |||
935 | /* submit two URBs, keep third one */ | 935 | /* submit two URBs, keep third one */ |
936 | for (k = 0; k < 2; ++k) { | 936 | for (k = 0; k < 2; ++k) { |
937 | dump_urb(DEBUG_ISO, "Initial isoc write", urb); | 937 | dump_urb(DEBUG_ISO, "Initial isoc write", urb); |
938 | rc = usb_submit_urb(ubc->isoouturbs[k].urb, SLAB_ATOMIC); | 938 | rc = usb_submit_urb(ubc->isoouturbs[k].urb, GFP_ATOMIC); |
939 | if (rc != 0) | 939 | if (rc != 0) |
940 | goto error; | 940 | goto error; |
941 | } | 941 | } |
@@ -1042,7 +1042,7 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx) | |||
1042 | return 0; /* no data to send */ | 1042 | return 0; /* no data to send */ |
1043 | urb->number_of_packets = nframe; | 1043 | urb->number_of_packets = nframe; |
1044 | 1044 | ||
1045 | rc = usb_submit_urb(urb, SLAB_ATOMIC); | 1045 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
1046 | if (unlikely(rc)) { | 1046 | if (unlikely(rc)) { |
1047 | if (rc == -ENODEV) | 1047 | if (rc == -ENODEV) |
1048 | /* device removed - give up silently */ | 1048 | /* device removed - give up silently */ |
@@ -1341,7 +1341,7 @@ static void read_iso_tasklet(unsigned long data) | |||
1341 | urb->dev = bcs->cs->hw.bas->udev; | 1341 | urb->dev = bcs->cs->hw.bas->udev; |
1342 | urb->transfer_flags = URB_ISO_ASAP; | 1342 | urb->transfer_flags = URB_ISO_ASAP; |
1343 | urb->number_of_packets = BAS_NUMFRAMES; | 1343 | urb->number_of_packets = BAS_NUMFRAMES; |
1344 | rc = usb_submit_urb(urb, SLAB_ATOMIC); | 1344 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
1345 | if (unlikely(rc != 0 && rc != -ENODEV)) { | 1345 | if (unlikely(rc != 0 && rc != -ENODEV)) { |
1346 | dev_err(cs->dev, | 1346 | dev_err(cs->dev, |
1347 | "could not resubmit isochronous read URB: %s\n", | 1347 | "could not resubmit isochronous read URB: %s\n", |
@@ -1458,7 +1458,7 @@ static void write_ctrl_callback(struct urb *urb) | |||
1458 | ucs->retry_ctrl); | 1458 | ucs->retry_ctrl); |
1459 | /* urb->dev is clobbered by USB subsystem */ | 1459 | /* urb->dev is clobbered by USB subsystem */ |
1460 | urb->dev = ucs->udev; | 1460 | urb->dev = ucs->udev; |
1461 | rc = usb_submit_urb(urb, SLAB_ATOMIC); | 1461 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
1462 | if (unlikely(rc)) { | 1462 | if (unlikely(rc)) { |
1463 | dev_err(&ucs->interface->dev, | 1463 | dev_err(&ucs->interface->dev, |
1464 | "could not resubmit request 0x%02x: %s\n", | 1464 | "could not resubmit request 0x%02x: %s\n", |
@@ -1517,7 +1517,7 @@ static int req_submit(struct bc_state *bcs, int req, int val, int timeout) | |||
1517 | (unsigned char*) &ucs->dr_ctrl, NULL, 0, | 1517 | (unsigned char*) &ucs->dr_ctrl, NULL, 0, |
1518 | write_ctrl_callback, ucs); | 1518 | write_ctrl_callback, ucs); |
1519 | ucs->retry_ctrl = 0; | 1519 | ucs->retry_ctrl = 0; |
1520 | ret = usb_submit_urb(ucs->urb_ctrl, SLAB_ATOMIC); | 1520 | ret = usb_submit_urb(ucs->urb_ctrl, GFP_ATOMIC); |
1521 | if (unlikely(ret)) { | 1521 | if (unlikely(ret)) { |
1522 | dev_err(bcs->cs->dev, "could not submit request 0x%02x: %s\n", | 1522 | dev_err(bcs->cs->dev, "could not submit request 0x%02x: %s\n", |
1523 | req, get_usb_rcmsg(ret)); | 1523 | req, get_usb_rcmsg(ret)); |
@@ -1763,7 +1763,7 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) | |||
1763 | usb_sndctrlpipe(ucs->udev, 0), | 1763 | usb_sndctrlpipe(ucs->udev, 0), |
1764 | (unsigned char*) &ucs->dr_cmd_out, buf, len, | 1764 | (unsigned char*) &ucs->dr_cmd_out, buf, len, |
1765 | write_command_callback, cs); | 1765 | write_command_callback, cs); |
1766 | rc = usb_submit_urb(ucs->urb_cmd_out, SLAB_ATOMIC); | 1766 | rc = usb_submit_urb(ucs->urb_cmd_out, GFP_ATOMIC); |
1767 | if (unlikely(rc)) { | 1767 | if (unlikely(rc)) { |
1768 | update_basstate(ucs, 0, BS_ATWRPEND); | 1768 | update_basstate(ucs, 0, BS_ATWRPEND); |
1769 | dev_err(cs->dev, "could not submit HD_WRITE_ATMESSAGE: %s\n", | 1769 | dev_err(cs->dev, "could not submit HD_WRITE_ATMESSAGE: %s\n", |
@@ -2218,21 +2218,21 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2218 | * - three for the different uses of the default control pipe | 2218 | * - three for the different uses of the default control pipe |
2219 | * - three for each isochronous pipe | 2219 | * - three for each isochronous pipe |
2220 | */ | 2220 | */ |
2221 | if (!(ucs->urb_int_in = usb_alloc_urb(0, SLAB_KERNEL)) || | 2221 | if (!(ucs->urb_int_in = usb_alloc_urb(0, GFP_KERNEL)) || |
2222 | !(ucs->urb_cmd_in = usb_alloc_urb(0, SLAB_KERNEL)) || | 2222 | !(ucs->urb_cmd_in = usb_alloc_urb(0, GFP_KERNEL)) || |
2223 | !(ucs->urb_cmd_out = usb_alloc_urb(0, SLAB_KERNEL)) || | 2223 | !(ucs->urb_cmd_out = usb_alloc_urb(0, GFP_KERNEL)) || |
2224 | !(ucs->urb_ctrl = usb_alloc_urb(0, SLAB_KERNEL))) | 2224 | !(ucs->urb_ctrl = usb_alloc_urb(0, GFP_KERNEL))) |
2225 | goto allocerr; | 2225 | goto allocerr; |
2226 | 2226 | ||
2227 | for (j = 0; j < 2; ++j) { | 2227 | for (j = 0; j < 2; ++j) { |
2228 | ubc = cs->bcs[j].hw.bas; | 2228 | ubc = cs->bcs[j].hw.bas; |
2229 | for (i = 0; i < BAS_OUTURBS; ++i) | 2229 | for (i = 0; i < BAS_OUTURBS; ++i) |
2230 | if (!(ubc->isoouturbs[i].urb = | 2230 | if (!(ubc->isoouturbs[i].urb = |
2231 | usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL))) | 2231 | usb_alloc_urb(BAS_NUMFRAMES, GFP_KERNEL))) |
2232 | goto allocerr; | 2232 | goto allocerr; |
2233 | for (i = 0; i < BAS_INURBS; ++i) | 2233 | for (i = 0; i < BAS_INURBS; ++i) |
2234 | if (!(ubc->isoinurbs[i] = | 2234 | if (!(ubc->isoinurbs[i] = |
2235 | usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL))) | 2235 | usb_alloc_urb(BAS_NUMFRAMES, GFP_KERNEL))) |
2236 | goto allocerr; | 2236 | goto allocerr; |
2237 | } | 2237 | } |
2238 | 2238 | ||
@@ -2246,7 +2246,7 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2246 | (endpoint->bEndpointAddress) & 0x0f), | 2246 | (endpoint->bEndpointAddress) & 0x0f), |
2247 | ucs->int_in_buf, 3, read_int_callback, cs, | 2247 | ucs->int_in_buf, 3, read_int_callback, cs, |
2248 | endpoint->bInterval); | 2248 | endpoint->bInterval); |
2249 | if ((rc = usb_submit_urb(ucs->urb_int_in, SLAB_KERNEL)) != 0) { | 2249 | if ((rc = usb_submit_urb(ucs->urb_int_in, GFP_KERNEL)) != 0) { |
2250 | dev_err(cs->dev, "could not submit interrupt URB: %s\n", | 2250 | dev_err(cs->dev, "could not submit interrupt URB: %s\n", |
2251 | get_usb_rcmsg(rc)); | 2251 | get_usb_rcmsg(rc)); |
2252 | goto error; | 2252 | goto error; |
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c index 5ebf49ac9b23..04f2ad7ba8b0 100644 --- a/drivers/isdn/gigaset/usb-gigaset.c +++ b/drivers/isdn/gigaset/usb-gigaset.c | |||
@@ -410,7 +410,7 @@ static void gigaset_read_int_callback(struct urb *urb) | |||
410 | 410 | ||
411 | if (resubmit) { | 411 | if (resubmit) { |
412 | spin_lock_irqsave(&cs->lock, flags); | 412 | spin_lock_irqsave(&cs->lock, flags); |
413 | r = cs->connected ? usb_submit_urb(urb, SLAB_ATOMIC) : -ENODEV; | 413 | r = cs->connected ? usb_submit_urb(urb, GFP_ATOMIC) : -ENODEV; |
414 | spin_unlock_irqrestore(&cs->lock, flags); | 414 | spin_unlock_irqrestore(&cs->lock, flags); |
415 | if (r) | 415 | if (r) |
416 | dev_err(cs->dev, "error %d when resubmitting urb.\n", | 416 | dev_err(cs->dev, "error %d when resubmitting urb.\n", |
@@ -486,7 +486,7 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb) | |||
486 | atomic_set(&ucs->busy, 1); | 486 | atomic_set(&ucs->busy, 1); |
487 | 487 | ||
488 | spin_lock_irqsave(&cs->lock, flags); | 488 | spin_lock_irqsave(&cs->lock, flags); |
489 | status = cs->connected ? usb_submit_urb(ucs->bulk_out_urb, SLAB_ATOMIC) : -ENODEV; | 489 | status = cs->connected ? usb_submit_urb(ucs->bulk_out_urb, GFP_ATOMIC) : -ENODEV; |
490 | spin_unlock_irqrestore(&cs->lock, flags); | 490 | spin_unlock_irqrestore(&cs->lock, flags); |
491 | 491 | ||
492 | if (status) { | 492 | if (status) { |
@@ -664,7 +664,7 @@ static int write_modem(struct cardstate *cs) | |||
664 | ucs->bulk_out_endpointAddr & 0x0f), | 664 | ucs->bulk_out_endpointAddr & 0x0f), |
665 | ucs->bulk_out_buffer, count, | 665 | ucs->bulk_out_buffer, count, |
666 | gigaset_write_bulk_callback, cs); | 666 | gigaset_write_bulk_callback, cs); |
667 | ret = usb_submit_urb(ucs->bulk_out_urb, SLAB_ATOMIC); | 667 | ret = usb_submit_urb(ucs->bulk_out_urb, GFP_ATOMIC); |
668 | } else { | 668 | } else { |
669 | ret = -ENODEV; | 669 | ret = -ENODEV; |
670 | } | 670 | } |
@@ -763,7 +763,7 @@ static int gigaset_probe(struct usb_interface *interface, | |||
763 | goto error; | 763 | goto error; |
764 | } | 764 | } |
765 | 765 | ||
766 | ucs->bulk_out_urb = usb_alloc_urb(0, SLAB_KERNEL); | 766 | ucs->bulk_out_urb = usb_alloc_urb(0, GFP_KERNEL); |
767 | if (!ucs->bulk_out_urb) { | 767 | if (!ucs->bulk_out_urb) { |
768 | dev_err(cs->dev, "Couldn't allocate bulk_out_urb\n"); | 768 | dev_err(cs->dev, "Couldn't allocate bulk_out_urb\n"); |
769 | retval = -ENOMEM; | 769 | retval = -ENOMEM; |
@@ -774,7 +774,7 @@ static int gigaset_probe(struct usb_interface *interface, | |||
774 | 774 | ||
775 | atomic_set(&ucs->busy, 0); | 775 | atomic_set(&ucs->busy, 0); |
776 | 776 | ||
777 | ucs->read_urb = usb_alloc_urb(0, SLAB_KERNEL); | 777 | ucs->read_urb = usb_alloc_urb(0, GFP_KERNEL); |
778 | if (!ucs->read_urb) { | 778 | if (!ucs->read_urb) { |
779 | dev_err(cs->dev, "No free urbs available\n"); | 779 | dev_err(cs->dev, "No free urbs available\n"); |
780 | retval = -ENOMEM; | 780 | retval = -ENOMEM; |
@@ -797,7 +797,7 @@ static int gigaset_probe(struct usb_interface *interface, | |||
797 | gigaset_read_int_callback, | 797 | gigaset_read_int_callback, |
798 | cs->inbuf + 0, endpoint->bInterval); | 798 | cs->inbuf + 0, endpoint->bInterval); |
799 | 799 | ||
800 | retval = usb_submit_urb(ucs->read_urb, SLAB_KERNEL); | 800 | retval = usb_submit_urb(ucs->read_urb, GFP_KERNEL); |
801 | if (retval) { | 801 | if (retval) { |
802 | dev_err(cs->dev, "Could not submit URB (error %d)\n", -retval); | 802 | dev_err(cs->dev, "Could not submit URB (error %d)\n", -retval); |
803 | goto error; | 803 | goto error; |
diff --git a/drivers/isdn/hisax/isdnhdlc.h b/drivers/isdn/hisax/isdnhdlc.h index 269315988dc8..5655b5f9c48e 100644 --- a/drivers/isdn/hisax/isdnhdlc.h +++ b/drivers/isdn/hisax/isdnhdlc.h | |||
@@ -41,10 +41,10 @@ struct isdnhdlc_vars { | |||
41 | unsigned char shift_reg; | 41 | unsigned char shift_reg; |
42 | unsigned char ffvalue; | 42 | unsigned char ffvalue; |
43 | 43 | ||
44 | int data_received:1; // set if transferring data | 44 | unsigned int data_received:1; // set if transferring data |
45 | int dchannel:1; // set if D channel (send idle instead of flags) | 45 | unsigned int dchannel:1; // set if D channel (send idle instead of flags) |
46 | int do_adapt56:1; // set if 56K adaptation | 46 | unsigned int do_adapt56:1; // set if 56K adaptation |
47 | int do_closing:1; // set if in closing phase (need to send CRC + flag | 47 | unsigned int do_closing:1; // set if in closing phase (need to send CRC + flag |
48 | }; | 48 | }; |
49 | 49 | ||
50 | 50 | ||
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 9c39b98d5a5b..176142c61492 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -76,6 +76,12 @@ config LEDS_NET48XX | |||
76 | This option enables support for the Soekris net4801 and net4826 error | 76 | This option enables support for the Soekris net4801 and net4826 error |
77 | LED. | 77 | LED. |
78 | 78 | ||
79 | config LEDS_WRAP | ||
80 | tristate "LED Support for the WRAP series LEDs" | ||
81 | depends on LEDS_CLASS && SCx200_GPIO | ||
82 | help | ||
83 | This option enables support for the PCEngines WRAP programmable LEDs. | ||
84 | |||
79 | comment "LED Triggers" | 85 | comment "LED Triggers" |
80 | 86 | ||
81 | config LEDS_TRIGGERS | 87 | config LEDS_TRIGGERS |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 6aa2aed7539d..500de3dc962a 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -13,6 +13,7 @@ obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o | |||
13 | obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o | 13 | obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o |
14 | obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o | 14 | obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o |
15 | obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o | 15 | obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o |
16 | obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o | ||
16 | 17 | ||
17 | # LED Triggers | 18 | # LED Triggers |
18 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o | 19 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o |
diff --git a/drivers/leds/leds-wrap.c b/drivers/leds/leds-wrap.c new file mode 100644 index 000000000000..27fb2d8e991f --- /dev/null +++ b/drivers/leds/leds-wrap.c | |||
@@ -0,0 +1,142 @@ | |||
1 | /* | ||
2 | * LEDs driver for PCEngines WRAP | ||
3 | * | ||
4 | * Copyright (C) 2006 Kristian Kielhofner <kris@krisk.org> | ||
5 | * | ||
6 | * Based on leds-net48xx.c | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/leds.h> | ||
17 | #include <linux/err.h> | ||
18 | #include <asm/io.h> | ||
19 | #include <linux/scx200_gpio.h> | ||
20 | |||
21 | #define DRVNAME "wrap-led" | ||
22 | #define WRAP_ERROR_LED_GPIO 3 | ||
23 | #define WRAP_EXTRA_LED_GPIO 18 | ||
24 | |||
25 | static struct platform_device *pdev; | ||
26 | |||
27 | static void wrap_error_led_set(struct led_classdev *led_cdev, | ||
28 | enum led_brightness value) | ||
29 | { | ||
30 | if (value) | ||
31 | scx200_gpio_set_low(WRAP_ERROR_LED_GPIO); | ||
32 | else | ||
33 | scx200_gpio_set_high(WRAP_ERROR_LED_GPIO); | ||
34 | } | ||
35 | |||
36 | static void wrap_extra_led_set(struct led_classdev *led_cdev, | ||
37 | enum led_brightness value) | ||
38 | { | ||
39 | if (value) | ||
40 | scx200_gpio_set_low(WRAP_EXTRA_LED_GPIO); | ||
41 | else | ||
42 | scx200_gpio_set_high(WRAP_EXTRA_LED_GPIO); | ||
43 | } | ||
44 | |||
45 | static struct led_classdev wrap_error_led = { | ||
46 | .name = "wrap:error", | ||
47 | .brightness_set = wrap_error_led_set, | ||
48 | }; | ||
49 | |||
50 | static struct led_classdev wrap_extra_led = { | ||
51 | .name = "wrap:extra", | ||
52 | .brightness_set = wrap_extra_led_set, | ||
53 | }; | ||
54 | |||
55 | #ifdef CONFIG_PM | ||
56 | static int wrap_led_suspend(struct platform_device *dev, | ||
57 | pm_message_t state) | ||
58 | { | ||
59 | led_classdev_suspend(&wrap_error_led); | ||
60 | led_classdev_suspend(&wrap_extra_led); | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static int wrap_led_resume(struct platform_device *dev) | ||
65 | { | ||
66 | led_classdev_resume(&wrap_error_led); | ||
67 | led_classdev_resume(&wrap_extra_led); | ||
68 | return 0; | ||
69 | } | ||
70 | #else | ||
71 | #define wrap_led_suspend NULL | ||
72 | #define wrap_led_resume NULL | ||
73 | #endif | ||
74 | |||
75 | static int wrap_led_probe(struct platform_device *pdev) | ||
76 | { | ||
77 | int ret; | ||
78 | |||
79 | ret = led_classdev_register(&pdev->dev, &wrap_error_led); | ||
80 | if (ret == 0) { | ||
81 | ret = led_classdev_register(&pdev->dev, &wrap_extra_led); | ||
82 | if (ret < 0) | ||
83 | led_classdev_unregister(&wrap_error_led); | ||
84 | } | ||
85 | return ret; | ||
86 | } | ||
87 | |||
88 | static int wrap_led_remove(struct platform_device *pdev) | ||
89 | { | ||
90 | led_classdev_unregister(&wrap_error_led); | ||
91 | led_classdev_unregister(&wrap_extra_led); | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static struct platform_driver wrap_led_driver = { | ||
96 | .probe = wrap_led_probe, | ||
97 | .remove = wrap_led_remove, | ||
98 | .suspend = wrap_led_suspend, | ||
99 | .resume = wrap_led_resume, | ||
100 | .driver = { | ||
101 | .name = DRVNAME, | ||
102 | .owner = THIS_MODULE, | ||
103 | }, | ||
104 | }; | ||
105 | |||
106 | static int __init wrap_led_init(void) | ||
107 | { | ||
108 | int ret; | ||
109 | |||
110 | if (!scx200_gpio_present()) { | ||
111 | ret = -ENODEV; | ||
112 | goto out; | ||
113 | } | ||
114 | |||
115 | ret = platform_driver_register(&wrap_led_driver); | ||
116 | if (ret < 0) | ||
117 | goto out; | ||
118 | |||
119 | pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); | ||
120 | if (IS_ERR(pdev)) { | ||
121 | ret = PTR_ERR(pdev); | ||
122 | platform_driver_unregister(&wrap_led_driver); | ||
123 | goto out; | ||
124 | } | ||
125 | |||
126 | out: | ||
127 | return ret; | ||
128 | } | ||
129 | |||
130 | static void __exit wrap_led_exit(void) | ||
131 | { | ||
132 | platform_device_unregister(pdev); | ||
133 | platform_driver_unregister(&wrap_led_driver); | ||
134 | } | ||
135 | |||
136 | module_init(wrap_led_init); | ||
137 | module_exit(wrap_led_exit); | ||
138 | |||
139 | MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>"); | ||
140 | MODULE_DESCRIPTION("PCEngines WRAP LED driver"); | ||
141 | MODULE_LICENSE("GPL"); | ||
142 | |||
diff --git a/drivers/macintosh/apm_emu.c b/drivers/macintosh/apm_emu.c index 1293876a2ebd..8862a83b8d84 100644 --- a/drivers/macintosh/apm_emu.c +++ b/drivers/macintosh/apm_emu.c | |||
@@ -529,7 +529,8 @@ static int __init apm_emu_init(void) | |||
529 | if (apm_proc) | 529 | if (apm_proc) |
530 | apm_proc->owner = THIS_MODULE; | 530 | apm_proc->owner = THIS_MODULE; |
531 | 531 | ||
532 | misc_register(&apm_device); | 532 | if (misc_register(&apm_device) != 0) |
533 | printk(KERN_INFO "Could not create misc. device for apm\n"); | ||
533 | 534 | ||
534 | pmu_register_sleep_notifier(&apm_sleep_notifier); | 535 | pmu_register_sleep_notifier(&apm_sleep_notifier); |
535 | 536 | ||
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 13b953ae8ebc..3d3bf1643e73 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/suspend.h> | 24 | #include <linux/suspend.h> |
25 | #include <linux/kthread.h> | 25 | #include <linux/kthread.h> |
26 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
27 | #include <linux/freezer.h> | ||
27 | 28 | ||
28 | #include <asm/prom.h> | 29 | #include <asm/prom.h> |
29 | #include <asm/machdep.h> | 30 | #include <asm/machdep.h> |
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index e63ea1c1f3c1..c8558d4ed506 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <linux/interrupt.h> | 42 | #include <linux/interrupt.h> |
43 | #include <linux/device.h> | 43 | #include <linux/device.h> |
44 | #include <linux/sysdev.h> | 44 | #include <linux/sysdev.h> |
45 | #include <linux/suspend.h> | 45 | #include <linux/freezer.h> |
46 | #include <linux/syscalls.h> | 46 | #include <linux/syscalls.h> |
47 | #include <linux/cpu.h> | 47 | #include <linux/cpu.h> |
48 | #include <asm/prom.h> | 48 | #include <asm/prom.h> |
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c index ab3faa702d58..e947af982f93 100644 --- a/drivers/macintosh/windfarm_core.c +++ b/drivers/macintosh/windfarm_core.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/device.h> | 34 | #include <linux/device.h> |
35 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/freezer.h> | ||
37 | 38 | ||
38 | #include <asm/prom.h> | 39 | #include <asm/prom.h> |
39 | 40 | ||
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index ed2d4ef27fd8..a1086ee8cccd 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/atomic.h> | 20 | #include <asm/atomic.h> |
21 | #include <linux/scatterlist.h> | 21 | #include <linux/scatterlist.h> |
22 | #include <asm/page.h> | 22 | #include <asm/page.h> |
23 | #include <asm/unaligned.h> | ||
23 | 24 | ||
24 | #include "dm.h" | 25 | #include "dm.h" |
25 | 26 | ||
@@ -85,7 +86,10 @@ struct crypt_config { | |||
85 | */ | 86 | */ |
86 | struct crypt_iv_operations *iv_gen_ops; | 87 | struct crypt_iv_operations *iv_gen_ops; |
87 | char *iv_mode; | 88 | char *iv_mode; |
88 | struct crypto_cipher *iv_gen_private; | 89 | union { |
90 | struct crypto_cipher *essiv_tfm; | ||
91 | int benbi_shift; | ||
92 | } iv_gen_private; | ||
89 | sector_t iv_offset; | 93 | sector_t iv_offset; |
90 | unsigned int iv_size; | 94 | unsigned int iv_size; |
91 | 95 | ||
@@ -101,7 +105,7 @@ struct crypt_config { | |||
101 | #define MIN_POOL_PAGES 32 | 105 | #define MIN_POOL_PAGES 32 |
102 | #define MIN_BIO_PAGES 8 | 106 | #define MIN_BIO_PAGES 8 |
103 | 107 | ||
104 | static kmem_cache_t *_crypt_io_pool; | 108 | static struct kmem_cache *_crypt_io_pool; |
105 | 109 | ||
106 | /* | 110 | /* |
107 | * Different IV generation algorithms: | 111 | * Different IV generation algorithms: |
@@ -113,6 +117,9 @@ static kmem_cache_t *_crypt_io_pool; | |||
113 | * encrypted with the bulk cipher using a salt as key. The salt | 117 | * encrypted with the bulk cipher using a salt as key. The salt |
114 | * should be derived from the bulk cipher's key via hashing. | 118 | * should be derived from the bulk cipher's key via hashing. |
115 | * | 119 | * |
120 | * benbi: the 64-bit "big-endian 'narrow block'-count", starting at 1 | ||
121 | * (needed for LRW-32-AES and possible other narrow block modes) | ||
122 | * | ||
116 | * plumb: unimplemented, see: | 123 | * plumb: unimplemented, see: |
117 | * http://article.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/454 | 124 | * http://article.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/454 |
118 | */ | 125 | */ |
@@ -191,21 +198,61 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, | |||
191 | } | 198 | } |
192 | kfree(salt); | 199 | kfree(salt); |
193 | 200 | ||
194 | cc->iv_gen_private = essiv_tfm; | 201 | cc->iv_gen_private.essiv_tfm = essiv_tfm; |
195 | return 0; | 202 | return 0; |
196 | } | 203 | } |
197 | 204 | ||
198 | static void crypt_iv_essiv_dtr(struct crypt_config *cc) | 205 | static void crypt_iv_essiv_dtr(struct crypt_config *cc) |
199 | { | 206 | { |
200 | crypto_free_cipher(cc->iv_gen_private); | 207 | crypto_free_cipher(cc->iv_gen_private.essiv_tfm); |
201 | cc->iv_gen_private = NULL; | 208 | cc->iv_gen_private.essiv_tfm = NULL; |
202 | } | 209 | } |
203 | 210 | ||
204 | static int crypt_iv_essiv_gen(struct crypt_config *cc, u8 *iv, sector_t sector) | 211 | static int crypt_iv_essiv_gen(struct crypt_config *cc, u8 *iv, sector_t sector) |
205 | { | 212 | { |
206 | memset(iv, 0, cc->iv_size); | 213 | memset(iv, 0, cc->iv_size); |
207 | *(u64 *)iv = cpu_to_le64(sector); | 214 | *(u64 *)iv = cpu_to_le64(sector); |
208 | crypto_cipher_encrypt_one(cc->iv_gen_private, iv, iv); | 215 | crypto_cipher_encrypt_one(cc->iv_gen_private.essiv_tfm, iv, iv); |
216 | return 0; | ||
217 | } | ||
218 | |||
219 | static int crypt_iv_benbi_ctr(struct crypt_config *cc, struct dm_target *ti, | ||
220 | const char *opts) | ||
221 | { | ||
222 | unsigned int bs = crypto_blkcipher_blocksize(cc->tfm); | ||
223 | int log = long_log2(bs); | ||
224 | |||
225 | /* we need to calculate how far we must shift the sector count | ||
226 | * to get the cipher block count, we use this shift in _gen */ | ||
227 | |||
228 | if (1 << log != bs) { | ||
229 | ti->error = "cypher blocksize is not a power of 2"; | ||
230 | return -EINVAL; | ||
231 | } | ||
232 | |||
233 | if (log > 9) { | ||
234 | ti->error = "cypher blocksize is > 512"; | ||
235 | return -EINVAL; | ||
236 | } | ||
237 | |||
238 | cc->iv_gen_private.benbi_shift = 9 - log; | ||
239 | |||
240 | return 0; | ||
241 | } | ||
242 | |||
243 | static void crypt_iv_benbi_dtr(struct crypt_config *cc) | ||
244 | { | ||
245 | } | ||
246 | |||
247 | static int crypt_iv_benbi_gen(struct crypt_config *cc, u8 *iv, sector_t sector) | ||
248 | { | ||
249 | __be64 val; | ||
250 | |||
251 | memset(iv, 0, cc->iv_size - sizeof(u64)); /* rest is cleared below */ | ||
252 | |||
253 | val = cpu_to_be64(((u64)sector << cc->iv_gen_private.benbi_shift) + 1); | ||
254 | put_unaligned(val, (__be64 *)(iv + cc->iv_size - sizeof(u64))); | ||
255 | |||
209 | return 0; | 256 | return 0; |
210 | } | 257 | } |
211 | 258 | ||
@@ -219,13 +266,18 @@ static struct crypt_iv_operations crypt_iv_essiv_ops = { | |||
219 | .generator = crypt_iv_essiv_gen | 266 | .generator = crypt_iv_essiv_gen |
220 | }; | 267 | }; |
221 | 268 | ||
269 | static struct crypt_iv_operations crypt_iv_benbi_ops = { | ||
270 | .ctr = crypt_iv_benbi_ctr, | ||
271 | .dtr = crypt_iv_benbi_dtr, | ||
272 | .generator = crypt_iv_benbi_gen | ||
273 | }; | ||
222 | 274 | ||
223 | static int | 275 | static int |
224 | crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, | 276 | crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, |
225 | struct scatterlist *in, unsigned int length, | 277 | struct scatterlist *in, unsigned int length, |
226 | int write, sector_t sector) | 278 | int write, sector_t sector) |
227 | { | 279 | { |
228 | u8 iv[cc->iv_size]; | 280 | u8 iv[cc->iv_size] __attribute__ ((aligned(__alignof__(u64)))); |
229 | struct blkcipher_desc desc = { | 281 | struct blkcipher_desc desc = { |
230 | .tfm = cc->tfm, | 282 | .tfm = cc->tfm, |
231 | .info = iv, | 283 | .info = iv, |
@@ -768,7 +820,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
768 | cc->tfm = tfm; | 820 | cc->tfm = tfm; |
769 | 821 | ||
770 | /* | 822 | /* |
771 | * Choose ivmode. Valid modes: "plain", "essiv:<esshash>". | 823 | * Choose ivmode. Valid modes: "plain", "essiv:<esshash>", "benbi". |
772 | * See comments at iv code | 824 | * See comments at iv code |
773 | */ | 825 | */ |
774 | 826 | ||
@@ -778,6 +830,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
778 | cc->iv_gen_ops = &crypt_iv_plain_ops; | 830 | cc->iv_gen_ops = &crypt_iv_plain_ops; |
779 | else if (strcmp(ivmode, "essiv") == 0) | 831 | else if (strcmp(ivmode, "essiv") == 0) |
780 | cc->iv_gen_ops = &crypt_iv_essiv_ops; | 832 | cc->iv_gen_ops = &crypt_iv_essiv_ops; |
833 | else if (strcmp(ivmode, "benbi") == 0) | ||
834 | cc->iv_gen_ops = &crypt_iv_benbi_ops; | ||
781 | else { | 835 | else { |
782 | ti->error = "Invalid IV mode"; | 836 | ti->error = "Invalid IV mode"; |
783 | goto bad2; | 837 | goto bad2; |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index e77ee6fd1044..cf8bf052138e 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -101,7 +101,7 @@ typedef int (*action_fn) (struct pgpath *pgpath); | |||
101 | 101 | ||
102 | #define MIN_IOS 256 /* Mempool size */ | 102 | #define MIN_IOS 256 /* Mempool size */ |
103 | 103 | ||
104 | static kmem_cache_t *_mpio_cache; | 104 | static struct kmem_cache *_mpio_cache; |
105 | 105 | ||
106 | struct workqueue_struct *kmultipathd; | 106 | struct workqueue_struct *kmultipathd; |
107 | static void process_queued_ios(struct work_struct *work); | 107 | static void process_queued_ios(struct work_struct *work); |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 91c7aa1fed0e..b0ce2ce82278 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -88,8 +88,8 @@ struct pending_exception { | |||
88 | * Hash table mapping origin volumes to lists of snapshots and | 88 | * Hash table mapping origin volumes to lists of snapshots and |
89 | * a lock to protect it | 89 | * a lock to protect it |
90 | */ | 90 | */ |
91 | static kmem_cache_t *exception_cache; | 91 | static struct kmem_cache *exception_cache; |
92 | static kmem_cache_t *pending_cache; | 92 | static struct kmem_cache *pending_cache; |
93 | static mempool_t *pending_pool; | 93 | static mempool_t *pending_pool; |
94 | 94 | ||
95 | /* | 95 | /* |
@@ -228,7 +228,7 @@ static int init_exception_table(struct exception_table *et, uint32_t size) | |||
228 | return 0; | 228 | return 0; |
229 | } | 229 | } |
230 | 230 | ||
231 | static void exit_exception_table(struct exception_table *et, kmem_cache_t *mem) | 231 | static void exit_exception_table(struct exception_table *et, struct kmem_cache *mem) |
232 | { | 232 | { |
233 | struct list_head *slot; | 233 | struct list_head *slot; |
234 | struct exception *ex, *next; | 234 | struct exception *ex, *next; |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index fc4f743f3b53..7ec1b112a6d5 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -121,8 +121,8 @@ struct mapped_device { | |||
121 | }; | 121 | }; |
122 | 122 | ||
123 | #define MIN_IOS 256 | 123 | #define MIN_IOS 256 |
124 | static kmem_cache_t *_io_cache; | 124 | static struct kmem_cache *_io_cache; |
125 | static kmem_cache_t *_tio_cache; | 125 | static struct kmem_cache *_tio_cache; |
126 | 126 | ||
127 | static int __init local_init(void) | 127 | static int __init local_init(void) |
128 | { | 128 | { |
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c index b3c01496c737..b46f6c575f7e 100644 --- a/drivers/md/kcopyd.c +++ b/drivers/md/kcopyd.c | |||
@@ -203,7 +203,7 @@ struct kcopyd_job { | |||
203 | /* FIXME: this should scale with the number of pages */ | 203 | /* FIXME: this should scale with the number of pages */ |
204 | #define MIN_JOBS 512 | 204 | #define MIN_JOBS 512 |
205 | 205 | ||
206 | static kmem_cache_t *_job_cache; | 206 | static struct kmem_cache *_job_cache; |
207 | static mempool_t *_job_pool; | 207 | static mempool_t *_job_pool; |
208 | 208 | ||
209 | /* | 209 | /* |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 8cbf9c9df1c3..6c4345bde07e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -39,10 +39,10 @@ | |||
39 | #include <linux/raid/bitmap.h> | 39 | #include <linux/raid/bitmap.h> |
40 | #include <linux/sysctl.h> | 40 | #include <linux/sysctl.h> |
41 | #include <linux/buffer_head.h> /* for invalidate_bdev */ | 41 | #include <linux/buffer_head.h> /* for invalidate_bdev */ |
42 | #include <linux/suspend.h> | ||
43 | #include <linux/poll.h> | 42 | #include <linux/poll.h> |
44 | #include <linux/mutex.h> | 43 | #include <linux/mutex.h> |
45 | #include <linux/ctype.h> | 44 | #include <linux/ctype.h> |
45 | #include <linux/freezer.h> | ||
46 | 46 | ||
47 | #include <linux/init.h> | 47 | #include <linux/init.h> |
48 | 48 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 69c3e201fa3b..52914d5cec76 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -348,7 +348,7 @@ static int grow_one_stripe(raid5_conf_t *conf) | |||
348 | 348 | ||
349 | static int grow_stripes(raid5_conf_t *conf, int num) | 349 | static int grow_stripes(raid5_conf_t *conf, int num) |
350 | { | 350 | { |
351 | kmem_cache_t *sc; | 351 | struct kmem_cache *sc; |
352 | int devs = conf->raid_disks; | 352 | int devs = conf->raid_disks; |
353 | 353 | ||
354 | sprintf(conf->cache_name[0], "raid5/%s", mdname(conf->mddev)); | 354 | sprintf(conf->cache_name[0], "raid5/%s", mdname(conf->mddev)); |
@@ -397,7 +397,7 @@ static int resize_stripes(raid5_conf_t *conf, int newsize) | |||
397 | LIST_HEAD(newstripes); | 397 | LIST_HEAD(newstripes); |
398 | struct disk_info *ndisks; | 398 | struct disk_info *ndisks; |
399 | int err = 0; | 399 | int err = 0; |
400 | kmem_cache_t *sc; | 400 | struct kmem_cache *sc; |
401 | int i; | 401 | int i; |
402 | 402 | ||
403 | if (newsize <= conf->pool_size) | 403 | if (newsize <= conf->pool_size) |
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 206c13e47a06..9123147e376f 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -287,7 +287,7 @@ static int cinergyt2_alloc_stream_urbs (struct cinergyt2 *cinergyt2) | |||
287 | int i; | 287 | int i; |
288 | 288 | ||
289 | cinergyt2->streambuf = usb_buffer_alloc(cinergyt2->udev, STREAM_URB_COUNT*STREAM_BUF_SIZE, | 289 | cinergyt2->streambuf = usb_buffer_alloc(cinergyt2->udev, STREAM_URB_COUNT*STREAM_BUF_SIZE, |
290 | SLAB_KERNEL, &cinergyt2->streambuf_dmahandle); | 290 | GFP_KERNEL, &cinergyt2->streambuf_dmahandle); |
291 | if (!cinergyt2->streambuf) { | 291 | if (!cinergyt2->streambuf) { |
292 | dprintk(1, "failed to alloc consistent stream memory area, bailing out!\n"); | 292 | dprintk(1, "failed to alloc consistent stream memory area, bailing out!\n"); |
293 | return -ENOMEM; | 293 | return -ENOMEM; |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index a2ab2eebfc68..e85972222ab4 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
36 | #include <linux/list.h> | 36 | #include <linux/list.h> |
37 | #include <linux/suspend.h> | 37 | #include <linux/freezer.h> |
38 | #include <linux/jiffies.h> | 38 | #include <linux/jiffies.h> |
39 | #include <asm/processor.h> | 39 | #include <asm/processor.h> |
40 | 40 | ||
diff --git a/drivers/media/dvb/dvb-usb/usb-urb.c b/drivers/media/dvb/dvb-usb/usb-urb.c index 78035ee824ca..397f51a7b2ad 100644 --- a/drivers/media/dvb/dvb-usb/usb-urb.c +++ b/drivers/media/dvb/dvb-usb/usb-urb.c | |||
@@ -116,7 +116,7 @@ static int usb_allocate_stream_buffers(struct usb_data_stream *stream, int num, | |||
116 | for (stream->buf_num = 0; stream->buf_num < num; stream->buf_num++) { | 116 | for (stream->buf_num = 0; stream->buf_num < num; stream->buf_num++) { |
117 | deb_mem("allocating buffer %d\n",stream->buf_num); | 117 | deb_mem("allocating buffer %d\n",stream->buf_num); |
118 | if (( stream->buf_list[stream->buf_num] = | 118 | if (( stream->buf_list[stream->buf_num] = |
119 | usb_buffer_alloc(stream->udev, size, SLAB_ATOMIC, | 119 | usb_buffer_alloc(stream->udev, size, GFP_ATOMIC, |
120 | &stream->dma_addr[stream->buf_num]) ) == NULL) { | 120 | &stream->dma_addr[stream->buf_num]) ) == NULL) { |
121 | deb_mem("not enough memory for urb-buffer allocation.\n"); | 121 | deb_mem("not enough memory for urb-buffer allocation.\n"); |
122 | usb_free_stream_buffers(stream); | 122 | usb_free_stream_buffers(stream); |
diff --git a/drivers/media/dvb/frontends/l64781.c b/drivers/media/dvb/frontends/l64781.c index f3bc82e44a28..1aeacb1c4af7 100644 --- a/drivers/media/dvb/frontends/l64781.c +++ b/drivers/media/dvb/frontends/l64781.c | |||
@@ -36,7 +36,7 @@ struct l64781_state { | |||
36 | struct dvb_frontend frontend; | 36 | struct dvb_frontend frontend; |
37 | 37 | ||
38 | /* private demodulator data */ | 38 | /* private demodulator data */ |
39 | int first:1; | 39 | unsigned int first:1; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | #define dprintk(args...) \ | 42 | #define dprintk(args...) \ |
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 8135f3e76aeb..10b121ada833 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c | |||
@@ -1244,7 +1244,7 @@ static int ttusb_dec_init_usb(struct ttusb_dec *dec) | |||
1244 | return -ENOMEM; | 1244 | return -ENOMEM; |
1245 | } | 1245 | } |
1246 | dec->irq_buffer = usb_buffer_alloc(dec->udev,IRQ_PACKET_SIZE, | 1246 | dec->irq_buffer = usb_buffer_alloc(dec->udev,IRQ_PACKET_SIZE, |
1247 | SLAB_ATOMIC, &dec->irq_dma_handle); | 1247 | GFP_ATOMIC, &dec->irq_dma_handle); |
1248 | if(!dec->irq_buffer) { | 1248 | if(!dec->irq_buffer) { |
1249 | return -ENOMEM; | 1249 | return -ENOMEM; |
1250 | } | 1250 | } |
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index 6d96b17a7f81..920b63f8cf05 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig | |||
@@ -173,38 +173,6 @@ config RADIO_MAESTRO | |||
173 | To compile this driver as a module, choose M here: the | 173 | To compile this driver as a module, choose M here: the |
174 | module will be called radio-maestro. | 174 | module will be called radio-maestro. |
175 | 175 | ||
176 | config RADIO_MIROPCM20 | ||
177 | tristate "miroSOUND PCM20 radio" | ||
178 | depends on ISA && VIDEO_V4L1 && SOUND_ACI_MIXER | ||
179 | ---help--- | ||
180 | Choose Y here if you have this FM radio card. You also need to say Y | ||
181 | to "ACI mixer (miroSOUND PCM1-pro/PCM12/PCM20 radio)" (in "Sound") | ||
182 | for this to work. | ||
183 | |||
184 | In order to control your radio card, you will need to use programs | ||
185 | that are compatible with the Video For Linux API. Information on | ||
186 | this API and pointers to "v4l" programs may be found at | ||
187 | <file:Documentation/video4linux/API.html>. | ||
188 | |||
189 | To compile this driver as a module, choose M here: the | ||
190 | module will be called miropcm20. | ||
191 | |||
192 | config RADIO_MIROPCM20_RDS | ||
193 | tristate "miroSOUND PCM20 radio RDS user interface (EXPERIMENTAL)" | ||
194 | depends on RADIO_MIROPCM20 && EXPERIMENTAL | ||
195 | ---help--- | ||
196 | Choose Y here if you want to see RDS/RBDS information like | ||
197 | RadioText, Programme Service name, Clock Time and date, Programme | ||
198 | Type and Traffic Announcement/Programme identification. | ||
199 | |||
200 | It's not possible to read the raw RDS packets from the device, so | ||
201 | the driver cant provide an V4L interface for this. But the | ||
202 | availability of RDS is reported over V4L by the basic driver | ||
203 | already. Here RDS can be read from files in /dev/v4l/rds. | ||
204 | |||
205 | To compile this driver as a module, choose M here: the | ||
206 | module will be called miropcm20-rds. | ||
207 | |||
208 | config RADIO_SF16FMI | 176 | config RADIO_SF16FMI |
209 | tristate "SF16FMI Radio" | 177 | tristate "SF16FMI Radio" |
210 | depends on ISA && VIDEO_V4L2 | 178 | depends on ISA && VIDEO_V4L2 |
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index cf43df3fe708..e1b56dc13c3f 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -56,7 +56,7 @@ | |||
56 | #include <media/tvaudio.h> | 56 | #include <media/tvaudio.h> |
57 | #include <media/msp3400.h> | 57 | #include <media/msp3400.h> |
58 | #include <linux/kthread.h> | 58 | #include <linux/kthread.h> |
59 | #include <linux/suspend.h> | 59 | #include <linux/freezer.h> |
60 | #include "msp3400-driver.h" | 60 | #include "msp3400-driver.h" |
61 | 61 | ||
62 | /* ---------------------------------------------------------------------- */ | 62 | /* ---------------------------------------------------------------------- */ |
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index fcaef4bf8289..d506dfaa45a9 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/smp_lock.h> | 30 | #include <linux/smp_lock.h> |
31 | #include <linux/kthread.h> | 31 | #include <linux/kthread.h> |
32 | #include <linux/freezer.h> | ||
32 | 33 | ||
33 | #include <media/tvaudio.h> | 34 | #include <media/tvaudio.h> |
34 | #include <media/v4l2-common.h> | 35 | #include <media/v4l2-common.h> |
diff --git a/drivers/media/video/video-buf-dvb.c b/drivers/media/video/video-buf-dvb.c index f53edf1923b7..fcc5467e7636 100644 --- a/drivers/media/video/video-buf-dvb.c +++ b/drivers/media/video/video-buf-dvb.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/kthread.h> | 21 | #include <linux/kthread.h> |
22 | #include <linux/file.h> | 22 | #include <linux/file.h> |
23 | #include <linux/suspend.h> | 23 | #include <linux/freezer.h> |
24 | 24 | ||
25 | #include <media/video-buf.h> | 25 | #include <media/video-buf.h> |
26 | #include <media/video-buf-dvb.h> | 26 | #include <media/video-buf-dvb.h> |
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 3c8dc72dc8e9..9986de5cb3d6 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
37 | #include <linux/kthread.h> | 37 | #include <linux/kthread.h> |
38 | #include <linux/highmem.h> | 38 | #include <linux/highmem.h> |
39 | #include <linux/freezer.h> | ||
39 | 40 | ||
40 | /* Wake up at about 30 fps */ | 41 | /* Wake up at about 30 fps */ |
41 | #define WAKE_NUMERATOR 30 | 42 | #define WAKE_NUMERATOR 30 |
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 051b7c5b8f03..6e068cf1049b 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -347,7 +347,7 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa) | |||
347 | } | 347 | } |
348 | 348 | ||
349 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 349 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
350 | /* | 350 | /** |
351 | * mpt_interrupt - MPT adapter (IOC) specific interrupt handler. | 351 | * mpt_interrupt - MPT adapter (IOC) specific interrupt handler. |
352 | * @irq: irq number (not used) | 352 | * @irq: irq number (not used) |
353 | * @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure | 353 | * @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure |
@@ -387,14 +387,16 @@ mpt_interrupt(int irq, void *bus_id) | |||
387 | } | 387 | } |
388 | 388 | ||
389 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 389 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
390 | /* | 390 | /** |
391 | * mpt_base_reply - MPT base driver's callback routine; all base driver | 391 | * mpt_base_reply - MPT base driver's callback routine |
392 | * "internal" request/reply processing is routed here. | ||
393 | * Currently used for EventNotification and EventAck handling. | ||
394 | * @ioc: Pointer to MPT_ADAPTER structure | 392 | * @ioc: Pointer to MPT_ADAPTER structure |
395 | * @mf: Pointer to original MPT request frame | 393 | * @mf: Pointer to original MPT request frame |
396 | * @reply: Pointer to MPT reply frame (NULL if TurboReply) | 394 | * @reply: Pointer to MPT reply frame (NULL if TurboReply) |
397 | * | 395 | * |
396 | * MPT base driver's callback routine; all base driver | ||
397 | * "internal" request/reply processing is routed here. | ||
398 | * Currently used for EventNotification and EventAck handling. | ||
399 | * | ||
398 | * Returns 1 indicating original alloc'd request frame ptr | 400 | * Returns 1 indicating original alloc'd request frame ptr |
399 | * should be freed, or 0 if it shouldn't. | 401 | * should be freed, or 0 if it shouldn't. |
400 | */ | 402 | */ |
@@ -530,7 +532,7 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply) | |||
530 | * @dclass: Protocol driver's class (%MPT_DRIVER_CLASS enum value) | 532 | * @dclass: Protocol driver's class (%MPT_DRIVER_CLASS enum value) |
531 | * | 533 | * |
532 | * This routine is called by a protocol-specific driver (SCSI host, | 534 | * This routine is called by a protocol-specific driver (SCSI host, |
533 | * LAN, SCSI target) to register it's reply callback routine. Each | 535 | * LAN, SCSI target) to register its reply callback routine. Each |
534 | * protocol-specific driver must do this before it will be able to | 536 | * protocol-specific driver must do this before it will be able to |
535 | * use any IOC resources, such as obtaining request frames. | 537 | * use any IOC resources, such as obtaining request frames. |
536 | * | 538 | * |
@@ -572,7 +574,7 @@ mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass) | |||
572 | * mpt_deregister - Deregister a protocol drivers resources. | 574 | * mpt_deregister - Deregister a protocol drivers resources. |
573 | * @cb_idx: previously registered callback handle | 575 | * @cb_idx: previously registered callback handle |
574 | * | 576 | * |
575 | * Each protocol-specific driver should call this routine when it's | 577 | * Each protocol-specific driver should call this routine when its |
576 | * module is unloaded. | 578 | * module is unloaded. |
577 | */ | 579 | */ |
578 | void | 580 | void |
@@ -617,7 +619,7 @@ mpt_event_register(int cb_idx, MPT_EVHANDLER ev_cbfunc) | |||
617 | * | 619 | * |
618 | * Each protocol-specific driver should call this routine | 620 | * Each protocol-specific driver should call this routine |
619 | * when it does not (or can no longer) handle events, | 621 | * when it does not (or can no longer) handle events, |
620 | * or when it's module is unloaded. | 622 | * or when its module is unloaded. |
621 | */ | 623 | */ |
622 | void | 624 | void |
623 | mpt_event_deregister(int cb_idx) | 625 | mpt_event_deregister(int cb_idx) |
@@ -656,7 +658,7 @@ mpt_reset_register(int cb_idx, MPT_RESETHANDLER reset_func) | |||
656 | * | 658 | * |
657 | * Each protocol-specific driver should call this routine | 659 | * Each protocol-specific driver should call this routine |
658 | * when it does not (or can no longer) handle IOC reset handling, | 660 | * when it does not (or can no longer) handle IOC reset handling, |
659 | * or when it's module is unloaded. | 661 | * or when its module is unloaded. |
660 | */ | 662 | */ |
661 | void | 663 | void |
662 | mpt_reset_deregister(int cb_idx) | 664 | mpt_reset_deregister(int cb_idx) |
@@ -670,6 +672,8 @@ mpt_reset_deregister(int cb_idx) | |||
670 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 672 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
671 | /** | 673 | /** |
672 | * mpt_device_driver_register - Register device driver hooks | 674 | * mpt_device_driver_register - Register device driver hooks |
675 | * @dd_cbfunc: driver callbacks struct | ||
676 | * @cb_idx: MPT protocol driver index | ||
673 | */ | 677 | */ |
674 | int | 678 | int |
675 | mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx) | 679 | mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx) |
@@ -696,6 +700,7 @@ mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx) | |||
696 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 700 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
697 | /** | 701 | /** |
698 | * mpt_device_driver_deregister - DeRegister device driver hooks | 702 | * mpt_device_driver_deregister - DeRegister device driver hooks |
703 | * @cb_idx: MPT protocol driver index | ||
699 | */ | 704 | */ |
700 | void | 705 | void |
701 | mpt_device_driver_deregister(int cb_idx) | 706 | mpt_device_driver_deregister(int cb_idx) |
@@ -887,8 +892,7 @@ mpt_add_sge(char *pAddr, u32 flagslength, dma_addr_t dma_addr) | |||
887 | 892 | ||
888 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 893 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
889 | /** | 894 | /** |
890 | * mpt_send_handshake_request - Send MPT request via doorbell | 895 | * mpt_send_handshake_request - Send MPT request via doorbell handshake method. |
891 | * handshake method. | ||
892 | * @handle: Handle of registered MPT protocol driver | 896 | * @handle: Handle of registered MPT protocol driver |
893 | * @ioc: Pointer to MPT adapter structure | 897 | * @ioc: Pointer to MPT adapter structure |
894 | * @reqBytes: Size of the request in bytes | 898 | * @reqBytes: Size of the request in bytes |
@@ -981,10 +985,13 @@ mpt_send_handshake_request(int handle, MPT_ADAPTER *ioc, int reqBytes, u32 *req, | |||
981 | 985 | ||
982 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 986 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
983 | /** | 987 | /** |
984 | * mpt_host_page_access_control - provides mechanism for the host | 988 | * mpt_host_page_access_control - control the IOC's Host Page Buffer access |
985 | * driver to control the IOC's Host Page Buffer access. | ||
986 | * @ioc: Pointer to MPT adapter structure | 989 | * @ioc: Pointer to MPT adapter structure |
987 | * @access_control_value: define bits below | 990 | * @access_control_value: define bits below |
991 | * @sleepFlag: Specifies whether the process can sleep | ||
992 | * | ||
993 | * Provides mechanism for the host driver to control the IOC's | ||
994 | * Host Page Buffer access. | ||
988 | * | 995 | * |
989 | * Access Control Value - bits[15:12] | 996 | * Access Control Value - bits[15:12] |
990 | * 0h Reserved | 997 | * 0h Reserved |
@@ -1022,10 +1029,10 @@ mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_value, int slee | |||
1022 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1029 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1023 | /** | 1030 | /** |
1024 | * mpt_host_page_alloc - allocate system memory for the fw | 1031 | * mpt_host_page_alloc - allocate system memory for the fw |
1025 | * If we already allocated memory in past, then resend the same pointer. | 1032 | * @ioc: Pointer to pointer to IOC adapter |
1026 | * ioc@: Pointer to pointer to IOC adapter | 1033 | * @ioc_init: Pointer to ioc init config page |
1027 | * ioc_init@: Pointer to ioc init config page | ||
1028 | * | 1034 | * |
1035 | * If we already allocated memory in past, then resend the same pointer. | ||
1029 | * Returns 0 for success, non-zero for failure. | 1036 | * Returns 0 for success, non-zero for failure. |
1030 | */ | 1037 | */ |
1031 | static int | 1038 | static int |
@@ -1091,12 +1098,15 @@ return 0; | |||
1091 | 1098 | ||
1092 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1099 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1093 | /** | 1100 | /** |
1094 | * mpt_verify_adapter - Given a unique IOC identifier, set pointer to | 1101 | * mpt_verify_adapter - Given IOC identifier, set pointer to its adapter structure. |
1095 | * the associated MPT adapter structure. | ||
1096 | * @iocid: IOC unique identifier (integer) | 1102 | * @iocid: IOC unique identifier (integer) |
1097 | * @iocpp: Pointer to pointer to IOC adapter | 1103 | * @iocpp: Pointer to pointer to IOC adapter |
1098 | * | 1104 | * |
1099 | * Returns iocid and sets iocpp. | 1105 | * Given a unique IOC identifier, set pointer to the associated MPT |
1106 | * adapter structure. | ||
1107 | * | ||
1108 | * Returns iocid and sets iocpp if iocid is found. | ||
1109 | * Returns -1 if iocid is not found. | ||
1100 | */ | 1110 | */ |
1101 | int | 1111 | int |
1102 | mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp) | 1112 | mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp) |
@@ -1115,9 +1125,10 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp) | |||
1115 | } | 1125 | } |
1116 | 1126 | ||
1117 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1127 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1118 | /* | 1128 | /** |
1119 | * mpt_attach - Install a PCI intelligent MPT adapter. | 1129 | * mpt_attach - Install a PCI intelligent MPT adapter. |
1120 | * @pdev: Pointer to pci_dev structure | 1130 | * @pdev: Pointer to pci_dev structure |
1131 | * @id: PCI device ID information | ||
1121 | * | 1132 | * |
1122 | * This routine performs all the steps necessary to bring the IOC of | 1133 | * This routine performs all the steps necessary to bring the IOC of |
1123 | * a MPT adapter to a OPERATIONAL state. This includes registering | 1134 | * a MPT adapter to a OPERATIONAL state. This includes registering |
@@ -1417,10 +1428,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1417 | } | 1428 | } |
1418 | 1429 | ||
1419 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1430 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1420 | /* | 1431 | /** |
1421 | * mpt_detach - Remove a PCI intelligent MPT adapter. | 1432 | * mpt_detach - Remove a PCI intelligent MPT adapter. |
1422 | * @pdev: Pointer to pci_dev structure | 1433 | * @pdev: Pointer to pci_dev structure |
1423 | * | ||
1424 | */ | 1434 | */ |
1425 | 1435 | ||
1426 | void | 1436 | void |
@@ -1466,10 +1476,10 @@ mpt_detach(struct pci_dev *pdev) | |||
1466 | */ | 1476 | */ |
1467 | #ifdef CONFIG_PM | 1477 | #ifdef CONFIG_PM |
1468 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1478 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1469 | /* | 1479 | /** |
1470 | * mpt_suspend - Fusion MPT base driver suspend routine. | 1480 | * mpt_suspend - Fusion MPT base driver suspend routine. |
1471 | * | 1481 | * @pdev: Pointer to pci_dev structure |
1472 | * | 1482 | * @state: new state to enter |
1473 | */ | 1483 | */ |
1474 | int | 1484 | int |
1475 | mpt_suspend(struct pci_dev *pdev, pm_message_t state) | 1485 | mpt_suspend(struct pci_dev *pdev, pm_message_t state) |
@@ -1505,10 +1515,9 @@ mpt_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1505 | } | 1515 | } |
1506 | 1516 | ||
1507 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1517 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1508 | /* | 1518 | /** |
1509 | * mpt_resume - Fusion MPT base driver resume routine. | 1519 | * mpt_resume - Fusion MPT base driver resume routine. |
1510 | * | 1520 | * @pdev: Pointer to pci_dev structure |
1511 | * | ||
1512 | */ | 1521 | */ |
1513 | int | 1522 | int |
1514 | mpt_resume(struct pci_dev *pdev) | 1523 | mpt_resume(struct pci_dev *pdev) |
@@ -1566,7 +1575,7 @@ mpt_signal_reset(int index, MPT_ADAPTER *ioc, int reset_phase) | |||
1566 | } | 1575 | } |
1567 | 1576 | ||
1568 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1577 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1569 | /* | 1578 | /** |
1570 | * mpt_do_ioc_recovery - Initialize or recover MPT adapter. | 1579 | * mpt_do_ioc_recovery - Initialize or recover MPT adapter. |
1571 | * @ioc: Pointer to MPT adapter structure | 1580 | * @ioc: Pointer to MPT adapter structure |
1572 | * @reason: Event word / reason | 1581 | * @reason: Event word / reason |
@@ -1892,13 +1901,15 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
1892 | } | 1901 | } |
1893 | 1902 | ||
1894 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1903 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1895 | /* | 1904 | /** |
1896 | * mpt_detect_bound_ports - Search for PCI bus/dev_function | 1905 | * mpt_detect_bound_ports - Search for matching PCI bus/dev_function |
1897 | * which matches PCI bus/dev_function (+/-1) for newly discovered 929, | ||
1898 | * 929X, 1030 or 1035. | ||
1899 | * @ioc: Pointer to MPT adapter structure | 1906 | * @ioc: Pointer to MPT adapter structure |
1900 | * @pdev: Pointer to (struct pci_dev) structure | 1907 | * @pdev: Pointer to (struct pci_dev) structure |
1901 | * | 1908 | * |
1909 | * Search for PCI bus/dev_function which matches | ||
1910 | * PCI bus/dev_function (+/-1) for newly discovered 929, | ||
1911 | * 929X, 1030 or 1035. | ||
1912 | * | ||
1902 | * If match on PCI dev_function +/-1 is found, bind the two MPT adapters | 1913 | * If match on PCI dev_function +/-1 is found, bind the two MPT adapters |
1903 | * using alt_ioc pointer fields in their %MPT_ADAPTER structures. | 1914 | * using alt_ioc pointer fields in their %MPT_ADAPTER structures. |
1904 | */ | 1915 | */ |
@@ -1945,9 +1956,9 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev) | |||
1945 | } | 1956 | } |
1946 | 1957 | ||
1947 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1958 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1948 | /* | 1959 | /** |
1949 | * mpt_adapter_disable - Disable misbehaving MPT adapter. | 1960 | * mpt_adapter_disable - Disable misbehaving MPT adapter. |
1950 | * @this: Pointer to MPT adapter structure | 1961 | * @ioc: Pointer to MPT adapter structure |
1951 | */ | 1962 | */ |
1952 | static void | 1963 | static void |
1953 | mpt_adapter_disable(MPT_ADAPTER *ioc) | 1964 | mpt_adapter_disable(MPT_ADAPTER *ioc) |
@@ -2046,9 +2057,8 @@ mpt_adapter_disable(MPT_ADAPTER *ioc) | |||
2046 | } | 2057 | } |
2047 | 2058 | ||
2048 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2059 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2049 | /* | 2060 | /** |
2050 | * mpt_adapter_dispose - Free all resources associated with a MPT | 2061 | * mpt_adapter_dispose - Free all resources associated with an MPT adapter |
2051 | * adapter. | ||
2052 | * @ioc: Pointer to MPT adapter structure | 2062 | * @ioc: Pointer to MPT adapter structure |
2053 | * | 2063 | * |
2054 | * This routine unregisters h/w resources and frees all alloc'd memory | 2064 | * This routine unregisters h/w resources and frees all alloc'd memory |
@@ -2099,8 +2109,8 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc) | |||
2099 | } | 2109 | } |
2100 | 2110 | ||
2101 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2111 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2102 | /* | 2112 | /** |
2103 | * MptDisplayIocCapabilities - Disply IOC's capacilities. | 2113 | * MptDisplayIocCapabilities - Disply IOC's capabilities. |
2104 | * @ioc: Pointer to MPT adapter structure | 2114 | * @ioc: Pointer to MPT adapter structure |
2105 | */ | 2115 | */ |
2106 | static void | 2116 | static void |
@@ -2142,7 +2152,7 @@ MptDisplayIocCapabilities(MPT_ADAPTER *ioc) | |||
2142 | } | 2152 | } |
2143 | 2153 | ||
2144 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2154 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2145 | /* | 2155 | /** |
2146 | * MakeIocReady - Get IOC to a READY state, using KickStart if needed. | 2156 | * MakeIocReady - Get IOC to a READY state, using KickStart if needed. |
2147 | * @ioc: Pointer to MPT_ADAPTER structure | 2157 | * @ioc: Pointer to MPT_ADAPTER structure |
2148 | * @force: Force hard KickStart of IOC | 2158 | * @force: Force hard KickStart of IOC |
@@ -2279,7 +2289,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag) | |||
2279 | } | 2289 | } |
2280 | 2290 | ||
2281 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2291 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2282 | /* | 2292 | /** |
2283 | * mpt_GetIocState - Get the current state of a MPT adapter. | 2293 | * mpt_GetIocState - Get the current state of a MPT adapter. |
2284 | * @ioc: Pointer to MPT_ADAPTER structure | 2294 | * @ioc: Pointer to MPT_ADAPTER structure |
2285 | * @cooked: Request raw or cooked IOC state | 2295 | * @cooked: Request raw or cooked IOC state |
@@ -2304,7 +2314,7 @@ mpt_GetIocState(MPT_ADAPTER *ioc, int cooked) | |||
2304 | } | 2314 | } |
2305 | 2315 | ||
2306 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2316 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2307 | /* | 2317 | /** |
2308 | * GetIocFacts - Send IOCFacts request to MPT adapter. | 2318 | * GetIocFacts - Send IOCFacts request to MPT adapter. |
2309 | * @ioc: Pointer to MPT_ADAPTER structure | 2319 | * @ioc: Pointer to MPT_ADAPTER structure |
2310 | * @sleepFlag: Specifies whether the process can sleep | 2320 | * @sleepFlag: Specifies whether the process can sleep |
@@ -2478,7 +2488,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason) | |||
2478 | } | 2488 | } |
2479 | 2489 | ||
2480 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2490 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2481 | /* | 2491 | /** |
2482 | * GetPortFacts - Send PortFacts request to MPT adapter. | 2492 | * GetPortFacts - Send PortFacts request to MPT adapter. |
2483 | * @ioc: Pointer to MPT_ADAPTER structure | 2493 | * @ioc: Pointer to MPT_ADAPTER structure |
2484 | * @portnum: Port number | 2494 | * @portnum: Port number |
@@ -2545,7 +2555,7 @@ GetPortFacts(MPT_ADAPTER *ioc, int portnum, int sleepFlag) | |||
2545 | } | 2555 | } |
2546 | 2556 | ||
2547 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2557 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2548 | /* | 2558 | /** |
2549 | * SendIocInit - Send IOCInit request to MPT adapter. | 2559 | * SendIocInit - Send IOCInit request to MPT adapter. |
2550 | * @ioc: Pointer to MPT_ADAPTER structure | 2560 | * @ioc: Pointer to MPT_ADAPTER structure |
2551 | * @sleepFlag: Specifies whether the process can sleep | 2561 | * @sleepFlag: Specifies whether the process can sleep |
@@ -2630,7 +2640,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag) | |||
2630 | } | 2640 | } |
2631 | 2641 | ||
2632 | /* No need to byte swap the multibyte fields in the reply | 2642 | /* No need to byte swap the multibyte fields in the reply |
2633 | * since we don't even look at it's contents. | 2643 | * since we don't even look at its contents. |
2634 | */ | 2644 | */ |
2635 | 2645 | ||
2636 | dhsprintk((MYIOC_s_INFO_FMT "Sending PortEnable (req @ %p)\n", | 2646 | dhsprintk((MYIOC_s_INFO_FMT "Sending PortEnable (req @ %p)\n", |
@@ -2672,7 +2682,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag) | |||
2672 | } | 2682 | } |
2673 | 2683 | ||
2674 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2684 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2675 | /* | 2685 | /** |
2676 | * SendPortEnable - Send PortEnable request to MPT adapter port. | 2686 | * SendPortEnable - Send PortEnable request to MPT adapter port. |
2677 | * @ioc: Pointer to MPT_ADAPTER structure | 2687 | * @ioc: Pointer to MPT_ADAPTER structure |
2678 | * @portnum: Port number to enable | 2688 | * @portnum: Port number to enable |
@@ -2723,9 +2733,13 @@ SendPortEnable(MPT_ADAPTER *ioc, int portnum, int sleepFlag) | |||
2723 | return rc; | 2733 | return rc; |
2724 | } | 2734 | } |
2725 | 2735 | ||
2726 | /* | 2736 | /** |
2727 | * ioc: Pointer to MPT_ADAPTER structure | 2737 | * mpt_alloc_fw_memory - allocate firmware memory |
2728 | * size - total FW bytes | 2738 | * @ioc: Pointer to MPT_ADAPTER structure |
2739 | * @size: total FW bytes | ||
2740 | * | ||
2741 | * If memory has already been allocated, the same (cached) value | ||
2742 | * is returned. | ||
2729 | */ | 2743 | */ |
2730 | void | 2744 | void |
2731 | mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size) | 2745 | mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size) |
@@ -2742,9 +2756,12 @@ mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size) | |||
2742 | ioc->alloc_total += size; | 2756 | ioc->alloc_total += size; |
2743 | } | 2757 | } |
2744 | } | 2758 | } |
2745 | /* | 2759 | /** |
2746 | * If alt_img is NULL, delete from ioc structure. | 2760 | * mpt_free_fw_memory - free firmware memory |
2747 | * Else, delete a secondary image in same format. | 2761 | * @ioc: Pointer to MPT_ADAPTER structure |
2762 | * | ||
2763 | * If alt_img is NULL, delete from ioc structure. | ||
2764 | * Else, delete a secondary image in same format. | ||
2748 | */ | 2765 | */ |
2749 | void | 2766 | void |
2750 | mpt_free_fw_memory(MPT_ADAPTER *ioc) | 2767 | mpt_free_fw_memory(MPT_ADAPTER *ioc) |
@@ -2763,7 +2780,7 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc) | |||
2763 | 2780 | ||
2764 | 2781 | ||
2765 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2782 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2766 | /* | 2783 | /** |
2767 | * mpt_do_upload - Construct and Send FWUpload request to MPT adapter port. | 2784 | * mpt_do_upload - Construct and Send FWUpload request to MPT adapter port. |
2768 | * @ioc: Pointer to MPT_ADAPTER structure | 2785 | * @ioc: Pointer to MPT_ADAPTER structure |
2769 | * @sleepFlag: Specifies whether the process can sleep | 2786 | * @sleepFlag: Specifies whether the process can sleep |
@@ -2865,10 +2882,10 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag) | |||
2865 | } | 2882 | } |
2866 | 2883 | ||
2867 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2884 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2868 | /* | 2885 | /** |
2869 | * mpt_downloadboot - DownloadBoot code | 2886 | * mpt_downloadboot - DownloadBoot code |
2870 | * @ioc: Pointer to MPT_ADAPTER structure | 2887 | * @ioc: Pointer to MPT_ADAPTER structure |
2871 | * @flag: Specify which part of IOC memory is to be uploaded. | 2888 | * @pFwHeader: Pointer to firmware header info |
2872 | * @sleepFlag: Specifies whether the process can sleep | 2889 | * @sleepFlag: Specifies whether the process can sleep |
2873 | * | 2890 | * |
2874 | * FwDownloadBoot requires Programmed IO access. | 2891 | * FwDownloadBoot requires Programmed IO access. |
@@ -3071,7 +3088,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag) | |||
3071 | } | 3088 | } |
3072 | 3089 | ||
3073 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 3090 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
3074 | /* | 3091 | /** |
3075 | * KickStart - Perform hard reset of MPT adapter. | 3092 | * KickStart - Perform hard reset of MPT adapter. |
3076 | * @ioc: Pointer to MPT_ADAPTER structure | 3093 | * @ioc: Pointer to MPT_ADAPTER structure |
3077 | * @force: Force hard reset | 3094 | * @force: Force hard reset |
@@ -3145,12 +3162,12 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag) | |||
3145 | } | 3162 | } |
3146 | 3163 | ||
3147 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 3164 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
3148 | /* | 3165 | /** |
3149 | * mpt_diag_reset - Perform hard reset of the adapter. | 3166 | * mpt_diag_reset - Perform hard reset of the adapter. |
3150 | * @ioc: Pointer to MPT_ADAPTER structure | 3167 | * @ioc: Pointer to MPT_ADAPTER structure |
3151 | * @ignore: Set if to honor and clear to ignore | 3168 | * @ignore: Set if to honor and clear to ignore |
3152 | * the reset history bit | 3169 | * the reset history bit |
3153 | * @sleepflag: CAN_SLEEP if called in a non-interrupt thread, | 3170 | * @sleepFlag: CAN_SLEEP if called in a non-interrupt thread, |
3154 | * else set to NO_SLEEP (use mdelay instead) | 3171 | * else set to NO_SLEEP (use mdelay instead) |
3155 | * | 3172 | * |
3156 | * This routine places the adapter in diagnostic mode via the | 3173 | * This routine places the adapter in diagnostic mode via the |
@@ -3436,11 +3453,12 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag) | |||
3436 | } | 3453 | } |
3437 | 3454 | ||
3438 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 3455 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
3439 | /* | 3456 | /** |
3440 | * SendIocReset - Send IOCReset request to MPT adapter. | 3457 | * SendIocReset - Send IOCReset request to MPT adapter. |
3441 | * @ioc: Pointer to MPT_ADAPTER structure | 3458 | * @ioc: Pointer to MPT_ADAPTER structure |
3442 | * @reset_type: reset type, expected values are | 3459 | * @reset_type: reset type, expected values are |
3443 | * %MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET or %MPI_FUNCTION_IO_UNIT_RESET | 3460 | * %MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET or %MPI_FUNCTION_IO_UNIT_RESET |
3461 | * @sleepFlag: Specifies whether the process can sleep | ||
3444 | * | 3462 | * |
3445 | * Send IOCReset request to the MPT adapter. | 3463 | * Send IOCReset request to the MPT adapter. |
3446 | * | 3464 | * |
@@ -3494,11 +3512,12 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_type, int sleepFlag) | |||
3494 | } | 3512 | } |
3495 | 3513 | ||
3496 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 3514 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
3497 | /* | 3515 | /** |
3498 | * initChainBuffers - Allocate memory for and initialize | 3516 | * initChainBuffers - Allocate memory for and initialize chain buffers |
3499 | * chain buffers, chain buffer control arrays and spinlock. | 3517 | * @ioc: Pointer to MPT_ADAPTER structure |
3500 | * @hd: Pointer to MPT_SCSI_HOST structure | 3518 | * |
3501 | * @init: If set, initialize the spin lock. | 3519 | * Allocates memory for and initializes chain buffers, |
3520 | * chain buffer control arrays and spinlock. | ||
3502 | */ | 3521 | */ |
3503 | static int | 3522 | static int |
3504 | initChainBuffers(MPT_ADAPTER *ioc) | 3523 | initChainBuffers(MPT_ADAPTER *ioc) |
@@ -3594,7 +3613,7 @@ initChainBuffers(MPT_ADAPTER *ioc) | |||
3594 | } | 3613 | } |
3595 | 3614 | ||
3596 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 3615 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
3597 | /* | 3616 | /** |
3598 | * PrimeIocFifos - Initialize IOC request and reply FIFOs. | 3617 | * PrimeIocFifos - Initialize IOC request and reply FIFOs. |
3599 | * @ioc: Pointer to MPT_ADAPTER structure | 3618 | * @ioc: Pointer to MPT_ADAPTER structure |
3600 | * | 3619 | * |
@@ -3891,15 +3910,15 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req, | |||
3891 | } | 3910 | } |
3892 | 3911 | ||
3893 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 3912 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
3894 | /* | 3913 | /** |
3895 | * WaitForDoorbellAck - Wait for IOC to clear the IOP_DOORBELL_STATUS bit | 3914 | * WaitForDoorbellAck - Wait for IOC doorbell handshake acknowledge |
3896 | * in it's IntStatus register. | ||
3897 | * @ioc: Pointer to MPT_ADAPTER structure | 3915 | * @ioc: Pointer to MPT_ADAPTER structure |
3898 | * @howlong: How long to wait (in seconds) | 3916 | * @howlong: How long to wait (in seconds) |
3899 | * @sleepFlag: Specifies whether the process can sleep | 3917 | * @sleepFlag: Specifies whether the process can sleep |
3900 | * | 3918 | * |
3901 | * This routine waits (up to ~2 seconds max) for IOC doorbell | 3919 | * This routine waits (up to ~2 seconds max) for IOC doorbell |
3902 | * handshake ACKnowledge. | 3920 | * handshake ACKnowledge, indicated by the IOP_DOORBELL_STATUS |
3921 | * bit in its IntStatus register being clear. | ||
3903 | * | 3922 | * |
3904 | * Returns a negative value on failure, else wait loop count. | 3923 | * Returns a negative value on failure, else wait loop count. |
3905 | */ | 3924 | */ |
@@ -3942,14 +3961,14 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag) | |||
3942 | } | 3961 | } |
3943 | 3962 | ||
3944 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 3963 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
3945 | /* | 3964 | /** |
3946 | * WaitForDoorbellInt - Wait for IOC to set the HIS_DOORBELL_INTERRUPT bit | 3965 | * WaitForDoorbellInt - Wait for IOC to set its doorbell interrupt bit |
3947 | * in it's IntStatus register. | ||
3948 | * @ioc: Pointer to MPT_ADAPTER structure | 3966 | * @ioc: Pointer to MPT_ADAPTER structure |
3949 | * @howlong: How long to wait (in seconds) | 3967 | * @howlong: How long to wait (in seconds) |
3950 | * @sleepFlag: Specifies whether the process can sleep | 3968 | * @sleepFlag: Specifies whether the process can sleep |
3951 | * | 3969 | * |
3952 | * This routine waits (up to ~2 seconds max) for IOC doorbell interrupt. | 3970 | * This routine waits (up to ~2 seconds max) for IOC doorbell interrupt |
3971 | * (MPI_HIS_DOORBELL_INTERRUPT) to be set in the IntStatus register. | ||
3953 | * | 3972 | * |
3954 | * Returns a negative value on failure, else wait loop count. | 3973 | * Returns a negative value on failure, else wait loop count. |
3955 | */ | 3974 | */ |
@@ -3991,8 +4010,8 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag) | |||
3991 | } | 4010 | } |
3992 | 4011 | ||
3993 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 4012 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
3994 | /* | 4013 | /** |
3995 | * WaitForDoorbellReply - Wait for and capture a IOC handshake reply. | 4014 | * WaitForDoorbellReply - Wait for and capture an IOC handshake reply. |
3996 | * @ioc: Pointer to MPT_ADAPTER structure | 4015 | * @ioc: Pointer to MPT_ADAPTER structure |
3997 | * @howlong: How long to wait (in seconds) | 4016 | * @howlong: How long to wait (in seconds) |
3998 | * @sleepFlag: Specifies whether the process can sleep | 4017 | * @sleepFlag: Specifies whether the process can sleep |
@@ -4077,7 +4096,7 @@ WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag) | |||
4077 | } | 4096 | } |
4078 | 4097 | ||
4079 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 4098 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
4080 | /* | 4099 | /** |
4081 | * GetLanConfigPages - Fetch LANConfig pages. | 4100 | * GetLanConfigPages - Fetch LANConfig pages. |
4082 | * @ioc: Pointer to MPT_ADAPTER structure | 4101 | * @ioc: Pointer to MPT_ADAPTER structure |
4083 | * | 4102 | * |
@@ -4188,12 +4207,9 @@ GetLanConfigPages(MPT_ADAPTER *ioc) | |||
4188 | } | 4207 | } |
4189 | 4208 | ||
4190 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 4209 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
4191 | /* | 4210 | /** |
4192 | * mptbase_sas_persist_operation - Perform operation on SAS Persitent Table | 4211 | * mptbase_sas_persist_operation - Perform operation on SAS Persistent Table |
4193 | * @ioc: Pointer to MPT_ADAPTER structure | 4212 | * @ioc: Pointer to MPT_ADAPTER structure |
4194 | * @sas_address: 64bit SAS Address for operation. | ||
4195 | * @target_id: specified target for operation | ||
4196 | * @bus: specified bus for operation | ||
4197 | * @persist_opcode: see below | 4213 | * @persist_opcode: see below |
4198 | * | 4214 | * |
4199 | * MPI_SAS_OP_CLEAR_NOT_PRESENT - Free all persist TargetID mappings for | 4215 | * MPI_SAS_OP_CLEAR_NOT_PRESENT - Free all persist TargetID mappings for |
@@ -4202,7 +4218,7 @@ GetLanConfigPages(MPT_ADAPTER *ioc) | |||
4202 | * | 4218 | * |
4203 | * NOTE: Don't use not this function during interrupt time. | 4219 | * NOTE: Don't use not this function during interrupt time. |
4204 | * | 4220 | * |
4205 | * Returns: 0 for success, non-zero error | 4221 | * Returns 0 for success, non-zero error |
4206 | */ | 4222 | */ |
4207 | 4223 | ||
4208 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 4224 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
@@ -4399,7 +4415,7 @@ mptbase_raid_process_event_data(MPT_ADAPTER *ioc, | |||
4399 | } | 4415 | } |
4400 | 4416 | ||
4401 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 4417 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
4402 | /* | 4418 | /** |
4403 | * GetIoUnitPage2 - Retrieve BIOS version and boot order information. | 4419 | * GetIoUnitPage2 - Retrieve BIOS version and boot order information. |
4404 | * @ioc: Pointer to MPT_ADAPTER structure | 4420 | * @ioc: Pointer to MPT_ADAPTER structure |
4405 | * | 4421 | * |
@@ -4457,7 +4473,8 @@ GetIoUnitPage2(MPT_ADAPTER *ioc) | |||
4457 | } | 4473 | } |
4458 | 4474 | ||
4459 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 4475 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
4460 | /* mpt_GetScsiPortSettings - read SCSI Port Page 0 and 2 | 4476 | /** |
4477 | * mpt_GetScsiPortSettings - read SCSI Port Page 0 and 2 | ||
4461 | * @ioc: Pointer to a Adapter Strucutre | 4478 | * @ioc: Pointer to a Adapter Strucutre |
4462 | * @portnum: IOC port number | 4479 | * @portnum: IOC port number |
4463 | * | 4480 | * |
@@ -4644,7 +4661,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum) | |||
4644 | } | 4661 | } |
4645 | 4662 | ||
4646 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 4663 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
4647 | /* mpt_readScsiDevicePageHeaders - save version and length of SDP1 | 4664 | /** |
4665 | * mpt_readScsiDevicePageHeaders - save version and length of SDP1 | ||
4648 | * @ioc: Pointer to a Adapter Strucutre | 4666 | * @ioc: Pointer to a Adapter Strucutre |
4649 | * @portnum: IOC port number | 4667 | * @portnum: IOC port number |
4650 | * | 4668 | * |
@@ -4996,9 +5014,8 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc) | |||
4996 | } | 5014 | } |
4997 | 5015 | ||
4998 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5016 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
4999 | /* | 5017 | /** |
5000 | * SendEventNotification - Send EventNotification (on or off) request | 5018 | * SendEventNotification - Send EventNotification (on or off) request to adapter |
5001 | * to MPT adapter. | ||
5002 | * @ioc: Pointer to MPT_ADAPTER structure | 5019 | * @ioc: Pointer to MPT_ADAPTER structure |
5003 | * @EvSwitch: Event switch flags | 5020 | * @EvSwitch: Event switch flags |
5004 | */ | 5021 | */ |
@@ -5062,8 +5079,8 @@ SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp) | |||
5062 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5079 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5063 | /** | 5080 | /** |
5064 | * mpt_config - Generic function to issue config message | 5081 | * mpt_config - Generic function to issue config message |
5065 | * @ioc - Pointer to an adapter structure | 5082 | * @ioc: Pointer to an adapter structure |
5066 | * @cfg - Pointer to a configuration structure. Struct contains | 5083 | * @pCfg: Pointer to a configuration structure. Struct contains |
5067 | * action, page address, direction, physical address | 5084 | * action, page address, direction, physical address |
5068 | * and pointer to a configuration page header | 5085 | * and pointer to a configuration page header |
5069 | * Page header is updated. | 5086 | * Page header is updated. |
@@ -5188,8 +5205,8 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg) | |||
5188 | } | 5205 | } |
5189 | 5206 | ||
5190 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5207 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5191 | /* | 5208 | /** |
5192 | * mpt_timer_expired - Call back for timer process. | 5209 | * mpt_timer_expired - Callback for timer process. |
5193 | * Used only internal config functionality. | 5210 | * Used only internal config functionality. |
5194 | * @data: Pointer to MPT_SCSI_HOST recast as an unsigned long | 5211 | * @data: Pointer to MPT_SCSI_HOST recast as an unsigned long |
5195 | */ | 5212 | */ |
@@ -5214,12 +5231,12 @@ mpt_timer_expired(unsigned long data) | |||
5214 | } | 5231 | } |
5215 | 5232 | ||
5216 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5233 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5217 | /* | 5234 | /** |
5218 | * mpt_ioc_reset - Base cleanup for hard reset | 5235 | * mpt_ioc_reset - Base cleanup for hard reset |
5219 | * @ioc: Pointer to the adapter structure | 5236 | * @ioc: Pointer to the adapter structure |
5220 | * @reset_phase: Indicates pre- or post-reset functionality | 5237 | * @reset_phase: Indicates pre- or post-reset functionality |
5221 | * | 5238 | * |
5222 | * Remark: Free's resources with internally generated commands. | 5239 | * Remark: Frees resources with internally generated commands. |
5223 | */ | 5240 | */ |
5224 | static int | 5241 | static int |
5225 | mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | 5242 | mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) |
@@ -5271,7 +5288,7 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
5271 | * procfs (%MPT_PROCFS_MPTBASEDIR/...) support stuff... | 5288 | * procfs (%MPT_PROCFS_MPTBASEDIR/...) support stuff... |
5272 | */ | 5289 | */ |
5273 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5290 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5274 | /* | 5291 | /** |
5275 | * procmpt_create - Create %MPT_PROCFS_MPTBASEDIR entries. | 5292 | * procmpt_create - Create %MPT_PROCFS_MPTBASEDIR entries. |
5276 | * | 5293 | * |
5277 | * Returns 0 for success, non-zero for failure. | 5294 | * Returns 0 for success, non-zero for failure. |
@@ -5297,7 +5314,7 @@ procmpt_create(void) | |||
5297 | } | 5314 | } |
5298 | 5315 | ||
5299 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5316 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5300 | /* | 5317 | /** |
5301 | * procmpt_destroy - Tear down %MPT_PROCFS_MPTBASEDIR entries. | 5318 | * procmpt_destroy - Tear down %MPT_PROCFS_MPTBASEDIR entries. |
5302 | * | 5319 | * |
5303 | * Returns 0 for success, non-zero for failure. | 5320 | * Returns 0 for success, non-zero for failure. |
@@ -5311,16 +5328,16 @@ procmpt_destroy(void) | |||
5311 | } | 5328 | } |
5312 | 5329 | ||
5313 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5330 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5314 | /* | 5331 | /** |
5315 | * procmpt_summary_read - Handle read request from /proc/mpt/summary | 5332 | * procmpt_summary_read - Handle read request of a summary file |
5316 | * or from /proc/mpt/iocN/summary. | ||
5317 | * @buf: Pointer to area to write information | 5333 | * @buf: Pointer to area to write information |
5318 | * @start: Pointer to start pointer | 5334 | * @start: Pointer to start pointer |
5319 | * @offset: Offset to start writing | 5335 | * @offset: Offset to start writing |
5320 | * @request: | 5336 | * @request: Amount of read data requested |
5321 | * @eof: Pointer to EOF integer | 5337 | * @eof: Pointer to EOF integer |
5322 | * @data: Pointer | 5338 | * @data: Pointer |
5323 | * | 5339 | * |
5340 | * Handles read request from /proc/mpt/summary or /proc/mpt/iocN/summary. | ||
5324 | * Returns number of characters written to process performing the read. | 5341 | * Returns number of characters written to process performing the read. |
5325 | */ | 5342 | */ |
5326 | static int | 5343 | static int |
@@ -5355,12 +5372,12 @@ procmpt_summary_read(char *buf, char **start, off_t offset, int request, int *eo | |||
5355 | } | 5372 | } |
5356 | 5373 | ||
5357 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5374 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5358 | /* | 5375 | /** |
5359 | * procmpt_version_read - Handle read request from /proc/mpt/version. | 5376 | * procmpt_version_read - Handle read request from /proc/mpt/version. |
5360 | * @buf: Pointer to area to write information | 5377 | * @buf: Pointer to area to write information |
5361 | * @start: Pointer to start pointer | 5378 | * @start: Pointer to start pointer |
5362 | * @offset: Offset to start writing | 5379 | * @offset: Offset to start writing |
5363 | * @request: | 5380 | * @request: Amount of read data requested |
5364 | * @eof: Pointer to EOF integer | 5381 | * @eof: Pointer to EOF integer |
5365 | * @data: Pointer | 5382 | * @data: Pointer |
5366 | * | 5383 | * |
@@ -5411,12 +5428,12 @@ procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eo | |||
5411 | } | 5428 | } |
5412 | 5429 | ||
5413 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5430 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5414 | /* | 5431 | /** |
5415 | * procmpt_iocinfo_read - Handle read request from /proc/mpt/iocN/info. | 5432 | * procmpt_iocinfo_read - Handle read request from /proc/mpt/iocN/info. |
5416 | * @buf: Pointer to area to write information | 5433 | * @buf: Pointer to area to write information |
5417 | * @start: Pointer to start pointer | 5434 | * @start: Pointer to start pointer |
5418 | * @offset: Offset to start writing | 5435 | * @offset: Offset to start writing |
5419 | * @request: | 5436 | * @request: Amount of read data requested |
5420 | * @eof: Pointer to EOF integer | 5437 | * @eof: Pointer to EOF integer |
5421 | * @data: Pointer | 5438 | * @data: Pointer |
5422 | * | 5439 | * |
@@ -5577,16 +5594,17 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh | |||
5577 | */ | 5594 | */ |
5578 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5595 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5579 | /** | 5596 | /** |
5580 | * mpt_HardResetHandler - Generic reset handler, issue SCSI Task | 5597 | * mpt_HardResetHandler - Generic reset handler |
5581 | * Management call based on input arg values. If TaskMgmt fails, | ||
5582 | * return associated SCSI request. | ||
5583 | * @ioc: Pointer to MPT_ADAPTER structure | 5598 | * @ioc: Pointer to MPT_ADAPTER structure |
5584 | * @sleepFlag: Indicates if sleep or schedule must be called. | 5599 | * @sleepFlag: Indicates if sleep or schedule must be called. |
5585 | * | 5600 | * |
5601 | * Issues SCSI Task Management call based on input arg values. | ||
5602 | * If TaskMgmt fails, returns associated SCSI request. | ||
5603 | * | ||
5586 | * Remark: _HardResetHandler can be invoked from an interrupt thread (timer) | 5604 | * Remark: _HardResetHandler can be invoked from an interrupt thread (timer) |
5587 | * or a non-interrupt thread. In the former, must not call schedule(). | 5605 | * or a non-interrupt thread. In the former, must not call schedule(). |
5588 | * | 5606 | * |
5589 | * Remark: A return of -1 is a FATAL error case, as it means a | 5607 | * Note: A return of -1 is a FATAL error case, as it means a |
5590 | * FW reload/initialization failed. | 5608 | * FW reload/initialization failed. |
5591 | * | 5609 | * |
5592 | * Returns 0 for SUCCESS or -1 if FAILED. | 5610 | * Returns 0 for SUCCESS or -1 if FAILED. |
@@ -5935,13 +5953,14 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr) | |||
5935 | } | 5953 | } |
5936 | 5954 | ||
5937 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5955 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5938 | /* | 5956 | /** |
5939 | * ProcessEventNotification - Route a received EventNotificationReply to | 5957 | * ProcessEventNotification - Route EventNotificationReply to all event handlers |
5940 | * all currently regeistered event handlers. | ||
5941 | * @ioc: Pointer to MPT_ADAPTER structure | 5958 | * @ioc: Pointer to MPT_ADAPTER structure |
5942 | * @pEventReply: Pointer to EventNotification reply frame | 5959 | * @pEventReply: Pointer to EventNotification reply frame |
5943 | * @evHandlers: Pointer to integer, number of event handlers | 5960 | * @evHandlers: Pointer to integer, number of event handlers |
5944 | * | 5961 | * |
5962 | * Routes a received EventNotificationReply to all currently registered | ||
5963 | * event handlers. | ||
5945 | * Returns sum of event handlers return values. | 5964 | * Returns sum of event handlers return values. |
5946 | */ | 5965 | */ |
5947 | static int | 5966 | static int |
@@ -6056,7 +6075,7 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply | |||
6056 | } | 6075 | } |
6057 | 6076 | ||
6058 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6077 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
6059 | /* | 6078 | /** |
6060 | * mpt_fc_log_info - Log information returned from Fibre Channel IOC. | 6079 | * mpt_fc_log_info - Log information returned from Fibre Channel IOC. |
6061 | * @ioc: Pointer to MPT_ADAPTER structure | 6080 | * @ioc: Pointer to MPT_ADAPTER structure |
6062 | * @log_info: U32 LogInfo reply word from the IOC | 6081 | * @log_info: U32 LogInfo reply word from the IOC |
@@ -6077,7 +6096,7 @@ mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info) | |||
6077 | } | 6096 | } |
6078 | 6097 | ||
6079 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6098 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
6080 | /* | 6099 | /** |
6081 | * mpt_spi_log_info - Log information returned from SCSI Parallel IOC. | 6100 | * mpt_spi_log_info - Log information returned from SCSI Parallel IOC. |
6082 | * @ioc: Pointer to MPT_ADAPTER structure | 6101 | * @ioc: Pointer to MPT_ADAPTER structure |
6083 | * @mr: Pointer to MPT reply frame | 6102 | * @mr: Pointer to MPT reply frame |
@@ -6200,7 +6219,7 @@ mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info) | |||
6200 | }; | 6219 | }; |
6201 | 6220 | ||
6202 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6221 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
6203 | /* | 6222 | /** |
6204 | * mpt_sas_log_info - Log information returned from SAS IOC. | 6223 | * mpt_sas_log_info - Log information returned from SAS IOC. |
6205 | * @ioc: Pointer to MPT_ADAPTER structure | 6224 | * @ioc: Pointer to MPT_ADAPTER structure |
6206 | * @log_info: U32 LogInfo reply word from the IOC | 6225 | * @log_info: U32 LogInfo reply word from the IOC |
@@ -6255,7 +6274,7 @@ union loginfo_type { | |||
6255 | } | 6274 | } |
6256 | 6275 | ||
6257 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6276 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
6258 | /* | 6277 | /** |
6259 | * mpt_sp_ioc_info - IOC information returned from SCSI Parallel IOC. | 6278 | * mpt_sp_ioc_info - IOC information returned from SCSI Parallel IOC. |
6260 | * @ioc: Pointer to MPT_ADAPTER structure | 6279 | * @ioc: Pointer to MPT_ADAPTER structure |
6261 | * @ioc_status: U32 IOCStatus word from IOC | 6280 | * @ioc_status: U32 IOCStatus word from IOC |
@@ -6416,7 +6435,7 @@ EXPORT_SYMBOL(mpt_free_fw_memory); | |||
6416 | EXPORT_SYMBOL(mptbase_sas_persist_operation); | 6435 | EXPORT_SYMBOL(mptbase_sas_persist_operation); |
6417 | 6436 | ||
6418 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6437 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
6419 | /* | 6438 | /** |
6420 | * fusion_init - Fusion MPT base driver initialization routine. | 6439 | * fusion_init - Fusion MPT base driver initialization routine. |
6421 | * | 6440 | * |
6422 | * Returns 0 for success, non-zero for failure. | 6441 | * Returns 0 for success, non-zero for failure. |
@@ -6456,7 +6475,7 @@ fusion_init(void) | |||
6456 | } | 6475 | } |
6457 | 6476 | ||
6458 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6477 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
6459 | /* | 6478 | /** |
6460 | * fusion_exit - Perform driver unload cleanup. | 6479 | * fusion_exit - Perform driver unload cleanup. |
6461 | * | 6480 | * |
6462 | * This routine frees all resources associated with each MPT adapter | 6481 | * This routine frees all resources associated with each MPT adapter |
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index ef2b55e19910..ca2f9107f145 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
@@ -1395,8 +1395,7 @@ mptfc_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
1395 | 1395 | ||
1396 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1396 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1397 | /** | 1397 | /** |
1398 | * mptfc_init - Register MPT adapter(s) as SCSI host(s) with | 1398 | * mptfc_init - Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer. |
1399 | * linux scsi mid-layer. | ||
1400 | * | 1399 | * |
1401 | * Returns 0 for success, non-zero for failure. | 1400 | * Returns 0 for success, non-zero for failure. |
1402 | */ | 1401 | */ |
@@ -1440,7 +1439,7 @@ mptfc_init(void) | |||
1440 | 1439 | ||
1441 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1440 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1442 | /** | 1441 | /** |
1443 | * mptfc_remove - Removed fc infrastructure for devices | 1442 | * mptfc_remove - Remove fc infrastructure for devices |
1444 | * @pdev: Pointer to pci_dev structure | 1443 | * @pdev: Pointer to pci_dev structure |
1445 | * | 1444 | * |
1446 | */ | 1445 | */ |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 30524dc54b16..2c72c36b8171 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -1230,15 +1230,15 @@ mptscsih_host_info(MPT_ADAPTER *ioc, char *pbuf, off_t offset, int len) | |||
1230 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1230 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1231 | /** | 1231 | /** |
1232 | * mptscsih_proc_info - Return information about MPT adapter | 1232 | * mptscsih_proc_info - Return information about MPT adapter |
1233 | * @host: scsi host struct | ||
1234 | * @buffer: if write, user data; if read, buffer for user | ||
1235 | * @start: returns the buffer address | ||
1236 | * @offset: if write, 0; if read, the current offset into the buffer from | ||
1237 | * the previous read. | ||
1238 | * @length: if write, return length; | ||
1239 | * @func: write = 1; read = 0 | ||
1233 | * | 1240 | * |
1234 | * (linux scsi_host_template.info routine) | 1241 | * (linux scsi_host_template.info routine) |
1235 | * | ||
1236 | * buffer: if write, user data; if read, buffer for user | ||
1237 | * length: if write, return length; | ||
1238 | * offset: if write, 0; if read, the current offset into the buffer from | ||
1239 | * the previous read. | ||
1240 | * hostno: scsi host number | ||
1241 | * func: if write = 1; if read = 0 | ||
1242 | */ | 1242 | */ |
1243 | int | 1243 | int |
1244 | mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | 1244 | mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, |
@@ -1902,8 +1902,7 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt) | |||
1902 | 1902 | ||
1903 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1903 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1904 | /** | 1904 | /** |
1905 | * mptscsih_host_reset - Perform a SCSI host adapter RESET! | 1905 | * mptscsih_host_reset - Perform a SCSI host adapter RESET (new_eh variant) |
1906 | * new_eh variant | ||
1907 | * @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to | 1906 | * @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to |
1908 | * | 1907 | * |
1909 | * (linux scsi_host_template.eh_host_reset_handler routine) | 1908 | * (linux scsi_host_template.eh_host_reset_handler routine) |
@@ -1949,8 +1948,7 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt) | |||
1949 | 1948 | ||
1950 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1949 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1951 | /** | 1950 | /** |
1952 | * mptscsih_tm_pending_wait - wait for pending task management request to | 1951 | * mptscsih_tm_pending_wait - wait for pending task management request to complete |
1953 | * complete. | ||
1954 | * @hd: Pointer to MPT host structure. | 1952 | * @hd: Pointer to MPT host structure. |
1955 | * | 1953 | * |
1956 | * Returns {SUCCESS,FAILED}. | 1954 | * Returns {SUCCESS,FAILED}. |
@@ -1982,6 +1980,7 @@ mptscsih_tm_pending_wait(MPT_SCSI_HOST * hd) | |||
1982 | /** | 1980 | /** |
1983 | * mptscsih_tm_wait_for_completion - wait for completion of TM task | 1981 | * mptscsih_tm_wait_for_completion - wait for completion of TM task |
1984 | * @hd: Pointer to MPT host structure. | 1982 | * @hd: Pointer to MPT host structure. |
1983 | * @timeout: timeout in seconds | ||
1985 | * | 1984 | * |
1986 | * Returns {SUCCESS,FAILED}. | 1985 | * Returns {SUCCESS,FAILED}. |
1987 | */ | 1986 | */ |
@@ -3429,8 +3428,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io) | |||
3429 | /** | 3428 | /** |
3430 | * mptscsih_synchronize_cache - Send SYNCHRONIZE_CACHE to all disks. | 3429 | * mptscsih_synchronize_cache - Send SYNCHRONIZE_CACHE to all disks. |
3431 | * @hd: Pointer to a SCSI HOST structure | 3430 | * @hd: Pointer to a SCSI HOST structure |
3432 | * @vtarget: per device private data | 3431 | * @vdevice: virtual target device |
3433 | * @lun: lun | ||
3434 | * | 3432 | * |
3435 | * Uses the ISR, but with special processing. | 3433 | * Uses the ISR, but with special processing. |
3436 | * MUST be single-threaded. | 3434 | * MUST be single-threaded. |
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index f422c0d0621c..36641da59289 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c | |||
@@ -1100,8 +1100,7 @@ static struct pci_driver mptspi_driver = { | |||
1100 | 1100 | ||
1101 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1101 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1102 | /** | 1102 | /** |
1103 | * mptspi_init - Register MPT adapter(s) as SCSI host(s) with | 1103 | * mptspi_init - Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer. |
1104 | * linux scsi mid-layer. | ||
1105 | * | 1104 | * |
1106 | * Returns 0 for success, non-zero for failure. | 1105 | * Returns 0 for success, non-zero for failure. |
1107 | */ | 1106 | */ |
@@ -1135,7 +1134,6 @@ mptspi_init(void) | |||
1135 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1134 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1136 | /** | 1135 | /** |
1137 | * mptspi_exit - Unregisters MPT adapter(s) | 1136 | * mptspi_exit - Unregisters MPT adapter(s) |
1138 | * | ||
1139 | */ | 1137 | */ |
1140 | static void __exit | 1138 | static void __exit |
1141 | mptspi_exit(void) | 1139 | mptspi_exit(void) |
diff --git a/drivers/message/i2o/bus-osm.c b/drivers/message/i2o/bus-osm.c index d96c687aee93..c463dc2efc09 100644 --- a/drivers/message/i2o/bus-osm.c +++ b/drivers/message/i2o/bus-osm.c | |||
@@ -56,6 +56,9 @@ static int i2o_bus_scan(struct i2o_device *dev) | |||
56 | /** | 56 | /** |
57 | * i2o_bus_store_scan - Scan the I2O Bus Adapter | 57 | * i2o_bus_store_scan - Scan the I2O Bus Adapter |
58 | * @d: device which should be scanned | 58 | * @d: device which should be scanned |
59 | * @attr: device_attribute | ||
60 | * @buf: output buffer | ||
61 | * @count: buffer size | ||
59 | * | 62 | * |
60 | * Returns count. | 63 | * Returns count. |
61 | */ | 64 | */ |
diff --git a/drivers/message/i2o/device.c b/drivers/message/i2o/device.c index ee183053fa23..b9df143e4ff1 100644 --- a/drivers/message/i2o/device.c +++ b/drivers/message/i2o/device.c | |||
@@ -54,8 +54,8 @@ static inline int i2o_device_issue_claim(struct i2o_device *dev, u32 cmd, | |||
54 | * @dev: I2O device to claim | 54 | * @dev: I2O device to claim |
55 | * @drv: I2O driver which wants to claim the device | 55 | * @drv: I2O driver which wants to claim the device |
56 | * | 56 | * |
57 | * Do the leg work to assign a device to a given OSM. If the claim succeed | 57 | * Do the leg work to assign a device to a given OSM. If the claim succeeds, |
58 | * the owner of the rimary. If the attempt fails a negative errno code | 58 | * the owner is the primary. If the attempt fails a negative errno code |
59 | * is returned. On success zero is returned. | 59 | * is returned. On success zero is returned. |
60 | */ | 60 | */ |
61 | int i2o_device_claim(struct i2o_device *dev) | 61 | int i2o_device_claim(struct i2o_device *dev) |
@@ -208,24 +208,23 @@ static struct i2o_device *i2o_device_alloc(void) | |||
208 | 208 | ||
209 | /** | 209 | /** |
210 | * i2o_device_add - allocate a new I2O device and add it to the IOP | 210 | * i2o_device_add - allocate a new I2O device and add it to the IOP |
211 | * @iop: I2O controller where the device is on | 211 | * @c: I2O controller that the device is on |
212 | * @entry: LCT entry of the I2O device | 212 | * @entry: LCT entry of the I2O device |
213 | * | 213 | * |
214 | * Allocate a new I2O device and initialize it with the LCT entry. The | 214 | * Allocate a new I2O device and initialize it with the LCT entry. The |
215 | * device is appended to the device list of the controller. | 215 | * device is appended to the device list of the controller. |
216 | * | 216 | * |
217 | * Returns a pointer to the I2O device on success or negative error code | 217 | * Returns zero on success, or a -ve errno. |
218 | * on failure. | ||
219 | */ | 218 | */ |
220 | static struct i2o_device *i2o_device_add(struct i2o_controller *c, | 219 | static int i2o_device_add(struct i2o_controller *c, i2o_lct_entry *entry) |
221 | i2o_lct_entry * entry) | ||
222 | { | 220 | { |
223 | struct i2o_device *i2o_dev, *tmp; | 221 | struct i2o_device *i2o_dev, *tmp; |
222 | int rc; | ||
224 | 223 | ||
225 | i2o_dev = i2o_device_alloc(); | 224 | i2o_dev = i2o_device_alloc(); |
226 | if (IS_ERR(i2o_dev)) { | 225 | if (IS_ERR(i2o_dev)) { |
227 | printk(KERN_ERR "i2o: unable to allocate i2o device\n"); | 226 | printk(KERN_ERR "i2o: unable to allocate i2o device\n"); |
228 | return i2o_dev; | 227 | return PTR_ERR(i2o_dev); |
229 | } | 228 | } |
230 | 229 | ||
231 | i2o_dev->lct_data = *entry; | 230 | i2o_dev->lct_data = *entry; |
@@ -236,7 +235,9 @@ static struct i2o_device *i2o_device_add(struct i2o_controller *c, | |||
236 | i2o_dev->iop = c; | 235 | i2o_dev->iop = c; |
237 | i2o_dev->device.parent = &c->device; | 236 | i2o_dev->device.parent = &c->device; |
238 | 237 | ||
239 | device_register(&i2o_dev->device); | 238 | rc = device_register(&i2o_dev->device); |
239 | if (rc) | ||
240 | goto err; | ||
240 | 241 | ||
241 | list_add_tail(&i2o_dev->list, &c->devices); | 242 | list_add_tail(&i2o_dev->list, &c->devices); |
242 | 243 | ||
@@ -270,12 +271,16 @@ static struct i2o_device *i2o_device_add(struct i2o_controller *c, | |||
270 | 271 | ||
271 | pr_debug("i2o: device %s added\n", i2o_dev->device.bus_id); | 272 | pr_debug("i2o: device %s added\n", i2o_dev->device.bus_id); |
272 | 273 | ||
273 | return i2o_dev; | 274 | return 0; |
275 | |||
276 | err: | ||
277 | kfree(i2o_dev); | ||
278 | return rc; | ||
274 | } | 279 | } |
275 | 280 | ||
276 | /** | 281 | /** |
277 | * i2o_device_remove - remove an I2O device from the I2O core | 282 | * i2o_device_remove - remove an I2O device from the I2O core |
278 | * @dev: I2O device which should be released | 283 | * @i2o_dev: I2O device which should be released |
279 | * | 284 | * |
280 | * Is used on I2O controller removal or LCT modification, when the device | 285 | * Is used on I2O controller removal or LCT modification, when the device |
281 | * is removed from the system. Note that the device could still hang | 286 | * is removed from the system. Note that the device could still hang |
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c index 7fc7399bd2ec..9104b65ff70f 100644 --- a/drivers/message/i2o/driver.c +++ b/drivers/message/i2o/driver.c | |||
@@ -34,9 +34,7 @@ static spinlock_t i2o_drivers_lock; | |||
34 | static struct i2o_driver **i2o_drivers; | 34 | static struct i2o_driver **i2o_drivers; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * i2o_bus_match - Tell if a I2O device class id match the class ids of | 37 | * i2o_bus_match - Tell if I2O device class id matches the class ids of the I2O driver (OSM) |
38 | * the I2O driver (OSM) | ||
39 | * | ||
40 | * @dev: device which should be verified | 38 | * @dev: device which should be verified |
41 | * @drv: the driver to match against | 39 | * @drv: the driver to match against |
42 | * | 40 | * |
@@ -248,7 +246,7 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m) | |||
248 | 246 | ||
249 | /** | 247 | /** |
250 | * i2o_driver_notify_controller_add_all - Send notify of added controller | 248 | * i2o_driver_notify_controller_add_all - Send notify of added controller |
251 | * to all I2O drivers | 249 | * @c: newly added controller |
252 | * | 250 | * |
253 | * Send notifications to all registered drivers that a new controller was | 251 | * Send notifications to all registered drivers that a new controller was |
254 | * added. | 252 | * added. |
@@ -267,8 +265,8 @@ void i2o_driver_notify_controller_add_all(struct i2o_controller *c) | |||
267 | } | 265 | } |
268 | 266 | ||
269 | /** | 267 | /** |
270 | * i2o_driver_notify_controller_remove_all - Send notify of removed | 268 | * i2o_driver_notify_controller_remove_all - Send notify of removed controller |
271 | * controller to all I2O drivers | 269 | * @c: controller that is being removed |
272 | * | 270 | * |
273 | * Send notifications to all registered drivers that a controller was | 271 | * Send notifications to all registered drivers that a controller was |
274 | * removed. | 272 | * removed. |
@@ -287,8 +285,8 @@ void i2o_driver_notify_controller_remove_all(struct i2o_controller *c) | |||
287 | } | 285 | } |
288 | 286 | ||
289 | /** | 287 | /** |
290 | * i2o_driver_notify_device_add_all - Send notify of added device to all | 288 | * i2o_driver_notify_device_add_all - Send notify of added device |
291 | * I2O drivers | 289 | * @i2o_dev: newly added I2O device |
292 | * | 290 | * |
293 | * Send notifications to all registered drivers that a device was added. | 291 | * Send notifications to all registered drivers that a device was added. |
294 | */ | 292 | */ |
@@ -306,8 +304,8 @@ void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev) | |||
306 | } | 304 | } |
307 | 305 | ||
308 | /** | 306 | /** |
309 | * i2o_driver_notify_device_remove_all - Send notify of removed device to | 307 | * i2o_driver_notify_device_remove_all - Send notify of removed device |
310 | * all I2O drivers | 308 | * @i2o_dev: device that is being removed |
311 | * | 309 | * |
312 | * Send notifications to all registered drivers that a device was removed. | 310 | * Send notifications to all registered drivers that a device was removed. |
313 | */ | 311 | */ |
@@ -362,7 +360,7 @@ int __init i2o_driver_init(void) | |||
362 | /** | 360 | /** |
363 | * i2o_driver_exit - clean up I2O drivers (OSMs) | 361 | * i2o_driver_exit - clean up I2O drivers (OSMs) |
364 | * | 362 | * |
365 | * Unregisters the I2O bus and free driver array. | 363 | * Unregisters the I2O bus and frees driver array. |
366 | */ | 364 | */ |
367 | void __exit i2o_driver_exit(void) | 365 | void __exit i2o_driver_exit(void) |
368 | { | 366 | { |
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c index 9e529d8dd5cb..902753b2c661 100644 --- a/drivers/message/i2o/exec-osm.c +++ b/drivers/message/i2o/exec-osm.c | |||
@@ -94,8 +94,8 @@ static struct i2o_exec_wait *i2o_exec_wait_alloc(void) | |||
94 | }; | 94 | }; |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * i2o_exec_wait_free - Free a i2o_exec_wait struct | 97 | * i2o_exec_wait_free - Free an i2o_exec_wait struct |
98 | * @i2o_exec_wait: I2O wait data which should be cleaned up | 98 | * @wait: I2O wait data which should be cleaned up |
99 | */ | 99 | */ |
100 | static void i2o_exec_wait_free(struct i2o_exec_wait *wait) | 100 | static void i2o_exec_wait_free(struct i2o_exec_wait *wait) |
101 | { | 101 | { |
@@ -105,7 +105,7 @@ static void i2o_exec_wait_free(struct i2o_exec_wait *wait) | |||
105 | /** | 105 | /** |
106 | * i2o_msg_post_wait_mem - Post and wait a message with DMA buffers | 106 | * i2o_msg_post_wait_mem - Post and wait a message with DMA buffers |
107 | * @c: controller | 107 | * @c: controller |
108 | * @m: message to post | 108 | * @msg: message to post |
109 | * @timeout: time in seconds to wait | 109 | * @timeout: time in seconds to wait |
110 | * @dma: i2o_dma struct of the DMA buffer to free on failure | 110 | * @dma: i2o_dma struct of the DMA buffer to free on failure |
111 | * | 111 | * |
@@ -269,6 +269,7 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m, | |||
269 | /** | 269 | /** |
270 | * i2o_exec_show_vendor_id - Displays Vendor ID of controller | 270 | * i2o_exec_show_vendor_id - Displays Vendor ID of controller |
271 | * @d: device of which the Vendor ID should be displayed | 271 | * @d: device of which the Vendor ID should be displayed |
272 | * @attr: device_attribute to display | ||
272 | * @buf: buffer into which the Vendor ID should be printed | 273 | * @buf: buffer into which the Vendor ID should be printed |
273 | * | 274 | * |
274 | * Returns number of bytes printed into buffer. | 275 | * Returns number of bytes printed into buffer. |
@@ -290,6 +291,7 @@ static ssize_t i2o_exec_show_vendor_id(struct device *d, | |||
290 | /** | 291 | /** |
291 | * i2o_exec_show_product_id - Displays Product ID of controller | 292 | * i2o_exec_show_product_id - Displays Product ID of controller |
292 | * @d: device of which the Product ID should be displayed | 293 | * @d: device of which the Product ID should be displayed |
294 | * @attr: device_attribute to display | ||
293 | * @buf: buffer into which the Product ID should be printed | 295 | * @buf: buffer into which the Product ID should be printed |
294 | * | 296 | * |
295 | * Returns number of bytes printed into buffer. | 297 | * Returns number of bytes printed into buffer. |
@@ -365,7 +367,7 @@ static int i2o_exec_remove(struct device *dev) | |||
365 | 367 | ||
366 | /** | 368 | /** |
367 | * i2o_exec_lct_modified - Called on LCT NOTIFY reply | 369 | * i2o_exec_lct_modified - Called on LCT NOTIFY reply |
368 | * @c: I2O controller on which the LCT has modified | 370 | * @work: work struct for a specific controller |
369 | * | 371 | * |
370 | * This function handles asynchronus LCT NOTIFY replies. It parses the | 372 | * This function handles asynchronus LCT NOTIFY replies. It parses the |
371 | * new LCT and if the buffer for the LCT was to small sends a LCT NOTIFY | 373 | * new LCT and if the buffer for the LCT was to small sends a LCT NOTIFY |
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index 70ae00253321..da9859f2caf2 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -259,7 +259,7 @@ static int i2o_block_device_unlock(struct i2o_device *dev, u32 media_id) | |||
259 | /** | 259 | /** |
260 | * i2o_block_device_power - Power management for device dev | 260 | * i2o_block_device_power - Power management for device dev |
261 | * @dev: I2O device which should receive the power management request | 261 | * @dev: I2O device which should receive the power management request |
262 | * @operation: Operation which should be send | 262 | * @op: Operation to send |
263 | * | 263 | * |
264 | * Send a power management request to the device dev. | 264 | * Send a power management request to the device dev. |
265 | * | 265 | * |
@@ -315,7 +315,7 @@ static inline struct i2o_block_request *i2o_block_request_alloc(void) | |||
315 | * i2o_block_request_free - Frees a I2O block request | 315 | * i2o_block_request_free - Frees a I2O block request |
316 | * @ireq: I2O block request which should be freed | 316 | * @ireq: I2O block request which should be freed |
317 | * | 317 | * |
318 | * Fres the allocated memory (give it back to the request mempool). | 318 | * Frees the allocated memory (give it back to the request mempool). |
319 | */ | 319 | */ |
320 | static inline void i2o_block_request_free(struct i2o_block_request *ireq) | 320 | static inline void i2o_block_request_free(struct i2o_block_request *ireq) |
321 | { | 321 | { |
@@ -326,6 +326,7 @@ static inline void i2o_block_request_free(struct i2o_block_request *ireq) | |||
326 | * i2o_block_sglist_alloc - Allocate the SG list and map it | 326 | * i2o_block_sglist_alloc - Allocate the SG list and map it |
327 | * @c: I2O controller to which the request belongs | 327 | * @c: I2O controller to which the request belongs |
328 | * @ireq: I2O block request | 328 | * @ireq: I2O block request |
329 | * @mptr: message body pointer | ||
329 | * | 330 | * |
330 | * Builds the SG list and map it to be accessable by the controller. | 331 | * Builds the SG list and map it to be accessable by the controller. |
331 | * | 332 | * |
@@ -490,7 +491,7 @@ static void i2o_block_end_request(struct request *req, int uptodate, | |||
490 | * i2o_block_reply - Block OSM reply handler. | 491 | * i2o_block_reply - Block OSM reply handler. |
491 | * @c: I2O controller from which the message arrives | 492 | * @c: I2O controller from which the message arrives |
492 | * @m: message id of reply | 493 | * @m: message id of reply |
493 | * qmsg: the actuall I2O message reply | 494 | * @msg: the actual I2O message reply |
494 | * | 495 | * |
495 | * This function gets all the message replies. | 496 | * This function gets all the message replies. |
496 | * | 497 | * |
@@ -602,6 +603,8 @@ static void i2o_block_biosparam(unsigned long capacity, unsigned short *cyls, | |||
602 | 603 | ||
603 | /** | 604 | /** |
604 | * i2o_block_open - Open the block device | 605 | * i2o_block_open - Open the block device |
606 | * @inode: inode for block device being opened | ||
607 | * @file: file to open | ||
605 | * | 608 | * |
606 | * Power up the device, mount and lock the media. This function is called, | 609 | * Power up the device, mount and lock the media. This function is called, |
607 | * if the block device is opened for access. | 610 | * if the block device is opened for access. |
@@ -629,6 +632,8 @@ static int i2o_block_open(struct inode *inode, struct file *file) | |||
629 | 632 | ||
630 | /** | 633 | /** |
631 | * i2o_block_release - Release the I2O block device | 634 | * i2o_block_release - Release the I2O block device |
635 | * @inode: inode for block device being released | ||
636 | * @file: file to close | ||
632 | * | 637 | * |
633 | * Unlock and unmount the media, and power down the device. Gets called if | 638 | * Unlock and unmount the media, and power down the device. Gets called if |
634 | * the block device is closed. | 639 | * the block device is closed. |
@@ -675,6 +680,8 @@ static int i2o_block_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
675 | 680 | ||
676 | /** | 681 | /** |
677 | * i2o_block_ioctl - Issue device specific ioctl calls. | 682 | * i2o_block_ioctl - Issue device specific ioctl calls. |
683 | * @inode: inode for block device ioctl | ||
684 | * @file: file for ioctl | ||
678 | * @cmd: ioctl command | 685 | * @cmd: ioctl command |
679 | * @arg: arg | 686 | * @arg: arg |
680 | * | 687 | * |
@@ -902,7 +909,7 @@ static int i2o_block_transfer(struct request *req) | |||
902 | 909 | ||
903 | /** | 910 | /** |
904 | * i2o_block_request_fn - request queue handling function | 911 | * i2o_block_request_fn - request queue handling function |
905 | * q: request queue from which the request could be fetched | 912 | * @q: request queue from which the request could be fetched |
906 | * | 913 | * |
907 | * Takes the next request from the queue, transfers it and if no error | 914 | * Takes the next request from the queue, transfers it and if no error |
908 | * occurs dequeue it from the queue. On arrival of the reply the message | 915 | * occurs dequeue it from the queue. On arrival of the reply the message |
diff --git a/drivers/message/i2o/i2o_block.h b/drivers/message/i2o/i2o_block.h index d9fdc95b440d..67f921b4419b 100644 --- a/drivers/message/i2o/i2o_block.h +++ b/drivers/message/i2o/i2o_block.h | |||
@@ -64,7 +64,7 @@ | |||
64 | 64 | ||
65 | /* I2O Block OSM mempool struct */ | 65 | /* I2O Block OSM mempool struct */ |
66 | struct i2o_block_mempool { | 66 | struct i2o_block_mempool { |
67 | kmem_cache_t *slab; | 67 | struct kmem_cache *slab; |
68 | mempool_t *pool; | 68 | mempool_t *pool; |
69 | }; | 69 | }; |
70 | 70 | ||
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index 7d23e082bf26..1de30d711671 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c | |||
@@ -265,7 +265,11 @@ static int i2o_cfg_swdl(unsigned long arg) | |||
265 | return -ENOMEM; | 265 | return -ENOMEM; |
266 | } | 266 | } |
267 | 267 | ||
268 | __copy_from_user(buffer.virt, kxfer.buf, fragsize); | 268 | if (__copy_from_user(buffer.virt, kxfer.buf, fragsize)) { |
269 | i2o_msg_nop(c, msg); | ||
270 | i2o_dma_free(&c->pdev->dev, &buffer); | ||
271 | return -EFAULT; | ||
272 | } | ||
269 | 273 | ||
270 | msg->u.head[0] = cpu_to_le32(NINE_WORD_MSG_SIZE | SGL_OFFSET_7); | 274 | msg->u.head[0] = cpu_to_le32(NINE_WORD_MSG_SIZE | SGL_OFFSET_7); |
271 | msg->u.head[1] = | 275 | msg->u.head[1] = |
@@ -516,7 +520,6 @@ static int i2o_cfg_evt_get(unsigned long arg, struct file *fp) | |||
516 | return 0; | 520 | return 0; |
517 | } | 521 | } |
518 | 522 | ||
519 | #ifdef CONFIG_I2O_EXT_ADAPTEC | ||
520 | #ifdef CONFIG_COMPAT | 523 | #ifdef CONFIG_COMPAT |
521 | static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, | 524 | static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, |
522 | unsigned long arg) | 525 | unsigned long arg) |
@@ -759,6 +762,7 @@ static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd, | |||
759 | 762 | ||
760 | #endif | 763 | #endif |
761 | 764 | ||
765 | #ifdef CONFIG_I2O_EXT_ADAPTEC | ||
762 | static int i2o_cfg_passthru(unsigned long arg) | 766 | static int i2o_cfg_passthru(unsigned long arg) |
763 | { | 767 | { |
764 | struct i2o_cmd_passthru __user *cmd = | 768 | struct i2o_cmd_passthru __user *cmd = |
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c index 3d2e76eea93e..a61cb17c5c12 100644 --- a/drivers/message/i2o/i2o_proc.c +++ b/drivers/message/i2o/i2o_proc.c | |||
@@ -163,7 +163,7 @@ static int print_serial_number(struct seq_file *seq, u8 * serialno, int max_len) | |||
163 | * i2o_get_class_name - do i2o class name lookup | 163 | * i2o_get_class_name - do i2o class name lookup |
164 | * @class: class number | 164 | * @class: class number |
165 | * | 165 | * |
166 | * Return a descriptive string for an i2o class | 166 | * Return a descriptive string for an i2o class. |
167 | */ | 167 | */ |
168 | static const char *i2o_get_class_name(int class) | 168 | static const char *i2o_get_class_name(int class) |
169 | { | 169 | { |
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c index 6ebf38213f9f..1045c8a518bb 100644 --- a/drivers/message/i2o/i2o_scsi.c +++ b/drivers/message/i2o/i2o_scsi.c | |||
@@ -220,7 +220,7 @@ static int i2o_scsi_probe(struct device *dev) | |||
220 | u32 id = -1; | 220 | u32 id = -1; |
221 | u64 lun = -1; | 221 | u64 lun = -1; |
222 | int channel = -1; | 222 | int channel = -1; |
223 | int i; | 223 | int i, rc; |
224 | 224 | ||
225 | i2o_shost = i2o_scsi_get_host(c); | 225 | i2o_shost = i2o_scsi_get_host(c); |
226 | if (!i2o_shost) | 226 | if (!i2o_shost) |
@@ -304,14 +304,20 @@ static int i2o_scsi_probe(struct device *dev) | |||
304 | return PTR_ERR(scsi_dev); | 304 | return PTR_ERR(scsi_dev); |
305 | } | 305 | } |
306 | 306 | ||
307 | sysfs_create_link(&i2o_dev->device.kobj, &scsi_dev->sdev_gendev.kobj, | 307 | rc = sysfs_create_link(&i2o_dev->device.kobj, |
308 | "scsi"); | 308 | &scsi_dev->sdev_gendev.kobj, "scsi"); |
309 | if (rc) | ||
310 | goto err; | ||
309 | 311 | ||
310 | osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %ld\n", | 312 | osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %ld\n", |
311 | i2o_dev->lct_data.tid, channel, le32_to_cpu(id), | 313 | i2o_dev->lct_data.tid, channel, le32_to_cpu(id), |
312 | (long unsigned int)le64_to_cpu(lun)); | 314 | (long unsigned int)le64_to_cpu(lun)); |
313 | 315 | ||
314 | return 0; | 316 | return 0; |
317 | |||
318 | err: | ||
319 | scsi_remove_device(scsi_dev); | ||
320 | return rc; | ||
315 | }; | 321 | }; |
316 | 322 | ||
317 | static const char *i2o_scsi_info(struct Scsi_Host *SChost) | 323 | static const char *i2o_scsi_info(struct Scsi_Host *SChost) |
@@ -405,8 +411,7 @@ static void i2o_scsi_notify_device_add(struct i2o_device *i2o_dev) | |||
405 | }; | 411 | }; |
406 | 412 | ||
407 | /** | 413 | /** |
408 | * i2o_scsi_notify_device_remove - Retrieve notifications of removed | 414 | * i2o_scsi_notify_device_remove - Retrieve notifications of removed devices |
409 | * devices | ||
410 | * @i2o_dev: the I2O device which was removed | 415 | * @i2o_dev: the I2O device which was removed |
411 | * | 416 | * |
412 | * If a I2O device is removed, we catch the notification to remove the | 417 | * If a I2O device is removed, we catch the notification to remove the |
@@ -426,8 +431,7 @@ static void i2o_scsi_notify_device_remove(struct i2o_device *i2o_dev) | |||
426 | }; | 431 | }; |
427 | 432 | ||
428 | /** | 433 | /** |
429 | * i2o_scsi_notify_controller_add - Retrieve notifications of added | 434 | * i2o_scsi_notify_controller_add - Retrieve notifications of added controllers |
430 | * controllers | ||
431 | * @c: the controller which was added | 435 | * @c: the controller which was added |
432 | * | 436 | * |
433 | * If a I2O controller is added, we catch the notification to add a | 437 | * If a I2O controller is added, we catch the notification to add a |
@@ -457,8 +461,7 @@ static void i2o_scsi_notify_controller_add(struct i2o_controller *c) | |||
457 | }; | 461 | }; |
458 | 462 | ||
459 | /** | 463 | /** |
460 | * i2o_scsi_notify_controller_remove - Retrieve notifications of removed | 464 | * i2o_scsi_notify_controller_remove - Retrieve notifications of removed controllers |
461 | * controllers | ||
462 | * @c: the controller which was removed | 465 | * @c: the controller which was removed |
463 | * | 466 | * |
464 | * If a I2O controller is removed, we catch the notification to remove the | 467 | * If a I2O controller is removed, we catch the notification to remove the |
@@ -745,7 +748,7 @@ static int i2o_scsi_abort(struct scsi_cmnd *SCpnt) | |||
745 | * @capacity: size in sectors | 748 | * @capacity: size in sectors |
746 | * @ip: geometry array | 749 | * @ip: geometry array |
747 | * | 750 | * |
748 | * This is anyones guess quite frankly. We use the same rules everyone | 751 | * This is anyone's guess quite frankly. We use the same rules everyone |
749 | * else appears to and hope. It seems to work. | 752 | * else appears to and hope. It seems to work. |
750 | */ | 753 | */ |
751 | 754 | ||
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c index 8287f95c8c42..3661e6e065d2 100644 --- a/drivers/message/i2o/pci.c +++ b/drivers/message/i2o/pci.c | |||
@@ -259,6 +259,7 @@ static irqreturn_t i2o_pci_interrupt(int irq, void *dev_id) | |||
259 | 259 | ||
260 | /** | 260 | /** |
261 | * i2o_pci_irq_enable - Allocate interrupt for I2O controller | 261 | * i2o_pci_irq_enable - Allocate interrupt for I2O controller |
262 | * @c: i2o_controller that the request is for | ||
262 | * | 263 | * |
263 | * Allocate an interrupt for the I2O controller, and activate interrupts | 264 | * Allocate an interrupt for the I2O controller, and activate interrupts |
264 | * on the I2O controller. | 265 | * on the I2O controller. |
@@ -305,7 +306,7 @@ static void i2o_pci_irq_disable(struct i2o_controller *c) | |||
305 | 306 | ||
306 | /** | 307 | /** |
307 | * i2o_pci_probe - Probe the PCI device for an I2O controller | 308 | * i2o_pci_probe - Probe the PCI device for an I2O controller |
308 | * @dev: PCI device to test | 309 | * @pdev: PCI device to test |
309 | * @id: id which matched with the PCI device id table | 310 | * @id: id which matched with the PCI device id table |
310 | * | 311 | * |
311 | * Probe the PCI device for any device which is a memory of the | 312 | * Probe the PCI device for any device which is a memory of the |
@@ -447,7 +448,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, | |||
447 | 448 | ||
448 | /** | 449 | /** |
449 | * i2o_pci_remove - Removes a I2O controller from the system | 450 | * i2o_pci_remove - Removes a I2O controller from the system |
450 | * pdev: I2O controller which should be removed | 451 | * @pdev: I2O controller which should be removed |
451 | * | 452 | * |
452 | * Reset the I2O controller, disable interrupts and remove all allocated | 453 | * Reset the I2O controller, disable interrupts and remove all allocated |
453 | * resources. | 454 | * resources. |
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c index 82938ad6ddbd..ce1a48108210 100644 --- a/drivers/mfd/ucb1x00-ts.c +++ b/drivers/mfd/ucb1x00-ts.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | #include <linux/input.h> | 29 | #include <linux/input.h> |
30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
31 | #include <linux/suspend.h> | 31 | #include <linux/freezer.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/kthread.h> | 33 | #include <linux/kthread.h> |
34 | 34 | ||
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c index ee326136d03b..d61df5c3ac36 100644 --- a/drivers/misc/tifm_core.c +++ b/drivers/misc/tifm_core.c | |||
@@ -219,8 +219,9 @@ static int tifm_device_remove(struct device *dev) | |||
219 | struct tifm_driver *drv = fm_dev->drv; | 219 | struct tifm_driver *drv = fm_dev->drv; |
220 | 220 | ||
221 | if (drv) { | 221 | if (drv) { |
222 | if (drv->remove) drv->remove(fm_dev); | 222 | if (drv->remove) |
223 | fm_dev->drv = 0; | 223 | drv->remove(fm_dev); |
224 | fm_dev->drv = NULL; | ||
224 | } | 225 | } |
225 | 226 | ||
226 | put_device(dev); | 227 | put_device(dev); |
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index ef4a731ca5c2..334e078ffaff 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -451,7 +451,7 @@ static int __devinit m25p_probe(struct spi_device *spi) | |||
451 | return -ENODEV; | 451 | return -ENODEV; |
452 | } | 452 | } |
453 | 453 | ||
454 | flash = kzalloc(sizeof *flash, SLAB_KERNEL); | 454 | flash = kzalloc(sizeof *flash, GFP_KERNEL); |
455 | if (!flash) | 455 | if (!flash) |
456 | return -ENOMEM; | 456 | return -ENOMEM; |
457 | 457 | ||
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c index 11d170afa9c3..06e33786078d 100644 --- a/drivers/net/3c501.c +++ b/drivers/net/3c501.c | |||
@@ -922,7 +922,7 @@ int __init init_module(void) | |||
922 | * and then free up the resources we took when the card was found. | 922 | * and then free up the resources we took when the card was found. |
923 | */ | 923 | */ |
924 | 924 | ||
925 | void cleanup_module(void) | 925 | void __exit cleanup_module(void) |
926 | { | 926 | { |
927 | struct net_device *dev = dev_3c501; | 927 | struct net_device *dev = dev_3c501; |
928 | unregister_netdev(dev); | 928 | unregister_netdev(dev); |
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c index a34b2206132d..7e34c4f07b70 100644 --- a/drivers/net/3c503.c +++ b/drivers/net/3c503.c | |||
@@ -726,7 +726,7 @@ static void cleanup_card(struct net_device *dev) | |||
726 | iounmap(ei_status.mem); | 726 | iounmap(ei_status.mem); |
727 | } | 727 | } |
728 | 728 | ||
729 | void | 729 | void __exit |
730 | cleanup_module(void) | 730 | cleanup_module(void) |
731 | { | 731 | { |
732 | int this_dev; | 732 | int this_dev; |
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c index 458cb9cbe915..702bfb2a5e99 100644 --- a/drivers/net/3c505.c +++ b/drivers/net/3c505.c | |||
@@ -1670,7 +1670,7 @@ int __init init_module(void) | |||
1670 | return 0; | 1670 | return 0; |
1671 | } | 1671 | } |
1672 | 1672 | ||
1673 | void cleanup_module(void) | 1673 | void __exit cleanup_module(void) |
1674 | { | 1674 | { |
1675 | int this_dev; | 1675 | int this_dev; |
1676 | 1676 | ||
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c index aa43563610ae..54e1d5aebed3 100644 --- a/drivers/net/3c507.c +++ b/drivers/net/3c507.c | |||
@@ -940,7 +940,7 @@ int __init init_module(void) | |||
940 | return IS_ERR(dev_3c507) ? PTR_ERR(dev_3c507) : 0; | 940 | return IS_ERR(dev_3c507) ? PTR_ERR(dev_3c507) : 0; |
941 | } | 941 | } |
942 | 942 | ||
943 | void | 943 | void __exit |
944 | cleanup_module(void) | 944 | cleanup_module(void) |
945 | { | 945 | { |
946 | struct net_device *dev = dev_3c507; | 946 | struct net_device *dev = dev_3c507; |
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c index 91849469b4f4..17d61eb0a7e5 100644 --- a/drivers/net/3c523.c +++ b/drivers/net/3c523.c | |||
@@ -1302,7 +1302,7 @@ int __init init_module(void) | |||
1302 | } else return 0; | 1302 | } else return 0; |
1303 | } | 1303 | } |
1304 | 1304 | ||
1305 | void cleanup_module(void) | 1305 | void __exit cleanup_module(void) |
1306 | { | 1306 | { |
1307 | int this_dev; | 1307 | int this_dev; |
1308 | for (this_dev=0; this_dev<MAX_3C523_CARDS; this_dev++) { | 1308 | for (this_dev=0; this_dev<MAX_3C523_CARDS; this_dev++) { |
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c index f4aca5386add..6c7437e60bd2 100644 --- a/drivers/net/3c527.c +++ b/drivers/net/3c527.c | |||
@@ -1659,7 +1659,7 @@ int __init init_module(void) | |||
1659 | * transmit operations are allowed to start scribbling into memory. | 1659 | * transmit operations are allowed to start scribbling into memory. |
1660 | */ | 1660 | */ |
1661 | 1661 | ||
1662 | void cleanup_module(void) | 1662 | void __exit cleanup_module(void) |
1663 | { | 1663 | { |
1664 | unregister_netdev(this_device); | 1664 | unregister_netdev(this_device); |
1665 | cleanup_card(this_device); | 1665 | cleanup_card(this_device); |
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c index 0dca8bb9d2c7..c01f87f5bed7 100644 --- a/drivers/net/ac3200.c +++ b/drivers/net/ac3200.c | |||
@@ -405,7 +405,7 @@ static void cleanup_card(struct net_device *dev) | |||
405 | iounmap(ei_status.mem); | 405 | iounmap(ei_status.mem); |
406 | } | 406 | } |
407 | 407 | ||
408 | void | 408 | void __exit |
409 | cleanup_module(void) | 409 | cleanup_module(void) |
410 | { | 410 | { |
411 | int this_dev; | 411 | int this_dev; |
diff --git a/drivers/net/apne.c b/drivers/net/apne.c index 9164d8cd670e..d4e408169073 100644 --- a/drivers/net/apne.c +++ b/drivers/net/apne.c | |||
@@ -568,7 +568,7 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id) | |||
568 | #ifdef MODULE | 568 | #ifdef MODULE |
569 | static struct net_device *apne_dev; | 569 | static struct net_device *apne_dev; |
570 | 570 | ||
571 | int init_module(void) | 571 | int __init init_module(void) |
572 | { | 572 | { |
573 | apne_dev = apne_probe(-1); | 573 | apne_dev = apne_probe(-1); |
574 | if (IS_ERR(apne_dev)) | 574 | if (IS_ERR(apne_dev)) |
@@ -576,7 +576,7 @@ int init_module(void) | |||
576 | return 0; | 576 | return 0; |
577 | } | 577 | } |
578 | 578 | ||
579 | void cleanup_module(void) | 579 | void __exit cleanup_module(void) |
580 | { | 580 | { |
581 | unregister_netdev(apne_dev); | 581 | unregister_netdev(apne_dev); |
582 | 582 | ||
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c index cc1a27ed197f..dba5e5165452 100644 --- a/drivers/net/appletalk/cops.c +++ b/drivers/net/appletalk/cops.c | |||
@@ -1041,7 +1041,7 @@ int __init init_module(void) | |||
1041 | return 0; | 1041 | return 0; |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | void cleanup_module(void) | 1044 | void __exit cleanup_module(void) |
1045 | { | 1045 | { |
1046 | unregister_netdev(cops_dev); | 1046 | unregister_netdev(cops_dev); |
1047 | cleanup_card(cops_dev); | 1047 | cleanup_card(cops_dev); |
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c index b54b857e357e..fada15d959de 100644 --- a/drivers/net/arm/at91_ether.c +++ b/drivers/net/arm/at91_ether.c | |||
@@ -41,9 +41,6 @@ | |||
41 | #define DRV_NAME "at91_ether" | 41 | #define DRV_NAME "at91_ether" |
42 | #define DRV_VERSION "1.0" | 42 | #define DRV_VERSION "1.0" |
43 | 43 | ||
44 | static struct net_device *at91_dev; | ||
45 | |||
46 | static struct timer_list check_timer; | ||
47 | #define LINK_POLL_INTERVAL (HZ) | 44 | #define LINK_POLL_INTERVAL (HZ) |
48 | 45 | ||
49 | /* ..................................................................... */ | 46 | /* ..................................................................... */ |
@@ -146,7 +143,7 @@ static void read_phy(unsigned char phy_addr, unsigned char address, unsigned int | |||
146 | */ | 143 | */ |
147 | static void update_linkspeed(struct net_device *dev, int silent) | 144 | static void update_linkspeed(struct net_device *dev, int silent) |
148 | { | 145 | { |
149 | struct at91_private *lp = (struct at91_private *) dev->priv; | 146 | struct at91_private *lp = netdev_priv(dev); |
150 | unsigned int bmsr, bmcr, lpa, mac_cfg; | 147 | unsigned int bmsr, bmcr, lpa, mac_cfg; |
151 | unsigned int speed, duplex; | 148 | unsigned int speed, duplex; |
152 | 149 | ||
@@ -199,7 +196,7 @@ static void update_linkspeed(struct net_device *dev, int silent) | |||
199 | static irqreturn_t at91ether_phy_interrupt(int irq, void *dev_id) | 196 | static irqreturn_t at91ether_phy_interrupt(int irq, void *dev_id) |
200 | { | 197 | { |
201 | struct net_device *dev = (struct net_device *) dev_id; | 198 | struct net_device *dev = (struct net_device *) dev_id; |
202 | struct at91_private *lp = (struct at91_private *) dev->priv; | 199 | struct at91_private *lp = netdev_priv(dev); |
203 | unsigned int phy; | 200 | unsigned int phy; |
204 | 201 | ||
205 | /* | 202 | /* |
@@ -242,7 +239,7 @@ done: | |||
242 | */ | 239 | */ |
243 | static void enable_phyirq(struct net_device *dev) | 240 | static void enable_phyirq(struct net_device *dev) |
244 | { | 241 | { |
245 | struct at91_private *lp = (struct at91_private *) dev->priv; | 242 | struct at91_private *lp = netdev_priv(dev); |
246 | unsigned int dsintr, irq_number; | 243 | unsigned int dsintr, irq_number; |
247 | int status; | 244 | int status; |
248 | 245 | ||
@@ -252,8 +249,7 @@ static void enable_phyirq(struct net_device *dev) | |||
252 | * PHY doesn't have an IRQ pin (RTL8201, DP83847, AC101L), | 249 | * PHY doesn't have an IRQ pin (RTL8201, DP83847, AC101L), |
253 | * or board does not have it connected. | 250 | * or board does not have it connected. |
254 | */ | 251 | */ |
255 | check_timer.expires = jiffies + LINK_POLL_INTERVAL; | 252 | mod_timer(&lp->check_timer, jiffies + LINK_POLL_INTERVAL); |
256 | add_timer(&check_timer); | ||
257 | return; | 253 | return; |
258 | } | 254 | } |
259 | 255 | ||
@@ -294,13 +290,13 @@ static void enable_phyirq(struct net_device *dev) | |||
294 | */ | 290 | */ |
295 | static void disable_phyirq(struct net_device *dev) | 291 | static void disable_phyirq(struct net_device *dev) |
296 | { | 292 | { |
297 | struct at91_private *lp = (struct at91_private *) dev->priv; | 293 | struct at91_private *lp = netdev_priv(dev); |
298 | unsigned int dsintr; | 294 | unsigned int dsintr; |
299 | unsigned int irq_number; | 295 | unsigned int irq_number; |
300 | 296 | ||
301 | irq_number = lp->board_data.phy_irq_pin; | 297 | irq_number = lp->board_data.phy_irq_pin; |
302 | if (!irq_number) { | 298 | if (!irq_number) { |
303 | del_timer_sync(&check_timer); | 299 | del_timer_sync(&lp->check_timer); |
304 | return; | 300 | return; |
305 | } | 301 | } |
306 | 302 | ||
@@ -340,7 +336,7 @@ static void disable_phyirq(struct net_device *dev) | |||
340 | #if 0 | 336 | #if 0 |
341 | static void reset_phy(struct net_device *dev) | 337 | static void reset_phy(struct net_device *dev) |
342 | { | 338 | { |
343 | struct at91_private *lp = (struct at91_private *) dev->priv; | 339 | struct at91_private *lp = netdev_priv(dev); |
344 | unsigned int bmcr; | 340 | unsigned int bmcr; |
345 | 341 | ||
346 | spin_lock_irq(&lp->lock); | 342 | spin_lock_irq(&lp->lock); |
@@ -362,13 +358,13 @@ static void reset_phy(struct net_device *dev) | |||
362 | static void at91ether_check_link(unsigned long dev_id) | 358 | static void at91ether_check_link(unsigned long dev_id) |
363 | { | 359 | { |
364 | struct net_device *dev = (struct net_device *) dev_id; | 360 | struct net_device *dev = (struct net_device *) dev_id; |
361 | struct at91_private *lp = netdev_priv(dev); | ||
365 | 362 | ||
366 | enable_mdi(); | 363 | enable_mdi(); |
367 | update_linkspeed(dev, 1); | 364 | update_linkspeed(dev, 1); |
368 | disable_mdi(); | 365 | disable_mdi(); |
369 | 366 | ||
370 | check_timer.expires = jiffies + LINK_POLL_INTERVAL; | 367 | mod_timer(&lp->check_timer, jiffies + LINK_POLL_INTERVAL); |
371 | add_timer(&check_timer); | ||
372 | } | 368 | } |
373 | 369 | ||
374 | /* ......................... ADDRESS MANAGEMENT ........................ */ | 370 | /* ......................... ADDRESS MANAGEMENT ........................ */ |
@@ -590,7 +586,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val | |||
590 | 586 | ||
591 | static int at91ether_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 587 | static int at91ether_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
592 | { | 588 | { |
593 | struct at91_private *lp = (struct at91_private *) dev->priv; | 589 | struct at91_private *lp = netdev_priv(dev); |
594 | int ret; | 590 | int ret; |
595 | 591 | ||
596 | spin_lock_irq(&lp->lock); | 592 | spin_lock_irq(&lp->lock); |
@@ -611,7 +607,7 @@ static int at91ether_get_settings(struct net_device *dev, struct ethtool_cmd *cm | |||
611 | 607 | ||
612 | static int at91ether_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 608 | static int at91ether_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
613 | { | 609 | { |
614 | struct at91_private *lp = (struct at91_private *) dev->priv; | 610 | struct at91_private *lp = netdev_priv(dev); |
615 | int ret; | 611 | int ret; |
616 | 612 | ||
617 | spin_lock_irq(&lp->lock); | 613 | spin_lock_irq(&lp->lock); |
@@ -627,7 +623,7 @@ static int at91ether_set_settings(struct net_device *dev, struct ethtool_cmd *cm | |||
627 | 623 | ||
628 | static int at91ether_nwayreset(struct net_device *dev) | 624 | static int at91ether_nwayreset(struct net_device *dev) |
629 | { | 625 | { |
630 | struct at91_private *lp = (struct at91_private *) dev->priv; | 626 | struct at91_private *lp = netdev_priv(dev); |
631 | int ret; | 627 | int ret; |
632 | 628 | ||
633 | spin_lock_irq(&lp->lock); | 629 | spin_lock_irq(&lp->lock); |
@@ -658,7 +654,7 @@ static const struct ethtool_ops at91ether_ethtool_ops = { | |||
658 | 654 | ||
659 | static int at91ether_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 655 | static int at91ether_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
660 | { | 656 | { |
661 | struct at91_private *lp = (struct at91_private *) dev->priv; | 657 | struct at91_private *lp = netdev_priv(dev); |
662 | int res; | 658 | int res; |
663 | 659 | ||
664 | if (!netif_running(dev)) | 660 | if (!netif_running(dev)) |
@@ -680,7 +676,7 @@ static int at91ether_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
680 | */ | 676 | */ |
681 | static void at91ether_start(struct net_device *dev) | 677 | static void at91ether_start(struct net_device *dev) |
682 | { | 678 | { |
683 | struct at91_private *lp = (struct at91_private *) dev->priv; | 679 | struct at91_private *lp = netdev_priv(dev); |
684 | struct recv_desc_bufs *dlist, *dlist_phys; | 680 | struct recv_desc_bufs *dlist, *dlist_phys; |
685 | int i; | 681 | int i; |
686 | unsigned long ctl; | 682 | unsigned long ctl; |
@@ -712,7 +708,7 @@ static void at91ether_start(struct net_device *dev) | |||
712 | */ | 708 | */ |
713 | static int at91ether_open(struct net_device *dev) | 709 | static int at91ether_open(struct net_device *dev) |
714 | { | 710 | { |
715 | struct at91_private *lp = (struct at91_private *) dev->priv; | 711 | struct at91_private *lp = netdev_priv(dev); |
716 | unsigned long ctl; | 712 | unsigned long ctl; |
717 | 713 | ||
718 | if (!is_valid_ether_addr(dev->dev_addr)) | 714 | if (!is_valid_ether_addr(dev->dev_addr)) |
@@ -752,7 +748,7 @@ static int at91ether_open(struct net_device *dev) | |||
752 | */ | 748 | */ |
753 | static int at91ether_close(struct net_device *dev) | 749 | static int at91ether_close(struct net_device *dev) |
754 | { | 750 | { |
755 | struct at91_private *lp = (struct at91_private *) dev->priv; | 751 | struct at91_private *lp = netdev_priv(dev); |
756 | unsigned long ctl; | 752 | unsigned long ctl; |
757 | 753 | ||
758 | /* Disable Receiver and Transmitter */ | 754 | /* Disable Receiver and Transmitter */ |
@@ -779,7 +775,7 @@ static int at91ether_close(struct net_device *dev) | |||
779 | */ | 775 | */ |
780 | static int at91ether_tx(struct sk_buff *skb, struct net_device *dev) | 776 | static int at91ether_tx(struct sk_buff *skb, struct net_device *dev) |
781 | { | 777 | { |
782 | struct at91_private *lp = (struct at91_private *) dev->priv; | 778 | struct at91_private *lp = netdev_priv(dev); |
783 | 779 | ||
784 | if (at91_emac_read(AT91_EMAC_TSR) & AT91_EMAC_TSR_BNQ) { | 780 | if (at91_emac_read(AT91_EMAC_TSR) & AT91_EMAC_TSR_BNQ) { |
785 | netif_stop_queue(dev); | 781 | netif_stop_queue(dev); |
@@ -811,7 +807,7 @@ static int at91ether_tx(struct sk_buff *skb, struct net_device *dev) | |||
811 | */ | 807 | */ |
812 | static struct net_device_stats *at91ether_stats(struct net_device *dev) | 808 | static struct net_device_stats *at91ether_stats(struct net_device *dev) |
813 | { | 809 | { |
814 | struct at91_private *lp = (struct at91_private *) dev->priv; | 810 | struct at91_private *lp = netdev_priv(dev); |
815 | int ale, lenerr, seqe, lcol, ecol; | 811 | int ale, lenerr, seqe, lcol, ecol; |
816 | 812 | ||
817 | if (netif_running(dev)) { | 813 | if (netif_running(dev)) { |
@@ -847,7 +843,7 @@ static struct net_device_stats *at91ether_stats(struct net_device *dev) | |||
847 | */ | 843 | */ |
848 | static void at91ether_rx(struct net_device *dev) | 844 | static void at91ether_rx(struct net_device *dev) |
849 | { | 845 | { |
850 | struct at91_private *lp = (struct at91_private *) dev->priv; | 846 | struct at91_private *lp = netdev_priv(dev); |
851 | struct recv_desc_bufs *dlist; | 847 | struct recv_desc_bufs *dlist; |
852 | unsigned char *p_recv; | 848 | unsigned char *p_recv; |
853 | struct sk_buff *skb; | 849 | struct sk_buff *skb; |
@@ -857,14 +853,13 @@ static void at91ether_rx(struct net_device *dev) | |||
857 | while (dlist->descriptors[lp->rxBuffIndex].addr & EMAC_DESC_DONE) { | 853 | while (dlist->descriptors[lp->rxBuffIndex].addr & EMAC_DESC_DONE) { |
858 | p_recv = dlist->recv_buf[lp->rxBuffIndex]; | 854 | p_recv = dlist->recv_buf[lp->rxBuffIndex]; |
859 | pktlen = dlist->descriptors[lp->rxBuffIndex].size & 0x7ff; /* Length of frame including FCS */ | 855 | pktlen = dlist->descriptors[lp->rxBuffIndex].size & 0x7ff; /* Length of frame including FCS */ |
860 | skb = alloc_skb(pktlen + 2, GFP_ATOMIC); | 856 | skb = dev_alloc_skb(pktlen + 2); |
861 | if (skb != NULL) { | 857 | if (skb != NULL) { |
862 | skb_reserve(skb, 2); | 858 | skb_reserve(skb, 2); |
863 | memcpy(skb_put(skb, pktlen), p_recv, pktlen); | 859 | memcpy(skb_put(skb, pktlen), p_recv, pktlen); |
864 | 860 | ||
865 | skb->dev = dev; | 861 | skb->dev = dev; |
866 | skb->protocol = eth_type_trans(skb, dev); | 862 | skb->protocol = eth_type_trans(skb, dev); |
867 | skb->len = pktlen; | ||
868 | dev->last_rx = jiffies; | 863 | dev->last_rx = jiffies; |
869 | lp->stats.rx_bytes += pktlen; | 864 | lp->stats.rx_bytes += pktlen; |
870 | netif_rx(skb); | 865 | netif_rx(skb); |
@@ -891,7 +886,7 @@ static void at91ether_rx(struct net_device *dev) | |||
891 | static irqreturn_t at91ether_interrupt(int irq, void *dev_id) | 886 | static irqreturn_t at91ether_interrupt(int irq, void *dev_id) |
892 | { | 887 | { |
893 | struct net_device *dev = (struct net_device *) dev_id; | 888 | struct net_device *dev = (struct net_device *) dev_id; |
894 | struct at91_private *lp = (struct at91_private *) dev->priv; | 889 | struct at91_private *lp = netdev_priv(dev); |
895 | unsigned long intstatus, ctl; | 890 | unsigned long intstatus, ctl; |
896 | 891 | ||
897 | /* MAC Interrupt Status register indicates what interrupts are pending. | 892 | /* MAC Interrupt Status register indicates what interrupts are pending. |
@@ -927,6 +922,17 @@ static irqreturn_t at91ether_interrupt(int irq, void *dev_id) | |||
927 | return IRQ_HANDLED; | 922 | return IRQ_HANDLED; |
928 | } | 923 | } |
929 | 924 | ||
925 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
926 | static void at91ether_poll_controller(struct net_device *dev) | ||
927 | { | ||
928 | unsigned long flags; | ||
929 | |||
930 | local_irq_save(flags); | ||
931 | at91ether_interrupt(dev->irq, dev); | ||
932 | local_irq_restore(flags); | ||
933 | } | ||
934 | #endif | ||
935 | |||
930 | /* | 936 | /* |
931 | * Initialize the ethernet interface | 937 | * Initialize the ethernet interface |
932 | */ | 938 | */ |
@@ -939,9 +945,6 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add | |||
939 | unsigned int val; | 945 | unsigned int val; |
940 | int res; | 946 | int res; |
941 | 947 | ||
942 | if (at91_dev) /* already initialized */ | ||
943 | return 0; | ||
944 | |||
945 | dev = alloc_etherdev(sizeof(struct at91_private)); | 948 | dev = alloc_etherdev(sizeof(struct at91_private)); |
946 | if (!dev) | 949 | if (!dev) |
947 | return -ENOMEM; | 950 | return -ENOMEM; |
@@ -957,7 +960,7 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add | |||
957 | } | 960 | } |
958 | 961 | ||
959 | /* Allocate memory for DMA Receive descriptors */ | 962 | /* Allocate memory for DMA Receive descriptors */ |
960 | lp = (struct at91_private *)dev->priv; | 963 | lp = netdev_priv(dev); |
961 | lp->dlist = (struct recv_desc_bufs *) dma_alloc_coherent(NULL, sizeof(struct recv_desc_bufs), (dma_addr_t *) &lp->dlist_phys, GFP_KERNEL); | 964 | lp->dlist = (struct recv_desc_bufs *) dma_alloc_coherent(NULL, sizeof(struct recv_desc_bufs), (dma_addr_t *) &lp->dlist_phys, GFP_KERNEL); |
962 | if (lp->dlist == NULL) { | 965 | if (lp->dlist == NULL) { |
963 | free_irq(dev->irq, dev); | 966 | free_irq(dev->irq, dev); |
@@ -979,6 +982,9 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add | |||
979 | dev->set_mac_address = set_mac_address; | 982 | dev->set_mac_address = set_mac_address; |
980 | dev->ethtool_ops = &at91ether_ethtool_ops; | 983 | dev->ethtool_ops = &at91ether_ethtool_ops; |
981 | dev->do_ioctl = at91ether_ioctl; | 984 | dev->do_ioctl = at91ether_ioctl; |
985 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
986 | dev->poll_controller = at91ether_poll_controller; | ||
987 | #endif | ||
982 | 988 | ||
983 | SET_NETDEV_DEV(dev, &pdev->dev); | 989 | SET_NETDEV_DEV(dev, &pdev->dev); |
984 | 990 | ||
@@ -1024,7 +1030,6 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add | |||
1024 | dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys); | 1030 | dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys); |
1025 | return res; | 1031 | return res; |
1026 | } | 1032 | } |
1027 | at91_dev = dev; | ||
1028 | 1033 | ||
1029 | /* Determine current link speed */ | 1034 | /* Determine current link speed */ |
1030 | spin_lock_irq(&lp->lock); | 1035 | spin_lock_irq(&lp->lock); |
@@ -1036,9 +1041,9 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add | |||
1036 | 1041 | ||
1037 | /* If board has no PHY IRQ, use a timer to poll the PHY */ | 1042 | /* If board has no PHY IRQ, use a timer to poll the PHY */ |
1038 | if (!lp->board_data.phy_irq_pin) { | 1043 | if (!lp->board_data.phy_irq_pin) { |
1039 | init_timer(&check_timer); | 1044 | init_timer(&lp->check_timer); |
1040 | check_timer.data = (unsigned long)dev; | 1045 | lp->check_timer.data = (unsigned long)dev; |
1041 | check_timer.function = at91ether_check_link; | 1046 | lp->check_timer.function = at91ether_check_link; |
1042 | } | 1047 | } |
1043 | 1048 | ||
1044 | /* Display ethernet banner */ | 1049 | /* Display ethernet banner */ |
@@ -1115,15 +1120,16 @@ static int __init at91ether_probe(struct platform_device *pdev) | |||
1115 | 1120 | ||
1116 | static int __devexit at91ether_remove(struct platform_device *pdev) | 1121 | static int __devexit at91ether_remove(struct platform_device *pdev) |
1117 | { | 1122 | { |
1118 | struct at91_private *lp = (struct at91_private *) at91_dev->priv; | 1123 | struct net_device *dev = platform_get_drvdata(pdev); |
1124 | struct at91_private *lp = netdev_priv(dev); | ||
1119 | 1125 | ||
1120 | unregister_netdev(at91_dev); | 1126 | unregister_netdev(dev); |
1121 | free_irq(at91_dev->irq, at91_dev); | 1127 | free_irq(dev->irq, dev); |
1122 | dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys); | 1128 | dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys); |
1123 | clk_put(lp->ether_clk); | 1129 | clk_put(lp->ether_clk); |
1124 | 1130 | ||
1125 | free_netdev(at91_dev); | 1131 | platform_set_drvdata(pdev, NULL); |
1126 | at91_dev = NULL; | 1132 | free_netdev(dev); |
1127 | return 0; | 1133 | return 0; |
1128 | } | 1134 | } |
1129 | 1135 | ||
@@ -1131,8 +1137,8 @@ static int __devexit at91ether_remove(struct platform_device *pdev) | |||
1131 | 1137 | ||
1132 | static int at91ether_suspend(struct platform_device *pdev, pm_message_t mesg) | 1138 | static int at91ether_suspend(struct platform_device *pdev, pm_message_t mesg) |
1133 | { | 1139 | { |
1134 | struct at91_private *lp = (struct at91_private *) at91_dev->priv; | ||
1135 | struct net_device *net_dev = platform_get_drvdata(pdev); | 1140 | struct net_device *net_dev = platform_get_drvdata(pdev); |
1141 | struct at91_private *lp = netdev_priv(net_dev); | ||
1136 | int phy_irq = lp->board_data.phy_irq_pin; | 1142 | int phy_irq = lp->board_data.phy_irq_pin; |
1137 | 1143 | ||
1138 | if (netif_running(net_dev)) { | 1144 | if (netif_running(net_dev)) { |
@@ -1149,8 +1155,8 @@ static int at91ether_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
1149 | 1155 | ||
1150 | static int at91ether_resume(struct platform_device *pdev) | 1156 | static int at91ether_resume(struct platform_device *pdev) |
1151 | { | 1157 | { |
1152 | struct at91_private *lp = (struct at91_private *) at91_dev->priv; | ||
1153 | struct net_device *net_dev = platform_get_drvdata(pdev); | 1158 | struct net_device *net_dev = platform_get_drvdata(pdev); |
1159 | struct at91_private *lp = netdev_priv(net_dev); | ||
1154 | int phy_irq = lp->board_data.phy_irq_pin; | 1160 | int phy_irq = lp->board_data.phy_irq_pin; |
1155 | 1161 | ||
1156 | if (netif_running(net_dev)) { | 1162 | if (netif_running(net_dev)) { |
diff --git a/drivers/net/arm/at91_ether.h b/drivers/net/arm/at91_ether.h index d1e72e02be3a..b6b665de2ea0 100644 --- a/drivers/net/arm/at91_ether.h +++ b/drivers/net/arm/at91_ether.h | |||
@@ -87,6 +87,7 @@ struct at91_private | |||
87 | spinlock_t lock; /* lock for MDI interface */ | 87 | spinlock_t lock; /* lock for MDI interface */ |
88 | short phy_media; /* media interface type */ | 88 | short phy_media; /* media interface type */ |
89 | unsigned short phy_address; /* 5-bit MDI address of PHY (0..31) */ | 89 | unsigned short phy_address; /* 5-bit MDI address of PHY (0..31) */ |
90 | struct timer_list check_timer; /* Poll link status */ | ||
90 | 91 | ||
91 | /* Transmit */ | 92 | /* Transmit */ |
92 | struct sk_buff *skb; /* holds skb until xmit interrupt completes */ | 93 | struct sk_buff *skb; /* holds skb until xmit interrupt completes */ |
diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c index f3478a30e778..d6da3ce9ad79 100644 --- a/drivers/net/arm/ether1.c +++ b/drivers/net/arm/ether1.c | |||
@@ -254,7 +254,7 @@ ether1_readbuffer (struct net_device *dev, void *data, unsigned int start, unsig | |||
254 | } while (thislen); | 254 | } while (thislen); |
255 | } | 255 | } |
256 | 256 | ||
257 | static int __init | 257 | static int __devinit |
258 | ether1_ramtest(struct net_device *dev, unsigned char byte) | 258 | ether1_ramtest(struct net_device *dev, unsigned char byte) |
259 | { | 259 | { |
260 | unsigned char *buffer = kmalloc (BUFFER_SIZE, GFP_KERNEL); | 260 | unsigned char *buffer = kmalloc (BUFFER_SIZE, GFP_KERNEL); |
@@ -308,7 +308,7 @@ ether1_reset (struct net_device *dev) | |||
308 | return BUS_16; | 308 | return BUS_16; |
309 | } | 309 | } |
310 | 310 | ||
311 | static int __init | 311 | static int __devinit |
312 | ether1_init_2(struct net_device *dev) | 312 | ether1_init_2(struct net_device *dev) |
313 | { | 313 | { |
314 | int i; | 314 | int i; |
@@ -986,7 +986,7 @@ ether1_setmulticastlist (struct net_device *dev) | |||
986 | 986 | ||
987 | /* ------------------------------------------------------------------------- */ | 987 | /* ------------------------------------------------------------------------- */ |
988 | 988 | ||
989 | static void __init ether1_banner(void) | 989 | static void __devinit ether1_banner(void) |
990 | { | 990 | { |
991 | static unsigned int version_printed = 0; | 991 | static unsigned int version_printed = 0; |
992 | 992 | ||
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c index 84686c8a5bc2..4fc234785d56 100644 --- a/drivers/net/arm/ether3.c +++ b/drivers/net/arm/ether3.c | |||
@@ -198,7 +198,7 @@ static inline void ether3_ledon(struct net_device *dev) | |||
198 | * Read the ethernet address string from the on board rom. | 198 | * Read the ethernet address string from the on board rom. |
199 | * This is an ascii string!!! | 199 | * This is an ascii string!!! |
200 | */ | 200 | */ |
201 | static int __init | 201 | static int __devinit |
202 | ether3_addr(char *addr, struct expansion_card *ec) | 202 | ether3_addr(char *addr, struct expansion_card *ec) |
203 | { | 203 | { |
204 | struct in_chunk_dir cd; | 204 | struct in_chunk_dir cd; |
@@ -223,7 +223,7 @@ ether3_addr(char *addr, struct expansion_card *ec) | |||
223 | 223 | ||
224 | /* --------------------------------------------------------------------------- */ | 224 | /* --------------------------------------------------------------------------- */ |
225 | 225 | ||
226 | static int __init | 226 | static int __devinit |
227 | ether3_ramtest(struct net_device *dev, unsigned char byte) | 227 | ether3_ramtest(struct net_device *dev, unsigned char byte) |
228 | { | 228 | { |
229 | unsigned char *buffer = kmalloc(RX_END, GFP_KERNEL); | 229 | unsigned char *buffer = kmalloc(RX_END, GFP_KERNEL); |
@@ -272,7 +272,7 @@ ether3_ramtest(struct net_device *dev, unsigned char byte) | |||
272 | 272 | ||
273 | /* ------------------------------------------------------------------------------- */ | 273 | /* ------------------------------------------------------------------------------- */ |
274 | 274 | ||
275 | static int __init ether3_init_2(struct net_device *dev) | 275 | static int __devinit ether3_init_2(struct net_device *dev) |
276 | { | 276 | { |
277 | int i; | 277 | int i; |
278 | 278 | ||
@@ -765,7 +765,7 @@ static void ether3_tx(struct net_device *dev) | |||
765 | } | 765 | } |
766 | } | 766 | } |
767 | 767 | ||
768 | static void __init ether3_banner(void) | 768 | static void __devinit ether3_banner(void) |
769 | { | 769 | { |
770 | static unsigned version_printed = 0; | 770 | static unsigned version_printed = 0; |
771 | 771 | ||
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index 8620a5b470f5..56ae8babd919 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c | |||
@@ -908,7 +908,7 @@ int __init init_module(void) | |||
908 | return 0; | 908 | return 0; |
909 | } | 909 | } |
910 | 910 | ||
911 | void | 911 | void __exit |
912 | cleanup_module(void) | 912 | cleanup_module(void) |
913 | { | 913 | { |
914 | unregister_netdev(dev_at1700); | 914 | unregister_netdev(dev_at1700); |
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c index d79489e46249..7e37ac86a69a 100644 --- a/drivers/net/atarilance.c +++ b/drivers/net/atarilance.c | |||
@@ -1179,7 +1179,7 @@ static int lance_set_mac_address( struct net_device *dev, void *addr ) | |||
1179 | #ifdef MODULE | 1179 | #ifdef MODULE |
1180 | static struct net_device *atarilance_dev; | 1180 | static struct net_device *atarilance_dev; |
1181 | 1181 | ||
1182 | int init_module(void) | 1182 | int __init init_module(void) |
1183 | { | 1183 | { |
1184 | atarilance_dev = atarilance_probe(-1); | 1184 | atarilance_dev = atarilance_probe(-1); |
1185 | if (IS_ERR(atarilance_dev)) | 1185 | if (IS_ERR(atarilance_dev)) |
@@ -1187,7 +1187,7 @@ int init_module(void) | |||
1187 | return 0; | 1187 | return 0; |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | void cleanup_module(void) | 1190 | void __exit cleanup_module(void) |
1191 | { | 1191 | { |
1192 | unregister_netdev(atarilance_dev); | 1192 | unregister_netdev(atarilance_dev); |
1193 | free_irq(atarilance_dev->irq, atarilance_dev); | 1193 | free_irq(atarilance_dev->irq, atarilance_dev); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 488d8ed9e740..6482aed4bb7c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -3684,7 +3684,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd | |||
3684 | mii->val_out = 0; | 3684 | mii->val_out = 0; |
3685 | read_lock_bh(&bond->lock); | 3685 | read_lock_bh(&bond->lock); |
3686 | read_lock(&bond->curr_slave_lock); | 3686 | read_lock(&bond->curr_slave_lock); |
3687 | if (bond->curr_active_slave) { | 3687 | if (netif_carrier_ok(bond->dev)) { |
3688 | mii->val_out = BMSR_LSTATUS; | 3688 | mii->val_out = BMSR_LSTATUS; |
3689 | } | 3689 | } |
3690 | read_unlock(&bond->curr_slave_lock); | 3690 | read_unlock(&bond->curr_slave_lock); |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index dec70c2b374a..4612f71a7106 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -1974,7 +1974,7 @@ out: | |||
1974 | return ret; | 1974 | return ret; |
1975 | } | 1975 | } |
1976 | 1976 | ||
1977 | void | 1977 | void __exit |
1978 | cleanup_module(void) | 1978 | cleanup_module(void) |
1979 | { | 1979 | { |
1980 | unregister_netdev(dev_cs89x0); | 1980 | unregister_netdev(dev_cs89x0); |
diff --git a/drivers/net/de600.c b/drivers/net/de600.c index 690bb40b353d..8396e411f1ce 100644 --- a/drivers/net/de600.c +++ b/drivers/net/de600.c | |||
@@ -43,7 +43,6 @@ static const char version[] = "de600.c: $Revision: 1.41-2.5 $, Bjorn Ekwall (bj | |||
43 | * modify the following "#define": (see <asm/io.h> for more info) | 43 | * modify the following "#define": (see <asm/io.h> for more info) |
44 | #define REALLY_SLOW_IO | 44 | #define REALLY_SLOW_IO |
45 | */ | 45 | */ |
46 | #define SLOW_IO_BY_JUMPING /* Looks "better" than dummy write to port 0x80 :-) */ | ||
47 | 46 | ||
48 | /* use 0 for production, 1 for verification, >2 for debug */ | 47 | /* use 0 for production, 1 for verification, >2 for debug */ |
49 | #ifdef DE600_DEBUG | 48 | #ifdef DE600_DEBUG |
diff --git a/drivers/net/declance.c b/drivers/net/declance.c index 00e2a8a134d7..4ae0fed7122e 100644 --- a/drivers/net/declance.c +++ b/drivers/net/declance.c | |||
@@ -40,6 +40,10 @@ | |||
40 | * | 40 | * |
41 | * v0.009: Module support fixes, multiple interfaces support, various | 41 | * v0.009: Module support fixes, multiple interfaces support, various |
42 | * bits. macro | 42 | * bits. macro |
43 | * | ||
44 | * v0.010: Fixes for the PMAD mapping of the LANCE buffer and for the | ||
45 | * PMAX requirement to only use halfword accesses to the | ||
46 | * buffer. macro | ||
43 | */ | 47 | */ |
44 | 48 | ||
45 | #include <linux/crc32.h> | 49 | #include <linux/crc32.h> |
@@ -54,6 +58,7 @@ | |||
54 | #include <linux/spinlock.h> | 58 | #include <linux/spinlock.h> |
55 | #include <linux/stddef.h> | 59 | #include <linux/stddef.h> |
56 | #include <linux/string.h> | 60 | #include <linux/string.h> |
61 | #include <linux/types.h> | ||
57 | 62 | ||
58 | #include <asm/addrspace.h> | 63 | #include <asm/addrspace.h> |
59 | #include <asm/system.h> | 64 | #include <asm/system.h> |
@@ -67,7 +72,7 @@ | |||
67 | #include <asm/dec/tc.h> | 72 | #include <asm/dec/tc.h> |
68 | 73 | ||
69 | static char version[] __devinitdata = | 74 | static char version[] __devinitdata = |
70 | "declance.c: v0.009 by Linux MIPS DECstation task force\n"; | 75 | "declance.c: v0.010 by Linux MIPS DECstation task force\n"; |
71 | 76 | ||
72 | MODULE_AUTHOR("Linux MIPS DECstation task force"); | 77 | MODULE_AUTHOR("Linux MIPS DECstation task force"); |
73 | MODULE_DESCRIPTION("DEC LANCE (DECstation onboard, PMAD-xx) driver"); | 78 | MODULE_DESCRIPTION("DEC LANCE (DECstation onboard, PMAD-xx) driver"); |
@@ -110,24 +115,25 @@ MODULE_LICENSE("GPL"); | |||
110 | #define LE_C3_BCON 0x1 /* Byte control */ | 115 | #define LE_C3_BCON 0x1 /* Byte control */ |
111 | 116 | ||
112 | /* Receive message descriptor 1 */ | 117 | /* Receive message descriptor 1 */ |
113 | #define LE_R1_OWN 0x80 /* Who owns the entry */ | 118 | #define LE_R1_OWN 0x8000 /* Who owns the entry */ |
114 | #define LE_R1_ERR 0x40 /* Error: if FRA, OFL, CRC or BUF is set */ | 119 | #define LE_R1_ERR 0x4000 /* Error: if FRA, OFL, CRC or BUF is set */ |
115 | #define LE_R1_FRA 0x20 /* FRA: Frame error */ | 120 | #define LE_R1_FRA 0x2000 /* FRA: Frame error */ |
116 | #define LE_R1_OFL 0x10 /* OFL: Frame overflow */ | 121 | #define LE_R1_OFL 0x1000 /* OFL: Frame overflow */ |
117 | #define LE_R1_CRC 0x08 /* CRC error */ | 122 | #define LE_R1_CRC 0x0800 /* CRC error */ |
118 | #define LE_R1_BUF 0x04 /* BUF: Buffer error */ | 123 | #define LE_R1_BUF 0x0400 /* BUF: Buffer error */ |
119 | #define LE_R1_SOP 0x02 /* Start of packet */ | 124 | #define LE_R1_SOP 0x0200 /* Start of packet */ |
120 | #define LE_R1_EOP 0x01 /* End of packet */ | 125 | #define LE_R1_EOP 0x0100 /* End of packet */ |
121 | #define LE_R1_POK 0x03 /* Packet is complete: SOP + EOP */ | 126 | #define LE_R1_POK 0x0300 /* Packet is complete: SOP + EOP */ |
122 | 127 | ||
123 | #define LE_T1_OWN 0x80 /* Lance owns the packet */ | 128 | /* Transmit message descriptor 1 */ |
124 | #define LE_T1_ERR 0x40 /* Error summary */ | 129 | #define LE_T1_OWN 0x8000 /* Lance owns the packet */ |
125 | #define LE_T1_EMORE 0x10 /* Error: more than one retry needed */ | 130 | #define LE_T1_ERR 0x4000 /* Error summary */ |
126 | #define LE_T1_EONE 0x08 /* Error: one retry needed */ | 131 | #define LE_T1_EMORE 0x1000 /* Error: more than one retry needed */ |
127 | #define LE_T1_EDEF 0x04 /* Error: deferred */ | 132 | #define LE_T1_EONE 0x0800 /* Error: one retry needed */ |
128 | #define LE_T1_SOP 0x02 /* Start of packet */ | 133 | #define LE_T1_EDEF 0x0400 /* Error: deferred */ |
129 | #define LE_T1_EOP 0x01 /* End of packet */ | 134 | #define LE_T1_SOP 0x0200 /* Start of packet */ |
130 | #define LE_T1_POK 0x03 /* Packet is complete: SOP + EOP */ | 135 | #define LE_T1_EOP 0x0100 /* End of packet */ |
136 | #define LE_T1_POK 0x0300 /* Packet is complete: SOP + EOP */ | ||
131 | 137 | ||
132 | #define LE_T3_BUF 0x8000 /* Buffer error */ | 138 | #define LE_T3_BUF 0x8000 /* Buffer error */ |
133 | #define LE_T3_UFL 0x4000 /* Error underflow */ | 139 | #define LE_T3_UFL 0x4000 /* Error underflow */ |
@@ -156,69 +162,57 @@ MODULE_LICENSE("GPL"); | |||
156 | #undef TEST_HITS | 162 | #undef TEST_HITS |
157 | #define ZERO 0 | 163 | #define ZERO 0 |
158 | 164 | ||
159 | /* The DS2000/3000 have a linear 64 KB buffer. | 165 | /* |
160 | 166 | * The DS2100/3100 have a linear 64 kB buffer which supports halfword | |
161 | * The PMAD-AA has 128 kb buffer on-board. | 167 | * accesses only. Each halfword of the buffer is word-aligned in the |
168 | * CPU address space. | ||
162 | * | 169 | * |
163 | * The IOASIC LANCE devices use a shared memory region. This region as seen | 170 | * The PMAD-AA has a 128 kB buffer on-board. |
164 | * from the CPU is (max) 128 KB long and has to be on an 128 KB boundary. | ||
165 | * The LANCE sees this as a 64 KB long continuous memory region. | ||
166 | * | 171 | * |
167 | * The LANCE's DMA address is used as an index in this buffer and DMA takes | 172 | * The IOASIC LANCE devices use a shared memory region. This region |
168 | * place in bursts of eight 16-Bit words which are packed into four 32-Bit words | 173 | * as seen from the CPU is (max) 128 kB long and has to be on an 128 kB |
169 | * by the IOASIC. This leads to a strange padding: 16 bytes of valid data followed | 174 | * boundary. The LANCE sees this as a 64 kB long continuous memory |
170 | * by a 16 byte gap :-(. | 175 | * region. |
176 | * | ||
177 | * The LANCE's DMA address is used as an index in this buffer and DMA | ||
178 | * takes place in bursts of eight 16-bit words which are packed into | ||
179 | * four 32-bit words by the IOASIC. This leads to a strange padding: | ||
180 | * 16 bytes of valid data followed by a 16 byte gap :-(. | ||
171 | */ | 181 | */ |
172 | 182 | ||
173 | struct lance_rx_desc { | 183 | struct lance_rx_desc { |
174 | unsigned short rmd0; /* low address of packet */ | 184 | unsigned short rmd0; /* low address of packet */ |
175 | short gap0; | 185 | unsigned short rmd1; /* high address of packet |
176 | unsigned char rmd1_hadr; /* high address of packet */ | 186 | and descriptor bits */ |
177 | unsigned char rmd1_bits; /* descriptor bits */ | ||
178 | short gap1; | ||
179 | short length; /* 2s complement (negative!) | 187 | short length; /* 2s complement (negative!) |
180 | of buffer length */ | 188 | of buffer length */ |
181 | short gap2; | ||
182 | unsigned short mblength; /* actual number of bytes received */ | 189 | unsigned short mblength; /* actual number of bytes received */ |
183 | short gap3; | ||
184 | }; | 190 | }; |
185 | 191 | ||
186 | struct lance_tx_desc { | 192 | struct lance_tx_desc { |
187 | unsigned short tmd0; /* low address of packet */ | 193 | unsigned short tmd0; /* low address of packet */ |
188 | short gap0; | 194 | unsigned short tmd1; /* high address of packet |
189 | unsigned char tmd1_hadr; /* high address of packet */ | 195 | and descriptor bits */ |
190 | unsigned char tmd1_bits; /* descriptor bits */ | ||
191 | short gap1; | ||
192 | short length; /* 2s complement (negative!) | 196 | short length; /* 2s complement (negative!) |
193 | of buffer length */ | 197 | of buffer length */ |
194 | short gap2; | ||
195 | unsigned short misc; | 198 | unsigned short misc; |
196 | short gap3; | ||
197 | }; | 199 | }; |
198 | 200 | ||
199 | 201 | ||
200 | /* First part of the LANCE initialization block, described in databook. */ | 202 | /* First part of the LANCE initialization block, described in databook. */ |
201 | struct lance_init_block { | 203 | struct lance_init_block { |
202 | unsigned short mode; /* pre-set mode (reg. 15) */ | 204 | unsigned short mode; /* pre-set mode (reg. 15) */ |
203 | short gap0; | ||
204 | 205 | ||
205 | unsigned char phys_addr[12]; /* physical ethernet address | 206 | unsigned short phys_addr[3]; /* physical ethernet address */ |
206 | only 0, 1, 4, 5, 8, 9 are valid | 207 | unsigned short filter[4]; /* multicast filter */ |
207 | 2, 3, 6, 7, 10, 11 are gaps */ | ||
208 | unsigned short filter[8]; /* multicast filter | ||
209 | only 0, 2, 4, 6 are valid | ||
210 | 1, 3, 5, 7 are gaps */ | ||
211 | 208 | ||
212 | /* Receive and transmit ring base, along with extra bits. */ | 209 | /* Receive and transmit ring base, along with extra bits. */ |
213 | unsigned short rx_ptr; /* receive descriptor addr */ | 210 | unsigned short rx_ptr; /* receive descriptor addr */ |
214 | short gap1; | ||
215 | unsigned short rx_len; /* receive len and high addr */ | 211 | unsigned short rx_len; /* receive len and high addr */ |
216 | short gap2; | ||
217 | unsigned short tx_ptr; /* transmit descriptor addr */ | 212 | unsigned short tx_ptr; /* transmit descriptor addr */ |
218 | short gap3; | ||
219 | unsigned short tx_len; /* transmit len and high addr */ | 213 | unsigned short tx_len; /* transmit len and high addr */ |
220 | short gap4; | 214 | |
221 | short gap5[8]; | 215 | short gap[4]; |
222 | 216 | ||
223 | /* The buffer descriptors */ | 217 | /* The buffer descriptors */ |
224 | struct lance_rx_desc brx_ring[RX_RING_SIZE]; | 218 | struct lance_rx_desc brx_ring[RX_RING_SIZE]; |
@@ -226,15 +220,28 @@ struct lance_init_block { | |||
226 | }; | 220 | }; |
227 | 221 | ||
228 | #define BUF_OFFSET_CPU sizeof(struct lance_init_block) | 222 | #define BUF_OFFSET_CPU sizeof(struct lance_init_block) |
229 | #define BUF_OFFSET_LNC (sizeof(struct lance_init_block)>>1) | 223 | #define BUF_OFFSET_LNC sizeof(struct lance_init_block) |
230 | 224 | ||
231 | #define libdesc_offset(rt, elem) \ | 225 | #define shift_off(off, type) \ |
232 | ((__u32)(((unsigned long)(&(((struct lance_init_block *)0)->rt[elem]))))) | 226 | (type == ASIC_LANCE || type == PMAX_LANCE ? off << 1 : off) |
233 | 227 | ||
234 | /* | 228 | #define lib_off(rt, type) \ |
235 | * This works *only* for the ring descriptors | 229 | shift_off(offsetof(struct lance_init_block, rt), type) |
236 | */ | 230 | |
237 | #define LANCE_ADDR(x) (CPHYSADDR(x) >> 1) | 231 | #define lib_ptr(ib, rt, type) \ |
232 | ((volatile u16 *)((u8 *)(ib) + lib_off(rt, type))) | ||
233 | |||
234 | #define rds_off(rt, type) \ | ||
235 | shift_off(offsetof(struct lance_rx_desc, rt), type) | ||
236 | |||
237 | #define rds_ptr(rd, rt, type) \ | ||
238 | ((volatile u16 *)((u8 *)(rd) + rds_off(rt, type))) | ||
239 | |||
240 | #define tds_off(rt, type) \ | ||
241 | shift_off(offsetof(struct lance_tx_desc, rt), type) | ||
242 | |||
243 | #define tds_ptr(td, rt, type) \ | ||
244 | ((volatile u16 *)((u8 *)(td) + tds_off(rt, type))) | ||
238 | 245 | ||
239 | struct lance_private { | 246 | struct lance_private { |
240 | struct net_device *next; | 247 | struct net_device *next; |
@@ -242,7 +249,6 @@ struct lance_private { | |||
242 | int slot; | 249 | int slot; |
243 | int dma_irq; | 250 | int dma_irq; |
244 | volatile struct lance_regs *ll; | 251 | volatile struct lance_regs *ll; |
245 | volatile struct lance_init_block *init_block; | ||
246 | 252 | ||
247 | spinlock_t lock; | 253 | spinlock_t lock; |
248 | 254 | ||
@@ -260,8 +266,8 @@ struct lance_private { | |||
260 | char *tx_buf_ptr_cpu[TX_RING_SIZE]; | 266 | char *tx_buf_ptr_cpu[TX_RING_SIZE]; |
261 | 267 | ||
262 | /* Pointers to the ring buffers as seen from the LANCE */ | 268 | /* Pointers to the ring buffers as seen from the LANCE */ |
263 | char *rx_buf_ptr_lnc[RX_RING_SIZE]; | 269 | uint rx_buf_ptr_lnc[RX_RING_SIZE]; |
264 | char *tx_buf_ptr_lnc[TX_RING_SIZE]; | 270 | uint tx_buf_ptr_lnc[TX_RING_SIZE]; |
265 | }; | 271 | }; |
266 | 272 | ||
267 | #define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\ | 273 | #define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\ |
@@ -294,7 +300,7 @@ static inline void writereg(volatile unsigned short *regptr, short value) | |||
294 | static void load_csrs(struct lance_private *lp) | 300 | static void load_csrs(struct lance_private *lp) |
295 | { | 301 | { |
296 | volatile struct lance_regs *ll = lp->ll; | 302 | volatile struct lance_regs *ll = lp->ll; |
297 | int leptr; | 303 | uint leptr; |
298 | 304 | ||
299 | /* The address space as seen from the LANCE | 305 | /* The address space as seen from the LANCE |
300 | * begins at address 0. HK | 306 | * begins at address 0. HK |
@@ -316,12 +322,14 @@ static void load_csrs(struct lance_private *lp) | |||
316 | * Our specialized copy routines | 322 | * Our specialized copy routines |
317 | * | 323 | * |
318 | */ | 324 | */ |
319 | void cp_to_buf(const int type, void *to, const void *from, int len) | 325 | static void cp_to_buf(const int type, void *to, const void *from, int len) |
320 | { | 326 | { |
321 | unsigned short *tp, *fp, clen; | 327 | unsigned short *tp, *fp, clen; |
322 | unsigned char *rtp, *rfp; | 328 | unsigned char *rtp, *rfp; |
323 | 329 | ||
324 | if (type == PMAX_LANCE) { | 330 | if (type == PMAD_LANCE) { |
331 | memcpy(to, from, len); | ||
332 | } else if (type == PMAX_LANCE) { | ||
325 | clen = len >> 1; | 333 | clen = len >> 1; |
326 | tp = (unsigned short *) to; | 334 | tp = (unsigned short *) to; |
327 | fp = (unsigned short *) from; | 335 | fp = (unsigned short *) from; |
@@ -370,12 +378,14 @@ void cp_to_buf(const int type, void *to, const void *from, int len) | |||
370 | iob(); | 378 | iob(); |
371 | } | 379 | } |
372 | 380 | ||
373 | void cp_from_buf(const int type, void *to, const void *from, int len) | 381 | static void cp_from_buf(const int type, void *to, const void *from, int len) |
374 | { | 382 | { |
375 | unsigned short *tp, *fp, clen; | 383 | unsigned short *tp, *fp, clen; |
376 | unsigned char *rtp, *rfp; | 384 | unsigned char *rtp, *rfp; |
377 | 385 | ||
378 | if (type == PMAX_LANCE) { | 386 | if (type == PMAD_LANCE) { |
387 | memcpy(to, from, len); | ||
388 | } else if (type == PMAX_LANCE) { | ||
379 | clen = len >> 1; | 389 | clen = len >> 1; |
380 | tp = (unsigned short *) to; | 390 | tp = (unsigned short *) to; |
381 | fp = (unsigned short *) from; | 391 | fp = (unsigned short *) from; |
@@ -431,12 +441,10 @@ void cp_from_buf(const int type, void *to, const void *from, int len) | |||
431 | static void lance_init_ring(struct net_device *dev) | 441 | static void lance_init_ring(struct net_device *dev) |
432 | { | 442 | { |
433 | struct lance_private *lp = netdev_priv(dev); | 443 | struct lance_private *lp = netdev_priv(dev); |
434 | volatile struct lance_init_block *ib; | 444 | volatile u16 *ib = (volatile u16 *)dev->mem_start; |
435 | int leptr; | 445 | uint leptr; |
436 | int i; | 446 | int i; |
437 | 447 | ||
438 | ib = (struct lance_init_block *) (dev->mem_start); | ||
439 | |||
440 | /* Lock out other processes while setting up hardware */ | 448 | /* Lock out other processes while setting up hardware */ |
441 | netif_stop_queue(dev); | 449 | netif_stop_queue(dev); |
442 | lp->rx_new = lp->tx_new = 0; | 450 | lp->rx_new = lp->tx_new = 0; |
@@ -445,55 +453,64 @@ static void lance_init_ring(struct net_device *dev) | |||
445 | /* Copy the ethernet address to the lance init block. | 453 | /* Copy the ethernet address to the lance init block. |
446 | * XXX bit 0 of the physical address registers has to be zero | 454 | * XXX bit 0 of the physical address registers has to be zero |
447 | */ | 455 | */ |
448 | ib->phys_addr[0] = dev->dev_addr[0]; | 456 | *lib_ptr(ib, phys_addr[0], lp->type) = (dev->dev_addr[1] << 8) | |
449 | ib->phys_addr[1] = dev->dev_addr[1]; | 457 | dev->dev_addr[0]; |
450 | ib->phys_addr[4] = dev->dev_addr[2]; | 458 | *lib_ptr(ib, phys_addr[1], lp->type) = (dev->dev_addr[3] << 8) | |
451 | ib->phys_addr[5] = dev->dev_addr[3]; | 459 | dev->dev_addr[2]; |
452 | ib->phys_addr[8] = dev->dev_addr[4]; | 460 | *lib_ptr(ib, phys_addr[2], lp->type) = (dev->dev_addr[5] << 8) | |
453 | ib->phys_addr[9] = dev->dev_addr[5]; | 461 | dev->dev_addr[4]; |
454 | /* Setup the initialization block */ | 462 | /* Setup the initialization block */ |
455 | 463 | ||
456 | /* Setup rx descriptor pointer */ | 464 | /* Setup rx descriptor pointer */ |
457 | leptr = LANCE_ADDR(libdesc_offset(brx_ring, 0)); | 465 | leptr = offsetof(struct lance_init_block, brx_ring); |
458 | ib->rx_len = (LANCE_LOG_RX_BUFFERS << 13) | (leptr >> 16); | 466 | *lib_ptr(ib, rx_len, lp->type) = (LANCE_LOG_RX_BUFFERS << 13) | |
459 | ib->rx_ptr = leptr; | 467 | (leptr >> 16); |
468 | *lib_ptr(ib, rx_ptr, lp->type) = leptr; | ||
460 | if (ZERO) | 469 | if (ZERO) |
461 | printk("RX ptr: %8.8x(%8.8x)\n", leptr, libdesc_offset(brx_ring, 0)); | 470 | printk("RX ptr: %8.8x(%8.8x)\n", |
471 | leptr, lib_off(brx_ring, lp->type)); | ||
462 | 472 | ||
463 | /* Setup tx descriptor pointer */ | 473 | /* Setup tx descriptor pointer */ |
464 | leptr = LANCE_ADDR(libdesc_offset(btx_ring, 0)); | 474 | leptr = offsetof(struct lance_init_block, btx_ring); |
465 | ib->tx_len = (LANCE_LOG_TX_BUFFERS << 13) | (leptr >> 16); | 475 | *lib_ptr(ib, tx_len, lp->type) = (LANCE_LOG_TX_BUFFERS << 13) | |
466 | ib->tx_ptr = leptr; | 476 | (leptr >> 16); |
477 | *lib_ptr(ib, tx_ptr, lp->type) = leptr; | ||
467 | if (ZERO) | 478 | if (ZERO) |
468 | printk("TX ptr: %8.8x(%8.8x)\n", leptr, libdesc_offset(btx_ring, 0)); | 479 | printk("TX ptr: %8.8x(%8.8x)\n", |
480 | leptr, lib_off(btx_ring, lp->type)); | ||
469 | 481 | ||
470 | if (ZERO) | 482 | if (ZERO) |
471 | printk("TX rings:\n"); | 483 | printk("TX rings:\n"); |
472 | 484 | ||
473 | /* Setup the Tx ring entries */ | 485 | /* Setup the Tx ring entries */ |
474 | for (i = 0; i < TX_RING_SIZE; i++) { | 486 | for (i = 0; i < TX_RING_SIZE; i++) { |
475 | leptr = (int) lp->tx_buf_ptr_lnc[i]; | 487 | leptr = lp->tx_buf_ptr_lnc[i]; |
476 | ib->btx_ring[i].tmd0 = leptr; | 488 | *lib_ptr(ib, btx_ring[i].tmd0, lp->type) = leptr; |
477 | ib->btx_ring[i].tmd1_hadr = leptr >> 16; | 489 | *lib_ptr(ib, btx_ring[i].tmd1, lp->type) = (leptr >> 16) & |
478 | ib->btx_ring[i].tmd1_bits = 0; | 490 | 0xff; |
479 | ib->btx_ring[i].length = 0xf000; /* The ones required by tmd2 */ | 491 | *lib_ptr(ib, btx_ring[i].length, lp->type) = 0xf000; |
480 | ib->btx_ring[i].misc = 0; | 492 | /* The ones required by tmd2 */ |
493 | *lib_ptr(ib, btx_ring[i].misc, lp->type) = 0; | ||
481 | if (i < 3 && ZERO) | 494 | if (i < 3 && ZERO) |
482 | printk("%d: 0x%8.8x(0x%8.8x)\n", i, leptr, (int) lp->tx_buf_ptr_cpu[i]); | 495 | printk("%d: 0x%8.8x(0x%8.8x)\n", |
496 | i, leptr, (uint)lp->tx_buf_ptr_cpu[i]); | ||
483 | } | 497 | } |
484 | 498 | ||
485 | /* Setup the Rx ring entries */ | 499 | /* Setup the Rx ring entries */ |
486 | if (ZERO) | 500 | if (ZERO) |
487 | printk("RX rings:\n"); | 501 | printk("RX rings:\n"); |
488 | for (i = 0; i < RX_RING_SIZE; i++) { | 502 | for (i = 0; i < RX_RING_SIZE; i++) { |
489 | leptr = (int) lp->rx_buf_ptr_lnc[i]; | 503 | leptr = lp->rx_buf_ptr_lnc[i]; |
490 | ib->brx_ring[i].rmd0 = leptr; | 504 | *lib_ptr(ib, brx_ring[i].rmd0, lp->type) = leptr; |
491 | ib->brx_ring[i].rmd1_hadr = leptr >> 16; | 505 | *lib_ptr(ib, brx_ring[i].rmd1, lp->type) = ((leptr >> 16) & |
492 | ib->brx_ring[i].rmd1_bits = LE_R1_OWN; | 506 | 0xff) | |
493 | ib->brx_ring[i].length = -RX_BUFF_SIZE | 0xf000; | 507 | LE_R1_OWN; |
494 | ib->brx_ring[i].mblength = 0; | 508 | *lib_ptr(ib, brx_ring[i].length, lp->type) = -RX_BUFF_SIZE | |
509 | 0xf000; | ||
510 | *lib_ptr(ib, brx_ring[i].mblength, lp->type) = 0; | ||
495 | if (i < 3 && ZERO) | 511 | if (i < 3 && ZERO) |
496 | printk("%d: 0x%8.8x(0x%8.8x)\n", i, leptr, (int) lp->rx_buf_ptr_cpu[i]); | 512 | printk("%d: 0x%8.8x(0x%8.8x)\n", |
513 | i, leptr, (uint)lp->rx_buf_ptr_cpu[i]); | ||
497 | } | 514 | } |
498 | iob(); | 515 | iob(); |
499 | } | 516 | } |
@@ -511,11 +528,13 @@ static int init_restart_lance(struct lance_private *lp) | |||
511 | udelay(10); | 528 | udelay(10); |
512 | } | 529 | } |
513 | if ((i == 100) || (ll->rdp & LE_C0_ERR)) { | 530 | if ((i == 100) || (ll->rdp & LE_C0_ERR)) { |
514 | printk("LANCE unopened after %d ticks, csr0=%4.4x.\n", i, ll->rdp); | 531 | printk("LANCE unopened after %d ticks, csr0=%4.4x.\n", |
532 | i, ll->rdp); | ||
515 | return -1; | 533 | return -1; |
516 | } | 534 | } |
517 | if ((ll->rdp & LE_C0_ERR)) { | 535 | if ((ll->rdp & LE_C0_ERR)) { |
518 | printk("LANCE unopened after %d ticks, csr0=%4.4x.\n", i, ll->rdp); | 536 | printk("LANCE unopened after %d ticks, csr0=%4.4x.\n", |
537 | i, ll->rdp); | ||
519 | return -1; | 538 | return -1; |
520 | } | 539 | } |
521 | writereg(&ll->rdp, LE_C0_IDON); | 540 | writereg(&ll->rdp, LE_C0_IDON); |
@@ -528,12 +547,11 @@ static int init_restart_lance(struct lance_private *lp) | |||
528 | static int lance_rx(struct net_device *dev) | 547 | static int lance_rx(struct net_device *dev) |
529 | { | 548 | { |
530 | struct lance_private *lp = netdev_priv(dev); | 549 | struct lance_private *lp = netdev_priv(dev); |
531 | volatile struct lance_init_block *ib; | 550 | volatile u16 *ib = (volatile u16 *)dev->mem_start; |
532 | volatile struct lance_rx_desc *rd = 0; | 551 | volatile u16 *rd; |
533 | unsigned char bits; | 552 | unsigned short bits; |
534 | int len = 0; | 553 | int entry, len; |
535 | struct sk_buff *skb = 0; | 554 | struct sk_buff *skb; |
536 | ib = (struct lance_init_block *) (dev->mem_start); | ||
537 | 555 | ||
538 | #ifdef TEST_HITS | 556 | #ifdef TEST_HITS |
539 | { | 557 | { |
@@ -542,19 +560,22 @@ static int lance_rx(struct net_device *dev) | |||
542 | printk("["); | 560 | printk("["); |
543 | for (i = 0; i < RX_RING_SIZE; i++) { | 561 | for (i = 0; i < RX_RING_SIZE; i++) { |
544 | if (i == lp->rx_new) | 562 | if (i == lp->rx_new) |
545 | printk("%s", ib->brx_ring[i].rmd1_bits & | 563 | printk("%s", *lib_ptr(ib, brx_ring[i].rmd1, |
564 | lp->type) & | ||
546 | LE_R1_OWN ? "_" : "X"); | 565 | LE_R1_OWN ? "_" : "X"); |
547 | else | 566 | else |
548 | printk("%s", ib->brx_ring[i].rmd1_bits & | 567 | printk("%s", *lib_ptr(ib, brx_ring[i].rmd1, |
568 | lp->type) & | ||
549 | LE_R1_OWN ? "." : "1"); | 569 | LE_R1_OWN ? "." : "1"); |
550 | } | 570 | } |
551 | printk("]"); | 571 | printk("]"); |
552 | } | 572 | } |
553 | #endif | 573 | #endif |
554 | 574 | ||
555 | for (rd = &ib->brx_ring[lp->rx_new]; | 575 | for (rd = lib_ptr(ib, brx_ring[lp->rx_new], lp->type); |
556 | !((bits = rd->rmd1_bits) & LE_R1_OWN); | 576 | !((bits = *rds_ptr(rd, rmd1, lp->type)) & LE_R1_OWN); |
557 | rd = &ib->brx_ring[lp->rx_new]) { | 577 | rd = lib_ptr(ib, brx_ring[lp->rx_new], lp->type)) { |
578 | entry = lp->rx_new; | ||
558 | 579 | ||
559 | /* We got an incomplete frame? */ | 580 | /* We got an incomplete frame? */ |
560 | if ((bits & LE_R1_POK) != LE_R1_POK) { | 581 | if ((bits & LE_R1_POK) != LE_R1_POK) { |
@@ -575,16 +596,18 @@ static int lance_rx(struct net_device *dev) | |||
575 | if (bits & LE_R1_EOP) | 596 | if (bits & LE_R1_EOP) |
576 | lp->stats.rx_errors++; | 597 | lp->stats.rx_errors++; |
577 | } else { | 598 | } else { |
578 | len = (rd->mblength & 0xfff) - 4; | 599 | len = (*rds_ptr(rd, mblength, lp->type) & 0xfff) - 4; |
579 | skb = dev_alloc_skb(len + 2); | 600 | skb = dev_alloc_skb(len + 2); |
580 | 601 | ||
581 | if (skb == 0) { | 602 | if (skb == 0) { |
582 | printk("%s: Memory squeeze, deferring packet.\n", | 603 | printk("%s: Memory squeeze, deferring packet.\n", |
583 | dev->name); | 604 | dev->name); |
584 | lp->stats.rx_dropped++; | 605 | lp->stats.rx_dropped++; |
585 | rd->mblength = 0; | 606 | *rds_ptr(rd, mblength, lp->type) = 0; |
586 | rd->rmd1_bits = LE_R1_OWN; | 607 | *rds_ptr(rd, rmd1, lp->type) = |
587 | lp->rx_new = (lp->rx_new + 1) & RX_RING_MOD_MASK; | 608 | ((lp->rx_buf_ptr_lnc[entry] >> 16) & |
609 | 0xff) | LE_R1_OWN; | ||
610 | lp->rx_new = (entry + 1) & RX_RING_MOD_MASK; | ||
588 | return 0; | 611 | return 0; |
589 | } | 612 | } |
590 | lp->stats.rx_bytes += len; | 613 | lp->stats.rx_bytes += len; |
@@ -594,8 +617,7 @@ static int lance_rx(struct net_device *dev) | |||
594 | skb_put(skb, len); /* make room */ | 617 | skb_put(skb, len); /* make room */ |
595 | 618 | ||
596 | cp_from_buf(lp->type, skb->data, | 619 | cp_from_buf(lp->type, skb->data, |
597 | (char *)lp->rx_buf_ptr_cpu[lp->rx_new], | 620 | (char *)lp->rx_buf_ptr_cpu[entry], len); |
598 | len); | ||
599 | 621 | ||
600 | skb->protocol = eth_type_trans(skb, dev); | 622 | skb->protocol = eth_type_trans(skb, dev); |
601 | netif_rx(skb); | 623 | netif_rx(skb); |
@@ -604,10 +626,11 @@ static int lance_rx(struct net_device *dev) | |||
604 | } | 626 | } |
605 | 627 | ||
606 | /* Return the packet to the pool */ | 628 | /* Return the packet to the pool */ |
607 | rd->mblength = 0; | 629 | *rds_ptr(rd, mblength, lp->type) = 0; |
608 | rd->length = -RX_BUFF_SIZE | 0xf000; | 630 | *rds_ptr(rd, length, lp->type) = -RX_BUFF_SIZE | 0xf000; |
609 | rd->rmd1_bits = LE_R1_OWN; | 631 | *rds_ptr(rd, rmd1, lp->type) = |
610 | lp->rx_new = (lp->rx_new + 1) & RX_RING_MOD_MASK; | 632 | ((lp->rx_buf_ptr_lnc[entry] >> 16) & 0xff) | LE_R1_OWN; |
633 | lp->rx_new = (entry + 1) & RX_RING_MOD_MASK; | ||
611 | } | 634 | } |
612 | return 0; | 635 | return 0; |
613 | } | 636 | } |
@@ -615,24 +638,24 @@ static int lance_rx(struct net_device *dev) | |||
615 | static void lance_tx(struct net_device *dev) | 638 | static void lance_tx(struct net_device *dev) |
616 | { | 639 | { |
617 | struct lance_private *lp = netdev_priv(dev); | 640 | struct lance_private *lp = netdev_priv(dev); |
618 | volatile struct lance_init_block *ib; | 641 | volatile u16 *ib = (volatile u16 *)dev->mem_start; |
619 | volatile struct lance_regs *ll = lp->ll; | 642 | volatile struct lance_regs *ll = lp->ll; |
620 | volatile struct lance_tx_desc *td; | 643 | volatile u16 *td; |
621 | int i, j; | 644 | int i, j; |
622 | int status; | 645 | int status; |
623 | ib = (struct lance_init_block *) (dev->mem_start); | 646 | |
624 | j = lp->tx_old; | 647 | j = lp->tx_old; |
625 | 648 | ||
626 | spin_lock(&lp->lock); | 649 | spin_lock(&lp->lock); |
627 | 650 | ||
628 | for (i = j; i != lp->tx_new; i = j) { | 651 | for (i = j; i != lp->tx_new; i = j) { |
629 | td = &ib->btx_ring[i]; | 652 | td = lib_ptr(ib, btx_ring[i], lp->type); |
630 | /* If we hit a packet not owned by us, stop */ | 653 | /* If we hit a packet not owned by us, stop */ |
631 | if (td->tmd1_bits & LE_T1_OWN) | 654 | if (*tds_ptr(td, tmd1, lp->type) & LE_T1_OWN) |
632 | break; | 655 | break; |
633 | 656 | ||
634 | if (td->tmd1_bits & LE_T1_ERR) { | 657 | if (*tds_ptr(td, tmd1, lp->type) & LE_T1_ERR) { |
635 | status = td->misc; | 658 | status = *tds_ptr(td, misc, lp->type); |
636 | 659 | ||
637 | lp->stats.tx_errors++; | 660 | lp->stats.tx_errors++; |
638 | if (status & LE_T3_RTY) | 661 | if (status & LE_T3_RTY) |
@@ -667,18 +690,19 @@ static void lance_tx(struct net_device *dev) | |||
667 | init_restart_lance(lp); | 690 | init_restart_lance(lp); |
668 | goto out; | 691 | goto out; |
669 | } | 692 | } |
670 | } else if ((td->tmd1_bits & LE_T1_POK) == LE_T1_POK) { | 693 | } else if ((*tds_ptr(td, tmd1, lp->type) & LE_T1_POK) == |
694 | LE_T1_POK) { | ||
671 | /* | 695 | /* |
672 | * So we don't count the packet more than once. | 696 | * So we don't count the packet more than once. |
673 | */ | 697 | */ |
674 | td->tmd1_bits &= ~(LE_T1_POK); | 698 | *tds_ptr(td, tmd1, lp->type) &= ~(LE_T1_POK); |
675 | 699 | ||
676 | /* One collision before packet was sent. */ | 700 | /* One collision before packet was sent. */ |
677 | if (td->tmd1_bits & LE_T1_EONE) | 701 | if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EONE) |
678 | lp->stats.collisions++; | 702 | lp->stats.collisions++; |
679 | 703 | ||
680 | /* More than one collision, be optimistic. */ | 704 | /* More than one collision, be optimistic. */ |
681 | if (td->tmd1_bits & LE_T1_EMORE) | 705 | if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EMORE) |
682 | lp->stats.collisions += 2; | 706 | lp->stats.collisions += 2; |
683 | 707 | ||
684 | lp->stats.tx_packets++; | 708 | lp->stats.tx_packets++; |
@@ -752,7 +776,7 @@ struct net_device *last_dev = 0; | |||
752 | 776 | ||
753 | static int lance_open(struct net_device *dev) | 777 | static int lance_open(struct net_device *dev) |
754 | { | 778 | { |
755 | volatile struct lance_init_block *ib = (struct lance_init_block *) (dev->mem_start); | 779 | volatile u16 *ib = (volatile u16 *)dev->mem_start; |
756 | struct lance_private *lp = netdev_priv(dev); | 780 | struct lance_private *lp = netdev_priv(dev); |
757 | volatile struct lance_regs *ll = lp->ll; | 781 | volatile struct lance_regs *ll = lp->ll; |
758 | int status = 0; | 782 | int status = 0; |
@@ -769,11 +793,11 @@ static int lance_open(struct net_device *dev) | |||
769 | * | 793 | * |
770 | * BTW it is common bug in all lance drivers! --ANK | 794 | * BTW it is common bug in all lance drivers! --ANK |
771 | */ | 795 | */ |
772 | ib->mode = 0; | 796 | *lib_ptr(ib, mode, lp->type) = 0; |
773 | ib->filter [0] = 0; | 797 | *lib_ptr(ib, filter[0], lp->type) = 0; |
774 | ib->filter [2] = 0; | 798 | *lib_ptr(ib, filter[1], lp->type) = 0; |
775 | ib->filter [4] = 0; | 799 | *lib_ptr(ib, filter[2], lp->type) = 0; |
776 | ib->filter [6] = 0; | 800 | *lib_ptr(ib, filter[3], lp->type) = 0; |
777 | 801 | ||
778 | lance_init_ring(dev); | 802 | lance_init_ring(dev); |
779 | load_csrs(lp); | 803 | load_csrs(lp); |
@@ -874,12 +898,10 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
874 | { | 898 | { |
875 | struct lance_private *lp = netdev_priv(dev); | 899 | struct lance_private *lp = netdev_priv(dev); |
876 | volatile struct lance_regs *ll = lp->ll; | 900 | volatile struct lance_regs *ll = lp->ll; |
877 | volatile struct lance_init_block *ib = (struct lance_init_block *) (dev->mem_start); | 901 | volatile u16 *ib = (volatile u16 *)dev->mem_start; |
878 | int entry, skblen, len; | 902 | int entry, len; |
879 | 903 | ||
880 | skblen = skb->len; | 904 | len = skb->len; |
881 | |||
882 | len = skblen; | ||
883 | 905 | ||
884 | if (len < ETH_ZLEN) { | 906 | if (len < ETH_ZLEN) { |
885 | if (skb_padto(skb, ETH_ZLEN)) | 907 | if (skb_padto(skb, ETH_ZLEN)) |
@@ -889,23 +911,17 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
889 | 911 | ||
890 | lp->stats.tx_bytes += len; | 912 | lp->stats.tx_bytes += len; |
891 | 913 | ||
892 | entry = lp->tx_new & TX_RING_MOD_MASK; | 914 | entry = lp->tx_new; |
893 | ib->btx_ring[entry].length = (-len); | 915 | *lib_ptr(ib, btx_ring[entry].length, lp->type) = (-len); |
894 | ib->btx_ring[entry].misc = 0; | 916 | *lib_ptr(ib, btx_ring[entry].misc, lp->type) = 0; |
895 | |||
896 | cp_to_buf(lp->type, (char *)lp->tx_buf_ptr_cpu[entry], skb->data, | ||
897 | skblen); | ||
898 | 917 | ||
899 | /* Clear the slack of the packet, do I need this? */ | 918 | cp_to_buf(lp->type, (char *)lp->tx_buf_ptr_cpu[entry], skb->data, len); |
900 | /* For a firewall it's a good idea - AC */ | ||
901 | /* | ||
902 | if (len != skblen) | ||
903 | memset ((char *) &ib->tx_buf [entry][skblen], 0, (len - skblen) << 1); | ||
904 | */ | ||
905 | 919 | ||
906 | /* Now, give the packet to the lance */ | 920 | /* Now, give the packet to the lance */ |
907 | ib->btx_ring[entry].tmd1_bits = (LE_T1_POK | LE_T1_OWN); | 921 | *lib_ptr(ib, btx_ring[entry].tmd1, lp->type) = |
908 | lp->tx_new = (lp->tx_new + 1) & TX_RING_MOD_MASK; | 922 | ((lp->tx_buf_ptr_lnc[entry] >> 16) & 0xff) | |
923 | (LE_T1_POK | LE_T1_OWN); | ||
924 | lp->tx_new = (entry + 1) & TX_RING_MOD_MASK; | ||
909 | 925 | ||
910 | if (TX_BUFFS_AVAIL <= 0) | 926 | if (TX_BUFFS_AVAIL <= 0) |
911 | netif_stop_queue(dev); | 927 | netif_stop_queue(dev); |
@@ -930,8 +946,8 @@ static struct net_device_stats *lance_get_stats(struct net_device *dev) | |||
930 | 946 | ||
931 | static void lance_load_multicast(struct net_device *dev) | 947 | static void lance_load_multicast(struct net_device *dev) |
932 | { | 948 | { |
933 | volatile struct lance_init_block *ib = (struct lance_init_block *) (dev->mem_start); | 949 | struct lance_private *lp = netdev_priv(dev); |
934 | volatile u16 *mcast_table = (u16 *) & ib->filter; | 950 | volatile u16 *ib = (volatile u16 *)dev->mem_start; |
935 | struct dev_mc_list *dmi = dev->mc_list; | 951 | struct dev_mc_list *dmi = dev->mc_list; |
936 | char *addrs; | 952 | char *addrs; |
937 | int i; | 953 | int i; |
@@ -939,17 +955,17 @@ static void lance_load_multicast(struct net_device *dev) | |||
939 | 955 | ||
940 | /* set all multicast bits */ | 956 | /* set all multicast bits */ |
941 | if (dev->flags & IFF_ALLMULTI) { | 957 | if (dev->flags & IFF_ALLMULTI) { |
942 | ib->filter[0] = 0xffff; | 958 | *lib_ptr(ib, filter[0], lp->type) = 0xffff; |
943 | ib->filter[2] = 0xffff; | 959 | *lib_ptr(ib, filter[1], lp->type) = 0xffff; |
944 | ib->filter[4] = 0xffff; | 960 | *lib_ptr(ib, filter[2], lp->type) = 0xffff; |
945 | ib->filter[6] = 0xffff; | 961 | *lib_ptr(ib, filter[3], lp->type) = 0xffff; |
946 | return; | 962 | return; |
947 | } | 963 | } |
948 | /* clear the multicast filter */ | 964 | /* clear the multicast filter */ |
949 | ib->filter[0] = 0; | 965 | *lib_ptr(ib, filter[0], lp->type) = 0; |
950 | ib->filter[2] = 0; | 966 | *lib_ptr(ib, filter[1], lp->type) = 0; |
951 | ib->filter[4] = 0; | 967 | *lib_ptr(ib, filter[2], lp->type) = 0; |
952 | ib->filter[6] = 0; | 968 | *lib_ptr(ib, filter[3], lp->type) = 0; |
953 | 969 | ||
954 | /* Add addresses */ | 970 | /* Add addresses */ |
955 | for (i = 0; i < dev->mc_count; i++) { | 971 | for (i = 0; i < dev->mc_count; i++) { |
@@ -962,7 +978,7 @@ static void lance_load_multicast(struct net_device *dev) | |||
962 | 978 | ||
963 | crc = ether_crc_le(ETH_ALEN, addrs); | 979 | crc = ether_crc_le(ETH_ALEN, addrs); |
964 | crc = crc >> 26; | 980 | crc = crc >> 26; |
965 | mcast_table[2 * (crc >> 4)] |= 1 << (crc & 0xf); | 981 | *lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf); |
966 | } | 982 | } |
967 | return; | 983 | return; |
968 | } | 984 | } |
@@ -970,11 +986,9 @@ static void lance_load_multicast(struct net_device *dev) | |||
970 | static void lance_set_multicast(struct net_device *dev) | 986 | static void lance_set_multicast(struct net_device *dev) |
971 | { | 987 | { |
972 | struct lance_private *lp = netdev_priv(dev); | 988 | struct lance_private *lp = netdev_priv(dev); |
973 | volatile struct lance_init_block *ib; | 989 | volatile u16 *ib = (volatile u16 *)dev->mem_start; |
974 | volatile struct lance_regs *ll = lp->ll; | 990 | volatile struct lance_regs *ll = lp->ll; |
975 | 991 | ||
976 | ib = (struct lance_init_block *) (dev->mem_start); | ||
977 | |||
978 | if (!netif_running(dev)) | 992 | if (!netif_running(dev)) |
979 | return; | 993 | return; |
980 | 994 | ||
@@ -992,9 +1006,9 @@ static void lance_set_multicast(struct net_device *dev) | |||
992 | lance_init_ring(dev); | 1006 | lance_init_ring(dev); |
993 | 1007 | ||
994 | if (dev->flags & IFF_PROMISC) { | 1008 | if (dev->flags & IFF_PROMISC) { |
995 | ib->mode |= LE_MO_PROM; | 1009 | *lib_ptr(ib, mode, lp->type) |= LE_MO_PROM; |
996 | } else { | 1010 | } else { |
997 | ib->mode &= ~LE_MO_PROM; | 1011 | *lib_ptr(ib, mode, lp->type) &= ~LE_MO_PROM; |
998 | lance_load_multicast(dev); | 1012 | lance_load_multicast(dev); |
999 | } | 1013 | } |
1000 | load_csrs(lp); | 1014 | load_csrs(lp); |
@@ -1051,7 +1065,6 @@ static int __init dec_lance_init(const int type, const int slot) | |||
1051 | lp->type = type; | 1065 | lp->type = type; |
1052 | lp->slot = slot; | 1066 | lp->slot = slot; |
1053 | switch (type) { | 1067 | switch (type) { |
1054 | #ifdef CONFIG_TC | ||
1055 | case ASIC_LANCE: | 1068 | case ASIC_LANCE: |
1056 | dev->base_addr = CKSEG1ADDR(dec_kn_slot_base + IOASIC_LANCE); | 1069 | dev->base_addr = CKSEG1ADDR(dec_kn_slot_base + IOASIC_LANCE); |
1057 | 1070 | ||
@@ -1073,20 +1086,20 @@ static int __init dec_lance_init(const int type, const int slot) | |||
1073 | */ | 1086 | */ |
1074 | for (i = 0; i < RX_RING_SIZE; i++) { | 1087 | for (i = 0; i < RX_RING_SIZE; i++) { |
1075 | lp->rx_buf_ptr_cpu[i] = | 1088 | lp->rx_buf_ptr_cpu[i] = |
1076 | (char *)(dev->mem_start + BUF_OFFSET_CPU + | 1089 | (char *)(dev->mem_start + 2 * BUF_OFFSET_CPU + |
1077 | 2 * i * RX_BUFF_SIZE); | 1090 | 2 * i * RX_BUFF_SIZE); |
1078 | lp->rx_buf_ptr_lnc[i] = | 1091 | lp->rx_buf_ptr_lnc[i] = |
1079 | (char *)(BUF_OFFSET_LNC + i * RX_BUFF_SIZE); | 1092 | (BUF_OFFSET_LNC + i * RX_BUFF_SIZE); |
1080 | } | 1093 | } |
1081 | for (i = 0; i < TX_RING_SIZE; i++) { | 1094 | for (i = 0; i < TX_RING_SIZE; i++) { |
1082 | lp->tx_buf_ptr_cpu[i] = | 1095 | lp->tx_buf_ptr_cpu[i] = |
1083 | (char *)(dev->mem_start + BUF_OFFSET_CPU + | 1096 | (char *)(dev->mem_start + 2 * BUF_OFFSET_CPU + |
1084 | 2 * RX_RING_SIZE * RX_BUFF_SIZE + | 1097 | 2 * RX_RING_SIZE * RX_BUFF_SIZE + |
1085 | 2 * i * TX_BUFF_SIZE); | 1098 | 2 * i * TX_BUFF_SIZE); |
1086 | lp->tx_buf_ptr_lnc[i] = | 1099 | lp->tx_buf_ptr_lnc[i] = |
1087 | (char *)(BUF_OFFSET_LNC + | 1100 | (BUF_OFFSET_LNC + |
1088 | RX_RING_SIZE * RX_BUFF_SIZE + | 1101 | RX_RING_SIZE * RX_BUFF_SIZE + |
1089 | i * TX_BUFF_SIZE); | 1102 | i * TX_BUFF_SIZE); |
1090 | } | 1103 | } |
1091 | 1104 | ||
1092 | /* Setup I/O ASIC LANCE DMA. */ | 1105 | /* Setup I/O ASIC LANCE DMA. */ |
@@ -1095,11 +1108,12 @@ static int __init dec_lance_init(const int type, const int slot) | |||
1095 | CPHYSADDR(dev->mem_start) << 3); | 1108 | CPHYSADDR(dev->mem_start) << 3); |
1096 | 1109 | ||
1097 | break; | 1110 | break; |
1098 | 1111 | #ifdef CONFIG_TC | |
1099 | case PMAD_LANCE: | 1112 | case PMAD_LANCE: |
1100 | claim_tc_card(slot); | 1113 | claim_tc_card(slot); |
1101 | 1114 | ||
1102 | dev->mem_start = CKSEG1ADDR(get_tc_base_addr(slot)); | 1115 | dev->mem_start = CKSEG1ADDR(get_tc_base_addr(slot)); |
1116 | dev->mem_end = dev->mem_start + 0x100000; | ||
1103 | dev->base_addr = dev->mem_start + 0x100000; | 1117 | dev->base_addr = dev->mem_start + 0x100000; |
1104 | dev->irq = get_tc_irq_nr(slot); | 1118 | dev->irq = get_tc_irq_nr(slot); |
1105 | esar_base = dev->mem_start + 0x1c0002; | 1119 | esar_base = dev->mem_start + 0x1c0002; |
@@ -1110,7 +1124,7 @@ static int __init dec_lance_init(const int type, const int slot) | |||
1110 | (char *)(dev->mem_start + BUF_OFFSET_CPU + | 1124 | (char *)(dev->mem_start + BUF_OFFSET_CPU + |
1111 | i * RX_BUFF_SIZE); | 1125 | i * RX_BUFF_SIZE); |
1112 | lp->rx_buf_ptr_lnc[i] = | 1126 | lp->rx_buf_ptr_lnc[i] = |
1113 | (char *)(BUF_OFFSET_LNC + i * RX_BUFF_SIZE); | 1127 | (BUF_OFFSET_LNC + i * RX_BUFF_SIZE); |
1114 | } | 1128 | } |
1115 | for (i = 0; i < TX_RING_SIZE; i++) { | 1129 | for (i = 0; i < TX_RING_SIZE; i++) { |
1116 | lp->tx_buf_ptr_cpu[i] = | 1130 | lp->tx_buf_ptr_cpu[i] = |
@@ -1118,18 +1132,18 @@ static int __init dec_lance_init(const int type, const int slot) | |||
1118 | RX_RING_SIZE * RX_BUFF_SIZE + | 1132 | RX_RING_SIZE * RX_BUFF_SIZE + |
1119 | i * TX_BUFF_SIZE); | 1133 | i * TX_BUFF_SIZE); |
1120 | lp->tx_buf_ptr_lnc[i] = | 1134 | lp->tx_buf_ptr_lnc[i] = |
1121 | (char *)(BUF_OFFSET_LNC + | 1135 | (BUF_OFFSET_LNC + |
1122 | RX_RING_SIZE * RX_BUFF_SIZE + | 1136 | RX_RING_SIZE * RX_BUFF_SIZE + |
1123 | i * TX_BUFF_SIZE); | 1137 | i * TX_BUFF_SIZE); |
1124 | } | 1138 | } |
1125 | 1139 | ||
1126 | break; | 1140 | break; |
1127 | #endif | 1141 | #endif |
1128 | |||
1129 | case PMAX_LANCE: | 1142 | case PMAX_LANCE: |
1130 | dev->irq = dec_interrupt[DEC_IRQ_LANCE]; | 1143 | dev->irq = dec_interrupt[DEC_IRQ_LANCE]; |
1131 | dev->base_addr = CKSEG1ADDR(KN01_SLOT_BASE + KN01_LANCE); | 1144 | dev->base_addr = CKSEG1ADDR(KN01_SLOT_BASE + KN01_LANCE); |
1132 | dev->mem_start = CKSEG1ADDR(KN01_SLOT_BASE + KN01_LANCE_MEM); | 1145 | dev->mem_start = CKSEG1ADDR(KN01_SLOT_BASE + KN01_LANCE_MEM); |
1146 | dev->mem_end = dev->mem_start + KN01_SLOT_SIZE; | ||
1133 | esar_base = CKSEG1ADDR(KN01_SLOT_BASE + KN01_ESAR + 1); | 1147 | esar_base = CKSEG1ADDR(KN01_SLOT_BASE + KN01_ESAR + 1); |
1134 | lp->dma_irq = -1; | 1148 | lp->dma_irq = -1; |
1135 | 1149 | ||
@@ -1138,20 +1152,20 @@ static int __init dec_lance_init(const int type, const int slot) | |||
1138 | */ | 1152 | */ |
1139 | for (i = 0; i < RX_RING_SIZE; i++) { | 1153 | for (i = 0; i < RX_RING_SIZE; i++) { |
1140 | lp->rx_buf_ptr_cpu[i] = | 1154 | lp->rx_buf_ptr_cpu[i] = |
1141 | (char *)(dev->mem_start + BUF_OFFSET_CPU + | 1155 | (char *)(dev->mem_start + 2 * BUF_OFFSET_CPU + |
1142 | 2 * i * RX_BUFF_SIZE); | 1156 | 2 * i * RX_BUFF_SIZE); |
1143 | lp->rx_buf_ptr_lnc[i] = | 1157 | lp->rx_buf_ptr_lnc[i] = |
1144 | (char *)(BUF_OFFSET_LNC + i * RX_BUFF_SIZE); | 1158 | (BUF_OFFSET_LNC + i * RX_BUFF_SIZE); |
1145 | } | 1159 | } |
1146 | for (i = 0; i < TX_RING_SIZE; i++) { | 1160 | for (i = 0; i < TX_RING_SIZE; i++) { |
1147 | lp->tx_buf_ptr_cpu[i] = | 1161 | lp->tx_buf_ptr_cpu[i] = |
1148 | (char *)(dev->mem_start + BUF_OFFSET_CPU + | 1162 | (char *)(dev->mem_start + 2 * BUF_OFFSET_CPU + |
1149 | 2 * RX_RING_SIZE * RX_BUFF_SIZE + | 1163 | 2 * RX_RING_SIZE * RX_BUFF_SIZE + |
1150 | 2 * i * TX_BUFF_SIZE); | 1164 | 2 * i * TX_BUFF_SIZE); |
1151 | lp->tx_buf_ptr_lnc[i] = | 1165 | lp->tx_buf_ptr_lnc[i] = |
1152 | (char *)(BUF_OFFSET_LNC + | 1166 | (BUF_OFFSET_LNC + |
1153 | RX_RING_SIZE * RX_BUFF_SIZE + | 1167 | RX_RING_SIZE * RX_BUFF_SIZE + |
1154 | i * TX_BUFF_SIZE); | 1168 | i * TX_BUFF_SIZE); |
1155 | } | 1169 | } |
1156 | 1170 | ||
1157 | break; | 1171 | break; |
@@ -1279,10 +1293,8 @@ static int __init dec_lance_probe(void) | |||
1279 | /* Then handle onboard devices. */ | 1293 | /* Then handle onboard devices. */ |
1280 | if (dec_interrupt[DEC_IRQ_LANCE] >= 0) { | 1294 | if (dec_interrupt[DEC_IRQ_LANCE] >= 0) { |
1281 | if (dec_interrupt[DEC_IRQ_LANCE_MERR] >= 0) { | 1295 | if (dec_interrupt[DEC_IRQ_LANCE_MERR] >= 0) { |
1282 | #ifdef CONFIG_TC | ||
1283 | if (dec_lance_init(ASIC_LANCE, -1) >= 0) | 1296 | if (dec_lance_init(ASIC_LANCE, -1) >= 0) |
1284 | count++; | 1297 | count++; |
1285 | #endif | ||
1286 | } else if (!TURBOCHANNEL) { | 1298 | } else if (!TURBOCHANNEL) { |
1287 | if (dec_lance_init(PMAX_LANCE, -1) >= 0) | 1299 | if (dec_lance_init(PMAX_LANCE, -1) >= 0) |
1288 | count++; | 1300 | count++; |
diff --git a/drivers/net/e2100.c b/drivers/net/e2100.c index d39e8480ca56..c62d9c6363c6 100644 --- a/drivers/net/e2100.c +++ b/drivers/net/e2100.c | |||
@@ -463,7 +463,7 @@ static void cleanup_card(struct net_device *dev) | |||
463 | release_region(dev->base_addr, E21_IO_EXTENT); | 463 | release_region(dev->base_addr, E21_IO_EXTENT); |
464 | } | 464 | } |
465 | 465 | ||
466 | void | 466 | void __exit |
467 | cleanup_module(void) | 467 | cleanup_module(void) |
468 | { | 468 | { |
469 | int this_dev; | 469 | int this_dev; |
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index a4eb0dc99ecf..b4463094c93a 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c | |||
@@ -1827,7 +1827,7 @@ int __init init_module(void) | |||
1827 | return n_eepro ? 0 : -ENODEV; | 1827 | return n_eepro ? 0 : -ENODEV; |
1828 | } | 1828 | } |
1829 | 1829 | ||
1830 | void | 1830 | void __exit |
1831 | cleanup_module(void) | 1831 | cleanup_module(void) |
1832 | { | 1832 | { |
1833 | int i; | 1833 | int i; |
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index e14be020e562..4a50fcb5ad6b 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c | |||
@@ -1719,7 +1719,7 @@ int __init init_module(void) | |||
1719 | return -ENXIO; | 1719 | return -ENXIO; |
1720 | } | 1720 | } |
1721 | 1721 | ||
1722 | void cleanup_module(void) | 1722 | void __exit cleanup_module(void) |
1723 | { | 1723 | { |
1724 | int this_dev; | 1724 | int this_dev; |
1725 | 1725 | ||
diff --git a/drivers/net/es3210.c b/drivers/net/es3210.c index fd7b32a24ea4..2d2ea94a00bb 100644 --- a/drivers/net/es3210.c +++ b/drivers/net/es3210.c | |||
@@ -455,7 +455,7 @@ static void cleanup_card(struct net_device *dev) | |||
455 | iounmap(ei_status.mem); | 455 | iounmap(ei_status.mem); |
456 | } | 456 | } |
457 | 457 | ||
458 | void | 458 | void __exit |
459 | cleanup_module(void) | 459 | cleanup_module(void) |
460 | { | 460 | { |
461 | int this_dev; | 461 | int this_dev; |
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c index b7b8bc2a6307..93283e386f3a 100644 --- a/drivers/net/eth16i.c +++ b/drivers/net/eth16i.c | |||
@@ -1475,7 +1475,7 @@ int __init init_module(void) | |||
1475 | return -ENXIO; | 1475 | return -ENXIO; |
1476 | } | 1476 | } |
1477 | 1477 | ||
1478 | void cleanup_module(void) | 1478 | void __exit cleanup_module(void) |
1479 | { | 1479 | { |
1480 | int this_dev; | 1480 | int this_dev; |
1481 | 1481 | ||
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c index 6abcfd2a4b28..99a36cc3f8df 100644 --- a/drivers/net/hp-plus.c +++ b/drivers/net/hp-plus.c | |||
@@ -482,7 +482,7 @@ static void cleanup_card(struct net_device *dev) | |||
482 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); | 482 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); |
483 | } | 483 | } |
484 | 484 | ||
485 | void | 485 | void __exit |
486 | cleanup_module(void) | 486 | cleanup_module(void) |
487 | { | 487 | { |
488 | int this_dev; | 488 | int this_dev; |
diff --git a/drivers/net/hp.c b/drivers/net/hp.c index 29470970aa27..635b13c2e2aa 100644 --- a/drivers/net/hp.c +++ b/drivers/net/hp.c | |||
@@ -444,7 +444,7 @@ static void cleanup_card(struct net_device *dev) | |||
444 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); | 444 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); |
445 | } | 445 | } |
446 | 446 | ||
447 | void | 447 | void __exit |
448 | cleanup_module(void) | 448 | cleanup_module(void) |
449 | { | 449 | { |
450 | int this_dev; | 450 | int this_dev; |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index f9a1c88a4283..9137e239fac2 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -704,9 +704,9 @@ static int pxa_irda_stop(struct net_device *dev) | |||
704 | return 0; | 704 | return 0; |
705 | } | 705 | } |
706 | 706 | ||
707 | static int pxa_irda_suspend(struct device *_dev, pm_message_t state) | 707 | static int pxa_irda_suspend(struct platform_device *_dev, pm_message_t state) |
708 | { | 708 | { |
709 | struct net_device *dev = dev_get_drvdata(_dev); | 709 | struct net_device *dev = platform_get_drvdata(_dev); |
710 | struct pxa_irda *si; | 710 | struct pxa_irda *si; |
711 | 711 | ||
712 | if (dev && netif_running(dev)) { | 712 | if (dev && netif_running(dev)) { |
@@ -718,9 +718,9 @@ static int pxa_irda_suspend(struct device *_dev, pm_message_t state) | |||
718 | return 0; | 718 | return 0; |
719 | } | 719 | } |
720 | 720 | ||
721 | static int pxa_irda_resume(struct device *_dev) | 721 | static int pxa_irda_resume(struct platform_device *_dev) |
722 | { | 722 | { |
723 | struct net_device *dev = dev_get_drvdata(_dev); | 723 | struct net_device *dev = platform_get_drvdata(_dev); |
724 | struct pxa_irda *si; | 724 | struct pxa_irda *si; |
725 | 725 | ||
726 | if (dev && netif_running(dev)) { | 726 | if (dev && netif_running(dev)) { |
@@ -746,9 +746,8 @@ static int pxa_irda_init_iobuf(iobuff_t *io, int size) | |||
746 | return io->head ? 0 : -ENOMEM; | 746 | return io->head ? 0 : -ENOMEM; |
747 | } | 747 | } |
748 | 748 | ||
749 | static int pxa_irda_probe(struct device *_dev) | 749 | static int pxa_irda_probe(struct platform_device *pdev) |
750 | { | 750 | { |
751 | struct platform_device *pdev = to_platform_device(_dev); | ||
752 | struct net_device *dev; | 751 | struct net_device *dev; |
753 | struct pxa_irda *si; | 752 | struct pxa_irda *si; |
754 | unsigned int baudrate_mask; | 753 | unsigned int baudrate_mask; |
@@ -822,9 +821,9 @@ err_mem_1: | |||
822 | return err; | 821 | return err; |
823 | } | 822 | } |
824 | 823 | ||
825 | static int pxa_irda_remove(struct device *_dev) | 824 | static int pxa_irda_remove(struct platform_device *_dev) |
826 | { | 825 | { |
827 | struct net_device *dev = dev_get_drvdata(_dev); | 826 | struct net_device *dev = platform_get_drvdata(_dev); |
828 | 827 | ||
829 | if (dev) { | 828 | if (dev) { |
830 | struct pxa_irda *si = netdev_priv(dev); | 829 | struct pxa_irda *si = netdev_priv(dev); |
@@ -840,9 +839,10 @@ static int pxa_irda_remove(struct device *_dev) | |||
840 | return 0; | 839 | return 0; |
841 | } | 840 | } |
842 | 841 | ||
843 | static struct device_driver pxa_ir_driver = { | 842 | static struct platform_driver pxa_ir_driver = { |
844 | .name = "pxa2xx-ir", | 843 | .driver = { |
845 | .bus = &platform_bus_type, | 844 | .name = "pxa2xx-ir", |
845 | }, | ||
846 | .probe = pxa_irda_probe, | 846 | .probe = pxa_irda_probe, |
847 | .remove = pxa_irda_remove, | 847 | .remove = pxa_irda_remove, |
848 | .suspend = pxa_irda_suspend, | 848 | .suspend = pxa_irda_suspend, |
@@ -851,12 +851,12 @@ static struct device_driver pxa_ir_driver = { | |||
851 | 851 | ||
852 | static int __init pxa_irda_init(void) | 852 | static int __init pxa_irda_init(void) |
853 | { | 853 | { |
854 | return driver_register(&pxa_ir_driver); | 854 | return platform_driver_register(&pxa_ir_driver); |
855 | } | 855 | } |
856 | 856 | ||
857 | static void __exit pxa_irda_exit(void) | 857 | static void __exit pxa_irda_exit(void) |
858 | { | 858 | { |
859 | driver_unregister(&pxa_ir_driver); | 859 | platform_driver_unregister(&pxa_ir_driver); |
860 | } | 860 | } |
861 | 861 | ||
862 | module_init(pxa_irda_init); | 862 | module_init(pxa_irda_init); |
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index 3b4c47875935..c14a74634fd5 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/usb.h> | 50 | #include <linux/usb.h> |
51 | #include <linux/crc32.h> | 51 | #include <linux/crc32.h> |
52 | #include <linux/kthread.h> | 52 | #include <linux/kthread.h> |
53 | #include <linux/freezer.h> | ||
53 | #include <net/irda/irda.h> | 54 | #include <net/irda/irda.h> |
54 | #include <net/irda/irlap.h> | 55 | #include <net/irda/irlap.h> |
55 | #include <net/irda/irda_device.h> | 56 | #include <net/irda/irda_device.h> |
diff --git a/drivers/net/lance.c b/drivers/net/lance.c index 4256c13c73c2..a3843320dbe1 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c | |||
@@ -368,7 +368,7 @@ static void cleanup_card(struct net_device *dev) | |||
368 | kfree(lp); | 368 | kfree(lp); |
369 | } | 369 | } |
370 | 370 | ||
371 | void cleanup_module(void) | 371 | void __exit cleanup_module(void) |
372 | { | 372 | { |
373 | int this_dev; | 373 | int this_dev; |
374 | 374 | ||
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c index f4d815bca643..ea392f2a5aa2 100644 --- a/drivers/net/lasi_82596.c +++ b/drivers/net/lasi_82596.c | |||
@@ -119,14 +119,14 @@ | |||
119 | #define DEB(x,y) if (i596_debug & (x)) { y; } | 119 | #define DEB(x,y) if (i596_debug & (x)) { y; } |
120 | 120 | ||
121 | 121 | ||
122 | #define CHECK_WBACK(addr,len) \ | 122 | #define CHECK_WBACK(priv, addr,len) \ |
123 | do { dma_cache_sync((void *)addr, len, DMA_TO_DEVICE); } while (0) | 123 | do { dma_cache_sync((priv)->dev, (void *)addr, len, DMA_TO_DEVICE); } while (0) |
124 | 124 | ||
125 | #define CHECK_INV(addr,len) \ | 125 | #define CHECK_INV(priv, addr,len) \ |
126 | do { dma_cache_sync((void *)addr, len, DMA_FROM_DEVICE); } while(0) | 126 | do { dma_cache_sync((priv)->dev, (void *)addr, len, DMA_FROM_DEVICE); } while(0) |
127 | 127 | ||
128 | #define CHECK_WBACK_INV(addr,len) \ | 128 | #define CHECK_WBACK_INV(priv, addr,len) \ |
129 | do { dma_cache_sync((void *)addr, len, DMA_BIDIRECTIONAL); } while (0) | 129 | do { dma_cache_sync((priv)->dev, (void *)addr, len, DMA_BIDIRECTIONAL); } while (0) |
130 | 130 | ||
131 | 131 | ||
132 | #define PA_I82596_RESET 0 /* Offsets relative to LASI-LAN-Addr.*/ | 132 | #define PA_I82596_RESET 0 /* Offsets relative to LASI-LAN-Addr.*/ |
@@ -449,10 +449,10 @@ static inline void MPU_PORT(struct net_device *dev, int c, dma_addr_t x) | |||
449 | 449 | ||
450 | static inline int wait_istat(struct net_device *dev, struct i596_private *lp, int delcnt, char *str) | 450 | static inline int wait_istat(struct net_device *dev, struct i596_private *lp, int delcnt, char *str) |
451 | { | 451 | { |
452 | CHECK_INV(&(lp->iscp), sizeof(struct i596_iscp)); | 452 | CHECK_INV(lp, &(lp->iscp), sizeof(struct i596_iscp)); |
453 | while (--delcnt && lp->iscp.stat) { | 453 | while (--delcnt && lp->iscp.stat) { |
454 | udelay(10); | 454 | udelay(10); |
455 | CHECK_INV(&(lp->iscp), sizeof(struct i596_iscp)); | 455 | CHECK_INV(lp, &(lp->iscp), sizeof(struct i596_iscp)); |
456 | } | 456 | } |
457 | if (!delcnt) { | 457 | if (!delcnt) { |
458 | printk("%s: %s, iscp.stat %04x, didn't clear\n", | 458 | printk("%s: %s, iscp.stat %04x, didn't clear\n", |
@@ -466,10 +466,10 @@ static inline int wait_istat(struct net_device *dev, struct i596_private *lp, in | |||
466 | 466 | ||
467 | static inline int wait_cmd(struct net_device *dev, struct i596_private *lp, int delcnt, char *str) | 467 | static inline int wait_cmd(struct net_device *dev, struct i596_private *lp, int delcnt, char *str) |
468 | { | 468 | { |
469 | CHECK_INV(&(lp->scb), sizeof(struct i596_scb)); | 469 | CHECK_INV(lp, &(lp->scb), sizeof(struct i596_scb)); |
470 | while (--delcnt && lp->scb.command) { | 470 | while (--delcnt && lp->scb.command) { |
471 | udelay(10); | 471 | udelay(10); |
472 | CHECK_INV(&(lp->scb), sizeof(struct i596_scb)); | 472 | CHECK_INV(lp, &(lp->scb), sizeof(struct i596_scb)); |
473 | } | 473 | } |
474 | if (!delcnt) { | 474 | if (!delcnt) { |
475 | printk("%s: %s, status %4.4x, cmd %4.4x.\n", | 475 | printk("%s: %s, status %4.4x, cmd %4.4x.\n", |
@@ -522,7 +522,7 @@ static void i596_display_data(struct net_device *dev) | |||
522 | rbd, rbd->count, rbd->b_next, rbd->b_data, rbd->size); | 522 | rbd, rbd->count, rbd->b_next, rbd->b_data, rbd->size); |
523 | rbd = rbd->v_next; | 523 | rbd = rbd->v_next; |
524 | } while (rbd != lp->rbd_head); | 524 | } while (rbd != lp->rbd_head); |
525 | CHECK_INV(lp, sizeof(struct i596_private)); | 525 | CHECK_INV(lp, lp, sizeof(struct i596_private)); |
526 | } | 526 | } |
527 | 527 | ||
528 | 528 | ||
@@ -592,7 +592,7 @@ static inline void init_rx_bufs(struct net_device *dev) | |||
592 | rfd->b_next = WSWAPrfd(virt_to_dma(lp,lp->rfds)); | 592 | rfd->b_next = WSWAPrfd(virt_to_dma(lp,lp->rfds)); |
593 | rfd->cmd = CMD_EOL|CMD_FLEX; | 593 | rfd->cmd = CMD_EOL|CMD_FLEX; |
594 | 594 | ||
595 | CHECK_WBACK_INV(lp, sizeof(struct i596_private)); | 595 | CHECK_WBACK_INV(lp, lp, sizeof(struct i596_private)); |
596 | } | 596 | } |
597 | 597 | ||
598 | static inline void remove_rx_bufs(struct net_device *dev) | 598 | static inline void remove_rx_bufs(struct net_device *dev) |
@@ -629,7 +629,7 @@ static void rebuild_rx_bufs(struct net_device *dev) | |||
629 | lp->rbd_head = lp->rbds; | 629 | lp->rbd_head = lp->rbds; |
630 | lp->rfds[0].rbd = WSWAPrbd(virt_to_dma(lp,lp->rbds)); | 630 | lp->rfds[0].rbd = WSWAPrbd(virt_to_dma(lp,lp->rbds)); |
631 | 631 | ||
632 | CHECK_WBACK_INV(lp, sizeof(struct i596_private)); | 632 | CHECK_WBACK_INV(lp, lp, sizeof(struct i596_private)); |
633 | } | 633 | } |
634 | 634 | ||
635 | 635 | ||
@@ -663,8 +663,8 @@ static int init_i596_mem(struct net_device *dev) | |||
663 | 663 | ||
664 | DEB(DEB_INIT, printk("%s: starting i82596.\n", dev->name)); | 664 | DEB(DEB_INIT, printk("%s: starting i82596.\n", dev->name)); |
665 | 665 | ||
666 | CHECK_WBACK(&(lp->scp), sizeof(struct i596_scp)); | 666 | CHECK_WBACK(lp, &(lp->scp), sizeof(struct i596_scp)); |
667 | CHECK_WBACK(&(lp->iscp), sizeof(struct i596_iscp)); | 667 | CHECK_WBACK(lp, &(lp->iscp), sizeof(struct i596_iscp)); |
668 | 668 | ||
669 | MPU_PORT(dev, PORT_ALTSCP, virt_to_dma(lp,&lp->scp)); | 669 | MPU_PORT(dev, PORT_ALTSCP, virt_to_dma(lp,&lp->scp)); |
670 | 670 | ||
@@ -678,25 +678,25 @@ static int init_i596_mem(struct net_device *dev) | |||
678 | rebuild_rx_bufs(dev); | 678 | rebuild_rx_bufs(dev); |
679 | 679 | ||
680 | lp->scb.command = 0; | 680 | lp->scb.command = 0; |
681 | CHECK_WBACK(&(lp->scb), sizeof(struct i596_scb)); | 681 | CHECK_WBACK(lp, &(lp->scb), sizeof(struct i596_scb)); |
682 | 682 | ||
683 | enable_irq(dev->irq); /* enable IRQs from LAN */ | 683 | enable_irq(dev->irq); /* enable IRQs from LAN */ |
684 | 684 | ||
685 | DEB(DEB_INIT, printk("%s: queuing CmdConfigure\n", dev->name)); | 685 | DEB(DEB_INIT, printk("%s: queuing CmdConfigure\n", dev->name)); |
686 | memcpy(lp->cf_cmd.i596_config, init_setup, 14); | 686 | memcpy(lp->cf_cmd.i596_config, init_setup, 14); |
687 | lp->cf_cmd.cmd.command = CmdConfigure; | 687 | lp->cf_cmd.cmd.command = CmdConfigure; |
688 | CHECK_WBACK(&(lp->cf_cmd), sizeof(struct cf_cmd)); | 688 | CHECK_WBACK(lp, &(lp->cf_cmd), sizeof(struct cf_cmd)); |
689 | i596_add_cmd(dev, &lp->cf_cmd.cmd); | 689 | i596_add_cmd(dev, &lp->cf_cmd.cmd); |
690 | 690 | ||
691 | DEB(DEB_INIT, printk("%s: queuing CmdSASetup\n", dev->name)); | 691 | DEB(DEB_INIT, printk("%s: queuing CmdSASetup\n", dev->name)); |
692 | memcpy(lp->sa_cmd.eth_addr, dev->dev_addr, 6); | 692 | memcpy(lp->sa_cmd.eth_addr, dev->dev_addr, 6); |
693 | lp->sa_cmd.cmd.command = CmdSASetup; | 693 | lp->sa_cmd.cmd.command = CmdSASetup; |
694 | CHECK_WBACK(&(lp->sa_cmd), sizeof(struct sa_cmd)); | 694 | CHECK_WBACK(lp, &(lp->sa_cmd), sizeof(struct sa_cmd)); |
695 | i596_add_cmd(dev, &lp->sa_cmd.cmd); | 695 | i596_add_cmd(dev, &lp->sa_cmd.cmd); |
696 | 696 | ||
697 | DEB(DEB_INIT, printk("%s: queuing CmdTDR\n", dev->name)); | 697 | DEB(DEB_INIT, printk("%s: queuing CmdTDR\n", dev->name)); |
698 | lp->tdr_cmd.cmd.command = CmdTDR; | 698 | lp->tdr_cmd.cmd.command = CmdTDR; |
699 | CHECK_WBACK(&(lp->tdr_cmd), sizeof(struct tdr_cmd)); | 699 | CHECK_WBACK(lp, &(lp->tdr_cmd), sizeof(struct tdr_cmd)); |
700 | i596_add_cmd(dev, &lp->tdr_cmd.cmd); | 700 | i596_add_cmd(dev, &lp->tdr_cmd.cmd); |
701 | 701 | ||
702 | spin_lock_irqsave (&lp->lock, flags); | 702 | spin_lock_irqsave (&lp->lock, flags); |
@@ -708,7 +708,7 @@ static int init_i596_mem(struct net_device *dev) | |||
708 | DEB(DEB_INIT, printk("%s: Issuing RX_START\n", dev->name)); | 708 | DEB(DEB_INIT, printk("%s: Issuing RX_START\n", dev->name)); |
709 | lp->scb.command = RX_START; | 709 | lp->scb.command = RX_START; |
710 | lp->scb.rfd = WSWAPrfd(virt_to_dma(lp,lp->rfds)); | 710 | lp->scb.rfd = WSWAPrfd(virt_to_dma(lp,lp->rfds)); |
711 | CHECK_WBACK(&(lp->scb), sizeof(struct i596_scb)); | 711 | CHECK_WBACK(lp, &(lp->scb), sizeof(struct i596_scb)); |
712 | 712 | ||
713 | CA(dev); | 713 | CA(dev); |
714 | 714 | ||
@@ -740,13 +740,13 @@ static inline int i596_rx(struct net_device *dev) | |||
740 | 740 | ||
741 | rfd = lp->rfd_head; /* Ref next frame to check */ | 741 | rfd = lp->rfd_head; /* Ref next frame to check */ |
742 | 742 | ||
743 | CHECK_INV(rfd, sizeof(struct i596_rfd)); | 743 | CHECK_INV(lp, rfd, sizeof(struct i596_rfd)); |
744 | while ((rfd->stat) & STAT_C) { /* Loop while complete frames */ | 744 | while ((rfd->stat) & STAT_C) { /* Loop while complete frames */ |
745 | if (rfd->rbd == I596_NULL) | 745 | if (rfd->rbd == I596_NULL) |
746 | rbd = NULL; | 746 | rbd = NULL; |
747 | else if (rfd->rbd == lp->rbd_head->b_addr) { | 747 | else if (rfd->rbd == lp->rbd_head->b_addr) { |
748 | rbd = lp->rbd_head; | 748 | rbd = lp->rbd_head; |
749 | CHECK_INV(rbd, sizeof(struct i596_rbd)); | 749 | CHECK_INV(lp, rbd, sizeof(struct i596_rbd)); |
750 | } | 750 | } |
751 | else { | 751 | else { |
752 | printk("%s: rbd chain broken!\n", dev->name); | 752 | printk("%s: rbd chain broken!\n", dev->name); |
@@ -790,7 +790,7 @@ static inline int i596_rx(struct net_device *dev) | |||
790 | dma_addr = dma_map_single(lp->dev, newskb->data, PKT_BUF_SZ, DMA_FROM_DEVICE); | 790 | dma_addr = dma_map_single(lp->dev, newskb->data, PKT_BUF_SZ, DMA_FROM_DEVICE); |
791 | rbd->v_data = newskb->data; | 791 | rbd->v_data = newskb->data; |
792 | rbd->b_data = WSWAPchar(dma_addr); | 792 | rbd->b_data = WSWAPchar(dma_addr); |
793 | CHECK_WBACK_INV(rbd, sizeof(struct i596_rbd)); | 793 | CHECK_WBACK_INV(lp, rbd, sizeof(struct i596_rbd)); |
794 | } | 794 | } |
795 | else | 795 | else |
796 | skb = dev_alloc_skb(pkt_len + 2); | 796 | skb = dev_alloc_skb(pkt_len + 2); |
@@ -842,7 +842,7 @@ memory_squeeze: | |||
842 | if (rbd != NULL && (rbd->count & 0x4000)) { | 842 | if (rbd != NULL && (rbd->count & 0x4000)) { |
843 | rbd->count = 0; | 843 | rbd->count = 0; |
844 | lp->rbd_head = rbd->v_next; | 844 | lp->rbd_head = rbd->v_next; |
845 | CHECK_WBACK_INV(rbd, sizeof(struct i596_rbd)); | 845 | CHECK_WBACK_INV(lp, rbd, sizeof(struct i596_rbd)); |
846 | } | 846 | } |
847 | 847 | ||
848 | /* Tidy the frame descriptor, marking it as end of list */ | 848 | /* Tidy the frame descriptor, marking it as end of list */ |
@@ -860,10 +860,10 @@ memory_squeeze: | |||
860 | 860 | ||
861 | lp->scb.rfd = rfd->b_next; | 861 | lp->scb.rfd = rfd->b_next; |
862 | lp->rfd_head = rfd->v_next; | 862 | lp->rfd_head = rfd->v_next; |
863 | CHECK_WBACK_INV(rfd->v_prev, sizeof(struct i596_rfd)); | 863 | CHECK_WBACK_INV(lp, rfd->v_prev, sizeof(struct i596_rfd)); |
864 | CHECK_WBACK_INV(rfd, sizeof(struct i596_rfd)); | 864 | CHECK_WBACK_INV(lp, rfd, sizeof(struct i596_rfd)); |
865 | rfd = lp->rfd_head; | 865 | rfd = lp->rfd_head; |
866 | CHECK_INV(rfd, sizeof(struct i596_rfd)); | 866 | CHECK_INV(lp, rfd, sizeof(struct i596_rfd)); |
867 | } | 867 | } |
868 | 868 | ||
869 | DEB(DEB_RXFRAME, printk("frames %d\n", frames)); | 869 | DEB(DEB_RXFRAME, printk("frames %d\n", frames)); |
@@ -902,12 +902,12 @@ static inline void i596_cleanup_cmd(struct net_device *dev, struct i596_private | |||
902 | ptr->v_next = NULL; | 902 | ptr->v_next = NULL; |
903 | ptr->b_next = I596_NULL; | 903 | ptr->b_next = I596_NULL; |
904 | } | 904 | } |
905 | CHECK_WBACK_INV(ptr, sizeof(struct i596_cmd)); | 905 | CHECK_WBACK_INV(lp, ptr, sizeof(struct i596_cmd)); |
906 | } | 906 | } |
907 | 907 | ||
908 | wait_cmd(dev, lp, 100, "i596_cleanup_cmd timed out"); | 908 | wait_cmd(dev, lp, 100, "i596_cleanup_cmd timed out"); |
909 | lp->scb.cmd = I596_NULL; | 909 | lp->scb.cmd = I596_NULL; |
910 | CHECK_WBACK(&(lp->scb), sizeof(struct i596_scb)); | 910 | CHECK_WBACK(lp, &(lp->scb), sizeof(struct i596_scb)); |
911 | } | 911 | } |
912 | 912 | ||
913 | 913 | ||
@@ -925,7 +925,7 @@ static inline void i596_reset(struct net_device *dev, struct i596_private *lp) | |||
925 | 925 | ||
926 | /* FIXME: this command might cause an lpmc */ | 926 | /* FIXME: this command might cause an lpmc */ |
927 | lp->scb.command = CUC_ABORT | RX_ABORT; | 927 | lp->scb.command = CUC_ABORT | RX_ABORT; |
928 | CHECK_WBACK(&(lp->scb), sizeof(struct i596_scb)); | 928 | CHECK_WBACK(lp, &(lp->scb), sizeof(struct i596_scb)); |
929 | CA(dev); | 929 | CA(dev); |
930 | 930 | ||
931 | /* wait for shutdown */ | 931 | /* wait for shutdown */ |
@@ -951,20 +951,20 @@ static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd) | |||
951 | cmd->command |= (CMD_EOL | CMD_INTR); | 951 | cmd->command |= (CMD_EOL | CMD_INTR); |
952 | cmd->v_next = NULL; | 952 | cmd->v_next = NULL; |
953 | cmd->b_next = I596_NULL; | 953 | cmd->b_next = I596_NULL; |
954 | CHECK_WBACK(cmd, sizeof(struct i596_cmd)); | 954 | CHECK_WBACK(lp, cmd, sizeof(struct i596_cmd)); |
955 | 955 | ||
956 | spin_lock_irqsave (&lp->lock, flags); | 956 | spin_lock_irqsave (&lp->lock, flags); |
957 | 957 | ||
958 | if (lp->cmd_head != NULL) { | 958 | if (lp->cmd_head != NULL) { |
959 | lp->cmd_tail->v_next = cmd; | 959 | lp->cmd_tail->v_next = cmd; |
960 | lp->cmd_tail->b_next = WSWAPcmd(virt_to_dma(lp,&cmd->status)); | 960 | lp->cmd_tail->b_next = WSWAPcmd(virt_to_dma(lp,&cmd->status)); |
961 | CHECK_WBACK(lp->cmd_tail, sizeof(struct i596_cmd)); | 961 | CHECK_WBACK(lp, lp->cmd_tail, sizeof(struct i596_cmd)); |
962 | } else { | 962 | } else { |
963 | lp->cmd_head = cmd; | 963 | lp->cmd_head = cmd; |
964 | wait_cmd(dev, lp, 100, "i596_add_cmd timed out"); | 964 | wait_cmd(dev, lp, 100, "i596_add_cmd timed out"); |
965 | lp->scb.cmd = WSWAPcmd(virt_to_dma(lp,&cmd->status)); | 965 | lp->scb.cmd = WSWAPcmd(virt_to_dma(lp,&cmd->status)); |
966 | lp->scb.command = CUC_START; | 966 | lp->scb.command = CUC_START; |
967 | CHECK_WBACK(&(lp->scb), sizeof(struct i596_scb)); | 967 | CHECK_WBACK(lp, &(lp->scb), sizeof(struct i596_scb)); |
968 | CA(dev); | 968 | CA(dev); |
969 | } | 969 | } |
970 | lp->cmd_tail = cmd; | 970 | lp->cmd_tail = cmd; |
@@ -998,12 +998,12 @@ static int i596_test(struct net_device *dev) | |||
998 | data = virt_to_dma(lp,tint); | 998 | data = virt_to_dma(lp,tint); |
999 | 999 | ||
1000 | tint[1] = -1; | 1000 | tint[1] = -1; |
1001 | CHECK_WBACK(tint,PAGE_SIZE); | 1001 | CHECK_WBACK(lp, tint, PAGE_SIZE); |
1002 | 1002 | ||
1003 | MPU_PORT(dev, 1, data); | 1003 | MPU_PORT(dev, 1, data); |
1004 | 1004 | ||
1005 | for(data = 1000000; data; data--) { | 1005 | for(data = 1000000; data; data--) { |
1006 | CHECK_INV(tint,PAGE_SIZE); | 1006 | CHECK_INV(lp, tint, PAGE_SIZE); |
1007 | if(tint[1] != -1) | 1007 | if(tint[1] != -1) |
1008 | break; | 1008 | break; |
1009 | 1009 | ||
@@ -1061,7 +1061,7 @@ static void i596_tx_timeout (struct net_device *dev) | |||
1061 | /* Issue a channel attention signal */ | 1061 | /* Issue a channel attention signal */ |
1062 | DEB(DEB_ERRORS, printk("Kicking board.\n")); | 1062 | DEB(DEB_ERRORS, printk("Kicking board.\n")); |
1063 | lp->scb.command = CUC_START | RX_START; | 1063 | lp->scb.command = CUC_START | RX_START; |
1064 | CHECK_WBACK_INV(&(lp->scb), sizeof(struct i596_scb)); | 1064 | CHECK_WBACK_INV(lp, &(lp->scb), sizeof(struct i596_scb)); |
1065 | CA (dev); | 1065 | CA (dev); |
1066 | lp->last_restart = lp->stats.tx_packets; | 1066 | lp->last_restart = lp->stats.tx_packets; |
1067 | } | 1067 | } |
@@ -1118,8 +1118,8 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1118 | tbd->data = WSWAPchar(tx_cmd->dma_addr); | 1118 | tbd->data = WSWAPchar(tx_cmd->dma_addr); |
1119 | 1119 | ||
1120 | DEB(DEB_TXADDR,print_eth(skb->data, "tx-queued")); | 1120 | DEB(DEB_TXADDR,print_eth(skb->data, "tx-queued")); |
1121 | CHECK_WBACK_INV(tx_cmd, sizeof(struct tx_cmd)); | 1121 | CHECK_WBACK_INV(lp, tx_cmd, sizeof(struct tx_cmd)); |
1122 | CHECK_WBACK_INV(tbd, sizeof(struct i596_tbd)); | 1122 | CHECK_WBACK_INV(lp, tbd, sizeof(struct i596_tbd)); |
1123 | i596_add_cmd(dev, &tx_cmd->cmd); | 1123 | i596_add_cmd(dev, &tx_cmd->cmd); |
1124 | 1124 | ||
1125 | lp->stats.tx_packets++; | 1125 | lp->stats.tx_packets++; |
@@ -1228,7 +1228,7 @@ static int __devinit i82596_probe(struct net_device *dev, | |||
1228 | lp->dma_addr = dma_addr; | 1228 | lp->dma_addr = dma_addr; |
1229 | lp->dev = gen_dev; | 1229 | lp->dev = gen_dev; |
1230 | 1230 | ||
1231 | CHECK_WBACK_INV(dev->mem_start, sizeof(struct i596_private)); | 1231 | CHECK_WBACK_INV(lp, dev->mem_start, sizeof(struct i596_private)); |
1232 | 1232 | ||
1233 | i = register_netdev(dev); | 1233 | i = register_netdev(dev); |
1234 | if (i) { | 1234 | if (i) { |
@@ -1295,7 +1295,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id) | |||
1295 | DEB(DEB_INTS, printk("%s: i596 interrupt command unit inactive %x.\n", dev->name, status & 0x0700)); | 1295 | DEB(DEB_INTS, printk("%s: i596 interrupt command unit inactive %x.\n", dev->name, status & 0x0700)); |
1296 | 1296 | ||
1297 | while (lp->cmd_head != NULL) { | 1297 | while (lp->cmd_head != NULL) { |
1298 | CHECK_INV(lp->cmd_head, sizeof(struct i596_cmd)); | 1298 | CHECK_INV(lp, lp->cmd_head, sizeof(struct i596_cmd)); |
1299 | if (!(lp->cmd_head->status & STAT_C)) | 1299 | if (!(lp->cmd_head->status & STAT_C)) |
1300 | break; | 1300 | break; |
1301 | 1301 | ||
@@ -1358,7 +1358,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id) | |||
1358 | } | 1358 | } |
1359 | ptr->v_next = NULL; | 1359 | ptr->v_next = NULL; |
1360 | ptr->b_next = I596_NULL; | 1360 | ptr->b_next = I596_NULL; |
1361 | CHECK_WBACK(ptr, sizeof(struct i596_cmd)); | 1361 | CHECK_WBACK(lp, ptr, sizeof(struct i596_cmd)); |
1362 | lp->last_cmd = jiffies; | 1362 | lp->last_cmd = jiffies; |
1363 | } | 1363 | } |
1364 | 1364 | ||
@@ -1372,13 +1372,13 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id) | |||
1372 | 1372 | ||
1373 | ptr->command &= 0x1fff; | 1373 | ptr->command &= 0x1fff; |
1374 | ptr = ptr->v_next; | 1374 | ptr = ptr->v_next; |
1375 | CHECK_WBACK_INV(prev, sizeof(struct i596_cmd)); | 1375 | CHECK_WBACK_INV(lp, prev, sizeof(struct i596_cmd)); |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | if ((lp->cmd_head != NULL)) | 1378 | if ((lp->cmd_head != NULL)) |
1379 | ack_cmd |= CUC_START; | 1379 | ack_cmd |= CUC_START; |
1380 | lp->scb.cmd = WSWAPcmd(virt_to_dma(lp,&lp->cmd_head->status)); | 1380 | lp->scb.cmd = WSWAPcmd(virt_to_dma(lp,&lp->cmd_head->status)); |
1381 | CHECK_WBACK_INV(&lp->scb, sizeof(struct i596_scb)); | 1381 | CHECK_WBACK_INV(lp, &lp->scb, sizeof(struct i596_scb)); |
1382 | } | 1382 | } |
1383 | if ((status & 0x1000) || (status & 0x4000)) { | 1383 | if ((status & 0x1000) || (status & 0x4000)) { |
1384 | if ((status & 0x4000)) | 1384 | if ((status & 0x4000)) |
@@ -1397,7 +1397,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id) | |||
1397 | } | 1397 | } |
1398 | wait_cmd(dev, lp, 100, "i596 interrupt, timeout"); | 1398 | wait_cmd(dev, lp, 100, "i596 interrupt, timeout"); |
1399 | lp->scb.command = ack_cmd; | 1399 | lp->scb.command = ack_cmd; |
1400 | CHECK_WBACK(&lp->scb, sizeof(struct i596_scb)); | 1400 | CHECK_WBACK(lp, &lp->scb, sizeof(struct i596_scb)); |
1401 | 1401 | ||
1402 | /* DANGER: I suspect that some kind of interrupt | 1402 | /* DANGER: I suspect that some kind of interrupt |
1403 | acknowledgement aside from acking the 82596 might be needed | 1403 | acknowledgement aside from acking the 82596 might be needed |
@@ -1426,7 +1426,7 @@ static int i596_close(struct net_device *dev) | |||
1426 | 1426 | ||
1427 | wait_cmd(dev, lp, 100, "close1 timed out"); | 1427 | wait_cmd(dev, lp, 100, "close1 timed out"); |
1428 | lp->scb.command = CUC_ABORT | RX_ABORT; | 1428 | lp->scb.command = CUC_ABORT | RX_ABORT; |
1429 | CHECK_WBACK(&lp->scb, sizeof(struct i596_scb)); | 1429 | CHECK_WBACK(lp, &lp->scb, sizeof(struct i596_scb)); |
1430 | 1430 | ||
1431 | CA(dev); | 1431 | CA(dev); |
1432 | 1432 | ||
@@ -1486,7 +1486,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1486 | dev->name); | 1486 | dev->name); |
1487 | else { | 1487 | else { |
1488 | lp->cf_cmd.cmd.command = CmdConfigure; | 1488 | lp->cf_cmd.cmd.command = CmdConfigure; |
1489 | CHECK_WBACK_INV(&lp->cf_cmd, sizeof(struct cf_cmd)); | 1489 | CHECK_WBACK_INV(lp, &lp->cf_cmd, sizeof(struct cf_cmd)); |
1490 | i596_add_cmd(dev, &lp->cf_cmd.cmd); | 1490 | i596_add_cmd(dev, &lp->cf_cmd.cmd); |
1491 | } | 1491 | } |
1492 | } | 1492 | } |
@@ -1514,7 +1514,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1514 | DEB(DEB_MULTI, printk("%s: Adding address %02x:%02x:%02x:%02x:%02x:%02x\n", | 1514 | DEB(DEB_MULTI, printk("%s: Adding address %02x:%02x:%02x:%02x:%02x:%02x\n", |
1515 | dev->name, cp[0],cp[1],cp[2],cp[3],cp[4],cp[5])); | 1515 | dev->name, cp[0],cp[1],cp[2],cp[3],cp[4],cp[5])); |
1516 | } | 1516 | } |
1517 | CHECK_WBACK_INV(&lp->mc_cmd, sizeof(struct mc_cmd)); | 1517 | CHECK_WBACK_INV(lp, &lp->mc_cmd, sizeof(struct mc_cmd)); |
1518 | i596_add_cmd(dev, &cmd->cmd); | 1518 | i596_add_cmd(dev, &cmd->cmd); |
1519 | } | 1519 | } |
1520 | } | 1520 | } |
diff --git a/drivers/net/lne390.c b/drivers/net/lne390.c index 5795ee116205..0a08d0c4e7b4 100644 --- a/drivers/net/lne390.c +++ b/drivers/net/lne390.c | |||
@@ -440,7 +440,7 @@ static void cleanup_card(struct net_device *dev) | |||
440 | iounmap(ei_status.mem); | 440 | iounmap(ei_status.mem); |
441 | } | 441 | } |
442 | 442 | ||
443 | void cleanup_module(void) | 443 | void __exit cleanup_module(void) |
444 | { | 444 | { |
445 | int this_dev; | 445 | int this_dev; |
446 | 446 | ||
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index d9f48bb04b05..c41ae4286eea 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1100,7 +1100,7 @@ static void eth_tx_fill_frag_descs(struct mv643xx_private *mp, | |||
1100 | ETH_TX_ENABLE_INTERRUPT; | 1100 | ETH_TX_ENABLE_INTERRUPT; |
1101 | mp->tx_skb[tx_index] = skb; | 1101 | mp->tx_skb[tx_index] = skb; |
1102 | } else | 1102 | } else |
1103 | mp->tx_skb[tx_index] = 0; | 1103 | mp->tx_skb[tx_index] = NULL; |
1104 | 1104 | ||
1105 | desc = &mp->p_tx_desc_area[tx_index]; | 1105 | desc = &mp->p_tx_desc_area[tx_index]; |
1106 | desc->l4i_chk = 0; | 1106 | desc->l4i_chk = 0; |
@@ -1136,7 +1136,7 @@ static void eth_tx_submit_descs_for_skb(struct mv643xx_private *mp, | |||
1136 | eth_tx_fill_frag_descs(mp, skb); | 1136 | eth_tx_fill_frag_descs(mp, skb); |
1137 | 1137 | ||
1138 | length = skb_headlen(skb); | 1138 | length = skb_headlen(skb); |
1139 | mp->tx_skb[tx_index] = 0; | 1139 | mp->tx_skb[tx_index] = NULL; |
1140 | } else { | 1140 | } else { |
1141 | cmd_sts |= ETH_ZERO_PADDING | | 1141 | cmd_sts |= ETH_ZERO_PADDING | |
1142 | ETH_TX_LAST_DESC | | 1142 | ETH_TX_LAST_DESC | |
diff --git a/drivers/net/mvme147.c b/drivers/net/mvme147.c index 56a82d8ee8f5..e246d00bba6d 100644 --- a/drivers/net/mvme147.c +++ b/drivers/net/mvme147.c | |||
@@ -184,7 +184,7 @@ static int m147lance_close(struct net_device *dev) | |||
184 | MODULE_LICENSE("GPL"); | 184 | MODULE_LICENSE("GPL"); |
185 | 185 | ||
186 | static struct net_device *dev_mvme147_lance; | 186 | static struct net_device *dev_mvme147_lance; |
187 | int init_module(void) | 187 | int __init init_module(void) |
188 | { | 188 | { |
189 | dev_mvme147_lance = mvme147lance_probe(-1); | 189 | dev_mvme147_lance = mvme147lance_probe(-1); |
190 | if (IS_ERR(dev_mvme147_lance)) | 190 | if (IS_ERR(dev_mvme147_lance)) |
@@ -192,7 +192,7 @@ int init_module(void) | |||
192 | return 0; | 192 | return 0; |
193 | } | 193 | } |
194 | 194 | ||
195 | void cleanup_module(void) | 195 | void __exit cleanup_module(void) |
196 | { | 196 | { |
197 | struct m147lance_private *lp = dev_mvme147_lance->priv; | 197 | struct m147lance_private *lp = dev_mvme147_lance->priv; |
198 | unregister_netdev(dev_mvme147_lance); | 198 | unregister_netdev(dev_mvme147_lance); |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 38df42802386..81f127a78afa 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -89,7 +89,7 @@ MODULE_LICENSE("Dual BSD/GPL"); | |||
89 | #define MYRI10GE_EEPROM_STRINGS_SIZE 256 | 89 | #define MYRI10GE_EEPROM_STRINGS_SIZE 256 |
90 | #define MYRI10GE_MAX_SEND_DESC_TSO ((65536 / 2048) * 2) | 90 | #define MYRI10GE_MAX_SEND_DESC_TSO ((65536 / 2048) * 2) |
91 | 91 | ||
92 | #define MYRI10GE_NO_CONFIRM_DATA 0xffffffff | 92 | #define MYRI10GE_NO_CONFIRM_DATA htonl(0xffffffff) |
93 | #define MYRI10GE_NO_RESPONSE_RESULT 0xffffffff | 93 | #define MYRI10GE_NO_RESPONSE_RESULT 0xffffffff |
94 | 94 | ||
95 | struct myri10ge_rx_buffer_state { | 95 | struct myri10ge_rx_buffer_state { |
@@ -156,8 +156,8 @@ struct myri10ge_priv { | |||
156 | int sram_size; | 156 | int sram_size; |
157 | unsigned long board_span; | 157 | unsigned long board_span; |
158 | unsigned long iomem_base; | 158 | unsigned long iomem_base; |
159 | u32 __iomem *irq_claim; | 159 | __be32 __iomem *irq_claim; |
160 | u32 __iomem *irq_deassert; | 160 | __be32 __iomem *irq_deassert; |
161 | char *mac_addr_string; | 161 | char *mac_addr_string; |
162 | struct mcp_cmd_response *cmd; | 162 | struct mcp_cmd_response *cmd; |
163 | dma_addr_t cmd_bus; | 163 | dma_addr_t cmd_bus; |
@@ -165,10 +165,10 @@ struct myri10ge_priv { | |||
165 | dma_addr_t fw_stats_bus; | 165 | dma_addr_t fw_stats_bus; |
166 | struct pci_dev *pdev; | 166 | struct pci_dev *pdev; |
167 | int msi_enabled; | 167 | int msi_enabled; |
168 | unsigned int link_state; | 168 | __be32 link_state; |
169 | unsigned int rdma_tags_available; | 169 | unsigned int rdma_tags_available; |
170 | int intr_coal_delay; | 170 | int intr_coal_delay; |
171 | u32 __iomem *intr_coal_delay_ptr; | 171 | __be32 __iomem *intr_coal_delay_ptr; |
172 | int mtrr; | 172 | int mtrr; |
173 | int wake_queue; | 173 | int wake_queue; |
174 | int stop_queue; | 174 | int stop_queue; |
@@ -273,6 +273,11 @@ MODULE_PARM_DESC(myri10ge_debug, "Debug level (0=none,...,16=all)"); | |||
273 | 273 | ||
274 | #define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8) | 274 | #define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8) |
275 | 275 | ||
276 | static inline void put_be32(__be32 val, __be32 __iomem *p) | ||
277 | { | ||
278 | __raw_writel((__force __u32)val, (__force void __iomem *)p); | ||
279 | } | ||
280 | |||
276 | static int | 281 | static int |
277 | myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, | 282 | myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, |
278 | struct myri10ge_cmd *data, int atomic) | 283 | struct myri10ge_cmd *data, int atomic) |
@@ -296,7 +301,7 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, | |||
296 | 301 | ||
297 | buf->response_addr.low = htonl(dma_low); | 302 | buf->response_addr.low = htonl(dma_low); |
298 | buf->response_addr.high = htonl(dma_high); | 303 | buf->response_addr.high = htonl(dma_high); |
299 | response->result = MYRI10GE_NO_RESPONSE_RESULT; | 304 | response->result = htonl(MYRI10GE_NO_RESPONSE_RESULT); |
300 | mb(); | 305 | mb(); |
301 | myri10ge_pio_copy(cmd_addr, buf, sizeof(*buf)); | 306 | myri10ge_pio_copy(cmd_addr, buf, sizeof(*buf)); |
302 | 307 | ||
@@ -311,14 +316,14 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, | |||
311 | * (1ms will be enough for those commands) */ | 316 | * (1ms will be enough for those commands) */ |
312 | for (sleep_total = 0; | 317 | for (sleep_total = 0; |
313 | sleep_total < 1000 | 318 | sleep_total < 1000 |
314 | && response->result == MYRI10GE_NO_RESPONSE_RESULT; | 319 | && response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT); |
315 | sleep_total += 10) | 320 | sleep_total += 10) |
316 | udelay(10); | 321 | udelay(10); |
317 | } else { | 322 | } else { |
318 | /* use msleep for most command */ | 323 | /* use msleep for most command */ |
319 | for (sleep_total = 0; | 324 | for (sleep_total = 0; |
320 | sleep_total < 15 | 325 | sleep_total < 15 |
321 | && response->result == MYRI10GE_NO_RESPONSE_RESULT; | 326 | && response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT); |
322 | sleep_total++) | 327 | sleep_total++) |
323 | msleep(1); | 328 | msleep(1); |
324 | } | 329 | } |
@@ -393,7 +398,7 @@ abort: | |||
393 | static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable) | 398 | static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable) |
394 | { | 399 | { |
395 | char __iomem *submit; | 400 | char __iomem *submit; |
396 | u32 buf[16]; | 401 | __be32 buf[16]; |
397 | u32 dma_low, dma_high; | 402 | u32 dma_low, dma_high; |
398 | int i; | 403 | int i; |
399 | 404 | ||
@@ -410,7 +415,7 @@ static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable) | |||
410 | 415 | ||
411 | buf[0] = htonl(dma_high); /* confirm addr MSW */ | 416 | buf[0] = htonl(dma_high); /* confirm addr MSW */ |
412 | buf[1] = htonl(dma_low); /* confirm addr LSW */ | 417 | buf[1] = htonl(dma_low); /* confirm addr LSW */ |
413 | buf[2] = htonl(MYRI10GE_NO_CONFIRM_DATA); /* confirm data */ | 418 | buf[2] = MYRI10GE_NO_CONFIRM_DATA; /* confirm data */ |
414 | buf[3] = htonl(dma_high); /* dummy addr MSW */ | 419 | buf[3] = htonl(dma_high); /* dummy addr MSW */ |
415 | buf[4] = htonl(dma_low); /* dummy addr LSW */ | 420 | buf[4] = htonl(dma_low); /* dummy addr LSW */ |
416 | buf[5] = htonl(enable); /* enable? */ | 421 | buf[5] = htonl(enable); /* enable? */ |
@@ -479,7 +484,7 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size) | |||
479 | } | 484 | } |
480 | 485 | ||
481 | /* check id */ | 486 | /* check id */ |
482 | hdr_offset = ntohl(*(u32 *) (fw->data + MCP_HEADER_PTR_OFFSET)); | 487 | hdr_offset = ntohl(*(__be32 *) (fw->data + MCP_HEADER_PTR_OFFSET)); |
483 | if ((hdr_offset & 3) || hdr_offset + sizeof(*hdr) > fw->size) { | 488 | if ((hdr_offset & 3) || hdr_offset + sizeof(*hdr) > fw->size) { |
484 | dev_err(dev, "Bad firmware file\n"); | 489 | dev_err(dev, "Bad firmware file\n"); |
485 | status = -EINVAL; | 490 | status = -EINVAL; |
@@ -550,7 +555,7 @@ static int myri10ge_adopt_running_firmware(struct myri10ge_priv *mgp) | |||
550 | static int myri10ge_load_firmware(struct myri10ge_priv *mgp) | 555 | static int myri10ge_load_firmware(struct myri10ge_priv *mgp) |
551 | { | 556 | { |
552 | char __iomem *submit; | 557 | char __iomem *submit; |
553 | u32 buf[16]; | 558 | __be32 buf[16]; |
554 | u32 dma_low, dma_high, size; | 559 | u32 dma_low, dma_high, size; |
555 | int status, i; | 560 | int status, i; |
556 | 561 | ||
@@ -600,7 +605,7 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp) | |||
600 | 605 | ||
601 | buf[0] = htonl(dma_high); /* confirm addr MSW */ | 606 | buf[0] = htonl(dma_high); /* confirm addr MSW */ |
602 | buf[1] = htonl(dma_low); /* confirm addr LSW */ | 607 | buf[1] = htonl(dma_low); /* confirm addr LSW */ |
603 | buf[2] = htonl(MYRI10GE_NO_CONFIRM_DATA); /* confirm data */ | 608 | buf[2] = MYRI10GE_NO_CONFIRM_DATA; /* confirm data */ |
604 | 609 | ||
605 | /* FIX: All newest firmware should un-protect the bottom of | 610 | /* FIX: All newest firmware should un-protect the bottom of |
606 | * the sram before handoff. However, the very first interfaces | 611 | * the sram before handoff. However, the very first interfaces |
@@ -705,21 +710,21 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
705 | 710 | ||
706 | status |= | 711 | status |= |
707 | myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_IRQ_ACK_OFFSET, &cmd, 0); | 712 | myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_IRQ_ACK_OFFSET, &cmd, 0); |
708 | mgp->irq_claim = (__iomem u32 *) (mgp->sram + cmd.data0); | 713 | mgp->irq_claim = (__iomem __be32 *) (mgp->sram + cmd.data0); |
709 | if (!mgp->msi_enabled) { | 714 | if (!mgp->msi_enabled) { |
710 | status |= myri10ge_send_cmd | 715 | status |= myri10ge_send_cmd |
711 | (mgp, MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET, &cmd, 0); | 716 | (mgp, MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET, &cmd, 0); |
712 | mgp->irq_deassert = (__iomem u32 *) (mgp->sram + cmd.data0); | 717 | mgp->irq_deassert = (__iomem __be32 *) (mgp->sram + cmd.data0); |
713 | 718 | ||
714 | } | 719 | } |
715 | status |= myri10ge_send_cmd | 720 | status |= myri10ge_send_cmd |
716 | (mgp, MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, &cmd, 0); | 721 | (mgp, MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, &cmd, 0); |
717 | mgp->intr_coal_delay_ptr = (__iomem u32 *) (mgp->sram + cmd.data0); | 722 | mgp->intr_coal_delay_ptr = (__iomem __be32 *) (mgp->sram + cmd.data0); |
718 | if (status != 0) { | 723 | if (status != 0) { |
719 | dev_err(&mgp->pdev->dev, "failed set interrupt parameters\n"); | 724 | dev_err(&mgp->pdev->dev, "failed set interrupt parameters\n"); |
720 | return status; | 725 | return status; |
721 | } | 726 | } |
722 | __raw_writel(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr); | 727 | put_be32(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr); |
723 | 728 | ||
724 | /* Run a small DMA test. | 729 | /* Run a small DMA test. |
725 | * The magic multipliers to the length tell the firmware | 730 | * The magic multipliers to the length tell the firmware |
@@ -786,14 +791,16 @@ static inline void | |||
786 | myri10ge_submit_8rx(struct mcp_kreq_ether_recv __iomem * dst, | 791 | myri10ge_submit_8rx(struct mcp_kreq_ether_recv __iomem * dst, |
787 | struct mcp_kreq_ether_recv *src) | 792 | struct mcp_kreq_ether_recv *src) |
788 | { | 793 | { |
789 | u32 low; | 794 | __be32 low; |
790 | 795 | ||
791 | low = src->addr_low; | 796 | low = src->addr_low; |
792 | src->addr_low = DMA_32BIT_MASK; | 797 | src->addr_low = htonl(DMA_32BIT_MASK); |
793 | myri10ge_pio_copy(dst, src, 8 * sizeof(*src)); | 798 | myri10ge_pio_copy(dst, src, 4 * sizeof(*src)); |
799 | mb(); | ||
800 | myri10ge_pio_copy(dst + 4, src + 4, 4 * sizeof(*src)); | ||
794 | mb(); | 801 | mb(); |
795 | src->addr_low = low; | 802 | src->addr_low = low; |
796 | __raw_writel(low, &dst->addr_low); | 803 | put_be32(low, &dst->addr_low); |
797 | mb(); | 804 | mb(); |
798 | } | 805 | } |
799 | 806 | ||
@@ -939,11 +946,11 @@ done: | |||
939 | return retval; | 946 | return retval; |
940 | } | 947 | } |
941 | 948 | ||
942 | static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, u16 hw_csum) | 949 | static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, __wsum hw_csum) |
943 | { | 950 | { |
944 | struct vlan_hdr *vh = (struct vlan_hdr *)(skb->data); | 951 | struct vlan_hdr *vh = (struct vlan_hdr *)(skb->data); |
945 | 952 | ||
946 | if ((skb->protocol == ntohs(ETH_P_8021Q)) && | 953 | if ((skb->protocol == htons(ETH_P_8021Q)) && |
947 | (vh->h_vlan_encapsulated_proto == htons(ETH_P_IP) || | 954 | (vh->h_vlan_encapsulated_proto == htons(ETH_P_IP) || |
948 | vh->h_vlan_encapsulated_proto == htons(ETH_P_IPV6))) { | 955 | vh->h_vlan_encapsulated_proto == htons(ETH_P_IPV6))) { |
949 | skb->csum = hw_csum; | 956 | skb->csum = hw_csum; |
@@ -953,7 +960,7 @@ static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, u16 hw_csum) | |||
953 | 960 | ||
954 | static inline unsigned long | 961 | static inline unsigned long |
955 | myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, | 962 | myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, |
956 | int bytes, int len, int csum) | 963 | int bytes, int len, __wsum csum) |
957 | { | 964 | { |
958 | dma_addr_t bus; | 965 | dma_addr_t bus; |
959 | struct sk_buff *skb; | 966 | struct sk_buff *skb; |
@@ -986,12 +993,12 @@ myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, | |||
986 | 993 | ||
987 | skb->protocol = eth_type_trans(skb, mgp->dev); | 994 | skb->protocol = eth_type_trans(skb, mgp->dev); |
988 | if (mgp->csum_flag) { | 995 | if (mgp->csum_flag) { |
989 | if ((skb->protocol == ntohs(ETH_P_IP)) || | 996 | if ((skb->protocol == htons(ETH_P_IP)) || |
990 | (skb->protocol == ntohs(ETH_P_IPV6))) { | 997 | (skb->protocol == htons(ETH_P_IPV6))) { |
991 | skb->csum = ntohs((u16) csum); | 998 | skb->csum = csum; |
992 | skb->ip_summed = CHECKSUM_COMPLETE; | 999 | skb->ip_summed = CHECKSUM_COMPLETE; |
993 | } else | 1000 | } else |
994 | myri10ge_vlan_ip_csum(skb, ntohs((u16) csum)); | 1001 | myri10ge_vlan_ip_csum(skb, csum); |
995 | } | 1002 | } |
996 | 1003 | ||
997 | netif_receive_skb(skb); | 1004 | netif_receive_skb(skb); |
@@ -1060,12 +1067,12 @@ static inline void myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int *limit) | |||
1060 | int idx = rx_done->idx; | 1067 | int idx = rx_done->idx; |
1061 | int cnt = rx_done->cnt; | 1068 | int cnt = rx_done->cnt; |
1062 | u16 length; | 1069 | u16 length; |
1063 | u16 checksum; | 1070 | __wsum checksum; |
1064 | 1071 | ||
1065 | while (rx_done->entry[idx].length != 0 && *limit != 0) { | 1072 | while (rx_done->entry[idx].length != 0 && *limit != 0) { |
1066 | length = ntohs(rx_done->entry[idx].length); | 1073 | length = ntohs(rx_done->entry[idx].length); |
1067 | rx_done->entry[idx].length = 0; | 1074 | rx_done->entry[idx].length = 0; |
1068 | checksum = ntohs(rx_done->entry[idx].checksum); | 1075 | checksum = csum_unfold(rx_done->entry[idx].checksum); |
1069 | if (length <= mgp->small_bytes) | 1076 | if (length <= mgp->small_bytes) |
1070 | rx_ok = myri10ge_rx_done(mgp, &mgp->rx_small, | 1077 | rx_ok = myri10ge_rx_done(mgp, &mgp->rx_small, |
1071 | mgp->small_bytes, | 1078 | mgp->small_bytes, |
@@ -1142,7 +1149,7 @@ static int myri10ge_poll(struct net_device *netdev, int *budget) | |||
1142 | 1149 | ||
1143 | if (rx_done->entry[rx_done->idx].length == 0 || !netif_running(netdev)) { | 1150 | if (rx_done->entry[rx_done->idx].length == 0 || !netif_running(netdev)) { |
1144 | netif_rx_complete(netdev); | 1151 | netif_rx_complete(netdev); |
1145 | __raw_writel(htonl(3), mgp->irq_claim); | 1152 | put_be32(htonl(3), mgp->irq_claim); |
1146 | return 0; | 1153 | return 0; |
1147 | } | 1154 | } |
1148 | return 1; | 1155 | return 1; |
@@ -1166,7 +1173,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg) | |||
1166 | netif_rx_schedule(mgp->dev); | 1173 | netif_rx_schedule(mgp->dev); |
1167 | 1174 | ||
1168 | if (!mgp->msi_enabled) { | 1175 | if (!mgp->msi_enabled) { |
1169 | __raw_writel(0, mgp->irq_deassert); | 1176 | put_be32(0, mgp->irq_deassert); |
1170 | if (!myri10ge_deassert_wait) | 1177 | if (!myri10ge_deassert_wait) |
1171 | stats->valid = 0; | 1178 | stats->valid = 0; |
1172 | mb(); | 1179 | mb(); |
@@ -1195,7 +1202,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg) | |||
1195 | 1202 | ||
1196 | myri10ge_check_statblock(mgp); | 1203 | myri10ge_check_statblock(mgp); |
1197 | 1204 | ||
1198 | __raw_writel(htonl(3), mgp->irq_claim + 1); | 1205 | put_be32(htonl(3), mgp->irq_claim + 1); |
1199 | return (IRQ_HANDLED); | 1206 | return (IRQ_HANDLED); |
1200 | } | 1207 | } |
1201 | 1208 | ||
@@ -1233,7 +1240,7 @@ myri10ge_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coal) | |||
1233 | struct myri10ge_priv *mgp = netdev_priv(netdev); | 1240 | struct myri10ge_priv *mgp = netdev_priv(netdev); |
1234 | 1241 | ||
1235 | mgp->intr_coal_delay = coal->rx_coalesce_usecs; | 1242 | mgp->intr_coal_delay = coal->rx_coalesce_usecs; |
1236 | __raw_writel(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr); | 1243 | put_be32(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr); |
1237 | return 0; | 1244 | return 0; |
1238 | } | 1245 | } |
1239 | 1246 | ||
@@ -1748,7 +1755,7 @@ static int myri10ge_open(struct net_device *dev) | |||
1748 | goto abort_with_rings; | 1755 | goto abort_with_rings; |
1749 | } | 1756 | } |
1750 | 1757 | ||
1751 | mgp->link_state = -1; | 1758 | mgp->link_state = htonl(~0U); |
1752 | mgp->rdma_tags_available = 15; | 1759 | mgp->rdma_tags_available = 15; |
1753 | 1760 | ||
1754 | netif_poll_enable(mgp->dev); /* must happen prior to any irq */ | 1761 | netif_poll_enable(mgp->dev); /* must happen prior to any irq */ |
@@ -1876,7 +1883,7 @@ myri10ge_submit_req(struct myri10ge_tx_buf *tx, struct mcp_kreq_ether_send *src, | |||
1876 | 1883 | ||
1877 | /* re-write the last 32-bits with the valid flags */ | 1884 | /* re-write the last 32-bits with the valid flags */ |
1878 | src->flags = last_flags; | 1885 | src->flags = last_flags; |
1879 | __raw_writel(*((u32 *) src + 3), (u32 __iomem *) dst + 3); | 1886 | put_be32(*((__be32 *) src + 3), (__be32 __iomem *) dst + 3); |
1880 | tx->req += cnt; | 1887 | tx->req += cnt; |
1881 | mb(); | 1888 | mb(); |
1882 | } | 1889 | } |
@@ -1919,7 +1926,8 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1919 | struct myri10ge_tx_buf *tx = &mgp->tx; | 1926 | struct myri10ge_tx_buf *tx = &mgp->tx; |
1920 | struct skb_frag_struct *frag; | 1927 | struct skb_frag_struct *frag; |
1921 | dma_addr_t bus; | 1928 | dma_addr_t bus; |
1922 | u32 low, high_swapped; | 1929 | u32 low; |
1930 | __be32 high_swapped; | ||
1923 | unsigned int len; | 1931 | unsigned int len; |
1924 | int idx, last_idx, avail, frag_cnt, frag_idx, count, mss, max_segments; | 1932 | int idx, last_idx, avail, frag_cnt, frag_idx, count, mss, max_segments; |
1925 | u16 pseudo_hdr_offset, cksum_offset; | 1933 | u16 pseudo_hdr_offset, cksum_offset; |
@@ -1964,7 +1972,6 @@ again: | |||
1964 | cksum_offset = 0; | 1972 | cksum_offset = 0; |
1965 | pseudo_hdr_offset = 0; | 1973 | pseudo_hdr_offset = 0; |
1966 | } else { | 1974 | } else { |
1967 | pseudo_hdr_offset = htons(pseudo_hdr_offset); | ||
1968 | odd_flag = MXGEFW_FLAGS_ALIGN_ODD; | 1975 | odd_flag = MXGEFW_FLAGS_ALIGN_ODD; |
1969 | flags |= MXGEFW_FLAGS_CKSUM; | 1976 | flags |= MXGEFW_FLAGS_CKSUM; |
1970 | } | 1977 | } |
@@ -1986,7 +1993,7 @@ again: | |||
1986 | /* for TSO, pseudo_hdr_offset holds mss. | 1993 | /* for TSO, pseudo_hdr_offset holds mss. |
1987 | * The firmware figures out where to put | 1994 | * The firmware figures out where to put |
1988 | * the checksum by parsing the header. */ | 1995 | * the checksum by parsing the header. */ |
1989 | pseudo_hdr_offset = htons(mss); | 1996 | pseudo_hdr_offset = mss; |
1990 | } else | 1997 | } else |
1991 | #endif /*NETIF_F_TSO */ | 1998 | #endif /*NETIF_F_TSO */ |
1992 | /* Mark small packets, and pad out tiny packets */ | 1999 | /* Mark small packets, and pad out tiny packets */ |
@@ -2086,7 +2093,7 @@ again: | |||
2086 | #endif /* NETIF_F_TSO */ | 2093 | #endif /* NETIF_F_TSO */ |
2087 | req->addr_high = high_swapped; | 2094 | req->addr_high = high_swapped; |
2088 | req->addr_low = htonl(low); | 2095 | req->addr_low = htonl(low); |
2089 | req->pseudo_hdr_offset = pseudo_hdr_offset; | 2096 | req->pseudo_hdr_offset = htons(pseudo_hdr_offset); |
2090 | req->pad = 0; /* complete solid 16-byte block; does this matter? */ | 2097 | req->pad = 0; /* complete solid 16-byte block; does this matter? */ |
2091 | req->rdma_count = 1; | 2098 | req->rdma_count = 1; |
2092 | req->length = htons(seglen); | 2099 | req->length = htons(seglen); |
@@ -2199,6 +2206,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev) | |||
2199 | struct myri10ge_cmd cmd; | 2206 | struct myri10ge_cmd cmd; |
2200 | struct myri10ge_priv *mgp; | 2207 | struct myri10ge_priv *mgp; |
2201 | struct dev_mc_list *mc_list; | 2208 | struct dev_mc_list *mc_list; |
2209 | __be32 data[2] = {0, 0}; | ||
2202 | int err; | 2210 | int err; |
2203 | 2211 | ||
2204 | mgp = netdev_priv(dev); | 2212 | mgp = netdev_priv(dev); |
@@ -2237,10 +2245,9 @@ static void myri10ge_set_multicast_list(struct net_device *dev) | |||
2237 | 2245 | ||
2238 | /* Walk the multicast list, and add each address */ | 2246 | /* Walk the multicast list, and add each address */ |
2239 | for (mc_list = dev->mc_list; mc_list != NULL; mc_list = mc_list->next) { | 2247 | for (mc_list = dev->mc_list; mc_list != NULL; mc_list = mc_list->next) { |
2240 | memcpy(&cmd.data0, &mc_list->dmi_addr, 4); | 2248 | memcpy(data, &mc_list->dmi_addr, 6); |
2241 | memcpy(&cmd.data1, ((char *)&mc_list->dmi_addr) + 4, 2); | 2249 | cmd.data0 = ntohl(data[0]); |
2242 | cmd.data0 = htonl(cmd.data0); | 2250 | cmd.data1 = ntohl(data[1]); |
2243 | cmd.data1 = htonl(cmd.data1); | ||
2244 | err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP, | 2251 | err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP, |
2245 | &cmd, 1); | 2252 | &cmd, 1); |
2246 | 2253 | ||
diff --git a/drivers/net/myri10ge/myri10ge_mcp.h b/drivers/net/myri10ge/myri10ge_mcp.h index 9519ae7cd5ec..29463b301a84 100644 --- a/drivers/net/myri10ge/myri10ge_mcp.h +++ b/drivers/net/myri10ge/myri10ge_mcp.h | |||
@@ -6,23 +6,23 @@ | |||
6 | 6 | ||
7 | /* 8 Bytes */ | 7 | /* 8 Bytes */ |
8 | struct mcp_dma_addr { | 8 | struct mcp_dma_addr { |
9 | u32 high; | 9 | __be32 high; |
10 | u32 low; | 10 | __be32 low; |
11 | }; | 11 | }; |
12 | 12 | ||
13 | /* 4 Bytes */ | 13 | /* 4 Bytes */ |
14 | struct mcp_slot { | 14 | struct mcp_slot { |
15 | u16 checksum; | 15 | __sum16 checksum; |
16 | u16 length; | 16 | __be16 length; |
17 | }; | 17 | }; |
18 | 18 | ||
19 | /* 64 Bytes */ | 19 | /* 64 Bytes */ |
20 | struct mcp_cmd { | 20 | struct mcp_cmd { |
21 | u32 cmd; | 21 | __be32 cmd; |
22 | u32 data0; /* will be low portion if data > 32 bits */ | 22 | __be32 data0; /* will be low portion if data > 32 bits */ |
23 | /* 8 */ | 23 | /* 8 */ |
24 | u32 data1; /* will be high portion if data > 32 bits */ | 24 | __be32 data1; /* will be high portion if data > 32 bits */ |
25 | u32 data2; /* currently unused.. */ | 25 | __be32 data2; /* currently unused.. */ |
26 | /* 16 */ | 26 | /* 16 */ |
27 | struct mcp_dma_addr response_addr; | 27 | struct mcp_dma_addr response_addr; |
28 | /* 24 */ | 28 | /* 24 */ |
@@ -31,8 +31,8 @@ struct mcp_cmd { | |||
31 | 31 | ||
32 | /* 8 Bytes */ | 32 | /* 8 Bytes */ |
33 | struct mcp_cmd_response { | 33 | struct mcp_cmd_response { |
34 | u32 data; | 34 | __be32 data; |
35 | u32 result; | 35 | __be32 result; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | /* | 38 | /* |
@@ -73,10 +73,10 @@ union mcp_pso_or_cumlen { | |||
73 | 73 | ||
74 | /* 16 Bytes */ | 74 | /* 16 Bytes */ |
75 | struct mcp_kreq_ether_send { | 75 | struct mcp_kreq_ether_send { |
76 | u32 addr_high; | 76 | __be32 addr_high; |
77 | u32 addr_low; | 77 | __be32 addr_low; |
78 | u16 pseudo_hdr_offset; | 78 | __be16 pseudo_hdr_offset; |
79 | u16 length; | 79 | __be16 length; |
80 | u8 pad; | 80 | u8 pad; |
81 | u8 rdma_count; | 81 | u8 rdma_count; |
82 | u8 cksum_offset; /* where to start computing cksum */ | 82 | u8 cksum_offset; /* where to start computing cksum */ |
@@ -85,8 +85,8 @@ struct mcp_kreq_ether_send { | |||
85 | 85 | ||
86 | /* 8 Bytes */ | 86 | /* 8 Bytes */ |
87 | struct mcp_kreq_ether_recv { | 87 | struct mcp_kreq_ether_recv { |
88 | u32 addr_high; | 88 | __be32 addr_high; |
89 | u32 addr_low; | 89 | __be32 addr_low; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | /* Commands */ | 92 | /* Commands */ |
@@ -219,19 +219,19 @@ enum myri10ge_mcp_cmd_status { | |||
219 | 219 | ||
220 | struct mcp_irq_data { | 220 | struct mcp_irq_data { |
221 | /* add new counters at the beginning */ | 221 | /* add new counters at the beginning */ |
222 | u32 future_use[5]; | 222 | __be32 future_use[5]; |
223 | u32 dropped_multicast_filtered; | 223 | __be32 dropped_multicast_filtered; |
224 | /* 40 Bytes */ | 224 | /* 40 Bytes */ |
225 | u32 send_done_count; | 225 | __be32 send_done_count; |
226 | 226 | ||
227 | u32 link_up; | 227 | __be32 link_up; |
228 | u32 dropped_link_overflow; | 228 | __be32 dropped_link_overflow; |
229 | u32 dropped_link_error_or_filtered; | 229 | __be32 dropped_link_error_or_filtered; |
230 | u32 dropped_runt; | 230 | __be32 dropped_runt; |
231 | u32 dropped_overrun; | 231 | __be32 dropped_overrun; |
232 | u32 dropped_no_small_buffer; | 232 | __be32 dropped_no_small_buffer; |
233 | u32 dropped_no_big_buffer; | 233 | __be32 dropped_no_big_buffer; |
234 | u32 rdma_tags_available; | 234 | __be32 rdma_tags_available; |
235 | 235 | ||
236 | u8 tx_stopped; | 236 | u8 tx_stopped; |
237 | u8 link_down; | 237 | u8 link_down; |
diff --git a/drivers/net/myri10ge/myri10ge_mcp_gen_header.h b/drivers/net/myri10ge/myri10ge_mcp_gen_header.h index 487f7792fd46..16a810dd6d51 100644 --- a/drivers/net/myri10ge/myri10ge_mcp_gen_header.h +++ b/drivers/net/myri10ge/myri10ge_mcp_gen_header.h | |||
@@ -36,7 +36,7 @@ | |||
36 | struct mcp_gen_header { | 36 | struct mcp_gen_header { |
37 | /* the first 4 fields are filled at compile time */ | 37 | /* the first 4 fields are filled at compile time */ |
38 | unsigned header_length; | 38 | unsigned header_length; |
39 | unsigned mcp_type; | 39 | __be32 mcp_type; |
40 | char version[128]; | 40 | char version[128]; |
41 | unsigned mcp_globals; /* pointer to mcp-type specific structure */ | 41 | unsigned mcp_globals; /* pointer to mcp-type specific structure */ |
42 | 42 | ||
diff --git a/drivers/net/ne.c b/drivers/net/ne.c index 787aa4221528..a5c4199e2754 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c | |||
@@ -867,7 +867,7 @@ static void cleanup_card(struct net_device *dev) | |||
867 | release_region(dev->base_addr, NE_IO_EXTENT); | 867 | release_region(dev->base_addr, NE_IO_EXTENT); |
868 | } | 868 | } |
869 | 869 | ||
870 | void cleanup_module(void) | 870 | void __exit cleanup_module(void) |
871 | { | 871 | { |
872 | int this_dev; | 872 | int this_dev; |
873 | 873 | ||
diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c index 5fccfea66d87..089b5bb702fc 100644 --- a/drivers/net/ne2.c +++ b/drivers/net/ne2.c | |||
@@ -813,7 +813,7 @@ static void cleanup_card(struct net_device *dev) | |||
813 | release_region(dev->base_addr, NE_IO_EXTENT); | 813 | release_region(dev->base_addr, NE_IO_EXTENT); |
814 | } | 814 | } |
815 | 815 | ||
816 | void cleanup_module(void) | 816 | void __exit cleanup_module(void) |
817 | { | 817 | { |
818 | int this_dev; | 818 | int this_dev; |
819 | 819 | ||
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 9c588af8ab74..b5410bee5f21 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -1,25 +1,25 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 - 2006 NetXen, Inc. | 2 | * Copyright (C) 2003 - 2006 NetXen, Inc. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
7 | * as published by the Free Software Foundation; either version 2 | 7 | * as published by the Free Software Foundation; either version 2 |
8 | * of the License, or (at your option) any later version. | 8 | * of the License, or (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, but | 10 | * This program is distributed in the hope that it will be useful, but |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
18 | * MA 02111-1307, USA. | 18 | * MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * The full GNU General Public License is included in this distribution | 20 | * The full GNU General Public License is included in this distribution |
21 | * in the file called LICENSE. | 21 | * in the file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * info@netxen.com | 24 | * info@netxen.com |
25 | * NetXen, | 25 | * NetXen, |
@@ -63,40 +63,68 @@ | |||
63 | 63 | ||
64 | #include "netxen_nic_hw.h" | 64 | #include "netxen_nic_hw.h" |
65 | 65 | ||
66 | #define NETXEN_NIC_BUILD_NO "5" | 66 | #define NETXEN_NIC_BUILD_NO "1" |
67 | #define _NETXEN_NIC_LINUX_MAJOR 2 | 67 | #define _NETXEN_NIC_LINUX_MAJOR 3 |
68 | #define _NETXEN_NIC_LINUX_MINOR 3 | 68 | #define _NETXEN_NIC_LINUX_MINOR 3 |
69 | #define _NETXEN_NIC_LINUX_SUBVERSION 59 | 69 | #define _NETXEN_NIC_LINUX_SUBVERSION 2 |
70 | #define NETXEN_NIC_LINUX_VERSIONID "2.3.59" "-" NETXEN_NIC_BUILD_NO | 70 | #define NETXEN_NIC_LINUX_VERSIONID "3.3.2" "-" NETXEN_NIC_BUILD_NO |
71 | #define NETXEN_NIC_FW_VERSIONID "2.3.59" | 71 | #define NETXEN_NIC_FW_VERSIONID "3.3.2" |
72 | 72 | ||
73 | #define RCV_DESC_RINGSIZE \ | 73 | #define RCV_DESC_RINGSIZE \ |
74 | (sizeof(struct rcv_desc) * adapter->max_rx_desc_count) | 74 | (sizeof(struct rcv_desc) * adapter->max_rx_desc_count) |
75 | #define STATUS_DESC_RINGSIZE \ | 75 | #define STATUS_DESC_RINGSIZE \ |
76 | (sizeof(struct status_desc)* adapter->max_rx_desc_count) | 76 | (sizeof(struct status_desc)* adapter->max_rx_desc_count) |
77 | #define LRO_DESC_RINGSIZE \ | ||
78 | (sizeof(rcvDesc_t) * adapter->max_lro_rx_desc_count) | ||
77 | #define TX_RINGSIZE \ | 79 | #define TX_RINGSIZE \ |
78 | (sizeof(struct netxen_cmd_buffer) * adapter->max_tx_desc_count) | 80 | (sizeof(struct netxen_cmd_buffer) * adapter->max_tx_desc_count) |
79 | #define RCV_BUFFSIZE \ | 81 | #define RCV_BUFFSIZE \ |
80 | (sizeof(struct netxen_rx_buffer) * rcv_desc->max_rx_desc_count) | 82 | (sizeof(struct netxen_rx_buffer) * rcv_desc->max_rx_desc_count) |
81 | #define find_diff_among(a,b,range) ((a)<(b)?((b)-(a)):((b)+(range)-(a))) | 83 | #define find_diff_among(a,b,range) ((a)<(b)?((b)-(a)):((b)+(range)-(a))) |
82 | 84 | ||
83 | #define NETXEN_NETDEV_STATUS 0x1 | 85 | #define NETXEN_NETDEV_STATUS 0x1 |
86 | #define NETXEN_RCV_PRODUCER_OFFSET 0 | ||
87 | #define NETXEN_RCV_PEG_DB_ID 2 | ||
88 | #define NETXEN_HOST_DUMMY_DMA_SIZE 1024 | ||
84 | 89 | ||
85 | #define ADDR_IN_WINDOW1(off) \ | 90 | #define ADDR_IN_WINDOW1(off) \ |
86 | ((off > NETXEN_CRB_PCIX_HOST2) && (off < NETXEN_CRB_MAX)) ? 1 : 0 | 91 | ((off > NETXEN_CRB_PCIX_HOST2) && (off < NETXEN_CRB_MAX)) ? 1 : 0 |
92 | /* | ||
93 | * In netxen_nic_down(), we must wait for any pending callback requests into | ||
94 | * netxen_watchdog_task() to complete; eg otherwise the watchdog_timer could be | ||
95 | * reenabled right after it is deleted in netxen_nic_down(). FLUSH_SCHEDULED_WORK() | ||
96 | * does this synchronization. | ||
97 | * | ||
98 | * Normally, schedule_work()/flush_scheduled_work() could have worked, but | ||
99 | * netxen_nic_close() is invoked with kernel rtnl lock held. netif_carrier_off() | ||
100 | * call in netxen_nic_close() triggers a schedule_work(&linkwatch_work), and a | ||
101 | * subsequent call to flush_scheduled_work() in netxen_nic_down() would cause | ||
102 | * linkwatch_event() to be executed which also attempts to acquire the rtnl | ||
103 | * lock thus causing a deadlock. | ||
104 | */ | ||
105 | |||
106 | #define SCHEDULE_WORK(tp) queue_work(netxen_workq, tp) | ||
107 | #define FLUSH_SCHEDULED_WORK() flush_workqueue(netxen_workq) | ||
108 | extern struct workqueue_struct *netxen_workq; | ||
87 | 109 | ||
88 | /* | 110 | /* |
89 | * normalize a 64MB crb address to 32MB PCI window | 111 | * normalize a 64MB crb address to 32MB PCI window |
90 | * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1 | 112 | * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1 |
91 | */ | 113 | */ |
92 | #define NETXEN_CRB_NORMAL(reg) \ | 114 | #define NETXEN_CRB_NORMAL(reg) \ |
93 | (reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST | 115 | ((reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST) |
94 | 116 | ||
95 | #define NETXEN_CRB_NORMALIZE(adapter, reg) \ | 117 | #define NETXEN_CRB_NORMALIZE(adapter, reg) \ |
96 | pci_base_offset(adapter, NETXEN_CRB_NORMAL(reg)) | 118 | pci_base_offset(adapter, NETXEN_CRB_NORMAL(reg)) |
97 | 119 | ||
120 | #define DB_NORMALIZE(adapter, off) \ | ||
121 | (adapter->ahw.db_base + (off)) | ||
122 | |||
123 | #define NX_P2_C0 0x24 | ||
124 | #define NX_P2_C1 0x25 | ||
125 | |||
98 | #define FIRST_PAGE_GROUP_START 0 | 126 | #define FIRST_PAGE_GROUP_START 0 |
99 | #define FIRST_PAGE_GROUP_END 0x400000 | 127 | #define FIRST_PAGE_GROUP_END 0x100000 |
100 | 128 | ||
101 | #define SECOND_PAGE_GROUP_START 0x4000000 | 129 | #define SECOND_PAGE_GROUP_START 0x4000000 |
102 | #define SECOND_PAGE_GROUP_END 0x66BC000 | 130 | #define SECOND_PAGE_GROUP_END 0x66BC000 |
@@ -108,11 +136,13 @@ | |||
108 | #define SECOND_PAGE_GROUP_SIZE SECOND_PAGE_GROUP_END - SECOND_PAGE_GROUP_START | 136 | #define SECOND_PAGE_GROUP_SIZE SECOND_PAGE_GROUP_END - SECOND_PAGE_GROUP_START |
109 | #define THIRD_PAGE_GROUP_SIZE THIRD_PAGE_GROUP_END - THIRD_PAGE_GROUP_START | 137 | #define THIRD_PAGE_GROUP_SIZE THIRD_PAGE_GROUP_END - THIRD_PAGE_GROUP_START |
110 | 138 | ||
111 | #define MAX_RX_BUFFER_LENGTH 2000 | 139 | #define MAX_RX_BUFFER_LENGTH 1760 |
112 | #define MAX_RX_JUMBO_BUFFER_LENGTH 9046 | 140 | #define MAX_RX_JUMBO_BUFFER_LENGTH 9046 |
113 | #define RX_DMA_MAP_LEN (MAX_RX_BUFFER_LENGTH - NET_IP_ALIGN) | 141 | #define MAX_RX_LRO_BUFFER_LENGTH ((48*1024)-512) |
142 | #define RX_DMA_MAP_LEN (MAX_RX_BUFFER_LENGTH - 2) | ||
114 | #define RX_JUMBO_DMA_MAP_LEN \ | 143 | #define RX_JUMBO_DMA_MAP_LEN \ |
115 | (MAX_RX_JUMBO_BUFFER_LENGTH - NET_IP_ALIGN) | 144 | (MAX_RX_JUMBO_BUFFER_LENGTH - 2) |
145 | #define RX_LRO_DMA_MAP_LEN (MAX_RX_LRO_BUFFER_LENGTH - 2) | ||
116 | #define NETXEN_ROM_ROUNDUP 0x80000000ULL | 146 | #define NETXEN_ROM_ROUNDUP 0x80000000ULL |
117 | 147 | ||
118 | /* | 148 | /* |
@@ -151,30 +181,38 @@ enum { | |||
151 | /* Host writes the following to notify that it has done the init-handshake */ | 181 | /* Host writes the following to notify that it has done the init-handshake */ |
152 | #define PHAN_INITIALIZE_ACK 0xf00f | 182 | #define PHAN_INITIALIZE_ACK 0xf00f |
153 | 183 | ||
154 | #define NUM_RCV_DESC_RINGS 2 /* No of Rcv Descriptor contexts */ | 184 | #define NUM_RCV_DESC_RINGS 3 /* No of Rcv Descriptor contexts */ |
155 | 185 | ||
156 | /* descriptor types */ | 186 | /* descriptor types */ |
157 | #define RCV_DESC_NORMAL 0x01 | 187 | #define RCV_DESC_NORMAL 0x01 |
158 | #define RCV_DESC_JUMBO 0x02 | 188 | #define RCV_DESC_JUMBO 0x02 |
189 | #define RCV_DESC_LRO 0x04 | ||
159 | #define RCV_DESC_NORMAL_CTXID 0 | 190 | #define RCV_DESC_NORMAL_CTXID 0 |
160 | #define RCV_DESC_JUMBO_CTXID 1 | 191 | #define RCV_DESC_JUMBO_CTXID 1 |
192 | #define RCV_DESC_LRO_CTXID 2 | ||
161 | 193 | ||
162 | #define RCV_DESC_TYPE(ID) \ | 194 | #define RCV_DESC_TYPE(ID) \ |
163 | ((ID == RCV_DESC_JUMBO_CTXID) ? RCV_DESC_JUMBO : RCV_DESC_NORMAL) | 195 | ((ID == RCV_DESC_JUMBO_CTXID) \ |
196 | ? RCV_DESC_JUMBO \ | ||
197 | : ((ID == RCV_DESC_LRO_CTXID) \ | ||
198 | ? RCV_DESC_LRO : \ | ||
199 | (RCV_DESC_NORMAL))) | ||
164 | 200 | ||
165 | #define MAX_CMD_DESCRIPTORS 1024 | 201 | #define MAX_CMD_DESCRIPTORS 1024 |
166 | #define MAX_RCV_DESCRIPTORS 32768 | 202 | #define MAX_RCV_DESCRIPTORS 32768 |
167 | #define MAX_JUMBO_RCV_DESCRIPTORS 1024 | 203 | #define MAX_JUMBO_RCV_DESCRIPTORS 4096 |
204 | #define MAX_LRO_RCV_DESCRIPTORS 2048 | ||
168 | #define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS | 205 | #define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS |
169 | #define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS | 206 | #define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS |
170 | #define MAX_RCV_DESC MAX_RCV_DESCRIPTORS | 207 | #define MAX_RCV_DESC MAX_RCV_DESCRIPTORS |
171 | #define MAX_RCVSTATUS_DESC MAX_RCV_DESCRIPTORS | 208 | #define MAX_RCVSTATUS_DESC MAX_RCV_DESCRIPTORS |
172 | #define NUM_RCV_DESC (MAX_RCV_DESC + MAX_JUMBO_RCV_DESCRIPTORS) | ||
173 | #define MAX_EPG_DESCRIPTORS (MAX_CMD_DESCRIPTORS * 8) | 209 | #define MAX_EPG_DESCRIPTORS (MAX_CMD_DESCRIPTORS * 8) |
174 | 210 | #define NUM_RCV_DESC (MAX_RCV_DESC + MAX_JUMBO_RCV_DESCRIPTORS + \ | |
211 | MAX_LRO_RCV_DESCRIPTORS) | ||
175 | #define MIN_TX_COUNT 4096 | 212 | #define MIN_TX_COUNT 4096 |
176 | #define MIN_RX_COUNT 4096 | 213 | #define MIN_RX_COUNT 4096 |
177 | 214 | #define NETXEN_CTX_SIGNATURE 0xdee0 | |
215 | #define NETXEN_RCV_PRODUCER(ringid) (ringid) | ||
178 | #define MAX_FRAME_SIZE 0x10000 /* 64K MAX size for LSO */ | 216 | #define MAX_FRAME_SIZE 0x10000 /* 64K MAX size for LSO */ |
179 | 217 | ||
180 | #define PHAN_PEG_RCV_INITIALIZED 0xff01 | 218 | #define PHAN_PEG_RCV_INITIALIZED 0xff01 |
@@ -186,6 +224,67 @@ enum { | |||
186 | #define get_index_range(index,length,count) \ | 224 | #define get_index_range(index,length,count) \ |
187 | (((index) + (count)) & ((length) - 1)) | 225 | (((index) + (count)) & ((length) - 1)) |
188 | 226 | ||
227 | #define MPORT_SINGLE_FUNCTION_MODE 0x1111 | ||
228 | |||
229 | extern unsigned long long netxen_dma_mask; | ||
230 | |||
231 | /* | ||
232 | * NetXen host-peg signal message structure | ||
233 | * | ||
234 | * Bit 0-1 : peg_id => 0x2 for tx and 01 for rx | ||
235 | * Bit 2 : priv_id => must be 1 | ||
236 | * Bit 3-17 : count => for doorbell | ||
237 | * Bit 18-27 : ctx_id => Context id | ||
238 | * Bit 28-31 : opcode | ||
239 | */ | ||
240 | |||
241 | typedef u32 netxen_ctx_msg; | ||
242 | |||
243 | #define _netxen_set_bits(config_word, start, bits, val) {\ | ||
244 | unsigned long long mask = (((1ULL << (bits)) - 1) << (start)); \ | ||
245 | unsigned long long value = (val); \ | ||
246 | (config_word) &= ~mask; \ | ||
247 | (config_word) |= (((value) << (start)) & mask); \ | ||
248 | } | ||
249 | |||
250 | #define netxen_set_msg_peg_id(config_word, val) \ | ||
251 | _netxen_set_bits(config_word, 0, 2, val) | ||
252 | #define netxen_set_msg_privid(config_word) \ | ||
253 | set_bit(2, (unsigned long*)&config_word) | ||
254 | #define netxen_set_msg_count(config_word, val) \ | ||
255 | _netxen_set_bits(config_word, 3, 15, val) | ||
256 | #define netxen_set_msg_ctxid(config_word, val) \ | ||
257 | _netxen_set_bits(config_word, 18, 10, val) | ||
258 | #define netxen_set_msg_opcode(config_word, val) \ | ||
259 | _netxen_set_bits(config_word, 28, 4, val) | ||
260 | |||
261 | struct netxen_rcv_context { | ||
262 | u32 rcv_ring_addr_lo; | ||
263 | u32 rcv_ring_addr_hi; | ||
264 | u32 rcv_ring_size; | ||
265 | u32 rsrvd; | ||
266 | }; | ||
267 | |||
268 | struct netxen_ring_ctx { | ||
269 | |||
270 | /* one command ring */ | ||
271 | u64 cmd_consumer_offset; | ||
272 | u32 cmd_ring_addr_lo; | ||
273 | u32 cmd_ring_addr_hi; | ||
274 | u32 cmd_ring_size; | ||
275 | u32 rsrvd; | ||
276 | |||
277 | /* three receive rings */ | ||
278 | struct netxen_rcv_context rcv_ctx[3]; | ||
279 | |||
280 | /* one status ring */ | ||
281 | u32 sts_ring_addr_lo; | ||
282 | u32 sts_ring_addr_hi; | ||
283 | u32 sts_ring_size; | ||
284 | |||
285 | u32 ctx_id; | ||
286 | } __attribute__ ((aligned(64))); | ||
287 | |||
189 | /* | 288 | /* |
190 | * Following data structures describe the descriptors that will be used. | 289 | * Following data structures describe the descriptors that will be used. |
191 | * Added fileds of tcpHdrSize and ipHdrSize, The driver needs to do it only when | 290 | * Added fileds of tcpHdrSize and ipHdrSize, The driver needs to do it only when |
@@ -203,22 +302,32 @@ enum { | |||
203 | #define FLAGS_IPSEC_SA_DELETE 0x08 | 302 | #define FLAGS_IPSEC_SA_DELETE 0x08 |
204 | #define FLAGS_VLAN_TAGGED 0x10 | 303 | #define FLAGS_VLAN_TAGGED 0x10 |
205 | 304 | ||
206 | #define CMD_DESC_TOTAL_LENGTH(cmd_desc) \ | 305 | #define netxen_set_cmd_desc_port(cmd_desc, var) \ |
207 | ((cmd_desc)->length_tcp_hdr & 0x00FFFFFF) | 306 | ((cmd_desc)->port_ctxid |= ((var) & 0x0F)) |
208 | #define CMD_DESC_TCP_HDR_OFFSET(cmd_desc) \ | ||
209 | (((cmd_desc)->length_tcp_hdr >> 24) & 0x0FF) | ||
210 | #define CMD_DESC_PORT(cmd_desc) ((cmd_desc)->port_ctxid & 0x0F) | ||
211 | #define CMD_DESC_CTX_ID(cmd_desc) (((cmd_desc)->port_ctxid >> 4) & 0x0F) | ||
212 | 307 | ||
213 | #define CMD_DESC_TOTAL_LENGTH_WRT(cmd_desc, var) \ | 308 | #define netxen_set_cmd_desc_flags(cmd_desc, val) \ |
214 | ((cmd_desc)->length_tcp_hdr |= ((var) & 0x00FFFFFF)) | 309 | _netxen_set_bits((cmd_desc)->flags_opcode, 0, 7, val) |
215 | #define CMD_DESC_TCP_HDR_OFFSET_WRT(cmd_desc, var) \ | 310 | #define netxen_set_cmd_desc_opcode(cmd_desc, val) \ |
216 | ((cmd_desc)->length_tcp_hdr |= (((var) << 24) & 0xFF000000)) | 311 | _netxen_set_bits((cmd_desc)->flags_opcode, 7, 6, val) |
217 | #define CMD_DESC_PORT_WRT(cmd_desc, var) \ | 312 | |
218 | ((cmd_desc)->port_ctxid |= ((var) & 0x0F)) | 313 | #define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ |
314 | _netxen_set_bits((cmd_desc)->num_of_buffers_total_length, 0, 8, val); | ||
315 | #define netxen_set_cmd_desc_totallength(cmd_desc, val) \ | ||
316 | _netxen_set_bits((cmd_desc)->num_of_buffers_total_length, 8, 24, val); | ||
317 | |||
318 | #define netxen_get_cmd_desc_opcode(cmd_desc) \ | ||
319 | (((cmd_desc)->flags_opcode >> 7) & 0x003F) | ||
320 | #define netxen_get_cmd_desc_totallength(cmd_desc) \ | ||
321 | (((cmd_desc)->num_of_buffers_total_length >> 8) & 0x0FFFFFF) | ||
219 | 322 | ||
220 | struct cmd_desc_type0 { | 323 | struct cmd_desc_type0 { |
221 | u64 netxen_next; /* for fragments handled by Phantom */ | 324 | u8 tcp_hdr_offset; /* For LSO only */ |
325 | u8 ip_hdr_offset; /* For LSO only */ | ||
326 | /* Bit pattern: 0-6 flags, 7-12 opcode, 13-15 unused */ | ||
327 | u16 flags_opcode; | ||
328 | /* Bit pattern: 0-7 total number of segments, | ||
329 | 8-31 Total size of the packet */ | ||
330 | u32 num_of_buffers_total_length; | ||
222 | union { | 331 | union { |
223 | struct { | 332 | struct { |
224 | u32 addr_low_part2; | 333 | u32 addr_low_part2; |
@@ -227,13 +336,6 @@ struct cmd_desc_type0 { | |||
227 | u64 addr_buffer2; | 336 | u64 addr_buffer2; |
228 | }; | 337 | }; |
229 | 338 | ||
230 | /* Bit pattern: 0-23 total length, 24-32 tcp header offset */ | ||
231 | u32 length_tcp_hdr; | ||
232 | u8 ip_hdr_offset; /* For LSO only */ | ||
233 | u8 num_of_buffers; /* total number of segments */ | ||
234 | u8 flags; /* as defined above */ | ||
235 | u8 opcode; | ||
236 | |||
237 | u16 reference_handle; /* changed to u16 to add mss */ | 339 | u16 reference_handle; /* changed to u16 to add mss */ |
238 | u16 mss; /* passed by NDIS_PACKET for LSO */ | 340 | u16 mss; /* passed by NDIS_PACKET for LSO */ |
239 | /* Bit pattern 0-3 port, 0-3 ctx id */ | 341 | /* Bit pattern 0-3 port, 0-3 ctx id */ |
@@ -248,7 +350,6 @@ struct cmd_desc_type0 { | |||
248 | }; | 350 | }; |
249 | u64 addr_buffer3; | 351 | u64 addr_buffer3; |
250 | }; | 352 | }; |
251 | |||
252 | union { | 353 | union { |
253 | struct { | 354 | struct { |
254 | u32 addr_low_part1; | 355 | u32 addr_low_part1; |
@@ -270,6 +371,8 @@ struct cmd_desc_type0 { | |||
270 | u64 addr_buffer4; | 371 | u64 addr_buffer4; |
271 | }; | 372 | }; |
272 | 373 | ||
374 | u64 unused; | ||
375 | |||
273 | } __attribute__ ((aligned(64))); | 376 | } __attribute__ ((aligned(64))); |
274 | 377 | ||
275 | /* Note: sizeof(rcv_desc) should always be a mutliple of 2 */ | 378 | /* Note: sizeof(rcv_desc) should always be a mutliple of 2 */ |
@@ -296,22 +399,49 @@ struct rcv_desc { | |||
296 | #define NETXEN_PROT_UNKNOWN (0) | 399 | #define NETXEN_PROT_UNKNOWN (0) |
297 | 400 | ||
298 | /* Note: sizeof(status_desc) should always be a mutliple of 2 */ | 401 | /* Note: sizeof(status_desc) should always be a mutliple of 2 */ |
299 | #define STATUS_DESC_PORT(status_desc) \ | 402 | |
300 | ((status_desc)->port_status_type_op & 0x0F) | 403 | #define netxen_get_sts_desc_lro_cnt(status_desc) \ |
301 | #define STATUS_DESC_STATUS(status_desc) \ | 404 | ((status_desc)->lro & 0x7F) |
302 | (((status_desc)->port_status_type_op >> 4) & 0x0F) | 405 | #define netxen_get_sts_desc_lro_last_frag(status_desc) \ |
303 | #define STATUS_DESC_TYPE(status_desc) \ | 406 | (((status_desc)->lro & 0x80) >> 7) |
304 | (((status_desc)->port_status_type_op >> 8) & 0x0F) | 407 | |
305 | #define STATUS_DESC_OPCODE(status_desc) \ | 408 | #define netxen_get_sts_port(status_desc) \ |
306 | (((status_desc)->port_status_type_op >> 12) & 0x0F) | 409 | ((status_desc)->status_desc_data & 0x0F) |
410 | #define netxen_get_sts_status(status_desc) \ | ||
411 | (((status_desc)->status_desc_data >> 4) & 0x0F) | ||
412 | #define netxen_get_sts_type(status_desc) \ | ||
413 | (((status_desc)->status_desc_data >> 8) & 0x0F) | ||
414 | #define netxen_get_sts_totallength(status_desc) \ | ||
415 | (((status_desc)->status_desc_data >> 12) & 0xFFFF) | ||
416 | #define netxen_get_sts_refhandle(status_desc) \ | ||
417 | (((status_desc)->status_desc_data >> 28) & 0xFFFF) | ||
418 | #define netxen_get_sts_prot(status_desc) \ | ||
419 | (((status_desc)->status_desc_data >> 44) & 0x0F) | ||
420 | #define netxen_get_sts_owner(status_desc) \ | ||
421 | (((status_desc)->status_desc_data >> 56) & 0x03) | ||
422 | #define netxen_get_sts_opcode(status_desc) \ | ||
423 | (((status_desc)->status_desc_data >> 58) & 0x03F) | ||
424 | |||
425 | #define netxen_clear_sts_owner(status_desc) \ | ||
426 | ((status_desc)->status_desc_data &= \ | ||
427 | ~(((unsigned long long)3) << 56 )) | ||
428 | #define netxen_set_sts_owner(status_desc, val) \ | ||
429 | ((status_desc)->status_desc_data |= \ | ||
430 | (((unsigned long long)((val) & 0x3)) << 56 )) | ||
307 | 431 | ||
308 | struct status_desc { | 432 | struct status_desc { |
309 | /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-15 opcode */ | 433 | /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length |
310 | u16 port_status_type_op; | 434 | 28-43 reference_handle, 44-47 protocol, 48-52 unused |
311 | u16 total_length; /* NIC mode */ | 435 | 53-55 desc_cnt, 56-57 owner, 58-63 opcode |
312 | u16 reference_handle; /* handle for the associated packet */ | 436 | */ |
313 | /* Bit pattern: 0-1 owner, 2-5 protocol */ | 437 | u64 status_desc_data; |
314 | u16 owner; /* Owner of the descriptor */ | 438 | u32 hash_value; |
439 | u8 hash_type; | ||
440 | u8 msg_type; | ||
441 | u8 unused; | ||
442 | /* Bit pattern: 0-6 lro_count indicates frag sequence, | ||
443 | 7 last_frag indicates last frag */ | ||
444 | u8 lro; | ||
315 | } __attribute__ ((aligned(8))); | 445 | } __attribute__ ((aligned(8))); |
316 | 446 | ||
317 | enum { | 447 | enum { |
@@ -559,11 +689,12 @@ typedef enum { | |||
559 | #define PRIMARY_START (BOOTLD_START) | 689 | #define PRIMARY_START (BOOTLD_START) |
560 | #define FLASH_CRBINIT_SIZE (0x4000) | 690 | #define FLASH_CRBINIT_SIZE (0x4000) |
561 | #define FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info)) | 691 | #define FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info)) |
562 | #define FLASH_USER_SIZE (sizeof(netxen_user_info)/sizeof(u32)) | 692 | #define FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32)) |
563 | #define FLASH_SECONDARY_SIZE (USER_START-SECONDARY_START) | 693 | #define FLASH_SECONDARY_SIZE (USER_START-SECONDARY_START) |
564 | #define NUM_PRIMARY_SECTORS (0x20) | 694 | #define NUM_PRIMARY_SECTORS (0x20) |
565 | #define NUM_CONFIG_SECTORS (1) | 695 | #define NUM_CONFIG_SECTORS (1) |
566 | #define PFX "netxen: " | 696 | #define PFX "NetXen: " |
697 | extern char netxen_nic_driver_name[]; | ||
567 | 698 | ||
568 | /* Note: Make sure to not call this before adapter->port is valid */ | 699 | /* Note: Make sure to not call this before adapter->port is valid */ |
569 | #if !defined(NETXEN_DEBUG) | 700 | #if !defined(NETXEN_DEBUG) |
@@ -572,7 +703,7 @@ typedef enum { | |||
572 | #else | 703 | #else |
573 | #define DPRINTK(klevel, fmt, args...) do { \ | 704 | #define DPRINTK(klevel, fmt, args...) do { \ |
574 | printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\ | 705 | printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\ |
575 | (adapter != NULL && adapter->port != NULL && \ | 706 | (adapter != NULL && \ |
576 | adapter->port[0] != NULL && \ | 707 | adapter->port[0] != NULL && \ |
577 | adapter->port[0]->netdev != NULL) ? \ | 708 | adapter->port[0]->netdev != NULL) ? \ |
578 | adapter->port[0]->netdev->name : NULL, \ | 709 | adapter->port[0]->netdev->name : NULL, \ |
@@ -609,7 +740,6 @@ struct netxen_cmd_buffer { | |||
609 | u8 frag_count; | 740 | u8 frag_count; |
610 | unsigned long time_stamp; | 741 | unsigned long time_stamp; |
611 | u32 state; | 742 | u32 state; |
612 | u32 no_of_descriptors; | ||
613 | }; | 743 | }; |
614 | 744 | ||
615 | /* In rx_buffer, we do not need multiple fragments as is a single buffer */ | 745 | /* In rx_buffer, we do not need multiple fragments as is a single buffer */ |
@@ -618,6 +748,9 @@ struct netxen_rx_buffer { | |||
618 | u64 dma; | 748 | u64 dma; |
619 | u16 ref_handle; | 749 | u16 ref_handle; |
620 | u16 state; | 750 | u16 state; |
751 | u32 lro_expected_frags; | ||
752 | u32 lro_current_frags; | ||
753 | u32 lro_length; | ||
621 | }; | 754 | }; |
622 | 755 | ||
623 | /* Board types */ | 756 | /* Board types */ |
@@ -633,6 +766,8 @@ struct netxen_hardware_context { | |||
633 | void __iomem *pci_base0; | 766 | void __iomem *pci_base0; |
634 | void __iomem *pci_base1; | 767 | void __iomem *pci_base1; |
635 | void __iomem *pci_base2; | 768 | void __iomem *pci_base2; |
769 | void __iomem *db_base; | ||
770 | unsigned long db_len; | ||
636 | 771 | ||
637 | u8 revision_id; | 772 | u8 revision_id; |
638 | u16 board_type; | 773 | u16 board_type; |
@@ -642,14 +777,13 @@ struct netxen_hardware_context { | |||
642 | u32 qg_linksup; | 777 | u32 qg_linksup; |
643 | /* Address of cmd ring in Phantom */ | 778 | /* Address of cmd ring in Phantom */ |
644 | struct cmd_desc_type0 *cmd_desc_head; | 779 | struct cmd_desc_type0 *cmd_desc_head; |
645 | char *pauseaddr; | ||
646 | struct pci_dev *cmd_desc_pdev; | 780 | struct pci_dev *cmd_desc_pdev; |
647 | dma_addr_t cmd_desc_phys_addr; | 781 | dma_addr_t cmd_desc_phys_addr; |
648 | dma_addr_t pause_physaddr; | ||
649 | struct pci_dev *pause_pdev; | ||
650 | struct netxen_adapter *adapter; | 782 | struct netxen_adapter *adapter; |
651 | }; | 783 | }; |
652 | 784 | ||
785 | #define RCV_RING_LRO RCV_DESC_LRO | ||
786 | |||
653 | #define MINIMUM_ETHERNET_FRAME_SIZE 64 /* With FCS */ | 787 | #define MINIMUM_ETHERNET_FRAME_SIZE 64 /* With FCS */ |
654 | #define ETHERNET_FCS_SIZE 4 | 788 | #define ETHERNET_FCS_SIZE 4 |
655 | 789 | ||
@@ -702,8 +836,13 @@ struct netxen_recv_context { | |||
702 | }; | 836 | }; |
703 | 837 | ||
704 | #define NETXEN_NIC_MSI_ENABLED 0x02 | 838 | #define NETXEN_NIC_MSI_ENABLED 0x02 |
839 | #define NETXEN_DMA_MASK 0xfffffffe | ||
840 | #define NETXEN_DB_MAPSIZE_BYTES 0x1000 | ||
705 | 841 | ||
706 | struct netxen_drvops; | 842 | struct netxen_dummy_dma { |
843 | void *addr; | ||
844 | dma_addr_t phys_addr; | ||
845 | }; | ||
707 | 846 | ||
708 | struct netxen_adapter { | 847 | struct netxen_adapter { |
709 | struct netxen_hardware_context ahw; | 848 | struct netxen_hardware_context ahw; |
@@ -720,12 +859,13 @@ struct netxen_adapter { | |||
720 | u32 curr_window; | 859 | u32 curr_window; |
721 | 860 | ||
722 | u32 cmd_producer; | 861 | u32 cmd_producer; |
723 | u32 cmd_consumer; | 862 | u32 *cmd_consumer; |
724 | 863 | ||
725 | u32 last_cmd_consumer; | 864 | u32 last_cmd_consumer; |
726 | u32 max_tx_desc_count; | 865 | u32 max_tx_desc_count; |
727 | u32 max_rx_desc_count; | 866 | u32 max_rx_desc_count; |
728 | u32 max_jumbo_rx_desc_count; | 867 | u32 max_jumbo_rx_desc_count; |
868 | u32 max_lro_rx_desc_count; | ||
729 | /* Num of instances active on cmd buffer ring */ | 869 | /* Num of instances active on cmd buffer ring */ |
730 | u32 proc_cmd_buf_counter; | 870 | u32 proc_cmd_buf_counter; |
731 | 871 | ||
@@ -747,8 +887,27 @@ struct netxen_adapter { | |||
747 | struct netxen_recv_context recv_ctx[MAX_RCV_CTX]; | 887 | struct netxen_recv_context recv_ctx[MAX_RCV_CTX]; |
748 | 888 | ||
749 | int is_up; | 889 | int is_up; |
750 | int work_done; | 890 | int number; |
751 | struct netxen_drvops *ops; | 891 | struct netxen_dummy_dma dummy_dma; |
892 | |||
893 | /* Context interface shared between card and host */ | ||
894 | struct netxen_ring_ctx *ctx_desc; | ||
895 | struct pci_dev *ctx_desc_pdev; | ||
896 | dma_addr_t ctx_desc_phys_addr; | ||
897 | int (*enable_phy_interrupts) (struct netxen_adapter *, int); | ||
898 | int (*disable_phy_interrupts) (struct netxen_adapter *, int); | ||
899 | void (*handle_phy_intr) (struct netxen_adapter *); | ||
900 | int (*macaddr_set) (struct netxen_port *, netxen_ethernet_macaddr_t); | ||
901 | int (*set_mtu) (struct netxen_port *, int); | ||
902 | int (*set_promisc) (struct netxen_adapter *, int, | ||
903 | netxen_niu_prom_mode_t); | ||
904 | int (*unset_promisc) (struct netxen_adapter *, int, | ||
905 | netxen_niu_prom_mode_t); | ||
906 | int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *); | ||
907 | int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val); | ||
908 | int (*init_port) (struct netxen_adapter *, int); | ||
909 | void (*init_niu) (struct netxen_adapter *); | ||
910 | int (*stop_port) (struct netxen_adapter *, int); | ||
752 | }; /* netxen_adapter structure */ | 911 | }; /* netxen_adapter structure */ |
753 | 912 | ||
754 | /* Max number of xmit producer threads that can run simultaneously */ | 913 | /* Max number of xmit producer threads that can run simultaneously */ |
@@ -830,25 +989,6 @@ static inline void __iomem *pci_base(struct netxen_adapter *adapter, | |||
830 | return NULL; | 989 | return NULL; |
831 | } | 990 | } |
832 | 991 | ||
833 | struct netxen_drvops { | ||
834 | int (*enable_phy_interrupts) (struct netxen_adapter *, int); | ||
835 | int (*disable_phy_interrupts) (struct netxen_adapter *, int); | ||
836 | void (*handle_phy_intr) (struct netxen_adapter *); | ||
837 | int (*macaddr_set) (struct netxen_port *, netxen_ethernet_macaddr_t); | ||
838 | int (*set_mtu) (struct netxen_port *, int); | ||
839 | int (*set_promisc) (struct netxen_adapter *, int, | ||
840 | netxen_niu_prom_mode_t); | ||
841 | int (*unset_promisc) (struct netxen_adapter *, int, | ||
842 | netxen_niu_prom_mode_t); | ||
843 | int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *); | ||
844 | int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val); | ||
845 | int (*init_port) (struct netxen_adapter *, int); | ||
846 | void (*init_niu) (struct netxen_adapter *); | ||
847 | int (*stop_port) (struct netxen_adapter *, int); | ||
848 | }; | ||
849 | |||
850 | extern char netxen_nic_driver_name[]; | ||
851 | |||
852 | int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter, | 992 | int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter, |
853 | int port); | 993 | int port); |
854 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter, | 994 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter, |
@@ -887,10 +1027,20 @@ int netxen_nic_hw_read_wx(struct netxen_adapter *adapter, u64 off, void *data, | |||
887 | int len); | 1027 | int len); |
888 | int netxen_nic_hw_write_wx(struct netxen_adapter *adapter, u64 off, void *data, | 1028 | int netxen_nic_hw_write_wx(struct netxen_adapter *adapter, u64 off, void *data, |
889 | int len); | 1029 | int len); |
1030 | int netxen_nic_hw_read_ioctl(struct netxen_adapter *adapter, u64 off, | ||
1031 | void *data, int len); | ||
1032 | int netxen_nic_hw_write_ioctl(struct netxen_adapter *adapter, u64 off, | ||
1033 | void *data, int len); | ||
1034 | int netxen_nic_pci_mem_write_ioctl(struct netxen_adapter *adapter, | ||
1035 | u64 off, void *data, int size); | ||
1036 | int netxen_nic_pci_mem_read_ioctl(struct netxen_adapter *adapter, | ||
1037 | u64 off, void *data, int size); | ||
890 | void netxen_crb_writelit_adapter(struct netxen_adapter *adapter, | 1038 | void netxen_crb_writelit_adapter(struct netxen_adapter *adapter, |
891 | unsigned long off, int data); | 1039 | unsigned long off, int data); |
892 | 1040 | ||
893 | /* Functions from netxen_nic_init.c */ | 1041 | /* Functions from netxen_nic_init.c */ |
1042 | void netxen_free_adapter_offload(struct netxen_adapter *adapter); | ||
1043 | int netxen_initialize_adapter_offload(struct netxen_adapter *adapter); | ||
894 | void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); | 1044 | void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); |
895 | void netxen_load_firmware(struct netxen_adapter *adapter); | 1045 | void netxen_load_firmware(struct netxen_adapter *adapter); |
896 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); | 1046 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); |
@@ -925,7 +1075,9 @@ int netxen_nic_tx_has_work(struct netxen_adapter *adapter); | |||
925 | void netxen_watchdog_task(struct work_struct *work); | 1075 | void netxen_watchdog_task(struct work_struct *work); |
926 | void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, | 1076 | void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, |
927 | u32 ringid); | 1077 | u32 ringid); |
928 | void netxen_process_cmd_ring(unsigned long data); | 1078 | void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, u32 ctx, |
1079 | u32 ringid); | ||
1080 | int netxen_process_cmd_ring(unsigned long data); | ||
929 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); | 1081 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); |
930 | void netxen_nic_set_multi(struct net_device *netdev); | 1082 | void netxen_nic_set_multi(struct net_device *netdev); |
931 | int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); | 1083 | int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); |
@@ -1019,7 +1171,6 @@ static inline void get_brd_name_by_type(u32 type, char *name) | |||
1019 | 1171 | ||
1020 | int netxen_is_flash_supported(struct netxen_adapter *adapter); | 1172 | int netxen_is_flash_supported(struct netxen_adapter *adapter); |
1021 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]); | 1173 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]); |
1022 | |||
1023 | extern void netxen_change_ringparam(struct netxen_adapter *adapter); | 1174 | extern void netxen_change_ringparam(struct netxen_adapter *adapter); |
1024 | extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, | 1175 | extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, |
1025 | int *valp); | 1176 | int *valp); |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 9a914aeba5bc..2ab4885cc950 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 - 2006 NetXen, Inc. | 2 | * Copyright (C) 2003 - 2006 NetXen, Inc. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
7 | * as published by the Free Software Foundation; either version 2 | 7 | * as published by the Free Software Foundation; either version 2 |
8 | * of the License, or (at your option) any later version. | 8 | * of the License, or (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, but | 10 | * This program is distributed in the hope that it will be useful, but |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
18 | * MA 02111-1307, USA. | 18 | * MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * The full GNU General Public License is included in this distribution | 20 | * The full GNU General Public License is included in this distribution |
21 | * in the file called LICENSE. | 21 | * in the file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * info@netxen.com | 24 | * info@netxen.com |
25 | * NetXen, | 25 | * NetXen, |
@@ -118,7 +118,7 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) | |||
118 | u32 fw_minor = 0; | 118 | u32 fw_minor = 0; |
119 | u32 fw_build = 0; | 119 | u32 fw_build = 0; |
120 | 120 | ||
121 | strncpy(drvinfo->driver, "netxen_nic", 32); | 121 | strncpy(drvinfo->driver, netxen_nic_driver_name, 32); |
122 | strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32); | 122 | strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32); |
123 | fw_major = readl(NETXEN_CRB_NORMALIZE(adapter, | 123 | fw_major = readl(NETXEN_CRB_NORMALIZE(adapter, |
124 | NETXEN_FW_VERSION_MAJOR)); | 124 | NETXEN_FW_VERSION_MAJOR)); |
@@ -210,7 +210,6 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
210 | printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", | 210 | printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", |
211 | (netxen_brdtype_t) boardinfo->board_type); | 211 | (netxen_brdtype_t) boardinfo->board_type); |
212 | return -EIO; | 212 | return -EIO; |
213 | |||
214 | } | 213 | } |
215 | 214 | ||
216 | return 0; | 215 | return 0; |
@@ -226,18 +225,18 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
226 | /* read which mode */ | 225 | /* read which mode */ |
227 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | 226 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { |
228 | /* autonegotiation */ | 227 | /* autonegotiation */ |
229 | if (adapter->ops->phy_write | 228 | if (adapter->phy_write |
230 | && adapter->ops->phy_write(adapter, port->portnum, | 229 | && adapter->phy_write(adapter, port->portnum, |
231 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, | 230 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, |
232 | (__le32) ecmd->autoneg) != 0) | 231 | (__le32) ecmd->autoneg) != 0) |
233 | return -EIO; | 232 | return -EIO; |
234 | else | 233 | else |
235 | port->link_autoneg = ecmd->autoneg; | 234 | port->link_autoneg = ecmd->autoneg; |
236 | 235 | ||
237 | if (adapter->ops->phy_read | 236 | if (adapter->phy_read |
238 | && adapter->ops->phy_read(adapter, port->portnum, | 237 | && adapter->phy_read(adapter, port->portnum, |
239 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 238 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
240 | &status) != 0) | 239 | &status) != 0) |
241 | return -EIO; | 240 | return -EIO; |
242 | 241 | ||
243 | /* speed */ | 242 | /* speed */ |
@@ -257,10 +256,10 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
257 | netxen_clear_phy_duplex(status); | 256 | netxen_clear_phy_duplex(status); |
258 | if (ecmd->duplex == DUPLEX_FULL) | 257 | if (ecmd->duplex == DUPLEX_FULL) |
259 | netxen_set_phy_duplex(status); | 258 | netxen_set_phy_duplex(status); |
260 | if (adapter->ops->phy_write | 259 | if (adapter->phy_write |
261 | && adapter->ops->phy_write(adapter, port->portnum, | 260 | && adapter->phy_write(adapter, port->portnum, |
262 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 261 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
263 | *((int *)&status)) != 0) | 262 | *((int *)&status)) != 0) |
264 | return -EIO; | 263 | return -EIO; |
265 | else { | 264 | else { |
266 | port->link_speed = ecmd->speed; | 265 | port->link_speed = ecmd->speed; |
@@ -422,10 +421,10 @@ static u32 netxen_nic_get_link(struct net_device *dev) | |||
422 | 421 | ||
423 | /* read which mode */ | 422 | /* read which mode */ |
424 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | 423 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { |
425 | if (adapter->ops->phy_read | 424 | if (adapter->phy_read |
426 | && adapter->ops->phy_read(adapter, port->portnum, | 425 | && adapter->phy_read(adapter, port->portnum, |
427 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 426 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
428 | &status) != 0) | 427 | &status) != 0) |
429 | return -EIO; | 428 | return -EIO; |
430 | else | 429 | else |
431 | return (netxen_get_phy_link(status)); | 430 | return (netxen_get_phy_link(status)); |
@@ -460,20 +459,22 @@ netxen_nic_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring) | |||
460 | { | 459 | { |
461 | struct netxen_port *port = netdev_priv(dev); | 460 | struct netxen_port *port = netdev_priv(dev); |
462 | struct netxen_adapter *adapter = port->adapter; | 461 | struct netxen_adapter *adapter = port->adapter; |
463 | int i, j; | 462 | int i; |
464 | 463 | ||
465 | ring->rx_pending = 0; | 464 | ring->rx_pending = 0; |
465 | ring->rx_jumbo_pending = 0; | ||
466 | for (i = 0; i < MAX_RCV_CTX; ++i) { | 466 | for (i = 0; i < MAX_RCV_CTX; ++i) { |
467 | for (j = 0; j < NUM_RCV_DESC_RINGS; j++) | 467 | ring->rx_pending += adapter->recv_ctx[i]. |
468 | ring->rx_pending += | 468 | rcv_desc[RCV_DESC_NORMAL_CTXID].rcv_pending; |
469 | adapter->recv_ctx[i].rcv_desc[j].rcv_pending; | 469 | ring->rx_jumbo_pending += adapter->recv_ctx[i]. |
470 | rcv_desc[RCV_DESC_JUMBO_CTXID].rcv_pending; | ||
470 | } | 471 | } |
471 | 472 | ||
472 | ring->rx_max_pending = adapter->max_rx_desc_count; | 473 | ring->rx_max_pending = adapter->max_rx_desc_count; |
473 | ring->tx_max_pending = adapter->max_tx_desc_count; | 474 | ring->tx_max_pending = adapter->max_tx_desc_count; |
475 | ring->rx_jumbo_max_pending = adapter->max_jumbo_rx_desc_count; | ||
474 | ring->rx_mini_max_pending = 0; | 476 | ring->rx_mini_max_pending = 0; |
475 | ring->rx_mini_pending = 0; | 477 | ring->rx_mini_pending = 0; |
476 | ring->rx_jumbo_max_pending = 0; | ||
477 | ring->rx_jumbo_pending = 0; | 478 | ring->rx_jumbo_pending = 0; |
478 | } | 479 | } |
479 | 480 | ||
@@ -526,10 +527,10 @@ netxen_nic_set_pauseparam(struct net_device *dev, | |||
526 | *(u32 *) (&val)); | 527 | *(u32 *) (&val)); |
527 | /* set autoneg */ | 528 | /* set autoneg */ |
528 | autoneg = pause->autoneg; | 529 | autoneg = pause->autoneg; |
529 | if (adapter->ops->phy_write | 530 | if (adapter->phy_write |
530 | && adapter->ops->phy_write(adapter, port->portnum, | 531 | && adapter->phy_write(adapter, port->portnum, |
531 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, | 532 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, |
532 | (__le32) autoneg) != 0) | 533 | (__le32) autoneg) != 0) |
533 | return -EIO; | 534 | return -EIO; |
534 | else { | 535 | else { |
535 | port->link_autoneg = pause->autoneg; | 536 | port->link_autoneg = pause->autoneg; |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index 72c6ec4ee2a0..fe8b675f9e72 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 - 2006 NetXen, Inc. | 2 | * Copyright (C) 2003 - 2006 NetXen, Inc. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
7 | * as published by the Free Software Foundation; either version 2 | 7 | * as published by the Free Software Foundation; either version 2 |
@@ -16,10 +16,10 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
18 | * MA 02111-1307, USA. | 18 | * MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * The full GNU General Public License is included in this distribution | 20 | * The full GNU General Public License is included in this distribution |
21 | * in the file called LICENSE. | 21 | * in the file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * info@netxen.com | 24 | * info@netxen.com |
25 | * NetXen, | 25 | * NetXen, |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 105c24f0ad4c..9147b6048dfb 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 - 2006 NetXen, Inc. | 2 | * Copyright (C) 2003 - 2006 NetXen, Inc. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
7 | * as published by the Free Software Foundation; either version 2 | 7 | * as published by the Free Software Foundation; either version 2 |
@@ -16,10 +16,10 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
18 | * MA 02111-1307, USA. | 18 | * MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * The full GNU General Public License is included in this distribution | 20 | * The full GNU General Public License is included in this distribution |
21 | * in the file called LICENSE. | 21 | * in the file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * info@netxen.com | 24 | * info@netxen.com |
25 | * NetXen, | 25 | * NetXen, |
@@ -42,7 +42,7 @@ | |||
42 | 42 | ||
43 | #define NETXEN_FLASH_BASE (BOOTLD_START) | 43 | #define NETXEN_FLASH_BASE (BOOTLD_START) |
44 | #define NETXEN_PHANTOM_MEM_BASE (NETXEN_FLASH_BASE) | 44 | #define NETXEN_PHANTOM_MEM_BASE (NETXEN_FLASH_BASE) |
45 | #define NETXEN_MAX_MTU 8000 | 45 | #define NETXEN_MAX_MTU 8000 + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE |
46 | #define NETXEN_MIN_MTU 64 | 46 | #define NETXEN_MIN_MTU 64 |
47 | #define NETXEN_ETH_FCS_SIZE 4 | 47 | #define NETXEN_ETH_FCS_SIZE 4 |
48 | #define NETXEN_ENET_HEADER_SIZE 14 | 48 | #define NETXEN_ENET_HEADER_SIZE 14 |
@@ -81,8 +81,8 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p) | |||
81 | DPRINTK(INFO, "valid ether addr\n"); | 81 | DPRINTK(INFO, "valid ether addr\n"); |
82 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | 82 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); |
83 | 83 | ||
84 | if (adapter->ops->macaddr_set) | 84 | if (adapter->macaddr_set) |
85 | adapter->ops->macaddr_set(port, addr->sa_data); | 85 | adapter->macaddr_set(port, addr->sa_data); |
86 | 86 | ||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
@@ -99,17 +99,17 @@ void netxen_nic_set_multi(struct net_device *netdev) | |||
99 | 99 | ||
100 | mc_ptr = netdev->mc_list; | 100 | mc_ptr = netdev->mc_list; |
101 | if (netdev->flags & IFF_PROMISC) { | 101 | if (netdev->flags & IFF_PROMISC) { |
102 | if (adapter->ops->set_promisc) | 102 | if (adapter->set_promisc) |
103 | adapter->ops->set_promisc(adapter, | 103 | adapter->set_promisc(adapter, |
104 | port->portnum, | 104 | port->portnum, |
105 | NETXEN_NIU_PROMISC_MODE); | 105 | NETXEN_NIU_PROMISC_MODE); |
106 | } else { | 106 | } else { |
107 | if (adapter->ops->unset_promisc && | 107 | if (adapter->unset_promisc && |
108 | adapter->ahw.boardcfg.board_type | 108 | adapter->ahw.boardcfg.board_type |
109 | != NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) | 109 | != NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) |
110 | adapter->ops->unset_promisc(adapter, | 110 | adapter->unset_promisc(adapter, |
111 | port->portnum, | 111 | port->portnum, |
112 | NETXEN_NIU_NON_PROMISC_MODE); | 112 | NETXEN_NIU_NON_PROMISC_MODE); |
113 | } | 113 | } |
114 | if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { | 114 | if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { |
115 | netxen_nic_mcr_set_mode_select(netxen_mac_addr_cntl_data, 0x03); | 115 | netxen_nic_mcr_set_mode_select(netxen_mac_addr_cntl_data, 0x03); |
@@ -160,8 +160,8 @@ int netxen_nic_change_mtu(struct net_device *netdev, int mtu) | |||
160 | return -EINVAL; | 160 | return -EINVAL; |
161 | } | 161 | } |
162 | 162 | ||
163 | if (adapter->ops->set_mtu) | 163 | if (adapter->set_mtu) |
164 | adapter->ops->set_mtu(port, mtu); | 164 | adapter->set_mtu(port, mtu); |
165 | netdev->mtu = mtu; | 165 | netdev->mtu = mtu; |
166 | 166 | ||
167 | return 0; | 167 | return 0; |
@@ -176,22 +176,18 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
176 | struct netxen_hardware_context *hw = &adapter->ahw; | 176 | struct netxen_hardware_context *hw = &adapter->ahw; |
177 | u32 state = 0; | 177 | u32 state = 0; |
178 | void *addr; | 178 | void *addr; |
179 | void *pause_addr; | ||
180 | int loops = 0, err = 0; | 179 | int loops = 0, err = 0; |
181 | int ctx, ring; | 180 | int ctx, ring; |
182 | u32 card_cmdring = 0; | 181 | u32 card_cmdring = 0; |
183 | struct netxen_rcv_desc_crb *rcv_desc_crb = NULL; | ||
184 | struct netxen_recv_context *recv_ctx; | 182 | struct netxen_recv_context *recv_ctx; |
185 | struct netxen_rcv_desc_ctx *rcv_desc; | 183 | struct netxen_rcv_desc_ctx *rcv_desc; |
186 | 184 | ||
187 | DPRINTK(INFO, "crb_base: %lx %lx", NETXEN_PCI_CRBSPACE, | 185 | DPRINTK(INFO, "crb_base: %lx %x", NETXEN_PCI_CRBSPACE, |
188 | PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCI_CRBSPACE)); | 186 | PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCI_CRBSPACE)); |
189 | DPRINTK(INFO, "cam base: %lx %lx", NETXEN_CRB_CAM, | 187 | DPRINTK(INFO, "cam base: %lx %x", NETXEN_CRB_CAM, |
190 | pci_base_offset(adapter, NETXEN_CRB_CAM)); | 188 | pci_base_offset(adapter, NETXEN_CRB_CAM)); |
191 | DPRINTK(INFO, "cam RAM: %lx %lx", NETXEN_CAM_RAM_BASE, | 189 | DPRINTK(INFO, "cam RAM: %lx %x", NETXEN_CAM_RAM_BASE, |
192 | pci_base_offset(adapter, NETXEN_CAM_RAM_BASE)); | 190 | pci_base_offset(adapter, NETXEN_CAM_RAM_BASE)); |
193 | DPRINTK(INFO, "NIC base:%lx %lx\n", NIC_CRB_BASE_PORT1, | ||
194 | pci_base_offset(adapter, NIC_CRB_BASE_PORT1)); | ||
195 | 191 | ||
196 | /* Window 1 call */ | 192 | /* Window 1 call */ |
197 | card_cmdring = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_CMDRING)); | 193 | card_cmdring = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_CMDRING)); |
@@ -226,33 +222,42 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
226 | DPRINTK(INFO, "Recieve Peg ready too. starting stuff\n"); | 222 | DPRINTK(INFO, "Recieve Peg ready too. starting stuff\n"); |
227 | 223 | ||
228 | addr = netxen_alloc(adapter->ahw.pdev, | 224 | addr = netxen_alloc(adapter->ahw.pdev, |
229 | sizeof(struct cmd_desc_type0) * | 225 | sizeof(struct netxen_ring_ctx) + |
230 | adapter->max_tx_desc_count, | 226 | sizeof(uint32_t), |
231 | &hw->cmd_desc_phys_addr, &hw->cmd_desc_pdev); | 227 | (dma_addr_t *) & adapter->ctx_desc_phys_addr, |
228 | &adapter->ctx_desc_pdev); | ||
232 | 229 | ||
230 | printk("ctx_desc_phys_addr: 0x%llx\n", | ||
231 | (u64) adapter->ctx_desc_phys_addr); | ||
233 | if (addr == NULL) { | 232 | if (addr == NULL) { |
234 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); | 233 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); |
235 | return -ENOMEM; | 234 | err = -ENOMEM; |
235 | return err; | ||
236 | } | 236 | } |
237 | memset(addr, 0, sizeof(struct netxen_ring_ctx)); | ||
238 | adapter->ctx_desc = (struct netxen_ring_ctx *)addr; | ||
239 | adapter->ctx_desc->cmd_consumer_offset = adapter->ctx_desc_phys_addr | ||
240 | + sizeof(struct netxen_ring_ctx); | ||
241 | adapter->cmd_consumer = (uint32_t *) (((char *)addr) + | ||
242 | sizeof(struct netxen_ring_ctx)); | ||
243 | |||
244 | addr = pci_alloc_consistent(adapter->ahw.pdev, | ||
245 | sizeof(struct cmd_desc_type0) * | ||
246 | adapter->max_tx_desc_count, | ||
247 | (dma_addr_t *) & hw->cmd_desc_phys_addr); | ||
248 | printk("cmd_desc_phys_addr: 0x%llx\n", (u64) hw->cmd_desc_phys_addr); | ||
237 | 249 | ||
238 | pause_addr = netxen_alloc(adapter->ahw.pdev, 512, | 250 | if (addr == NULL) { |
239 | (dma_addr_t *) & hw->pause_physaddr, | 251 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); |
240 | &hw->pause_pdev); | 252 | netxen_free_hw_resources(adapter); |
241 | if (pause_addr == NULL) { | ||
242 | DPRINTK(1, ERR, "bad return from pci_alloc_consistent\n"); | ||
243 | return -ENOMEM; | 253 | return -ENOMEM; |
244 | } | 254 | } |
245 | 255 | ||
246 | hw->pauseaddr = (char *)pause_addr; | 256 | adapter->ctx_desc->cmd_ring_addr_lo = |
247 | { | 257 | hw->cmd_desc_phys_addr & 0xffffffffUL; |
248 | u64 *ptr = (u64 *) pause_addr; | 258 | adapter->ctx_desc->cmd_ring_addr_hi = |
249 | *ptr++ = NETXEN_NIC_ZERO_PAUSE_ADDR; | 259 | ((u64) hw->cmd_desc_phys_addr >> 32); |
250 | *ptr++ = NETXEN_NIC_ZERO_PAUSE_ADDR; | 260 | adapter->ctx_desc->cmd_ring_size = adapter->max_tx_desc_count; |
251 | *ptr++ = NETXEN_NIC_UNIT_PAUSE_ADDR; | ||
252 | *ptr++ = NETXEN_NIC_ZERO_PAUSE_ADDR; | ||
253 | *ptr++ = NETXEN_NIC_EPG_PAUSE_ADDR1; | ||
254 | *ptr++ = NETXEN_NIC_EPG_PAUSE_ADDR2; | ||
255 | } | ||
256 | 261 | ||
257 | hw->cmd_desc_head = (struct cmd_desc_type0 *)addr; | 262 | hw->cmd_desc_head = (struct cmd_desc_type0 *)addr; |
258 | 263 | ||
@@ -273,6 +278,12 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
273 | return err; | 278 | return err; |
274 | } | 279 | } |
275 | rcv_desc->desc_head = (struct rcv_desc *)addr; | 280 | rcv_desc->desc_head = (struct rcv_desc *)addr; |
281 | adapter->ctx_desc->rcv_ctx[ring].rcv_ring_addr_lo = | ||
282 | rcv_desc->phys_addr & 0xffffffffUL; | ||
283 | adapter->ctx_desc->rcv_ctx[ring].rcv_ring_addr_hi = | ||
284 | ((u64) rcv_desc->phys_addr >> 32); | ||
285 | adapter->ctx_desc->rcv_ctx[ring].rcv_ring_size = | ||
286 | rcv_desc->max_rx_desc_count; | ||
276 | } | 287 | } |
277 | 288 | ||
278 | addr = netxen_alloc(adapter->ahw.pdev, STATUS_DESC_RINGSIZE, | 289 | addr = netxen_alloc(adapter->ahw.pdev, STATUS_DESC_RINGSIZE, |
@@ -286,47 +297,21 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
286 | return err; | 297 | return err; |
287 | } | 298 | } |
288 | recv_ctx->rcv_status_desc_head = (struct status_desc *)addr; | 299 | recv_ctx->rcv_status_desc_head = (struct status_desc *)addr; |
289 | for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) { | 300 | adapter->ctx_desc->sts_ring_addr_lo = |
290 | rcv_desc = &recv_ctx->rcv_desc[ring]; | 301 | recv_ctx->rcv_status_desc_phys_addr & 0xffffffffUL; |
291 | rcv_desc_crb = | 302 | adapter->ctx_desc->sts_ring_addr_hi = |
292 | &recv_crb_registers[ctx].rcv_desc_crb[ring]; | 303 | ((u64) recv_ctx->rcv_status_desc_phys_addr >> 32); |
293 | DPRINTK(INFO, "ring #%d crb global ring reg 0x%x\n", | 304 | adapter->ctx_desc->sts_ring_size = adapter->max_rx_desc_count; |
294 | ring, rcv_desc_crb->crb_globalrcv_ring); | ||
295 | /* Window = 1 */ | ||
296 | writel(lower32(rcv_desc->phys_addr), | ||
297 | NETXEN_CRB_NORMALIZE(adapter, | ||
298 | rcv_desc_crb-> | ||
299 | crb_globalrcv_ring)); | ||
300 | DPRINTK(INFO, "GLOBAL_RCV_RING ctx %d, addr 0x%x" | ||
301 | " val 0x%llx," | ||
302 | " virt %p\n", ctx, | ||
303 | rcv_desc_crb->crb_globalrcv_ring, | ||
304 | (unsigned long long)rcv_desc->phys_addr, | ||
305 | +rcv_desc->desc_head); | ||
306 | } | ||
307 | 305 | ||
308 | /* Window = 1 */ | ||
309 | writel(lower32(recv_ctx->rcv_status_desc_phys_addr), | ||
310 | NETXEN_CRB_NORMALIZE(adapter, | ||
311 | recv_crb_registers[ctx]. | ||
312 | crb_rcvstatus_ring)); | ||
313 | DPRINTK(INFO, "RCVSTATUS_RING, ctx %d, addr 0x%x," | ||
314 | " val 0x%x,virt%p\n", | ||
315 | ctx, | ||
316 | recv_crb_registers[ctx].crb_rcvstatus_ring, | ||
317 | (unsigned long long)recv_ctx->rcv_status_desc_phys_addr, | ||
318 | recv_ctx->rcv_status_desc_head); | ||
319 | } | 306 | } |
320 | /* Window = 1 */ | 307 | /* Window = 1 */ |
321 | writel(lower32(hw->pause_physaddr), | 308 | |
322 | NETXEN_CRB_NORMALIZE(adapter, CRB_PAUSE_ADDR_LO)); | 309 | writel(lower32(adapter->ctx_desc_phys_addr), |
323 | writel(upper32(hw->pause_physaddr), | 310 | NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_ADDR_REG_LO)); |
324 | NETXEN_CRB_NORMALIZE(adapter, CRB_PAUSE_ADDR_HI)); | 311 | writel(upper32(adapter->ctx_desc_phys_addr), |
325 | 312 | NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_ADDR_REG_HI)); | |
326 | writel(lower32(hw->cmd_desc_phys_addr), | 313 | writel(NETXEN_CTX_SIGNATURE, |
327 | NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_CMD_ADDR_LO)); | 314 | NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_SIGNATURE_REG)); |
328 | writel(upper32(hw->cmd_desc_phys_addr), | ||
329 | NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_CMD_ADDR_HI)); | ||
330 | return err; | 315 | return err; |
331 | } | 316 | } |
332 | 317 | ||
@@ -336,6 +321,15 @@ void netxen_free_hw_resources(struct netxen_adapter *adapter) | |||
336 | struct netxen_rcv_desc_ctx *rcv_desc; | 321 | struct netxen_rcv_desc_ctx *rcv_desc; |
337 | int ctx, ring; | 322 | int ctx, ring; |
338 | 323 | ||
324 | if (adapter->ctx_desc != NULL) { | ||
325 | pci_free_consistent(adapter->ctx_desc_pdev, | ||
326 | sizeof(struct netxen_ring_ctx) + | ||
327 | sizeof(uint32_t), | ||
328 | adapter->ctx_desc, | ||
329 | adapter->ctx_desc_phys_addr); | ||
330 | adapter->ctx_desc = NULL; | ||
331 | } | ||
332 | |||
339 | if (adapter->ahw.cmd_desc_head != NULL) { | 333 | if (adapter->ahw.cmd_desc_head != NULL) { |
340 | pci_free_consistent(adapter->ahw.cmd_desc_pdev, | 334 | pci_free_consistent(adapter->ahw.cmd_desc_pdev, |
341 | sizeof(struct cmd_desc_type0) * | 335 | sizeof(struct cmd_desc_type0) * |
@@ -344,11 +338,9 @@ void netxen_free_hw_resources(struct netxen_adapter *adapter) | |||
344 | adapter->ahw.cmd_desc_phys_addr); | 338 | adapter->ahw.cmd_desc_phys_addr); |
345 | adapter->ahw.cmd_desc_head = NULL; | 339 | adapter->ahw.cmd_desc_head = NULL; |
346 | } | 340 | } |
347 | if (adapter->ahw.pauseaddr != NULL) { | 341 | /* Special handling: there are 2 ports on this board */ |
348 | pci_free_consistent(adapter->ahw.pause_pdev, 512, | 342 | if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) { |
349 | adapter->ahw.pauseaddr, | 343 | adapter->ahw.max_ports = 2; |
350 | adapter->ahw.pause_physaddr); | ||
351 | adapter->ahw.pauseaddr = NULL; | ||
352 | } | 344 | } |
353 | 345 | ||
354 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { | 346 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { |
@@ -383,19 +375,22 @@ void netxen_tso_check(struct netxen_adapter *adapter, | |||
383 | desc->total_hdr_length = sizeof(struct ethhdr) + | 375 | desc->total_hdr_length = sizeof(struct ethhdr) + |
384 | ((skb->nh.iph)->ihl * sizeof(u32)) + | 376 | ((skb->nh.iph)->ihl * sizeof(u32)) + |
385 | ((skb->h.th)->doff * sizeof(u32)); | 377 | ((skb->h.th)->doff * sizeof(u32)); |
386 | desc->opcode = TX_TCP_LSO; | 378 | netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); |
387 | } else if (skb->ip_summed == CHECKSUM_COMPLETE) { | 379 | } else if (skb->ip_summed == CHECKSUM_COMPLETE) { |
388 | if (skb->nh.iph->protocol == IPPROTO_TCP) { | 380 | if (skb->nh.iph->protocol == IPPROTO_TCP) { |
389 | desc->opcode = TX_TCP_PKT; | 381 | netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT); |
390 | } else if (skb->nh.iph->protocol == IPPROTO_UDP) { | 382 | } else if (skb->nh.iph->protocol == IPPROTO_UDP) { |
391 | desc->opcode = TX_UDP_PKT; | 383 | netxen_set_cmd_desc_opcode(desc, TX_UDP_PKT); |
392 | } else { | 384 | } else { |
393 | return; | 385 | return; |
394 | } | 386 | } |
395 | } | 387 | } |
396 | adapter->stats.xmitcsummed++; | 388 | adapter->stats.xmitcsummed++; |
397 | CMD_DESC_TCP_HDR_OFFSET_WRT(desc, skb->h.raw - skb->data); | 389 | desc->tcp_hdr_offset = skb->h.raw - skb->data; |
398 | desc->length_tcp_hdr = cpu_to_le32(desc->length_tcp_hdr); | 390 | netxen_set_cmd_desc_totallength(desc, |
391 | cpu_to_le32 | ||
392 | (netxen_get_cmd_desc_totallength | ||
393 | (desc))); | ||
399 | desc->ip_hdr_offset = skb->nh.raw - skb->data; | 394 | desc->ip_hdr_offset = skb->nh.raw - skb->data; |
400 | } | 395 | } |
401 | 396 | ||
@@ -648,7 +643,7 @@ void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val) | |||
648 | 643 | ||
649 | addr = NETXEN_CRB_NORMALIZE(adapter, off); | 644 | addr = NETXEN_CRB_NORMALIZE(adapter, off); |
650 | DPRINTK(INFO, "writing to base %lx offset %llx addr %p data %x\n", | 645 | DPRINTK(INFO, "writing to base %lx offset %llx addr %p data %x\n", |
651 | pci_base(adapter, off), off, addr); | 646 | pci_base(adapter, off), off, addr, val); |
652 | writel(val, addr); | 647 | writel(val, addr); |
653 | 648 | ||
654 | } | 649 | } |
@@ -660,7 +655,7 @@ int netxen_nic_reg_read(struct netxen_adapter *adapter, u64 off) | |||
660 | 655 | ||
661 | addr = NETXEN_CRB_NORMALIZE(adapter, off); | 656 | addr = NETXEN_CRB_NORMALIZE(adapter, off); |
662 | DPRINTK(INFO, "reading from base %lx offset %llx addr %p\n", | 657 | DPRINTK(INFO, "reading from base %lx offset %llx addr %p\n", |
663 | adapter->ahw.pci_base, off, addr); | 658 | pci_base(adapter, off), off, addr); |
664 | val = readl(addr); | 659 | val = readl(addr); |
665 | writel(val, addr); | 660 | writel(val, addr); |
666 | 661 | ||
@@ -848,8 +843,8 @@ void netxen_nic_stop_all_ports(struct netxen_adapter *adapter) | |||
848 | 843 | ||
849 | for (port_nr = 0; port_nr < adapter->ahw.max_ports; port_nr++) { | 844 | for (port_nr = 0; port_nr < adapter->ahw.max_ports; port_nr++) { |
850 | port = adapter->port[port_nr]; | 845 | port = adapter->port[port_nr]; |
851 | if (adapter->ops->stop_port) | 846 | if (adapter->stop_port) |
852 | adapter->ops->stop_port(adapter, port->portnum); | 847 | adapter->stop_port(adapter, port->portnum); |
853 | } | 848 | } |
854 | } | 849 | } |
855 | 850 | ||
@@ -873,13 +868,13 @@ void netxen_nic_set_link_parameters(struct netxen_port *port) | |||
873 | { | 868 | { |
874 | struct netxen_adapter *adapter = port->adapter; | 869 | struct netxen_adapter *adapter = port->adapter; |
875 | __le32 status; | 870 | __le32 status; |
876 | u16 autoneg; | 871 | __le32 autoneg; |
877 | __le32 mode; | 872 | __le32 mode; |
878 | 873 | ||
879 | netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); | 874 | netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); |
880 | if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ | 875 | if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ |
881 | if (adapter->ops->phy_read | 876 | if (adapter->phy_read |
882 | && adapter->ops-> | 877 | && adapter-> |
883 | phy_read(adapter, port->portnum, | 878 | phy_read(adapter, port->portnum, |
884 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 879 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
885 | &status) == 0) { | 880 | &status) == 0) { |
@@ -909,11 +904,11 @@ void netxen_nic_set_link_parameters(struct netxen_port *port) | |||
909 | port->link_duplex = -1; | 904 | port->link_duplex = -1; |
910 | break; | 905 | break; |
911 | } | 906 | } |
912 | if (adapter->ops->phy_read | 907 | if (adapter->phy_read |
913 | && adapter->ops-> | 908 | && adapter-> |
914 | phy_read(adapter, port->portnum, | 909 | phy_read(adapter, port->portnum, |
915 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, | 910 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, |
916 | (__le32 *) & autoneg) != 0) | 911 | &autoneg) != 0) |
917 | port->link_autoneg = autoneg; | 912 | port->link_autoneg = autoneg; |
918 | } else | 913 | } else |
919 | goto link_down; | 914 | goto link_down; |
@@ -1008,3 +1003,291 @@ int netxen_crb_read_val(struct netxen_adapter *adapter, unsigned long off) | |||
1008 | netxen_nic_hw_read_wx(adapter, off, &data, 4); | 1003 | netxen_nic_hw_read_wx(adapter, off, &data, 4); |
1009 | return data; | 1004 | return data; |
1010 | } | 1005 | } |
1006 | |||
1007 | int netxen_nic_hw_write_ioctl(struct netxen_adapter *adapter, u64 off, | ||
1008 | void *data, int len) | ||
1009 | { | ||
1010 | void *addr; | ||
1011 | u64 offset = off; | ||
1012 | u8 *mem_ptr = NULL; | ||
1013 | unsigned long mem_base; | ||
1014 | unsigned long mem_page; | ||
1015 | |||
1016 | if (ADDR_IN_WINDOW1(off)) { | ||
1017 | addr = NETXEN_CRB_NORMALIZE(adapter, off); | ||
1018 | if (!addr) { | ||
1019 | mem_base = pci_resource_start(adapter->ahw.pdev, 0); | ||
1020 | offset = NETXEN_CRB_NORMAL(off); | ||
1021 | mem_page = offset & PAGE_MASK; | ||
1022 | if (mem_page != ((offset + len - 1) & PAGE_MASK)) | ||
1023 | mem_ptr = | ||
1024 | ioremap(mem_base + mem_page, PAGE_SIZE * 2); | ||
1025 | else | ||
1026 | mem_ptr = | ||
1027 | ioremap(mem_base + mem_page, PAGE_SIZE); | ||
1028 | if (mem_ptr == 0UL) { | ||
1029 | return 1; | ||
1030 | } | ||
1031 | addr = mem_ptr; | ||
1032 | addr += offset & (PAGE_SIZE - 1); | ||
1033 | } | ||
1034 | } else { | ||
1035 | addr = pci_base_offset(adapter, off); | ||
1036 | if (!addr) { | ||
1037 | mem_base = pci_resource_start(adapter->ahw.pdev, 0); | ||
1038 | mem_page = off & PAGE_MASK; | ||
1039 | if (mem_page != ((off + len - 1) & PAGE_MASK)) | ||
1040 | mem_ptr = | ||
1041 | ioremap(mem_base + mem_page, PAGE_SIZE * 2); | ||
1042 | else | ||
1043 | mem_ptr = | ||
1044 | ioremap(mem_base + mem_page, PAGE_SIZE); | ||
1045 | if (mem_ptr == 0UL) { | ||
1046 | return 1; | ||
1047 | } | ||
1048 | addr = mem_ptr; | ||
1049 | addr += off & (PAGE_SIZE - 1); | ||
1050 | } | ||
1051 | netxen_nic_pci_change_crbwindow(adapter, 0); | ||
1052 | } | ||
1053 | switch (len) { | ||
1054 | case 1: | ||
1055 | writeb(*(u8 *) data, addr); | ||
1056 | break; | ||
1057 | case 2: | ||
1058 | writew(*(u16 *) data, addr); | ||
1059 | break; | ||
1060 | case 4: | ||
1061 | writel(*(u32 *) data, addr); | ||
1062 | break; | ||
1063 | case 8: | ||
1064 | writeq(*(u64 *) data, addr); | ||
1065 | break; | ||
1066 | default: | ||
1067 | DPRINTK(INFO, | ||
1068 | "writing data %lx to offset %llx, num words=%d\n", | ||
1069 | *(unsigned long *)data, off, (len >> 3)); | ||
1070 | |||
1071 | netxen_nic_hw_block_write64((u64 __iomem *) data, addr, | ||
1072 | (len >> 3)); | ||
1073 | break; | ||
1074 | } | ||
1075 | |||
1076 | if (!ADDR_IN_WINDOW1(off)) | ||
1077 | netxen_nic_pci_change_crbwindow(adapter, 1); | ||
1078 | if (mem_ptr) | ||
1079 | iounmap(mem_ptr); | ||
1080 | return 0; | ||
1081 | } | ||
1082 | |||
1083 | int netxen_nic_hw_read_ioctl(struct netxen_adapter *adapter, u64 off, | ||
1084 | void *data, int len) | ||
1085 | { | ||
1086 | void *addr; | ||
1087 | u64 offset; | ||
1088 | u8 *mem_ptr = NULL; | ||
1089 | unsigned long mem_base; | ||
1090 | unsigned long mem_page; | ||
1091 | |||
1092 | if (ADDR_IN_WINDOW1(off)) { | ||
1093 | addr = NETXEN_CRB_NORMALIZE(adapter, off); | ||
1094 | if (!addr) { | ||
1095 | mem_base = pci_resource_start(adapter->ahw.pdev, 0); | ||
1096 | offset = NETXEN_CRB_NORMAL(off); | ||
1097 | mem_page = offset & PAGE_MASK; | ||
1098 | if (mem_page != ((offset + len - 1) & PAGE_MASK)) | ||
1099 | mem_ptr = | ||
1100 | ioremap(mem_base + mem_page, PAGE_SIZE * 2); | ||
1101 | else | ||
1102 | mem_ptr = | ||
1103 | ioremap(mem_base + mem_page, PAGE_SIZE); | ||
1104 | if (mem_ptr == 0UL) { | ||
1105 | *(u8 *) data = 0; | ||
1106 | return 1; | ||
1107 | } | ||
1108 | addr = mem_ptr; | ||
1109 | addr += offset & (PAGE_SIZE - 1); | ||
1110 | } | ||
1111 | } else { | ||
1112 | addr = pci_base_offset(adapter, off); | ||
1113 | if (!addr) { | ||
1114 | mem_base = pci_resource_start(adapter->ahw.pdev, 0); | ||
1115 | mem_page = off & PAGE_MASK; | ||
1116 | if (mem_page != ((off + len - 1) & PAGE_MASK)) | ||
1117 | mem_ptr = | ||
1118 | ioremap(mem_base + mem_page, PAGE_SIZE * 2); | ||
1119 | else | ||
1120 | mem_ptr = | ||
1121 | ioremap(mem_base + mem_page, PAGE_SIZE); | ||
1122 | if (mem_ptr == 0UL) | ||
1123 | return 1; | ||
1124 | addr = mem_ptr; | ||
1125 | addr += off & (PAGE_SIZE - 1); | ||
1126 | } | ||
1127 | netxen_nic_pci_change_crbwindow(adapter, 0); | ||
1128 | } | ||
1129 | switch (len) { | ||
1130 | case 1: | ||
1131 | *(u8 *) data = readb(addr); | ||
1132 | break; | ||
1133 | case 2: | ||
1134 | *(u16 *) data = readw(addr); | ||
1135 | break; | ||
1136 | case 4: | ||
1137 | *(u32 *) data = readl(addr); | ||
1138 | break; | ||
1139 | case 8: | ||
1140 | *(u64 *) data = readq(addr); | ||
1141 | break; | ||
1142 | default: | ||
1143 | netxen_nic_hw_block_read64((u64 __iomem *) data, addr, | ||
1144 | (len >> 3)); | ||
1145 | break; | ||
1146 | } | ||
1147 | if (!ADDR_IN_WINDOW1(off)) | ||
1148 | netxen_nic_pci_change_crbwindow(adapter, 1); | ||
1149 | if (mem_ptr) | ||
1150 | iounmap(mem_ptr); | ||
1151 | return 0; | ||
1152 | } | ||
1153 | |||
1154 | int netxen_nic_pci_mem_write_ioctl(struct netxen_adapter *adapter, u64 off, | ||
1155 | void *data, int size) | ||
1156 | { | ||
1157 | void *addr; | ||
1158 | int ret = 0; | ||
1159 | u8 *mem_ptr = NULL; | ||
1160 | unsigned long mem_base; | ||
1161 | unsigned long mem_page; | ||
1162 | |||
1163 | if (data == NULL || off > (128 * 1024 * 1024)) { | ||
1164 | printk(KERN_ERR "%s: data: %p off:%llx\n", | ||
1165 | netxen_nic_driver_name, data, off); | ||
1166 | return 1; | ||
1167 | } | ||
1168 | off = netxen_nic_pci_set_window(adapter, off); | ||
1169 | /* Corner case : Malicious user tried to break the driver by reading | ||
1170 | last few bytes in ranges and tries to read further addresses. | ||
1171 | */ | ||
1172 | if (!pci_base(adapter, off + size - 1) && pci_base(adapter, off)) { | ||
1173 | printk(KERN_ERR "%s: Invalid access to memory address range" | ||
1174 | " 0x%llx - 0x%llx\n", netxen_nic_driver_name, off, | ||
1175 | off + size); | ||
1176 | return 1; | ||
1177 | } | ||
1178 | addr = pci_base_offset(adapter, off); | ||
1179 | DPRINTK(INFO, "writing data %llx to offset %llx\n", | ||
1180 | *(unsigned long long *)data, off); | ||
1181 | if (!addr) { | ||
1182 | mem_base = pci_resource_start(adapter->ahw.pdev, 0); | ||
1183 | mem_page = off & PAGE_MASK; | ||
1184 | /* Map two pages whenever user tries to access addresses in two | ||
1185 | consecutive pages. | ||
1186 | */ | ||
1187 | if (mem_page != ((off + size - 1) & PAGE_MASK)) | ||
1188 | mem_ptr = ioremap(mem_base + mem_page, PAGE_SIZE * 2); | ||
1189 | else | ||
1190 | mem_ptr = ioremap(mem_base + mem_page, PAGE_SIZE); | ||
1191 | if (mem_ptr == 0UL) { | ||
1192 | return 1; | ||
1193 | } | ||
1194 | addr = mem_ptr; | ||
1195 | addr += off & (PAGE_SIZE - 1); | ||
1196 | } | ||
1197 | switch (size) { | ||
1198 | case 1: | ||
1199 | writeb(*(u8 *) data, addr); | ||
1200 | break; | ||
1201 | case 2: | ||
1202 | writew(*(u16 *) data, addr); | ||
1203 | break; | ||
1204 | case 4: | ||
1205 | writel(*(u32 *) data, addr); | ||
1206 | break; | ||
1207 | case 8: | ||
1208 | writeq(*(u64 *) data, addr); | ||
1209 | break; | ||
1210 | default: | ||
1211 | DPRINTK(INFO, | ||
1212 | "writing data %lx to offset %llx, num words=%d\n", | ||
1213 | *(unsigned long *)data, off, (size >> 3)); | ||
1214 | |||
1215 | netxen_nic_hw_block_write64((u64 __iomem *) data, addr, | ||
1216 | (size >> 3)); | ||
1217 | break; | ||
1218 | } | ||
1219 | |||
1220 | if (mem_ptr) | ||
1221 | iounmap(mem_ptr); | ||
1222 | DPRINTK(INFO, "wrote %llx\n", *(unsigned long long *)data); | ||
1223 | |||
1224 | return ret; | ||
1225 | } | ||
1226 | |||
1227 | int netxen_nic_pci_mem_read_ioctl(struct netxen_adapter *adapter, | ||
1228 | u64 off, void *data, int size) | ||
1229 | { | ||
1230 | void *addr; | ||
1231 | int ret = 0; | ||
1232 | u8 *mem_ptr = NULL; | ||
1233 | unsigned long mem_base; | ||
1234 | unsigned long mem_page; | ||
1235 | |||
1236 | if (data == NULL || off > (128 * 1024 * 1024)) { | ||
1237 | printk(KERN_ERR "%s: data: %p off:%llx\n", | ||
1238 | netxen_nic_driver_name, data, off); | ||
1239 | return 1; | ||
1240 | } | ||
1241 | off = netxen_nic_pci_set_window(adapter, off); | ||
1242 | /* Corner case : Malicious user tried to break the driver by reading | ||
1243 | last few bytes in ranges and tries to read further addresses. | ||
1244 | */ | ||
1245 | if (!pci_base(adapter, off + size - 1) && pci_base(adapter, off)) { | ||
1246 | printk(KERN_ERR "%s: Invalid access to memory address range" | ||
1247 | " 0x%llx - 0x%llx\n", netxen_nic_driver_name, off, | ||
1248 | off + size); | ||
1249 | return 1; | ||
1250 | } | ||
1251 | addr = pci_base_offset(adapter, off); | ||
1252 | if (!addr) { | ||
1253 | mem_base = pci_resource_start(adapter->ahw.pdev, 0); | ||
1254 | mem_page = off & PAGE_MASK; | ||
1255 | /* Map two pages whenever user tries to access addresses in two | ||
1256 | consecutive pages. | ||
1257 | */ | ||
1258 | if (mem_page != ((off + size - 1) & PAGE_MASK)) | ||
1259 | mem_ptr = ioremap(mem_base + mem_page, PAGE_SIZE * 2); | ||
1260 | else | ||
1261 | mem_ptr = ioremap(mem_base + mem_page, PAGE_SIZE); | ||
1262 | if (mem_ptr == 0UL) { | ||
1263 | *(u8 *) data = 0; | ||
1264 | return 1; | ||
1265 | } | ||
1266 | addr = mem_ptr; | ||
1267 | addr += off & (PAGE_SIZE - 1); | ||
1268 | } | ||
1269 | switch (size) { | ||
1270 | case 1: | ||
1271 | *(u8 *) data = readb(addr); | ||
1272 | break; | ||
1273 | case 2: | ||
1274 | *(u16 *) data = readw(addr); | ||
1275 | break; | ||
1276 | case 4: | ||
1277 | *(u32 *) data = readl(addr); | ||
1278 | break; | ||
1279 | case 8: | ||
1280 | *(u64 *) data = readq(addr); | ||
1281 | break; | ||
1282 | default: | ||
1283 | netxen_nic_hw_block_read64((u64 __iomem *) data, addr, | ||
1284 | (size >> 3)); | ||
1285 | break; | ||
1286 | } | ||
1287 | |||
1288 | if (mem_ptr) | ||
1289 | iounmap(mem_ptr); | ||
1290 | DPRINTK(INFO, "read %llx\n", *(unsigned long long *)data); | ||
1291 | |||
1292 | return ret; | ||
1293 | } | ||
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h index 201a636b7ab8..0685633a9c1e 100644 --- a/drivers/net/netxen/netxen_nic_hw.h +++ b/drivers/net/netxen/netxen_nic_hw.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 - 2006 NetXen, Inc. | 2 | * Copyright (C) 2003 - 2006 NetXen, Inc. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
7 | * as published by the Free Software Foundation; either version 2 | 7 | * as published by the Free Software Foundation; either version 2 |
@@ -16,10 +16,10 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
18 | * MA 02111-1307, USA. | 18 | * MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * The full GNU General Public License is included in this distribution | 20 | * The full GNU General Public License is included in this distribution |
21 | * in the file called LICENSE. | 21 | * in the file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * info@netxen.com | 24 | * info@netxen.com |
25 | * NetXen, | 25 | * NetXen, |
@@ -83,8 +83,8 @@ struct netxen_adapter; | |||
83 | #define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20) | 83 | #define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20) |
84 | 84 | ||
85 | #define NETXEN_NIC_LOCKED_READ_REG(X, Y) \ | 85 | #define NETXEN_NIC_LOCKED_READ_REG(X, Y) \ |
86 | addr = pci_base_offset(adapter, (X)); \ | 86 | addr = pci_base_offset(adapter, X); \ |
87 | *(u32 *)Y = readl(addr); | 87 | *(u32 *)Y = readl((void __iomem*) addr); |
88 | 88 | ||
89 | struct netxen_port; | 89 | struct netxen_port; |
90 | void netxen_nic_set_link_parameters(struct netxen_port *port); | 90 | void netxen_nic_set_link_parameters(struct netxen_port *port); |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index eae18236aefa..869725f0bb18 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 - 2006 NetXen, Inc. | 2 | * Copyright (C) 2003 - 2006 NetXen, Inc. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
7 | * as published by the Free Software Foundation; either version 2 | 7 | * as published by the Free Software Foundation; either version 2 |
8 | * of the License, or (at your option) any later version. | 8 | * of the License, or (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, but | 10 | * This program is distributed in the hope that it will be useful, but |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
18 | * MA 02111-1307, USA. | 18 | * MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * The full GNU General Public License is included in this distribution | 20 | * The full GNU General Public License is included in this distribution |
21 | * in the file called LICENSE. | 21 | * in the file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * info@netxen.com | 24 | * info@netxen.com |
25 | * NetXen, | 25 | * NetXen, |
@@ -137,6 +137,8 @@ int netxen_init_firmware(struct netxen_adapter *adapter) | |||
137 | return err; | 137 | return err; |
138 | } | 138 | } |
139 | /* Window 1 call */ | 139 | /* Window 1 call */ |
140 | writel(MPORT_SINGLE_FUNCTION_MODE, | ||
141 | NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE)); | ||
140 | writel(PHAN_INITIALIZE_ACK, | 142 | writel(PHAN_INITIALIZE_ACK, |
141 | NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | 143 | NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); |
142 | 144 | ||
@@ -184,15 +186,12 @@ void netxen_initialize_adapter_sw(struct netxen_adapter *adapter) | |||
184 | for (i = 0; i < num_rx_bufs; i++) { | 186 | for (i = 0; i < num_rx_bufs; i++) { |
185 | rx_buf->ref_handle = i; | 187 | rx_buf->ref_handle = i; |
186 | rx_buf->state = NETXEN_BUFFER_FREE; | 188 | rx_buf->state = NETXEN_BUFFER_FREE; |
187 | |||
188 | DPRINTK(INFO, "Rx buf:ctx%d i(%d) rx_buf:" | 189 | DPRINTK(INFO, "Rx buf:ctx%d i(%d) rx_buf:" |
189 | "%p\n", ctxid, i, rx_buf); | 190 | "%p\n", ctxid, i, rx_buf); |
190 | rx_buf++; | 191 | rx_buf++; |
191 | } | 192 | } |
192 | } | 193 | } |
193 | } | 194 | } |
194 | DPRINTK(INFO, "initialized buffers for %s and %s\n", | ||
195 | "adapter->free_cmd_buf_list", "adapter->free_rxbuf"); | ||
196 | } | 195 | } |
197 | 196 | ||
198 | void netxen_initialize_adapter_hw(struct netxen_adapter *adapter) | 197 | void netxen_initialize_adapter_hw(struct netxen_adapter *adapter) |
@@ -212,37 +211,36 @@ void netxen_initialize_adapter_hw(struct netxen_adapter *adapter) | |||
212 | 211 | ||
213 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) | 212 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) |
214 | { | 213 | { |
215 | struct netxen_drvops *ops = adapter->ops; | ||
216 | switch (adapter->ahw.board_type) { | 214 | switch (adapter->ahw.board_type) { |
217 | case NETXEN_NIC_GBE: | 215 | case NETXEN_NIC_GBE: |
218 | ops->enable_phy_interrupts = | 216 | adapter->enable_phy_interrupts = |
219 | netxen_niu_gbe_enable_phy_interrupts; | 217 | netxen_niu_gbe_enable_phy_interrupts; |
220 | ops->disable_phy_interrupts = | 218 | adapter->disable_phy_interrupts = |
221 | netxen_niu_gbe_disable_phy_interrupts; | 219 | netxen_niu_gbe_disable_phy_interrupts; |
222 | ops->handle_phy_intr = netxen_nic_gbe_handle_phy_intr; | 220 | adapter->handle_phy_intr = netxen_nic_gbe_handle_phy_intr; |
223 | ops->macaddr_set = netxen_niu_macaddr_set; | 221 | adapter->macaddr_set = netxen_niu_macaddr_set; |
224 | ops->set_mtu = netxen_nic_set_mtu_gb; | 222 | adapter->set_mtu = netxen_nic_set_mtu_gb; |
225 | ops->set_promisc = netxen_niu_set_promiscuous_mode; | 223 | adapter->set_promisc = netxen_niu_set_promiscuous_mode; |
226 | ops->unset_promisc = netxen_niu_set_promiscuous_mode; | 224 | adapter->unset_promisc = netxen_niu_set_promiscuous_mode; |
227 | ops->phy_read = netxen_niu_gbe_phy_read; | 225 | adapter->phy_read = netxen_niu_gbe_phy_read; |
228 | ops->phy_write = netxen_niu_gbe_phy_write; | 226 | adapter->phy_write = netxen_niu_gbe_phy_write; |
229 | ops->init_port = netxen_niu_gbe_init_port; | 227 | adapter->init_port = netxen_niu_gbe_init_port; |
230 | ops->init_niu = netxen_nic_init_niu_gb; | 228 | adapter->init_niu = netxen_nic_init_niu_gb; |
231 | ops->stop_port = netxen_niu_disable_gbe_port; | 229 | adapter->stop_port = netxen_niu_disable_gbe_port; |
232 | break; | 230 | break; |
233 | 231 | ||
234 | case NETXEN_NIC_XGBE: | 232 | case NETXEN_NIC_XGBE: |
235 | ops->enable_phy_interrupts = | 233 | adapter->enable_phy_interrupts = |
236 | netxen_niu_xgbe_enable_phy_interrupts; | 234 | netxen_niu_xgbe_enable_phy_interrupts; |
237 | ops->disable_phy_interrupts = | 235 | adapter->disable_phy_interrupts = |
238 | netxen_niu_xgbe_disable_phy_interrupts; | 236 | netxen_niu_xgbe_disable_phy_interrupts; |
239 | ops->handle_phy_intr = netxen_nic_xgbe_handle_phy_intr; | 237 | adapter->handle_phy_intr = netxen_nic_xgbe_handle_phy_intr; |
240 | ops->macaddr_set = netxen_niu_xg_macaddr_set; | 238 | adapter->macaddr_set = netxen_niu_xg_macaddr_set; |
241 | ops->set_mtu = netxen_nic_set_mtu_xgb; | 239 | adapter->set_mtu = netxen_nic_set_mtu_xgb; |
242 | ops->init_port = netxen_niu_xg_init_port; | 240 | adapter->init_port = netxen_niu_xg_init_port; |
243 | ops->set_promisc = netxen_niu_xg_set_promiscuous_mode; | 241 | adapter->set_promisc = netxen_niu_xg_set_promiscuous_mode; |
244 | ops->unset_promisc = netxen_niu_xg_set_promiscuous_mode; | 242 | adapter->unset_promisc = netxen_niu_xg_set_promiscuous_mode; |
245 | ops->stop_port = netxen_niu_disable_xg_port; | 243 | adapter->stop_port = netxen_niu_disable_xg_port; |
246 | break; | 244 | break; |
247 | 245 | ||
248 | default: | 246 | default: |
@@ -383,8 +381,8 @@ int netxen_rom_wip_poll(struct netxen_adapter *adapter) | |||
383 | return 0; | 381 | return 0; |
384 | } | 382 | } |
385 | 383 | ||
386 | static inline int do_rom_fast_write(struct netxen_adapter *adapter, | 384 | static inline int do_rom_fast_write(struct netxen_adapter *adapter, int addr, |
387 | int addr, int data) | 385 | int data) |
388 | { | 386 | { |
389 | if (netxen_rom_wren(adapter)) { | 387 | if (netxen_rom_wren(adapter)) { |
390 | return -1; | 388 | return -1; |
@@ -622,6 +620,43 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
622 | return 0; | 620 | return 0; |
623 | } | 621 | } |
624 | 622 | ||
623 | int netxen_initialize_adapter_offload(struct netxen_adapter *adapter) | ||
624 | { | ||
625 | uint64_t addr; | ||
626 | uint32_t hi; | ||
627 | uint32_t lo; | ||
628 | |||
629 | adapter->dummy_dma.addr = | ||
630 | pci_alloc_consistent(adapter->ahw.pdev, | ||
631 | NETXEN_HOST_DUMMY_DMA_SIZE, | ||
632 | &adapter->dummy_dma.phys_addr); | ||
633 | if (adapter->dummy_dma.addr == NULL) { | ||
634 | printk("%s: ERROR: Could not allocate dummy DMA memory\n", | ||
635 | __FUNCTION__); | ||
636 | return -ENOMEM; | ||
637 | } | ||
638 | |||
639 | addr = (uint64_t) adapter->dummy_dma.phys_addr; | ||
640 | hi = (addr >> 32) & 0xffffffff; | ||
641 | lo = addr & 0xffffffff; | ||
642 | |||
643 | writel(hi, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_DUMMY_BUF_ADDR_HI)); | ||
644 | writel(lo, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_DUMMY_BUF_ADDR_LO)); | ||
645 | |||
646 | return 0; | ||
647 | } | ||
648 | |||
649 | void netxen_free_adapter_offload(struct netxen_adapter *adapter) | ||
650 | { | ||
651 | if (adapter->dummy_dma.addr) { | ||
652 | pci_free_consistent(adapter->ahw.pdev, | ||
653 | NETXEN_HOST_DUMMY_DMA_SIZE, | ||
654 | adapter->dummy_dma.addr, | ||
655 | adapter->dummy_dma.phys_addr); | ||
656 | adapter->dummy_dma.addr = NULL; | ||
657 | } | ||
658 | } | ||
659 | |||
625 | void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val) | 660 | void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val) |
626 | { | 661 | { |
627 | u32 val = 0; | 662 | u32 val = 0; |
@@ -656,7 +691,8 @@ int netxen_nic_rx_has_work(struct netxen_adapter *adapter) | |||
656 | desc_head = recv_ctx->rcv_status_desc_head; | 691 | desc_head = recv_ctx->rcv_status_desc_head; |
657 | desc = &desc_head[consumer]; | 692 | desc = &desc_head[consumer]; |
658 | 693 | ||
659 | if (((le16_to_cpu(desc->owner)) & STATUS_OWNER_HOST)) | 694 | if (((le16_to_cpu(netxen_get_sts_owner(desc))) |
695 | & STATUS_OWNER_HOST)) | ||
660 | return 1; | 696 | return 1; |
661 | } | 697 | } |
662 | 698 | ||
@@ -735,8 +771,8 @@ void netxen_watchdog_task(struct work_struct *work) | |||
735 | netif_wake_queue(netdev); | 771 | netif_wake_queue(netdev); |
736 | } | 772 | } |
737 | 773 | ||
738 | if (adapter->ops->handle_phy_intr) | 774 | if (adapter->handle_phy_intr) |
739 | adapter->ops->handle_phy_intr(adapter); | 775 | adapter->handle_phy_intr(adapter); |
740 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | 776 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); |
741 | } | 777 | } |
742 | 778 | ||
@@ -749,19 +785,19 @@ void | |||
749 | netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, | 785 | netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, |
750 | struct status_desc *desc) | 786 | struct status_desc *desc) |
751 | { | 787 | { |
752 | struct netxen_port *port = adapter->port[STATUS_DESC_PORT(desc)]; | 788 | struct netxen_port *port = adapter->port[netxen_get_sts_port(desc)]; |
753 | struct pci_dev *pdev = port->pdev; | 789 | struct pci_dev *pdev = port->pdev; |
754 | struct net_device *netdev = port->netdev; | 790 | struct net_device *netdev = port->netdev; |
755 | int index = le16_to_cpu(desc->reference_handle); | 791 | int index = le16_to_cpu(netxen_get_sts_refhandle(desc)); |
756 | struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]); | 792 | struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]); |
757 | struct netxen_rx_buffer *buffer; | 793 | struct netxen_rx_buffer *buffer; |
758 | struct sk_buff *skb; | 794 | struct sk_buff *skb; |
759 | u32 length = le16_to_cpu(desc->total_length); | 795 | u32 length = le16_to_cpu(netxen_get_sts_totallength(desc)); |
760 | u32 desc_ctx; | 796 | u32 desc_ctx; |
761 | struct netxen_rcv_desc_ctx *rcv_desc; | 797 | struct netxen_rcv_desc_ctx *rcv_desc; |
762 | int ret; | 798 | int ret; |
763 | 799 | ||
764 | desc_ctx = STATUS_DESC_TYPE(desc); | 800 | desc_ctx = netxen_get_sts_type(desc); |
765 | if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) { | 801 | if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) { |
766 | printk("%s: %s Bad Rcv descriptor ring\n", | 802 | printk("%s: %s Bad Rcv descriptor ring\n", |
767 | netxen_nic_driver_name, netdev->name); | 803 | netxen_nic_driver_name, netdev->name); |
@@ -769,20 +805,49 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, | |||
769 | } | 805 | } |
770 | 806 | ||
771 | rcv_desc = &recv_ctx->rcv_desc[desc_ctx]; | 807 | rcv_desc = &recv_ctx->rcv_desc[desc_ctx]; |
808 | if (unlikely(index > rcv_desc->max_rx_desc_count)) { | ||
809 | DPRINTK(ERR, "Got a buffer index:%x Max is %x\n", | ||
810 | index, rcv_desc->max_rx_desc_count); | ||
811 | return; | ||
812 | } | ||
772 | buffer = &rcv_desc->rx_buf_arr[index]; | 813 | buffer = &rcv_desc->rx_buf_arr[index]; |
814 | if (desc_ctx == RCV_DESC_LRO_CTXID) { | ||
815 | buffer->lro_current_frags++; | ||
816 | if (netxen_get_sts_desc_lro_last_frag(desc)) { | ||
817 | buffer->lro_expected_frags = | ||
818 | netxen_get_sts_desc_lro_cnt(desc); | ||
819 | buffer->lro_length = length; | ||
820 | } | ||
821 | if (buffer->lro_current_frags != buffer->lro_expected_frags) { | ||
822 | if (buffer->lro_expected_frags != 0) { | ||
823 | printk("LRO: (refhandle:%x) recv frag." | ||
824 | "wait for last. flags: %x expected:%d" | ||
825 | "have:%d\n", index, | ||
826 | netxen_get_sts_desc_lro_last_frag(desc), | ||
827 | buffer->lro_expected_frags, | ||
828 | buffer->lro_current_frags); | ||
829 | } | ||
830 | return; | ||
831 | } | ||
832 | } | ||
773 | 833 | ||
774 | pci_unmap_single(pdev, buffer->dma, rcv_desc->dma_size, | 834 | pci_unmap_single(pdev, buffer->dma, rcv_desc->dma_size, |
775 | PCI_DMA_FROMDEVICE); | 835 | PCI_DMA_FROMDEVICE); |
776 | 836 | ||
777 | skb = (struct sk_buff *)buffer->skb; | 837 | skb = (struct sk_buff *)buffer->skb; |
778 | 838 | ||
779 | if (likely(STATUS_DESC_STATUS(desc) == STATUS_CKSUM_OK)) { | 839 | if (likely(netxen_get_sts_status(desc) == STATUS_CKSUM_OK)) { |
780 | port->stats.csummed++; | 840 | port->stats.csummed++; |
781 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 841 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
782 | } else | 842 | } |
783 | skb->ip_summed = CHECKSUM_NONE; | ||
784 | skb->dev = netdev; | 843 | skb->dev = netdev; |
785 | skb_put(skb, length); | 844 | if (desc_ctx == RCV_DESC_LRO_CTXID) { |
845 | /* True length was only available on the last pkt */ | ||
846 | skb_put(skb, buffer->lro_length); | ||
847 | } else { | ||
848 | skb_put(skb, length); | ||
849 | } | ||
850 | |||
786 | skb->protocol = eth_type_trans(skb, netdev); | 851 | skb->protocol = eth_type_trans(skb, netdev); |
787 | 852 | ||
788 | ret = netif_receive_skb(skb); | 853 | ret = netif_receive_skb(skb); |
@@ -828,6 +893,8 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, | |||
828 | adapter->stats.post_called++; | 893 | adapter->stats.post_called++; |
829 | buffer->skb = NULL; | 894 | buffer->skb = NULL; |
830 | buffer->state = NETXEN_BUFFER_FREE; | 895 | buffer->state = NETXEN_BUFFER_FREE; |
896 | buffer->lro_current_frags = 0; | ||
897 | buffer->lro_expected_frags = 0; | ||
831 | 898 | ||
832 | port->stats.no_rcv++; | 899 | port->stats.no_rcv++; |
833 | port->stats.rxbytes += length; | 900 | port->stats.rxbytes += length; |
@@ -840,6 +907,7 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max) | |||
840 | struct status_desc *desc_head = recv_ctx->rcv_status_desc_head; | 907 | struct status_desc *desc_head = recv_ctx->rcv_status_desc_head; |
841 | struct status_desc *desc; /* used to read status desc here */ | 908 | struct status_desc *desc; /* used to read status desc here */ |
842 | u32 consumer = recv_ctx->status_rx_consumer; | 909 | u32 consumer = recv_ctx->status_rx_consumer; |
910 | u32 producer = 0; | ||
843 | int count = 0, ring; | 911 | int count = 0, ring; |
844 | 912 | ||
845 | DPRINTK(INFO, "procesing receive\n"); | 913 | DPRINTK(INFO, "procesing receive\n"); |
@@ -851,18 +919,22 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max) | |||
851 | */ | 919 | */ |
852 | while (count < max) { | 920 | while (count < max) { |
853 | desc = &desc_head[consumer]; | 921 | desc = &desc_head[consumer]; |
854 | if (!((le16_to_cpu(desc->owner)) & STATUS_OWNER_HOST)) { | 922 | if (! |
855 | DPRINTK(ERR, "desc %p ownedby %x\n", desc, desc->owner); | 923 | (le16_to_cpu(netxen_get_sts_owner(desc)) & |
924 | STATUS_OWNER_HOST)) { | ||
925 | DPRINTK(ERR, "desc %p ownedby %x\n", desc, | ||
926 | netxen_get_sts_owner(desc)); | ||
856 | break; | 927 | break; |
857 | } | 928 | } |
858 | netxen_process_rcv(adapter, ctxid, desc); | 929 | netxen_process_rcv(adapter, ctxid, desc); |
859 | desc->owner = STATUS_OWNER_PHANTOM; | 930 | netxen_clear_sts_owner(desc); |
931 | netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM); | ||
860 | consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); | 932 | consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); |
861 | count++; | 933 | count++; |
862 | } | 934 | } |
863 | if (count) { | 935 | if (count) { |
864 | for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) { | 936 | for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) { |
865 | netxen_post_rx_buffers(adapter, ctxid, ring); | 937 | netxen_post_rx_buffers_nodb(adapter, ctxid, ring); |
866 | } | 938 | } |
867 | } | 939 | } |
868 | 940 | ||
@@ -870,6 +942,7 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max) | |||
870 | if (count) { | 942 | if (count) { |
871 | adapter->stats.process_rcv++; | 943 | adapter->stats.process_rcv++; |
872 | recv_ctx->status_rx_consumer = consumer; | 944 | recv_ctx->status_rx_consumer = consumer; |
945 | recv_ctx->status_rx_producer = producer; | ||
873 | 946 | ||
874 | /* Window = 1 */ | 947 | /* Window = 1 */ |
875 | writel(consumer, | 948 | writel(consumer, |
@@ -882,12 +955,13 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max) | |||
882 | } | 955 | } |
883 | 956 | ||
884 | /* Process Command status ring */ | 957 | /* Process Command status ring */ |
885 | void netxen_process_cmd_ring(unsigned long data) | 958 | int netxen_process_cmd_ring(unsigned long data) |
886 | { | 959 | { |
887 | u32 last_consumer; | 960 | u32 last_consumer; |
888 | u32 consumer; | 961 | u32 consumer; |
889 | struct netxen_adapter *adapter = (struct netxen_adapter *)data; | 962 | struct netxen_adapter *adapter = (struct netxen_adapter *)data; |
890 | int count = 0; | 963 | int count1 = 0; |
964 | int count2 = 0; | ||
891 | struct netxen_cmd_buffer *buffer; | 965 | struct netxen_cmd_buffer *buffer; |
892 | struct netxen_port *port; /* port #1 */ | 966 | struct netxen_port *port; /* port #1 */ |
893 | struct netxen_port *nport; | 967 | struct netxen_port *nport; |
@@ -896,6 +970,7 @@ void netxen_process_cmd_ring(unsigned long data) | |||
896 | u32 i; | 970 | u32 i; |
897 | struct sk_buff *skb = NULL; | 971 | struct sk_buff *skb = NULL; |
898 | int p; | 972 | int p; |
973 | int done; | ||
899 | 974 | ||
900 | spin_lock(&adapter->tx_lock); | 975 | spin_lock(&adapter->tx_lock); |
901 | last_consumer = adapter->last_cmd_consumer; | 976 | last_consumer = adapter->last_cmd_consumer; |
@@ -905,14 +980,13 @@ void netxen_process_cmd_ring(unsigned long data) | |||
905 | * number as part of the descriptor. This way we will be able to get | 980 | * number as part of the descriptor. This way we will be able to get |
906 | * the netdev which is associated with that device. | 981 | * the netdev which is associated with that device. |
907 | */ | 982 | */ |
908 | consumer = | ||
909 | readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMD_CONSUMER_OFFSET)); | ||
910 | 983 | ||
984 | consumer = *(adapter->cmd_consumer); | ||
911 | if (last_consumer == consumer) { /* Ring is empty */ | 985 | if (last_consumer == consumer) { /* Ring is empty */ |
912 | DPRINTK(INFO, "last_consumer %d == consumer %d\n", | 986 | DPRINTK(INFO, "last_consumer %d == consumer %d\n", |
913 | last_consumer, consumer); | 987 | last_consumer, consumer); |
914 | spin_unlock(&adapter->tx_lock); | 988 | spin_unlock(&adapter->tx_lock); |
915 | return; | 989 | return 1; |
916 | } | 990 | } |
917 | 991 | ||
918 | adapter->proc_cmd_buf_counter++; | 992 | adapter->proc_cmd_buf_counter++; |
@@ -923,7 +997,7 @@ void netxen_process_cmd_ring(unsigned long data) | |||
923 | */ | 997 | */ |
924 | spin_unlock(&adapter->tx_lock); | 998 | spin_unlock(&adapter->tx_lock); |
925 | 999 | ||
926 | while ((last_consumer != consumer) && (count < MAX_STATUS_HANDLE)) { | 1000 | while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) { |
927 | buffer = &adapter->cmd_buf_arr[last_consumer]; | 1001 | buffer = &adapter->cmd_buf_arr[last_consumer]; |
928 | port = adapter->port[buffer->port]; | 1002 | port = adapter->port[buffer->port]; |
929 | pdev = port->pdev; | 1003 | pdev = port->pdev; |
@@ -949,24 +1023,24 @@ void netxen_process_cmd_ring(unsigned long data) | |||
949 | && netif_carrier_ok(port->netdev)) | 1023 | && netif_carrier_ok(port->netdev)) |
950 | && ((jiffies - port->netdev->trans_start) > | 1024 | && ((jiffies - port->netdev->trans_start) > |
951 | port->netdev->watchdog_timeo)) { | 1025 | port->netdev->watchdog_timeo)) { |
952 | schedule_work(&port->adapter->tx_timeout_task); | 1026 | SCHEDULE_WORK(&port->adapter->tx_timeout_task); |
953 | } | 1027 | } |
954 | 1028 | ||
955 | last_consumer = get_next_index(last_consumer, | 1029 | last_consumer = get_next_index(last_consumer, |
956 | adapter->max_tx_desc_count); | 1030 | adapter->max_tx_desc_count); |
957 | count++; | 1031 | count1++; |
958 | } | 1032 | } |
959 | adapter->stats.noxmitdone += count; | 1033 | adapter->stats.noxmitdone += count1; |
960 | 1034 | ||
961 | count = 0; | 1035 | count2 = 0; |
962 | spin_lock(&adapter->tx_lock); | 1036 | spin_lock(&adapter->tx_lock); |
963 | if ((--adapter->proc_cmd_buf_counter) == 0) { | 1037 | if ((--adapter->proc_cmd_buf_counter) == 0) { |
964 | adapter->last_cmd_consumer = last_consumer; | 1038 | adapter->last_cmd_consumer = last_consumer; |
965 | while ((adapter->last_cmd_consumer != consumer) | 1039 | while ((adapter->last_cmd_consumer != consumer) |
966 | && (count < MAX_STATUS_HANDLE)) { | 1040 | && (count2 < MAX_STATUS_HANDLE)) { |
967 | buffer = | 1041 | buffer = |
968 | &adapter->cmd_buf_arr[adapter->last_cmd_consumer]; | 1042 | &adapter->cmd_buf_arr[adapter->last_cmd_consumer]; |
969 | count++; | 1043 | count2++; |
970 | if (buffer->skb) | 1044 | if (buffer->skb) |
971 | break; | 1045 | break; |
972 | else | 1046 | else |
@@ -975,7 +1049,7 @@ void netxen_process_cmd_ring(unsigned long data) | |||
975 | adapter->max_tx_desc_count); | 1049 | adapter->max_tx_desc_count); |
976 | } | 1050 | } |
977 | } | 1051 | } |
978 | if (count) { | 1052 | if (count1 || count2) { |
979 | for (p = 0; p < adapter->ahw.max_ports; p++) { | 1053 | for (p = 0; p < adapter->ahw.max_ports; p++) { |
980 | nport = adapter->port[p]; | 1054 | nport = adapter->port[p]; |
981 | if (netif_queue_stopped(nport->netdev) | 1055 | if (netif_queue_stopped(nport->netdev) |
@@ -985,10 +1059,30 @@ void netxen_process_cmd_ring(unsigned long data) | |||
985 | } | 1059 | } |
986 | } | 1060 | } |
987 | } | 1061 | } |
1062 | /* | ||
1063 | * If everything is freed up to consumer then check if the ring is full | ||
1064 | * If the ring is full then check if more needs to be freed and | ||
1065 | * schedule the call back again. | ||
1066 | * | ||
1067 | * This happens when there are 2 CPUs. One could be freeing and the | ||
1068 | * other filling it. If the ring is full when we get out of here and | ||
1069 | * the card has already interrupted the host then the host can miss the | ||
1070 | * interrupt. | ||
1071 | * | ||
1072 | * There is still a possible race condition and the host could miss an | ||
1073 | * interrupt. The card has to take care of this. | ||
1074 | */ | ||
1075 | if (adapter->last_cmd_consumer == consumer && | ||
1076 | (((adapter->cmd_producer + 1) % | ||
1077 | adapter->max_tx_desc_count) == adapter->last_cmd_consumer)) { | ||
1078 | consumer = *(adapter->cmd_consumer); | ||
1079 | } | ||
1080 | done = (adapter->last_cmd_consumer == consumer); | ||
988 | 1081 | ||
989 | spin_unlock(&adapter->tx_lock); | 1082 | spin_unlock(&adapter->tx_lock); |
990 | DPRINTK(INFO, "last consumer is %d in %s\n", last_consumer, | 1083 | DPRINTK(INFO, "last consumer is %d in %s\n", last_consumer, |
991 | __FUNCTION__); | 1084 | __FUNCTION__); |
1085 | return (done); | ||
992 | } | 1086 | } |
993 | 1087 | ||
994 | /* | 1088 | /* |
@@ -1000,17 +1094,16 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1000 | struct sk_buff *skb; | 1094 | struct sk_buff *skb; |
1001 | struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctx]); | 1095 | struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctx]); |
1002 | struct netxen_rcv_desc_ctx *rcv_desc = NULL; | 1096 | struct netxen_rcv_desc_ctx *rcv_desc = NULL; |
1003 | struct netxen_recv_crb *crbarea = &recv_crb_registers[ctx]; | 1097 | uint producer; |
1004 | struct netxen_rcv_desc_crb *rcv_desc_crb = NULL; | ||
1005 | u32 producer; | ||
1006 | struct rcv_desc *pdesc; | 1098 | struct rcv_desc *pdesc; |
1007 | struct netxen_rx_buffer *buffer; | 1099 | struct netxen_rx_buffer *buffer; |
1008 | int count = 0; | 1100 | int count = 0; |
1009 | int index = 0; | 1101 | int index = 0; |
1102 | netxen_ctx_msg msg = 0; | ||
1103 | dma_addr_t dma; | ||
1010 | 1104 | ||
1011 | adapter->stats.post_called++; | 1105 | adapter->stats.post_called++; |
1012 | rcv_desc = &recv_ctx->rcv_desc[ringid]; | 1106 | rcv_desc = &recv_ctx->rcv_desc[ringid]; |
1013 | rcv_desc_crb = &crbarea->rcv_desc_crb[ringid]; | ||
1014 | 1107 | ||
1015 | producer = rcv_desc->producer; | 1108 | producer = rcv_desc->producer; |
1016 | index = rcv_desc->begin_alloc; | 1109 | index = rcv_desc->begin_alloc; |
@@ -1020,6 +1113,7 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1020 | skb = dev_alloc_skb(rcv_desc->skb_size); | 1113 | skb = dev_alloc_skb(rcv_desc->skb_size); |
1021 | if (unlikely(!skb)) { | 1114 | if (unlikely(!skb)) { |
1022 | /* | 1115 | /* |
1116 | * TODO | ||
1023 | * We need to schedule the posting of buffers to the pegs. | 1117 | * We need to schedule the posting of buffers to the pegs. |
1024 | */ | 1118 | */ |
1025 | rcv_desc->begin_alloc = index; | 1119 | rcv_desc->begin_alloc = index; |
@@ -1027,9 +1121,105 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1027 | " allocated only %d buffers\n", count); | 1121 | " allocated only %d buffers\n", count); |
1028 | break; | 1122 | break; |
1029 | } | 1123 | } |
1124 | |||
1030 | count++; /* now there should be no failure */ | 1125 | count++; /* now there should be no failure */ |
1031 | pdesc = &rcv_desc->desc_head[producer]; | 1126 | pdesc = &rcv_desc->desc_head[producer]; |
1032 | skb_reserve(skb, NET_IP_ALIGN); | 1127 | |
1128 | #if defined(XGB_DEBUG) | ||
1129 | *(unsigned long *)(skb->head) = 0xc0debabe; | ||
1130 | if (skb_is_nonlinear(skb)) { | ||
1131 | printk("Allocated SKB @%p is nonlinear\n"); | ||
1132 | } | ||
1133 | #endif | ||
1134 | skb_reserve(skb, 2); | ||
1135 | /* This will be setup when we receive the | ||
1136 | * buffer after it has been filled FSL TBD TBD | ||
1137 | * skb->dev = netdev; | ||
1138 | */ | ||
1139 | dma = pci_map_single(pdev, skb->data, rcv_desc->dma_size, | ||
1140 | PCI_DMA_FROMDEVICE); | ||
1141 | pdesc->addr_buffer = dma; | ||
1142 | buffer->skb = skb; | ||
1143 | buffer->state = NETXEN_BUFFER_BUSY; | ||
1144 | buffer->dma = dma; | ||
1145 | /* make a rcv descriptor */ | ||
1146 | pdesc->reference_handle = buffer->ref_handle; | ||
1147 | pdesc->buffer_length = rcv_desc->dma_size; | ||
1148 | DPRINTK(INFO, "done writing descripter\n"); | ||
1149 | producer = | ||
1150 | get_next_index(producer, rcv_desc->max_rx_desc_count); | ||
1151 | index = get_next_index(index, rcv_desc->max_rx_desc_count); | ||
1152 | buffer = &rcv_desc->rx_buf_arr[index]; | ||
1153 | } | ||
1154 | /* if we did allocate buffers, then write the count to Phantom */ | ||
1155 | if (count) { | ||
1156 | rcv_desc->begin_alloc = index; | ||
1157 | rcv_desc->rcv_pending += count; | ||
1158 | adapter->stats.lastposted = count; | ||
1159 | adapter->stats.posted += count; | ||
1160 | rcv_desc->producer = producer; | ||
1161 | if (rcv_desc->rcv_free >= 32) { | ||
1162 | rcv_desc->rcv_free = 0; | ||
1163 | /* Window = 1 */ | ||
1164 | writel((producer - 1) & | ||
1165 | (rcv_desc->max_rx_desc_count - 1), | ||
1166 | NETXEN_CRB_NORMALIZE(adapter, | ||
1167 | recv_crb_registers[0]. | ||
1168 | rcv_desc_crb[ringid]. | ||
1169 | crb_rcv_producer_offset)); | ||
1170 | /* | ||
1171 | * Write a doorbell msg to tell phanmon of change in | ||
1172 | * receive ring producer | ||
1173 | */ | ||
1174 | netxen_set_msg_peg_id(msg, NETXEN_RCV_PEG_DB_ID); | ||
1175 | netxen_set_msg_privid(msg); | ||
1176 | netxen_set_msg_count(msg, | ||
1177 | ((producer - | ||
1178 | 1) & (rcv_desc-> | ||
1179 | max_rx_desc_count - 1))); | ||
1180 | netxen_set_msg_ctxid(msg, 0); | ||
1181 | netxen_set_msg_opcode(msg, NETXEN_RCV_PRODUCER(ringid)); | ||
1182 | writel(msg, | ||
1183 | DB_NORMALIZE(adapter, | ||
1184 | NETXEN_RCV_PRODUCER_OFFSET)); | ||
1185 | } | ||
1186 | } | ||
1187 | } | ||
1188 | |||
1189 | void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, uint32_t ctx, | ||
1190 | uint32_t ringid) | ||
1191 | { | ||
1192 | struct pci_dev *pdev = adapter->ahw.pdev; | ||
1193 | struct sk_buff *skb; | ||
1194 | struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctx]); | ||
1195 | struct netxen_rcv_desc_ctx *rcv_desc = NULL; | ||
1196 | u32 producer; | ||
1197 | struct rcv_desc *pdesc; | ||
1198 | struct netxen_rx_buffer *buffer; | ||
1199 | int count = 0; | ||
1200 | int index = 0; | ||
1201 | |||
1202 | adapter->stats.post_called++; | ||
1203 | rcv_desc = &recv_ctx->rcv_desc[ringid]; | ||
1204 | |||
1205 | producer = rcv_desc->producer; | ||
1206 | index = rcv_desc->begin_alloc; | ||
1207 | buffer = &rcv_desc->rx_buf_arr[index]; | ||
1208 | /* We can start writing rx descriptors into the phantom memory. */ | ||
1209 | while (buffer->state == NETXEN_BUFFER_FREE) { | ||
1210 | skb = dev_alloc_skb(rcv_desc->skb_size); | ||
1211 | if (unlikely(!skb)) { | ||
1212 | /* | ||
1213 | * We need to schedule the posting of buffers to the pegs. | ||
1214 | */ | ||
1215 | rcv_desc->begin_alloc = index; | ||
1216 | DPRINTK(ERR, "netxen_post_rx_buffers_nodb: " | ||
1217 | " allocated only %d buffers\n", count); | ||
1218 | break; | ||
1219 | } | ||
1220 | count++; /* now there should be no failure */ | ||
1221 | pdesc = &rcv_desc->desc_head[producer]; | ||
1222 | skb_reserve(skb, 2); | ||
1033 | /* | 1223 | /* |
1034 | * This will be setup when we receive the | 1224 | * This will be setup when we receive the |
1035 | * buffer after it has been filled | 1225 | * buffer after it has been filled |
@@ -1040,6 +1230,7 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1040 | buffer->dma = pci_map_single(pdev, skb->data, | 1230 | buffer->dma = pci_map_single(pdev, skb->data, |
1041 | rcv_desc->dma_size, | 1231 | rcv_desc->dma_size, |
1042 | PCI_DMA_FROMDEVICE); | 1232 | PCI_DMA_FROMDEVICE); |
1233 | |||
1043 | /* make a rcv descriptor */ | 1234 | /* make a rcv descriptor */ |
1044 | pdesc->reference_handle = le16_to_cpu(buffer->ref_handle); | 1235 | pdesc->reference_handle = le16_to_cpu(buffer->ref_handle); |
1045 | pdesc->buffer_length = le16_to_cpu(rcv_desc->dma_size); | 1236 | pdesc->buffer_length = le16_to_cpu(rcv_desc->dma_size); |
@@ -1064,7 +1255,8 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1064 | writel((producer - 1) & | 1255 | writel((producer - 1) & |
1065 | (rcv_desc->max_rx_desc_count - 1), | 1256 | (rcv_desc->max_rx_desc_count - 1), |
1066 | NETXEN_CRB_NORMALIZE(adapter, | 1257 | NETXEN_CRB_NORMALIZE(adapter, |
1067 | rcv_desc_crb-> | 1258 | recv_crb_registers[0]. |
1259 | rcv_desc_crb[ringid]. | ||
1068 | crb_rcv_producer_offset)); | 1260 | crb_rcv_producer_offset)); |
1069 | wmb(); | 1261 | wmb(); |
1070 | } | 1262 | } |
@@ -1197,8 +1389,8 @@ netxen_nic_do_ioctl(struct netxen_adapter *adapter, void *u_data, | |||
1197 | 1389 | ||
1198 | switch (data.cmd) { | 1390 | switch (data.cmd) { |
1199 | case netxen_nic_cmd_pci_read: | 1391 | case netxen_nic_cmd_pci_read: |
1200 | if ((retval = netxen_nic_hw_read_wx(adapter, data.off, | 1392 | if ((retval = netxen_nic_hw_read_ioctl(adapter, data.off, |
1201 | &(data.u), data.size))) | 1393 | &(data.u), data.size))) |
1202 | goto error_out; | 1394 | goto error_out; |
1203 | if (copy_to_user | 1395 | if (copy_to_user |
1204 | ((void __user *)&(up_data->u), &(data.u), data.size)) { | 1396 | ((void __user *)&(up_data->u), &(data.u), data.size)) { |
@@ -1211,8 +1403,35 @@ netxen_nic_do_ioctl(struct netxen_adapter *adapter, void *u_data, | |||
1211 | break; | 1403 | break; |
1212 | 1404 | ||
1213 | case netxen_nic_cmd_pci_write: | 1405 | case netxen_nic_cmd_pci_write: |
1214 | data.rv = netxen_nic_hw_write_wx(adapter, data.off, &(data.u), | 1406 | if ((retval = netxen_nic_hw_write_ioctl(adapter, data.off, |
1215 | data.size); | 1407 | &(data.u), data.size))) |
1408 | goto error_out; | ||
1409 | data.rv = 0; | ||
1410 | break; | ||
1411 | |||
1412 | case netxen_nic_cmd_pci_mem_read: | ||
1413 | if (netxen_nic_pci_mem_read_ioctl(adapter, data.off, &(data.u), | ||
1414 | data.size)) { | ||
1415 | DPRINTK(ERR, "Failed to read the data.\n"); | ||
1416 | retval = -EFAULT; | ||
1417 | goto error_out; | ||
1418 | } | ||
1419 | if (copy_to_user | ||
1420 | ((void __user *)&(up_data->u), &(data.u), data.size)) { | ||
1421 | DPRINTK(ERR, "bad copy to userland: %d\n", | ||
1422 | (int)sizeof(data)); | ||
1423 | retval = -EFAULT; | ||
1424 | goto error_out; | ||
1425 | } | ||
1426 | data.rv = 0; | ||
1427 | break; | ||
1428 | |||
1429 | case netxen_nic_cmd_pci_mem_write: | ||
1430 | if ((retval = netxen_nic_pci_mem_write_ioctl(adapter, data.off, | ||
1431 | &(data.u), | ||
1432 | data.size))) | ||
1433 | goto error_out; | ||
1434 | data.rv = 0; | ||
1216 | break; | 1435 | break; |
1217 | 1436 | ||
1218 | case netxen_nic_cmd_pci_config_read: | 1437 | case netxen_nic_cmd_pci_config_read: |
@@ -1297,7 +1516,7 @@ netxen_nic_do_ioctl(struct netxen_adapter *adapter, void *u_data, | |||
1297 | retval = -EOPNOTSUPP; | 1516 | retval = -EOPNOTSUPP; |
1298 | goto error_out; | 1517 | goto error_out; |
1299 | } | 1518 | } |
1300 | put_user(data.rv, (u16 __user *) (&(up_data->rv))); | 1519 | put_user(data.rv, (&(up_data->rv))); |
1301 | DPRINTK(INFO, "done ioctl for %p well.\n", adapter); | 1520 | DPRINTK(INFO, "done ioctl for %p well.\n", adapter); |
1302 | 1521 | ||
1303 | error_out: | 1522 | error_out: |
diff --git a/drivers/net/netxen/netxen_nic_ioctl.h b/drivers/net/netxen/netxen_nic_ioctl.h index 23e53adbf123..1221fa527552 100644 --- a/drivers/net/netxen/netxen_nic_ioctl.h +++ b/drivers/net/netxen/netxen_nic_ioctl.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 - 2006 NetXen, Inc. | 2 | * Copyright (C) 2003 - 2006 NetXen, Inc. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
7 | * as published by the Free Software Foundation; either version 2 | 7 | * as published by the Free Software Foundation; either version 2 |
@@ -16,10 +16,10 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
18 | * MA 02111-1307, USA. | 18 | * MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * The full GNU General Public License is included in this distribution | 20 | * The full GNU General Public License is included in this distribution |
21 | * in the file called LICENSE. | 21 | * in the file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * info@netxen.com | 24 | * info@netxen.com |
25 | * NetXen, | 25 | * NetXen, |
@@ -36,7 +36,7 @@ | |||
36 | #define NETXEN_NIC_CMD (NETXEN_CMD_START + 1) | 36 | #define NETXEN_NIC_CMD (NETXEN_CMD_START + 1) |
37 | #define NETXEN_NIC_NAME (NETXEN_CMD_START + 2) | 37 | #define NETXEN_NIC_NAME (NETXEN_CMD_START + 2) |
38 | #define NETXEN_NIC_NAME_LEN 16 | 38 | #define NETXEN_NIC_NAME_LEN 16 |
39 | #define NETXEN_NIC_NAME_RSP "NETXEN" | 39 | #define NETXEN_NIC_NAME_RSP "NETXEN-UNM" |
40 | 40 | ||
41 | typedef enum { | 41 | typedef enum { |
42 | netxen_nic_cmd_none = 0, | 42 | netxen_nic_cmd_none = 0, |
diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c index ae180fee8008..1b45f50fa6aa 100644 --- a/drivers/net/netxen/netxen_nic_isr.c +++ b/drivers/net/netxen/netxen_nic_isr.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 - 2006 NetXen, Inc. | 2 | * Copyright (C) 2003 - 2006 NetXen, Inc. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
7 | * as published by the Free Software Foundation; either version 2 | 7 | * as published by the Free Software Foundation; either version 2 |
@@ -16,10 +16,10 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
18 | * MA 02111-1307, USA. | 18 | * MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * The full GNU General Public License is included in this distribution | 20 | * The full GNU General Public License is included in this distribution |
21 | * in the file called LICENSE. | 21 | * in the file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * info@netxen.com | 24 | * info@netxen.com |
25 | * NetXen, | 25 | * NetXen, |
@@ -68,8 +68,7 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) | |||
68 | void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 portno, | 68 | void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 portno, |
69 | u32 link) | 69 | u32 link) |
70 | { | 70 | { |
71 | struct netxen_port *pport = adapter->port[portno]; | 71 | struct net_device *netdev = (adapter->port[portno])->netdev; |
72 | struct net_device *netdev = pport->netdev; | ||
73 | 72 | ||
74 | if (link) | 73 | if (link) |
75 | netif_carrier_on(netdev); | 74 | netif_carrier_on(netdev); |
@@ -84,46 +83,41 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno, | |||
84 | struct netxen_port *port; | 83 | struct netxen_port *port; |
85 | 84 | ||
86 | /* This should clear the interrupt source */ | 85 | /* This should clear the interrupt source */ |
87 | if (adapter->ops->phy_read) | 86 | if (adapter->phy_read) |
88 | adapter->ops->phy_read(adapter, portno, | 87 | adapter->phy_read(adapter, portno, |
89 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, | 88 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, |
90 | &int_src); | 89 | &int_src); |
91 | if (int_src == 0) { | 90 | if (int_src == 0) { |
92 | DPRINTK(INFO, "No phy interrupts for port #%d\n", portno); | 91 | DPRINTK(INFO, "No phy interrupts for port #%d\n", portno); |
93 | return; | 92 | return; |
94 | } | 93 | } |
95 | if (adapter->ops->disable_phy_interrupts) | 94 | if (adapter->disable_phy_interrupts) |
96 | adapter->ops->disable_phy_interrupts(adapter, portno); | 95 | adapter->disable_phy_interrupts(adapter, portno); |
97 | 96 | ||
98 | port = adapter->port[portno]; | 97 | port = adapter->port[portno]; |
99 | 98 | ||
100 | if (netxen_get_phy_int_jabber(int_src)) | 99 | if (netxen_get_phy_int_jabber(int_src)) |
101 | DPRINTK(INFO, "NetXen: %s Jabber interrupt \n", | 100 | DPRINTK(INFO, "Jabber interrupt \n"); |
102 | port->netdev->name); | ||
103 | 101 | ||
104 | if (netxen_get_phy_int_polarity_changed(int_src)) | 102 | if (netxen_get_phy_int_polarity_changed(int_src)) |
105 | DPRINTK(INFO, "NetXen: %s POLARITY CHANGED int \n", | 103 | DPRINTK(INFO, "POLARITY CHANGED int \n"); |
106 | port->netdev->name); | ||
107 | 104 | ||
108 | if (netxen_get_phy_int_energy_detect(int_src)) | 105 | if (netxen_get_phy_int_energy_detect(int_src)) |
109 | DPRINTK(INFO, "NetXen: %s ENERGY DETECT INT \n", | 106 | DPRINTK(INFO, "ENERGY DETECT INT \n"); |
110 | port->netdev->name); | ||
111 | 107 | ||
112 | if (netxen_get_phy_int_downshift(int_src)) | 108 | if (netxen_get_phy_int_downshift(int_src)) |
113 | DPRINTK(INFO, "NetXen: %s DOWNSHIFT INT \n", | 109 | DPRINTK(INFO, "DOWNSHIFT INT \n"); |
114 | port->netdev->name); | ||
115 | /* write it down later.. */ | 110 | /* write it down later.. */ |
116 | if ((netxen_get_phy_int_speed_changed(int_src)) | 111 | if ((netxen_get_phy_int_speed_changed(int_src)) |
117 | || (netxen_get_phy_int_link_status_changed(int_src))) { | 112 | || (netxen_get_phy_int_link_status_changed(int_src))) { |
118 | __le32 status; | 113 | __le32 status; |
119 | 114 | ||
120 | DPRINTK(INFO, "NetXen: %s SPEED CHANGED OR" | 115 | DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n"); |
121 | " LINK STATUS CHANGED \n", port->netdev->name); | ||
122 | 116 | ||
123 | if (adapter->ops->phy_read | 117 | if (adapter->phy_read |
124 | && adapter->ops->phy_read(adapter, portno, | 118 | && adapter->phy_read(adapter, portno, |
125 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 119 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
126 | &status) == 0) { | 120 | &status) == 0) { |
127 | if (netxen_get_phy_int_link_status_changed(int_src)) { | 121 | if (netxen_get_phy_int_link_status_changed(int_src)) { |
128 | if (netxen_get_phy_link(status)) { | 122 | if (netxen_get_phy_link(status)) { |
129 | netxen_niu_gbe_init_port(adapter, | 123 | netxen_niu_gbe_init_port(adapter, |
@@ -143,8 +137,8 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno, | |||
143 | } | 137 | } |
144 | } | 138 | } |
145 | } | 139 | } |
146 | if (adapter->ops->enable_phy_interrupts) | 140 | if (adapter->enable_phy_interrupts) |
147 | adapter->ops->enable_phy_interrupts(adapter, portno); | 141 | adapter->enable_phy_interrupts(adapter, portno); |
148 | } | 142 | } |
149 | 143 | ||
150 | void netxen_nic_isr_other(struct netxen_adapter *adapter) | 144 | void netxen_nic_isr_other(struct netxen_adapter *adapter) |
@@ -159,8 +153,7 @@ void netxen_nic_isr_other(struct netxen_adapter *adapter) | |||
159 | 153 | ||
160 | qg_linksup = adapter->ahw.qg_linksup; | 154 | qg_linksup = adapter->ahw.qg_linksup; |
161 | adapter->ahw.qg_linksup = val; | 155 | adapter->ahw.qg_linksup = val; |
162 | DPRINTK(1, INFO, "%s: link update 0x%08x\n", netxen_nic_driver_name, | 156 | DPRINTK(INFO, "link update 0x%08x\n", val); |
163 | val); | ||
164 | for (portno = 0; portno < NETXEN_NIU_MAX_GBE_PORTS; portno++) { | 157 | for (portno = 0; portno < NETXEN_NIU_MAX_GBE_PORTS; portno++) { |
165 | linkup = val & 1; | 158 | linkup = val & 1; |
166 | if (linkup != (qg_linksup & 1)) { | 159 | if (linkup != (qg_linksup & 1)) { |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index df0bb36a1cfb..575b71b67202 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 - 2006 NetXen, Inc. | 2 | * Copyright (C) 2003 - 2006 NetXen, Inc. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
7 | * as published by the Free Software Foundation; either version 2 | 7 | * as published by the Free Software Foundation; either version 2 |
8 | * of the License, or (at your option) any later version. | 8 | * of the License, or (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, but | 10 | * This program is distributed in the hope that it will be useful, but |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
18 | * MA 02111-1307, USA. | 18 | * MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * The full GNU General Public License is included in this distribution | 20 | * The full GNU General Public License is included in this distribution |
21 | * in the file called LICENSE. | 21 | * in the file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * info@netxen.com | 24 | * info@netxen.com |
25 | * NetXen, | 25 | * NetXen, |
@@ -32,6 +32,7 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/vmalloc.h> | 34 | #include <linux/vmalloc.h> |
35 | #include <linux/highmem.h> | ||
35 | #include "netxen_nic_hw.h" | 36 | #include "netxen_nic_hw.h" |
36 | 37 | ||
37 | #include "netxen_nic.h" | 38 | #include "netxen_nic.h" |
@@ -48,14 +49,21 @@ MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); | |||
48 | MODULE_LICENSE("GPL"); | 49 | MODULE_LICENSE("GPL"); |
49 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); | 50 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); |
50 | 51 | ||
51 | char netxen_nic_driver_name[] = "netxen"; | 52 | char netxen_nic_driver_name[] = "netxen-nic"; |
52 | static char netxen_nic_driver_string[] = "NetXen Network Driver version " | 53 | static char netxen_nic_driver_string[] = "NetXen Network Driver version " |
53 | NETXEN_NIC_LINUX_VERSIONID; | 54 | NETXEN_NIC_LINUX_VERSIONID; |
54 | 55 | ||
56 | struct netxen_adapter *g_adapter = NULL; | ||
57 | |||
55 | #define NETXEN_NETDEV_WEIGHT 120 | 58 | #define NETXEN_NETDEV_WEIGHT 120 |
56 | #define NETXEN_ADAPTER_UP_MAGIC 777 | 59 | #define NETXEN_ADAPTER_UP_MAGIC 777 |
57 | #define NETXEN_NIC_PEG_TUNE 0 | 60 | #define NETXEN_NIC_PEG_TUNE 0 |
58 | 61 | ||
62 | u8 nx_p2_id = NX_P2_C0; | ||
63 | |||
64 | #define DMA_32BIT_MASK 0x00000000ffffffffULL | ||
65 | #define DMA_35BIT_MASK 0x00000007ffffffffULL | ||
66 | |||
59 | /* Local functions to NetXen NIC driver */ | 67 | /* Local functions to NetXen NIC driver */ |
60 | static int __devinit netxen_nic_probe(struct pci_dev *pdev, | 68 | static int __devinit netxen_nic_probe(struct pci_dev *pdev, |
61 | const struct pci_device_id *ent); | 69 | const struct pci_device_id *ent); |
@@ -87,6 +95,9 @@ static struct pci_device_id netxen_pci_tbl[] __devinitdata = { | |||
87 | 95 | ||
88 | MODULE_DEVICE_TABLE(pci, netxen_pci_tbl); | 96 | MODULE_DEVICE_TABLE(pci, netxen_pci_tbl); |
89 | 97 | ||
98 | struct workqueue_struct *netxen_workq; | ||
99 | static void netxen_watchdog(unsigned long); | ||
100 | |||
90 | /* | 101 | /* |
91 | * netxen_nic_probe() | 102 | * netxen_nic_probe() |
92 | * | 103 | * |
@@ -105,20 +116,28 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
105 | struct net_device *netdev = NULL; | 116 | struct net_device *netdev = NULL; |
106 | struct netxen_adapter *adapter = NULL; | 117 | struct netxen_adapter *adapter = NULL; |
107 | struct netxen_port *port = NULL; | 118 | struct netxen_port *port = NULL; |
108 | u8 *mem_ptr0 = NULL; | 119 | void __iomem *mem_ptr0 = NULL; |
109 | u8 *mem_ptr1 = NULL; | 120 | void __iomem *mem_ptr1 = NULL; |
110 | u8 *mem_ptr2 = NULL; | 121 | void __iomem *mem_ptr2 = NULL; |
111 | 122 | ||
112 | unsigned long mem_base, mem_len; | 123 | u8 *db_ptr = NULL; |
124 | unsigned long mem_base, mem_len, db_base, db_len; | ||
113 | int pci_using_dac, i, err; | 125 | int pci_using_dac, i, err; |
114 | int ring; | 126 | int ring; |
115 | struct netxen_recv_context *recv_ctx = NULL; | 127 | struct netxen_recv_context *recv_ctx = NULL; |
116 | struct netxen_rcv_desc_ctx *rcv_desc = NULL; | 128 | struct netxen_rcv_desc_ctx *rcv_desc = NULL; |
117 | struct netxen_cmd_buffer *cmd_buf_arr = NULL; | 129 | struct netxen_cmd_buffer *cmd_buf_arr = NULL; |
118 | u64 mac_addr[FLASH_NUM_PORTS + 1]; | 130 | u64 mac_addr[FLASH_NUM_PORTS + 1]; |
119 | int valid_mac; | 131 | int valid_mac = 0; |
132 | static int netxen_cards_found = 0; | ||
120 | 133 | ||
121 | printk(KERN_INFO "%s \n", netxen_nic_driver_string); | 134 | printk(KERN_INFO "%s \n", netxen_nic_driver_string); |
135 | /* In current scheme, we use only PCI function 0 */ | ||
136 | if (PCI_FUNC(pdev->devfn) != 0) { | ||
137 | DPRINTK(ERR, "NetXen function %d will not be enabled.\n", | ||
138 | PCI_FUNC(pdev->devfn)); | ||
139 | return -ENODEV; | ||
140 | } | ||
122 | if ((err = pci_enable_device(pdev))) | 141 | if ((err = pci_enable_device(pdev))) |
123 | return err; | 142 | return err; |
124 | if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { | 143 | if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { |
@@ -130,10 +149,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
130 | goto err_out_disable_pdev; | 149 | goto err_out_disable_pdev; |
131 | 150 | ||
132 | pci_set_master(pdev); | 151 | pci_set_master(pdev); |
133 | if ((pci_set_dma_mask(pdev, DMA_64BIT_MASK) == 0) && | 152 | pci_read_config_byte(pdev, PCI_REVISION_ID, &nx_p2_id); |
134 | (pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK) == 0)) | 153 | if (nx_p2_id == NX_P2_C1 && |
154 | (pci_set_dma_mask(pdev, DMA_35BIT_MASK) == 0) && | ||
155 | (pci_set_consistent_dma_mask(pdev, DMA_35BIT_MASK) == 0)) { | ||
135 | pci_using_dac = 1; | 156 | pci_using_dac = 1; |
136 | else { | 157 | } else { |
137 | if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) || | 158 | if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) || |
138 | (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) | 159 | (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) |
139 | goto err_out_free_res; | 160 | goto err_out_free_res; |
@@ -153,21 +174,34 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
153 | ioremap(mem_base + THIRD_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE); | 174 | ioremap(mem_base + THIRD_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE); |
154 | 175 | ||
155 | if ((mem_ptr0 == 0UL) || (mem_ptr1 == 0UL) || (mem_ptr2 == 0UL)) { | 176 | if ((mem_ptr0 == 0UL) || (mem_ptr1 == 0UL) || (mem_ptr2 == 0UL)) { |
156 | DPRINTK(1, ERR, | 177 | DPRINTK(ERR, |
157 | "Cannot remap adapter memory aborting.:" | 178 | "Cannot remap adapter memory aborting.:" |
158 | "0 -> %p, 1 -> %p, 2 -> %p\n", | 179 | "0 -> %p, 1 -> %p, 2 -> %p\n", |
159 | mem_ptr0, mem_ptr1, mem_ptr2); | 180 | mem_ptr0, mem_ptr1, mem_ptr2); |
160 | 181 | ||
161 | err = -EIO; | 182 | err = -EIO; |
162 | if (mem_ptr0) | 183 | goto err_out_iounmap; |
163 | iounmap(mem_ptr0); | 184 | } |
164 | if (mem_ptr1) | 185 | db_base = pci_resource_start(pdev, 4); /* doorbell is on bar 4 */ |
165 | iounmap(mem_ptr1); | 186 | db_len = pci_resource_len(pdev, 4); |
166 | if (mem_ptr2) | 187 | |
167 | iounmap(mem_ptr2); | 188 | if (db_len == 0) { |
168 | 189 | printk(KERN_ERR "%s: doorbell is disabled\n", | |
169 | goto err_out_free_res; | 190 | netxen_nic_driver_name); |
191 | err = -EIO; | ||
192 | goto err_out_iounmap; | ||
193 | } | ||
194 | DPRINTK(INFO, "doorbell ioremap from %lx a size of %lx\n", db_base, | ||
195 | db_len); | ||
196 | |||
197 | db_ptr = ioremap(db_base, NETXEN_DB_MAPSIZE_BYTES); | ||
198 | if (db_ptr == 0UL) { | ||
199 | printk(KERN_ERR "%s: Failed to allocate doorbell map.", | ||
200 | netxen_nic_driver_name); | ||
201 | err = -EIO; | ||
202 | goto err_out_iounmap; | ||
170 | } | 203 | } |
204 | DPRINTK(INFO, "doorbell ioremaped at %p\n", db_ptr); | ||
171 | 205 | ||
172 | /* | 206 | /* |
173 | * Allocate a adapter structure which will manage all the initialization | 207 | * Allocate a adapter structure which will manage all the initialization |
@@ -183,17 +217,24 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
183 | netxen_nic_driver_name, | 217 | netxen_nic_driver_name, |
184 | (int)sizeof(struct netxen_adapter)); | 218 | (int)sizeof(struct netxen_adapter)); |
185 | err = -ENOMEM; | 219 | err = -ENOMEM; |
186 | goto err_out_iounmap; | 220 | goto err_out_dbunmap; |
187 | } | 221 | } |
188 | 222 | ||
223 | if (netxen_cards_found == 0) { | ||
224 | g_adapter = adapter; | ||
225 | } | ||
189 | adapter->max_tx_desc_count = MAX_CMD_DESCRIPTORS; | 226 | adapter->max_tx_desc_count = MAX_CMD_DESCRIPTORS; |
190 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS; | 227 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS; |
191 | adapter->max_jumbo_rx_desc_count = MAX_JUMBO_RCV_DESCRIPTORS; | 228 | adapter->max_jumbo_rx_desc_count = MAX_JUMBO_RCV_DESCRIPTORS; |
229 | adapter->max_lro_rx_desc_count = MAX_LRO_RCV_DESCRIPTORS; | ||
192 | 230 | ||
193 | pci_set_drvdata(pdev, adapter); | 231 | pci_set_drvdata(pdev, adapter); |
194 | 232 | ||
195 | cmd_buf_arr = (struct netxen_cmd_buffer *)vmalloc(TX_RINGSIZE); | 233 | cmd_buf_arr = (struct netxen_cmd_buffer *)vmalloc(TX_RINGSIZE); |
196 | if (cmd_buf_arr == NULL) { | 234 | if (cmd_buf_arr == NULL) { |
235 | printk(KERN_ERR | ||
236 | "%s: Could not allocate cmd_buf_arr memory:%d\n", | ||
237 | netxen_nic_driver_name, (int)TX_RINGSIZE); | ||
197 | err = -ENOMEM; | 238 | err = -ENOMEM; |
198 | goto err_out_free_adapter; | 239 | goto err_out_free_adapter; |
199 | } | 240 | } |
@@ -220,11 +261,23 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
220 | rcv_desc->skb_size = MAX_RX_JUMBO_BUFFER_LENGTH; | 261 | rcv_desc->skb_size = MAX_RX_JUMBO_BUFFER_LENGTH; |
221 | break; | 262 | break; |
222 | 263 | ||
264 | case RCV_RING_LRO: | ||
265 | rcv_desc->max_rx_desc_count = | ||
266 | adapter->max_lro_rx_desc_count; | ||
267 | rcv_desc->flags = RCV_DESC_LRO; | ||
268 | rcv_desc->dma_size = RX_LRO_DMA_MAP_LEN; | ||
269 | rcv_desc->skb_size = MAX_RX_LRO_BUFFER_LENGTH; | ||
270 | break; | ||
271 | |||
223 | } | 272 | } |
224 | rcv_desc->rx_buf_arr = (struct netxen_rx_buffer *) | 273 | rcv_desc->rx_buf_arr = (struct netxen_rx_buffer *) |
225 | vmalloc(RCV_BUFFSIZE); | 274 | vmalloc(RCV_BUFFSIZE); |
226 | 275 | ||
227 | if (rcv_desc->rx_buf_arr == NULL) { | 276 | if (rcv_desc->rx_buf_arr == NULL) { |
277 | printk(KERN_ERR "%s: Could not allocate" | ||
278 | "rcv_desc->rx_buf_arr memory:%d\n", | ||
279 | netxen_nic_driver_name, | ||
280 | (int)RCV_BUFFSIZE); | ||
228 | err = -ENOMEM; | 281 | err = -ENOMEM; |
229 | goto err_out_free_rx_buffer; | 282 | goto err_out_free_rx_buffer; |
230 | } | 283 | } |
@@ -233,30 +286,21 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
233 | 286 | ||
234 | } | 287 | } |
235 | 288 | ||
236 | adapter->ops = kzalloc(sizeof(struct netxen_drvops), GFP_KERNEL); | ||
237 | if (adapter->ops == NULL) { | ||
238 | printk(KERN_ERR | ||
239 | "%s: Could not allocate memory for adapter->ops:%d\n", | ||
240 | netxen_nic_driver_name, | ||
241 | (int)sizeof(struct netxen_adapter)); | ||
242 | err = -ENOMEM; | ||
243 | goto err_out_free_rx_buffer; | ||
244 | } | ||
245 | |||
246 | adapter->cmd_buf_arr = cmd_buf_arr; | 289 | adapter->cmd_buf_arr = cmd_buf_arr; |
247 | adapter->ahw.pci_base0 = mem_ptr0; | 290 | adapter->ahw.pci_base0 = mem_ptr0; |
248 | adapter->ahw.pci_base1 = mem_ptr1; | 291 | adapter->ahw.pci_base1 = mem_ptr1; |
249 | adapter->ahw.pci_base2 = mem_ptr2; | 292 | adapter->ahw.pci_base2 = mem_ptr2; |
293 | adapter->ahw.db_base = db_ptr; | ||
294 | adapter->ahw.db_len = db_len; | ||
250 | spin_lock_init(&adapter->tx_lock); | 295 | spin_lock_init(&adapter->tx_lock); |
251 | spin_lock_init(&adapter->lock); | 296 | spin_lock_init(&adapter->lock); |
297 | netxen_initialize_adapter_sw(adapter); /* initialize the buffers in adapter */ | ||
252 | #ifdef CONFIG_IA64 | 298 | #ifdef CONFIG_IA64 |
253 | netxen_pinit_from_rom(adapter, 0); | 299 | netxen_pinit_from_rom(adapter, 0); |
254 | udelay(500); | 300 | udelay(500); |
255 | netxen_load_firmware(adapter); | 301 | netxen_load_firmware(adapter); |
256 | #endif | 302 | #endif |
257 | 303 | ||
258 | /* initialize the buffers in adapter */ | ||
259 | netxen_initialize_adapter_sw(adapter); | ||
260 | /* | 304 | /* |
261 | * Set the CRB window to invalid. If any register in window 0 is | 305 | * Set the CRB window to invalid. If any register in window 0 is |
262 | * accessed it should set the window to 0 and then reset it to 1. | 306 | * accessed it should set the window to 0 and then reset it to 1. |
@@ -277,7 +321,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
277 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); | 321 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); |
278 | adapter->ahw.pdev = pdev; | 322 | adapter->ahw.pdev = pdev; |
279 | adapter->proc_cmd_buf_counter = 0; | 323 | adapter->proc_cmd_buf_counter = 0; |
280 | pci_read_config_byte(pdev, PCI_REVISION_ID, &adapter->ahw.revision_id); | 324 | adapter->ahw.revision_id = nx_p2_id; |
281 | 325 | ||
282 | if (pci_enable_msi(pdev)) { | 326 | if (pci_enable_msi(pdev)) { |
283 | adapter->flags &= ~NETXEN_NIC_MSI_ENABLED; | 327 | adapter->flags &= ~NETXEN_NIC_MSI_ENABLED; |
@@ -299,6 +343,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
299 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMD_CONSUMER_OFFSET)); | 343 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMD_CONSUMER_OFFSET)); |
300 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_CMD_ADDR_LO)); | 344 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_CMD_ADDR_LO)); |
301 | 345 | ||
346 | /* do this before waking up pegs so that we have valid dummy dma addr */ | ||
347 | err = netxen_initialize_adapter_offload(adapter); | ||
348 | if (err) { | ||
349 | goto err_out_free_dev; | ||
350 | } | ||
351 | |||
302 | /* Unlock the HW, prompting the boot sequence */ | 352 | /* Unlock the HW, prompting the boot sequence */ |
303 | writel(1, | 353 | writel(1, |
304 | NETXEN_CRB_NORMALIZE(adapter, NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); | 354 | NETXEN_CRB_NORMALIZE(adapter, NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); |
@@ -307,6 +357,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
307 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 357 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
308 | 358 | ||
309 | /* initialize the all the ports */ | 359 | /* initialize the all the ports */ |
360 | adapter->active_ports = 0; | ||
310 | 361 | ||
311 | for (i = 0; i < adapter->ahw.max_ports; i++) { | 362 | for (i = 0; i < adapter->ahw.max_ports; i++) { |
312 | netdev = alloc_etherdev(sizeof(struct netxen_port)); | 363 | netdev = alloc_etherdev(sizeof(struct netxen_port)); |
@@ -372,10 +423,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
372 | netdev->dev_addr[4], | 423 | netdev->dev_addr[4], |
373 | netdev->dev_addr[5]); | 424 | netdev->dev_addr[5]); |
374 | } else { | 425 | } else { |
375 | if (adapter->ops->macaddr_set) | 426 | if (adapter->macaddr_set) |
376 | adapter->ops->macaddr_set(port, | 427 | adapter->macaddr_set(port, |
377 | netdev-> | 428 | netdev->dev_addr); |
378 | dev_addr); | ||
379 | } | 429 | } |
380 | } | 430 | } |
381 | adapter->netdev = netdev; | 431 | adapter->netdev = netdev; |
@@ -391,7 +441,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
391 | goto err_out_free_dev; | 441 | goto err_out_free_dev; |
392 | } | 442 | } |
393 | adapter->port_count++; | 443 | adapter->port_count++; |
394 | adapter->active_ports = 0; | ||
395 | adapter->port[i] = port; | 444 | adapter->port[i] = port; |
396 | } | 445 | } |
397 | 446 | ||
@@ -412,6 +461,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
412 | break; | 461 | break; |
413 | } | 462 | } |
414 | 463 | ||
464 | adapter->number = netxen_cards_found; | ||
415 | adapter->driver_mismatch = 0; | 465 | adapter->driver_mismatch = 0; |
416 | 466 | ||
417 | return 0; | 467 | return 0; |
@@ -426,7 +476,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
426 | free_netdev(port->netdev); | 476 | free_netdev(port->netdev); |
427 | } | 477 | } |
428 | } | 478 | } |
429 | kfree(adapter->ops); | 479 | |
480 | netxen_free_adapter_offload(adapter); | ||
430 | 481 | ||
431 | err_out_free_rx_buffer: | 482 | err_out_free_rx_buffer: |
432 | for (i = 0; i < MAX_RCV_CTX; ++i) { | 483 | for (i = 0; i < MAX_RCV_CTX; ++i) { |
@@ -439,19 +490,23 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
439 | } | 490 | } |
440 | } | 491 | } |
441 | } | 492 | } |
442 | |||
443 | vfree(cmd_buf_arr); | 493 | vfree(cmd_buf_arr); |
444 | 494 | ||
445 | kfree(adapter->port); | ||
446 | |||
447 | err_out_free_adapter: | 495 | err_out_free_adapter: |
448 | pci_set_drvdata(pdev, NULL); | 496 | pci_set_drvdata(pdev, NULL); |
449 | kfree(adapter); | 497 | kfree(adapter); |
450 | 498 | ||
499 | err_out_dbunmap: | ||
500 | if (db_ptr) | ||
501 | iounmap(db_ptr); | ||
502 | |||
451 | err_out_iounmap: | 503 | err_out_iounmap: |
452 | iounmap(mem_ptr0); | 504 | if (mem_ptr0) |
453 | iounmap(mem_ptr1); | 505 | iounmap(mem_ptr0); |
454 | iounmap(mem_ptr2); | 506 | if (mem_ptr1) |
507 | iounmap(mem_ptr1); | ||
508 | if (mem_ptr2) | ||
509 | iounmap(mem_ptr2); | ||
455 | 510 | ||
456 | err_out_free_res: | 511 | err_out_free_res: |
457 | pci_release_regions(pdev); | 512 | pci_release_regions(pdev); |
@@ -476,12 +531,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
476 | 531 | ||
477 | netxen_nic_stop_all_ports(adapter); | 532 | netxen_nic_stop_all_ports(adapter); |
478 | /* leave the hw in the same state as reboot */ | 533 | /* leave the hw in the same state as reboot */ |
479 | netxen_pinit_from_rom(adapter, 0); | ||
480 | udelay(500); | ||
481 | netxen_load_firmware(adapter); | 534 | netxen_load_firmware(adapter); |
482 | 535 | netxen_free_adapter_offload(adapter); | |
483 | if ((adapter->flags & NETXEN_NIC_MSI_ENABLED)) | ||
484 | netxen_nic_disable_int(adapter); | ||
485 | 536 | ||
486 | udelay(500); /* Delay for a while to drain the DMA engines */ | 537 | udelay(500); /* Delay for a while to drain the DMA engines */ |
487 | for (i = 0; i < adapter->port_count; i++) { | 538 | for (i = 0; i < adapter->port_count; i++) { |
@@ -498,6 +549,7 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
498 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) | 549 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) |
499 | netxen_free_hw_resources(adapter); | 550 | netxen_free_hw_resources(adapter); |
500 | 551 | ||
552 | iounmap(adapter->ahw.db_base); | ||
501 | iounmap(adapter->ahw.pci_base0); | 553 | iounmap(adapter->ahw.pci_base0); |
502 | iounmap(adapter->ahw.pci_base1); | 554 | iounmap(adapter->ahw.pci_base1); |
503 | iounmap(adapter->ahw.pci_base2); | 555 | iounmap(adapter->ahw.pci_base2); |
@@ -524,7 +576,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
524 | } | 576 | } |
525 | 577 | ||
526 | vfree(adapter->cmd_buf_arr); | 578 | vfree(adapter->cmd_buf_arr); |
527 | kfree(adapter->ops); | ||
528 | kfree(adapter); | 579 | kfree(adapter); |
529 | } | 580 | } |
530 | 581 | ||
@@ -546,6 +597,8 @@ static int netxen_nic_open(struct net_device *netdev) | |||
546 | return -EIO; | 597 | return -EIO; |
547 | } | 598 | } |
548 | netxen_nic_flash_print(adapter); | 599 | netxen_nic_flash_print(adapter); |
600 | if (adapter->init_niu) | ||
601 | adapter->init_niu(adapter); | ||
549 | 602 | ||
550 | /* setup all the resources for the Phantom... */ | 603 | /* setup all the resources for the Phantom... */ |
551 | /* this include the descriptors for rcv, tx, and status */ | 604 | /* this include the descriptors for rcv, tx, and status */ |
@@ -556,32 +609,31 @@ static int netxen_nic_open(struct net_device *netdev) | |||
556 | err); | 609 | err); |
557 | return err; | 610 | return err; |
558 | } | 611 | } |
559 | if (adapter->ops->init_port | 612 | if (adapter->init_port |
560 | && adapter->ops->init_port(adapter, port->portnum) != 0) { | 613 | && adapter->init_port(adapter, port->portnum) != 0) { |
561 | printk(KERN_ERR "%s: Failed to initialize port %d\n", | 614 | printk(KERN_ERR "%s: Failed to initialize port %d\n", |
562 | netxen_nic_driver_name, port->portnum); | 615 | netxen_nic_driver_name, port->portnum); |
563 | netxen_free_hw_resources(adapter); | 616 | netxen_free_hw_resources(adapter); |
564 | return -EIO; | 617 | return -EIO; |
565 | } | 618 | } |
566 | if (adapter->ops->init_niu) | ||
567 | adapter->ops->init_niu(adapter); | ||
568 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { | 619 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { |
569 | for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) | 620 | for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) |
570 | netxen_post_rx_buffers(adapter, ctx, ring); | 621 | netxen_post_rx_buffers(adapter, ctx, ring); |
571 | } | 622 | } |
572 | adapter->is_up = NETXEN_ADAPTER_UP_MAGIC; | 623 | adapter->irq = adapter->ahw.pdev->irq; |
573 | } | ||
574 | adapter->active_ports++; | ||
575 | if (adapter->active_ports == 1) { | ||
576 | err = request_irq(adapter->ahw.pdev->irq, &netxen_intr, | 624 | err = request_irq(adapter->ahw.pdev->irq, &netxen_intr, |
577 | SA_SHIRQ | SA_SAMPLE_RANDOM, netdev->name, | 625 | SA_SHIRQ | SA_SAMPLE_RANDOM, netdev->name, |
578 | adapter); | 626 | adapter); |
579 | if (err) { | 627 | if (err) { |
580 | printk(KERN_ERR "request_irq failed with: %d\n", err); | 628 | printk(KERN_ERR "request_irq failed with: %d\n", err); |
581 | adapter->active_ports--; | 629 | netxen_free_hw_resources(adapter); |
582 | return err; | 630 | return err; |
583 | } | 631 | } |
584 | adapter->irq = adapter->ahw.pdev->irq; | 632 | |
633 | adapter->is_up = NETXEN_ADAPTER_UP_MAGIC; | ||
634 | } | ||
635 | adapter->active_ports++; | ||
636 | if (adapter->active_ports == 1) { | ||
585 | if (!adapter->driver_mismatch) | 637 | if (!adapter->driver_mismatch) |
586 | mod_timer(&adapter->watchdog_timer, jiffies); | 638 | mod_timer(&adapter->watchdog_timer, jiffies); |
587 | 639 | ||
@@ -590,11 +642,14 @@ static int netxen_nic_open(struct net_device *netdev) | |||
590 | 642 | ||
591 | /* Done here again so that even if phantom sw overwrote it, | 643 | /* Done here again so that even if phantom sw overwrote it, |
592 | * we set it */ | 644 | * we set it */ |
593 | if (adapter->ops->macaddr_set) | 645 | if (adapter->macaddr_set) |
594 | adapter->ops->macaddr_set(port, netdev->dev_addr); | 646 | adapter->macaddr_set(port, netdev->dev_addr); |
595 | netxen_nic_set_link_parameters(port); | 647 | netxen_nic_set_link_parameters(port); |
596 | 648 | ||
597 | netxen_nic_set_multi(netdev); | 649 | netxen_nic_set_multi(netdev); |
650 | if (adapter->set_mtu) | ||
651 | adapter->set_mtu(port, netdev->mtu); | ||
652 | |||
598 | if (!adapter->driver_mismatch) | 653 | if (!adapter->driver_mismatch) |
599 | netif_start_queue(netdev); | 654 | netif_start_queue(netdev); |
600 | 655 | ||
@@ -647,6 +702,7 @@ static int netxen_nic_close(struct net_device *netdev) | |||
647 | } | 702 | } |
648 | cmd_buff++; | 703 | cmd_buff++; |
649 | } | 704 | } |
705 | FLUSH_SCHEDULED_WORK(); | ||
650 | del_timer_sync(&adapter->watchdog_timer); | 706 | del_timer_sync(&adapter->watchdog_timer); |
651 | } | 707 | } |
652 | 708 | ||
@@ -667,7 +723,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
667 | struct cmd_desc_type0 *hwdesc; | 723 | struct cmd_desc_type0 *hwdesc; |
668 | int k; | 724 | int k; |
669 | struct netxen_cmd_buffer *pbuf = NULL; | 725 | struct netxen_cmd_buffer *pbuf = NULL; |
670 | unsigned int tries = 0; | ||
671 | static int dropped_packet = 0; | 726 | static int dropped_packet = 0; |
672 | int frag_count; | 727 | int frag_count; |
673 | u32 local_producer = 0; | 728 | u32 local_producer = 0; |
@@ -729,7 +784,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
729 | if (((skb->nh.iph)->ihl * sizeof(u32)) + | 784 | if (((skb->nh.iph)->ihl * sizeof(u32)) + |
730 | ((skb->h.th)->doff * sizeof(u32)) + | 785 | ((skb->h.th)->doff * sizeof(u32)) + |
731 | sizeof(struct ethhdr) > | 786 | sizeof(struct ethhdr) > |
732 | (sizeof(struct cmd_desc_type0) - NET_IP_ALIGN)) { | 787 | (sizeof(struct cmd_desc_type0) - 2)) { |
733 | no_of_desc++; | 788 | no_of_desc++; |
734 | } | 789 | } |
735 | } | 790 | } |
@@ -740,27 +795,17 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
740 | if ((k + no_of_desc) >= | 795 | if ((k + no_of_desc) >= |
741 | ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count : | 796 | ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count : |
742 | last_cmd_consumer)) { | 797 | last_cmd_consumer)) { |
798 | port->stats.nocmddescriptor++; | ||
799 | DPRINTK(ERR, "No command descriptors available," | ||
800 | " producer = %d, consumer = %d count=%llu," | ||
801 | " dropping packet\n", producer, | ||
802 | adapter->last_cmd_consumer, | ||
803 | port->stats.nocmddescriptor); | ||
804 | |||
805 | netif_stop_queue(netdev); | ||
806 | port->flags |= NETXEN_NETDEV_STATUS; | ||
743 | spin_unlock_bh(&adapter->tx_lock); | 807 | spin_unlock_bh(&adapter->tx_lock); |
744 | if (tries == 0) { | 808 | return NETDEV_TX_BUSY; |
745 | local_bh_disable(); | ||
746 | netxen_process_cmd_ring((unsigned long)adapter); | ||
747 | local_bh_enable(); | ||
748 | ++tries; | ||
749 | goto retry_getting_window; | ||
750 | } else { | ||
751 | port->stats.nocmddescriptor++; | ||
752 | DPRINTK(ERR, "No command descriptors available," | ||
753 | " producer = %d, consumer = %d count=%llu," | ||
754 | " dropping packet\n", producer, | ||
755 | adapter->last_cmd_consumer, | ||
756 | port->stats.nocmddescriptor); | ||
757 | |||
758 | spin_lock_bh(&adapter->tx_lock); | ||
759 | netif_stop_queue(netdev); | ||
760 | port->flags |= NETXEN_NETDEV_STATUS; | ||
761 | spin_unlock_bh(&adapter->tx_lock); | ||
762 | return NETDEV_TX_BUSY; | ||
763 | } | ||
764 | } | 809 | } |
765 | k = get_index_range(k, max_tx_desc_count, no_of_desc); | 810 | k = get_index_range(k, max_tx_desc_count, no_of_desc); |
766 | adapter->cmd_producer = k; | 811 | adapter->cmd_producer = k; |
@@ -782,7 +827,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
782 | pbuf->mss = 0; | 827 | pbuf->mss = 0; |
783 | hwdesc->mss = 0; | 828 | hwdesc->mss = 0; |
784 | } | 829 | } |
785 | pbuf->no_of_descriptors = no_of_desc; | ||
786 | pbuf->total_length = skb->len; | 830 | pbuf->total_length = skb->len; |
787 | pbuf->skb = skb; | 831 | pbuf->skb = skb; |
788 | pbuf->cmd = TX_ETHER_PKT; | 832 | pbuf->cmd = TX_ETHER_PKT; |
@@ -792,11 +836,11 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
792 | buffrag->dma = pci_map_single(port->pdev, skb->data, first_seg_len, | 836 | buffrag->dma = pci_map_single(port->pdev, skb->data, first_seg_len, |
793 | PCI_DMA_TODEVICE); | 837 | PCI_DMA_TODEVICE); |
794 | buffrag->length = first_seg_len; | 838 | buffrag->length = first_seg_len; |
795 | CMD_DESC_TOTAL_LENGTH_WRT(hwdesc, skb->len); | 839 | netxen_set_cmd_desc_totallength(hwdesc, skb->len); |
796 | hwdesc->num_of_buffers = frag_count; | 840 | netxen_set_cmd_desc_num_of_buff(hwdesc, frag_count); |
797 | hwdesc->opcode = TX_ETHER_PKT; | 841 | netxen_set_cmd_desc_opcode(hwdesc, TX_ETHER_PKT); |
798 | 842 | ||
799 | CMD_DESC_PORT_WRT(hwdesc, port->portnum); | 843 | netxen_set_cmd_desc_port(hwdesc, port->portnum); |
800 | hwdesc->buffer1_length = cpu_to_le16(first_seg_len); | 844 | hwdesc->buffer1_length = cpu_to_le16(first_seg_len); |
801 | hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); | 845 | hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); |
802 | 846 | ||
@@ -855,12 +899,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
855 | /* For LSO, we need to copy the MAC/IP/TCP headers into | 899 | /* For LSO, we need to copy the MAC/IP/TCP headers into |
856 | * the descriptor ring | 900 | * the descriptor ring |
857 | */ | 901 | */ |
858 | if (hw->cmd_desc_head[saved_producer].opcode == TX_TCP_LSO) { | 902 | if (netxen_get_cmd_desc_opcode(&hw->cmd_desc_head[saved_producer]) |
903 | == TX_TCP_LSO) { | ||
859 | int hdr_len, first_hdr_len, more_hdr; | 904 | int hdr_len, first_hdr_len, more_hdr; |
860 | hdr_len = hw->cmd_desc_head[saved_producer].total_hdr_length; | 905 | hdr_len = hw->cmd_desc_head[saved_producer].total_hdr_length; |
861 | if (hdr_len > (sizeof(struct cmd_desc_type0) - NET_IP_ALIGN)) { | 906 | if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) { |
862 | first_hdr_len = | 907 | first_hdr_len = sizeof(struct cmd_desc_type0) - 2; |
863 | sizeof(struct cmd_desc_type0) - NET_IP_ALIGN; | ||
864 | more_hdr = 1; | 908 | more_hdr = 1; |
865 | } else { | 909 | } else { |
866 | first_hdr_len = hdr_len; | 910 | first_hdr_len = hdr_len; |
@@ -870,7 +914,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
870 | hwdesc = &hw->cmd_desc_head[producer]; | 914 | hwdesc = &hw->cmd_desc_head[producer]; |
871 | 915 | ||
872 | /* copy the first 64 bytes */ | 916 | /* copy the first 64 bytes */ |
873 | memcpy(((void *)hwdesc) + NET_IP_ALIGN, | 917 | memcpy(((void *)hwdesc) + 2, |
874 | (void *)(skb->data), first_hdr_len); | 918 | (void *)(skb->data), first_hdr_len); |
875 | producer = get_next_index(producer, max_tx_desc_count); | 919 | producer = get_next_index(producer, max_tx_desc_count); |
876 | 920 | ||
@@ -886,7 +930,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
886 | } | 930 | } |
887 | spin_lock_bh(&adapter->tx_lock); | 931 | spin_lock_bh(&adapter->tx_lock); |
888 | port->stats.txbytes += | 932 | port->stats.txbytes += |
889 | CMD_DESC_TOTAL_LENGTH(&hw->cmd_desc_head[saved_producer]); | 933 | netxen_get_cmd_desc_totallength(&hw->cmd_desc_head[saved_producer]); |
890 | /* Code to update the adapter considering how many producer threads | 934 | /* Code to update the adapter considering how many producer threads |
891 | are currently working */ | 935 | are currently working */ |
892 | if ((--adapter->num_threads) == 0) { | 936 | if ((--adapter->num_threads) == 0) { |
@@ -896,20 +940,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
896 | NETXEN_CRB_NORMALIZE(adapter, CRB_CMD_PRODUCER_OFFSET)); | 940 | NETXEN_CRB_NORMALIZE(adapter, CRB_CMD_PRODUCER_OFFSET)); |
897 | wmb(); | 941 | wmb(); |
898 | adapter->total_threads = 0; | 942 | adapter->total_threads = 0; |
899 | } else { | ||
900 | u32 crb_producer = 0; | ||
901 | crb_producer = | ||
902 | readl(NETXEN_CRB_NORMALIZE | ||
903 | (adapter, CRB_CMD_PRODUCER_OFFSET)); | ||
904 | if (crb_producer == local_producer) { | ||
905 | crb_producer = get_index_range(crb_producer, | ||
906 | max_tx_desc_count, | ||
907 | no_of_desc); | ||
908 | writel(crb_producer, | ||
909 | NETXEN_CRB_NORMALIZE(adapter, | ||
910 | CRB_CMD_PRODUCER_OFFSET)); | ||
911 | wmb(); | ||
912 | } | ||
913 | } | 943 | } |
914 | 944 | ||
915 | port->stats.xmitfinished++; | 945 | port->stats.xmitfinished++; |
@@ -926,15 +956,20 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
926 | static void netxen_watchdog(unsigned long v) | 956 | static void netxen_watchdog(unsigned long v) |
927 | { | 957 | { |
928 | struct netxen_adapter *adapter = (struct netxen_adapter *)v; | 958 | struct netxen_adapter *adapter = (struct netxen_adapter *)v; |
929 | schedule_work(&adapter->watchdog_task); | 959 | if (adapter != g_adapter) { |
960 | printk("%s: ***BUG*** adapter[%p] != g_adapter[%p]\n", | ||
961 | __FUNCTION__, adapter, g_adapter); | ||
962 | return; | ||
963 | } | ||
964 | |||
965 | SCHEDULE_WORK(&adapter->watchdog_task); | ||
930 | } | 966 | } |
931 | 967 | ||
932 | static void netxen_tx_timeout(struct net_device *netdev) | 968 | static void netxen_tx_timeout(struct net_device *netdev) |
933 | { | 969 | { |
934 | struct netxen_port *port = (struct netxen_port *)netdev_priv(netdev); | 970 | struct netxen_port *port = (struct netxen_port *)netdev_priv(netdev); |
935 | struct netxen_adapter *adapter = port->adapter; | ||
936 | 971 | ||
937 | schedule_work(&adapter->tx_timeout_task); | 972 | SCHEDULE_WORK(&port->adapter->tx_timeout_task); |
938 | } | 973 | } |
939 | 974 | ||
940 | static void netxen_tx_timeout_task(struct work_struct *work) | 975 | static void netxen_tx_timeout_task(struct work_struct *work) |
@@ -967,6 +1002,11 @@ netxen_handle_int(struct netxen_adapter *adapter, struct net_device *netdev) | |||
967 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { | 1002 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { |
968 | int count = 0; | 1003 | int count = 0; |
969 | u32 mask; | 1004 | u32 mask; |
1005 | mask = readl(pci_base_offset(adapter, ISR_INT_VECTOR)); | ||
1006 | if ((mask & 0x80) == 0) { | ||
1007 | /* not our interrupt */ | ||
1008 | return ret; | ||
1009 | } | ||
970 | netxen_nic_disable_int(adapter); | 1010 | netxen_nic_disable_int(adapter); |
971 | /* Window = 0 or 1 */ | 1011 | /* Window = 0 or 1 */ |
972 | do { | 1012 | do { |
@@ -1026,7 +1066,10 @@ irqreturn_t netxen_intr(int irq, void *data) | |||
1026 | netdev = port->netdev; | 1066 | netdev = port->netdev; |
1027 | 1067 | ||
1028 | /* process our status queue (for all 4 ports) */ | 1068 | /* process our status queue (for all 4 ports) */ |
1029 | netxen_handle_int(adapter, netdev); | 1069 | if (netif_running(netdev)) { |
1070 | netxen_handle_int(adapter, netdev); | ||
1071 | break; | ||
1072 | } | ||
1030 | } | 1073 | } |
1031 | 1074 | ||
1032 | return IRQ_HANDLED; | 1075 | return IRQ_HANDLED; |
@@ -1040,11 +1083,12 @@ static int netxen_nic_poll(struct net_device *netdev, int *budget) | |||
1040 | int done = 1; | 1083 | int done = 1; |
1041 | int ctx; | 1084 | int ctx; |
1042 | int this_work_done; | 1085 | int this_work_done; |
1086 | int work_done = 0; | ||
1043 | 1087 | ||
1044 | DPRINTK(INFO, "polling for %d descriptors\n", *budget); | 1088 | DPRINTK(INFO, "polling for %d descriptors\n", *budget); |
1045 | port->stats.polled++; | 1089 | port->stats.polled++; |
1046 | 1090 | ||
1047 | adapter->work_done = 0; | 1091 | work_done = 0; |
1048 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { | 1092 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { |
1049 | /* | 1093 | /* |
1050 | * Fairness issue. This will give undue weight to the | 1094 | * Fairness issue. This will give undue weight to the |
@@ -1061,20 +1105,20 @@ static int netxen_nic_poll(struct net_device *netdev, int *budget) | |||
1061 | this_work_done = netxen_process_rcv_ring(adapter, ctx, | 1105 | this_work_done = netxen_process_rcv_ring(adapter, ctx, |
1062 | work_to_do / | 1106 | work_to_do / |
1063 | MAX_RCV_CTX); | 1107 | MAX_RCV_CTX); |
1064 | adapter->work_done += this_work_done; | 1108 | work_done += this_work_done; |
1065 | } | 1109 | } |
1066 | 1110 | ||
1067 | netdev->quota -= adapter->work_done; | 1111 | netdev->quota -= work_done; |
1068 | *budget -= adapter->work_done; | 1112 | *budget -= work_done; |
1069 | 1113 | ||
1070 | if (adapter->work_done >= work_to_do | 1114 | if (work_done >= work_to_do && netxen_nic_rx_has_work(adapter) != 0) |
1071 | && netxen_nic_rx_has_work(adapter) != 0) | ||
1072 | done = 0; | 1115 | done = 0; |
1073 | 1116 | ||
1074 | netxen_process_cmd_ring((unsigned long)adapter); | 1117 | if (netxen_process_cmd_ring((unsigned long)adapter) == 0) |
1118 | done = 0; | ||
1075 | 1119 | ||
1076 | DPRINTK(INFO, "new work_done: %d work_to_do: %d\n", | 1120 | DPRINTK(INFO, "new work_done: %d work_to_do: %d\n", |
1077 | adapter->work_done, work_to_do); | 1121 | work_done, work_to_do); |
1078 | if (done) { | 1122 | if (done) { |
1079 | netif_rx_complete(netdev); | 1123 | netif_rx_complete(netdev); |
1080 | netxen_nic_enable_int(adapter); | 1124 | netxen_nic_enable_int(adapter); |
@@ -1117,8 +1161,9 @@ netxen_nic_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
1117 | if (ifr->ifr_data) { | 1161 | if (ifr->ifr_data) { |
1118 | sprintf(dev_name, "%s-%d", NETXEN_NIC_NAME_RSP, | 1162 | sprintf(dev_name, "%s-%d", NETXEN_NIC_NAME_RSP, |
1119 | port->portnum); | 1163 | port->portnum); |
1120 | nr_bytes = copy_to_user((char *)ifr->ifr_data, dev_name, | 1164 | nr_bytes = |
1121 | NETXEN_NIC_NAME_LEN); | 1165 | copy_to_user((char __user *)ifr->ifr_data, dev_name, |
1166 | NETXEN_NIC_NAME_LEN); | ||
1122 | if (nr_bytes) | 1167 | if (nr_bytes) |
1123 | err = -EIO; | 1168 | err = -EIO; |
1124 | 1169 | ||
@@ -1145,6 +1190,9 @@ static struct pci_driver netxen_driver = { | |||
1145 | 1190 | ||
1146 | static int __init netxen_init_module(void) | 1191 | static int __init netxen_init_module(void) |
1147 | { | 1192 | { |
1193 | if ((netxen_workq = create_singlethread_workqueue("netxen")) == 0) | ||
1194 | return -ENOMEM; | ||
1195 | |||
1148 | return pci_module_init(&netxen_driver); | 1196 | return pci_module_init(&netxen_driver); |
1149 | } | 1197 | } |
1150 | 1198 | ||
@@ -1155,7 +1203,7 @@ static void __exit netxen_exit_module(void) | |||
1155 | /* | 1203 | /* |
1156 | * Wait for some time to allow the dma to drain, if any. | 1204 | * Wait for some time to allow the dma to drain, if any. |
1157 | */ | 1205 | */ |
1158 | mdelay(5); | 1206 | destroy_workqueue(netxen_workq); |
1159 | pci_unregister_driver(&netxen_driver); | 1207 | pci_unregister_driver(&netxen_driver); |
1160 | } | 1208 | } |
1161 | 1209 | ||
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index 7950a04532e6..4987dc765d99 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 - 2006 NetXen, Inc. | 2 | * Copyright (C) 2003 - 2006 NetXen, Inc. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License | 6 | * modify it under the terms of the GNU General Public License |
7 | * as published by the Free Software Foundation; either version 2 | 7 | * as published by the Free Software Foundation; either version 2 |
@@ -16,10 +16,10 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
18 | * MA 02111-1307, USA. | 18 | * MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * The full GNU General Public License is included in this distribution | 20 | * The full GNU General Public License is included in this distribution |
21 | * in the file called LICENSE. | 21 | * in the file called LICENSE. |
22 | * | 22 | * |
23 | * Contact Information: | 23 | * Contact Information: |
24 | * info@netxen.com | 24 | * info@netxen.com |
25 | * NetXen, | 25 | * NetXen, |
@@ -40,13 +40,15 @@ | |||
40 | 40 | ||
41 | static long phy_lock_timeout = 100000000; | 41 | static long phy_lock_timeout = 100000000; |
42 | 42 | ||
43 | static inline int phy_lock(void) | 43 | static inline int phy_lock(struct netxen_adapter *adapter) |
44 | { | 44 | { |
45 | int i; | 45 | int i; |
46 | int done = 0, timeout = 0; | 46 | int done = 0, timeout = 0; |
47 | 47 | ||
48 | while (!done) { | 48 | while (!done) { |
49 | done = readl((void __iomem *)NETXEN_PCIE_REG(PCIE_SEM3_LOCK)); | 49 | done = |
50 | readl(pci_base_offset | ||
51 | (adapter, NETXEN_PCIE_REG(PCIE_SEM3_LOCK))); | ||
50 | if (done == 1) | 52 | if (done == 1) |
51 | break; | 53 | break; |
52 | if (timeout >= phy_lock_timeout) { | 54 | if (timeout >= phy_lock_timeout) { |
@@ -61,13 +63,15 @@ static inline int phy_lock(void) | |||
61 | } | 63 | } |
62 | } | 64 | } |
63 | 65 | ||
64 | writel(NETXEN_PHY_LOCK_ID, (void __iomem *)PHY_LOCK_DRIVER); | 66 | writel(PHY_LOCK_DRIVER, |
67 | NETXEN_CRB_NORMALIZE(adapter, NETXEN_PHY_LOCK_ID)); | ||
65 | return 0; | 68 | return 0; |
66 | } | 69 | } |
67 | 70 | ||
68 | static inline int phy_unlock(void) | 71 | static inline int phy_unlock(struct netxen_adapter *adapter) |
69 | { | 72 | { |
70 | readl((void __iomem *)NETXEN_PCIE_REG(PCIE_SEM3_UNLOCK)); | 73 | readl(pci_base_offset(adapter, NETXEN_PCIE_REG(PCIE_SEM3_UNLOCK))); |
74 | |||
71 | return 0; | 75 | return 0; |
72 | } | 76 | } |
73 | 77 | ||
@@ -95,7 +99,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, | |||
95 | __le32 status; | 99 | __le32 status; |
96 | __le32 mac_cfg0; | 100 | __le32 mac_cfg0; |
97 | 101 | ||
98 | if (phy_lock() != 0) { | 102 | if (phy_lock(adapter) != 0) { |
99 | return -1; | 103 | return -1; |
100 | } | 104 | } |
101 | 105 | ||
@@ -162,7 +166,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, | |||
162 | NETXEN_NIU_GB_MAC_CONFIG_0(0), | 166 | NETXEN_NIU_GB_MAC_CONFIG_0(0), |
163 | &mac_cfg0, 4)) | 167 | &mac_cfg0, 4)) |
164 | return -EIO; | 168 | return -EIO; |
165 | phy_unlock(); | 169 | phy_unlock(adapter); |
166 | return result; | 170 | return result; |
167 | } | 171 | } |
168 | 172 | ||
@@ -399,8 +403,8 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
399 | { | 403 | { |
400 | int result = 0; | 404 | int result = 0; |
401 | __le32 status; | 405 | __le32 status; |
402 | if (adapter->ops->disable_phy_interrupts) | 406 | if (adapter->disable_phy_interrupts) |
403 | adapter->ops->disable_phy_interrupts(adapter, port); | 407 | adapter->disable_phy_interrupts(adapter, port); |
404 | mdelay(2); | 408 | mdelay(2); |
405 | 409 | ||
406 | if (0 == | 410 | if (0 == |
@@ -612,7 +616,7 @@ int netxen_niu_macaddr_set(struct netxen_port *port, | |||
612 | __le32 temp = 0; | 616 | __le32 temp = 0; |
613 | struct netxen_adapter *adapter = port->adapter; | 617 | struct netxen_adapter *adapter = port->adapter; |
614 | int phy = port->portnum; | 618 | int phy = port->portnum; |
615 | unsigned char mac_addr[MAX_ADDR_LEN]; | 619 | unsigned char mac_addr[6]; |
616 | int i; | 620 | int i; |
617 | 621 | ||
618 | for (i = 0; i < 10; i++) { | 622 | for (i = 0; i < 10; i++) { |
@@ -631,7 +635,7 @@ int netxen_niu_macaddr_set(struct netxen_port *port, | |||
631 | 635 | ||
632 | netxen_niu_macaddr_get(adapter, phy, | 636 | netxen_niu_macaddr_get(adapter, phy, |
633 | (netxen_ethernet_macaddr_t *) mac_addr); | 637 | (netxen_ethernet_macaddr_t *) mac_addr); |
634 | if (memcmp(mac_addr, addr, MAX_ADDR_LEN == 0)) | 638 | if (memcmp(mac_addr, addr, 6) == 0) |
635 | break; | 639 | break; |
636 | } | 640 | } |
637 | 641 | ||
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h index 8181d436783f..7879f855af0b 100644 --- a/drivers/net/netxen/netxen_nic_phan_reg.h +++ b/drivers/net/netxen/netxen_nic_phan_reg.h | |||
@@ -33,15 +33,74 @@ | |||
33 | /* | 33 | /* |
34 | * CRB Registers or queue message done only at initialization time. | 34 | * CRB Registers or queue message done only at initialization time. |
35 | */ | 35 | */ |
36 | #define NIC_CRB_BASE NETXEN_CAM_RAM(0x200) | ||
37 | #define NETXEN_NIC_REG(X) (NIC_CRB_BASE+(X)) | ||
36 | 38 | ||
37 | /* | 39 | #define CRB_PHAN_CNTRL_LO_OFFSET NETXEN_NIC_REG(0x00) |
38 | * The following 2 are the base adresses for the CRB registers and their | 40 | #define CRB_PHAN_CNTRL_HI_OFFSET NETXEN_NIC_REG(0x04) |
39 | * offsets will be added to get addresses for the index addresses. | 41 | #define CRB_CMD_PRODUCER_OFFSET NETXEN_NIC_REG(0x08) |
40 | */ | 42 | #define CRB_CMD_CONSUMER_OFFSET NETXEN_NIC_REG(0x0c) |
41 | #define NIC_CRB_BASE_PORT1 NETXEN_CAM_RAM(0x200) | 43 | #define CRB_PAUSE_ADDR_LO NETXEN_NIC_REG(0x10) /* C0 EPG BUG */ |
42 | #define NIC_CRB_BASE_PORT2 NETXEN_CAM_RAM(0x250) | 44 | #define CRB_PAUSE_ADDR_HI NETXEN_NIC_REG(0x14) |
45 | #define CRB_HOST_CMD_ADDR_HI NETXEN_NIC_REG(0x18) /* host add:cmd ring */ | ||
46 | #define CRB_HOST_CMD_ADDR_LO NETXEN_NIC_REG(0x1c) | ||
47 | #define CRB_CMD_INTR_LOOP NETXEN_NIC_REG(0x20) /* 4 regs for perf */ | ||
48 | #define CRB_CMD_DMA_LOOP NETXEN_NIC_REG(0x24) | ||
49 | #define CRB_RCV_INTR_LOOP NETXEN_NIC_REG(0x28) | ||
50 | #define CRB_RCV_DMA_LOOP NETXEN_NIC_REG(0x2c) | ||
51 | #define CRB_ENABLE_TX_INTR NETXEN_NIC_REG(0x30) /* phantom init status */ | ||
52 | #define CRB_MMAP_ADDR_3 NETXEN_NIC_REG(0x34) | ||
53 | #define CRB_CMDPEG_CMDRING NETXEN_NIC_REG(0x38) | ||
54 | #define CRB_HOST_DUMMY_BUF_ADDR_HI NETXEN_NIC_REG(0x3c) | ||
55 | #define CRB_HOST_DUMMY_BUF_ADDR_LO NETXEN_NIC_REG(0x40) | ||
56 | #define CRB_MMAP_ADDR_0 NETXEN_NIC_REG(0x44) | ||
57 | #define CRB_MMAP_ADDR_1 NETXEN_NIC_REG(0x48) | ||
58 | #define CRB_MMAP_ADDR_2 NETXEN_NIC_REG(0x4c) | ||
59 | #define CRB_CMDPEG_STATE NETXEN_NIC_REG(0x50) | ||
60 | #define CRB_MMAP_SIZE_0 NETXEN_NIC_REG(0x54) | ||
61 | #define CRB_MMAP_SIZE_1 NETXEN_NIC_REG(0x58) | ||
62 | #define CRB_MMAP_SIZE_2 NETXEN_NIC_REG(0x5c) | ||
63 | #define CRB_MMAP_SIZE_3 NETXEN_NIC_REG(0x60) | ||
64 | #define CRB_GLOBAL_INT_COAL NETXEN_NIC_REG(0x64) /* interrupt coalescing */ | ||
65 | #define CRB_INT_COAL_MODE NETXEN_NIC_REG(0x68) | ||
66 | #define CRB_MAX_RCV_BUFS NETXEN_NIC_REG(0x6c) | ||
67 | #define CRB_TX_INT_THRESHOLD NETXEN_NIC_REG(0x70) | ||
68 | #define CRB_RX_PKT_TIMER NETXEN_NIC_REG(0x74) | ||
69 | #define CRB_TX_PKT_TIMER NETXEN_NIC_REG(0x78) | ||
70 | #define CRB_RX_PKT_CNT NETXEN_NIC_REG(0x7c) | ||
71 | #define CRB_RX_TMR_CNT NETXEN_NIC_REG(0x80) | ||
72 | #define CRB_RX_LRO_TIMER NETXEN_NIC_REG(0x84) | ||
73 | #define CRB_RX_LRO_MID_TIMER NETXEN_NIC_REG(0x88) | ||
74 | #define CRB_DMA_MAX_RCV_BUFS NETXEN_NIC_REG(0x8c) | ||
75 | #define CRB_MAX_DMA_ENTRIES NETXEN_NIC_REG(0x90) | ||
76 | #define CRB_XG_STATE NETXEN_NIC_REG(0x94) /* XG Link status */ | ||
77 | #define CRB_AGENT_GO NETXEN_NIC_REG(0x98) /* NIC pkt gen agent */ | ||
78 | #define CRB_AGENT_TX_SIZE NETXEN_NIC_REG(0x9c) | ||
79 | #define CRB_AGENT_TX_TYPE NETXEN_NIC_REG(0xa0) | ||
80 | #define CRB_AGENT_TX_ADDR NETXEN_NIC_REG(0xa4) | ||
81 | #define CRB_AGENT_TX_MSS NETXEN_NIC_REG(0xa8) | ||
82 | #define CRB_TX_STATE NETXEN_NIC_REG(0xac) /* Debug -performance */ | ||
83 | #define CRB_TX_COUNT NETXEN_NIC_REG(0xb0) | ||
84 | #define CRB_RX_STATE NETXEN_NIC_REG(0xb4) | ||
85 | #define CRB_RX_PERF_DEBUG_1 NETXEN_NIC_REG(0xb8) | ||
86 | #define CRB_RX_LRO_CONTROL NETXEN_NIC_REG(0xbc) /* LRO On/OFF */ | ||
87 | #define CRB_RX_LRO_START_NUM NETXEN_NIC_REG(0xc0) | ||
88 | #define CRB_MPORT_MODE NETXEN_NIC_REG(0xc4) /* Multiport Mode */ | ||
89 | #define CRB_CMD_RING_SIZE NETXEN_NIC_REG(0xc8) | ||
90 | #define CRB_INT_VECTOR NETXEN_NIC_REG(0xd4) | ||
91 | #define CRB_CTX_RESET NETXEN_NIC_REG(0xd8) | ||
92 | #define CRB_HOST_STS_PROD NETXEN_NIC_REG(0xdc) | ||
93 | #define CRB_HOST_STS_CONS NETXEN_NIC_REG(0xe0) | ||
94 | #define CRB_PEG_CMD_PROD NETXEN_NIC_REG(0xe4) | ||
95 | #define CRB_PEG_CMD_CONS NETXEN_NIC_REG(0xe8) | ||
96 | #define CRB_HOST_BUFFER_PROD NETXEN_NIC_REG(0xec) | ||
97 | #define CRB_HOST_BUFFER_CONS NETXEN_NIC_REG(0xf0) | ||
98 | #define CRB_JUMBO_BUFFER_PROD NETXEN_NIC_REG(0xf4) | ||
99 | #define CRB_JUMBO_BUFFER_CONS NETXEN_NIC_REG(0xf8) | ||
43 | 100 | ||
44 | #define NETXEN_NIC_REG(X) (NIC_CRB_BASE_PORT1+(X)) | 101 | #define CRB_CMD_PRODUCER_OFFSET_1 NETXEN_NIC_REG(0x1ac) |
102 | #define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0) | ||
103 | #define CRB_TEMP_STATE NETXEN_NIC_REG(0x1b4) | ||
45 | 104 | ||
46 | /* | 105 | /* |
47 | * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address | 106 | * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address |
@@ -51,74 +110,20 @@ | |||
51 | * on the Phantom. | 110 | * on the Phantom. |
52 | */ | 111 | */ |
53 | 112 | ||
54 | #define CRB_PHAN_CNTRL_LO_OFFSET NETXEN_NIC_REG(0x00) | 113 | #define nx_get_temp_val(x) ((x) >> 16) |
55 | #define CRB_PHAN_CNTRL_HI_OFFSET NETXEN_NIC_REG(0x04) | 114 | #define nx_get_temp_state(x) ((x) & 0xffff) |
56 | 115 | #define nx_encode_temp(val, state) (((val) << 16) | (state)) | |
57 | /* point to the indexes */ | ||
58 | #define CRB_CMD_PRODUCER_OFFSET NETXEN_NIC_REG(0x08) | ||
59 | #define CRB_CMD_CONSUMER_OFFSET NETXEN_NIC_REG(0x0c) | ||
60 | |||
61 | #define CRB_PAUSE_ADDR_LO NETXEN_NIC_REG(0x10) | ||
62 | #define CRB_PAUSE_ADDR_HI NETXEN_NIC_REG(0x14) | ||
63 | |||
64 | /* address of command descriptors in the host memory */ | ||
65 | #define CRB_HOST_CMD_ADDR_HI NETXEN_NIC_REG(0x30) | ||
66 | #define CRB_HOST_CMD_ADDR_LO NETXEN_NIC_REG(0x34) | ||
67 | |||
68 | /* The following 4 CRB registers are for doing performance coal */ | ||
69 | #define CRB_CMD_INTR_LOOP NETXEN_NIC_REG(0x38) | ||
70 | #define CRB_CMD_DMA_LOOP NETXEN_NIC_REG(0x3c) | ||
71 | #define CRB_RCV_INTR_LOOP NETXEN_NIC_REG(0x40) | ||
72 | #define CRB_RCV_DMA_LOOP NETXEN_NIC_REG(0x44) | ||
73 | |||
74 | /* Needed by the host to find out the state of Phantom's initialization */ | ||
75 | #define CRB_ENABLE_TX_INTR NETXEN_NIC_REG(0x4c) | ||
76 | #define CRB_CMDPEG_STATE NETXEN_NIC_REG(0x50) | ||
77 | #define CRB_CMDPEG_CMDRING NETXEN_NIC_REG(0x54) | ||
78 | |||
79 | /* Interrupt coalescing parameters */ | ||
80 | #define CRB_GLOBAL_INT_COAL NETXEN_NIC_REG(0x80) | ||
81 | #define CRB_INT_COAL_MODE NETXEN_NIC_REG(0x84) | ||
82 | #define CRB_MAX_RCV_BUFS NETXEN_NIC_REG(0x88) | ||
83 | #define CRB_TX_INT_THRESHOLD NETXEN_NIC_REG(0x8c) | ||
84 | #define CRB_RX_PKT_TIMER NETXEN_NIC_REG(0x90) | ||
85 | #define CRB_TX_PKT_TIMER NETXEN_NIC_REG(0x94) | ||
86 | #define CRB_RX_PKT_CNT NETXEN_NIC_REG(0x98) | ||
87 | #define CRB_RX_TMR_CNT NETXEN_NIC_REG(0x9c) | ||
88 | #define CRB_INT_THRESH NETXEN_NIC_REG(0xa4) | ||
89 | |||
90 | /* Register for communicating XG link status */ | ||
91 | #define CRB_XG_STATE NETXEN_NIC_REG(0xa0) | ||
92 | |||
93 | /* Register for communicating card temperature */ | ||
94 | /* Upper 16 bits are temperature value. Lower 16 bits are the state */ | ||
95 | #define CRB_TEMP_STATE NETXEN_NIC_REG(0xa8) | ||
96 | #define nx_get_temp_val(x) ((x) >> 16) | ||
97 | #define nx_get_temp_state(x) ((x) & 0xffff) | ||
98 | #define nx_encode_temp(val, state) (((val) << 16) | (state)) | ||
99 | |||
100 | /* Debug registers for controlling NIC pkt gen agent */ | ||
101 | #define CRB_AGENT_GO NETXEN_NIC_REG(0xb0) | ||
102 | #define CRB_AGENT_TX_SIZE NETXEN_NIC_REG(0xb4) | ||
103 | #define CRB_AGENT_TX_TYPE NETXEN_NIC_REG(0xb8) | ||
104 | #define CRB_AGENT_TX_ADDR NETXEN_NIC_REG(0xbc) | ||
105 | #define CRB_AGENT_TX_MSS NETXEN_NIC_REG(0xc0) | ||
106 | |||
107 | /* Debug registers for observing NIC performance */ | ||
108 | #define CRB_TX_STATE NETXEN_NIC_REG(0xd0) | ||
109 | #define CRB_TX_COUNT NETXEN_NIC_REG(0xd4) | ||
110 | #define CRB_RX_STATE NETXEN_NIC_REG(0xd8) | ||
111 | 116 | ||
112 | /* CRB registers per Rcv Descriptor ring */ | 117 | /* CRB registers per Rcv Descriptor ring */ |
113 | struct netxen_rcv_desc_crb { | 118 | struct netxen_rcv_desc_crb { |
114 | u32 crb_rcv_producer_offset __attribute__ ((aligned(512))); | 119 | u32 crb_rcv_producer_offset __attribute__ ((aligned(512))); |
115 | u32 crb_rcv_consumer_offset; | 120 | u32 crb_rcv_consumer_offset; |
116 | u32 crb_globalrcv_ring; | 121 | u32 crb_globalrcv_ring; |
122 | u32 crb_rcv_ring_size; | ||
117 | }; | 123 | }; |
118 | 124 | ||
119 | /* | 125 | /* |
120 | * CRB registers used by the receive peg logic. One instance of these | 126 | * CRB registers used by the receive peg logic. |
121 | * needs to be instantiated per instance of the receive peg. | ||
122 | */ | 127 | */ |
123 | 128 | ||
124 | struct netxen_recv_crb { | 129 | struct netxen_recv_crb { |
@@ -127,6 +132,7 @@ struct netxen_recv_crb { | |||
127 | u32 crb_rcv_status_producer; | 132 | u32 crb_rcv_status_producer; |
128 | u32 crb_rcv_status_consumer; | 133 | u32 crb_rcv_status_consumer; |
129 | u32 crb_rcvpeg_state; | 134 | u32 crb_rcvpeg_state; |
135 | u32 crb_status_ring_size; | ||
130 | }; | 136 | }; |
131 | 137 | ||
132 | #if defined(DEFINE_GLOBAL_RECV_CRB) | 138 | #if defined(DEFINE_GLOBAL_RECV_CRB) |
@@ -139,30 +145,48 @@ struct netxen_recv_crb recv_crb_registers[] = { | |||
139 | { | 145 | { |
140 | { | 146 | { |
141 | /* crb_rcv_producer_offset: */ | 147 | /* crb_rcv_producer_offset: */ |
142 | NETXEN_NIC_REG(0x18), | 148 | NETXEN_NIC_REG(0x100), |
143 | /* crb_rcv_consumer_offset: */ | 149 | /* crb_rcv_consumer_offset: */ |
144 | NETXEN_NIC_REG(0x1c), | 150 | NETXEN_NIC_REG(0x104), |
145 | /* crb_gloablrcv_ring: */ | 151 | /* crb_gloablrcv_ring: */ |
146 | NETXEN_NIC_REG(0x20), | 152 | NETXEN_NIC_REG(0x108), |
153 | /* crb_rcv_ring_size */ | ||
154 | NETXEN_NIC_REG(0x10c), | ||
155 | |||
147 | }, | 156 | }, |
148 | /* Jumbo frames */ | 157 | /* Jumbo frames */ |
149 | { | 158 | { |
150 | /* crb_rcv_producer_offset: */ | 159 | /* crb_rcv_producer_offset: */ |
151 | NETXEN_NIC_REG(0x100), | 160 | NETXEN_NIC_REG(0x110), |
152 | /* crb_rcv_consumer_offset: */ | 161 | /* crb_rcv_consumer_offset: */ |
153 | NETXEN_NIC_REG(0x104), | 162 | NETXEN_NIC_REG(0x114), |
154 | /* crb_gloablrcv_ring: */ | 163 | /* crb_gloablrcv_ring: */ |
155 | NETXEN_NIC_REG(0x108), | 164 | NETXEN_NIC_REG(0x118), |
165 | /* crb_rcv_ring_size */ | ||
166 | NETXEN_NIC_REG(0x11c), | ||
167 | }, | ||
168 | /* LRO */ | ||
169 | { | ||
170 | /* crb_rcv_producer_offset: */ | ||
171 | NETXEN_NIC_REG(0x120), | ||
172 | /* crb_rcv_consumer_offset: */ | ||
173 | NETXEN_NIC_REG(0x124), | ||
174 | /* crb_gloablrcv_ring: */ | ||
175 | NETXEN_NIC_REG(0x128), | ||
176 | /* crb_rcv_ring_size */ | ||
177 | NETXEN_NIC_REG(0x12c), | ||
156 | } | 178 | } |
157 | }, | 179 | }, |
158 | /* crb_rcvstatus_ring: */ | 180 | /* crb_rcvstatus_ring: */ |
159 | NETXEN_NIC_REG(0x24), | 181 | NETXEN_NIC_REG(0x130), |
160 | /* crb_rcv_status_producer: */ | 182 | /* crb_rcv_status_producer: */ |
161 | NETXEN_NIC_REG(0x28), | 183 | NETXEN_NIC_REG(0x134), |
162 | /* crb_rcv_status_consumer: */ | 184 | /* crb_rcv_status_consumer: */ |
163 | NETXEN_NIC_REG(0x2c), | 185 | NETXEN_NIC_REG(0x138), |
164 | /* crb_rcvpeg_state: */ | 186 | /* crb_rcvpeg_state: */ |
165 | NETXEN_NIC_REG(0x48), | 187 | NETXEN_NIC_REG(0x13c), |
188 | /* crb_status_ring_size */ | ||
189 | NETXEN_NIC_REG(0x140), | ||
166 | 190 | ||
167 | }, | 191 | }, |
168 | /* | 192 | /* |
@@ -173,34 +197,66 @@ struct netxen_recv_crb recv_crb_registers[] = { | |||
173 | { | 197 | { |
174 | { | 198 | { |
175 | /* crb_rcv_producer_offset: */ | 199 | /* crb_rcv_producer_offset: */ |
176 | NETXEN_NIC_REG(0x80), | 200 | NETXEN_NIC_REG(0x144), |
177 | /* crb_rcv_consumer_offset: */ | 201 | /* crb_rcv_consumer_offset: */ |
178 | NETXEN_NIC_REG(0x84), | 202 | NETXEN_NIC_REG(0x148), |
179 | /* crb_globalrcv_ring: */ | 203 | /* crb_globalrcv_ring: */ |
180 | NETXEN_NIC_REG(0x88), | 204 | NETXEN_NIC_REG(0x14c), |
205 | /* crb_rcv_ring_size */ | ||
206 | NETXEN_NIC_REG(0x150), | ||
207 | |||
181 | }, | 208 | }, |
182 | /* Jumbo frames */ | 209 | /* Jumbo frames */ |
183 | { | 210 | { |
184 | /* crb_rcv_producer_offset: */ | 211 | /* crb_rcv_producer_offset: */ |
185 | NETXEN_NIC_REG(0x10C), | 212 | NETXEN_NIC_REG(0x154), |
186 | /* crb_rcv_consumer_offset: */ | 213 | /* crb_rcv_consumer_offset: */ |
187 | NETXEN_NIC_REG(0x110), | 214 | NETXEN_NIC_REG(0x158), |
188 | /* crb_globalrcv_ring: */ | 215 | /* crb_globalrcv_ring: */ |
189 | NETXEN_NIC_REG(0x114), | 216 | NETXEN_NIC_REG(0x15c), |
217 | /* crb_rcv_ring_size */ | ||
218 | NETXEN_NIC_REG(0x160), | ||
219 | }, | ||
220 | /* LRO */ | ||
221 | { | ||
222 | /* crb_rcv_producer_offset: */ | ||
223 | NETXEN_NIC_REG(0x164), | ||
224 | /* crb_rcv_consumer_offset: */ | ||
225 | NETXEN_NIC_REG(0x168), | ||
226 | /* crb_globalrcv_ring: */ | ||
227 | NETXEN_NIC_REG(0x16c), | ||
228 | /* crb_rcv_ring_size */ | ||
229 | NETXEN_NIC_REG(0x170), | ||
190 | } | 230 | } |
231 | |||
191 | }, | 232 | }, |
192 | /* crb_rcvstatus_ring: */ | 233 | /* crb_rcvstatus_ring: */ |
193 | NETXEN_NIC_REG(0x8c), | 234 | NETXEN_NIC_REG(0x174), |
194 | /* crb_rcv_status_producer: */ | 235 | /* crb_rcv_status_producer: */ |
195 | NETXEN_NIC_REG(0x90), | 236 | NETXEN_NIC_REG(0x178), |
196 | /* crb_rcv_status_consumer: */ | 237 | /* crb_rcv_status_consumer: */ |
197 | NETXEN_NIC_REG(0x94), | 238 | NETXEN_NIC_REG(0x17c), |
198 | /* crb_rcvpeg_state: */ | 239 | /* crb_rcvpeg_state: */ |
199 | NETXEN_NIC_REG(0x98), | 240 | NETXEN_NIC_REG(0x180), |
241 | /* crb_status_ring_size */ | ||
242 | NETXEN_NIC_REG(0x184), | ||
243 | |||
200 | }, | 244 | }, |
201 | }; | 245 | }; |
246 | |||
247 | u64 ctx_addr_sig_regs[][3] = { | ||
248 | {NETXEN_NIC_REG(0x188), NETXEN_NIC_REG(0x18c), NETXEN_NIC_REG(0x1c0)}, | ||
249 | {NETXEN_NIC_REG(0x190), NETXEN_NIC_REG(0x194), NETXEN_NIC_REG(0x1c4)}, | ||
250 | {NETXEN_NIC_REG(0x198), NETXEN_NIC_REG(0x19c), NETXEN_NIC_REG(0x1c8)}, | ||
251 | {NETXEN_NIC_REG(0x1a0), NETXEN_NIC_REG(0x1a4), NETXEN_NIC_REG(0x1cc)} | ||
252 | }; | ||
253 | |||
202 | #else | 254 | #else |
203 | extern struct netxen_recv_crb recv_crb_registers[]; | 255 | extern struct netxen_recv_crb recv_crb_registers[]; |
256 | extern u64 ctx_addr_sig_regs[][3]; | ||
257 | #define CRB_CTX_ADDR_REG_LO (ctx_addr_sig_regs[0][0]) | ||
258 | #define CRB_CTX_ADDR_REG_HI (ctx_addr_sig_regs[0][2]) | ||
259 | #define CRB_CTX_SIGNATURE_REG (ctx_addr_sig_regs[0][1]) | ||
204 | #endif /* DEFINE_GLOBAL_RECEIVE_CRB */ | 260 | #endif /* DEFINE_GLOBAL_RECEIVE_CRB */ |
205 | 261 | ||
206 | /* | 262 | /* |
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c index 26e42f6e9fb1..196993a29b09 100644 --- a/drivers/net/ni52.c +++ b/drivers/net/ni52.c | |||
@@ -1335,7 +1335,7 @@ int __init init_module(void) | |||
1335 | return 0; | 1335 | return 0; |
1336 | } | 1336 | } |
1337 | 1337 | ||
1338 | void cleanup_module(void) | 1338 | void __exit cleanup_module(void) |
1339 | { | 1339 | { |
1340 | unregister_netdev(dev_ni52); | 1340 | unregister_netdev(dev_ni52); |
1341 | release_region(dev_ni52->base_addr, NI52_TOTAL_SIZE); | 1341 | release_region(dev_ni52->base_addr, NI52_TOTAL_SIZE); |
diff --git a/drivers/net/ni65.c b/drivers/net/ni65.c index 340ad0d5388a..1578f4d98498 100644 --- a/drivers/net/ni65.c +++ b/drivers/net/ni65.c | |||
@@ -1259,7 +1259,7 @@ int __init init_module(void) | |||
1259 | return IS_ERR(dev_ni65) ? PTR_ERR(dev_ni65) : 0; | 1259 | return IS_ERR(dev_ni65) ? PTR_ERR(dev_ni65) : 0; |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | void cleanup_module(void) | 1262 | void __exit cleanup_module(void) |
1263 | { | 1263 | { |
1264 | unregister_netdev(dev_ni65); | 1264 | unregister_netdev(dev_ni65); |
1265 | cleanup_card(dev_ni65); | 1265 | cleanup_card(dev_ni65); |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index 312e0e331712..568daeb3e9d8 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
@@ -414,10 +414,10 @@ struct rx_info { | |||
414 | 414 | ||
415 | struct sk_buff *skbs[NR_RX_DESC]; | 415 | struct sk_buff *skbs[NR_RX_DESC]; |
416 | 416 | ||
417 | u32 *next_rx_desc; | 417 | __le32 *next_rx_desc; |
418 | u16 next_rx, next_empty; | 418 | u16 next_rx, next_empty; |
419 | 419 | ||
420 | u32 *descs; | 420 | __le32 *descs; |
421 | dma_addr_t phy_descs; | 421 | dma_addr_t phy_descs; |
422 | }; | 422 | }; |
423 | 423 | ||
@@ -460,7 +460,7 @@ struct ns83820 { | |||
460 | struct sk_buff *tx_skbs[NR_TX_DESC]; | 460 | struct sk_buff *tx_skbs[NR_TX_DESC]; |
461 | 461 | ||
462 | char pad[16] __attribute__((aligned(16))); | 462 | char pad[16] __attribute__((aligned(16))); |
463 | u32 *tx_descs; | 463 | __le32 *tx_descs; |
464 | dma_addr_t tx_phy_descs; | 464 | dma_addr_t tx_phy_descs; |
465 | 465 | ||
466 | struct timer_list tx_watchdog; | 466 | struct timer_list tx_watchdog; |
@@ -534,7 +534,7 @@ static void ns83820_vlan_rx_kill_vid(struct net_device *ndev, unsigned short vid | |||
534 | * conditions, still route realtime traffic with as low jitter as | 534 | * conditions, still route realtime traffic with as low jitter as |
535 | * possible. | 535 | * possible. |
536 | */ | 536 | */ |
537 | static inline void build_rx_desc(struct ns83820 *dev, u32 *desc, dma_addr_t link, dma_addr_t buf, u32 cmdsts, u32 extsts) | 537 | static inline void build_rx_desc(struct ns83820 *dev, __le32 *desc, dma_addr_t link, dma_addr_t buf, u32 cmdsts, u32 extsts) |
538 | { | 538 | { |
539 | desc_addr_set(desc + DESC_LINK, link); | 539 | desc_addr_set(desc + DESC_LINK, link); |
540 | desc_addr_set(desc + DESC_BUFPTR, buf); | 540 | desc_addr_set(desc + DESC_BUFPTR, buf); |
@@ -548,7 +548,7 @@ static inline int ns83820_add_rx_skb(struct ns83820 *dev, struct sk_buff *skb) | |||
548 | { | 548 | { |
549 | unsigned next_empty; | 549 | unsigned next_empty; |
550 | u32 cmdsts; | 550 | u32 cmdsts; |
551 | u32 *sg; | 551 | __le32 *sg; |
552 | dma_addr_t buf; | 552 | dma_addr_t buf; |
553 | 553 | ||
554 | next_empty = dev->rx_info.next_empty; | 554 | next_empty = dev->rx_info.next_empty; |
@@ -875,7 +875,8 @@ static void fastcall rx_irq(struct net_device *ndev) | |||
875 | struct rx_info *info = &dev->rx_info; | 875 | struct rx_info *info = &dev->rx_info; |
876 | unsigned next_rx; | 876 | unsigned next_rx; |
877 | int rx_rc, len; | 877 | int rx_rc, len; |
878 | u32 cmdsts, *desc; | 878 | u32 cmdsts; |
879 | __le32 *desc; | ||
879 | unsigned long flags; | 880 | unsigned long flags; |
880 | int nr = 0; | 881 | int nr = 0; |
881 | 882 | ||
@@ -1011,7 +1012,8 @@ static inline void kick_tx(struct ns83820 *dev) | |||
1011 | static void do_tx_done(struct net_device *ndev) | 1012 | static void do_tx_done(struct net_device *ndev) |
1012 | { | 1013 | { |
1013 | struct ns83820 *dev = PRIV(ndev); | 1014 | struct ns83820 *dev = PRIV(ndev); |
1014 | u32 cmdsts, tx_done_idx, *desc; | 1015 | u32 cmdsts, tx_done_idx; |
1016 | __le32 *desc; | ||
1015 | 1017 | ||
1016 | dprintk("do_tx_done(%p)\n", ndev); | 1018 | dprintk("do_tx_done(%p)\n", ndev); |
1017 | tx_done_idx = dev->tx_done_idx; | 1019 | tx_done_idx = dev->tx_done_idx; |
@@ -1078,7 +1080,7 @@ static void ns83820_cleanup_tx(struct ns83820 *dev) | |||
1078 | struct sk_buff *skb = dev->tx_skbs[i]; | 1080 | struct sk_buff *skb = dev->tx_skbs[i]; |
1079 | dev->tx_skbs[i] = NULL; | 1081 | dev->tx_skbs[i] = NULL; |
1080 | if (skb) { | 1082 | if (skb) { |
1081 | u32 *desc = dev->tx_descs + (i * DESC_SIZE); | 1083 | __le32 *desc = dev->tx_descs + (i * DESC_SIZE); |
1082 | pci_unmap_single(dev->pci_dev, | 1084 | pci_unmap_single(dev->pci_dev, |
1083 | desc_addr_get(desc + DESC_BUFPTR), | 1085 | desc_addr_get(desc + DESC_BUFPTR), |
1084 | le32_to_cpu(desc[DESC_CMDSTS]) & CMDSTS_LEN_MASK, | 1086 | le32_to_cpu(desc[DESC_CMDSTS]) & CMDSTS_LEN_MASK, |
@@ -1108,7 +1110,7 @@ static int ns83820_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
1108 | skb_frag_t *frag; | 1110 | skb_frag_t *frag; |
1109 | int stopped = 0; | 1111 | int stopped = 0; |
1110 | int do_intr = 0; | 1112 | int do_intr = 0; |
1111 | volatile u32 *first_desc; | 1113 | volatile __le32 *first_desc; |
1112 | 1114 | ||
1113 | dprintk("ns83820_hard_start_xmit\n"); | 1115 | dprintk("ns83820_hard_start_xmit\n"); |
1114 | 1116 | ||
@@ -1181,7 +1183,7 @@ again: | |||
1181 | first_desc = dev->tx_descs + (free_idx * DESC_SIZE); | 1183 | first_desc = dev->tx_descs + (free_idx * DESC_SIZE); |
1182 | 1184 | ||
1183 | for (;;) { | 1185 | for (;;) { |
1184 | volatile u32 *desc = dev->tx_descs + (free_idx * DESC_SIZE); | 1186 | volatile __le32 *desc = dev->tx_descs + (free_idx * DESC_SIZE); |
1185 | 1187 | ||
1186 | dprintk("frag[%3u]: %4u @ 0x%08Lx\n", free_idx, len, | 1188 | dprintk("frag[%3u]: %4u @ 0x%08Lx\n", free_idx, len, |
1187 | (unsigned long long)buf); | 1189 | (unsigned long long)buf); |
@@ -1456,7 +1458,8 @@ static int ns83820_stop(struct net_device *ndev) | |||
1456 | static void ns83820_tx_timeout(struct net_device *ndev) | 1458 | static void ns83820_tx_timeout(struct net_device *ndev) |
1457 | { | 1459 | { |
1458 | struct ns83820 *dev = PRIV(ndev); | 1460 | struct ns83820 *dev = PRIV(ndev); |
1459 | u32 tx_done_idx, *desc; | 1461 | u32 tx_done_idx; |
1462 | __le32 *desc; | ||
1460 | unsigned long flags; | 1463 | unsigned long flags; |
1461 | 1464 | ||
1462 | spin_lock_irqsave(&dev->tx_lock, flags); | 1465 | spin_lock_irqsave(&dev->tx_lock, flags); |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 4044bb1ada86..e175f3910b18 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -587,8 +587,7 @@ int phy_stop_interrupts(struct phy_device *phydev) | |||
587 | * Finish any pending work; we might have been scheduled | 587 | * Finish any pending work; we might have been scheduled |
588 | * to be called from keventd ourselves, though. | 588 | * to be called from keventd ourselves, though. |
589 | */ | 589 | */ |
590 | if (!current_is_keventd()) | 590 | run_scheduled_work(&phydev->phy_queue); |
591 | flush_scheduled_work(); | ||
592 | 591 | ||
593 | free_irq(phydev->irq, phydev); | 592 | free_irq(phydev->irq, phydev); |
594 | 593 | ||
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 85a392fab5cc..f83b41d4cb0e 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -225,6 +225,7 @@ MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); | |||
225 | 225 | ||
226 | static int rx_copybreak = 200; | 226 | static int rx_copybreak = 200; |
227 | static int use_dac; | 227 | static int use_dac; |
228 | static int ignore_parity_err; | ||
228 | static struct { | 229 | static struct { |
229 | u32 msg_enable; | 230 | u32 msg_enable; |
230 | } debug = { -1 }; | 231 | } debug = { -1 }; |
@@ -470,6 +471,8 @@ module_param(use_dac, int, 0); | |||
470 | MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); | 471 | MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); |
471 | module_param_named(debug, debug.msg_enable, int, 0); | 472 | module_param_named(debug, debug.msg_enable, int, 0); |
472 | MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); | 473 | MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); |
474 | module_param_named(ignore_parity_err, ignore_parity_err, bool, 0); | ||
475 | MODULE_PARM_DESC(ignore_parity_err, "Ignore PCI parity error as target. Default: false"); | ||
473 | MODULE_LICENSE("GPL"); | 476 | MODULE_LICENSE("GPL"); |
474 | MODULE_VERSION(RTL8169_VERSION); | 477 | MODULE_VERSION(RTL8169_VERSION); |
475 | 478 | ||
@@ -1284,11 +1287,6 @@ static void rtl8169_hw_phy_config(struct net_device *dev) | |||
1284 | /* Shazam ! */ | 1287 | /* Shazam ! */ |
1285 | 1288 | ||
1286 | if (tp->mac_version == RTL_GIGA_MAC_VER_04) { | 1289 | if (tp->mac_version == RTL_GIGA_MAC_VER_04) { |
1287 | mdio_write(ioaddr, 31, 0x0001); | ||
1288 | mdio_write(ioaddr, 9, 0x273a); | ||
1289 | mdio_write(ioaddr, 14, 0x7bfb); | ||
1290 | mdio_write(ioaddr, 27, 0x841e); | ||
1291 | |||
1292 | mdio_write(ioaddr, 31, 0x0002); | 1290 | mdio_write(ioaddr, 31, 0x0002); |
1293 | mdio_write(ioaddr, 1, 0x90d0); | 1291 | mdio_write(ioaddr, 1, 0x90d0); |
1294 | mdio_write(ioaddr, 31, 0x0000); | 1292 | mdio_write(ioaddr, 31, 0x0000); |
@@ -1817,12 +1815,25 @@ static void rtl8169_hw_reset(void __iomem *ioaddr) | |||
1817 | RTL_R8(ChipCmd); | 1815 | RTL_R8(ChipCmd); |
1818 | } | 1816 | } |
1819 | 1817 | ||
1820 | static void | 1818 | static void rtl8169_set_rx_tx_config_registers(struct rtl8169_private *tp) |
1821 | rtl8169_hw_start(struct net_device *dev) | 1819 | { |
1820 | void __iomem *ioaddr = tp->mmio_addr; | ||
1821 | u32 cfg = rtl8169_rx_config; | ||
1822 | |||
1823 | cfg |= (RTL_R32(RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask); | ||
1824 | RTL_W32(RxConfig, cfg); | ||
1825 | |||
1826 | /* Set DMA burst size and Interframe Gap Time */ | ||
1827 | RTL_W32(TxConfig, (TX_DMA_BURST << TxDMAShift) | | ||
1828 | (InterFrameGap << TxInterFrameGapShift)); | ||
1829 | } | ||
1830 | |||
1831 | static void rtl8169_hw_start(struct net_device *dev) | ||
1822 | { | 1832 | { |
1823 | struct rtl8169_private *tp = netdev_priv(dev); | 1833 | struct rtl8169_private *tp = netdev_priv(dev); |
1824 | void __iomem *ioaddr = tp->mmio_addr; | 1834 | void __iomem *ioaddr = tp->mmio_addr; |
1825 | struct pci_dev *pdev = tp->pci_dev; | 1835 | struct pci_dev *pdev = tp->pci_dev; |
1836 | u16 cmd; | ||
1826 | u32 i; | 1837 | u32 i; |
1827 | 1838 | ||
1828 | /* Soft reset the chip. */ | 1839 | /* Soft reset the chip. */ |
@@ -1835,6 +1846,11 @@ rtl8169_hw_start(struct net_device *dev) | |||
1835 | msleep_interruptible(1); | 1846 | msleep_interruptible(1); |
1836 | } | 1847 | } |
1837 | 1848 | ||
1849 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) { | ||
1850 | RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) | PCIMulRW); | ||
1851 | pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x08); | ||
1852 | } | ||
1853 | |||
1838 | if (tp->mac_version == RTL_GIGA_MAC_VER_13) { | 1854 | if (tp->mac_version == RTL_GIGA_MAC_VER_13) { |
1839 | pci_write_config_word(pdev, 0x68, 0x00); | 1855 | pci_write_config_word(pdev, 0x68, 0x00); |
1840 | pci_write_config_word(pdev, 0x69, 0x08); | 1856 | pci_write_config_word(pdev, 0x69, 0x08); |
@@ -1842,8 +1858,6 @@ rtl8169_hw_start(struct net_device *dev) | |||
1842 | 1858 | ||
1843 | /* Undocumented stuff. */ | 1859 | /* Undocumented stuff. */ |
1844 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) { | 1860 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) { |
1845 | u16 cmd; | ||
1846 | |||
1847 | /* Realtek's r1000_n.c driver uses '&& 0x01' here. Well... */ | 1861 | /* Realtek's r1000_n.c driver uses '&& 0x01' here. Well... */ |
1848 | if ((RTL_R8(Config2) & 0x07) & 0x01) | 1862 | if ((RTL_R8(Config2) & 0x07) & 0x01) |
1849 | RTL_W32(0x7c, 0x0007ffff); | 1863 | RTL_W32(0x7c, 0x0007ffff); |
@@ -1855,23 +1869,29 @@ rtl8169_hw_start(struct net_device *dev) | |||
1855 | pci_write_config_word(pdev, PCI_COMMAND, cmd); | 1869 | pci_write_config_word(pdev, PCI_COMMAND, cmd); |
1856 | } | 1870 | } |
1857 | 1871 | ||
1858 | |||
1859 | RTL_W8(Cfg9346, Cfg9346_Unlock); | 1872 | RTL_W8(Cfg9346, Cfg9346_Unlock); |
1873 | if ((tp->mac_version == RTL_GIGA_MAC_VER_01) || | ||
1874 | (tp->mac_version == RTL_GIGA_MAC_VER_02) || | ||
1875 | (tp->mac_version == RTL_GIGA_MAC_VER_03) || | ||
1876 | (tp->mac_version == RTL_GIGA_MAC_VER_04)) | ||
1877 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | ||
1878 | |||
1860 | RTL_W8(EarlyTxThres, EarlyTxThld); | 1879 | RTL_W8(EarlyTxThres, EarlyTxThld); |
1861 | 1880 | ||
1862 | /* Low hurts. Let's disable the filtering. */ | 1881 | /* Low hurts. Let's disable the filtering. */ |
1863 | RTL_W16(RxMaxSize, 16383); | 1882 | RTL_W16(RxMaxSize, 16383); |
1864 | 1883 | ||
1865 | /* Set Rx Config register */ | 1884 | if ((tp->mac_version == RTL_GIGA_MAC_VER_01) || |
1866 | i = rtl8169_rx_config | | 1885 | (tp->mac_version == RTL_GIGA_MAC_VER_02) || |
1867 | (RTL_R32(RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask); | 1886 | (tp->mac_version == RTL_GIGA_MAC_VER_03) || |
1868 | RTL_W32(RxConfig, i); | 1887 | (tp->mac_version == RTL_GIGA_MAC_VER_04)) |
1888 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | ||
1889 | rtl8169_set_rx_tx_config_registers(tp); | ||
1869 | 1890 | ||
1870 | /* Set DMA burst size and Interframe Gap Time */ | 1891 | cmd = RTL_R16(CPlusCmd); |
1871 | RTL_W32(TxConfig, (TX_DMA_BURST << TxDMAShift) | | 1892 | RTL_W16(CPlusCmd, cmd); |
1872 | (InterFrameGap << TxInterFrameGapShift)); | ||
1873 | 1893 | ||
1874 | tp->cp_cmd |= RTL_R16(CPlusCmd) | PCIMulRW; | 1894 | tp->cp_cmd |= cmd | PCIMulRW; |
1875 | 1895 | ||
1876 | if ((tp->mac_version == RTL_GIGA_MAC_VER_02) || | 1896 | if ((tp->mac_version == RTL_GIGA_MAC_VER_02) || |
1877 | (tp->mac_version == RTL_GIGA_MAC_VER_03)) { | 1897 | (tp->mac_version == RTL_GIGA_MAC_VER_03)) { |
@@ -1897,7 +1917,15 @@ rtl8169_hw_start(struct net_device *dev) | |||
1897 | RTL_W32(TxDescStartAddrLow, ((u64) tp->TxPhyAddr & DMA_32BIT_MASK)); | 1917 | RTL_W32(TxDescStartAddrLow, ((u64) tp->TxPhyAddr & DMA_32BIT_MASK)); |
1898 | RTL_W32(RxDescAddrHigh, ((u64) tp->RxPhyAddr >> 32)); | 1918 | RTL_W32(RxDescAddrHigh, ((u64) tp->RxPhyAddr >> 32)); |
1899 | RTL_W32(RxDescAddrLow, ((u64) tp->RxPhyAddr & DMA_32BIT_MASK)); | 1919 | RTL_W32(RxDescAddrLow, ((u64) tp->RxPhyAddr & DMA_32BIT_MASK)); |
1900 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | 1920 | |
1921 | if ((tp->mac_version != RTL_GIGA_MAC_VER_01) && | ||
1922 | (tp->mac_version != RTL_GIGA_MAC_VER_02) && | ||
1923 | (tp->mac_version != RTL_GIGA_MAC_VER_03) && | ||
1924 | (tp->mac_version != RTL_GIGA_MAC_VER_04)) { | ||
1925 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | ||
1926 | rtl8169_set_rx_tx_config_registers(tp); | ||
1927 | } | ||
1928 | |||
1901 | RTL_W8(Cfg9346, Cfg9346_Lock); | 1929 | RTL_W8(Cfg9346, Cfg9346_Lock); |
1902 | 1930 | ||
1903 | /* Initially a 10 us delay. Turned it into a PCI commit. - FR */ | 1931 | /* Initially a 10 us delay. Turned it into a PCI commit. - FR */ |
@@ -1992,7 +2020,7 @@ static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff, | |||
1992 | if (!skb) | 2020 | if (!skb) |
1993 | goto err_out; | 2021 | goto err_out; |
1994 | 2022 | ||
1995 | skb_reserve(skb, align); | 2023 | skb_reserve(skb, (align - 1) & (u32)skb->data); |
1996 | *sk_buff = skb; | 2024 | *sk_buff = skb; |
1997 | 2025 | ||
1998 | mapping = pci_map_single(pdev, skb->data, rx_buf_sz, | 2026 | mapping = pci_map_single(pdev, skb->data, rx_buf_sz, |
@@ -2355,12 +2383,17 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev) | |||
2355 | /* | 2383 | /* |
2356 | * The recovery sequence below admits a very elaborated explanation: | 2384 | * The recovery sequence below admits a very elaborated explanation: |
2357 | * - it seems to work; | 2385 | * - it seems to work; |
2358 | * - I did not see what else could be done. | 2386 | * - I did not see what else could be done; |
2387 | * - it makes iop3xx happy. | ||
2359 | * | 2388 | * |
2360 | * Feel free to adjust to your needs. | 2389 | * Feel free to adjust to your needs. |
2361 | */ | 2390 | */ |
2362 | pci_write_config_word(pdev, PCI_COMMAND, | 2391 | if (ignore_parity_err) |
2363 | pci_cmd | PCI_COMMAND_SERR | PCI_COMMAND_PARITY); | 2392 | pci_cmd &= ~PCI_COMMAND_PARITY; |
2393 | else | ||
2394 | pci_cmd |= PCI_COMMAND_SERR | PCI_COMMAND_PARITY; | ||
2395 | |||
2396 | pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); | ||
2364 | 2397 | ||
2365 | pci_write_config_word(pdev, PCI_STATUS, | 2398 | pci_write_config_word(pdev, PCI_STATUS, |
2366 | pci_status & (PCI_STATUS_DETECTED_PARITY | | 2399 | pci_status & (PCI_STATUS_DETECTED_PARITY | |
@@ -2374,10 +2407,11 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev) | |||
2374 | tp->cp_cmd &= ~PCIDAC; | 2407 | tp->cp_cmd &= ~PCIDAC; |
2375 | RTL_W16(CPlusCmd, tp->cp_cmd); | 2408 | RTL_W16(CPlusCmd, tp->cp_cmd); |
2376 | dev->features &= ~NETIF_F_HIGHDMA; | 2409 | dev->features &= ~NETIF_F_HIGHDMA; |
2377 | rtl8169_schedule_work(dev, rtl8169_reinit_task); | ||
2378 | } | 2410 | } |
2379 | 2411 | ||
2380 | rtl8169_hw_reset(ioaddr); | 2412 | rtl8169_hw_reset(ioaddr); |
2413 | |||
2414 | rtl8169_schedule_work(dev, rtl8169_reinit_task); | ||
2381 | } | 2415 | } |
2382 | 2416 | ||
2383 | static void | 2417 | static void |
@@ -2457,7 +2491,7 @@ static inline int rtl8169_try_rx_copy(struct sk_buff **sk_buff, int pkt_size, | |||
2457 | 2491 | ||
2458 | skb = dev_alloc_skb(pkt_size + align); | 2492 | skb = dev_alloc_skb(pkt_size + align); |
2459 | if (skb) { | 2493 | if (skb) { |
2460 | skb_reserve(skb, align); | 2494 | skb_reserve(skb, (align - 1) & (u32)skb->data); |
2461 | eth_copy_and_sum(skb, sk_buff[0]->data, pkt_size, 0); | 2495 | eth_copy_and_sum(skb, sk_buff[0]->data, pkt_size, 0); |
2462 | *sk_buff = skb; | 2496 | *sk_buff = skb; |
2463 | rtl8169_mark_to_asic(desc, rx_buf_sz); | 2497 | rtl8169_mark_to_asic(desc, rx_buf_sz); |
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c index d9d0a3a3c558..0d6c95c7aedf 100644 --- a/drivers/net/seeq8005.c +++ b/drivers/net/seeq8005.c | |||
@@ -750,7 +750,7 @@ int __init init_module(void) | |||
750 | return 0; | 750 | return 0; |
751 | } | 751 | } |
752 | 752 | ||
753 | void cleanup_module(void) | 753 | void __exit cleanup_module(void) |
754 | { | 754 | { |
755 | unregister_netdev(dev_seeq); | 755 | unregister_netdev(dev_seeq); |
756 | release_region(dev_seeq->base_addr, SEEQ8005_IO_EXTENT); | 756 | release_region(dev_seeq->base_addr, SEEQ8005_IO_EXTENT); |
diff --git a/drivers/net/sk98lin/skgesirq.c b/drivers/net/sk98lin/skgesirq.c index ab66d80a4455..3e7aa49afd00 100644 --- a/drivers/net/sk98lin/skgesirq.c +++ b/drivers/net/sk98lin/skgesirq.c | |||
@@ -1319,7 +1319,7 @@ SK_BOOL AutoNeg) /* Is Auto-negotiation used ? */ | |||
1319 | SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_INT_STAT, &Isrc); | 1319 | SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_INT_STAT, &Isrc); |
1320 | 1320 | ||
1321 | #ifdef xDEBUG | 1321 | #ifdef xDEBUG |
1322 | if ((Isrc & ~(PHY_B_IS_HCT | PHY_B_IS_LCT) == | 1322 | if ((Isrc & ~(PHY_B_IS_HCT | PHY_B_IS_LCT)) == |
1323 | (PHY_B_IS_SCR_S_ER | PHY_B_IS_RRS_CHANGE | PHY_B_IS_LRS_CHANGE)) { | 1323 | (PHY_B_IS_SCR_S_ER | PHY_B_IS_RRS_CHANGE | PHY_B_IS_LRS_CHANGE)) { |
1324 | 1324 | ||
1325 | SK_U32 Stat1, Stat2, Stat3; | 1325 | SK_U32 Stat1, Stat2, Stat3; |
diff --git a/drivers/net/skge.h b/drivers/net/skge.h index 23e5275d920c..f6223c533c01 100644 --- a/drivers/net/skge.h +++ b/drivers/net/skge.h | |||
@@ -389,10 +389,10 @@ enum { | |||
389 | /* Packet Arbiter Registers */ | 389 | /* Packet Arbiter Registers */ |
390 | /* B3_PA_CTRL 16 bit Packet Arbiter Ctrl Register */ | 390 | /* B3_PA_CTRL 16 bit Packet Arbiter Ctrl Register */ |
391 | enum { | 391 | enum { |
392 | PA_CLR_TO_TX2 = 1<<13, /* Clear IRQ Packet Timeout TX2 */ | 392 | PA_CLR_TO_TX2 = 1<<13,/* Clear IRQ Packet Timeout TX2 */ |
393 | PA_CLR_TO_TX1 = 1<<12, /* Clear IRQ Packet Timeout TX1 */ | 393 | PA_CLR_TO_TX1 = 1<<12,/* Clear IRQ Packet Timeout TX1 */ |
394 | PA_CLR_TO_RX2 = 1<<11, /* Clear IRQ Packet Timeout RX2 */ | 394 | PA_CLR_TO_RX2 = 1<<11,/* Clear IRQ Packet Timeout RX2 */ |
395 | PA_CLR_TO_RX1 = 1<<10, /* Clear IRQ Packet Timeout RX1 */ | 395 | PA_CLR_TO_RX1 = 1<<10,/* Clear IRQ Packet Timeout RX1 */ |
396 | PA_ENA_TO_TX2 = 1<<9, /* Enable Timeout Timer TX2 */ | 396 | PA_ENA_TO_TX2 = 1<<9, /* Enable Timeout Timer TX2 */ |
397 | PA_DIS_TO_TX2 = 1<<8, /* Disable Timeout Timer TX2 */ | 397 | PA_DIS_TO_TX2 = 1<<8, /* Disable Timeout Timer TX2 */ |
398 | PA_ENA_TO_TX1 = 1<<7, /* Enable Timeout Timer TX1 */ | 398 | PA_ENA_TO_TX1 = 1<<7, /* Enable Timeout Timer TX1 */ |
@@ -481,14 +481,14 @@ enum { | |||
481 | /* RAM Buffer Register Offsets */ | 481 | /* RAM Buffer Register Offsets */ |
482 | enum { | 482 | enum { |
483 | 483 | ||
484 | RB_START = 0x00,/* 32 bit RAM Buffer Start Address */ | 484 | RB_START= 0x00,/* 32 bit RAM Buffer Start Address */ |
485 | RB_END = 0x04,/* 32 bit RAM Buffer End Address */ | 485 | RB_END = 0x04,/* 32 bit RAM Buffer End Address */ |
486 | RB_WP = 0x08,/* 32 bit RAM Buffer Write Pointer */ | 486 | RB_WP = 0x08,/* 32 bit RAM Buffer Write Pointer */ |
487 | RB_RP = 0x0c,/* 32 bit RAM Buffer Read Pointer */ | 487 | RB_RP = 0x0c,/* 32 bit RAM Buffer Read Pointer */ |
488 | RB_RX_UTPP = 0x10,/* 32 bit Rx Upper Threshold, Pause Packet */ | 488 | RB_RX_UTPP= 0x10,/* 32 bit Rx Upper Threshold, Pause Packet */ |
489 | RB_RX_LTPP = 0x14,/* 32 bit Rx Lower Threshold, Pause Packet */ | 489 | RB_RX_LTPP= 0x14,/* 32 bit Rx Lower Threshold, Pause Packet */ |
490 | RB_RX_UTHP = 0x18,/* 32 bit Rx Upper Threshold, High Prio */ | 490 | RB_RX_UTHP= 0x18,/* 32 bit Rx Upper Threshold, High Prio */ |
491 | RB_RX_LTHP = 0x1c,/* 32 bit Rx Lower Threshold, High Prio */ | 491 | RB_RX_LTHP= 0x1c,/* 32 bit Rx Lower Threshold, High Prio */ |
492 | /* 0x10 - 0x1f: reserved at Tx RAM Buffer Registers */ | 492 | /* 0x10 - 0x1f: reserved at Tx RAM Buffer Registers */ |
493 | RB_PC = 0x20,/* 32 bit RAM Buffer Packet Counter */ | 493 | RB_PC = 0x20,/* 32 bit RAM Buffer Packet Counter */ |
494 | RB_LEV = 0x24,/* 32 bit RAM Buffer Level Register */ | 494 | RB_LEV = 0x24,/* 32 bit RAM Buffer Level Register */ |
@@ -532,7 +532,7 @@ enum { | |||
532 | PHY_ADDR_MARV = 0, | 532 | PHY_ADDR_MARV = 0, |
533 | }; | 533 | }; |
534 | 534 | ||
535 | #define RB_ADDR(offs, queue) (B16_RAM_REGS + (queue) + (offs)) | 535 | #define RB_ADDR(offs, queue) ((u16)B16_RAM_REGS + (u16)(queue) + (offs)) |
536 | 536 | ||
537 | /* Receive MAC FIFO, Receive LED, and Link_Sync regs (GENESIS only) */ | 537 | /* Receive MAC FIFO, Receive LED, and Link_Sync regs (GENESIS only) */ |
538 | enum { | 538 | enum { |
@@ -578,15 +578,15 @@ enum { | |||
578 | MFF_DIS_TIST = 1<<2, /* Disable Time Stamp Gener */ | 578 | MFF_DIS_TIST = 1<<2, /* Disable Time Stamp Gener */ |
579 | MFF_CLR_INTIST = 1<<1, /* Clear IRQ No Time Stamp */ | 579 | MFF_CLR_INTIST = 1<<1, /* Clear IRQ No Time Stamp */ |
580 | MFF_CLR_INSTAT = 1<<0, /* Clear IRQ No Status */ | 580 | MFF_CLR_INSTAT = 1<<0, /* Clear IRQ No Status */ |
581 | #define MFF_RX_CTRL_DEF MFF_ENA_TIM_PAT | 581 | MFF_RX_CTRL_DEF = MFF_ENA_TIM_PAT, |
582 | }; | 582 | }; |
583 | 583 | ||
584 | /* TX_MFF_CTRL1 16 bit Transmit MAC FIFO Control Reg 1 */ | 584 | /* TX_MFF_CTRL1 16 bit Transmit MAC FIFO Control Reg 1 */ |
585 | enum { | 585 | enum { |
586 | MFF_CLR_PERR = 1<<15, /* Clear Parity Error IRQ */ | 586 | MFF_CLR_PERR = 1<<15, /* Clear Parity Error IRQ */ |
587 | /* Bit 14: reserved */ | 587 | |
588 | MFF_ENA_PKT_REC = 1<<13, /* Enable Packet Recovery */ | 588 | MFF_ENA_PKT_REC = 1<<13, /* Enable Packet Recovery */ |
589 | MFF_DIS_PKT_REC = 1<<12, /* Disable Packet Recovery */ | 589 | MFF_DIS_PKT_REC = 1<<12, /* Disable Packet Recovery */ |
590 | 590 | ||
591 | MFF_ENA_W4E = 1<<7, /* Enable Wait for Empty */ | 591 | MFF_ENA_W4E = 1<<7, /* Enable Wait for Empty */ |
592 | MFF_DIS_W4E = 1<<6, /* Disable Wait for Empty */ | 592 | MFF_DIS_W4E = 1<<6, /* Disable Wait for Empty */ |
@@ -595,9 +595,10 @@ enum { | |||
595 | MFF_DIS_LOOPB = 1<<2, /* Disable Loopback */ | 595 | MFF_DIS_LOOPB = 1<<2, /* Disable Loopback */ |
596 | MFF_CLR_MAC_RST = 1<<1, /* Clear XMAC Reset */ | 596 | MFF_CLR_MAC_RST = 1<<1, /* Clear XMAC Reset */ |
597 | MFF_SET_MAC_RST = 1<<0, /* Set XMAC Reset */ | 597 | MFF_SET_MAC_RST = 1<<0, /* Set XMAC Reset */ |
598 | |||
599 | MFF_TX_CTRL_DEF = MFF_ENA_PKT_REC | (u16) MFF_ENA_TIM_PAT | MFF_ENA_FLUSH, | ||
598 | }; | 600 | }; |
599 | 601 | ||
600 | #define MFF_TX_CTRL_DEF (MFF_ENA_PKT_REC | MFF_ENA_TIM_PAT | MFF_ENA_FLUSH) | ||
601 | 602 | ||
602 | /* RX_MFF_TST2 8 bit Receive MAC FIFO Test Register 2 */ | 603 | /* RX_MFF_TST2 8 bit Receive MAC FIFO Test Register 2 */ |
603 | /* TX_MFF_TST2 8 bit Transmit MAC FIFO Test Register 2 */ | 604 | /* TX_MFF_TST2 8 bit Transmit MAC FIFO Test Register 2 */ |
@@ -1304,8 +1305,8 @@ enum { | |||
1304 | 1305 | ||
1305 | /* special defines for FIBER (88E1011S only) */ | 1306 | /* special defines for FIBER (88E1011S only) */ |
1306 | enum { | 1307 | enum { |
1307 | PHY_M_AN_ASP_X = 1<<8, /* Asymmetric Pause */ | 1308 | PHY_M_AN_ASP_X = 1<<8, /* Asymmetric Pause */ |
1308 | PHY_M_AN_PC_X = 1<<7, /* MAC Pause implemented */ | 1309 | PHY_M_AN_PC_X = 1<<7, /* MAC Pause implemented */ |
1309 | PHY_M_AN_1000X_AHD = 1<<6, /* Advertise 10000Base-X Half Duplex */ | 1310 | PHY_M_AN_1000X_AHD = 1<<6, /* Advertise 10000Base-X Half Duplex */ |
1310 | PHY_M_AN_1000X_AFD = 1<<5, /* Advertise 10000Base-X Full Duplex */ | 1311 | PHY_M_AN_1000X_AFD = 1<<5, /* Advertise 10000Base-X Full Duplex */ |
1311 | }; | 1312 | }; |
@@ -1320,7 +1321,7 @@ enum { | |||
1320 | 1321 | ||
1321 | /***** PHY_MARV_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/ | 1322 | /***** PHY_MARV_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/ |
1322 | enum { | 1323 | enum { |
1323 | PHY_M_1000C_TEST = 7<<13,/* Bit 15..13: Test Modes */ | 1324 | PHY_M_1000C_TEST= 7<<13,/* Bit 15..13: Test Modes */ |
1324 | PHY_M_1000C_MSE = 1<<12, /* Manual Master/Slave Enable */ | 1325 | PHY_M_1000C_MSE = 1<<12, /* Manual Master/Slave Enable */ |
1325 | PHY_M_1000C_MSC = 1<<11, /* M/S Configuration (1=Master) */ | 1326 | PHY_M_1000C_MSC = 1<<11, /* M/S Configuration (1=Master) */ |
1326 | PHY_M_1000C_MPD = 1<<10, /* Multi-Port Device */ | 1327 | PHY_M_1000C_MPD = 1<<10, /* Multi-Port Device */ |
@@ -1349,7 +1350,7 @@ enum { | |||
1349 | PHY_M_PC_EN_DET_PLUS = 3<<8, /* Energy Detect Plus (Mode 2) */ | 1350 | PHY_M_PC_EN_DET_PLUS = 3<<8, /* Energy Detect Plus (Mode 2) */ |
1350 | }; | 1351 | }; |
1351 | 1352 | ||
1352 | #define PHY_M_PC_MDI_XMODE(x) (((x)<<5) & PHY_M_PC_MDIX_MSK) | 1353 | #define PHY_M_PC_MDI_XMODE(x) ((((u16)(x)<<5) & PHY_M_PC_MDIX_MSK) |
1353 | 1354 | ||
1354 | enum { | 1355 | enum { |
1355 | PHY_M_PC_MAN_MDI = 0, /* 00 = Manual MDI configuration */ | 1356 | PHY_M_PC_MAN_MDI = 0, /* 00 = Manual MDI configuration */ |
@@ -1432,24 +1433,24 @@ enum { | |||
1432 | PHY_M_EC_DIS_LINK_P = 1<<12, /* Disable Link Pulses (88E1111 only) */ | 1433 | PHY_M_EC_DIS_LINK_P = 1<<12, /* Disable Link Pulses (88E1111 only) */ |
1433 | PHY_M_EC_M_DSC_MSK = 3<<10, /* Bit 11..10: Master Downshift Counter */ | 1434 | PHY_M_EC_M_DSC_MSK = 3<<10, /* Bit 11..10: Master Downshift Counter */ |
1434 | /* (88E1011 only) */ | 1435 | /* (88E1011 only) */ |
1435 | PHY_M_EC_S_DSC_MSK = 3<<8,/* Bit 9.. 8: Slave Downshift Counter */ | 1436 | PHY_M_EC_S_DSC_MSK = 3<<8, /* Bit 9.. 8: Slave Downshift Counter */ |
1436 | /* (88E1011 only) */ | 1437 | /* (88E1011 only) */ |
1437 | PHY_M_EC_M_DSC_MSK2 = 7<<9,/* Bit 11.. 9: Master Downshift Counter */ | 1438 | PHY_M_EC_M_DSC_MSK2 = 7<<9, /* Bit 11.. 9: Master Downshift Counter */ |
1438 | /* (88E1111 only) */ | 1439 | /* (88E1111 only) */ |
1439 | PHY_M_EC_DOWN_S_ENA = 1<<8, /* Downshift Enable (88E1111 only) */ | 1440 | PHY_M_EC_DOWN_S_ENA = 1<<8, /* Downshift Enable (88E1111 only) */ |
1440 | /* !!! Errata in spec. (1 = disable) */ | 1441 | /* !!! Errata in spec. (1 = disable) */ |
1441 | PHY_M_EC_RX_TIM_CT = 1<<7, /* RGMII Rx Timing Control*/ | 1442 | PHY_M_EC_RX_TIM_CT = 1<<7, /* RGMII Rx Timing Control*/ |
1442 | PHY_M_EC_MAC_S_MSK = 7<<4,/* Bit 6.. 4: Def. MAC interface speed */ | 1443 | PHY_M_EC_MAC_S_MSK = 7<<4, /* Bit 6.. 4: Def. MAC interface speed */ |
1443 | PHY_M_EC_FIB_AN_ENA = 1<<3, /* Fiber Auto-Neg. Enable (88E1011S only) */ | 1444 | PHY_M_EC_FIB_AN_ENA = 1<<3, /* Fiber Auto-Neg. Enable (88E1011S only) */ |
1444 | PHY_M_EC_DTE_D_ENA = 1<<2, /* DTE Detect Enable (88E1111 only) */ | 1445 | PHY_M_EC_DTE_D_ENA = 1<<2, /* DTE Detect Enable (88E1111 only) */ |
1445 | PHY_M_EC_TX_TIM_CT = 1<<1, /* RGMII Tx Timing Control */ | 1446 | PHY_M_EC_TX_TIM_CT = 1<<1, /* RGMII Tx Timing Control */ |
1446 | PHY_M_EC_TRANS_DIS = 1<<0, /* Transmitter Disable (88E1111 only) */}; | 1447 | PHY_M_EC_TRANS_DIS = 1<<0, /* Transmitter Disable (88E1111 only) */}; |
1447 | 1448 | ||
1448 | #define PHY_M_EC_M_DSC(x) ((x)<<10) /* 00=1x; 01=2x; 10=3x; 11=4x */ | 1449 | #define PHY_M_EC_M_DSC(x) ((u16)(x)<<10) /* 00=1x; 01=2x; 10=3x; 11=4x */ |
1449 | #define PHY_M_EC_S_DSC(x) ((x)<<8) /* 00=dis; 01=1x; 10=2x; 11=3x */ | 1450 | #define PHY_M_EC_S_DSC(x) ((u16)(x)<<8) /* 00=dis; 01=1x; 10=2x; 11=3x */ |
1450 | #define PHY_M_EC_MAC_S(x) ((x)<<4) /* 01X=0; 110=2.5; 111=25 (MHz) */ | 1451 | #define PHY_M_EC_MAC_S(x) ((u16)(x)<<4) /* 01X=0; 110=2.5; 111=25 (MHz) */ |
1451 | 1452 | ||
1452 | #define PHY_M_EC_M_DSC_2(x) ((x)<<9) /* 000=1x; 001=2x; 010=3x; 011=4x */ | 1453 | #define PHY_M_EC_M_DSC_2(x) ((u16)(x)<<9) /* 000=1x; 001=2x; 010=3x; 011=4x */ |
1453 | /* 100=5x; 101=6x; 110=7x; 111=8x */ | 1454 | /* 100=5x; 101=6x; 110=7x; 111=8x */ |
1454 | enum { | 1455 | enum { |
1455 | MAC_TX_CLK_0_MHZ = 2, | 1456 | MAC_TX_CLK_0_MHZ = 2, |
@@ -1468,10 +1469,12 @@ enum { | |||
1468 | PHY_M_LEDC_LK_C_MSK = 7<<3,/* Bit 5.. 3: Link Control Mask */ | 1469 | PHY_M_LEDC_LK_C_MSK = 7<<3,/* Bit 5.. 3: Link Control Mask */ |
1469 | /* (88E1111 only) */ | 1470 | /* (88E1111 only) */ |
1470 | }; | 1471 | }; |
1472 | #define PHY_M_LED_PULS_DUR(x) (((u16)(x)<<12) & PHY_M_LEDC_PULS_MSK) | ||
1473 | #define PHY_M_LED_BLINK_RT(x) (((u16)(x)<<8) & PHY_M_LEDC_BL_R_MSK) | ||
1471 | 1474 | ||
1472 | enum { | 1475 | enum { |
1473 | PHY_M_LEDC_LINK_MSK = 3<<3,/* Bit 4.. 3: Link Control Mask */ | 1476 | PHY_M_LEDC_LINK_MSK = 3<<3, /* Bit 4.. 3: Link Control Mask */ |
1474 | /* (88E1011 only) */ | 1477 | /* (88E1011 only) */ |
1475 | PHY_M_LEDC_DP_CTRL = 1<<2, /* Duplex Control */ | 1478 | PHY_M_LEDC_DP_CTRL = 1<<2, /* Duplex Control */ |
1476 | PHY_M_LEDC_DP_C_MSB = 1<<2, /* Duplex Control (MSB, 88E1111 only) */ | 1479 | PHY_M_LEDC_DP_C_MSB = 1<<2, /* Duplex Control (MSB, 88E1111 only) */ |
1477 | PHY_M_LEDC_RX_CTRL = 1<<1, /* Rx Activity / Link */ | 1480 | PHY_M_LEDC_RX_CTRL = 1<<1, /* Rx Activity / Link */ |
@@ -1479,27 +1482,24 @@ enum { | |||
1479 | PHY_M_LEDC_TX_C_MSB = 1<<0, /* Tx Control (MSB, 88E1111 only) */ | 1482 | PHY_M_LEDC_TX_C_MSB = 1<<0, /* Tx Control (MSB, 88E1111 only) */ |
1480 | }; | 1483 | }; |
1481 | 1484 | ||
1482 | #define PHY_M_LED_PULS_DUR(x) (((x)<<12) & PHY_M_LEDC_PULS_MSK) | ||
1483 | |||
1484 | enum { | 1485 | enum { |
1485 | PULS_NO_STR = 0,/* no pulse stretching */ | 1486 | PULS_NO_STR = 0, /* no pulse stretching */ |
1486 | PULS_21MS = 1,/* 21 ms to 42 ms */ | 1487 | PULS_21MS = 1, /* 21 ms to 42 ms */ |
1487 | PULS_42MS = 2,/* 42 ms to 84 ms */ | 1488 | PULS_42MS = 2, /* 42 ms to 84 ms */ |
1488 | PULS_84MS = 3,/* 84 ms to 170 ms */ | 1489 | PULS_84MS = 3, /* 84 ms to 170 ms */ |
1489 | PULS_170MS = 4,/* 170 ms to 340 ms */ | 1490 | PULS_170MS = 4, /* 170 ms to 340 ms */ |
1490 | PULS_340MS = 5,/* 340 ms to 670 ms */ | 1491 | PULS_340MS = 5, /* 340 ms to 670 ms */ |
1491 | PULS_670MS = 6,/* 670 ms to 1.3 s */ | 1492 | PULS_670MS = 6, /* 670 ms to 1.3 s */ |
1492 | PULS_1300MS = 7,/* 1.3 s to 2.7 s */ | 1493 | PULS_1300MS = 7, /* 1.3 s to 2.7 s */ |
1493 | }; | 1494 | }; |
1494 | 1495 | ||
1495 | #define PHY_M_LED_BLINK_RT(x) (((x)<<8) & PHY_M_LEDC_BL_R_MSK) | ||
1496 | 1496 | ||
1497 | enum { | 1497 | enum { |
1498 | BLINK_42MS = 0,/* 42 ms */ | 1498 | BLINK_42MS = 0, /* 42 ms */ |
1499 | BLINK_84MS = 1,/* 84 ms */ | 1499 | BLINK_84MS = 1, /* 84 ms */ |
1500 | BLINK_170MS = 2,/* 170 ms */ | 1500 | BLINK_170MS = 2, /* 170 ms */ |
1501 | BLINK_340MS = 3,/* 340 ms */ | 1501 | BLINK_340MS = 3, /* 340 ms */ |
1502 | BLINK_670MS = 4,/* 670 ms */ | 1502 | BLINK_670MS = 4, /* 670 ms */ |
1503 | }; | 1503 | }; |
1504 | 1504 | ||
1505 | /***** PHY_MARV_LED_OVER 16 bit r/w Manual LED Override Reg *****/ | 1505 | /***** PHY_MARV_LED_OVER 16 bit r/w Manual LED Override Reg *****/ |
@@ -1525,7 +1525,7 @@ enum { | |||
1525 | PHY_M_EC2_FO_IMPED = 1<<5, /* Fiber Output Impedance */ | 1525 | PHY_M_EC2_FO_IMPED = 1<<5, /* Fiber Output Impedance */ |
1526 | PHY_M_EC2_FO_M_CLK = 1<<4, /* Fiber Mode Clock Enable */ | 1526 | PHY_M_EC2_FO_M_CLK = 1<<4, /* Fiber Mode Clock Enable */ |
1527 | PHY_M_EC2_FO_BOOST = 1<<3, /* Fiber Output Boost */ | 1527 | PHY_M_EC2_FO_BOOST = 1<<3, /* Fiber Output Boost */ |
1528 | PHY_M_EC2_FO_AM_MSK = 7,/* Bit 2.. 0: Fiber Output Amplitude */ | 1528 | PHY_M_EC2_FO_AM_MSK = 7, /* Bit 2.. 0: Fiber Output Amplitude */ |
1529 | }; | 1529 | }; |
1530 | 1530 | ||
1531 | /***** PHY_MARV_EXT_P_STAT 16 bit r/w Ext. PHY Specific Status *****/ | 1531 | /***** PHY_MARV_EXT_P_STAT 16 bit r/w Ext. PHY Specific Status *****/ |
@@ -1550,7 +1550,7 @@ enum { | |||
1550 | PHY_M_CABD_DIS_WAIT = 1<<15, /* Disable Waiting Period (Page 1) */ | 1550 | PHY_M_CABD_DIS_WAIT = 1<<15, /* Disable Waiting Period (Page 1) */ |
1551 | /* (88E1111 only) */ | 1551 | /* (88E1111 only) */ |
1552 | PHY_M_CABD_STAT_MSK = 3<<13, /* Bit 14..13: Status Mask */ | 1552 | PHY_M_CABD_STAT_MSK = 3<<13, /* Bit 14..13: Status Mask */ |
1553 | PHY_M_CABD_AMPL_MSK = 0x1f<<8,/* Bit 12.. 8: Amplitude Mask */ | 1553 | PHY_M_CABD_AMPL_MSK = 0x1f<<8, /* Bit 12.. 8: Amplitude Mask */ |
1554 | /* (88E1111 only) */ | 1554 | /* (88E1111 only) */ |
1555 | PHY_M_CABD_DIST_MSK = 0xff, /* Bit 7.. 0: Distance Mask */ | 1555 | PHY_M_CABD_DIST_MSK = 0xff, /* Bit 7.. 0: Distance Mask */ |
1556 | }; | 1556 | }; |
@@ -1605,9 +1605,9 @@ enum { | |||
1605 | 1605 | ||
1606 | /***** PHY_MARV_PHY_CTRL (page 3) 16 bit r/w LED Control Reg. *****/ | 1606 | /***** PHY_MARV_PHY_CTRL (page 3) 16 bit r/w LED Control Reg. *****/ |
1607 | enum { | 1607 | enum { |
1608 | PHY_M_LEDC_LOS_MSK = 0xf<<12,/* Bit 15..12: LOS LED Ctrl. Mask */ | 1608 | PHY_M_LEDC_LOS_MSK = 0xf<<12, /* Bit 15..12: LOS LED Ctrl. Mask */ |
1609 | PHY_M_LEDC_INIT_MSK = 0xf<<8, /* Bit 11.. 8: INIT LED Ctrl. Mask */ | 1609 | PHY_M_LEDC_INIT_MSK = 0xf<<8, /* Bit 11.. 8: INIT LED Ctrl. Mask */ |
1610 | PHY_M_LEDC_STA1_MSK = 0xf<<4,/* Bit 7.. 4: STAT1 LED Ctrl. Mask */ | 1610 | PHY_M_LEDC_STA1_MSK = 0xf<<4, /* Bit 7.. 4: STAT1 LED Ctrl. Mask */ |
1611 | PHY_M_LEDC_STA0_MSK = 0xf, /* Bit 3.. 0: STAT0 LED Ctrl. Mask */ | 1611 | PHY_M_LEDC_STA0_MSK = 0xf, /* Bit 3.. 0: STAT0 LED Ctrl. Mask */ |
1612 | }; | 1612 | }; |
1613 | 1613 | ||
@@ -1804,8 +1804,8 @@ enum { | |||
1804 | 1804 | ||
1805 | /* GM_SMI_CTRL 16 bit r/w SMI Control Register */ | 1805 | /* GM_SMI_CTRL 16 bit r/w SMI Control Register */ |
1806 | enum { | 1806 | enum { |
1807 | GM_SMI_CT_PHY_A_MSK = 0x1f<<11,/* Bit 15..11: PHY Device Address */ | 1807 | GM_SMI_CT_PHY_A_MSK = 0x1f<<11, /* Bit 15..11: PHY Device Address */ |
1808 | GM_SMI_CT_REG_A_MSK = 0x1f<<6,/* Bit 10.. 6: PHY Register Address */ | 1808 | GM_SMI_CT_REG_A_MSK = 0x1f<<6, /* Bit 10.. 6: PHY Register Address */ |
1809 | GM_SMI_CT_OP_RD = 1<<5, /* Bit 5: OpCode Read (0=Write)*/ | 1809 | GM_SMI_CT_OP_RD = 1<<5, /* Bit 5: OpCode Read (0=Write)*/ |
1810 | GM_SMI_CT_RD_VAL = 1<<4, /* Bit 4: Read Valid (Read completed) */ | 1810 | GM_SMI_CT_RD_VAL = 1<<4, /* Bit 4: Read Valid (Read completed) */ |
1811 | GM_SMI_CT_BUSY = 1<<3, /* Bit 3: Busy (Operation in progress) */ | 1811 | GM_SMI_CT_BUSY = 1<<3, /* Bit 3: Busy (Operation in progress) */ |
@@ -1875,9 +1875,9 @@ enum { | |||
1875 | 1875 | ||
1876 | /* TX_GMF_CTRL_T 32 bit Tx GMAC FIFO Control/Test */ | 1876 | /* TX_GMF_CTRL_T 32 bit Tx GMAC FIFO Control/Test */ |
1877 | enum { | 1877 | enum { |
1878 | GMF_WSP_TST_ON = 1<<18,/* Write Shadow Pointer Test On */ | 1878 | GMF_WSP_TST_ON = 1<<18, /* Write Shadow Pointer Test On */ |
1879 | GMF_WSP_TST_OFF = 1<<17,/* Write Shadow Pointer Test Off */ | 1879 | GMF_WSP_TST_OFF = 1<<17, /* Write Shadow Pointer Test Off */ |
1880 | GMF_WSP_STEP = 1<<16,/* Write Shadow Pointer Step/Increment */ | 1880 | GMF_WSP_STEP = 1<<16, /* Write Shadow Pointer Step/Increment */ |
1881 | 1881 | ||
1882 | GMF_CLI_TX_FU = 1<<6, /* Clear IRQ Tx FIFO Underrun */ | 1882 | GMF_CLI_TX_FU = 1<<6, /* Clear IRQ Tx FIFO Underrun */ |
1883 | GMF_CLI_TX_FC = 1<<5, /* Clear IRQ Tx Frame Complete */ | 1883 | GMF_CLI_TX_FC = 1<<5, /* Clear IRQ Tx Frame Complete */ |
@@ -2111,18 +2111,18 @@ enum { | |||
2111 | 2111 | ||
2112 | /* XM_MMU_CMD 16 bit r/w MMU Command Register */ | 2112 | /* XM_MMU_CMD 16 bit r/w MMU Command Register */ |
2113 | enum { | 2113 | enum { |
2114 | XM_MMU_PHY_RDY = 1<<12,/* Bit 12: PHY Read Ready */ | 2114 | XM_MMU_PHY_RDY = 1<<12, /* Bit 12: PHY Read Ready */ |
2115 | XM_MMU_PHY_BUSY = 1<<11,/* Bit 11: PHY Busy */ | 2115 | XM_MMU_PHY_BUSY = 1<<11, /* Bit 11: PHY Busy */ |
2116 | XM_MMU_IGN_PF = 1<<10,/* Bit 10: Ignore Pause Frame */ | 2116 | XM_MMU_IGN_PF = 1<<10, /* Bit 10: Ignore Pause Frame */ |
2117 | XM_MMU_MAC_LB = 1<<9, /* Bit 9: Enable MAC Loopback */ | 2117 | XM_MMU_MAC_LB = 1<<9, /* Bit 9: Enable MAC Loopback */ |
2118 | XM_MMU_FRC_COL = 1<<7, /* Bit 7: Force Collision */ | 2118 | XM_MMU_FRC_COL = 1<<7, /* Bit 7: Force Collision */ |
2119 | XM_MMU_SIM_COL = 1<<6, /* Bit 6: Simulate Collision */ | 2119 | XM_MMU_SIM_COL = 1<<6, /* Bit 6: Simulate Collision */ |
2120 | XM_MMU_NO_PRE = 1<<5, /* Bit 5: No MDIO Preamble */ | 2120 | XM_MMU_NO_PRE = 1<<5, /* Bit 5: No MDIO Preamble */ |
2121 | XM_MMU_GMII_FD = 1<<4, /* Bit 4: GMII uses Full Duplex */ | 2121 | XM_MMU_GMII_FD = 1<<4, /* Bit 4: GMII uses Full Duplex */ |
2122 | XM_MMU_RAT_CTRL = 1<<3, /* Bit 3: Enable Rate Control */ | 2122 | XM_MMU_RAT_CTRL = 1<<3, /* Bit 3: Enable Rate Control */ |
2123 | XM_MMU_GMII_LOOP= 1<<2, /* Bit 2: PHY is in Loopback Mode */ | 2123 | XM_MMU_GMII_LOOP= 1<<2, /* Bit 2: PHY is in Loopback Mode */ |
2124 | XM_MMU_ENA_RX = 1<<1, /* Bit 1: Enable Receiver */ | 2124 | XM_MMU_ENA_RX = 1<<1, /* Bit 1: Enable Receiver */ |
2125 | XM_MMU_ENA_TX = 1<<0, /* Bit 0: Enable Transmitter */ | 2125 | XM_MMU_ENA_TX = 1<<0, /* Bit 0: Enable Transmitter */ |
2126 | }; | 2126 | }; |
2127 | 2127 | ||
2128 | 2128 | ||
@@ -2506,7 +2506,7 @@ static inline void skge_write8(const struct skge_hw *hw, int reg, u8 val) | |||
2506 | } | 2506 | } |
2507 | 2507 | ||
2508 | /* MAC Related Registers inside the device. */ | 2508 | /* MAC Related Registers inside the device. */ |
2509 | #define SK_REG(port,reg) (((port)<<7)+(reg)) | 2509 | #define SK_REG(port,reg) (((port)<<7)+(u16)(reg)) |
2510 | #define SK_XMAC_REG(port, reg) \ | 2510 | #define SK_XMAC_REG(port, reg) \ |
2511 | ((BASE_XMAC_1 + (port) * (BASE_XMAC_2 - BASE_XMAC_1)) | (reg) << 1) | 2511 | ((BASE_XMAC_1 + (port) * (BASE_XMAC_2 - BASE_XMAC_1)) | (reg) << 1) |
2512 | 2512 | ||
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 842abd9396c6..fb1d2c30c1bb 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -100,33 +100,32 @@ module_param(idle_timeout, int, 0); | |||
100 | MODULE_PARM_DESC(idle_timeout, "Watchdog timer for lost interrupts (ms)"); | 100 | MODULE_PARM_DESC(idle_timeout, "Watchdog timer for lost interrupts (ms)"); |
101 | 101 | ||
102 | static const struct pci_device_id sky2_id_table[] = { | 102 | static const struct pci_device_id sky2_id_table[] = { |
103 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, | 103 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, /* SK-9Sxx */ |
104 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, | 104 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */ |
105 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) }, /* DGE-560T */ | 105 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) }, /* DGE-560T */ |
106 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4001) }, /* DGE-550SX */ | 106 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4001) }, /* DGE-550SX */ |
107 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4B02) }, /* DGE-560SX */ | 107 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4B02) }, /* DGE-560SX */ |
108 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, | 108 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, /* 88E8021 */ |
109 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, | 109 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, /* 88E8022 */ |
110 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) }, | 110 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) }, /* 88E8061 */ |
111 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4343) }, | 111 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4343) }, /* 88E8062 */ |
112 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4344) }, | 112 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4344) }, /* 88E8021 */ |
113 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4345) }, | 113 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4345) }, /* 88E8022 */ |
114 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4346) }, | 114 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4346) }, /* 88E8061 */ |
115 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4347) }, | 115 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4347) }, /* 88E8062 */ |
116 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4350) }, | 116 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4350) }, /* 88E8035 */ |
117 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4351) }, | 117 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4351) }, /* 88E8036 */ |
118 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, | 118 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, /* 88E8038 */ |
119 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, | 119 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */ |
120 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) }, | 120 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */ |
121 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, | 121 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) }, /* 88E8052 */ |
122 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, | 122 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ |
123 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, | 123 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */ |
124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, | 124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */ |
125 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4365) }, | 125 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */ |
126 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, | 126 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */ |
127 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, | 127 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */ |
128 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, | 128 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */ |
129 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4369) }, | ||
130 | { 0 } | 129 | { 0 } |
131 | }; | 130 | }; |
132 | 131 | ||
@@ -522,7 +521,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
522 | /* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */ | 521 | /* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */ |
523 | ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) | PHY_M_LEDC_TX_CTRL; | 522 | ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) | PHY_M_LEDC_TX_CTRL; |
524 | /* turn off the Rx LED (LED_RX) */ | 523 | /* turn off the Rx LED (LED_RX) */ |
525 | ledover |= PHY_M_LED_MO_RX(MO_LED_OFF); | 524 | ledover &= ~PHY_M_LED_MO_RX; |
526 | } | 525 | } |
527 | 526 | ||
528 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev == CHIP_REV_YU_EC_A1) { | 527 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev == CHIP_REV_YU_EC_A1) { |
@@ -545,7 +544,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
545 | 544 | ||
546 | if (sky2->autoneg == AUTONEG_DISABLE || sky2->speed == SPEED_100) { | 545 | if (sky2->autoneg == AUTONEG_DISABLE || sky2->speed == SPEED_100) { |
547 | /* turn on 100 Mbps LED (LED_LINK100) */ | 546 | /* turn on 100 Mbps LED (LED_LINK100) */ |
548 | ledover |= PHY_M_LED_MO_100(MO_LED_ON); | 547 | ledover |= PHY_M_LED_MO_100; |
549 | } | 548 | } |
550 | 549 | ||
551 | if (ledover) | 550 | if (ledover) |
@@ -697,10 +696,15 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) | |||
697 | 696 | ||
698 | } | 697 | } |
699 | 698 | ||
700 | /* Assign Ram Buffer allocation in units of 64bit (8 bytes) */ | 699 | /* Assign Ram Buffer allocation to queue */ |
701 | static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 end) | 700 | static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 space) |
702 | { | 701 | { |
703 | pr_debug(PFX "q %d %#x %#x\n", q, start, end); | 702 | u32 end; |
703 | |||
704 | /* convert from K bytes to qwords used for hw register */ | ||
705 | start *= 1024/8; | ||
706 | space *= 1024/8; | ||
707 | end = start + space - 1; | ||
704 | 708 | ||
705 | sky2_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR); | 709 | sky2_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR); |
706 | sky2_write32(hw, RB_ADDR(q, RB_START), start); | 710 | sky2_write32(hw, RB_ADDR(q, RB_START), start); |
@@ -709,7 +713,6 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 end) | |||
709 | sky2_write32(hw, RB_ADDR(q, RB_RP), start); | 713 | sky2_write32(hw, RB_ADDR(q, RB_RP), start); |
710 | 714 | ||
711 | if (q == Q_R1 || q == Q_R2) { | 715 | if (q == Q_R1 || q == Q_R2) { |
712 | u32 space = end - start + 1; | ||
713 | u32 tp = space - space/4; | 716 | u32 tp = space - space/4; |
714 | 717 | ||
715 | /* On receive queue's set the thresholds | 718 | /* On receive queue's set the thresholds |
@@ -1059,11 +1062,16 @@ static int sky2_rx_start(struct sky2_port *sky2) | |||
1059 | sky2->rx_put = sky2->rx_next = 0; | 1062 | sky2->rx_put = sky2->rx_next = 0; |
1060 | sky2_qset(hw, rxq); | 1063 | sky2_qset(hw, rxq); |
1061 | 1064 | ||
1065 | /* On PCI express lowering the watermark gives better performance */ | ||
1066 | if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP)) | ||
1067 | sky2_write32(hw, Q_ADDR(rxq, Q_WM), BMU_WM_PEX); | ||
1068 | |||
1069 | /* These chips have no ram buffer? | ||
1070 | * MAC Rx RAM Read is controlled by hardware */ | ||
1062 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && | 1071 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && |
1063 | (hw->chip_rev == CHIP_REV_YU_EC_U_A1 || hw->chip_rev == CHIP_REV_YU_EC_U_B0)) { | 1072 | (hw->chip_rev == CHIP_REV_YU_EC_U_A1 |
1064 | /* MAC Rx RAM Read is controlled by hardware */ | 1073 | || hw->chip_rev == CHIP_REV_YU_EC_U_B0)) |
1065 | sky2_write32(hw, Q_ADDR(rxq, Q_F), F_M_RX_RAM_DIS); | 1074 | sky2_write32(hw, Q_ADDR(rxq, Q_F), F_M_RX_RAM_DIS); |
1066 | } | ||
1067 | 1075 | ||
1068 | sky2_prefetch_init(hw, rxq, sky2->rx_le_map, RX_LE_SIZE - 1); | 1076 | sky2_prefetch_init(hw, rxq, sky2->rx_le_map, RX_LE_SIZE - 1); |
1069 | 1077 | ||
@@ -1139,7 +1147,7 @@ static int sky2_up(struct net_device *dev) | |||
1139 | struct sky2_port *sky2 = netdev_priv(dev); | 1147 | struct sky2_port *sky2 = netdev_priv(dev); |
1140 | struct sky2_hw *hw = sky2->hw; | 1148 | struct sky2_hw *hw = sky2->hw; |
1141 | unsigned port = sky2->port; | 1149 | unsigned port = sky2->port; |
1142 | u32 ramsize, rxspace, imask; | 1150 | u32 ramsize, imask; |
1143 | int cap, err = -ENOMEM; | 1151 | int cap, err = -ENOMEM; |
1144 | struct net_device *otherdev = hw->dev[sky2->port^1]; | 1152 | struct net_device *otherdev = hw->dev[sky2->port^1]; |
1145 | 1153 | ||
@@ -1192,20 +1200,25 @@ static int sky2_up(struct net_device *dev) | |||
1192 | 1200 | ||
1193 | sky2_mac_init(hw, port); | 1201 | sky2_mac_init(hw, port); |
1194 | 1202 | ||
1195 | /* Determine available ram buffer space in qwords. */ | 1203 | /* Register is number of 4K blocks on internal RAM buffer. */ |
1196 | ramsize = sky2_read8(hw, B2_E_0) * 4096/8; | 1204 | ramsize = sky2_read8(hw, B2_E_0) * 4; |
1205 | printk(KERN_INFO PFX "%s: ram buffer %dK\n", dev->name, ramsize); | ||
1197 | 1206 | ||
1198 | if (ramsize > 6*1024/8) | 1207 | if (ramsize > 0) { |
1199 | rxspace = ramsize - (ramsize + 2) / 3; | 1208 | u32 rxspace; |
1200 | else | ||
1201 | rxspace = ramsize / 2; | ||
1202 | 1209 | ||
1203 | sky2_ramset(hw, rxqaddr[port], 0, rxspace-1); | 1210 | if (ramsize < 16) |
1204 | sky2_ramset(hw, txqaddr[port], rxspace, ramsize-1); | 1211 | rxspace = ramsize / 2; |
1212 | else | ||
1213 | rxspace = 8 + (2*(ramsize - 16))/3; | ||
1214 | |||
1215 | sky2_ramset(hw, rxqaddr[port], 0, rxspace); | ||
1216 | sky2_ramset(hw, txqaddr[port], rxspace, ramsize - rxspace); | ||
1205 | 1217 | ||
1206 | /* Make sure SyncQ is disabled */ | 1218 | /* Make sure SyncQ is disabled */ |
1207 | sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL), | 1219 | sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL), |
1208 | RB_RST_SET); | 1220 | RB_RST_SET); |
1221 | } | ||
1209 | 1222 | ||
1210 | sky2_qset(hw, txqaddr[port]); | 1223 | sky2_qset(hw, txqaddr[port]); |
1211 | 1224 | ||
@@ -2917,18 +2930,8 @@ static void sky2_led(struct sky2_hw *hw, unsigned port, int on) | |||
2917 | 2930 | ||
2918 | default: | 2931 | default: |
2919 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); | 2932 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); |
2920 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, | 2933 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, |
2921 | on ? PHY_M_LED_MO_DUP(MO_LED_ON) | | 2934 | on ? PHY_M_LED_ALL : 0); |
2922 | PHY_M_LED_MO_10(MO_LED_ON) | | ||
2923 | PHY_M_LED_MO_100(MO_LED_ON) | | ||
2924 | PHY_M_LED_MO_1000(MO_LED_ON) | | ||
2925 | PHY_M_LED_MO_RX(MO_LED_ON) | ||
2926 | : PHY_M_LED_MO_DUP(MO_LED_OFF) | | ||
2927 | PHY_M_LED_MO_10(MO_LED_OFF) | | ||
2928 | PHY_M_LED_MO_100(MO_LED_OFF) | | ||
2929 | PHY_M_LED_MO_1000(MO_LED_OFF) | | ||
2930 | PHY_M_LED_MO_RX(MO_LED_OFF)); | ||
2931 | |||
2932 | } | 2935 | } |
2933 | } | 2936 | } |
2934 | 2937 | ||
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 7760545edbf2..6ed1d47dbbd3 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -608,7 +608,7 @@ enum { | |||
608 | PHY_ADDR_MARV = 0, | 608 | PHY_ADDR_MARV = 0, |
609 | }; | 609 | }; |
610 | 610 | ||
611 | #define RB_ADDR(offs, queue) (B16_RAM_REGS + (queue) + (offs)) | 611 | #define RB_ADDR(offs, queue) ((u16) B16_RAM_REGS + (queue) + (offs)) |
612 | 612 | ||
613 | 613 | ||
614 | enum { | 614 | enum { |
@@ -680,6 +680,7 @@ enum { | |||
680 | BMU_FIFO_ENA | BMU_OP_ON, | 680 | BMU_FIFO_ENA | BMU_OP_ON, |
681 | 681 | ||
682 | BMU_WM_DEFAULT = 0x600, | 682 | BMU_WM_DEFAULT = 0x600, |
683 | BMU_WM_PEX = 0x80, | ||
683 | }; | 684 | }; |
684 | 685 | ||
685 | /* Tx BMU Control / Status Registers (Yukon-2) */ | 686 | /* Tx BMU Control / Status Registers (Yukon-2) */ |
@@ -1060,7 +1061,7 @@ enum { | |||
1060 | PHY_M_PC_EN_DET_PLUS = 3<<8, /* Energy Detect Plus (Mode 2) */ | 1061 | PHY_M_PC_EN_DET_PLUS = 3<<8, /* Energy Detect Plus (Mode 2) */ |
1061 | }; | 1062 | }; |
1062 | 1063 | ||
1063 | #define PHY_M_PC_MDI_XMODE(x) (((x)<<5) & PHY_M_PC_MDIX_MSK) | 1064 | #define PHY_M_PC_MDI_XMODE(x) (((u16)(x)<<5) & PHY_M_PC_MDIX_MSK) |
1064 | 1065 | ||
1065 | enum { | 1066 | enum { |
1066 | PHY_M_PC_MAN_MDI = 0, /* 00 = Manual MDI configuration */ | 1067 | PHY_M_PC_MAN_MDI = 0, /* 00 = Manual MDI configuration */ |
@@ -1156,13 +1157,13 @@ enum { | |||
1156 | PHY_M_EC_TX_TIM_CT = 1<<1, /* RGMII Tx Timing Control */ | 1157 | PHY_M_EC_TX_TIM_CT = 1<<1, /* RGMII Tx Timing Control */ |
1157 | PHY_M_EC_TRANS_DIS = 1<<0, /* Transmitter Disable (88E1111 only) */}; | 1158 | PHY_M_EC_TRANS_DIS = 1<<0, /* Transmitter Disable (88E1111 only) */}; |
1158 | 1159 | ||
1159 | #define PHY_M_EC_M_DSC(x) ((x)<<10 & PHY_M_EC_M_DSC_MSK) | 1160 | #define PHY_M_EC_M_DSC(x) ((u16)(x)<<10 & PHY_M_EC_M_DSC_MSK) |
1160 | /* 00=1x; 01=2x; 10=3x; 11=4x */ | 1161 | /* 00=1x; 01=2x; 10=3x; 11=4x */ |
1161 | #define PHY_M_EC_S_DSC(x) ((x)<<8 & PHY_M_EC_S_DSC_MSK) | 1162 | #define PHY_M_EC_S_DSC(x) ((u16)(x)<<8 & PHY_M_EC_S_DSC_MSK) |
1162 | /* 00=dis; 01=1x; 10=2x; 11=3x */ | 1163 | /* 00=dis; 01=1x; 10=2x; 11=3x */ |
1163 | #define PHY_M_EC_DSC_2(x) ((x)<<9 & PHY_M_EC_M_DSC_MSK2) | 1164 | #define PHY_M_EC_DSC_2(x) ((u16)(x)<<9 & PHY_M_EC_M_DSC_MSK2) |
1164 | /* 000=1x; 001=2x; 010=3x; 011=4x */ | 1165 | /* 000=1x; 001=2x; 010=3x; 011=4x */ |
1165 | #define PHY_M_EC_MAC_S(x) ((x)<<4 & PHY_M_EC_MAC_S_MSK) | 1166 | #define PHY_M_EC_MAC_S(x) ((u16)(x)<<4 & PHY_M_EC_MAC_S_MSK) |
1166 | /* 01X=0; 110=2.5; 111=25 (MHz) */ | 1167 | /* 01X=0; 110=2.5; 111=25 (MHz) */ |
1167 | 1168 | ||
1168 | /* for Yukon-2 Gigabit Ethernet PHY (88E1112 only) */ | 1169 | /* for Yukon-2 Gigabit Ethernet PHY (88E1112 only) */ |
@@ -1173,7 +1174,7 @@ enum { | |||
1173 | }; | 1174 | }; |
1174 | /* !!! Errata in spec. (1 = disable) */ | 1175 | /* !!! Errata in spec. (1 = disable) */ |
1175 | 1176 | ||
1176 | #define PHY_M_PC_DSC(x) (((x)<<12) & PHY_M_PC_DSC_MSK) | 1177 | #define PHY_M_PC_DSC(x) (((u16)(x)<<12) & PHY_M_PC_DSC_MSK) |
1177 | /* 100=5x; 101=6x; 110=7x; 111=8x */ | 1178 | /* 100=5x; 101=6x; 110=7x; 111=8x */ |
1178 | enum { | 1179 | enum { |
1179 | MAC_TX_CLK_0_MHZ = 2, | 1180 | MAC_TX_CLK_0_MHZ = 2, |
@@ -1203,7 +1204,7 @@ enum { | |||
1203 | PHY_M_LEDC_TX_C_MSB = 1<<0, /* Tx Control (MSB, 88E1111 only) */ | 1204 | PHY_M_LEDC_TX_C_MSB = 1<<0, /* Tx Control (MSB, 88E1111 only) */ |
1204 | }; | 1205 | }; |
1205 | 1206 | ||
1206 | #define PHY_M_LED_PULS_DUR(x) (((x)<<12) & PHY_M_LEDC_PULS_MSK) | 1207 | #define PHY_M_LED_PULS_DUR(x) (((u16)(x)<<12) & PHY_M_LEDC_PULS_MSK) |
1207 | 1208 | ||
1208 | /***** PHY_MARV_PHY_STAT (page 3)16 bit r/w Polarity Control Reg. *****/ | 1209 | /***** PHY_MARV_PHY_STAT (page 3)16 bit r/w Polarity Control Reg. *****/ |
1209 | enum { | 1210 | enum { |
@@ -1233,7 +1234,7 @@ enum { | |||
1233 | PULS_1300MS = 7,/* 1.3 s to 2.7 s */ | 1234 | PULS_1300MS = 7,/* 1.3 s to 2.7 s */ |
1234 | }; | 1235 | }; |
1235 | 1236 | ||
1236 | #define PHY_M_LED_BLINK_RT(x) (((x)<<8) & PHY_M_LEDC_BL_R_MSK) | 1237 | #define PHY_M_LED_BLINK_RT(x) (((u16)(x)<<8) & PHY_M_LEDC_BL_R_MSK) |
1237 | 1238 | ||
1238 | enum { | 1239 | enum { |
1239 | BLINK_42MS = 0,/* 42 ms */ | 1240 | BLINK_42MS = 0,/* 42 ms */ |
@@ -1243,21 +1244,18 @@ enum { | |||
1243 | BLINK_670MS = 4,/* 670 ms */ | 1244 | BLINK_670MS = 4,/* 670 ms */ |
1244 | }; | 1245 | }; |
1245 | 1246 | ||
1246 | /***** PHY_MARV_LED_OVER 16 bit r/w Manual LED Override Reg *****/ | 1247 | /**** PHY_MARV_LED_OVER 16 bit r/w LED control */ |
1247 | #define PHY_M_LED_MO_SGMII(x) ((x)<<14) /* Bit 15..14: SGMII AN Timer */ | ||
1248 | /* Bit 13..12: reserved */ | ||
1249 | #define PHY_M_LED_MO_DUP(x) ((x)<<10) /* Bit 11..10: Duplex */ | ||
1250 | #define PHY_M_LED_MO_10(x) ((x)<<8) /* Bit 9.. 8: Link 10 */ | ||
1251 | #define PHY_M_LED_MO_100(x) ((x)<<6) /* Bit 7.. 6: Link 100 */ | ||
1252 | #define PHY_M_LED_MO_1000(x) ((x)<<4) /* Bit 5.. 4: Link 1000 */ | ||
1253 | #define PHY_M_LED_MO_RX(x) ((x)<<2) /* Bit 3.. 2: Rx */ | ||
1254 | #define PHY_M_LED_MO_TX(x) ((x)<<0) /* Bit 1.. 0: Tx */ | ||
1255 | |||
1256 | enum { | 1248 | enum { |
1257 | MO_LED_NORM = 0, | 1249 | PHY_M_LED_MO_DUP = 3<<10,/* Bit 11..10: Duplex */ |
1258 | MO_LED_BLINK = 1, | 1250 | PHY_M_LED_MO_10 = 3<<8, /* Bit 9.. 8: Link 10 */ |
1259 | MO_LED_OFF = 2, | 1251 | PHY_M_LED_MO_100 = 3<<6, /* Bit 7.. 6: Link 100 */ |
1260 | MO_LED_ON = 3, | 1252 | PHY_M_LED_MO_1000 = 3<<4, /* Bit 5.. 4: Link 1000 */ |
1253 | PHY_M_LED_MO_RX = 3<<2, /* Bit 3.. 2: Rx */ | ||
1254 | PHY_M_LED_MO_TX = 3<<0, /* Bit 1.. 0: Tx */ | ||
1255 | |||
1256 | PHY_M_LED_ALL = PHY_M_LED_MO_DUP | PHY_M_LED_MO_10 | ||
1257 | | PHY_M_LED_MO_100 | PHY_M_LED_MO_1000 | ||
1258 | | PHY_M_LED_MO_RX, | ||
1261 | }; | 1259 | }; |
1262 | 1260 | ||
1263 | /***** PHY_MARV_EXT_CTRL_2 16 bit r/w Ext. PHY Specific Ctrl 2 *****/ | 1261 | /***** PHY_MARV_EXT_CTRL_2 16 bit r/w Ext. PHY Specific Ctrl 2 *****/ |
@@ -1294,9 +1292,9 @@ enum { | |||
1294 | PHY_M_FELP_LED0_MSK = 0xf, /* Bit 3.. 0: LED0 Mask (SPEED) */ | 1292 | PHY_M_FELP_LED0_MSK = 0xf, /* Bit 3.. 0: LED0 Mask (SPEED) */ |
1295 | }; | 1293 | }; |
1296 | 1294 | ||
1297 | #define PHY_M_FELP_LED2_CTRL(x) (((x)<<8) & PHY_M_FELP_LED2_MSK) | 1295 | #define PHY_M_FELP_LED2_CTRL(x) (((u16)(x)<<8) & PHY_M_FELP_LED2_MSK) |
1298 | #define PHY_M_FELP_LED1_CTRL(x) (((x)<<4) & PHY_M_FELP_LED1_MSK) | 1296 | #define PHY_M_FELP_LED1_CTRL(x) (((u16)(x)<<4) & PHY_M_FELP_LED1_MSK) |
1299 | #define PHY_M_FELP_LED0_CTRL(x) (((x)<<0) & PHY_M_FELP_LED0_MSK) | 1297 | #define PHY_M_FELP_LED0_CTRL(x) (((u16)(x)<<0) & PHY_M_FELP_LED0_MSK) |
1300 | 1298 | ||
1301 | enum { | 1299 | enum { |
1302 | LED_PAR_CTRL_COLX = 0x00, | 1300 | LED_PAR_CTRL_COLX = 0x00, |
@@ -1552,8 +1550,8 @@ enum { | |||
1552 | GM_SMI_CT_BUSY = 1<<3, /* Bit 3: Busy (Operation in progress) */ | 1550 | GM_SMI_CT_BUSY = 1<<3, /* Bit 3: Busy (Operation in progress) */ |
1553 | }; | 1551 | }; |
1554 | 1552 | ||
1555 | #define GM_SMI_CT_PHY_AD(x) (((x)<<11) & GM_SMI_CT_PHY_A_MSK) | 1553 | #define GM_SMI_CT_PHY_AD(x) (((u16)(x)<<11) & GM_SMI_CT_PHY_A_MSK) |
1556 | #define GM_SMI_CT_REG_AD(x) (((x)<<6) & GM_SMI_CT_REG_A_MSK) | 1554 | #define GM_SMI_CT_REG_AD(x) (((u16)(x)<<6) & GM_SMI_CT_REG_A_MSK) |
1557 | 1555 | ||
1558 | /* GM_PHY_ADDR 16 bit r/w GPHY Address Register */ | 1556 | /* GM_PHY_ADDR 16 bit r/w GPHY Address Register */ |
1559 | enum { | 1557 | enum { |
diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c index 889ef0d7c374..d70bc9795346 100644 --- a/drivers/net/smc-ultra.c +++ b/drivers/net/smc-ultra.c | |||
@@ -593,7 +593,7 @@ static void cleanup_card(struct net_device *dev) | |||
593 | iounmap(ei_status.mem); | 593 | iounmap(ei_status.mem); |
594 | } | 594 | } |
595 | 595 | ||
596 | void | 596 | void __exit |
597 | cleanup_module(void) | 597 | cleanup_module(void) |
598 | { | 598 | { |
599 | int this_dev; | 599 | int this_dev; |
diff --git a/drivers/net/smc-ultra32.c b/drivers/net/smc-ultra32.c index e10755ec5def..2c5319c62fa5 100644 --- a/drivers/net/smc-ultra32.c +++ b/drivers/net/smc-ultra32.c | |||
@@ -437,7 +437,7 @@ int __init init_module(void) | |||
437 | return -ENXIO; | 437 | return -ENXIO; |
438 | } | 438 | } |
439 | 439 | ||
440 | void cleanup_module(void) | 440 | void __exit cleanup_module(void) |
441 | { | 441 | { |
442 | int this_dev; | 442 | int this_dev; |
443 | 443 | ||
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c index c0d13d650913..bd6e84506c29 100644 --- a/drivers/net/smc9194.c +++ b/drivers/net/smc9194.c | |||
@@ -1616,7 +1616,7 @@ int __init init_module(void) | |||
1616 | return 0; | 1616 | return 0; |
1617 | } | 1617 | } |
1618 | 1618 | ||
1619 | void cleanup_module(void) | 1619 | void __exit cleanup_module(void) |
1620 | { | 1620 | { |
1621 | unregister_netdev(devSMC9194); | 1621 | unregister_netdev(devSMC9194); |
1622 | free_irq(devSMC9194->irq, devSMC9194); | 1622 | free_irq(devSMC9194->irq, devSMC9194); |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index a8640169fc77..9367c574477a 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -238,7 +238,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
238 | #define SMC_CAN_USE_16BIT 1 | 238 | #define SMC_CAN_USE_16BIT 1 |
239 | #define SMC_CAN_USE_32BIT 0 | 239 | #define SMC_CAN_USE_32BIT 0 |
240 | 240 | ||
241 | #define SMC_inb(a, r) inb((u32)a) + (r)) | 241 | #define SMC_inb(a, r) inb(((u32)a) + (r)) |
242 | #define SMC_inw(a, r) inw(((u32)a) + (r)) | 242 | #define SMC_inw(a, r) inw(((u32)a) + (r)) |
243 | #define SMC_outb(v, a, r) outb(v, ((u32)a) + (r)) | 243 | #define SMC_outb(v, a, r) outb(v, ((u32)a) + (r)) |
244 | #define SMC_outw(v, a, r) outw(v, ((u32)a) + (r)) | 244 | #define SMC_outw(v, a, r) outw(v, ((u32)a) + (r)) |
@@ -434,6 +434,24 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r, | |||
434 | 434 | ||
435 | #define SMC_IRQ_FLAGS (0) | 435 | #define SMC_IRQ_FLAGS (0) |
436 | 436 | ||
437 | #elif defined(CONFIG_ARCH_VERSATILE) | ||
438 | |||
439 | #define SMC_CAN_USE_8BIT 1 | ||
440 | #define SMC_CAN_USE_16BIT 1 | ||
441 | #define SMC_CAN_USE_32BIT 1 | ||
442 | #define SMC_NOWAIT 1 | ||
443 | |||
444 | #define SMC_inb(a, r) readb((a) + (r)) | ||
445 | #define SMC_inw(a, r) readw((a) + (r)) | ||
446 | #define SMC_inl(a, r) readl((a) + (r)) | ||
447 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
448 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
449 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
450 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | ||
451 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | ||
452 | |||
453 | #define SMC_IRQ_FLAGS (0) | ||
454 | |||
437 | #else | 455 | #else |
438 | 456 | ||
439 | #define SMC_CAN_USE_8BIT 1 | 457 | #define SMC_CAN_USE_8BIT 1 |
@@ -1216,7 +1234,7 @@ static const char * chip_ids[ 16 ] = { | |||
1216 | if (SMC_CAN_USE_32BIT) { \ | 1234 | if (SMC_CAN_USE_32BIT) { \ |
1217 | void *__ptr = (p); \ | 1235 | void *__ptr = (p); \ |
1218 | int __len = (l); \ | 1236 | int __len = (l); \ |
1219 | void *__ioaddr = ioaddr; \ | 1237 | void __iomem *__ioaddr = ioaddr; \ |
1220 | if (__len >= 2 && (unsigned long)__ptr & 2) { \ | 1238 | if (__len >= 2 && (unsigned long)__ptr & 2) { \ |
1221 | __len -= 2; \ | 1239 | __len -= 2; \ |
1222 | SMC_outw(*(u16 *)__ptr, ioaddr, DATA_REG); \ | 1240 | SMC_outw(*(u16 *)__ptr, ioaddr, DATA_REG); \ |
@@ -1240,7 +1258,7 @@ static const char * chip_ids[ 16 ] = { | |||
1240 | if (SMC_CAN_USE_32BIT) { \ | 1258 | if (SMC_CAN_USE_32BIT) { \ |
1241 | void *__ptr = (p); \ | 1259 | void *__ptr = (p); \ |
1242 | int __len = (l); \ | 1260 | int __len = (l); \ |
1243 | void *__ioaddr = ioaddr; \ | 1261 | void __iomem *__ioaddr = ioaddr; \ |
1244 | if ((unsigned long)__ptr & 2) { \ | 1262 | if ((unsigned long)__ptr & 2) { \ |
1245 | /* \ | 1263 | /* \ |
1246 | * We want 32bit alignment here. \ | 1264 | * We want 32bit alignment here. \ |
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index 47a1c09d19ac..c62e85d89f41 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c | |||
@@ -945,7 +945,7 @@ static void set_multicast_list( struct net_device *dev ) | |||
945 | 945 | ||
946 | static struct net_device *sun3lance_dev; | 946 | static struct net_device *sun3lance_dev; |
947 | 947 | ||
948 | int init_module(void) | 948 | int __init init_module(void) |
949 | { | 949 | { |
950 | sun3lance_dev = sun3lance_probe(-1); | 950 | sun3lance_dev = sun3lance_probe(-1); |
951 | if (IS_ERR(sun3lance_dev)) | 951 | if (IS_ERR(sun3lance_dev)) |
@@ -953,7 +953,7 @@ int init_module(void) | |||
953 | return 0; | 953 | return 0; |
954 | } | 954 | } |
955 | 955 | ||
956 | void cleanup_module(void) | 956 | void __exit cleanup_module(void) |
957 | { | 957 | { |
958 | unregister_netdev(sun3lance_dev); | 958 | unregister_netdev(sun3lance_dev); |
959 | #ifdef CONFIG_SUN3 | 959 | #ifdef CONFIG_SUN3 |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index d9123c9adc1e..571320ae87ab 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -68,8 +68,8 @@ | |||
68 | 68 | ||
69 | #define DRV_MODULE_NAME "tg3" | 69 | #define DRV_MODULE_NAME "tg3" |
70 | #define PFX DRV_MODULE_NAME ": " | 70 | #define PFX DRV_MODULE_NAME ": " |
71 | #define DRV_MODULE_VERSION "3.69" | 71 | #define DRV_MODULE_VERSION "3.70" |
72 | #define DRV_MODULE_RELDATE "November 15, 2006" | 72 | #define DRV_MODULE_RELDATE "December 1, 2006" |
73 | 73 | ||
74 | #define TG3_DEF_MAC_MODE 0 | 74 | #define TG3_DEF_MAC_MODE 0 |
75 | #define TG3_DEF_RX_MODE 0 | 75 | #define TG3_DEF_RX_MODE 0 |
@@ -192,6 +192,7 @@ static struct pci_device_id tg3_pci_tbl[] = { | |||
192 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5786)}, | 192 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5786)}, |
193 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787)}, | 193 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787)}, |
194 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M)}, | 194 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M)}, |
195 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787F)}, | ||
195 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5714)}, | 196 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5714)}, |
196 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5714S)}, | 197 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5714S)}, |
197 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5715)}, | 198 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5715)}, |
@@ -1061,7 +1062,7 @@ static void tg3_frob_aux_power(struct tg3 *tp) | |||
1061 | { | 1062 | { |
1062 | struct tg3 *tp_peer = tp; | 1063 | struct tg3 *tp_peer = tp; |
1063 | 1064 | ||
1064 | if ((tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) != 0) | 1065 | if ((tp->tg3_flags2 & TG3_FLG2_IS_NIC) == 0) |
1065 | return; | 1066 | return; |
1066 | 1067 | ||
1067 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || | 1068 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || |
@@ -1212,8 +1213,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
1212 | power_control); | 1213 | power_control); |
1213 | udelay(100); /* Delay after power state change */ | 1214 | udelay(100); /* Delay after power state change */ |
1214 | 1215 | ||
1215 | /* Switch out of Vaux if it is not a LOM */ | 1216 | /* Switch out of Vaux if it is a NIC */ |
1216 | if (!(tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT)) | 1217 | if (tp->tg3_flags2 & TG3_FLG2_IS_NIC) |
1217 | tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl, 100); | 1218 | tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl, 100); |
1218 | 1219 | ||
1219 | return 0; | 1220 | return 0; |
@@ -1401,8 +1402,10 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
1401 | static void tg3_link_report(struct tg3 *tp) | 1402 | static void tg3_link_report(struct tg3 *tp) |
1402 | { | 1403 | { |
1403 | if (!netif_carrier_ok(tp->dev)) { | 1404 | if (!netif_carrier_ok(tp->dev)) { |
1404 | printk(KERN_INFO PFX "%s: Link is down.\n", tp->dev->name); | 1405 | if (netif_msg_link(tp)) |
1405 | } else { | 1406 | printk(KERN_INFO PFX "%s: Link is down.\n", |
1407 | tp->dev->name); | ||
1408 | } else if (netif_msg_link(tp)) { | ||
1406 | printk(KERN_INFO PFX "%s: Link is up at %d Mbps, %s duplex.\n", | 1409 | printk(KERN_INFO PFX "%s: Link is up at %d Mbps, %s duplex.\n", |
1407 | tp->dev->name, | 1410 | tp->dev->name, |
1408 | (tp->link_config.active_speed == SPEED_1000 ? | 1411 | (tp->link_config.active_speed == SPEED_1000 ? |
@@ -1557,12 +1560,6 @@ static void tg3_phy_copper_begin(struct tg3 *tp) | |||
1557 | 1560 | ||
1558 | tg3_writephy(tp, MII_ADVERTISE, new_adv); | 1561 | tg3_writephy(tp, MII_ADVERTISE, new_adv); |
1559 | } else if (tp->link_config.speed == SPEED_INVALID) { | 1562 | } else if (tp->link_config.speed == SPEED_INVALID) { |
1560 | tp->link_config.advertising = | ||
1561 | (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | ||
1562 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | | ||
1563 | ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full | | ||
1564 | ADVERTISED_Autoneg | ADVERTISED_MII); | ||
1565 | |||
1566 | if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) | 1563 | if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) |
1567 | tp->link_config.advertising &= | 1564 | tp->link_config.advertising &= |
1568 | ~(ADVERTISED_1000baseT_Half | | 1565 | ~(ADVERTISED_1000baseT_Half | |
@@ -1706,25 +1703,36 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp) | |||
1706 | return err; | 1703 | return err; |
1707 | } | 1704 | } |
1708 | 1705 | ||
1709 | static int tg3_copper_is_advertising_all(struct tg3 *tp) | 1706 | static int tg3_copper_is_advertising_all(struct tg3 *tp, u32 mask) |
1710 | { | 1707 | { |
1711 | u32 adv_reg, all_mask; | 1708 | u32 adv_reg, all_mask = 0; |
1709 | |||
1710 | if (mask & ADVERTISED_10baseT_Half) | ||
1711 | all_mask |= ADVERTISE_10HALF; | ||
1712 | if (mask & ADVERTISED_10baseT_Full) | ||
1713 | all_mask |= ADVERTISE_10FULL; | ||
1714 | if (mask & ADVERTISED_100baseT_Half) | ||
1715 | all_mask |= ADVERTISE_100HALF; | ||
1716 | if (mask & ADVERTISED_100baseT_Full) | ||
1717 | all_mask |= ADVERTISE_100FULL; | ||
1712 | 1718 | ||
1713 | if (tg3_readphy(tp, MII_ADVERTISE, &adv_reg)) | 1719 | if (tg3_readphy(tp, MII_ADVERTISE, &adv_reg)) |
1714 | return 0; | 1720 | return 0; |
1715 | 1721 | ||
1716 | all_mask = (ADVERTISE_10HALF | ADVERTISE_10FULL | | ||
1717 | ADVERTISE_100HALF | ADVERTISE_100FULL); | ||
1718 | if ((adv_reg & all_mask) != all_mask) | 1722 | if ((adv_reg & all_mask) != all_mask) |
1719 | return 0; | 1723 | return 0; |
1720 | if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) { | 1724 | if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) { |
1721 | u32 tg3_ctrl; | 1725 | u32 tg3_ctrl; |
1722 | 1726 | ||
1727 | all_mask = 0; | ||
1728 | if (mask & ADVERTISED_1000baseT_Half) | ||
1729 | all_mask |= ADVERTISE_1000HALF; | ||
1730 | if (mask & ADVERTISED_1000baseT_Full) | ||
1731 | all_mask |= ADVERTISE_1000FULL; | ||
1732 | |||
1723 | if (tg3_readphy(tp, MII_TG3_CTRL, &tg3_ctrl)) | 1733 | if (tg3_readphy(tp, MII_TG3_CTRL, &tg3_ctrl)) |
1724 | return 0; | 1734 | return 0; |
1725 | 1735 | ||
1726 | all_mask = (MII_TG3_CTRL_ADV_1000_HALF | | ||
1727 | MII_TG3_CTRL_ADV_1000_FULL); | ||
1728 | if ((tg3_ctrl & all_mask) != all_mask) | 1736 | if ((tg3_ctrl & all_mask) != all_mask) |
1729 | return 0; | 1737 | return 0; |
1730 | } | 1738 | } |
@@ -1884,7 +1892,8 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) | |||
1884 | /* Force autoneg restart if we are exiting | 1892 | /* Force autoneg restart if we are exiting |
1885 | * low power mode. | 1893 | * low power mode. |
1886 | */ | 1894 | */ |
1887 | if (!tg3_copper_is_advertising_all(tp)) | 1895 | if (!tg3_copper_is_advertising_all(tp, |
1896 | tp->link_config.advertising)) | ||
1888 | current_link_up = 0; | 1897 | current_link_up = 0; |
1889 | } else { | 1898 | } else { |
1890 | current_link_up = 0; | 1899 | current_link_up = 0; |
@@ -3703,8 +3712,9 @@ static void tg3_tx_timeout(struct net_device *dev) | |||
3703 | { | 3712 | { |
3704 | struct tg3 *tp = netdev_priv(dev); | 3713 | struct tg3 *tp = netdev_priv(dev); |
3705 | 3714 | ||
3706 | printk(KERN_ERR PFX "%s: transmit timed out, resetting\n", | 3715 | if (netif_msg_tx_err(tp)) |
3707 | dev->name); | 3716 | printk(KERN_ERR PFX "%s: transmit timed out, resetting\n", |
3717 | dev->name); | ||
3708 | 3718 | ||
3709 | schedule_work(&tp->reset_task); | 3719 | schedule_work(&tp->reset_task); |
3710 | } | 3720 | } |
@@ -6396,16 +6406,17 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
6396 | udelay(40); | 6406 | udelay(40); |
6397 | 6407 | ||
6398 | /* tp->grc_local_ctrl is partially set up during tg3_get_invariants(). | 6408 | /* tp->grc_local_ctrl is partially set up during tg3_get_invariants(). |
6399 | * If TG3_FLAG_EEPROM_WRITE_PROT is set, we should read the | 6409 | * If TG3_FLG2_IS_NIC is zero, we should read the |
6400 | * register to preserve the GPIO settings for LOMs. The GPIOs, | 6410 | * register to preserve the GPIO settings for LOMs. The GPIOs, |
6401 | * whether used as inputs or outputs, are set by boot code after | 6411 | * whether used as inputs or outputs, are set by boot code after |
6402 | * reset. | 6412 | * reset. |
6403 | */ | 6413 | */ |
6404 | if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) { | 6414 | if (!(tp->tg3_flags2 & TG3_FLG2_IS_NIC)) { |
6405 | u32 gpio_mask; | 6415 | u32 gpio_mask; |
6406 | 6416 | ||
6407 | gpio_mask = GRC_LCLCTRL_GPIO_OE0 | GRC_LCLCTRL_GPIO_OE2 | | 6417 | gpio_mask = GRC_LCLCTRL_GPIO_OE0 | GRC_LCLCTRL_GPIO_OE1 | |
6408 | GRC_LCLCTRL_GPIO_OUTPUT0 | GRC_LCLCTRL_GPIO_OUTPUT2; | 6418 | GRC_LCLCTRL_GPIO_OE2 | GRC_LCLCTRL_GPIO_OUTPUT0 | |
6419 | GRC_LCLCTRL_GPIO_OUTPUT1 | GRC_LCLCTRL_GPIO_OUTPUT2; | ||
6409 | 6420 | ||
6410 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) | 6421 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) |
6411 | gpio_mask |= GRC_LCLCTRL_GPIO_OE3 | | 6422 | gpio_mask |= GRC_LCLCTRL_GPIO_OE3 | |
@@ -6417,8 +6428,9 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
6417 | tp->grc_local_ctrl |= tr32(GRC_LOCAL_CTRL) & gpio_mask; | 6428 | tp->grc_local_ctrl |= tr32(GRC_LOCAL_CTRL) & gpio_mask; |
6418 | 6429 | ||
6419 | /* GPIO1 must be driven high for eeprom write protect */ | 6430 | /* GPIO1 must be driven high for eeprom write protect */ |
6420 | tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 | | 6431 | if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) |
6421 | GRC_LCLCTRL_GPIO_OUTPUT1); | 6432 | tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 | |
6433 | GRC_LCLCTRL_GPIO_OUTPUT1); | ||
6422 | } | 6434 | } |
6423 | tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl); | 6435 | tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl); |
6424 | udelay(100); | 6436 | udelay(100); |
@@ -8656,7 +8668,9 @@ static int tg3_test_registers(struct tg3 *tp) | |||
8656 | return 0; | 8668 | return 0; |
8657 | 8669 | ||
8658 | out: | 8670 | out: |
8659 | printk(KERN_ERR PFX "Register test failed at offset %x\n", offset); | 8671 | if (netif_msg_hw(tp)) |
8672 | printk(KERN_ERR PFX "Register test failed at offset %x\n", | ||
8673 | offset); | ||
8660 | tw32(offset, save_val); | 8674 | tw32(offset, save_val); |
8661 | return -EIO; | 8675 | return -EIO; |
8662 | } | 8676 | } |
@@ -8781,17 +8795,20 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) | |||
8781 | tg3_writephy(tp, 0x10, phy & ~0x4000); | 8795 | tg3_writephy(tp, 0x10, phy & ~0x4000); |
8782 | tg3_writephy(tp, MII_TG3_EPHY_TEST, phytest); | 8796 | tg3_writephy(tp, MII_TG3_EPHY_TEST, phytest); |
8783 | } | 8797 | } |
8784 | } | 8798 | val = BMCR_LOOPBACK | BMCR_FULLDPLX | BMCR_SPEED100; |
8785 | val = BMCR_LOOPBACK | BMCR_FULLDPLX; | 8799 | } else |
8786 | if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) | 8800 | val = BMCR_LOOPBACK | BMCR_FULLDPLX | BMCR_SPEED1000; |
8787 | val |= BMCR_SPEED100; | ||
8788 | else | ||
8789 | val |= BMCR_SPEED1000; | ||
8790 | 8801 | ||
8791 | tg3_writephy(tp, MII_BMCR, val); | 8802 | tg3_writephy(tp, MII_BMCR, val); |
8792 | udelay(40); | 8803 | udelay(40); |
8793 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | 8804 | |
8805 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | | ||
8806 | MAC_MODE_LINK_POLARITY; | ||
8807 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
8794 | tg3_writephy(tp, MII_TG3_EPHY_PTEST, 0x1800); | 8808 | tg3_writephy(tp, MII_TG3_EPHY_PTEST, 0x1800); |
8809 | mac_mode |= MAC_MODE_PORT_MODE_MII; | ||
8810 | } else | ||
8811 | mac_mode |= MAC_MODE_PORT_MODE_GMII; | ||
8795 | 8812 | ||
8796 | /* reset to prevent losing 1st rx packet intermittently */ | 8813 | /* reset to prevent losing 1st rx packet intermittently */ |
8797 | if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { | 8814 | if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { |
@@ -8799,12 +8816,6 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) | |||
8799 | udelay(10); | 8816 | udelay(10); |
8800 | tw32_f(MAC_RX_MODE, tp->rx_mode); | 8817 | tw32_f(MAC_RX_MODE, tp->rx_mode); |
8801 | } | 8818 | } |
8802 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | | ||
8803 | MAC_MODE_LINK_POLARITY; | ||
8804 | if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) | ||
8805 | mac_mode |= MAC_MODE_PORT_MODE_MII; | ||
8806 | else | ||
8807 | mac_mode |= MAC_MODE_PORT_MODE_GMII; | ||
8808 | if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) { | 8819 | if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) { |
8809 | mac_mode &= ~MAC_MODE_LINK_POLARITY; | 8820 | mac_mode &= ~MAC_MODE_LINK_POLARITY; |
8810 | tg3_writephy(tp, MII_TG3_EXT_CTRL, | 8821 | tg3_writephy(tp, MII_TG3_EXT_CTRL, |
@@ -9456,16 +9467,12 @@ static void __devinit tg3_get_5906_nvram_info(struct tg3 *tp) | |||
9456 | /* Chips other than 5700/5701 use the NVRAM for fetching info. */ | 9467 | /* Chips other than 5700/5701 use the NVRAM for fetching info. */ |
9457 | static void __devinit tg3_nvram_init(struct tg3 *tp) | 9468 | static void __devinit tg3_nvram_init(struct tg3 *tp) |
9458 | { | 9469 | { |
9459 | int j; | ||
9460 | |||
9461 | tw32_f(GRC_EEPROM_ADDR, | 9470 | tw32_f(GRC_EEPROM_ADDR, |
9462 | (EEPROM_ADDR_FSM_RESET | | 9471 | (EEPROM_ADDR_FSM_RESET | |
9463 | (EEPROM_DEFAULT_CLOCK_PERIOD << | 9472 | (EEPROM_DEFAULT_CLOCK_PERIOD << |
9464 | EEPROM_ADDR_CLKPERD_SHIFT))); | 9473 | EEPROM_ADDR_CLKPERD_SHIFT))); |
9465 | 9474 | ||
9466 | /* XXX schedule_timeout() ... */ | 9475 | msleep(1); |
9467 | for (j = 0; j < 100; j++) | ||
9468 | udelay(10); | ||
9469 | 9476 | ||
9470 | /* Enable seeprom accesses. */ | 9477 | /* Enable seeprom accesses. */ |
9471 | tw32_f(GRC_LOCAL_CTRL, | 9478 | tw32_f(GRC_LOCAL_CTRL, |
@@ -9526,12 +9533,12 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp, | |||
9526 | EEPROM_ADDR_ADDR_MASK) | | 9533 | EEPROM_ADDR_ADDR_MASK) | |
9527 | EEPROM_ADDR_READ | EEPROM_ADDR_START); | 9534 | EEPROM_ADDR_READ | EEPROM_ADDR_START); |
9528 | 9535 | ||
9529 | for (i = 0; i < 10000; i++) { | 9536 | for (i = 0; i < 1000; i++) { |
9530 | tmp = tr32(GRC_EEPROM_ADDR); | 9537 | tmp = tr32(GRC_EEPROM_ADDR); |
9531 | 9538 | ||
9532 | if (tmp & EEPROM_ADDR_COMPLETE) | 9539 | if (tmp & EEPROM_ADDR_COMPLETE) |
9533 | break; | 9540 | break; |
9534 | udelay(100); | 9541 | msleep(1); |
9535 | } | 9542 | } |
9536 | if (!(tmp & EEPROM_ADDR_COMPLETE)) | 9543 | if (!(tmp & EEPROM_ADDR_COMPLETE)) |
9537 | return -EBUSY; | 9544 | return -EBUSY; |
@@ -9656,12 +9663,12 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp, | |||
9656 | EEPROM_ADDR_START | | 9663 | EEPROM_ADDR_START | |
9657 | EEPROM_ADDR_WRITE); | 9664 | EEPROM_ADDR_WRITE); |
9658 | 9665 | ||
9659 | for (j = 0; j < 10000; j++) { | 9666 | for (j = 0; j < 1000; j++) { |
9660 | val = tr32(GRC_EEPROM_ADDR); | 9667 | val = tr32(GRC_EEPROM_ADDR); |
9661 | 9668 | ||
9662 | if (val & EEPROM_ADDR_COMPLETE) | 9669 | if (val & EEPROM_ADDR_COMPLETE) |
9663 | break; | 9670 | break; |
9664 | udelay(100); | 9671 | msleep(1); |
9665 | } | 9672 | } |
9666 | if (!(val & EEPROM_ADDR_COMPLETE)) { | 9673 | if (!(val & EEPROM_ADDR_COMPLETE)) { |
9667 | rc = -EBUSY; | 9674 | rc = -EBUSY; |
@@ -9965,8 +9972,10 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
9965 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | 9972 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; |
9966 | 9973 | ||
9967 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 9974 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
9968 | if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM)) | 9975 | if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM)) { |
9969 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; | 9976 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; |
9977 | tp->tg3_flags2 |= TG3_FLG2_IS_NIC; | ||
9978 | } | ||
9970 | return; | 9979 | return; |
9971 | } | 9980 | } |
9972 | 9981 | ||
@@ -10066,10 +10075,17 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
10066 | tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) | 10075 | tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) |
10067 | tp->led_ctrl = LED_CTRL_MODE_PHY_2; | 10076 | tp->led_ctrl = LED_CTRL_MODE_PHY_2; |
10068 | 10077 | ||
10069 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) | 10078 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) { |
10070 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | 10079 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; |
10071 | else | 10080 | if ((tp->pdev->subsystem_vendor == |
10081 | PCI_VENDOR_ID_ARIMA) && | ||
10082 | (tp->pdev->subsystem_device == 0x205a || | ||
10083 | tp->pdev->subsystem_device == 0x2063)) | ||
10084 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; | ||
10085 | } else { | ||
10072 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; | 10086 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; |
10087 | tp->tg3_flags2 |= TG3_FLG2_IS_NIC; | ||
10088 | } | ||
10073 | 10089 | ||
10074 | if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { | 10090 | if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { |
10075 | tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; | 10091 | tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; |
@@ -10147,7 +10163,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) | |||
10147 | 10163 | ||
10148 | if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) && | 10164 | if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) && |
10149 | !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { | 10165 | !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { |
10150 | u32 bmsr, adv_reg, tg3_ctrl; | 10166 | u32 bmsr, adv_reg, tg3_ctrl, mask; |
10151 | 10167 | ||
10152 | tg3_readphy(tp, MII_BMSR, &bmsr); | 10168 | tg3_readphy(tp, MII_BMSR, &bmsr); |
10153 | if (!tg3_readphy(tp, MII_BMSR, &bmsr) && | 10169 | if (!tg3_readphy(tp, MII_BMSR, &bmsr) && |
@@ -10171,7 +10187,10 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) | |||
10171 | MII_TG3_CTRL_ENABLE_AS_MASTER); | 10187 | MII_TG3_CTRL_ENABLE_AS_MASTER); |
10172 | } | 10188 | } |
10173 | 10189 | ||
10174 | if (!tg3_copper_is_advertising_all(tp)) { | 10190 | mask = (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | |
10191 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | | ||
10192 | ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full); | ||
10193 | if (!tg3_copper_is_advertising_all(tp, mask)) { | ||
10175 | tg3_writephy(tp, MII_ADVERTISE, adv_reg); | 10194 | tg3_writephy(tp, MII_ADVERTISE, adv_reg); |
10176 | 10195 | ||
10177 | if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) | 10196 | if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) |
@@ -10695,7 +10714,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10695 | tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG; | 10714 | tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG; |
10696 | 10715 | ||
10697 | /* Get eeprom hw config before calling tg3_set_power_state(). | 10716 | /* Get eeprom hw config before calling tg3_set_power_state(). |
10698 | * In particular, the TG3_FLAG_EEPROM_WRITE_PROT flag must be | 10717 | * In particular, the TG3_FLG2_IS_NIC flag must be |
10699 | * determined before calling tg3_set_power_state() so that | 10718 | * determined before calling tg3_set_power_state() so that |
10700 | * we know whether or not to switch out of Vaux power. | 10719 | * we know whether or not to switch out of Vaux power. |
10701 | * When the flag is set, it means that GPIO1 is used for eeprom | 10720 | * When the flag is set, it means that GPIO1 is used for eeprom |
@@ -10862,7 +10881,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10862 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F)) || | 10881 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F)) || |
10863 | (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM && | 10882 | (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM && |
10864 | (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5751F || | 10883 | (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5751F || |
10865 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5753F)) || | 10884 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5753F || |
10885 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5787F)) || | ||
10866 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | 10886 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) |
10867 | tp->tg3_flags |= TG3_FLAG_10_100_ONLY; | 10887 | tp->tg3_flags |= TG3_FLAG_10_100_ONLY; |
10868 | 10888 | ||
@@ -11912,13 +11932,15 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
11912 | 11932 | ||
11913 | pci_set_drvdata(pdev, dev); | 11933 | pci_set_drvdata(pdev, dev); |
11914 | 11934 | ||
11915 | printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (%s) %sBaseT Ethernet ", | 11935 | printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (%s) %s Ethernet ", |
11916 | dev->name, | 11936 | dev->name, |
11917 | tp->board_part_number, | 11937 | tp->board_part_number, |
11918 | tp->pci_chip_rev_id, | 11938 | tp->pci_chip_rev_id, |
11919 | tg3_phy_string(tp), | 11939 | tg3_phy_string(tp), |
11920 | tg3_bus_string(tp, str), | 11940 | tg3_bus_string(tp, str), |
11921 | (tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100" : "10/100/1000"); | 11941 | ((tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100Base-TX" : |
11942 | ((tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) ? "1000Base-SX" : | ||
11943 | "10/100/1000Base-T"))); | ||
11922 | 11944 | ||
11923 | for (i = 0; i < 6; i++) | 11945 | for (i = 0; i < 6; i++) |
11924 | printk("%2.2x%c", dev->dev_addr[i], | 11946 | printk("%2.2x%c", dev->dev_addr[i], |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 92f53000bce6..dfaf4ed127bd 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2233,6 +2233,7 @@ struct tg3 { | |||
2233 | #define TG3_FLG2_PCI_EXPRESS 0x00000200 | 2233 | #define TG3_FLG2_PCI_EXPRESS 0x00000200 |
2234 | #define TG3_FLG2_ASF_NEW_HANDSHAKE 0x00000400 | 2234 | #define TG3_FLG2_ASF_NEW_HANDSHAKE 0x00000400 |
2235 | #define TG3_FLG2_HW_AUTONEG 0x00000800 | 2235 | #define TG3_FLG2_HW_AUTONEG 0x00000800 |
2236 | #define TG3_FLG2_IS_NIC 0x00001000 | ||
2236 | #define TG3_FLG2_PHY_SERDES 0x00002000 | 2237 | #define TG3_FLG2_PHY_SERDES 0x00002000 |
2237 | #define TG3_FLG2_CAPACITIVE_COUPLING 0x00004000 | 2238 | #define TG3_FLG2_CAPACITIVE_COUPLING 0x00004000 |
2238 | #define TG3_FLG2_FLASH 0x00008000 | 2239 | #define TG3_FLG2_FLASH 0x00008000 |
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c index 46dabdb12071..cec282a6f62d 100644 --- a/drivers/net/tokenring/smctr.c +++ b/drivers/net/tokenring/smctr.c | |||
@@ -5706,7 +5706,7 @@ int __init init_module(void) | |||
5706 | return found ? 0 : -ENODEV; | 5706 | return found ? 0 : -ENODEV; |
5707 | } | 5707 | } |
5708 | 5708 | ||
5709 | void cleanup_module(void) | 5709 | void __exit cleanup_module(void) |
5710 | { | 5710 | { |
5711 | int i; | 5711 | int i; |
5712 | 5712 | ||
diff --git a/drivers/net/wd.c b/drivers/net/wd.c index 41f1d6778849..7f38012b9c92 100644 --- a/drivers/net/wd.c +++ b/drivers/net/wd.c | |||
@@ -538,7 +538,7 @@ static void cleanup_card(struct net_device *dev) | |||
538 | iounmap(ei_status.mem); | 538 | iounmap(ei_status.mem); |
539 | } | 539 | } |
540 | 540 | ||
541 | void | 541 | void __exit |
542 | cleanup_module(void) | 542 | cleanup_module(void) |
543 | { | 543 | { |
544 | int this_dev; | 544 | int this_dev; |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index efcdaf1c5f73..44a22701da97 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
50 | #include <net/ieee80211.h> | 50 | #include <net/ieee80211.h> |
51 | #include <linux/kthread.h> | 51 | #include <linux/kthread.h> |
52 | #include <linux/freezer.h> | ||
52 | 53 | ||
53 | #include "airo.h" | 54 | #include "airo.h" |
54 | 55 | ||
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index 08bc57a4b895..974a8e5bec8b 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c | |||
@@ -1100,15 +1100,13 @@ static struct sta_info * ap_add_sta(struct ap_data *ap, u8 *addr) | |||
1100 | { | 1100 | { |
1101 | struct sta_info *sta; | 1101 | struct sta_info *sta; |
1102 | 1102 | ||
1103 | sta = (struct sta_info *) | 1103 | sta = kzalloc(sizeof(struct sta_info), GFP_ATOMIC); |
1104 | kmalloc(sizeof(struct sta_info), GFP_ATOMIC); | ||
1105 | if (sta == NULL) { | 1104 | if (sta == NULL) { |
1106 | PDEBUG(DEBUG_AP, "AP: kmalloc failed\n"); | 1105 | PDEBUG(DEBUG_AP, "AP: kmalloc failed\n"); |
1107 | return NULL; | 1106 | return NULL; |
1108 | } | 1107 | } |
1109 | 1108 | ||
1110 | /* initialize STA info data */ | 1109 | /* initialize STA info data */ |
1111 | memset(sta, 0, sizeof(struct sta_info)); | ||
1112 | sta->local = ap->local; | 1110 | sta->local = ap->local; |
1113 | skb_queue_head_init(&sta->tx_buf); | 1111 | skb_queue_head_init(&sta->tx_buf); |
1114 | memcpy(sta->addr, addr, ETH_ALEN); | 1112 | memcpy(sta->addr, addr, ETH_ALEN); |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index ee542ec6d6a8..8d8f4b9b8b07 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -563,12 +563,11 @@ static int prism2_config(struct pcmcia_device *link) | |||
563 | PDEBUG(DEBUG_FLOW, "prism2_config()\n"); | 563 | PDEBUG(DEBUG_FLOW, "prism2_config()\n"); |
564 | 564 | ||
565 | parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL); | 565 | parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL); |
566 | hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL); | 566 | hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL); |
567 | if (parse == NULL || hw_priv == NULL) { | 567 | if (parse == NULL || hw_priv == NULL) { |
568 | ret = -ENOMEM; | 568 | ret = -ENOMEM; |
569 | goto failed; | 569 | goto failed; |
570 | } | 570 | } |
571 | memset(hw_priv, 0, sizeof(*hw_priv)); | ||
572 | 571 | ||
573 | tuple.Attributes = 0; | 572 | tuple.Attributes = 0; |
574 | tuple.TupleData = buf; | 573 | tuple.TupleData = buf; |
diff --git a/drivers/net/wireless/hostap/hostap_download.c b/drivers/net/wireless/hostap/hostap_download.c index ab26b52b3e76..24fc387bba67 100644 --- a/drivers/net/wireless/hostap/hostap_download.c +++ b/drivers/net/wireless/hostap/hostap_download.c | |||
@@ -685,14 +685,12 @@ static int prism2_download(local_info_t *local, | |||
685 | goto out; | 685 | goto out; |
686 | } | 686 | } |
687 | 687 | ||
688 | dl = kmalloc(sizeof(*dl) + param->num_areas * | 688 | dl = kzalloc(sizeof(*dl) + param->num_areas * |
689 | sizeof(struct prism2_download_data_area), GFP_KERNEL); | 689 | sizeof(struct prism2_download_data_area), GFP_KERNEL); |
690 | if (dl == NULL) { | 690 | if (dl == NULL) { |
691 | ret = -ENOMEM; | 691 | ret = -ENOMEM; |
692 | goto out; | 692 | goto out; |
693 | } | 693 | } |
694 | memset(dl, 0, sizeof(*dl) + param->num_areas * | ||
695 | sizeof(struct prism2_download_data_area)); | ||
696 | dl->dl_cmd = param->dl_cmd; | 694 | dl->dl_cmd = param->dl_cmd; |
697 | dl->start_addr = param->start_addr; | 695 | dl->start_addr = param->start_addr; |
698 | dl->num_areas = param->num_areas; | 696 | dl->num_areas = param->num_areas; |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index c19e68636a1c..a394a23b9a20 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -347,14 +347,12 @@ static int hfa384x_cmd(struct net_device *dev, u16 cmd, u16 param0, | |||
347 | if (signal_pending(current)) | 347 | if (signal_pending(current)) |
348 | return -EINTR; | 348 | return -EINTR; |
349 | 349 | ||
350 | entry = (struct hostap_cmd_queue *) | 350 | entry = kzalloc(sizeof(*entry), GFP_ATOMIC); |
351 | kmalloc(sizeof(*entry), GFP_ATOMIC); | ||
352 | if (entry == NULL) { | 351 | if (entry == NULL) { |
353 | printk(KERN_DEBUG "%s: hfa384x_cmd - kmalloc failed\n", | 352 | printk(KERN_DEBUG "%s: hfa384x_cmd - kmalloc failed\n", |
354 | dev->name); | 353 | dev->name); |
355 | return -ENOMEM; | 354 | return -ENOMEM; |
356 | } | 355 | } |
357 | memset(entry, 0, sizeof(*entry)); | ||
358 | atomic_set(&entry->usecnt, 1); | 356 | atomic_set(&entry->usecnt, 1); |
359 | entry->type = CMD_SLEEP; | 357 | entry->type = CMD_SLEEP; |
360 | entry->cmd = cmd; | 358 | entry->cmd = cmd; |
@@ -517,14 +515,12 @@ static int hfa384x_cmd_callback(struct net_device *dev, u16 cmd, u16 param0, | |||
517 | return -1; | 515 | return -1; |
518 | } | 516 | } |
519 | 517 | ||
520 | entry = (struct hostap_cmd_queue *) | 518 | entry = kzalloc(sizeof(*entry), GFP_ATOMIC); |
521 | kmalloc(sizeof(*entry), GFP_ATOMIC); | ||
522 | if (entry == NULL) { | 519 | if (entry == NULL) { |
523 | printk(KERN_DEBUG "%s: hfa384x_cmd_callback - kmalloc " | 520 | printk(KERN_DEBUG "%s: hfa384x_cmd_callback - kmalloc " |
524 | "failed\n", dev->name); | 521 | "failed\n", dev->name); |
525 | return -ENOMEM; | 522 | return -ENOMEM; |
526 | } | 523 | } |
527 | memset(entry, 0, sizeof(*entry)); | ||
528 | atomic_set(&entry->usecnt, 1); | 524 | atomic_set(&entry->usecnt, 1); |
529 | entry->type = CMD_CALLBACK; | 525 | entry->type = CMD_CALLBACK; |
530 | entry->cmd = cmd; | 526 | entry->cmd = cmd; |
@@ -3016,14 +3012,12 @@ static int prism2_set_tim(struct net_device *dev, int aid, int set) | |||
3016 | iface = netdev_priv(dev); | 3012 | iface = netdev_priv(dev); |
3017 | local = iface->local; | 3013 | local = iface->local; |
3018 | 3014 | ||
3019 | new_entry = (struct set_tim_data *) | 3015 | new_entry = kzalloc(sizeof(*new_entry), GFP_ATOMIC); |
3020 | kmalloc(sizeof(*new_entry), GFP_ATOMIC); | ||
3021 | if (new_entry == NULL) { | 3016 | if (new_entry == NULL) { |
3022 | printk(KERN_DEBUG "%s: prism2_set_tim: kmalloc failed\n", | 3017 | printk(KERN_DEBUG "%s: prism2_set_tim: kmalloc failed\n", |
3023 | local->dev->name); | 3018 | local->dev->name); |
3024 | return -ENOMEM; | 3019 | return -ENOMEM; |
3025 | } | 3020 | } |
3026 | memset(new_entry, 0, sizeof(*new_entry)); | ||
3027 | new_entry->aid = aid; | 3021 | new_entry->aid = aid; |
3028 | new_entry->set = set; | 3022 | new_entry->set = set; |
3029 | 3023 | ||
diff --git a/drivers/net/wireless/hostap/hostap_info.c b/drivers/net/wireless/hostap/hostap_info.c index 5fd2b1ad7f5e..b6a02a02da74 100644 --- a/drivers/net/wireless/hostap/hostap_info.c +++ b/drivers/net/wireless/hostap/hostap_info.c | |||
@@ -327,11 +327,10 @@ static void prism2_info_hostscanresults(local_info_t *local, | |||
327 | ptr = (u8 *) pos; | 327 | ptr = (u8 *) pos; |
328 | 328 | ||
329 | new_count = left / result_size; | 329 | new_count = left / result_size; |
330 | results = kmalloc(new_count * sizeof(struct hfa384x_hostscan_result), | 330 | results = kcalloc(new_count, sizeof(struct hfa384x_hostscan_result), |
331 | GFP_ATOMIC); | 331 | GFP_ATOMIC); |
332 | if (results == NULL) | 332 | if (results == NULL) |
333 | return; | 333 | return; |
334 | memset(results, 0, new_count * sizeof(struct hfa384x_hostscan_result)); | ||
335 | 334 | ||
336 | for (i = 0; i < new_count; i++) { | 335 | for (i = 0; i < new_count; i++) { |
337 | memcpy(&results[i], ptr, copy_len); | 336 | memcpy(&results[i], ptr, copy_len); |
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index d061fb3443ff..3b7b8063ff1c 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c | |||
@@ -181,12 +181,10 @@ static int prism2_ioctl_siwencode(struct net_device *dev, | |||
181 | struct ieee80211_crypt_data *new_crypt; | 181 | struct ieee80211_crypt_data *new_crypt; |
182 | 182 | ||
183 | /* take WEP into use */ | 183 | /* take WEP into use */ |
184 | new_crypt = (struct ieee80211_crypt_data *) | 184 | new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), |
185 | kmalloc(sizeof(struct ieee80211_crypt_data), | ||
186 | GFP_KERNEL); | 185 | GFP_KERNEL); |
187 | if (new_crypt == NULL) | 186 | if (new_crypt == NULL) |
188 | return -ENOMEM; | 187 | return -ENOMEM; |
189 | memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); | ||
190 | new_crypt->ops = ieee80211_get_crypto_ops("WEP"); | 188 | new_crypt->ops = ieee80211_get_crypto_ops("WEP"); |
191 | if (!new_crypt->ops) { | 189 | if (!new_crypt->ops) { |
192 | request_module("ieee80211_crypt_wep"); | 190 | request_module("ieee80211_crypt_wep"); |
@@ -3320,14 +3318,12 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev, | |||
3320 | 3318 | ||
3321 | prism2_crypt_delayed_deinit(local, crypt); | 3319 | prism2_crypt_delayed_deinit(local, crypt); |
3322 | 3320 | ||
3323 | new_crypt = (struct ieee80211_crypt_data *) | 3321 | new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), |
3324 | kmalloc(sizeof(struct ieee80211_crypt_data), | ||
3325 | GFP_KERNEL); | 3322 | GFP_KERNEL); |
3326 | if (new_crypt == NULL) { | 3323 | if (new_crypt == NULL) { |
3327 | ret = -ENOMEM; | 3324 | ret = -ENOMEM; |
3328 | goto done; | 3325 | goto done; |
3329 | } | 3326 | } |
3330 | memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); | ||
3331 | new_crypt->ops = ops; | 3327 | new_crypt->ops = ops; |
3332 | new_crypt->priv = new_crypt->ops->init(i); | 3328 | new_crypt->priv = new_crypt->ops->init(i); |
3333 | if (new_crypt->priv == NULL) { | 3329 | if (new_crypt->priv == NULL) { |
@@ -3538,14 +3534,12 @@ static int prism2_ioctl_set_encryption(local_info_t *local, | |||
3538 | 3534 | ||
3539 | prism2_crypt_delayed_deinit(local, crypt); | 3535 | prism2_crypt_delayed_deinit(local, crypt); |
3540 | 3536 | ||
3541 | new_crypt = (struct ieee80211_crypt_data *) | 3537 | new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), |
3542 | kmalloc(sizeof(struct ieee80211_crypt_data), | ||
3543 | GFP_KERNEL); | 3538 | GFP_KERNEL); |
3544 | if (new_crypt == NULL) { | 3539 | if (new_crypt == NULL) { |
3545 | ret = -ENOMEM; | 3540 | ret = -ENOMEM; |
3546 | goto done; | 3541 | goto done; |
3547 | } | 3542 | } |
3548 | memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); | ||
3549 | new_crypt->ops = ops; | 3543 | new_crypt->ops = ops; |
3550 | new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); | 3544 | new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); |
3551 | if (new_crypt->priv == NULL) { | 3545 | if (new_crypt->priv == NULL) { |
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index d1de9766c831..c4f6020baa9e 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c | |||
@@ -300,10 +300,9 @@ static int prism2_pci_probe(struct pci_dev *pdev, | |||
300 | struct hostap_interface *iface; | 300 | struct hostap_interface *iface; |
301 | struct hostap_pci_priv *hw_priv; | 301 | struct hostap_pci_priv *hw_priv; |
302 | 302 | ||
303 | hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL); | 303 | hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL); |
304 | if (hw_priv == NULL) | 304 | if (hw_priv == NULL) |
305 | return -ENOMEM; | 305 | return -ENOMEM; |
306 | memset(hw_priv, 0, sizeof(*hw_priv)); | ||
307 | 306 | ||
308 | if (pci_enable_device(pdev)) | 307 | if (pci_enable_device(pdev)) |
309 | goto err_out_free; | 308 | goto err_out_free; |
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c index bc81b13a5a2a..e235e0647897 100644 --- a/drivers/net/wireless/hostap/hostap_plx.c +++ b/drivers/net/wireless/hostap/hostap_plx.c | |||
@@ -447,10 +447,9 @@ static int prism2_plx_probe(struct pci_dev *pdev, | |||
447 | int tmd7160; | 447 | int tmd7160; |
448 | struct hostap_plx_priv *hw_priv; | 448 | struct hostap_plx_priv *hw_priv; |
449 | 449 | ||
450 | hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL); | 450 | hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL); |
451 | if (hw_priv == NULL) | 451 | if (hw_priv == NULL) |
452 | return -ENOMEM; | 452 | return -ENOMEM; |
453 | memset(hw_priv, 0, sizeof(*hw_priv)); | ||
454 | 453 | ||
455 | if (pci_enable_device(pdev)) | 454 | if (pci_enable_device(pdev)) |
456 | goto err_out_free; | 455 | goto err_out_free; |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 1bcd352a813b..dd9ba4aad7bb 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -6220,7 +6220,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
6220 | /* Allocate and initialize the Tx/Rx queues and lists */ | 6220 | /* Allocate and initialize the Tx/Rx queues and lists */ |
6221 | if (ipw2100_queues_allocate(priv)) { | 6221 | if (ipw2100_queues_allocate(priv)) { |
6222 | printk(KERN_WARNING DRV_NAME | 6222 | printk(KERN_WARNING DRV_NAME |
6223 | "Error calilng ipw2100_queues_allocate.\n"); | 6223 | "Error calling ipw2100_queues_allocate.\n"); |
6224 | err = -ENOMEM; | 6224 | err = -ENOMEM; |
6225 | goto fail; | 6225 | goto fail; |
6226 | } | 6226 | } |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index e82e56bb85e1..22cb3fb7502e 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -70,7 +70,7 @@ | |||
70 | #define VQ | 70 | #define VQ |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #define IPW2200_VERSION "1.1.4" VK VD VM VP VR VQ | 73 | #define IPW2200_VERSION "1.2.0" VK VD VM VP VR VQ |
74 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" | 74 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" |
75 | #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" | 75 | #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" |
76 | #define DRV_VERSION IPW2200_VERSION | 76 | #define DRV_VERSION IPW2200_VERSION |
@@ -7677,7 +7677,8 @@ static void ipw_handle_data_packet_monitor(struct ipw_priv *priv, | |||
7677 | 7677 | ||
7678 | /* Big bitfield of all the fields we provide in radiotap */ | 7678 | /* Big bitfield of all the fields we provide in radiotap */ |
7679 | ipw_rt->rt_hdr.it_present = | 7679 | ipw_rt->rt_hdr.it_present = |
7680 | ((1 << IEEE80211_RADIOTAP_FLAGS) | | 7680 | ((1 << IEEE80211_RADIOTAP_TSFT) | |
7681 | (1 << IEEE80211_RADIOTAP_FLAGS) | | ||
7681 | (1 << IEEE80211_RADIOTAP_RATE) | | 7682 | (1 << IEEE80211_RADIOTAP_RATE) | |
7682 | (1 << IEEE80211_RADIOTAP_CHANNEL) | | 7683 | (1 << IEEE80211_RADIOTAP_CHANNEL) | |
7683 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | | 7684 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | |
@@ -7686,10 +7687,14 @@ static void ipw_handle_data_packet_monitor(struct ipw_priv *priv, | |||
7686 | 7687 | ||
7687 | /* Zero the flags, we'll add to them as we go */ | 7688 | /* Zero the flags, we'll add to them as we go */ |
7688 | ipw_rt->rt_flags = 0; | 7689 | ipw_rt->rt_flags = 0; |
7689 | ipw_rt->rt_tsf = 0ULL; | 7690 | ipw_rt->rt_tsf = (u64)(frame->parent_tsf[3] << 24 | |
7691 | frame->parent_tsf[2] << 16 | | ||
7692 | frame->parent_tsf[1] << 8 | | ||
7693 | frame->parent_tsf[0]); | ||
7690 | 7694 | ||
7691 | /* Convert signal to DBM */ | 7695 | /* Convert signal to DBM */ |
7692 | ipw_rt->rt_dbmsignal = antsignal; | 7696 | ipw_rt->rt_dbmsignal = antsignal; |
7697 | ipw_rt->rt_dbmnoise = frame->noise; | ||
7693 | 7698 | ||
7694 | /* Convert the channel data and set the flags */ | 7699 | /* Convert the channel data and set the flags */ |
7695 | ipw_rt->rt_channel = cpu_to_le16(ieee80211chan2mhz(received_channel)); | 7700 | ipw_rt->rt_channel = cpu_to_le16(ieee80211chan2mhz(received_channel)); |
@@ -7889,7 +7894,8 @@ static void ipw_handle_promiscuous_rx(struct ipw_priv *priv, | |||
7889 | 7894 | ||
7890 | /* Big bitfield of all the fields we provide in radiotap */ | 7895 | /* Big bitfield of all the fields we provide in radiotap */ |
7891 | ipw_rt->rt_hdr.it_present = | 7896 | ipw_rt->rt_hdr.it_present = |
7892 | ((1 << IEEE80211_RADIOTAP_FLAGS) | | 7897 | ((1 << IEEE80211_RADIOTAP_TSFT) | |
7898 | (1 << IEEE80211_RADIOTAP_FLAGS) | | ||
7893 | (1 << IEEE80211_RADIOTAP_RATE) | | 7899 | (1 << IEEE80211_RADIOTAP_RATE) | |
7894 | (1 << IEEE80211_RADIOTAP_CHANNEL) | | 7900 | (1 << IEEE80211_RADIOTAP_CHANNEL) | |
7895 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | | 7901 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | |
@@ -7898,7 +7904,10 @@ static void ipw_handle_promiscuous_rx(struct ipw_priv *priv, | |||
7898 | 7904 | ||
7899 | /* Zero the flags, we'll add to them as we go */ | 7905 | /* Zero the flags, we'll add to them as we go */ |
7900 | ipw_rt->rt_flags = 0; | 7906 | ipw_rt->rt_flags = 0; |
7901 | ipw_rt->rt_tsf = 0ULL; | 7907 | ipw_rt->rt_tsf = (u64)(frame->parent_tsf[3] << 24 | |
7908 | frame->parent_tsf[2] << 16 | | ||
7909 | frame->parent_tsf[1] << 8 | | ||
7910 | frame->parent_tsf[0]); | ||
7902 | 7911 | ||
7903 | /* Convert to DBM */ | 7912 | /* Convert to DBM */ |
7904 | ipw_rt->rt_dbmsignal = signal; | 7913 | ipw_rt->rt_dbmsignal = signal; |
@@ -8297,7 +8306,7 @@ static void ipw_rx(struct ipw_priv *priv) | |||
8297 | ("Notification: subtype=%02X flags=%02X size=%d\n", | 8306 | ("Notification: subtype=%02X flags=%02X size=%d\n", |
8298 | pkt->u.notification.subtype, | 8307 | pkt->u.notification.subtype, |
8299 | pkt->u.notification.flags, | 8308 | pkt->u.notification.flags, |
8300 | pkt->u.notification.size); | 8309 | le16_to_cpu(pkt->u.notification.size)); |
8301 | ipw_rx_notification(priv, &pkt->u.notification); | 8310 | ipw_rx_notification(priv, &pkt->u.notification); |
8302 | break; | 8311 | break; |
8303 | } | 8312 | } |
@@ -11145,14 +11154,13 @@ static int ipw_up(struct ipw_priv *priv) | |||
11145 | return -EIO; | 11154 | return -EIO; |
11146 | 11155 | ||
11147 | if (cmdlog && !priv->cmdlog) { | 11156 | if (cmdlog && !priv->cmdlog) { |
11148 | priv->cmdlog = kmalloc(sizeof(*priv->cmdlog) * cmdlog, | 11157 | priv->cmdlog = kcalloc(cmdlog, sizeof(*priv->cmdlog), |
11149 | GFP_KERNEL); | 11158 | GFP_KERNEL); |
11150 | if (priv->cmdlog == NULL) { | 11159 | if (priv->cmdlog == NULL) { |
11151 | IPW_ERROR("Error allocating %d command log entries.\n", | 11160 | IPW_ERROR("Error allocating %d command log entries.\n", |
11152 | cmdlog); | 11161 | cmdlog); |
11153 | return -ENOMEM; | 11162 | return -ENOMEM; |
11154 | } else { | 11163 | } else { |
11155 | memset(priv->cmdlog, 0, sizeof(*priv->cmdlog) * cmdlog); | ||
11156 | priv->cmdlog_len = cmdlog; | 11164 | priv->cmdlog_len = cmdlog; |
11157 | } | 11165 | } |
11158 | } | 11166 | } |
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index a87eb51886c8..96606ed10076 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -2141,11 +2141,9 @@ prism54_wpa_bss_ie_add(islpci_private *priv, u8 *bssid, | |||
2141 | struct islpci_bss_wpa_ie, list); | 2141 | struct islpci_bss_wpa_ie, list); |
2142 | list_del(&bss->list); | 2142 | list_del(&bss->list); |
2143 | } else { | 2143 | } else { |
2144 | bss = kmalloc(sizeof (*bss), GFP_ATOMIC); | 2144 | bss = kzalloc(sizeof (*bss), GFP_ATOMIC); |
2145 | if (bss != NULL) { | 2145 | if (bss != NULL) |
2146 | priv->num_bss_wpa++; | 2146 | priv->num_bss_wpa++; |
2147 | memset(bss, 0, sizeof (*bss)); | ||
2148 | } | ||
2149 | } | 2147 | } |
2150 | if (bss != NULL) { | 2148 | if (bss != NULL) { |
2151 | memcpy(bss->bssid, bssid, ETH_ALEN); | 2149 | memcpy(bss->bssid, bssid, ETH_ALEN); |
@@ -2686,11 +2684,10 @@ prism2_ioctl_set_generic_element(struct net_device *ndev, | |||
2686 | return -EINVAL; | 2684 | return -EINVAL; |
2687 | 2685 | ||
2688 | alen = sizeof(*attach) + len; | 2686 | alen = sizeof(*attach) + len; |
2689 | attach = kmalloc(alen, GFP_KERNEL); | 2687 | attach = kzalloc(alen, GFP_KERNEL); |
2690 | if (attach == NULL) | 2688 | if (attach == NULL) |
2691 | return -ENOMEM; | 2689 | return -ENOMEM; |
2692 | 2690 | ||
2693 | memset(attach, 0, alen); | ||
2694 | #define WLAN_FC_TYPE_MGMT 0 | 2691 | #define WLAN_FC_TYPE_MGMT 0 |
2695 | #define WLAN_FC_STYPE_ASSOC_REQ 0 | 2692 | #define WLAN_FC_STYPE_ASSOC_REQ 0 |
2696 | #define WLAN_FC_STYPE_REASSOC_REQ 2 | 2693 | #define WLAN_FC_STYPE_REASSOC_REQ 2 |
diff --git a/drivers/net/wireless/prism54/oid_mgt.c b/drivers/net/wireless/prism54/oid_mgt.c index fbc52b6a3024..e6cf9df2c206 100644 --- a/drivers/net/wireless/prism54/oid_mgt.c +++ b/drivers/net/wireless/prism54/oid_mgt.c | |||
@@ -235,12 +235,10 @@ mgt_init(islpci_private *priv) | |||
235 | { | 235 | { |
236 | int i; | 236 | int i; |
237 | 237 | ||
238 | priv->mib = kmalloc(OID_NUM_LAST * sizeof (void *), GFP_KERNEL); | 238 | priv->mib = kcalloc(OID_NUM_LAST, sizeof (void *), GFP_KERNEL); |
239 | if (!priv->mib) | 239 | if (!priv->mib) |
240 | return -ENOMEM; | 240 | return -ENOMEM; |
241 | 241 | ||
242 | memset(priv->mib, 0, OID_NUM_LAST * sizeof (void *)); | ||
243 | |||
244 | /* Alloc the cache */ | 242 | /* Alloc the cache */ |
245 | for (i = 0; i < OID_NUM_LAST; i++) { | 243 | for (i = 0; i < OID_NUM_LAST; i++) { |
246 | if (isl_oid[i].flags & OID_FLAG_CACHED) { | 244 | if (isl_oid[i].flags & OID_FLAG_CACHED) { |
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c index 8be99ebbe1cd..77e11ddad836 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.c +++ b/drivers/net/wireless/zd1211rw/zd_chip.c | |||
@@ -1673,3 +1673,16 @@ int zd_rfwritev_cr_locked(struct zd_chip *chip, | |||
1673 | 1673 | ||
1674 | return 0; | 1674 | return 0; |
1675 | } | 1675 | } |
1676 | |||
1677 | int zd_chip_set_multicast_hash(struct zd_chip *chip, | ||
1678 | struct zd_mc_hash *hash) | ||
1679 | { | ||
1680 | struct zd_ioreq32 ioreqs[] = { | ||
1681 | { CR_GROUP_HASH_P1, hash->low }, | ||
1682 | { CR_GROUP_HASH_P2, hash->high }, | ||
1683 | }; | ||
1684 | |||
1685 | dev_dbg_f(zd_chip_dev(chip), "hash l 0x%08x h 0x%08x\n", | ||
1686 | ioreqs[0].value, ioreqs[1].value); | ||
1687 | return zd_iowrite32a(chip, ioreqs, ARRAY_SIZE(ioreqs)); | ||
1688 | } | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h index ca892b9a6448..a4e3cee9b59d 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.h +++ b/drivers/net/wireless/zd1211rw/zd_chip.h | |||
@@ -390,10 +390,19 @@ | |||
390 | #define CR_BSSID_P1 CTL_REG(0x0618) | 390 | #define CR_BSSID_P1 CTL_REG(0x0618) |
391 | #define CR_BSSID_P2 CTL_REG(0x061C) | 391 | #define CR_BSSID_P2 CTL_REG(0x061C) |
392 | #define CR_BCN_PLCP_CFG CTL_REG(0x0620) | 392 | #define CR_BCN_PLCP_CFG CTL_REG(0x0620) |
393 | |||
394 | /* Group hash table for filtering incoming packets. | ||
395 | * | ||
396 | * The group hash table is 64 bit large and split over two parts. The first | ||
397 | * part is the lower part. The upper 6 bits of the last byte of the target | ||
398 | * address are used as index. Packets are received if the hash table bit is | ||
399 | * set. This is used for multicast handling, but for broadcasts (address | ||
400 | * ff:ff:ff:ff:ff:ff) the highest bit in the second table must also be set. | ||
401 | */ | ||
393 | #define CR_GROUP_HASH_P1 CTL_REG(0x0624) | 402 | #define CR_GROUP_HASH_P1 CTL_REG(0x0624) |
394 | #define CR_GROUP_HASH_P2 CTL_REG(0x0628) | 403 | #define CR_GROUP_HASH_P2 CTL_REG(0x0628) |
395 | #define CR_RX_TIMEOUT CTL_REG(0x062C) | ||
396 | 404 | ||
405 | #define CR_RX_TIMEOUT CTL_REG(0x062C) | ||
397 | /* Basic rates supported by the BSS. When producing ACK or CTS messages, the | 406 | /* Basic rates supported by the BSS. When producing ACK or CTS messages, the |
398 | * device will use a rate in this table that is less than or equal to the rate | 407 | * device will use a rate in this table that is less than or equal to the rate |
399 | * of the incoming frame which prompted the response */ | 408 | * of the incoming frame which prompted the response */ |
@@ -864,4 +873,36 @@ u8 zd_rx_strength_percent(u8 rssi); | |||
864 | 873 | ||
865 | u16 zd_rx_rate(const void *rx_frame, const struct rx_status *status); | 874 | u16 zd_rx_rate(const void *rx_frame, const struct rx_status *status); |
866 | 875 | ||
876 | struct zd_mc_hash { | ||
877 | u32 low; | ||
878 | u32 high; | ||
879 | }; | ||
880 | |||
881 | static inline void zd_mc_clear(struct zd_mc_hash *hash) | ||
882 | { | ||
883 | hash->low = 0; | ||
884 | /* The interfaces must always received broadcasts. | ||
885 | * The hash of the broadcast address ff:ff:ff:ff:ff:ff is 63. | ||
886 | */ | ||
887 | hash->high = 0x80000000; | ||
888 | } | ||
889 | |||
890 | static inline void zd_mc_add_all(struct zd_mc_hash *hash) | ||
891 | { | ||
892 | hash->low = hash->high = 0xffffffff; | ||
893 | } | ||
894 | |||
895 | static inline void zd_mc_add_addr(struct zd_mc_hash *hash, u8 *addr) | ||
896 | { | ||
897 | unsigned int i = addr[5] >> 2; | ||
898 | if (i < 32) { | ||
899 | hash->low |= 1 << i; | ||
900 | } else { | ||
901 | hash->high |= 1 << (i-32); | ||
902 | } | ||
903 | } | ||
904 | |||
905 | int zd_chip_set_multicast_hash(struct zd_chip *chip, | ||
906 | struct zd_mc_hash *hash); | ||
907 | |||
867 | #endif /* _ZD_CHIP_H */ | 908 | #endif /* _ZD_CHIP_H */ |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index f1573a9c2336..00ca704ece35 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -39,6 +39,8 @@ static void housekeeping_init(struct zd_mac *mac); | |||
39 | static void housekeeping_enable(struct zd_mac *mac); | 39 | static void housekeeping_enable(struct zd_mac *mac); |
40 | static void housekeeping_disable(struct zd_mac *mac); | 40 | static void housekeeping_disable(struct zd_mac *mac); |
41 | 41 | ||
42 | static void set_multicast_hash_handler(struct work_struct *work); | ||
43 | |||
42 | int zd_mac_init(struct zd_mac *mac, | 44 | int zd_mac_init(struct zd_mac *mac, |
43 | struct net_device *netdev, | 45 | struct net_device *netdev, |
44 | struct usb_interface *intf) | 46 | struct usb_interface *intf) |
@@ -55,6 +57,7 @@ int zd_mac_init(struct zd_mac *mac, | |||
55 | softmac_init(ieee80211_priv(netdev)); | 57 | softmac_init(ieee80211_priv(netdev)); |
56 | zd_chip_init(&mac->chip, netdev, intf); | 58 | zd_chip_init(&mac->chip, netdev, intf); |
57 | housekeeping_init(mac); | 59 | housekeeping_init(mac); |
60 | INIT_WORK(&mac->set_multicast_hash_work, set_multicast_hash_handler); | ||
58 | return 0; | 61 | return 0; |
59 | } | 62 | } |
60 | 63 | ||
@@ -136,6 +139,7 @@ out: | |||
136 | 139 | ||
137 | void zd_mac_clear(struct zd_mac *mac) | 140 | void zd_mac_clear(struct zd_mac *mac) |
138 | { | 141 | { |
142 | flush_workqueue(zd_workqueue); | ||
139 | zd_chip_clear(&mac->chip); | 143 | zd_chip_clear(&mac->chip); |
140 | ZD_ASSERT(!spin_is_locked(&mac->lock)); | 144 | ZD_ASSERT(!spin_is_locked(&mac->lock)); |
141 | ZD_MEMCLEAR(mac, sizeof(struct zd_mac)); | 145 | ZD_MEMCLEAR(mac, sizeof(struct zd_mac)); |
@@ -256,6 +260,43 @@ int zd_mac_set_mac_address(struct net_device *netdev, void *p) | |||
256 | return 0; | 260 | return 0; |
257 | } | 261 | } |
258 | 262 | ||
263 | static void set_multicast_hash_handler(struct work_struct *work) | ||
264 | { | ||
265 | struct zd_mac *mac = container_of(work, struct zd_mac, | ||
266 | set_multicast_hash_work); | ||
267 | struct zd_mc_hash hash; | ||
268 | |||
269 | spin_lock_irq(&mac->lock); | ||
270 | hash = mac->multicast_hash; | ||
271 | spin_unlock_irq(&mac->lock); | ||
272 | |||
273 | zd_chip_set_multicast_hash(&mac->chip, &hash); | ||
274 | } | ||
275 | |||
276 | void zd_mac_set_multicast_list(struct net_device *dev) | ||
277 | { | ||
278 | struct zd_mc_hash hash; | ||
279 | struct zd_mac *mac = zd_netdev_mac(dev); | ||
280 | struct dev_mc_list *mc; | ||
281 | unsigned long flags; | ||
282 | |||
283 | if (dev->flags & (IFF_PROMISC|IFF_ALLMULTI)) { | ||
284 | zd_mc_add_all(&hash); | ||
285 | } else { | ||
286 | zd_mc_clear(&hash); | ||
287 | for (mc = dev->mc_list; mc; mc = mc->next) { | ||
288 | dev_dbg_f(zd_mac_dev(mac), "mc addr " MAC_FMT "\n", | ||
289 | MAC_ARG(mc->dmi_addr)); | ||
290 | zd_mc_add_addr(&hash, mc->dmi_addr); | ||
291 | } | ||
292 | } | ||
293 | |||
294 | spin_lock_irqsave(&mac->lock, flags); | ||
295 | mac->multicast_hash = hash; | ||
296 | spin_unlock_irqrestore(&mac->lock, flags); | ||
297 | queue_work(zd_workqueue, &mac->set_multicast_hash_work); | ||
298 | } | ||
299 | |||
259 | int zd_mac_set_regdomain(struct zd_mac *mac, u8 regdomain) | 300 | int zd_mac_set_regdomain(struct zd_mac *mac, u8 regdomain) |
260 | { | 301 | { |
261 | int r; | 302 | int r; |
@@ -618,6 +659,9 @@ int zd_mac_get_range(struct zd_mac *mac, struct iw_range *range) | |||
618 | range->we_version_compiled = WIRELESS_EXT; | 659 | range->we_version_compiled = WIRELESS_EXT; |
619 | range->we_version_source = 20; | 660 | range->we_version_source = 20; |
620 | 661 | ||
662 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | | ||
663 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; | ||
664 | |||
621 | ZD_ASSERT(!irqs_disabled()); | 665 | ZD_ASSERT(!irqs_disabled()); |
622 | spin_lock_irq(&mac->lock); | 666 | spin_lock_irq(&mac->lock); |
623 | regdomain = mac->regdomain; | 667 | regdomain = mac->regdomain; |
@@ -930,7 +974,8 @@ static int is_data_packet_for_us(struct ieee80211_device *ieee, | |||
930 | } | 974 | } |
931 | 975 | ||
932 | return memcmp(hdr->addr1, netdev->dev_addr, ETH_ALEN) == 0 || | 976 | return memcmp(hdr->addr1, netdev->dev_addr, ETH_ALEN) == 0 || |
933 | is_multicast_ether_addr(hdr->addr1) || | 977 | (is_multicast_ether_addr(hdr->addr1) && |
978 | memcmp(hdr->addr3, netdev->dev_addr, ETH_ALEN) != 0) || | ||
934 | (netdev->flags & IFF_PROMISC); | 979 | (netdev->flags & IFF_PROMISC); |
935 | } | 980 | } |
936 | 981 | ||
@@ -1062,10 +1107,8 @@ int zd_mac_rx(struct zd_mac *mac, const u8 *buffer, unsigned int length) | |||
1062 | memcpy(skb_put(skb, length), buffer, length); | 1107 | memcpy(skb_put(skb, length), buffer, length); |
1063 | 1108 | ||
1064 | r = ieee80211_rx(ieee, skb, &stats); | 1109 | r = ieee80211_rx(ieee, skb, &stats); |
1065 | if (!r) { | 1110 | if (!r) |
1066 | ZD_ASSERT(in_irq()); | 1111 | dev_kfree_skb_any(skb); |
1067 | dev_kfree_skb_irq(skb); | ||
1068 | } | ||
1069 | return 0; | 1112 | return 0; |
1070 | } | 1113 | } |
1071 | 1114 | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h b/drivers/net/wireless/zd1211rw/zd_mac.h index d4e8b870409d..f0cf05dc7d3e 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.h +++ b/drivers/net/wireless/zd1211rw/zd_mac.h | |||
@@ -133,6 +133,8 @@ struct zd_mac { | |||
133 | struct iw_statistics iw_stats; | 133 | struct iw_statistics iw_stats; |
134 | 134 | ||
135 | struct housekeeping housekeeping; | 135 | struct housekeeping housekeeping; |
136 | struct work_struct set_multicast_hash_work; | ||
137 | struct zd_mc_hash multicast_hash; | ||
136 | struct delayed_work set_rts_cts_work; | 138 | struct delayed_work set_rts_cts_work; |
137 | struct delayed_work set_basic_rates_work; | 139 | struct delayed_work set_basic_rates_work; |
138 | 140 | ||
@@ -189,6 +191,7 @@ int zd_mac_init_hw(struct zd_mac *mac, u8 device_type); | |||
189 | int zd_mac_open(struct net_device *netdev); | 191 | int zd_mac_open(struct net_device *netdev); |
190 | int zd_mac_stop(struct net_device *netdev); | 192 | int zd_mac_stop(struct net_device *netdev); |
191 | int zd_mac_set_mac_address(struct net_device *dev, void *p); | 193 | int zd_mac_set_mac_address(struct net_device *dev, void *p); |
194 | void zd_mac_set_multicast_list(struct net_device *netdev); | ||
192 | 195 | ||
193 | int zd_mac_rx(struct zd_mac *mac, const u8 *buffer, unsigned int length); | 196 | int zd_mac_rx(struct zd_mac *mac, const u8 *buffer, unsigned int length); |
194 | 197 | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_netdev.c b/drivers/net/wireless/zd1211rw/zd_netdev.c index 60f1b0f6d45b..8bda48de31ef 100644 --- a/drivers/net/wireless/zd1211rw/zd_netdev.c +++ b/drivers/net/wireless/zd1211rw/zd_netdev.c | |||
@@ -242,7 +242,7 @@ struct net_device *zd_netdev_alloc(struct usb_interface *intf) | |||
242 | netdev->open = zd_mac_open; | 242 | netdev->open = zd_mac_open; |
243 | netdev->stop = zd_mac_stop; | 243 | netdev->stop = zd_mac_stop; |
244 | /* netdev->get_stats = */ | 244 | /* netdev->get_stats = */ |
245 | /* netdev->set_multicast_list = */ | 245 | netdev->set_multicast_list = zd_mac_set_multicast_list; |
246 | netdev->set_mac_address = zd_mac_set_mac_address; | 246 | netdev->set_mac_address = zd_mac_set_mac_address; |
247 | netdev->wireless_handlers = &iw_handler_def; | 247 | netdev->wireless_handlers = &iw_handler_def; |
248 | /* netdev->ethtool_ops = */ | 248 | /* netdev->ethtool_ops = */ |
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 39c96641bc72..b61c17b3e298 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c | |||
@@ -1975,7 +1975,7 @@ static int __devinit parport_ECPPS2_supported(struct parport *pb){return 0;} | |||
1975 | /* --- IRQ detection -------------------------------------- */ | 1975 | /* --- IRQ detection -------------------------------------- */ |
1976 | 1976 | ||
1977 | /* Only if supports ECP mode */ | 1977 | /* Only if supports ECP mode */ |
1978 | static int __devinit programmable_irq_support(struct parport *pb) | 1978 | static int programmable_irq_support(struct parport *pb) |
1979 | { | 1979 | { |
1980 | int irq, intrLine; | 1980 | int irq, intrLine; |
1981 | unsigned char oecr = inb (ECONTROL (pb)); | 1981 | unsigned char oecr = inb (ECONTROL (pb)); |
@@ -1992,7 +1992,7 @@ static int __devinit programmable_irq_support(struct parport *pb) | |||
1992 | return irq; | 1992 | return irq; |
1993 | } | 1993 | } |
1994 | 1994 | ||
1995 | static int __devinit irq_probe_ECP(struct parport *pb) | 1995 | static int irq_probe_ECP(struct parport *pb) |
1996 | { | 1996 | { |
1997 | int i; | 1997 | int i; |
1998 | unsigned long irqs; | 1998 | unsigned long irqs; |
@@ -2020,7 +2020,7 @@ static int __devinit irq_probe_ECP(struct parport *pb) | |||
2020 | * This detection seems that only works in National Semiconductors | 2020 | * This detection seems that only works in National Semiconductors |
2021 | * This doesn't work in SMC, LGS, and Winbond | 2021 | * This doesn't work in SMC, LGS, and Winbond |
2022 | */ | 2022 | */ |
2023 | static int __devinit irq_probe_EPP(struct parport *pb) | 2023 | static int irq_probe_EPP(struct parport *pb) |
2024 | { | 2024 | { |
2025 | #ifndef ADVANCED_DETECT | 2025 | #ifndef ADVANCED_DETECT |
2026 | return PARPORT_IRQ_NONE; | 2026 | return PARPORT_IRQ_NONE; |
@@ -2059,7 +2059,7 @@ static int __devinit irq_probe_EPP(struct parport *pb) | |||
2059 | #endif /* Advanced detection */ | 2059 | #endif /* Advanced detection */ |
2060 | } | 2060 | } |
2061 | 2061 | ||
2062 | static int __devinit irq_probe_SPP(struct parport *pb) | 2062 | static int irq_probe_SPP(struct parport *pb) |
2063 | { | 2063 | { |
2064 | /* Don't even try to do this. */ | 2064 | /* Don't even try to do this. */ |
2065 | return PARPORT_IRQ_NONE; | 2065 | return PARPORT_IRQ_NONE; |
@@ -2747,6 +2747,7 @@ enum parport_pc_pci_cards { | |||
2747 | titan_1284p2, | 2747 | titan_1284p2, |
2748 | avlab_1p, | 2748 | avlab_1p, |
2749 | avlab_2p, | 2749 | avlab_2p, |
2750 | oxsemi_952, | ||
2750 | oxsemi_954, | 2751 | oxsemi_954, |
2751 | oxsemi_840, | 2752 | oxsemi_840, |
2752 | aks_0100, | 2753 | aks_0100, |
@@ -2822,6 +2823,7 @@ static struct parport_pc_pci { | |||
2822 | /* avlab_2p */ { 2, { { 0, 1}, { 2, 3 },} }, | 2823 | /* avlab_2p */ { 2, { { 0, 1}, { 2, 3 },} }, |
2823 | /* The Oxford Semi cards are unusual: 954 doesn't support ECP, | 2824 | /* The Oxford Semi cards are unusual: 954 doesn't support ECP, |
2824 | * and 840 locks up if you write 1 to bit 2! */ | 2825 | * and 840 locks up if you write 1 to bit 2! */ |
2826 | /* oxsemi_952 */ { 1, { { 0, 1 }, } }, | ||
2825 | /* oxsemi_954 */ { 1, { { 0, -1 }, } }, | 2827 | /* oxsemi_954 */ { 1, { { 0, -1 }, } }, |
2826 | /* oxsemi_840 */ { 1, { { 0, -1 }, } }, | 2828 | /* oxsemi_840 */ { 1, { { 0, -1 }, } }, |
2827 | /* aks_0100 */ { 1, { { 0, -1 }, } }, | 2829 | /* aks_0100 */ { 1, { { 0, -1 }, } }, |
@@ -2895,6 +2897,8 @@ static const struct pci_device_id parport_pc_pci_tbl[] = { | |||
2895 | /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/ | 2897 | /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/ |
2896 | { 0x14db, 0x2120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1p}, /* AFAVLAB_TK9902 */ | 2898 | { 0x14db, 0x2120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1p}, /* AFAVLAB_TK9902 */ |
2897 | { 0x14db, 0x2121, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2p}, | 2899 | { 0x14db, 0x2121, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2p}, |
2900 | { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952PP, | ||
2901 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_952 }, | ||
2898 | { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954PP, | 2902 | { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954PP, |
2899 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_954 }, | 2903 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_954 }, |
2900 | { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_12PCI840, | 2904 | { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_12PCI840, |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 9fc9a34ef24a..9168401401bc 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | static DEFINE_SPINLOCK(msi_lock); | 27 | static DEFINE_SPINLOCK(msi_lock); |
28 | static struct msi_desc* msi_desc[NR_IRQS] = { [0 ... NR_IRQS-1] = NULL }; | 28 | static struct msi_desc* msi_desc[NR_IRQS] = { [0 ... NR_IRQS-1] = NULL }; |
29 | static kmem_cache_t* msi_cachep; | 29 | static struct kmem_cache* msi_cachep; |
30 | 30 | ||
31 | static int pci_msi_enable = 1; | 31 | static int pci_msi_enable = 1; |
32 | 32 | ||
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 0eeac60042b3..6a3c1e728900 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -873,6 +873,7 @@ void __devinit pci_device_add(struct pci_dev *dev, struct pci_bus *bus) | |||
873 | dev->dev.release = pci_release_dev; | 873 | dev->dev.release = pci_release_dev; |
874 | pci_dev_get(dev); | 874 | pci_dev_get(dev); |
875 | 875 | ||
876 | set_dev_node(&dev->dev, pcibus_to_node(bus)); | ||
876 | dev->dev.dma_mask = &dev->dma_mask; | 877 | dev->dev.dma_mask = &dev->dma_mask; |
877 | dev->dev.coherent_dma_mask = 0xffffffffull; | 878 | dev->dev.coherent_dma_mask = 0xffffffffull; |
878 | 879 | ||
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index f9cd831a3f31..606a46740338 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
31 | #include <linux/kthread.h> | 31 | #include <linux/kthread.h> |
32 | #include <linux/freezer.h> | ||
32 | #include <asm/system.h> | 33 | #include <asm/system.h> |
33 | #include <asm/irq.h> | 34 | #include <asm/irq.h> |
34 | 35 | ||
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index 227600cd6360..91c047a7e635 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c | |||
@@ -164,9 +164,17 @@ static DEVICE_ATTR(card_id,S_IRUGO,pnp_show_card_ids,NULL); | |||
164 | 164 | ||
165 | static int pnp_interface_attach_card(struct pnp_card *card) | 165 | static int pnp_interface_attach_card(struct pnp_card *card) |
166 | { | 166 | { |
167 | device_create_file(&card->dev,&dev_attr_name); | 167 | int rc = device_create_file(&card->dev,&dev_attr_name); |
168 | device_create_file(&card->dev,&dev_attr_card_id); | 168 | if (rc) return rc; |
169 | |||
170 | rc = device_create_file(&card->dev,&dev_attr_card_id); | ||
171 | if (rc) goto err_name; | ||
172 | |||
169 | return 0; | 173 | return 0; |
174 | |||
175 | err_name: | ||
176 | device_remove_file(&card->dev,&dev_attr_name); | ||
177 | return rc; | ||
170 | } | 178 | } |
171 | 179 | ||
172 | /** | 180 | /** |
@@ -306,16 +314,20 @@ found: | |||
306 | down_write(&dev->dev.bus->subsys.rwsem); | 314 | down_write(&dev->dev.bus->subsys.rwsem); |
307 | dev->card_link = clink; | 315 | dev->card_link = clink; |
308 | dev->dev.driver = &drv->link.driver; | 316 | dev->dev.driver = &drv->link.driver; |
309 | if (pnp_bus_type.probe(&dev->dev)) { | 317 | if (pnp_bus_type.probe(&dev->dev)) |
310 | dev->dev.driver = NULL; | 318 | goto err_out; |
311 | dev->card_link = NULL; | 319 | if (device_bind_driver(&dev->dev)) |
312 | up_write(&dev->dev.bus->subsys.rwsem); | 320 | goto err_out; |
313 | return NULL; | 321 | |
314 | } | ||
315 | device_bind_driver(&dev->dev); | ||
316 | up_write(&dev->dev.bus->subsys.rwsem); | 322 | up_write(&dev->dev.bus->subsys.rwsem); |
317 | 323 | ||
318 | return dev; | 324 | return dev; |
325 | |||
326 | err_out: | ||
327 | dev->dev.driver = NULL; | ||
328 | dev->card_link = NULL; | ||
329 | up_write(&dev->dev.bus->subsys.rwsem); | ||
330 | return NULL; | ||
319 | } | 331 | } |
320 | 332 | ||
321 | /** | 333 | /** |
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index 9d8b415eca79..ac9fcd499f3f 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -461,8 +461,19 @@ static DEVICE_ATTR(id,S_IRUGO,pnp_show_current_ids,NULL); | |||
461 | 461 | ||
462 | int pnp_interface_attach_device(struct pnp_dev *dev) | 462 | int pnp_interface_attach_device(struct pnp_dev *dev) |
463 | { | 463 | { |
464 | device_create_file(&dev->dev,&dev_attr_options); | 464 | int rc = device_create_file(&dev->dev,&dev_attr_options); |
465 | device_create_file(&dev->dev,&dev_attr_resources); | 465 | if (rc) goto err; |
466 | device_create_file(&dev->dev,&dev_attr_id); | 466 | rc = device_create_file(&dev->dev,&dev_attr_resources); |
467 | if (rc) goto err_opt; | ||
468 | rc = device_create_file(&dev->dev,&dev_attr_id); | ||
469 | if (rc) goto err_res; | ||
470 | |||
467 | return 0; | 471 | return 0; |
472 | |||
473 | err_res: | ||
474 | device_remove_file(&dev->dev,&dev_attr_resources); | ||
475 | err_opt: | ||
476 | device_remove_file(&dev->dev,&dev_attr_options); | ||
477 | err: | ||
478 | return rc; | ||
468 | } | 479 | } |
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index 81a6c83d89a6..33adeba1a31f 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/dmi.h> | 61 | #include <linux/dmi.h> |
62 | #include <linux/delay.h> | 62 | #include <linux/delay.h> |
63 | #include <linux/acpi.h> | 63 | #include <linux/acpi.h> |
64 | #include <linux/freezer.h> | ||
64 | 65 | ||
65 | #include <asm/page.h> | 66 | #include <asm/page.h> |
66 | #include <asm/desc.h> | 67 | #include <asm/desc.h> |
@@ -530,7 +531,8 @@ static int __init pnpbios_init(void) | |||
530 | if (check_legacy_ioport(PNPBIOS_BASE)) | 531 | if (check_legacy_ioport(PNPBIOS_BASE)) |
531 | return -ENODEV; | 532 | return -ENODEV; |
532 | #endif | 533 | #endif |
533 | if (pnpbios_disabled || dmi_check_system(pnpbios_dmi_table)) { | 534 | if (pnpbios_disabled || dmi_check_system(pnpbios_dmi_table) || |
535 | paravirt_enabled()) { | ||
534 | printk(KERN_INFO "PnPBIOS: Disabled\n"); | 536 | printk(KERN_INFO "PnPBIOS: Disabled\n"); |
535 | return -ENODEV; | 537 | return -ENODEV; |
536 | } | 538 | } |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index fc766a7a611e..2a63ab2b47f4 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -154,15 +154,23 @@ config RTC_DRV_DS1672 | |||
154 | will be called rtc-ds1672. | 154 | will be called rtc-ds1672. |
155 | 155 | ||
156 | config RTC_DRV_DS1742 | 156 | config RTC_DRV_DS1742 |
157 | tristate "Dallas DS1742" | 157 | tristate "Dallas DS1742/1743" |
158 | depends on RTC_CLASS | 158 | depends on RTC_CLASS |
159 | help | 159 | help |
160 | If you say yes here you get support for the | 160 | If you say yes here you get support for the |
161 | Dallas DS1742 timekeeping chip. | 161 | Dallas DS1742/1743 timekeeping chip. |
162 | 162 | ||
163 | This driver can also be built as a module. If so, the module | 163 | This driver can also be built as a module. If so, the module |
164 | will be called rtc-ds1742. | 164 | will be called rtc-ds1742. |
165 | 165 | ||
166 | config RTC_DRV_OMAP | ||
167 | tristate "TI OMAP1" | ||
168 | depends on RTC_CLASS && ( \ | ||
169 | ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 ) | ||
170 | help | ||
171 | Say "yes" here to support the real time clock on TI OMAP1 chips. | ||
172 | This driver can also be built as a module called rtc-omap. | ||
173 | |||
166 | config RTC_DRV_PCF8563 | 174 | config RTC_DRV_PCF8563 |
167 | tristate "Philips PCF8563/Epson RTC8564" | 175 | tristate "Philips PCF8563/Epson RTC8564" |
168 | depends on RTC_CLASS && I2C | 176 | depends on RTC_CLASS && I2C |
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 3ba5ff6e6800..bd4c45d333f0 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile | |||
@@ -21,6 +21,7 @@ obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o | |||
21 | obj-$(CONFIG_RTC_DRV_DS1307) += rtc-ds1307.o | 21 | obj-$(CONFIG_RTC_DRV_DS1307) += rtc-ds1307.o |
22 | obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o | 22 | obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o |
23 | obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o | 23 | obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o |
24 | obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o | ||
24 | obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o | 25 | obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o |
25 | obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o | 26 | obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o |
26 | obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o | 27 | obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o |
diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c index 67e816a9a39f..dfef1637bfb8 100644 --- a/drivers/rtc/rtc-ds1672.c +++ b/drivers/rtc/rtc-ds1672.c | |||
@@ -237,17 +237,22 @@ static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind) | |||
237 | /* read control register */ | 237 | /* read control register */ |
238 | err = ds1672_get_control(client, &control); | 238 | err = ds1672_get_control(client, &control); |
239 | if (err) | 239 | if (err) |
240 | goto exit_detach; | 240 | goto exit_devreg; |
241 | 241 | ||
242 | if (control & DS1672_REG_CONTROL_EOSC) | 242 | if (control & DS1672_REG_CONTROL_EOSC) |
243 | dev_warn(&client->dev, "Oscillator not enabled. " | 243 | dev_warn(&client->dev, "Oscillator not enabled. " |
244 | "Set time to enable.\n"); | 244 | "Set time to enable.\n"); |
245 | 245 | ||
246 | /* Register sysfs hooks */ | 246 | /* Register sysfs hooks */ |
247 | device_create_file(&client->dev, &dev_attr_control); | 247 | err = device_create_file(&client->dev, &dev_attr_control); |
248 | if (err) | ||
249 | goto exit_devreg; | ||
248 | 250 | ||
249 | return 0; | 251 | return 0; |
250 | 252 | ||
253 | exit_devreg: | ||
254 | rtc_device_unregister(rtc); | ||
255 | |||
251 | exit_detach: | 256 | exit_detach: |
252 | i2c_detach_client(client); | 257 | i2c_detach_client(client); |
253 | 258 | ||
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index 6273a3d240a2..17633bfa8480 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c | |||
@@ -6,6 +6,10 @@ | |||
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | * | ||
10 | * Copyright (C) 2006 Torsten Ertbjerg Rasmussen <tr@newtec.dk> | ||
11 | * - nvram size determined from resource | ||
12 | * - this ds1742 driver now supports ds1743. | ||
9 | */ | 13 | */ |
10 | 14 | ||
11 | #include <linux/bcd.h> | 15 | #include <linux/bcd.h> |
@@ -17,20 +21,19 @@ | |||
17 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
18 | #include <linux/io.h> | 22 | #include <linux/io.h> |
19 | 23 | ||
20 | #define DRV_VERSION "0.2" | 24 | #define DRV_VERSION "0.3" |
21 | 25 | ||
22 | #define RTC_REG_SIZE 0x800 | 26 | #define RTC_SIZE 8 |
23 | #define RTC_OFFSET 0x7f8 | ||
24 | 27 | ||
25 | #define RTC_CONTROL (RTC_OFFSET + 0) | 28 | #define RTC_CONTROL 0 |
26 | #define RTC_CENTURY (RTC_OFFSET + 0) | 29 | #define RTC_CENTURY 0 |
27 | #define RTC_SECONDS (RTC_OFFSET + 1) | 30 | #define RTC_SECONDS 1 |
28 | #define RTC_MINUTES (RTC_OFFSET + 2) | 31 | #define RTC_MINUTES 2 |
29 | #define RTC_HOURS (RTC_OFFSET + 3) | 32 | #define RTC_HOURS 3 |
30 | #define RTC_DAY (RTC_OFFSET + 4) | 33 | #define RTC_DAY 4 |
31 | #define RTC_DATE (RTC_OFFSET + 5) | 34 | #define RTC_DATE 5 |
32 | #define RTC_MONTH (RTC_OFFSET + 6) | 35 | #define RTC_MONTH 6 |
33 | #define RTC_YEAR (RTC_OFFSET + 7) | 36 | #define RTC_YEAR 7 |
34 | 37 | ||
35 | #define RTC_CENTURY_MASK 0x3f | 38 | #define RTC_CENTURY_MASK 0x3f |
36 | #define RTC_SECONDS_MASK 0x7f | 39 | #define RTC_SECONDS_MASK 0x7f |
@@ -48,7 +51,10 @@ | |||
48 | 51 | ||
49 | struct rtc_plat_data { | 52 | struct rtc_plat_data { |
50 | struct rtc_device *rtc; | 53 | struct rtc_device *rtc; |
51 | void __iomem *ioaddr; | 54 | void __iomem *ioaddr_nvram; |
55 | void __iomem *ioaddr_rtc; | ||
56 | size_t size_nvram; | ||
57 | size_t size; | ||
52 | unsigned long baseaddr; | 58 | unsigned long baseaddr; |
53 | unsigned long last_jiffies; | 59 | unsigned long last_jiffies; |
54 | }; | 60 | }; |
@@ -57,7 +63,7 @@ static int ds1742_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
57 | { | 63 | { |
58 | struct platform_device *pdev = to_platform_device(dev); | 64 | struct platform_device *pdev = to_platform_device(dev); |
59 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 65 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
60 | void __iomem *ioaddr = pdata->ioaddr; | 66 | void __iomem *ioaddr = pdata->ioaddr_rtc; |
61 | u8 century; | 67 | u8 century; |
62 | 68 | ||
63 | century = BIN2BCD((tm->tm_year + 1900) / 100); | 69 | century = BIN2BCD((tm->tm_year + 1900) / 100); |
@@ -82,7 +88,7 @@ static int ds1742_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
82 | { | 88 | { |
83 | struct platform_device *pdev = to_platform_device(dev); | 89 | struct platform_device *pdev = to_platform_device(dev); |
84 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 90 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
85 | void __iomem *ioaddr = pdata->ioaddr; | 91 | void __iomem *ioaddr = pdata->ioaddr_rtc; |
86 | unsigned int year, month, day, hour, minute, second, week; | 92 | unsigned int year, month, day, hour, minute, second, week; |
87 | unsigned int century; | 93 | unsigned int century; |
88 | 94 | ||
@@ -127,10 +133,10 @@ static ssize_t ds1742_nvram_read(struct kobject *kobj, char *buf, | |||
127 | struct platform_device *pdev = | 133 | struct platform_device *pdev = |
128 | to_platform_device(container_of(kobj, struct device, kobj)); | 134 | to_platform_device(container_of(kobj, struct device, kobj)); |
129 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 135 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
130 | void __iomem *ioaddr = pdata->ioaddr; | 136 | void __iomem *ioaddr = pdata->ioaddr_nvram; |
131 | ssize_t count; | 137 | ssize_t count; |
132 | 138 | ||
133 | for (count = 0; size > 0 && pos < RTC_OFFSET; count++, size--) | 139 | for (count = 0; size > 0 && pos < pdata->size_nvram; count++, size--) |
134 | *buf++ = readb(ioaddr + pos++); | 140 | *buf++ = readb(ioaddr + pos++); |
135 | return count; | 141 | return count; |
136 | } | 142 | } |
@@ -141,10 +147,10 @@ static ssize_t ds1742_nvram_write(struct kobject *kobj, char *buf, | |||
141 | struct platform_device *pdev = | 147 | struct platform_device *pdev = |
142 | to_platform_device(container_of(kobj, struct device, kobj)); | 148 | to_platform_device(container_of(kobj, struct device, kobj)); |
143 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 149 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
144 | void __iomem *ioaddr = pdata->ioaddr; | 150 | void __iomem *ioaddr = pdata->ioaddr_nvram; |
145 | ssize_t count; | 151 | ssize_t count; |
146 | 152 | ||
147 | for (count = 0; size > 0 && pos < RTC_OFFSET; count++, size--) | 153 | for (count = 0; size > 0 && pos < pdata->size_nvram; count++, size--) |
148 | writeb(*buf++, ioaddr + pos++); | 154 | writeb(*buf++, ioaddr + pos++); |
149 | return count; | 155 | return count; |
150 | } | 156 | } |
@@ -155,7 +161,6 @@ static struct bin_attribute ds1742_nvram_attr = { | |||
155 | .mode = S_IRUGO | S_IWUGO, | 161 | .mode = S_IRUGO | S_IWUGO, |
156 | .owner = THIS_MODULE, | 162 | .owner = THIS_MODULE, |
157 | }, | 163 | }, |
158 | .size = RTC_OFFSET, | ||
159 | .read = ds1742_nvram_read, | 164 | .read = ds1742_nvram_read, |
160 | .write = ds1742_nvram_write, | 165 | .write = ds1742_nvram_write, |
161 | }; | 166 | }; |
@@ -175,19 +180,23 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev) | |||
175 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); | 180 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); |
176 | if (!pdata) | 181 | if (!pdata) |
177 | return -ENOMEM; | 182 | return -ENOMEM; |
178 | if (!request_mem_region(res->start, RTC_REG_SIZE, pdev->name)) { | 183 | pdata->size = res->end - res->start + 1; |
184 | if (!request_mem_region(res->start, pdata->size, pdev->name)) { | ||
179 | ret = -EBUSY; | 185 | ret = -EBUSY; |
180 | goto out; | 186 | goto out; |
181 | } | 187 | } |
182 | pdata->baseaddr = res->start; | 188 | pdata->baseaddr = res->start; |
183 | ioaddr = ioremap(pdata->baseaddr, RTC_REG_SIZE); | 189 | ioaddr = ioremap(pdata->baseaddr, pdata->size); |
184 | if (!ioaddr) { | 190 | if (!ioaddr) { |
185 | ret = -ENOMEM; | 191 | ret = -ENOMEM; |
186 | goto out; | 192 | goto out; |
187 | } | 193 | } |
188 | pdata->ioaddr = ioaddr; | 194 | pdata->ioaddr_nvram = ioaddr; |
195 | pdata->size_nvram = pdata->size - RTC_SIZE; | ||
196 | pdata->ioaddr_rtc = ioaddr + pdata->size_nvram; | ||
189 | 197 | ||
190 | /* turn RTC on if it was not on */ | 198 | /* turn RTC on if it was not on */ |
199 | ioaddr = pdata->ioaddr_rtc; | ||
191 | sec = readb(ioaddr + RTC_SECONDS); | 200 | sec = readb(ioaddr + RTC_SECONDS); |
192 | if (sec & RTC_STOP) { | 201 | if (sec & RTC_STOP) { |
193 | sec &= RTC_SECONDS_MASK; | 202 | sec &= RTC_SECONDS_MASK; |
@@ -208,6 +217,8 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev) | |||
208 | pdata->rtc = rtc; | 217 | pdata->rtc = rtc; |
209 | pdata->last_jiffies = jiffies; | 218 | pdata->last_jiffies = jiffies; |
210 | platform_set_drvdata(pdev, pdata); | 219 | platform_set_drvdata(pdev, pdata); |
220 | ds1742_nvram_attr.size = max(ds1742_nvram_attr.size, | ||
221 | pdata->size_nvram); | ||
211 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &ds1742_nvram_attr); | 222 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &ds1742_nvram_attr); |
212 | if (ret) | 223 | if (ret) |
213 | goto out; | 224 | goto out; |
@@ -215,10 +226,10 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev) | |||
215 | out: | 226 | out: |
216 | if (pdata->rtc) | 227 | if (pdata->rtc) |
217 | rtc_device_unregister(pdata->rtc); | 228 | rtc_device_unregister(pdata->rtc); |
218 | if (ioaddr) | 229 | if (pdata->ioaddr_nvram) |
219 | iounmap(ioaddr); | 230 | iounmap(pdata->ioaddr_nvram); |
220 | if (pdata->baseaddr) | 231 | if (pdata->baseaddr) |
221 | release_mem_region(pdata->baseaddr, RTC_REG_SIZE); | 232 | release_mem_region(pdata->baseaddr, pdata->size); |
222 | kfree(pdata); | 233 | kfree(pdata); |
223 | return ret; | 234 | return ret; |
224 | } | 235 | } |
@@ -229,8 +240,8 @@ static int __devexit ds1742_rtc_remove(struct platform_device *pdev) | |||
229 | 240 | ||
230 | sysfs_remove_bin_file(&pdev->dev.kobj, &ds1742_nvram_attr); | 241 | sysfs_remove_bin_file(&pdev->dev.kobj, &ds1742_nvram_attr); |
231 | rtc_device_unregister(pdata->rtc); | 242 | rtc_device_unregister(pdata->rtc); |
232 | iounmap(pdata->ioaddr); | 243 | iounmap(pdata->ioaddr_nvram); |
233 | release_mem_region(pdata->baseaddr, RTC_REG_SIZE); | 244 | release_mem_region(pdata->baseaddr, pdata->size); |
234 | kfree(pdata); | 245 | kfree(pdata); |
235 | return 0; | 246 | return 0; |
236 | } | 247 | } |
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c new file mode 100644 index 000000000000..eac5fb1fc02f --- /dev/null +++ b/drivers/rtc/rtc-omap.c | |||
@@ -0,0 +1,572 @@ | |||
1 | /* | ||
2 | * TI OMAP1 Real Time Clock interface for Linux | ||
3 | * | ||
4 | * Copyright (C) 2003 MontaVista Software, Inc. | ||
5 | * Author: George G. Davis <gdavis@mvista.com> or <source@mvista.com> | ||
6 | * | ||
7 | * Copyright (C) 2006 David Brownell (new RTC framework) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/ioport.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/rtc.h> | ||
21 | #include <linux/bcd.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | |||
24 | #include <asm/io.h> | ||
25 | #include <asm/mach/time.h> | ||
26 | |||
27 | |||
28 | /* The OMAP1 RTC is a year/month/day/hours/minutes/seconds BCD clock | ||
29 | * with century-range alarm matching, driven by the 32kHz clock. | ||
30 | * | ||
31 | * The main user-visible ways it differs from PC RTCs are by omitting | ||
32 | * "don't care" alarm fields and sub-second periodic IRQs, and having | ||
33 | * an autoadjust mechanism to calibrate to the true oscillator rate. | ||
34 | * | ||
35 | * Board-specific wiring options include using split power mode with | ||
36 | * RTC_OFF_NOFF used as the reset signal (so the RTC won't be reset), | ||
37 | * and wiring RTC_WAKE_INT (so the RTC alarm can wake the system from | ||
38 | * low power modes). See the BOARD-SPECIFIC CUSTOMIZATION comment. | ||
39 | */ | ||
40 | |||
41 | #define OMAP_RTC_BASE 0xfffb4800 | ||
42 | |||
43 | /* RTC registers */ | ||
44 | #define OMAP_RTC_SECONDS_REG 0x00 | ||
45 | #define OMAP_RTC_MINUTES_REG 0x04 | ||
46 | #define OMAP_RTC_HOURS_REG 0x08 | ||
47 | #define OMAP_RTC_DAYS_REG 0x0C | ||
48 | #define OMAP_RTC_MONTHS_REG 0x10 | ||
49 | #define OMAP_RTC_YEARS_REG 0x14 | ||
50 | #define OMAP_RTC_WEEKS_REG 0x18 | ||
51 | |||
52 | #define OMAP_RTC_ALARM_SECONDS_REG 0x20 | ||
53 | #define OMAP_RTC_ALARM_MINUTES_REG 0x24 | ||
54 | #define OMAP_RTC_ALARM_HOURS_REG 0x28 | ||
55 | #define OMAP_RTC_ALARM_DAYS_REG 0x2c | ||
56 | #define OMAP_RTC_ALARM_MONTHS_REG 0x30 | ||
57 | #define OMAP_RTC_ALARM_YEARS_REG 0x34 | ||
58 | |||
59 | #define OMAP_RTC_CTRL_REG 0x40 | ||
60 | #define OMAP_RTC_STATUS_REG 0x44 | ||
61 | #define OMAP_RTC_INTERRUPTS_REG 0x48 | ||
62 | |||
63 | #define OMAP_RTC_COMP_LSB_REG 0x4c | ||
64 | #define OMAP_RTC_COMP_MSB_REG 0x50 | ||
65 | #define OMAP_RTC_OSC_REG 0x54 | ||
66 | |||
67 | /* OMAP_RTC_CTRL_REG bit fields: */ | ||
68 | #define OMAP_RTC_CTRL_SPLIT (1<<7) | ||
69 | #define OMAP_RTC_CTRL_DISABLE (1<<6) | ||
70 | #define OMAP_RTC_CTRL_SET_32_COUNTER (1<<5) | ||
71 | #define OMAP_RTC_CTRL_TEST (1<<4) | ||
72 | #define OMAP_RTC_CTRL_MODE_12_24 (1<<3) | ||
73 | #define OMAP_RTC_CTRL_AUTO_COMP (1<<2) | ||
74 | #define OMAP_RTC_CTRL_ROUND_30S (1<<1) | ||
75 | #define OMAP_RTC_CTRL_STOP (1<<0) | ||
76 | |||
77 | /* OMAP_RTC_STATUS_REG bit fields: */ | ||
78 | #define OMAP_RTC_STATUS_POWER_UP (1<<7) | ||
79 | #define OMAP_RTC_STATUS_ALARM (1<<6) | ||
80 | #define OMAP_RTC_STATUS_1D_EVENT (1<<5) | ||
81 | #define OMAP_RTC_STATUS_1H_EVENT (1<<4) | ||
82 | #define OMAP_RTC_STATUS_1M_EVENT (1<<3) | ||
83 | #define OMAP_RTC_STATUS_1S_EVENT (1<<2) | ||
84 | #define OMAP_RTC_STATUS_RUN (1<<1) | ||
85 | #define OMAP_RTC_STATUS_BUSY (1<<0) | ||
86 | |||
87 | /* OMAP_RTC_INTERRUPTS_REG bit fields: */ | ||
88 | #define OMAP_RTC_INTERRUPTS_IT_ALARM (1<<3) | ||
89 | #define OMAP_RTC_INTERRUPTS_IT_TIMER (1<<2) | ||
90 | |||
91 | |||
92 | #define rtc_read(addr) omap_readb(OMAP_RTC_BASE + (addr)) | ||
93 | #define rtc_write(val, addr) omap_writeb(val, OMAP_RTC_BASE + (addr)) | ||
94 | |||
95 | |||
96 | /* platform_bus isn't hotpluggable, so for static linkage it'd be safe | ||
97 | * to get rid of probe() and remove() code ... too bad the driver struct | ||
98 | * remembers probe(), that's about 25% of the runtime footprint!! | ||
99 | */ | ||
100 | #ifndef MODULE | ||
101 | #undef __devexit | ||
102 | #undef __devexit_p | ||
103 | #define __devexit __exit | ||
104 | #define __devexit_p __exit_p | ||
105 | #endif | ||
106 | |||
107 | |||
108 | /* we rely on the rtc framework to handle locking (rtc->ops_lock), | ||
109 | * so the only other requirement is that register accesses which | ||
110 | * require BUSY to be clear are made with IRQs locally disabled | ||
111 | */ | ||
112 | static void rtc_wait_not_busy(void) | ||
113 | { | ||
114 | int count = 0; | ||
115 | u8 status; | ||
116 | |||
117 | /* BUSY may stay active for 1/32768 second (~30 usec) */ | ||
118 | for (count = 0; count < 50; count++) { | ||
119 | status = rtc_read(OMAP_RTC_STATUS_REG); | ||
120 | if ((status & (u8)OMAP_RTC_STATUS_BUSY) == 0) | ||
121 | break; | ||
122 | udelay(1); | ||
123 | } | ||
124 | /* now we have ~15 usec to read/write various registers */ | ||
125 | } | ||
126 | |||
127 | static irqreturn_t rtc_irq(int irq, void *class_dev) | ||
128 | { | ||
129 | unsigned long events = 0; | ||
130 | u8 irq_data; | ||
131 | |||
132 | irq_data = rtc_read(OMAP_RTC_STATUS_REG); | ||
133 | |||
134 | /* alarm irq? */ | ||
135 | if (irq_data & OMAP_RTC_STATUS_ALARM) { | ||
136 | rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG); | ||
137 | events |= RTC_IRQF | RTC_AF; | ||
138 | } | ||
139 | |||
140 | /* 1/sec periodic/update irq? */ | ||
141 | if (irq_data & OMAP_RTC_STATUS_1S_EVENT) | ||
142 | events |= RTC_IRQF | RTC_UF; | ||
143 | |||
144 | rtc_update_irq(class_dev, 1, events); | ||
145 | |||
146 | return IRQ_HANDLED; | ||
147 | } | ||
148 | |||
149 | #ifdef CONFIG_RTC_INTF_DEV | ||
150 | |||
151 | static int | ||
152 | omap_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | ||
153 | { | ||
154 | u8 reg; | ||
155 | |||
156 | switch (cmd) { | ||
157 | case RTC_AIE_OFF: | ||
158 | case RTC_AIE_ON: | ||
159 | case RTC_UIE_OFF: | ||
160 | case RTC_UIE_ON: | ||
161 | break; | ||
162 | default: | ||
163 | return -ENOIOCTLCMD; | ||
164 | } | ||
165 | |||
166 | local_irq_disable(); | ||
167 | rtc_wait_not_busy(); | ||
168 | reg = rtc_read(OMAP_RTC_INTERRUPTS_REG); | ||
169 | switch (cmd) { | ||
170 | /* AIE = Alarm Interrupt Enable */ | ||
171 | case RTC_AIE_OFF: | ||
172 | reg &= ~OMAP_RTC_INTERRUPTS_IT_ALARM; | ||
173 | break; | ||
174 | case RTC_AIE_ON: | ||
175 | reg |= OMAP_RTC_INTERRUPTS_IT_ALARM; | ||
176 | break; | ||
177 | /* UIE = Update Interrupt Enable (1/second) */ | ||
178 | case RTC_UIE_OFF: | ||
179 | reg &= ~OMAP_RTC_INTERRUPTS_IT_TIMER; | ||
180 | break; | ||
181 | case RTC_UIE_ON: | ||
182 | reg |= OMAP_RTC_INTERRUPTS_IT_TIMER; | ||
183 | break; | ||
184 | } | ||
185 | rtc_wait_not_busy(); | ||
186 | rtc_write(reg, OMAP_RTC_INTERRUPTS_REG); | ||
187 | local_irq_enable(); | ||
188 | |||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | #else | ||
193 | #define omap_rtc_ioctl NULL | ||
194 | #endif | ||
195 | |||
196 | /* this hardware doesn't support "don't care" alarm fields */ | ||
197 | static int tm2bcd(struct rtc_time *tm) | ||
198 | { | ||
199 | if (rtc_valid_tm(tm) != 0) | ||
200 | return -EINVAL; | ||
201 | |||
202 | tm->tm_sec = BIN2BCD(tm->tm_sec); | ||
203 | tm->tm_min = BIN2BCD(tm->tm_min); | ||
204 | tm->tm_hour = BIN2BCD(tm->tm_hour); | ||
205 | tm->tm_mday = BIN2BCD(tm->tm_mday); | ||
206 | |||
207 | tm->tm_mon = BIN2BCD(tm->tm_mon + 1); | ||
208 | |||
209 | /* epoch == 1900 */ | ||
210 | if (tm->tm_year < 100 || tm->tm_year > 199) | ||
211 | return -EINVAL; | ||
212 | tm->tm_year = BIN2BCD(tm->tm_year - 100); | ||
213 | |||
214 | return 0; | ||
215 | } | ||
216 | |||
217 | static void bcd2tm(struct rtc_time *tm) | ||
218 | { | ||
219 | tm->tm_sec = BCD2BIN(tm->tm_sec); | ||
220 | tm->tm_min = BCD2BIN(tm->tm_min); | ||
221 | tm->tm_hour = BCD2BIN(tm->tm_hour); | ||
222 | tm->tm_mday = BCD2BIN(tm->tm_mday); | ||
223 | tm->tm_mon = BCD2BIN(tm->tm_mon) - 1; | ||
224 | /* epoch == 1900 */ | ||
225 | tm->tm_year = BCD2BIN(tm->tm_year) + 100; | ||
226 | } | ||
227 | |||
228 | |||
229 | static int omap_rtc_read_time(struct device *dev, struct rtc_time *tm) | ||
230 | { | ||
231 | /* we don't report wday/yday/isdst ... */ | ||
232 | local_irq_disable(); | ||
233 | rtc_wait_not_busy(); | ||
234 | |||
235 | tm->tm_sec = rtc_read(OMAP_RTC_SECONDS_REG); | ||
236 | tm->tm_min = rtc_read(OMAP_RTC_MINUTES_REG); | ||
237 | tm->tm_hour = rtc_read(OMAP_RTC_HOURS_REG); | ||
238 | tm->tm_mday = rtc_read(OMAP_RTC_DAYS_REG); | ||
239 | tm->tm_mon = rtc_read(OMAP_RTC_MONTHS_REG); | ||
240 | tm->tm_year = rtc_read(OMAP_RTC_YEARS_REG); | ||
241 | |||
242 | local_irq_enable(); | ||
243 | |||
244 | bcd2tm(tm); | ||
245 | return 0; | ||
246 | } | ||
247 | |||
248 | static int omap_rtc_set_time(struct device *dev, struct rtc_time *tm) | ||
249 | { | ||
250 | if (tm2bcd(tm) < 0) | ||
251 | return -EINVAL; | ||
252 | local_irq_disable(); | ||
253 | rtc_wait_not_busy(); | ||
254 | |||
255 | rtc_write(tm->tm_year, OMAP_RTC_YEARS_REG); | ||
256 | rtc_write(tm->tm_mon, OMAP_RTC_MONTHS_REG); | ||
257 | rtc_write(tm->tm_mday, OMAP_RTC_DAYS_REG); | ||
258 | rtc_write(tm->tm_hour, OMAP_RTC_HOURS_REG); | ||
259 | rtc_write(tm->tm_min, OMAP_RTC_MINUTES_REG); | ||
260 | rtc_write(tm->tm_sec, OMAP_RTC_SECONDS_REG); | ||
261 | |||
262 | local_irq_enable(); | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | static int omap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) | ||
268 | { | ||
269 | local_irq_disable(); | ||
270 | rtc_wait_not_busy(); | ||
271 | |||
272 | alm->time.tm_sec = rtc_read(OMAP_RTC_ALARM_SECONDS_REG); | ||
273 | alm->time.tm_min = rtc_read(OMAP_RTC_ALARM_MINUTES_REG); | ||
274 | alm->time.tm_hour = rtc_read(OMAP_RTC_ALARM_HOURS_REG); | ||
275 | alm->time.tm_mday = rtc_read(OMAP_RTC_ALARM_DAYS_REG); | ||
276 | alm->time.tm_mon = rtc_read(OMAP_RTC_ALARM_MONTHS_REG); | ||
277 | alm->time.tm_year = rtc_read(OMAP_RTC_ALARM_YEARS_REG); | ||
278 | |||
279 | local_irq_enable(); | ||
280 | |||
281 | bcd2tm(&alm->time); | ||
282 | alm->pending = !!(rtc_read(OMAP_RTC_INTERRUPTS_REG) | ||
283 | & OMAP_RTC_INTERRUPTS_IT_ALARM); | ||
284 | alm->enabled = alm->pending && device_may_wakeup(dev); | ||
285 | |||
286 | return 0; | ||
287 | } | ||
288 | |||
289 | static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) | ||
290 | { | ||
291 | u8 reg; | ||
292 | |||
293 | /* Much userspace code uses RTC_ALM_SET, thus "don't care" for | ||
294 | * day/month/year specifies alarms up to 24 hours in the future. | ||
295 | * So we need to handle that ... but let's ignore the "don't care" | ||
296 | * values for hours/minutes/seconds. | ||
297 | */ | ||
298 | if (alm->time.tm_mday <= 0 | ||
299 | && alm->time.tm_mon < 0 | ||
300 | && alm->time.tm_year < 0) { | ||
301 | struct rtc_time tm; | ||
302 | unsigned long now, then; | ||
303 | |||
304 | omap_rtc_read_time(dev, &tm); | ||
305 | rtc_tm_to_time(&tm, &now); | ||
306 | |||
307 | alm->time.tm_mday = tm.tm_mday; | ||
308 | alm->time.tm_mon = tm.tm_mon; | ||
309 | alm->time.tm_year = tm.tm_year; | ||
310 | rtc_tm_to_time(&alm->time, &then); | ||
311 | |||
312 | /* sometimes the alarm wraps into tomorrow */ | ||
313 | if (then < now) { | ||
314 | rtc_time_to_tm(now + 24 * 60 * 60, &tm); | ||
315 | alm->time.tm_mday = tm.tm_mday; | ||
316 | alm->time.tm_mon = tm.tm_mon; | ||
317 | alm->time.tm_year = tm.tm_year; | ||
318 | } | ||
319 | } | ||
320 | |||
321 | if (tm2bcd(&alm->time) < 0) | ||
322 | return -EINVAL; | ||
323 | |||
324 | local_irq_disable(); | ||
325 | rtc_wait_not_busy(); | ||
326 | |||
327 | rtc_write(alm->time.tm_year, OMAP_RTC_ALARM_YEARS_REG); | ||
328 | rtc_write(alm->time.tm_mon, OMAP_RTC_ALARM_MONTHS_REG); | ||
329 | rtc_write(alm->time.tm_mday, OMAP_RTC_ALARM_DAYS_REG); | ||
330 | rtc_write(alm->time.tm_hour, OMAP_RTC_ALARM_HOURS_REG); | ||
331 | rtc_write(alm->time.tm_min, OMAP_RTC_ALARM_MINUTES_REG); | ||
332 | rtc_write(alm->time.tm_sec, OMAP_RTC_ALARM_SECONDS_REG); | ||
333 | |||
334 | reg = rtc_read(OMAP_RTC_INTERRUPTS_REG); | ||
335 | if (alm->enabled) | ||
336 | reg |= OMAP_RTC_INTERRUPTS_IT_ALARM; | ||
337 | else | ||
338 | reg &= ~OMAP_RTC_INTERRUPTS_IT_ALARM; | ||
339 | rtc_write(reg, OMAP_RTC_INTERRUPTS_REG); | ||
340 | |||
341 | local_irq_enable(); | ||
342 | |||
343 | return 0; | ||
344 | } | ||
345 | |||
346 | static struct rtc_class_ops omap_rtc_ops = { | ||
347 | .ioctl = omap_rtc_ioctl, | ||
348 | .read_time = omap_rtc_read_time, | ||
349 | .set_time = omap_rtc_set_time, | ||
350 | .read_alarm = omap_rtc_read_alarm, | ||
351 | .set_alarm = omap_rtc_set_alarm, | ||
352 | }; | ||
353 | |||
354 | static int omap_rtc_alarm; | ||
355 | static int omap_rtc_timer; | ||
356 | |||
357 | static int __devinit omap_rtc_probe(struct platform_device *pdev) | ||
358 | { | ||
359 | struct resource *res, *mem; | ||
360 | struct rtc_device *rtc; | ||
361 | u8 reg, new_ctrl; | ||
362 | |||
363 | omap_rtc_timer = platform_get_irq(pdev, 0); | ||
364 | if (omap_rtc_timer <= 0) { | ||
365 | pr_debug("%s: no update irq?\n", pdev->name); | ||
366 | return -ENOENT; | ||
367 | } | ||
368 | |||
369 | omap_rtc_alarm = platform_get_irq(pdev, 1); | ||
370 | if (omap_rtc_alarm <= 0) { | ||
371 | pr_debug("%s: no alarm irq?\n", pdev->name); | ||
372 | return -ENOENT; | ||
373 | } | ||
374 | |||
375 | /* NOTE: using static mapping for RTC registers */ | ||
376 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
377 | if (res && res->start != OMAP_RTC_BASE) { | ||
378 | pr_debug("%s: RTC registers at %08x, expected %08x\n", | ||
379 | pdev->name, (unsigned) res->start, OMAP_RTC_BASE); | ||
380 | return -ENOENT; | ||
381 | } | ||
382 | |||
383 | if (res) | ||
384 | mem = request_mem_region(res->start, | ||
385 | res->end - res->start + 1, | ||
386 | pdev->name); | ||
387 | else | ||
388 | mem = NULL; | ||
389 | if (!mem) { | ||
390 | pr_debug("%s: RTC registers at %08x are not free\n", | ||
391 | pdev->name, OMAP_RTC_BASE); | ||
392 | return -EBUSY; | ||
393 | } | ||
394 | |||
395 | rtc = rtc_device_register(pdev->name, &pdev->dev, | ||
396 | &omap_rtc_ops, THIS_MODULE); | ||
397 | if (IS_ERR(rtc)) { | ||
398 | pr_debug("%s: can't register RTC device, err %ld\n", | ||
399 | pdev->name, PTR_ERR(rtc)); | ||
400 | goto fail; | ||
401 | } | ||
402 | platform_set_drvdata(pdev, rtc); | ||
403 | class_set_devdata(&rtc->class_dev, mem); | ||
404 | |||
405 | /* clear pending irqs, and set 1/second periodic, | ||
406 | * which we'll use instead of update irqs | ||
407 | */ | ||
408 | rtc_write(0, OMAP_RTC_INTERRUPTS_REG); | ||
409 | |||
410 | /* clear old status */ | ||
411 | reg = rtc_read(OMAP_RTC_STATUS_REG); | ||
412 | if (reg & (u8) OMAP_RTC_STATUS_POWER_UP) { | ||
413 | pr_info("%s: RTC power up reset detected\n", | ||
414 | pdev->name); | ||
415 | rtc_write(OMAP_RTC_STATUS_POWER_UP, OMAP_RTC_STATUS_REG); | ||
416 | } | ||
417 | if (reg & (u8) OMAP_RTC_STATUS_ALARM) | ||
418 | rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG); | ||
419 | |||
420 | /* handle periodic and alarm irqs */ | ||
421 | if (request_irq(omap_rtc_timer, rtc_irq, SA_INTERRUPT, | ||
422 | rtc->class_dev.class_id, &rtc->class_dev)) { | ||
423 | pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n", | ||
424 | pdev->name, omap_rtc_timer); | ||
425 | goto fail0; | ||
426 | } | ||
427 | if (request_irq(omap_rtc_alarm, rtc_irq, SA_INTERRUPT, | ||
428 | rtc->class_dev.class_id, &rtc->class_dev)) { | ||
429 | pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n", | ||
430 | pdev->name, omap_rtc_alarm); | ||
431 | goto fail1; | ||
432 | } | ||
433 | |||
434 | /* On boards with split power, RTC_ON_NOFF won't reset the RTC */ | ||
435 | reg = rtc_read(OMAP_RTC_CTRL_REG); | ||
436 | if (reg & (u8) OMAP_RTC_CTRL_STOP) | ||
437 | pr_info("%s: already running\n", pdev->name); | ||
438 | |||
439 | /* force to 24 hour mode */ | ||
440 | new_ctrl = reg & ~(OMAP_RTC_CTRL_SPLIT|OMAP_RTC_CTRL_AUTO_COMP); | ||
441 | new_ctrl |= OMAP_RTC_CTRL_STOP; | ||
442 | |||
443 | /* BOARD-SPECIFIC CUSTOMIZATION CAN GO HERE: | ||
444 | * | ||
445 | * - Boards wired so that RTC_WAKE_INT does something, and muxed | ||
446 | * right (W13_1610_RTC_WAKE_INT is the default after chip reset), | ||
447 | * should initialize the device wakeup flag appropriately. | ||
448 | * | ||
449 | * - Boards wired so RTC_ON_nOFF is used as the reset signal, | ||
450 | * rather than nPWRON_RESET, should forcibly enable split | ||
451 | * power mode. (Some chip errata report that RTC_CTRL_SPLIT | ||
452 | * is write-only, and always reads as zero...) | ||
453 | */ | ||
454 | device_init_wakeup(&pdev->dev, 0); | ||
455 | |||
456 | if (new_ctrl & (u8) OMAP_RTC_CTRL_SPLIT) | ||
457 | pr_info("%s: split power mode\n", pdev->name); | ||
458 | |||
459 | if (reg != new_ctrl) | ||
460 | rtc_write(new_ctrl, OMAP_RTC_CTRL_REG); | ||
461 | |||
462 | return 0; | ||
463 | |||
464 | fail1: | ||
465 | free_irq(omap_rtc_timer, NULL); | ||
466 | fail0: | ||
467 | rtc_device_unregister(rtc); | ||
468 | fail: | ||
469 | release_resource(mem); | ||
470 | return -EIO; | ||
471 | } | ||
472 | |||
473 | static int __devexit omap_rtc_remove(struct platform_device *pdev) | ||
474 | { | ||
475 | struct rtc_device *rtc = platform_get_drvdata(pdev);; | ||
476 | |||
477 | device_init_wakeup(&pdev->dev, 0); | ||
478 | |||
479 | /* leave rtc running, but disable irqs */ | ||
480 | rtc_write(0, OMAP_RTC_INTERRUPTS_REG); | ||
481 | |||
482 | free_irq(omap_rtc_timer, rtc); | ||
483 | free_irq(omap_rtc_alarm, rtc); | ||
484 | |||
485 | release_resource(class_get_devdata(&rtc->class_dev)); | ||
486 | rtc_device_unregister(rtc); | ||
487 | return 0; | ||
488 | } | ||
489 | |||
490 | #ifdef CONFIG_PM | ||
491 | |||
492 | static struct timespec rtc_delta; | ||
493 | static u8 irqstat; | ||
494 | |||
495 | static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state) | ||
496 | { | ||
497 | struct rtc_time rtc_tm; | ||
498 | struct timespec time; | ||
499 | |||
500 | time.tv_nsec = 0; | ||
501 | omap_rtc_read_time(NULL, &rtc_tm); | ||
502 | rtc_tm_to_time(&rtc_tm, &time.tv_sec); | ||
503 | |||
504 | save_time_delta(&rtc_delta, &time); | ||
505 | irqstat = rtc_read(OMAP_RTC_INTERRUPTS_REG); | ||
506 | |||
507 | /* FIXME the RTC alarm is not currently acting as a wakeup event | ||
508 | * source, and in fact this enable() call is just saving a flag | ||
509 | * that's never used... | ||
510 | */ | ||
511 | if (device_may_wakeup(&pdev->dev)) | ||
512 | enable_irq_wake(omap_rtc_alarm); | ||
513 | else | ||
514 | rtc_write(0, OMAP_RTC_INTERRUPTS_REG); | ||
515 | |||
516 | return 0; | ||
517 | } | ||
518 | |||
519 | static int omap_rtc_resume(struct platform_device *pdev) | ||
520 | { | ||
521 | struct rtc_time rtc_tm; | ||
522 | struct timespec time; | ||
523 | |||
524 | time.tv_nsec = 0; | ||
525 | omap_rtc_read_time(NULL, &rtc_tm); | ||
526 | rtc_tm_to_time(&rtc_tm, &time.tv_sec); | ||
527 | |||
528 | restore_time_delta(&rtc_delta, &time); | ||
529 | if (device_may_wakeup(&pdev->dev)) | ||
530 | disable_irq_wake(omap_rtc_alarm); | ||
531 | else | ||
532 | rtc_write(irqstat, OMAP_RTC_INTERRUPTS_REG); | ||
533 | return 0; | ||
534 | } | ||
535 | |||
536 | #else | ||
537 | #define omap_rtc_suspend NULL | ||
538 | #define omap_rtc_resume NULL | ||
539 | #endif | ||
540 | |||
541 | static void omap_rtc_shutdown(struct platform_device *pdev) | ||
542 | { | ||
543 | rtc_write(0, OMAP_RTC_INTERRUPTS_REG); | ||
544 | } | ||
545 | |||
546 | MODULE_ALIAS("omap_rtc"); | ||
547 | static struct platform_driver omap_rtc_driver = { | ||
548 | .probe = omap_rtc_probe, | ||
549 | .remove = __devexit_p(omap_rtc_remove), | ||
550 | .suspend = omap_rtc_suspend, | ||
551 | .resume = omap_rtc_resume, | ||
552 | .shutdown = omap_rtc_shutdown, | ||
553 | .driver = { | ||
554 | .name = "omap_rtc", | ||
555 | .owner = THIS_MODULE, | ||
556 | }, | ||
557 | }; | ||
558 | |||
559 | static int __init rtc_init(void) | ||
560 | { | ||
561 | return platform_driver_register(&omap_rtc_driver); | ||
562 | } | ||
563 | module_init(rtc_init); | ||
564 | |||
565 | static void __exit rtc_exit(void) | ||
566 | { | ||
567 | platform_driver_unregister(&omap_rtc_driver); | ||
568 | } | ||
569 | module_exit(rtc_exit); | ||
570 | |||
571 | MODULE_AUTHOR("George G. Davis (and others)"); | ||
572 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index a44fe4efa216..e2c7698fdba3 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/rtc.h> | 13 | #include <linux/rtc.h> |
14 | #include <linux/bcd.h> | 14 | #include <linux/bcd.h> |
15 | 15 | ||
16 | #define DRV_VERSION "0.2" | 16 | #define DRV_VERSION "0.3" |
17 | 17 | ||
18 | /* Addresses to scan */ | 18 | /* Addresses to scan */ |
19 | static unsigned short normal_i2c[] = { /* 0x32,*/ I2C_CLIENT_END }; | 19 | static unsigned short normal_i2c[] = { /* 0x32,*/ I2C_CLIENT_END }; |
@@ -39,6 +39,14 @@ static int rs5c372_attach(struct i2c_adapter *adapter); | |||
39 | static int rs5c372_detach(struct i2c_client *client); | 39 | static int rs5c372_detach(struct i2c_client *client); |
40 | static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind); | 40 | static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind); |
41 | 41 | ||
42 | struct rs5c372 { | ||
43 | u8 reg_addr; | ||
44 | u8 regs[17]; | ||
45 | struct i2c_msg msg[1]; | ||
46 | struct i2c_client client; | ||
47 | struct rtc_device *rtc; | ||
48 | }; | ||
49 | |||
42 | static struct i2c_driver rs5c372_driver = { | 50 | static struct i2c_driver rs5c372_driver = { |
43 | .driver = { | 51 | .driver = { |
44 | .name = "rs5c372", | 52 | .name = "rs5c372", |
@@ -49,18 +57,16 @@ static struct i2c_driver rs5c372_driver = { | |||
49 | 57 | ||
50 | static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm) | 58 | static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm) |
51 | { | 59 | { |
52 | unsigned char buf[7] = { RS5C372_REG_BASE }; | ||
53 | 60 | ||
54 | /* this implements the 1st reading method, according | 61 | struct rs5c372 *rs5c372 = i2c_get_clientdata(client); |
55 | * to the datasheet. buf[0] is initialized with | 62 | u8 *buf = &(rs5c372->regs[1]); |
56 | * address ptr and transmission format register. | 63 | |
64 | /* this implements the 3rd reading method, according | ||
65 | * to the datasheet. rs5c372 defaults to internal | ||
66 | * address 0xF, so 0x0 is in regs[1] | ||
57 | */ | 67 | */ |
58 | struct i2c_msg msgs[] = { | ||
59 | { client->addr, 0, 1, buf }, | ||
60 | { client->addr, I2C_M_RD, 7, buf }, | ||
61 | }; | ||
62 | 68 | ||
63 | if ((i2c_transfer(client->adapter, msgs, 2)) != 2) { | 69 | if ((i2c_transfer(client->adapter, rs5c372->msg, 1)) != 1) { |
64 | dev_err(&client->dev, "%s: read error\n", __FUNCTION__); | 70 | dev_err(&client->dev, "%s: read error\n", __FUNCTION__); |
65 | return -EIO; | 71 | return -EIO; |
66 | } | 72 | } |
@@ -114,23 +120,14 @@ static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
114 | 120 | ||
115 | static int rs5c372_get_trim(struct i2c_client *client, int *osc, int *trim) | 121 | static int rs5c372_get_trim(struct i2c_client *client, int *osc, int *trim) |
116 | { | 122 | { |
117 | unsigned char buf = RS5C372_REG_TRIM; | 123 | struct rs5c372 *rs5c372 = i2c_get_clientdata(client); |
118 | 124 | u8 tmp = rs5c372->regs[RS5C372_REG_TRIM + 1]; | |
119 | struct i2c_msg msgs[] = { | ||
120 | { client->addr, 0, 1, &buf }, | ||
121 | { client->addr, I2C_M_RD, 1, &buf }, | ||
122 | }; | ||
123 | |||
124 | if ((i2c_transfer(client->adapter, msgs, 2)) != 2) { | ||
125 | dev_err(&client->dev, "%s: read error\n", __FUNCTION__); | ||
126 | return -EIO; | ||
127 | } | ||
128 | 125 | ||
129 | if (osc) | 126 | if (osc) |
130 | *osc = (buf & RS5C372_TRIM_XSL) ? 32000 : 32768; | 127 | *osc = (tmp & RS5C372_TRIM_XSL) ? 32000 : 32768; |
131 | 128 | ||
132 | if (trim) { | 129 | if (trim) { |
133 | *trim = buf & RS5C372_TRIM_MASK; | 130 | *trim = tmp & RS5C372_TRIM_MASK; |
134 | dev_dbg(&client->dev, "%s: raw trim=%x\n", __FUNCTION__, *trim); | 131 | dev_dbg(&client->dev, "%s: raw trim=%x\n", __FUNCTION__, *trim); |
135 | } | 132 | } |
136 | 133 | ||
@@ -201,7 +198,7 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind) | |||
201 | { | 198 | { |
202 | int err = 0; | 199 | int err = 0; |
203 | struct i2c_client *client; | 200 | struct i2c_client *client; |
204 | struct rtc_device *rtc; | 201 | struct rs5c372 *rs5c372; |
205 | 202 | ||
206 | dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); | 203 | dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); |
207 | 204 | ||
@@ -210,10 +207,11 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind) | |||
210 | goto exit; | 207 | goto exit; |
211 | } | 208 | } |
212 | 209 | ||
213 | if (!(client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL))) { | 210 | if (!(rs5c372 = kzalloc(sizeof(struct rs5c372), GFP_KERNEL))) { |
214 | err = -ENOMEM; | 211 | err = -ENOMEM; |
215 | goto exit; | 212 | goto exit; |
216 | } | 213 | } |
214 | client = &rs5c372->client; | ||
217 | 215 | ||
218 | /* I2C client */ | 216 | /* I2C client */ |
219 | client->addr = address; | 217 | client->addr = address; |
@@ -222,32 +220,47 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind) | |||
222 | 220 | ||
223 | strlcpy(client->name, rs5c372_driver.driver.name, I2C_NAME_SIZE); | 221 | strlcpy(client->name, rs5c372_driver.driver.name, I2C_NAME_SIZE); |
224 | 222 | ||
223 | i2c_set_clientdata(client, rs5c372); | ||
224 | |||
225 | rs5c372->msg[0].addr = address; | ||
226 | rs5c372->msg[0].flags = I2C_M_RD; | ||
227 | rs5c372->msg[0].len = sizeof(rs5c372->regs); | ||
228 | rs5c372->msg[0].buf = rs5c372->regs; | ||
229 | |||
225 | /* Inform the i2c layer */ | 230 | /* Inform the i2c layer */ |
226 | if ((err = i2c_attach_client(client))) | 231 | if ((err = i2c_attach_client(client))) |
227 | goto exit_kfree; | 232 | goto exit_kfree; |
228 | 233 | ||
229 | dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); | 234 | dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); |
230 | 235 | ||
231 | rtc = rtc_device_register(rs5c372_driver.driver.name, &client->dev, | 236 | rs5c372->rtc = rtc_device_register(rs5c372_driver.driver.name, |
232 | &rs5c372_rtc_ops, THIS_MODULE); | 237 | &client->dev, &rs5c372_rtc_ops, THIS_MODULE); |
233 | 238 | ||
234 | if (IS_ERR(rtc)) { | 239 | if (IS_ERR(rs5c372->rtc)) { |
235 | err = PTR_ERR(rtc); | 240 | err = PTR_ERR(rs5c372->rtc); |
236 | goto exit_detach; | 241 | goto exit_detach; |
237 | } | 242 | } |
238 | 243 | ||
239 | i2c_set_clientdata(client, rtc); | 244 | err = device_create_file(&client->dev, &dev_attr_trim); |
240 | 245 | if (err) | |
241 | device_create_file(&client->dev, &dev_attr_trim); | 246 | goto exit_devreg; |
242 | device_create_file(&client->dev, &dev_attr_osc); | 247 | err = device_create_file(&client->dev, &dev_attr_osc); |
248 | if (err) | ||
249 | goto exit_trim; | ||
243 | 250 | ||
244 | return 0; | 251 | return 0; |
245 | 252 | ||
253 | exit_trim: | ||
254 | device_remove_file(&client->dev, &dev_attr_trim); | ||
255 | |||
256 | exit_devreg: | ||
257 | rtc_device_unregister(rs5c372->rtc); | ||
258 | |||
246 | exit_detach: | 259 | exit_detach: |
247 | i2c_detach_client(client); | 260 | i2c_detach_client(client); |
248 | 261 | ||
249 | exit_kfree: | 262 | exit_kfree: |
250 | kfree(client); | 263 | kfree(rs5c372); |
251 | 264 | ||
252 | exit: | 265 | exit: |
253 | return err; | 266 | return err; |
@@ -256,16 +269,15 @@ exit: | |||
256 | static int rs5c372_detach(struct i2c_client *client) | 269 | static int rs5c372_detach(struct i2c_client *client) |
257 | { | 270 | { |
258 | int err; | 271 | int err; |
259 | struct rtc_device *rtc = i2c_get_clientdata(client); | 272 | struct rs5c372 *rs5c372 = i2c_get_clientdata(client); |
260 | 273 | ||
261 | if (rtc) | 274 | if (rs5c372->rtc) |
262 | rtc_device_unregister(rtc); | 275 | rtc_device_unregister(rs5c372->rtc); |
263 | 276 | ||
264 | if ((err = i2c_detach_client(client))) | 277 | if ((err = i2c_detach_client(client))) |
265 | return err; | 278 | return err; |
266 | 279 | ||
267 | kfree(client); | 280 | kfree(rs5c372); |
268 | |||
269 | return 0; | 281 | return 0; |
270 | } | 282 | } |
271 | 283 | ||
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index 6ef9c62d5032..f50a1b8e1607 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c | |||
@@ -123,11 +123,18 @@ static int test_probe(struct platform_device *plat_dev) | |||
123 | err = PTR_ERR(rtc); | 123 | err = PTR_ERR(rtc); |
124 | return err; | 124 | return err; |
125 | } | 125 | } |
126 | device_create_file(&plat_dev->dev, &dev_attr_irq); | 126 | |
127 | err = device_create_file(&plat_dev->dev, &dev_attr_irq); | ||
128 | if (err) | ||
129 | goto err; | ||
127 | 130 | ||
128 | platform_set_drvdata(plat_dev, rtc); | 131 | platform_set_drvdata(plat_dev, rtc); |
129 | 132 | ||
130 | return 0; | 133 | return 0; |
134 | |||
135 | err: | ||
136 | rtc_device_unregister(rtc); | ||
137 | return err; | ||
131 | } | 138 | } |
132 | 139 | ||
133 | static int __devexit test_remove(struct platform_device *plat_dev) | 140 | static int __devexit test_remove(struct platform_device *plat_dev) |
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c index 522c69753bbf..9a67487d086b 100644 --- a/drivers/rtc/rtc-x1205.c +++ b/drivers/rtc/rtc-x1205.c | |||
@@ -562,11 +562,19 @@ static int x1205_probe(struct i2c_adapter *adapter, int address, int kind) | |||
562 | else | 562 | else |
563 | dev_err(&client->dev, "couldn't read status\n"); | 563 | dev_err(&client->dev, "couldn't read status\n"); |
564 | 564 | ||
565 | device_create_file(&client->dev, &dev_attr_atrim); | 565 | err = device_create_file(&client->dev, &dev_attr_atrim); |
566 | device_create_file(&client->dev, &dev_attr_dtrim); | 566 | if (err) goto exit_devreg; |
567 | err = device_create_file(&client->dev, &dev_attr_dtrim); | ||
568 | if (err) goto exit_atrim; | ||
567 | 569 | ||
568 | return 0; | 570 | return 0; |
569 | 571 | ||
572 | exit_atrim: | ||
573 | device_remove_file(&client->dev, &dev_attr_atrim); | ||
574 | |||
575 | exit_devreg: | ||
576 | rtc_device_unregister(rtc); | ||
577 | |||
570 | exit_detach: | 578 | exit_detach: |
571 | i2c_detach_client(client); | 579 | i2c_detach_client(client); |
572 | 580 | ||
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 17fdd8c9f740..cf28ccc57948 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #include "dasd_int.h" | 26 | #include "dasd_int.h" |
27 | 27 | ||
28 | kmem_cache_t *dasd_page_cache; | 28 | struct kmem_cache *dasd_page_cache; |
29 | EXPORT_SYMBOL_GPL(dasd_page_cache); | 29 | EXPORT_SYMBOL_GPL(dasd_page_cache); |
30 | 30 | ||
31 | /* | 31 | /* |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 5ecea3e4fdef..fdaa471e845f 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -1215,7 +1215,7 @@ dasd_eckd_build_cp(struct dasd_device * device, struct request *req) | |||
1215 | dst = page_address(bv->bv_page) + bv->bv_offset; | 1215 | dst = page_address(bv->bv_page) + bv->bv_offset; |
1216 | if (dasd_page_cache) { | 1216 | if (dasd_page_cache) { |
1217 | char *copy = kmem_cache_alloc(dasd_page_cache, | 1217 | char *copy = kmem_cache_alloc(dasd_page_cache, |
1218 | SLAB_DMA | __GFP_NOWARN); | 1218 | GFP_DMA | __GFP_NOWARN); |
1219 | if (copy && rq_data_dir(req) == WRITE) | 1219 | if (copy && rq_data_dir(req) == WRITE) |
1220 | memcpy(copy + bv->bv_offset, dst, bv->bv_len); | 1220 | memcpy(copy + bv->bv_offset, dst, bv->bv_len); |
1221 | if (copy) | 1221 | if (copy) |
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index 80926c548228..b857fd5893fd 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c | |||
@@ -308,7 +308,7 @@ dasd_fba_build_cp(struct dasd_device * device, struct request *req) | |||
308 | dst = page_address(bv->bv_page) + bv->bv_offset; | 308 | dst = page_address(bv->bv_page) + bv->bv_offset; |
309 | if (dasd_page_cache) { | 309 | if (dasd_page_cache) { |
310 | char *copy = kmem_cache_alloc(dasd_page_cache, | 310 | char *copy = kmem_cache_alloc(dasd_page_cache, |
311 | SLAB_DMA | __GFP_NOWARN); | 311 | GFP_DMA | __GFP_NOWARN); |
312 | if (copy && rq_data_dir(req) == WRITE) | 312 | if (copy && rq_data_dir(req) == WRITE) |
313 | memcpy(copy + bv->bv_offset, dst, bv->bv_len); | 313 | memcpy(copy + bv->bv_offset, dst, bv->bv_len); |
314 | if (copy) | 314 | if (copy) |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index 9f52004f6fc2..dc5dd509434d 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -474,7 +474,7 @@ extern struct dasd_profile_info_t dasd_global_profile; | |||
474 | extern unsigned int dasd_profile_level; | 474 | extern unsigned int dasd_profile_level; |
475 | extern struct block_device_operations dasd_device_operations; | 475 | extern struct block_device_operations dasd_device_operations; |
476 | 476 | ||
477 | extern kmem_cache_t *dasd_page_cache; | 477 | extern struct kmem_cache *dasd_page_cache; |
478 | 478 | ||
479 | struct dasd_ccw_req * | 479 | struct dasd_ccw_req * |
480 | dasd_kmalloc_request(char *, int, int, struct dasd_device *); | 480 | dasd_kmalloc_request(char *, int, int, struct dasd_device *); |
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 74c0eac083e4..32933ed54b8a 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h | |||
@@ -1032,9 +1032,9 @@ struct zfcp_data { | |||
1032 | wwn_t init_wwpn; | 1032 | wwn_t init_wwpn; |
1033 | fcp_lun_t init_fcp_lun; | 1033 | fcp_lun_t init_fcp_lun; |
1034 | char *driver_version; | 1034 | char *driver_version; |
1035 | kmem_cache_t *fsf_req_qtcb_cache; | 1035 | struct kmem_cache *fsf_req_qtcb_cache; |
1036 | kmem_cache_t *sr_buffer_cache; | 1036 | struct kmem_cache *sr_buffer_cache; |
1037 | kmem_cache_t *gid_pn_cache; | 1037 | struct kmem_cache *gid_pn_cache; |
1038 | }; | 1038 | }; |
1039 | 1039 | ||
1040 | /** | 1040 | /** |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 277826cdd0c8..067f1519eb04 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -109,7 +109,7 @@ zfcp_fsf_req_alloc(mempool_t *pool, int req_flags) | |||
109 | ptr = kmalloc(size, GFP_ATOMIC); | 109 | ptr = kmalloc(size, GFP_ATOMIC); |
110 | else | 110 | else |
111 | ptr = kmem_cache_alloc(zfcp_data.fsf_req_qtcb_cache, | 111 | ptr = kmem_cache_alloc(zfcp_data.fsf_req_qtcb_cache, |
112 | SLAB_ATOMIC); | 112 | GFP_ATOMIC); |
113 | } | 113 | } |
114 | 114 | ||
115 | if (unlikely(!ptr)) | 115 | if (unlikely(!ptr)) |
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 335a25540c08..68103e508db7 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
@@ -313,7 +313,7 @@ NCR_700_detect(struct scsi_host_template *tpnt, | |||
313 | hostdata->status = memory + STATUS_OFFSET; | 313 | hostdata->status = memory + STATUS_OFFSET; |
314 | /* all of these offsets are L1_CACHE_BYTES separated. It is fatal | 314 | /* all of these offsets are L1_CACHE_BYTES separated. It is fatal |
315 | * if this isn't sufficient separation to avoid dma flushing issues */ | 315 | * if this isn't sufficient separation to avoid dma flushing issues */ |
316 | BUG_ON(!dma_is_consistent(pScript) && L1_CACHE_BYTES < dma_get_cache_alignment()); | 316 | BUG_ON(!dma_is_consistent(hostdata->dev, pScript) && L1_CACHE_BYTES < dma_get_cache_alignment()); |
317 | hostdata->slots = (struct NCR_700_command_slot *)(memory + SLOTS_OFFSET); | 317 | hostdata->slots = (struct NCR_700_command_slot *)(memory + SLOTS_OFFSET); |
318 | hostdata->dev = dev; | 318 | hostdata->dev = dev; |
319 | 319 | ||
@@ -362,11 +362,11 @@ NCR_700_detect(struct scsi_host_template *tpnt, | |||
362 | for (j = 0; j < PATCHES; j++) | 362 | for (j = 0; j < PATCHES; j++) |
363 | script[LABELPATCHES[j]] = bS_to_host(pScript + SCRIPT[LABELPATCHES[j]]); | 363 | script[LABELPATCHES[j]] = bS_to_host(pScript + SCRIPT[LABELPATCHES[j]]); |
364 | /* now patch up fixed addresses. */ | 364 | /* now patch up fixed addresses. */ |
365 | script_patch_32(script, MessageLocation, | 365 | script_patch_32(hostdata->dev, script, MessageLocation, |
366 | pScript + MSGOUT_OFFSET); | 366 | pScript + MSGOUT_OFFSET); |
367 | script_patch_32(script, StatusAddress, | 367 | script_patch_32(hostdata->dev, script, StatusAddress, |
368 | pScript + STATUS_OFFSET); | 368 | pScript + STATUS_OFFSET); |
369 | script_patch_32(script, ReceiveMsgAddress, | 369 | script_patch_32(hostdata->dev, script, ReceiveMsgAddress, |
370 | pScript + MSGIN_OFFSET); | 370 | pScript + MSGIN_OFFSET); |
371 | 371 | ||
372 | hostdata->script = script; | 372 | hostdata->script = script; |
@@ -821,8 +821,9 @@ process_extended_message(struct Scsi_Host *host, | |||
821 | shost_printk(KERN_WARNING, host, | 821 | shost_printk(KERN_WARNING, host, |
822 | "Unexpected SDTR msg\n"); | 822 | "Unexpected SDTR msg\n"); |
823 | hostdata->msgout[0] = A_REJECT_MSG; | 823 | hostdata->msgout[0] = A_REJECT_MSG; |
824 | dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE); | 824 | dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE); |
825 | script_patch_16(hostdata->script, MessageCount, 1); | 825 | script_patch_16(hostdata->dev, hostdata->script, |
826 | MessageCount, 1); | ||
826 | /* SendMsgOut returns, so set up the return | 827 | /* SendMsgOut returns, so set up the return |
827 | * address */ | 828 | * address */ |
828 | resume_offset = hostdata->pScript + Ent_SendMessageWithATN; | 829 | resume_offset = hostdata->pScript + Ent_SendMessageWithATN; |
@@ -833,8 +834,9 @@ process_extended_message(struct Scsi_Host *host, | |||
833 | printk(KERN_INFO "scsi%d: (%d:%d), Unsolicited WDTR after CMD, Rejecting\n", | 834 | printk(KERN_INFO "scsi%d: (%d:%d), Unsolicited WDTR after CMD, Rejecting\n", |
834 | host->host_no, pun, lun); | 835 | host->host_no, pun, lun); |
835 | hostdata->msgout[0] = A_REJECT_MSG; | 836 | hostdata->msgout[0] = A_REJECT_MSG; |
836 | dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE); | 837 | dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE); |
837 | script_patch_16(hostdata->script, MessageCount, 1); | 838 | script_patch_16(hostdata->dev, hostdata->script, MessageCount, |
839 | 1); | ||
838 | resume_offset = hostdata->pScript + Ent_SendMessageWithATN; | 840 | resume_offset = hostdata->pScript + Ent_SendMessageWithATN; |
839 | 841 | ||
840 | break; | 842 | break; |
@@ -847,8 +849,9 @@ process_extended_message(struct Scsi_Host *host, | |||
847 | printk("\n"); | 849 | printk("\n"); |
848 | /* just reject it */ | 850 | /* just reject it */ |
849 | hostdata->msgout[0] = A_REJECT_MSG; | 851 | hostdata->msgout[0] = A_REJECT_MSG; |
850 | dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE); | 852 | dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE); |
851 | script_patch_16(hostdata->script, MessageCount, 1); | 853 | script_patch_16(hostdata->dev, hostdata->script, MessageCount, |
854 | 1); | ||
852 | /* SendMsgOut returns, so set up the return | 855 | /* SendMsgOut returns, so set up the return |
853 | * address */ | 856 | * address */ |
854 | resume_offset = hostdata->pScript + Ent_SendMessageWithATN; | 857 | resume_offset = hostdata->pScript + Ent_SendMessageWithATN; |
@@ -929,8 +932,9 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata | |||
929 | printk("\n"); | 932 | printk("\n"); |
930 | /* just reject it */ | 933 | /* just reject it */ |
931 | hostdata->msgout[0] = A_REJECT_MSG; | 934 | hostdata->msgout[0] = A_REJECT_MSG; |
932 | dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE); | 935 | dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE); |
933 | script_patch_16(hostdata->script, MessageCount, 1); | 936 | script_patch_16(hostdata->dev, hostdata->script, MessageCount, |
937 | 1); | ||
934 | /* SendMsgOut returns, so set up the return | 938 | /* SendMsgOut returns, so set up the return |
935 | * address */ | 939 | * address */ |
936 | resume_offset = hostdata->pScript + Ent_SendMessageWithATN; | 940 | resume_offset = hostdata->pScript + Ent_SendMessageWithATN; |
@@ -939,7 +943,7 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata | |||
939 | } | 943 | } |
940 | NCR_700_writel(temp, host, TEMP_REG); | 944 | NCR_700_writel(temp, host, TEMP_REG); |
941 | /* set us up to receive another message */ | 945 | /* set us up to receive another message */ |
942 | dma_cache_sync(hostdata->msgin, MSG_ARRAY_SIZE, DMA_FROM_DEVICE); | 946 | dma_cache_sync(hostdata->dev, hostdata->msgin, MSG_ARRAY_SIZE, DMA_FROM_DEVICE); |
943 | return resume_offset; | 947 | return resume_offset; |
944 | } | 948 | } |
945 | 949 | ||
@@ -1019,9 +1023,9 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, | |||
1019 | slot->SG[1].ins = bS_to_host(SCRIPT_RETURN); | 1023 | slot->SG[1].ins = bS_to_host(SCRIPT_RETURN); |
1020 | slot->SG[1].pAddr = 0; | 1024 | slot->SG[1].pAddr = 0; |
1021 | slot->resume_offset = hostdata->pScript; | 1025 | slot->resume_offset = hostdata->pScript; |
1022 | dma_cache_sync(slot->SG, sizeof(slot->SG[0])*2, DMA_TO_DEVICE); | 1026 | dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG[0])*2, DMA_TO_DEVICE); |
1023 | dma_cache_sync(SCp->sense_buffer, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE); | 1027 | dma_cache_sync(hostdata->dev, SCp->sense_buffer, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE); |
1024 | 1028 | ||
1025 | /* queue the command for reissue */ | 1029 | /* queue the command for reissue */ |
1026 | slot->state = NCR_700_SLOT_QUEUED; | 1030 | slot->state = NCR_700_SLOT_QUEUED; |
1027 | slot->flags = NCR_700_FLAG_AUTOSENSE; | 1031 | slot->flags = NCR_700_FLAG_AUTOSENSE; |
@@ -1136,11 +1140,12 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, | |||
1136 | hostdata->cmd = slot->cmnd; | 1140 | hostdata->cmd = slot->cmnd; |
1137 | 1141 | ||
1138 | /* re-patch for this command */ | 1142 | /* re-patch for this command */ |
1139 | script_patch_32_abs(hostdata->script, CommandAddress, | 1143 | script_patch_32_abs(hostdata->dev, hostdata->script, |
1140 | slot->pCmd); | 1144 | CommandAddress, slot->pCmd); |
1141 | script_patch_16(hostdata->script, | 1145 | script_patch_16(hostdata->dev, hostdata->script, |
1142 | CommandCount, slot->cmnd->cmd_len); | 1146 | CommandCount, slot->cmnd->cmd_len); |
1143 | script_patch_32_abs(hostdata->script, SGScriptStartAddress, | 1147 | script_patch_32_abs(hostdata->dev, hostdata->script, |
1148 | SGScriptStartAddress, | ||
1144 | to32bit(&slot->pSG[0].ins)); | 1149 | to32bit(&slot->pSG[0].ins)); |
1145 | 1150 | ||
1146 | /* Note: setting SXFER only works if we're | 1151 | /* Note: setting SXFER only works if we're |
@@ -1150,13 +1155,13 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, | |||
1150 | * should therefore always clear ACK */ | 1155 | * should therefore always clear ACK */ |
1151 | NCR_700_writeb(NCR_700_get_SXFER(hostdata->cmd->device), | 1156 | NCR_700_writeb(NCR_700_get_SXFER(hostdata->cmd->device), |
1152 | host, SXFER_REG); | 1157 | host, SXFER_REG); |
1153 | dma_cache_sync(hostdata->msgin, | 1158 | dma_cache_sync(hostdata->dev, hostdata->msgin, |
1154 | MSG_ARRAY_SIZE, DMA_FROM_DEVICE); | 1159 | MSG_ARRAY_SIZE, DMA_FROM_DEVICE); |
1155 | dma_cache_sync(hostdata->msgout, | 1160 | dma_cache_sync(hostdata->dev, hostdata->msgout, |
1156 | MSG_ARRAY_SIZE, DMA_TO_DEVICE); | 1161 | MSG_ARRAY_SIZE, DMA_TO_DEVICE); |
1157 | /* I'm just being paranoid here, the command should | 1162 | /* I'm just being paranoid here, the command should |
1158 | * already have been flushed from the cache */ | 1163 | * already have been flushed from the cache */ |
1159 | dma_cache_sync(slot->cmnd->cmnd, | 1164 | dma_cache_sync(hostdata->dev, slot->cmnd->cmnd, |
1160 | slot->cmnd->cmd_len, DMA_TO_DEVICE); | 1165 | slot->cmnd->cmd_len, DMA_TO_DEVICE); |
1161 | 1166 | ||
1162 | 1167 | ||
@@ -1220,7 +1225,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, | |||
1220 | hostdata->reselection_id = reselection_id; | 1225 | hostdata->reselection_id = reselection_id; |
1221 | /* just in case we have a stale simple tag message, clear it */ | 1226 | /* just in case we have a stale simple tag message, clear it */ |
1222 | hostdata->msgin[1] = 0; | 1227 | hostdata->msgin[1] = 0; |
1223 | dma_cache_sync(hostdata->msgin, | 1228 | dma_cache_sync(hostdata->dev, hostdata->msgin, |
1224 | MSG_ARRAY_SIZE, DMA_BIDIRECTIONAL); | 1229 | MSG_ARRAY_SIZE, DMA_BIDIRECTIONAL); |
1225 | if(hostdata->tag_negotiated & (1<<reselection_id)) { | 1230 | if(hostdata->tag_negotiated & (1<<reselection_id)) { |
1226 | resume_offset = hostdata->pScript + Ent_GetReselectionWithTag; | 1231 | resume_offset = hostdata->pScript + Ent_GetReselectionWithTag; |
@@ -1336,7 +1341,7 @@ process_selection(struct Scsi_Host *host, __u32 dsp) | |||
1336 | hostdata->cmd = NULL; | 1341 | hostdata->cmd = NULL; |
1337 | /* clear any stale simple tag message */ | 1342 | /* clear any stale simple tag message */ |
1338 | hostdata->msgin[1] = 0; | 1343 | hostdata->msgin[1] = 0; |
1339 | dma_cache_sync(hostdata->msgin, MSG_ARRAY_SIZE, | 1344 | dma_cache_sync(hostdata->dev, hostdata->msgin, MSG_ARRAY_SIZE, |
1340 | DMA_BIDIRECTIONAL); | 1345 | DMA_BIDIRECTIONAL); |
1341 | 1346 | ||
1342 | if(id == 0xff) { | 1347 | if(id == 0xff) { |
@@ -1433,29 +1438,30 @@ NCR_700_start_command(struct scsi_cmnd *SCp) | |||
1433 | NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); | 1438 | NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); |
1434 | } | 1439 | } |
1435 | 1440 | ||
1436 | script_patch_16(hostdata->script, MessageCount, count); | 1441 | script_patch_16(hostdata->dev, hostdata->script, MessageCount, count); |
1437 | 1442 | ||
1438 | 1443 | ||
1439 | script_patch_ID(hostdata->script, | 1444 | script_patch_ID(hostdata->dev, hostdata->script, |
1440 | Device_ID, 1<<scmd_id(SCp)); | 1445 | Device_ID, 1<<scmd_id(SCp)); |
1441 | 1446 | ||
1442 | script_patch_32_abs(hostdata->script, CommandAddress, | 1447 | script_patch_32_abs(hostdata->dev, hostdata->script, CommandAddress, |
1443 | slot->pCmd); | 1448 | slot->pCmd); |
1444 | script_patch_16(hostdata->script, CommandCount, SCp->cmd_len); | 1449 | script_patch_16(hostdata->dev, hostdata->script, CommandCount, |
1450 | SCp->cmd_len); | ||
1445 | /* finally plumb the beginning of the SG list into the script | 1451 | /* finally plumb the beginning of the SG list into the script |
1446 | * */ | 1452 | * */ |
1447 | script_patch_32_abs(hostdata->script, SGScriptStartAddress, | 1453 | script_patch_32_abs(hostdata->dev, hostdata->script, |
1448 | to32bit(&slot->pSG[0].ins)); | 1454 | SGScriptStartAddress, to32bit(&slot->pSG[0].ins)); |
1449 | NCR_700_clear_fifo(SCp->device->host); | 1455 | NCR_700_clear_fifo(SCp->device->host); |
1450 | 1456 | ||
1451 | if(slot->resume_offset == 0) | 1457 | if(slot->resume_offset == 0) |
1452 | slot->resume_offset = hostdata->pScript; | 1458 | slot->resume_offset = hostdata->pScript; |
1453 | /* now perform all the writebacks and invalidates */ | 1459 | /* now perform all the writebacks and invalidates */ |
1454 | dma_cache_sync(hostdata->msgout, count, DMA_TO_DEVICE); | 1460 | dma_cache_sync(hostdata->dev, hostdata->msgout, count, DMA_TO_DEVICE); |
1455 | dma_cache_sync(hostdata->msgin, MSG_ARRAY_SIZE, | 1461 | dma_cache_sync(hostdata->dev, hostdata->msgin, MSG_ARRAY_SIZE, |
1456 | DMA_FROM_DEVICE); | 1462 | DMA_FROM_DEVICE); |
1457 | dma_cache_sync(SCp->cmnd, SCp->cmd_len, DMA_TO_DEVICE); | 1463 | dma_cache_sync(hostdata->dev, SCp->cmnd, SCp->cmd_len, DMA_TO_DEVICE); |
1458 | dma_cache_sync(hostdata->status, 1, DMA_FROM_DEVICE); | 1464 | dma_cache_sync(hostdata->dev, hostdata->status, 1, DMA_FROM_DEVICE); |
1459 | 1465 | ||
1460 | /* set the synchronous period/offset */ | 1466 | /* set the synchronous period/offset */ |
1461 | NCR_700_writeb(NCR_700_get_SXFER(SCp->device), | 1467 | NCR_700_writeb(NCR_700_get_SXFER(SCp->device), |
@@ -1631,7 +1637,7 @@ NCR_700_intr(int irq, void *dev_id) | |||
1631 | slot->SG[i].ins = bS_to_host(SCRIPT_NOP); | 1637 | slot->SG[i].ins = bS_to_host(SCRIPT_NOP); |
1632 | slot->SG[i].pAddr = 0; | 1638 | slot->SG[i].pAddr = 0; |
1633 | } | 1639 | } |
1634 | dma_cache_sync(slot->SG, sizeof(slot->SG), DMA_TO_DEVICE); | 1640 | dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG), DMA_TO_DEVICE); |
1635 | /* and pretend we disconnected after | 1641 | /* and pretend we disconnected after |
1636 | * the command phase */ | 1642 | * the command phase */ |
1637 | resume_offset = hostdata->pScript + Ent_MsgInDuringData; | 1643 | resume_offset = hostdata->pScript + Ent_MsgInDuringData; |
@@ -1897,9 +1903,9 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) | |||
1897 | } | 1903 | } |
1898 | slot->SG[i].ins = bS_to_host(SCRIPT_RETURN); | 1904 | slot->SG[i].ins = bS_to_host(SCRIPT_RETURN); |
1899 | slot->SG[i].pAddr = 0; | 1905 | slot->SG[i].pAddr = 0; |
1900 | dma_cache_sync(slot->SG, sizeof(slot->SG), DMA_TO_DEVICE); | 1906 | dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG), DMA_TO_DEVICE); |
1901 | DEBUG((" SETTING %08lx to %x\n", | 1907 | DEBUG((" SETTING %08lx to %x\n", |
1902 | (&slot->pSG[i].ins), | 1908 | (&slot->pSG[i].ins), |
1903 | slot->SG[i].ins)); | 1909 | slot->SG[i].ins)); |
1904 | } | 1910 | } |
1905 | slot->resume_offset = 0; | 1911 | slot->resume_offset = 0; |
diff --git a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h index f5c3caf344a7..f38822db4210 100644 --- a/drivers/scsi/53c700.h +++ b/drivers/scsi/53c700.h | |||
@@ -415,31 +415,31 @@ struct NCR_700_Host_Parameters { | |||
415 | #define NCR_710_MIN_XFERP 0 | 415 | #define NCR_710_MIN_XFERP 0 |
416 | #define NCR_700_MIN_PERIOD 25 /* for SDTR message, 100ns */ | 416 | #define NCR_700_MIN_PERIOD 25 /* for SDTR message, 100ns */ |
417 | 417 | ||
418 | #define script_patch_32(script, symbol, value) \ | 418 | #define script_patch_32(dev, script, symbol, value) \ |
419 | { \ | 419 | { \ |
420 | int i; \ | 420 | int i; \ |
421 | for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \ | 421 | for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \ |
422 | __u32 val = bS_to_cpu((script)[A_##symbol##_used[i]]) + value; \ | 422 | __u32 val = bS_to_cpu((script)[A_##symbol##_used[i]]) + value; \ |
423 | (script)[A_##symbol##_used[i]] = bS_to_host(val); \ | 423 | (script)[A_##symbol##_used[i]] = bS_to_host(val); \ |
424 | dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ | 424 | dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ |
425 | DEBUG((" script, patching %s at %d to 0x%lx\n", \ | 425 | DEBUG((" script, patching %s at %d to 0x%lx\n", \ |
426 | #symbol, A_##symbol##_used[i], (value))); \ | 426 | #symbol, A_##symbol##_used[i], (value))); \ |
427 | } \ | 427 | } \ |
428 | } | 428 | } |
429 | 429 | ||
430 | #define script_patch_32_abs(script, symbol, value) \ | 430 | #define script_patch_32_abs(dev, script, symbol, value) \ |
431 | { \ | 431 | { \ |
432 | int i; \ | 432 | int i; \ |
433 | for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \ | 433 | for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \ |
434 | (script)[A_##symbol##_used[i]] = bS_to_host(value); \ | 434 | (script)[A_##symbol##_used[i]] = bS_to_host(value); \ |
435 | dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ | 435 | dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ |
436 | DEBUG((" script, patching %s at %d to 0x%lx\n", \ | 436 | DEBUG((" script, patching %s at %d to 0x%lx\n", \ |
437 | #symbol, A_##symbol##_used[i], (value))); \ | 437 | #symbol, A_##symbol##_used[i], (value))); \ |
438 | } \ | 438 | } \ |
439 | } | 439 | } |
440 | 440 | ||
441 | /* Used for patching the SCSI ID in the SELECT instruction */ | 441 | /* Used for patching the SCSI ID in the SELECT instruction */ |
442 | #define script_patch_ID(script, symbol, value) \ | 442 | #define script_patch_ID(dev, script, symbol, value) \ |
443 | { \ | 443 | { \ |
444 | int i; \ | 444 | int i; \ |
445 | for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \ | 445 | for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \ |
@@ -447,13 +447,13 @@ struct NCR_700_Host_Parameters { | |||
447 | val &= 0xff00ffff; \ | 447 | val &= 0xff00ffff; \ |
448 | val |= ((value) & 0xff) << 16; \ | 448 | val |= ((value) & 0xff) << 16; \ |
449 | (script)[A_##symbol##_used[i]] = bS_to_host(val); \ | 449 | (script)[A_##symbol##_used[i]] = bS_to_host(val); \ |
450 | dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ | 450 | dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ |
451 | DEBUG((" script, patching ID field %s at %d to 0x%x\n", \ | 451 | DEBUG((" script, patching ID field %s at %d to 0x%x\n", \ |
452 | #symbol, A_##symbol##_used[i], val)); \ | 452 | #symbol, A_##symbol##_used[i], val)); \ |
453 | } \ | 453 | } \ |
454 | } | 454 | } |
455 | 455 | ||
456 | #define script_patch_16(script, symbol, value) \ | 456 | #define script_patch_16(dev, script, symbol, value) \ |
457 | { \ | 457 | { \ |
458 | int i; \ | 458 | int i; \ |
459 | for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \ | 459 | for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \ |
@@ -461,7 +461,7 @@ struct NCR_700_Host_Parameters { | |||
461 | val &= 0xffff0000; \ | 461 | val &= 0xffff0000; \ |
462 | val |= ((value) & 0xffff); \ | 462 | val |= ((value) & 0xffff); \ |
463 | (script)[A_##symbol##_used[i]] = bS_to_host(val); \ | 463 | (script)[A_##symbol##_used[i]] = bS_to_host(val); \ |
464 | dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ | 464 | dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ |
465 | DEBUG((" script, patching short field %s at %d to 0x%x\n", \ | 465 | DEBUG((" script, patching short field %s at %d to 0x%x\n", \ |
466 | #symbol, A_##symbol##_used[i], val)); \ | 466 | #symbol, A_##symbol##_used[i], val)); \ |
467 | } \ | 467 | } \ |
diff --git a/drivers/scsi/aic94xx/aic94xx.h b/drivers/scsi/aic94xx/aic94xx.h index 71a031df7a34..32f513b1b78a 100644 --- a/drivers/scsi/aic94xx/aic94xx.h +++ b/drivers/scsi/aic94xx/aic94xx.h | |||
@@ -56,8 +56,8 @@ | |||
56 | /* 2*ITNL timeout + 1 second */ | 56 | /* 2*ITNL timeout + 1 second */ |
57 | #define AIC94XX_SCB_TIMEOUT (5*HZ) | 57 | #define AIC94XX_SCB_TIMEOUT (5*HZ) |
58 | 58 | ||
59 | extern kmem_cache_t *asd_dma_token_cache; | 59 | extern struct kmem_cache *asd_dma_token_cache; |
60 | extern kmem_cache_t *asd_ascb_cache; | 60 | extern struct kmem_cache *asd_ascb_cache; |
61 | extern char sas_addr_str[2*SAS_ADDR_SIZE + 1]; | 61 | extern char sas_addr_str[2*SAS_ADDR_SIZE + 1]; |
62 | 62 | ||
63 | static inline void asd_stringify_sas_addr(char *p, const u8 *sas_addr) | 63 | static inline void asd_stringify_sas_addr(char *p, const u8 *sas_addr) |
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c index af7e01134364..da94e126ca83 100644 --- a/drivers/scsi/aic94xx/aic94xx_hwi.c +++ b/drivers/scsi/aic94xx/aic94xx_hwi.c | |||
@@ -1047,7 +1047,7 @@ irqreturn_t asd_hw_isr(int irq, void *dev_id) | |||
1047 | static inline struct asd_ascb *asd_ascb_alloc(struct asd_ha_struct *asd_ha, | 1047 | static inline struct asd_ascb *asd_ascb_alloc(struct asd_ha_struct *asd_ha, |
1048 | gfp_t gfp_flags) | 1048 | gfp_t gfp_flags) |
1049 | { | 1049 | { |
1050 | extern kmem_cache_t *asd_ascb_cache; | 1050 | extern struct kmem_cache *asd_ascb_cache; |
1051 | struct asd_seq_data *seq = &asd_ha->seq; | 1051 | struct asd_seq_data *seq = &asd_ha->seq; |
1052 | struct asd_ascb *ascb; | 1052 | struct asd_ascb *ascb; |
1053 | unsigned long flags; | 1053 | unsigned long flags; |
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index 42302ef05ee5..fbc82b00a418 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c | |||
@@ -450,8 +450,8 @@ static inline void asd_destroy_ha_caches(struct asd_ha_struct *asd_ha) | |||
450 | asd_ha->scb_pool = NULL; | 450 | asd_ha->scb_pool = NULL; |
451 | } | 451 | } |
452 | 452 | ||
453 | kmem_cache_t *asd_dma_token_cache; | 453 | struct kmem_cache *asd_dma_token_cache; |
454 | kmem_cache_t *asd_ascb_cache; | 454 | struct kmem_cache *asd_ascb_cache; |
455 | 455 | ||
456 | static int asd_create_global_caches(void) | 456 | static int asd_create_global_caches(void) |
457 | { | 457 | { |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 1427a41e8441..8f6b5bf580f6 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -110,6 +110,7 @@ typedef struct ide_scsi_obj { | |||
110 | } idescsi_scsi_t; | 110 | } idescsi_scsi_t; |
111 | 111 | ||
112 | static DEFINE_MUTEX(idescsi_ref_mutex); | 112 | static DEFINE_MUTEX(idescsi_ref_mutex); |
113 | static int idescsi_nocd; /* Set by module param to skip cd */ | ||
113 | 114 | ||
114 | #define ide_scsi_g(disk) \ | 115 | #define ide_scsi_g(disk) \ |
115 | container_of((disk)->private_data, struct ide_scsi_obj, driver) | 116 | container_of((disk)->private_data, struct ide_scsi_obj, driver) |
@@ -1127,6 +1128,9 @@ static int ide_scsi_probe(ide_drive_t *drive) | |||
1127 | warned = 1; | 1128 | warned = 1; |
1128 | } | 1129 | } |
1129 | 1130 | ||
1131 | if (idescsi_nocd && drive->media == ide_cdrom) | ||
1132 | return -ENODEV; | ||
1133 | |||
1130 | if (!strstr("ide-scsi", drive->driver_req) || | 1134 | if (!strstr("ide-scsi", drive->driver_req) || |
1131 | !drive->present || | 1135 | !drive->present || |
1132 | drive->media == ide_disk || | 1136 | drive->media == ide_disk || |
@@ -1187,6 +1191,8 @@ static void __exit exit_idescsi_module(void) | |||
1187 | driver_unregister(&idescsi_driver.gen_driver); | 1191 | driver_unregister(&idescsi_driver.gen_driver); |
1188 | } | 1192 | } |
1189 | 1193 | ||
1194 | module_param(idescsi_nocd, int, 0600); | ||
1195 | MODULE_PARM_DESC(idescsi_nocd, "Disable handling of CD-ROMs so they may be driven by ide-cd"); | ||
1190 | module_init(init_idescsi_module); | 1196 | module_init(init_idescsi_module); |
1191 | module_exit(exit_idescsi_module); | 1197 | module_exit(exit_idescsi_module); |
1192 | MODULE_LICENSE("GPL"); | 1198 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index ccd4dafce8e2..b318500785e5 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -6940,7 +6940,7 @@ static int __devinit ipr_alloc_cmd_blks(struct ipr_ioa_cfg *ioa_cfg) | |||
6940 | return -ENOMEM; | 6940 | return -ENOMEM; |
6941 | 6941 | ||
6942 | for (i = 0; i < IPR_NUM_CMD_BLKS; i++) { | 6942 | for (i = 0; i < IPR_NUM_CMD_BLKS; i++) { |
6943 | ipr_cmd = pci_pool_alloc (ioa_cfg->ipr_cmd_pool, SLAB_KERNEL, &dma_addr); | 6943 | ipr_cmd = pci_pool_alloc (ioa_cfg->ipr_cmd_pool, GFP_KERNEL, &dma_addr); |
6944 | 6944 | ||
6945 | if (!ipr_cmd) { | 6945 | if (!ipr_cmd) { |
6946 | ipr_free_cmd_blks(ioa_cfg); | 6946 | ipr_free_cmd_blks(ioa_cfg); |
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index d65bc4e0f214..2f0c07fc3f48 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #include "../scsi_sas_internal.h" | 37 | #include "../scsi_sas_internal.h" |
38 | 38 | ||
39 | kmem_cache_t *sas_task_cache; | 39 | struct kmem_cache *sas_task_cache; |
40 | 40 | ||
41 | /*------------ SAS addr hash -----------*/ | 41 | /*------------ SAS addr hash -----------*/ |
42 | void sas_hash_addr(u8 *hashed, const u8 *sas_addr) | 42 | void sas_hash_addr(u8 *hashed, const u8 *sas_addr) |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index cbe0cad83b68..d03523d3bf38 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -24,7 +24,7 @@ char qla2x00_version_str[40]; | |||
24 | /* | 24 | /* |
25 | * SRB allocation cache | 25 | * SRB allocation cache |
26 | */ | 26 | */ |
27 | static kmem_cache_t *srb_cachep; | 27 | static struct kmem_cache *srb_cachep; |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * Ioctl related information. | 30 | * Ioctl related information. |
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 969c9e431028..9ef693c8809a 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -19,7 +19,7 @@ char qla4xxx_version_str[40]; | |||
19 | /* | 19 | /* |
20 | * SRB allocation cache | 20 | * SRB allocation cache |
21 | */ | 21 | */ |
22 | static kmem_cache_t *srb_cachep; | 22 | static struct kmem_cache *srb_cachep; |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * Module parameter information and variables | 25 | * Module parameter information and variables |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index fafc00deaade..24cffd98ee63 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -136,7 +136,7 @@ const char * scsi_device_type(unsigned type) | |||
136 | EXPORT_SYMBOL(scsi_device_type); | 136 | EXPORT_SYMBOL(scsi_device_type); |
137 | 137 | ||
138 | struct scsi_host_cmd_pool { | 138 | struct scsi_host_cmd_pool { |
139 | kmem_cache_t *slab; | 139 | struct kmem_cache *slab; |
140 | unsigned int users; | 140 | unsigned int users; |
141 | char *name; | 141 | char *name; |
142 | unsigned int slab_flags; | 142 | unsigned int slab_flags; |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index fb616c69151f..1748e27501cd 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -36,7 +36,7 @@ | |||
36 | struct scsi_host_sg_pool { | 36 | struct scsi_host_sg_pool { |
37 | size_t size; | 37 | size_t size; |
38 | char *name; | 38 | char *name; |
39 | kmem_cache_t *slab; | 39 | struct kmem_cache *slab; |
40 | mempool_t *pool; | 40 | mempool_t *pool; |
41 | }; | 41 | }; |
42 | 42 | ||
@@ -241,7 +241,7 @@ struct scsi_io_context { | |||
241 | char sense[SCSI_SENSE_BUFFERSIZE]; | 241 | char sense[SCSI_SENSE_BUFFERSIZE]; |
242 | }; | 242 | }; |
243 | 243 | ||
244 | static kmem_cache_t *scsi_io_context_cache; | 244 | static struct kmem_cache *scsi_io_context_cache; |
245 | 245 | ||
246 | static void scsi_end_async(struct request *req, int uptodate) | 246 | static void scsi_end_async(struct request *req, int uptodate) |
247 | { | 247 | { |
diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c index 386dbae17b44..d402aff5f314 100644 --- a/drivers/scsi/scsi_tgt_lib.c +++ b/drivers/scsi/scsi_tgt_lib.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include "scsi_tgt_priv.h" | 33 | #include "scsi_tgt_priv.h" |
34 | 34 | ||
35 | static struct workqueue_struct *scsi_tgtd; | 35 | static struct workqueue_struct *scsi_tgtd; |
36 | static kmem_cache_t *scsi_tgt_cmd_cache; | 36 | static struct kmem_cache *scsi_tgt_cmd_cache; |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * TODO: this struct will be killed when the block layer supports large bios | 39 | * TODO: this struct will be killed when the block layer supports large bios |
diff --git a/drivers/serial/8250_exar_st16c554.c b/drivers/serial/8250_exar_st16c554.c new file mode 100644 index 000000000000..567143ace159 --- /dev/null +++ b/drivers/serial/8250_exar_st16c554.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * linux/drivers/serial/8250_exar.c | ||
3 | * | ||
4 | * Written by Paul B Schroeder < pschroeder "at" uplogix "dot" com > | ||
5 | * Based on 8250_boca. | ||
6 | * | ||
7 | * Copyright (C) 2005 Russell King. | ||
8 | * Data taken from include/asm-i386/serial.h | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/serial_8250.h> | ||
17 | |||
18 | #define PORT(_base,_irq) \ | ||
19 | { \ | ||
20 | .iobase = _base, \ | ||
21 | .irq = _irq, \ | ||
22 | .uartclk = 1843200, \ | ||
23 | .iotype = UPIO_PORT, \ | ||
24 | .flags = UPF_BOOT_AUTOCONF, \ | ||
25 | } | ||
26 | |||
27 | static struct plat_serial8250_port exar_data[] = { | ||
28 | PORT(0x100, 5), | ||
29 | PORT(0x108, 5), | ||
30 | PORT(0x110, 5), | ||
31 | PORT(0x118, 5), | ||
32 | { }, | ||
33 | }; | ||
34 | |||
35 | static struct platform_device exar_device = { | ||
36 | .name = "serial8250", | ||
37 | .id = PLAT8250_DEV_EXAR_ST16C554, | ||
38 | .dev = { | ||
39 | .platform_data = exar_data, | ||
40 | }, | ||
41 | }; | ||
42 | |||
43 | static int __init exar_init(void) | ||
44 | { | ||
45 | return platform_device_register(&exar_device); | ||
46 | } | ||
47 | |||
48 | module_init(exar_init); | ||
49 | |||
50 | MODULE_AUTHOR("Paul B Schroeder"); | ||
51 | MODULE_DESCRIPTION("8250 serial probe module for Exar cards"); | ||
52 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index 71d907c8288b..d3d6b82706b5 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
@@ -464,11 +464,38 @@ static void __devexit serial_pnp_remove(struct pnp_dev *dev) | |||
464 | serial8250_unregister_port(line - 1); | 464 | serial8250_unregister_port(line - 1); |
465 | } | 465 | } |
466 | 466 | ||
467 | #ifdef CONFIG_PM | ||
468 | static int serial_pnp_suspend(struct pnp_dev *dev, pm_message_t state) | ||
469 | { | ||
470 | long line = (long)pnp_get_drvdata(dev); | ||
471 | |||
472 | if (!line) | ||
473 | return -ENODEV; | ||
474 | serial8250_suspend_port(line - 1); | ||
475 | return 0; | ||
476 | } | ||
477 | |||
478 | static int serial_pnp_resume(struct pnp_dev *dev) | ||
479 | { | ||
480 | long line = (long)pnp_get_drvdata(dev); | ||
481 | |||
482 | if (!line) | ||
483 | return -ENODEV; | ||
484 | serial8250_resume_port(line - 1); | ||
485 | return 0; | ||
486 | } | ||
487 | #else | ||
488 | #define serial_pnp_suspend NULL | ||
489 | #define serial_pnp_resume NULL | ||
490 | #endif /* CONFIG_PM */ | ||
491 | |||
467 | static struct pnp_driver serial_pnp_driver = { | 492 | static struct pnp_driver serial_pnp_driver = { |
468 | .name = "serial", | 493 | .name = "serial", |
469 | .id_table = pnp_dev_table, | ||
470 | .probe = serial_pnp_probe, | 494 | .probe = serial_pnp_probe, |
471 | .remove = __devexit_p(serial_pnp_remove), | 495 | .remove = __devexit_p(serial_pnp_remove), |
496 | .suspend = serial_pnp_suspend, | ||
497 | .resume = serial_pnp_resume, | ||
498 | .id_table = pnp_dev_table, | ||
472 | }; | 499 | }; |
473 | 500 | ||
474 | static int __init serial8250_pnp_init(void) | 501 | static int __init serial8250_pnp_init(void) |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 0b71e7d18903..fc12d5df10e2 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -210,6 +210,17 @@ config SERIAL_8250_BOCA | |||
210 | To compile this driver as a module, choose M here: the module | 210 | To compile this driver as a module, choose M here: the module |
211 | will be called 8250_boca. | 211 | will be called 8250_boca. |
212 | 212 | ||
213 | config SERIAL_8250_EXAR_ST16C554 | ||
214 | tristate "Support Exar ST16C554/554D Quad UART" | ||
215 | depends on SERIAL_8250 != n && ISA && SERIAL_8250_MANY_PORTS | ||
216 | help | ||
217 | The Uplogix Envoy TU301 uses this Exar Quad UART. If you are | ||
218 | tinkering with your Envoy TU301, or have a machine with this UART, | ||
219 | say Y here. | ||
220 | |||
221 | To compile this driver as a module, choose M here: the module | ||
222 | will be called 8250_exar_st16c554. | ||
223 | |||
213 | config SERIAL_8250_HUB6 | 224 | config SERIAL_8250_HUB6 |
214 | tristate "Support Hub6 cards" | 225 | tristate "Support Hub6 cards" |
215 | depends on SERIAL_8250 != n && ISA && SERIAL_8250_MANY_PORTS | 226 | depends on SERIAL_8250 != n && ISA && SERIAL_8250_MANY_PORTS |
@@ -511,6 +522,25 @@ config SERIAL_IMX_CONSOLE | |||
511 | your boot loader (lilo or loadlin) about how to pass options to the | 522 | your boot loader (lilo or loadlin) about how to pass options to the |
512 | kernel at boot time.) | 523 | kernel at boot time.) |
513 | 524 | ||
525 | config SERIAL_UARTLITE | ||
526 | tristate "Xilinx uartlite serial port support" | ||
527 | depends on PPC32 | ||
528 | select SERIAL_CORE | ||
529 | help | ||
530 | Say Y here if you want to use the Xilinx uartlite serial controller. | ||
531 | |||
532 | To compile this driver as a module, choose M here: the | ||
533 | module will be called uartlite.ko. | ||
534 | |||
535 | config SERIAL_UARTLITE_CONSOLE | ||
536 | bool "Support for console on Xilinx uartlite serial port" | ||
537 | depends on SERIAL_UARTLITE=y | ||
538 | select SERIAL_CORE_CONSOLE | ||
539 | help | ||
540 | Say Y here if you wish to use a Xilinx uartlite as the system | ||
541 | console (the system console is the device which receives all kernel | ||
542 | messages and warnings and which allows logins in single user mode). | ||
543 | |||
514 | config SERIAL_SUNCORE | 544 | config SERIAL_SUNCORE |
515 | bool | 545 | bool |
516 | depends on SPARC | 546 | depends on SPARC |
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index b4d8a7c182e3..df3632cd7df9 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile | |||
@@ -17,6 +17,7 @@ obj-$(CONFIG_SERIAL_8250_CONSOLE) += 8250_early.o | |||
17 | obj-$(CONFIG_SERIAL_8250_FOURPORT) += 8250_fourport.o | 17 | obj-$(CONFIG_SERIAL_8250_FOURPORT) += 8250_fourport.o |
18 | obj-$(CONFIG_SERIAL_8250_ACCENT) += 8250_accent.o | 18 | obj-$(CONFIG_SERIAL_8250_ACCENT) += 8250_accent.o |
19 | obj-$(CONFIG_SERIAL_8250_BOCA) += 8250_boca.o | 19 | obj-$(CONFIG_SERIAL_8250_BOCA) += 8250_boca.o |
20 | obj-$(CONFIG_SERIAL_8250_EXAR_ST16C554) += 8250_exar_st16c554.o | ||
20 | obj-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o | 21 | obj-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o |
21 | obj-$(CONFIG_SERIAL_8250_MCA) += 8250_mca.o | 22 | obj-$(CONFIG_SERIAL_8250_MCA) += 8250_mca.o |
22 | obj-$(CONFIG_SERIAL_8250_AU1X00) += 8250_au1x00.o | 23 | obj-$(CONFIG_SERIAL_8250_AU1X00) += 8250_au1x00.o |
@@ -55,4 +56,5 @@ obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o | |||
55 | obj-$(CONFIG_SERIAL_SGI_IOC4) += ioc4_serial.o | 56 | obj-$(CONFIG_SERIAL_SGI_IOC4) += ioc4_serial.o |
56 | obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o | 57 | obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o |
57 | obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o | 58 | obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o |
59 | obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o | ||
58 | obj-$(CONFIG_SERIAL_NETX) += netx-serial.o | 60 | obj-$(CONFIG_SERIAL_NETX) += netx-serial.o |
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c index 4213fabc62bf..4d3626ef4643 100644 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c | |||
@@ -129,6 +129,8 @@ static void pl010_rx_chars(struct uart_port *port) | |||
129 | */ | 129 | */ |
130 | rsr = readb(port->membase + UART01x_RSR) | UART_DUMMY_RSR_RX; | 130 | rsr = readb(port->membase + UART01x_RSR) | UART_DUMMY_RSR_RX; |
131 | if (unlikely(rsr & UART01x_RSR_ANY)) { | 131 | if (unlikely(rsr & UART01x_RSR_ANY)) { |
132 | writel(0, port->membase + UART01x_ECR); | ||
133 | |||
132 | if (rsr & UART01x_RSR_BE) { | 134 | if (rsr & UART01x_RSR_BE) { |
133 | rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); | 135 | rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); |
134 | port->icount.brk++; | 136 | port->icount.brk++; |
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c index 53662b33b841..af1544f3356f 100644 --- a/drivers/serial/dz.c +++ b/drivers/serial/dz.c | |||
@@ -1,11 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * dz.c: Serial port driver for DECStations equiped | 2 | * dz.c: Serial port driver for DECstations equipped |
3 | * with the DZ chipset. | 3 | * with the DZ chipset. |
4 | * | 4 | * |
5 | * Copyright (C) 1998 Olivier A. D. Lebaillif | 5 | * Copyright (C) 1998 Olivier A. D. Lebaillif |
6 | * | 6 | * |
7 | * Email: olivier.lebaillif@ifrsys.com | 7 | * Email: olivier.lebaillif@ifrsys.com |
8 | * | 8 | * |
9 | * Copyright (C) 2004, 2006 Maciej W. Rozycki | ||
10 | * | ||
9 | * [31-AUG-98] triemer | 11 | * [31-AUG-98] triemer |
10 | * Changed IRQ to use Harald's dec internals interrupts.h | 12 | * Changed IRQ to use Harald's dec internals interrupts.h |
11 | * removed base_addr code - moving address assignment to setup.c | 13 | * removed base_addr code - moving address assignment to setup.c |
@@ -26,10 +28,16 @@ | |||
26 | 28 | ||
27 | #undef DEBUG_DZ | 29 | #undef DEBUG_DZ |
28 | 30 | ||
31 | #if defined(CONFIG_SERIAL_DZ_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | ||
32 | #define SUPPORT_SYSRQ | ||
33 | #endif | ||
34 | |||
35 | #include <linux/delay.h> | ||
29 | #include <linux/module.h> | 36 | #include <linux/module.h> |
30 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
31 | #include <linux/init.h> | 38 | #include <linux/init.h> |
32 | #include <linux/console.h> | 39 | #include <linux/console.h> |
40 | #include <linux/sysrq.h> | ||
33 | #include <linux/tty.h> | 41 | #include <linux/tty.h> |
34 | #include <linux/tty_flip.h> | 42 | #include <linux/tty_flip.h> |
35 | #include <linux/serial_core.h> | 43 | #include <linux/serial_core.h> |
@@ -45,14 +53,10 @@ | |||
45 | #include <asm/system.h> | 53 | #include <asm/system.h> |
46 | #include <asm/uaccess.h> | 54 | #include <asm/uaccess.h> |
47 | 55 | ||
48 | #define CONSOLE_LINE (3) /* for definition of struct console */ | ||
49 | |||
50 | #include "dz.h" | 56 | #include "dz.h" |
51 | 57 | ||
52 | #define DZ_INTR_DEBUG 1 | ||
53 | |||
54 | static char *dz_name = "DECstation DZ serial driver version "; | 58 | static char *dz_name = "DECstation DZ serial driver version "; |
55 | static char *dz_version = "1.02"; | 59 | static char *dz_version = "1.03"; |
56 | 60 | ||
57 | struct dz_port { | 61 | struct dz_port { |
58 | struct uart_port port; | 62 | struct uart_port port; |
@@ -61,22 +65,6 @@ struct dz_port { | |||
61 | 65 | ||
62 | static struct dz_port dz_ports[DZ_NB_PORT]; | 66 | static struct dz_port dz_ports[DZ_NB_PORT]; |
63 | 67 | ||
64 | #ifdef DEBUG_DZ | ||
65 | /* | ||
66 | * debugging code to send out chars via prom | ||
67 | */ | ||
68 | static void debug_console(const char *s, int count) | ||
69 | { | ||
70 | unsigned i; | ||
71 | |||
72 | for (i = 0; i < count; i++) { | ||
73 | if (*s == 10) | ||
74 | prom_printf("%c", 13); | ||
75 | prom_printf("%c", *s++); | ||
76 | } | ||
77 | } | ||
78 | #endif | ||
79 | |||
80 | /* | 68 | /* |
81 | * ------------------------------------------------------------ | 69 | * ------------------------------------------------------------ |
82 | * dz_in () and dz_out () | 70 | * dz_in () and dz_out () |
@@ -90,6 +78,7 @@ static inline unsigned short dz_in(struct dz_port *dport, unsigned offset) | |||
90 | { | 78 | { |
91 | volatile unsigned short *addr = | 79 | volatile unsigned short *addr = |
92 | (volatile unsigned short *) (dport->port.membase + offset); | 80 | (volatile unsigned short *) (dport->port.membase + offset); |
81 | |||
93 | return *addr; | 82 | return *addr; |
94 | } | 83 | } |
95 | 84 | ||
@@ -98,6 +87,7 @@ static inline void dz_out(struct dz_port *dport, unsigned offset, | |||
98 | { | 87 | { |
99 | volatile unsigned short *addr = | 88 | volatile unsigned short *addr = |
100 | (volatile unsigned short *) (dport->port.membase + offset); | 89 | (volatile unsigned short *) (dport->port.membase + offset); |
90 | |||
101 | *addr = value; | 91 | *addr = value; |
102 | } | 92 | } |
103 | 93 | ||
@@ -144,7 +134,7 @@ static void dz_stop_rx(struct uart_port *uport) | |||
144 | 134 | ||
145 | spin_lock_irqsave(&dport->port.lock, flags); | 135 | spin_lock_irqsave(&dport->port.lock, flags); |
146 | dport->cflag &= ~DZ_CREAD; | 136 | dport->cflag &= ~DZ_CREAD; |
147 | dz_out(dport, DZ_LPR, dport->cflag); | 137 | dz_out(dport, DZ_LPR, dport->cflag | dport->port.line); |
148 | spin_unlock_irqrestore(&dport->port.lock, flags); | 138 | spin_unlock_irqrestore(&dport->port.lock, flags); |
149 | } | 139 | } |
150 | 140 | ||
@@ -155,14 +145,14 @@ static void dz_enable_ms(struct uart_port *port) | |||
155 | 145 | ||
156 | /* | 146 | /* |
157 | * ------------------------------------------------------------ | 147 | * ------------------------------------------------------------ |
158 | * Here starts the interrupt handling routines. All of the | ||
159 | * following subroutines are declared as inline and are folded | ||
160 | * into dz_interrupt. They were separated out for readability's | ||
161 | * sake. | ||
162 | * | 148 | * |
163 | * Note: rs_interrupt() is a "fast" interrupt, which means that it | 149 | * Here start the interrupt handling routines. All of the following |
150 | * subroutines are declared as inline and are folded into | ||
151 | * dz_interrupt. They were separated out for readability's sake. | ||
152 | * | ||
153 | * Note: dz_interrupt() is a "fast" interrupt, which means that it | ||
164 | * runs with interrupts turned off. People who may want to modify | 154 | * runs with interrupts turned off. People who may want to modify |
165 | * rs_interrupt() should try to keep the interrupt handler as fast as | 155 | * dz_interrupt() should try to keep the interrupt handler as fast as |
166 | * possible. After you are done making modifications, it is not a bad | 156 | * possible. After you are done making modifications, it is not a bad |
167 | * idea to do: | 157 | * idea to do: |
168 | * | 158 | * |
@@ -180,92 +170,74 @@ static void dz_enable_ms(struct uart_port *port) | |||
180 | * This routine deals with inputs from any lines. | 170 | * This routine deals with inputs from any lines. |
181 | * ------------------------------------------------------------ | 171 | * ------------------------------------------------------------ |
182 | */ | 172 | */ |
183 | static inline void dz_receive_chars(struct dz_port *dport) | 173 | static inline void dz_receive_chars(struct dz_port *dport_in, |
174 | struct pt_regs *regs) | ||
184 | { | 175 | { |
176 | struct dz_port *dport; | ||
185 | struct tty_struct *tty = NULL; | 177 | struct tty_struct *tty = NULL; |
186 | struct uart_icount *icount; | 178 | struct uart_icount *icount; |
187 | int ignore = 0; | 179 | int lines_rx[DZ_NB_PORT] = { [0 ... DZ_NB_PORT - 1] = 0 }; |
188 | unsigned short status, tmp; | 180 | unsigned short status; |
189 | unsigned char ch, flag; | 181 | unsigned char ch, flag; |
182 | int i; | ||
190 | 183 | ||
191 | /* this code is going to be a problem... | 184 | while ((status = dz_in(dport_in, DZ_RBUF)) & DZ_DVAL) { |
192 | the call to tty_flip_buffer is going to need | 185 | dport = &dz_ports[LINE(status)]; |
193 | to be rethought... | 186 | tty = dport->port.info->tty; /* point to the proper dev */ |
194 | */ | ||
195 | do { | ||
196 | status = dz_in(dport, DZ_RBUF); | ||
197 | |||
198 | /* punt so we don't get duplicate characters */ | ||
199 | if (!(status & DZ_DVAL)) | ||
200 | goto ignore_char; | ||
201 | |||
202 | |||
203 | ch = UCHAR(status); /* grab the char */ | ||
204 | flag = TTY_NORMAL; | ||
205 | 187 | ||
206 | #if 0 | 188 | ch = UCHAR(status); /* grab the char */ |
207 | if (info->is_console) { | ||
208 | if (ch == 0) | ||
209 | return; /* it's a break ... */ | ||
210 | } | ||
211 | #endif | ||
212 | 189 | ||
213 | tty = dport->port.info->tty;/* now tty points to the proper dev */ | ||
214 | icount = &dport->port.icount; | 190 | icount = &dport->port.icount; |
215 | |||
216 | if (!tty) | ||
217 | break; | ||
218 | |||
219 | icount->rx++; | 191 | icount->rx++; |
220 | 192 | ||
221 | /* keep track of the statistics */ | 193 | flag = TTY_NORMAL; |
222 | if (status & (DZ_OERR | DZ_FERR | DZ_PERR)) { | 194 | if (status & DZ_FERR) { /* frame error */ |
223 | if (status & DZ_PERR) /* parity error */ | 195 | /* |
224 | icount->parity++; | 196 | * There is no separate BREAK status bit, so |
225 | else if (status & DZ_FERR) /* frame error */ | 197 | * treat framing errors as BREAKs for Magic SysRq |
226 | icount->frame++; | 198 | * and SAK; normally, otherwise. |
227 | if (status & DZ_OERR) /* overrun error */ | ||
228 | icount->overrun++; | ||
229 | |||
230 | /* check to see if we should ignore the character | ||
231 | and mask off conditions that should be ignored | ||
232 | */ | 199 | */ |
233 | 200 | if (uart_handle_break(&dport->port)) | |
234 | if (status & dport->port.ignore_status_mask) { | 201 | continue; |
235 | if (++ignore > 100) | 202 | if (dport->port.flags & UPF_SAK) |
236 | break; | 203 | flag = TTY_BREAK; |
237 | goto ignore_char; | 204 | else |
238 | } | ||
239 | /* mask off the error conditions we want to ignore */ | ||
240 | tmp = status & dport->port.read_status_mask; | ||
241 | |||
242 | if (tmp & DZ_PERR) { | ||
243 | flag = TTY_PARITY; | ||
244 | #ifdef DEBUG_DZ | ||
245 | debug_console("PERR\n", 5); | ||
246 | #endif | ||
247 | } else if (tmp & DZ_FERR) { | ||
248 | flag = TTY_FRAME; | 205 | flag = TTY_FRAME; |
249 | #ifdef DEBUG_DZ | 206 | } else if (status & DZ_OERR) /* overrun error */ |
250 | debug_console("FERR\n", 5); | 207 | flag = TTY_OVERRUN; |
251 | #endif | 208 | else if (status & DZ_PERR) /* parity error */ |
252 | } | 209 | flag = TTY_PARITY; |
253 | if (tmp & DZ_OERR) { | 210 | |
254 | #ifdef DEBUG_DZ | 211 | /* keep track of the statistics */ |
255 | debug_console("OERR\n", 5); | 212 | switch (flag) { |
256 | #endif | 213 | case TTY_FRAME: |
257 | tty_insert_flip_char(tty, ch, flag); | 214 | icount->frame++; |
258 | ch = 0; | 215 | break; |
259 | flag = TTY_OVERRUN; | 216 | case TTY_PARITY: |
260 | } | 217 | icount->parity++; |
218 | break; | ||
219 | case TTY_OVERRUN: | ||
220 | icount->overrun++; | ||
221 | break; | ||
222 | case TTY_BREAK: | ||
223 | icount->brk++; | ||
224 | break; | ||
225 | default: | ||
226 | break; | ||
261 | } | 227 | } |
262 | tty_insert_flip_char(tty, ch, flag); | ||
263 | ignore_char: | ||
264 | ; | ||
265 | } while (status & DZ_DVAL); | ||
266 | 228 | ||
267 | if (tty) | 229 | if (uart_handle_sysrq_char(&dport->port, ch, regs)) |
268 | tty_flip_buffer_push(tty); | 230 | continue; |
231 | |||
232 | if ((status & dport->port.ignore_status_mask) == 0) { | ||
233 | uart_insert_char(&dport->port, | ||
234 | status, DZ_OERR, ch, flag); | ||
235 | lines_rx[LINE(status)] = 1; | ||
236 | } | ||
237 | } | ||
238 | for (i = 0; i < DZ_NB_PORT; i++) | ||
239 | if (lines_rx[i]) | ||
240 | tty_flip_buffer_push(dz_ports[i].port.info->tty); | ||
269 | } | 241 | } |
270 | 242 | ||
271 | /* | 243 | /* |
@@ -275,26 +247,32 @@ static inline void dz_receive_chars(struct dz_port *dport) | |||
275 | * This routine deals with outputs to any lines. | 247 | * This routine deals with outputs to any lines. |
276 | * ------------------------------------------------------------ | 248 | * ------------------------------------------------------------ |
277 | */ | 249 | */ |
278 | static inline void dz_transmit_chars(struct dz_port *dport) | 250 | static inline void dz_transmit_chars(struct dz_port *dport_in) |
279 | { | 251 | { |
280 | struct circ_buf *xmit = &dport->port.info->xmit; | 252 | struct dz_port *dport; |
253 | struct circ_buf *xmit; | ||
254 | unsigned short status; | ||
281 | unsigned char tmp; | 255 | unsigned char tmp; |
282 | 256 | ||
283 | if (dport->port.x_char) { /* XON/XOFF chars */ | 257 | status = dz_in(dport_in, DZ_CSR); |
258 | dport = &dz_ports[LINE(status)]; | ||
259 | xmit = &dport->port.info->xmit; | ||
260 | |||
261 | if (dport->port.x_char) { /* XON/XOFF chars */ | ||
284 | dz_out(dport, DZ_TDR, dport->port.x_char); | 262 | dz_out(dport, DZ_TDR, dport->port.x_char); |
285 | dport->port.icount.tx++; | 263 | dport->port.icount.tx++; |
286 | dport->port.x_char = 0; | 264 | dport->port.x_char = 0; |
287 | return; | 265 | return; |
288 | } | 266 | } |
289 | /* if nothing to do or stopped or hardware stopped */ | 267 | /* If nothing to do or stopped or hardware stopped. */ |
290 | if (uart_circ_empty(xmit) || uart_tx_stopped(&dport->port)) { | 268 | if (uart_circ_empty(xmit) || uart_tx_stopped(&dport->port)) { |
291 | dz_stop_tx(&dport->port); | 269 | dz_stop_tx(&dport->port); |
292 | return; | 270 | return; |
293 | } | 271 | } |
294 | 272 | ||
295 | /* | 273 | /* |
296 | * if something to do ... (rember the dz has no output fifo so we go | 274 | * If something to do... (remember the dz has no output fifo, |
297 | * one char at a time :-< | 275 | * so we go one char at a time) :-< |
298 | */ | 276 | */ |
299 | tmp = xmit->buf[xmit->tail]; | 277 | tmp = xmit->buf[xmit->tail]; |
300 | xmit->tail = (xmit->tail + 1) & (DZ_XMIT_SIZE - 1); | 278 | xmit->tail = (xmit->tail + 1) & (DZ_XMIT_SIZE - 1); |
@@ -304,23 +282,29 @@ static inline void dz_transmit_chars(struct dz_port *dport) | |||
304 | if (uart_circ_chars_pending(xmit) < DZ_WAKEUP_CHARS) | 282 | if (uart_circ_chars_pending(xmit) < DZ_WAKEUP_CHARS) |
305 | uart_write_wakeup(&dport->port); | 283 | uart_write_wakeup(&dport->port); |
306 | 284 | ||
307 | /* Are we done */ | 285 | /* Are we are done. */ |
308 | if (uart_circ_empty(xmit)) | 286 | if (uart_circ_empty(xmit)) |
309 | dz_stop_tx(&dport->port); | 287 | dz_stop_tx(&dport->port); |
310 | } | 288 | } |
311 | 289 | ||
312 | /* | 290 | /* |
313 | * ------------------------------------------------------------ | 291 | * ------------------------------------------------------------ |
314 | * check_modem_status () | 292 | * check_modem_status() |
315 | * | 293 | * |
316 | * Only valid for the MODEM line duh ! | 294 | * DS 3100 & 5100: Only valid for the MODEM line, duh! |
295 | * DS 5000/200: Valid for the MODEM and PRINTER line. | ||
317 | * ------------------------------------------------------------ | 296 | * ------------------------------------------------------------ |
318 | */ | 297 | */ |
319 | static inline void check_modem_status(struct dz_port *dport) | 298 | static inline void check_modem_status(struct dz_port *dport) |
320 | { | 299 | { |
300 | /* | ||
301 | * FIXME: | ||
302 | * 1. No status change interrupt; use a timer. | ||
303 | * 2. Handle the 3100/5000 as appropriate. --macro | ||
304 | */ | ||
321 | unsigned short status; | 305 | unsigned short status; |
322 | 306 | ||
323 | /* if not ne modem line just return */ | 307 | /* If not the modem line just return. */ |
324 | if (dport->port.line != DZ_MODEM) | 308 | if (dport->port.line != DZ_MODEM) |
325 | return; | 309 | return; |
326 | 310 | ||
@@ -341,21 +325,18 @@ static inline void check_modem_status(struct dz_port *dport) | |||
341 | */ | 325 | */ |
342 | static irqreturn_t dz_interrupt(int irq, void *dev) | 326 | static irqreturn_t dz_interrupt(int irq, void *dev) |
343 | { | 327 | { |
344 | struct dz_port *dport; | 328 | struct dz_port *dport = (struct dz_port *)dev; |
345 | unsigned short status; | 329 | unsigned short status; |
346 | 330 | ||
347 | /* get the reason why we just got an irq */ | 331 | /* get the reason why we just got an irq */ |
348 | status = dz_in((struct dz_port *)dev, DZ_CSR); | 332 | status = dz_in(dport, DZ_CSR); |
349 | dport = &dz_ports[LINE(status)]; | ||
350 | 333 | ||
351 | if (status & DZ_RDONE) | 334 | if ((status & (DZ_RDONE | DZ_RIE)) == (DZ_RDONE | DZ_RIE)) |
352 | dz_receive_chars(dport); | 335 | dz_receive_chars(dport, regs); |
353 | 336 | ||
354 | if (status & DZ_TRDY) | 337 | if ((status & (DZ_TRDY | DZ_TIE)) == (DZ_TRDY | DZ_TIE)) |
355 | dz_transmit_chars(dport); | 338 | dz_transmit_chars(dport); |
356 | 339 | ||
357 | /* FIXME: what about check modem status??? --rmk */ | ||
358 | |||
359 | return IRQ_HANDLED; | 340 | return IRQ_HANDLED; |
360 | } | 341 | } |
361 | 342 | ||
@@ -367,13 +348,13 @@ static irqreturn_t dz_interrupt(int irq, void *dev) | |||
367 | 348 | ||
368 | static unsigned int dz_get_mctrl(struct uart_port *uport) | 349 | static unsigned int dz_get_mctrl(struct uart_port *uport) |
369 | { | 350 | { |
351 | /* | ||
352 | * FIXME: Handle the 3100/5000 as appropriate. --macro | ||
353 | */ | ||
370 | struct dz_port *dport = (struct dz_port *)uport; | 354 | struct dz_port *dport = (struct dz_port *)uport; |
371 | unsigned int mctrl = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS; | 355 | unsigned int mctrl = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS; |
372 | 356 | ||
373 | if (dport->port.line == DZ_MODEM) { | 357 | if (dport->port.line == DZ_MODEM) { |
374 | /* | ||
375 | * CHECKME: This is a guess from the other code... --rmk | ||
376 | */ | ||
377 | if (dz_in(dport, DZ_MSR) & DZ_MODEM_DSR) | 358 | if (dz_in(dport, DZ_MSR) & DZ_MODEM_DSR) |
378 | mctrl &= ~TIOCM_DSR; | 359 | mctrl &= ~TIOCM_DSR; |
379 | } | 360 | } |
@@ -383,6 +364,9 @@ static unsigned int dz_get_mctrl(struct uart_port *uport) | |||
383 | 364 | ||
384 | static void dz_set_mctrl(struct uart_port *uport, unsigned int mctrl) | 365 | static void dz_set_mctrl(struct uart_port *uport, unsigned int mctrl) |
385 | { | 366 | { |
367 | /* | ||
368 | * FIXME: Handle the 3100/5000 as appropriate. --macro | ||
369 | */ | ||
386 | struct dz_port *dport = (struct dz_port *)uport; | 370 | struct dz_port *dport = (struct dz_port *)uport; |
387 | unsigned short tmp; | 371 | unsigned short tmp; |
388 | 372 | ||
@@ -409,13 +393,6 @@ static int dz_startup(struct uart_port *uport) | |||
409 | unsigned long flags; | 393 | unsigned long flags; |
410 | unsigned short tmp; | 394 | unsigned short tmp; |
411 | 395 | ||
412 | /* The dz lines for the mouse/keyboard must be | ||
413 | * opened using their respective drivers. | ||
414 | */ | ||
415 | if ((dport->port.line == DZ_KEYBOARD) || | ||
416 | (dport->port.line == DZ_MOUSE)) | ||
417 | return -ENODEV; | ||
418 | |||
419 | spin_lock_irqsave(&dport->port.lock, flags); | 396 | spin_lock_irqsave(&dport->port.lock, flags); |
420 | 397 | ||
421 | /* enable the interrupt and the scanning */ | 398 | /* enable the interrupt and the scanning */ |
@@ -442,7 +419,8 @@ static void dz_shutdown(struct uart_port *uport) | |||
442 | } | 419 | } |
443 | 420 | ||
444 | /* | 421 | /* |
445 | * get_lsr_info - get line status register info | 422 | * ------------------------------------------------------------------- |
423 | * dz_tx_empty() -- get the transmitter empty status | ||
446 | * | 424 | * |
447 | * Purpose: Let user call ioctl() to get info when the UART physically | 425 | * Purpose: Let user call ioctl() to get info when the UART physically |
448 | * is emptied. On bus types like RS485, the transmitter must | 426 | * is emptied. On bus types like RS485, the transmitter must |
@@ -450,21 +428,28 @@ static void dz_shutdown(struct uart_port *uport) | |||
450 | * the transmit shift register is empty, not be done when the | 428 | * the transmit shift register is empty, not be done when the |
451 | * transmit holding register is empty. This functionality | 429 | * transmit holding register is empty. This functionality |
452 | * allows an RS485 driver to be written in user space. | 430 | * allows an RS485 driver to be written in user space. |
431 | * ------------------------------------------------------------------- | ||
453 | */ | 432 | */ |
454 | static unsigned int dz_tx_empty(struct uart_port *uport) | 433 | static unsigned int dz_tx_empty(struct uart_port *uport) |
455 | { | 434 | { |
456 | struct dz_port *dport = (struct dz_port *)uport; | 435 | struct dz_port *dport = (struct dz_port *)uport; |
457 | unsigned short status = dz_in(dport, DZ_LPR); | 436 | unsigned short tmp, mask = 1 << dport->port.line; |
458 | 437 | ||
459 | /* FIXME: this appears to be obviously broken --rmk. */ | 438 | tmp = dz_in(dport, DZ_TCR); |
460 | return status ? TIOCSER_TEMT : 0; | 439 | tmp &= mask; |
440 | |||
441 | return tmp ? 0 : TIOCSER_TEMT; | ||
461 | } | 442 | } |
462 | 443 | ||
463 | static void dz_break_ctl(struct uart_port *uport, int break_state) | 444 | static void dz_break_ctl(struct uart_port *uport, int break_state) |
464 | { | 445 | { |
446 | /* | ||
447 | * FIXME: Can't access BREAK bits in TDR easily; | ||
448 | * reuse the code for polled TX. --macro | ||
449 | */ | ||
465 | struct dz_port *dport = (struct dz_port *)uport; | 450 | struct dz_port *dport = (struct dz_port *)uport; |
466 | unsigned long flags; | 451 | unsigned long flags; |
467 | unsigned short tmp, mask = 1 << uport->line; | 452 | unsigned short tmp, mask = 1 << dport->port.line; |
468 | 453 | ||
469 | spin_lock_irqsave(&uport->lock, flags); | 454 | spin_lock_irqsave(&uport->lock, flags); |
470 | tmp = dz_in(dport, DZ_TCR); | 455 | tmp = dz_in(dport, DZ_TCR); |
@@ -561,7 +546,7 @@ static void dz_set_termios(struct uart_port *uport, struct termios *termios, | |||
561 | 546 | ||
562 | spin_lock_irqsave(&dport->port.lock, flags); | 547 | spin_lock_irqsave(&dport->port.lock, flags); |
563 | 548 | ||
564 | dz_out(dport, DZ_LPR, cflag); | 549 | dz_out(dport, DZ_LPR, cflag | dport->port.line); |
565 | dport->cflag = cflag; | 550 | dport->cflag = cflag; |
566 | 551 | ||
567 | /* setup accept flag */ | 552 | /* setup accept flag */ |
@@ -650,7 +635,7 @@ static void __init dz_init_ports(void) | |||
650 | for (i = 0, dport = dz_ports; i < DZ_NB_PORT; i++, dport++) { | 635 | for (i = 0, dport = dz_ports; i < DZ_NB_PORT; i++, dport++) { |
651 | spin_lock_init(&dport->port.lock); | 636 | spin_lock_init(&dport->port.lock); |
652 | dport->port.membase = (char *) base; | 637 | dport->port.membase = (char *) base; |
653 | dport->port.iotype = UPIO_PORT; | 638 | dport->port.iotype = UPIO_MEM; |
654 | dport->port.irq = dec_interrupt[DEC_IRQ_DZ11]; | 639 | dport->port.irq = dec_interrupt[DEC_IRQ_DZ11]; |
655 | dport->port.line = i; | 640 | dport->port.line = i; |
656 | dport->port.fifosize = 1; | 641 | dport->port.fifosize = 1; |
@@ -662,10 +647,7 @@ static void __init dz_init_ports(void) | |||
662 | static void dz_reset(struct dz_port *dport) | 647 | static void dz_reset(struct dz_port *dport) |
663 | { | 648 | { |
664 | dz_out(dport, DZ_CSR, DZ_CLR); | 649 | dz_out(dport, DZ_CSR, DZ_CLR); |
665 | |||
666 | while (dz_in(dport, DZ_CSR) & DZ_CLR); | 650 | while (dz_in(dport, DZ_CSR) & DZ_CLR); |
667 | /* FIXME: cpu_relax? */ | ||
668 | |||
669 | iob(); | 651 | iob(); |
670 | 652 | ||
671 | /* enable scanning */ | 653 | /* enable scanning */ |
@@ -673,26 +655,55 @@ static void dz_reset(struct dz_port *dport) | |||
673 | } | 655 | } |
674 | 656 | ||
675 | #ifdef CONFIG_SERIAL_DZ_CONSOLE | 657 | #ifdef CONFIG_SERIAL_DZ_CONSOLE |
658 | /* | ||
659 | * ------------------------------------------------------------------- | ||
660 | * dz_console_putchar() -- transmit a character | ||
661 | * | ||
662 | * Polled transmission. This is tricky. We need to mask transmit | ||
663 | * interrupts so that they do not interfere, enable the transmitter | ||
664 | * for the line requested and then wait till the transmit scanner | ||
665 | * requests data for this line. But it may request data for another | ||
666 | * line first, in which case we have to disable its transmitter and | ||
667 | * repeat waiting till our line pops up. Only then the character may | ||
668 | * be transmitted. Finally, the state of the transmitter mask is | ||
669 | * restored. Welcome to the world of PDP-11! | ||
670 | * ------------------------------------------------------------------- | ||
671 | */ | ||
676 | static void dz_console_putchar(struct uart_port *uport, int ch) | 672 | static void dz_console_putchar(struct uart_port *uport, int ch) |
677 | { | 673 | { |
678 | struct dz_port *dport = (struct dz_port *)uport; | 674 | struct dz_port *dport = (struct dz_port *)uport; |
679 | unsigned long flags; | 675 | unsigned long flags; |
680 | int loops = 2500; | 676 | unsigned short csr, tcr, trdy, mask; |
681 | unsigned short tmp = (unsigned char)ch; | 677 | int loops = 10000; |
682 | /* this code sends stuff out to serial device - spinning its | ||
683 | wheels and waiting. */ | ||
684 | 678 | ||
685 | spin_lock_irqsave(&dport->port.lock, flags); | 679 | spin_lock_irqsave(&dport->port.lock, flags); |
680 | csr = dz_in(dport, DZ_CSR); | ||
681 | dz_out(dport, DZ_CSR, csr & ~DZ_TIE); | ||
682 | tcr = dz_in(dport, DZ_TCR); | ||
683 | tcr |= 1 << dport->port.line; | ||
684 | mask = tcr; | ||
685 | dz_out(dport, DZ_TCR, mask); | ||
686 | iob(); | ||
687 | spin_unlock_irqrestore(&dport->port.lock, flags); | ||
686 | 688 | ||
687 | /* spin our wheels */ | 689 | while (loops--) { |
688 | while (((dz_in(dport, DZ_CSR) & DZ_TRDY) != DZ_TRDY) && loops--) | 690 | trdy = dz_in(dport, DZ_CSR); |
689 | /* FIXME: cpu_relax, udelay? --rmk */ | 691 | if (!(trdy & DZ_TRDY)) |
690 | ; | 692 | continue; |
693 | trdy = (trdy & DZ_TLINE) >> 8; | ||
694 | if (trdy == dport->port.line) | ||
695 | break; | ||
696 | mask &= ~(1 << trdy); | ||
697 | dz_out(dport, DZ_TCR, mask); | ||
698 | iob(); | ||
699 | udelay(2); | ||
700 | } | ||
691 | 701 | ||
692 | /* Actually transmit the character. */ | 702 | if (loops) /* Cannot send otherwise. */ |
693 | dz_out(dport, DZ_TDR, tmp); | 703 | dz_out(dport, DZ_TDR, ch); |
694 | 704 | ||
695 | spin_unlock_irqrestore(&dport->port.lock, flags); | 705 | dz_out(dport, DZ_TCR, tcr); |
706 | dz_out(dport, DZ_CSR, csr); | ||
696 | } | 707 | } |
697 | 708 | ||
698 | /* | 709 | /* |
@@ -703,11 +714,11 @@ static void dz_console_putchar(struct uart_port *uport, int ch) | |||
703 | * The console must be locked when we get here. | 714 | * The console must be locked when we get here. |
704 | * ------------------------------------------------------------------- | 715 | * ------------------------------------------------------------------- |
705 | */ | 716 | */ |
706 | static void dz_console_print(struct console *cons, | 717 | static void dz_console_print(struct console *co, |
707 | const char *str, | 718 | const char *str, |
708 | unsigned int count) | 719 | unsigned int count) |
709 | { | 720 | { |
710 | struct dz_port *dport = &dz_ports[CONSOLE_LINE]; | 721 | struct dz_port *dport = &dz_ports[co->index]; |
711 | #ifdef DEBUG_DZ | 722 | #ifdef DEBUG_DZ |
712 | prom_printf((char *) str); | 723 | prom_printf((char *) str); |
713 | #endif | 724 | #endif |
@@ -716,49 +727,43 @@ static void dz_console_print(struct console *cons, | |||
716 | 727 | ||
717 | static int __init dz_console_setup(struct console *co, char *options) | 728 | static int __init dz_console_setup(struct console *co, char *options) |
718 | { | 729 | { |
719 | struct dz_port *dport = &dz_ports[CONSOLE_LINE]; | 730 | struct dz_port *dport = &dz_ports[co->index]; |
720 | int baud = 9600; | 731 | int baud = 9600; |
721 | int bits = 8; | 732 | int bits = 8; |
722 | int parity = 'n'; | 733 | int parity = 'n'; |
723 | int flow = 'n'; | 734 | int flow = 'n'; |
724 | int ret; | ||
725 | unsigned short mask, tmp; | ||
726 | 735 | ||
727 | if (options) | 736 | if (options) |
728 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 737 | uart_parse_options(options, &baud, &parity, &bits, &flow); |
729 | 738 | ||
730 | dz_reset(dport); | 739 | dz_reset(dport); |
731 | 740 | ||
732 | ret = uart_set_options(&dport->port, co, baud, parity, bits, flow); | 741 | return uart_set_options(&dport->port, co, baud, parity, bits, flow); |
733 | if (ret == 0) { | ||
734 | mask = 1 << dport->port.line; | ||
735 | tmp = dz_in(dport, DZ_TCR); /* read the TX flag */ | ||
736 | if (!(tmp & mask)) { | ||
737 | tmp |= mask; /* set the TX flag */ | ||
738 | dz_out(dport, DZ_TCR, tmp); | ||
739 | } | ||
740 | } | ||
741 | |||
742 | return ret; | ||
743 | } | 742 | } |
744 | 743 | ||
745 | static struct console dz_sercons = | 744 | static struct uart_driver dz_reg; |
746 | { | 745 | static struct console dz_sercons = { |
747 | .name = "ttyS", | 746 | .name = "ttyS", |
748 | .write = dz_console_print, | 747 | .write = dz_console_print, |
749 | .device = uart_console_device, | 748 | .device = uart_console_device, |
750 | .setup = dz_console_setup, | 749 | .setup = dz_console_setup, |
751 | .flags = CON_CONSDEV | CON_PRINTBUFFER, | 750 | .flags = CON_PRINTBUFFER, |
752 | .index = CONSOLE_LINE, | 751 | .index = -1, |
752 | .data = &dz_reg, | ||
753 | }; | 753 | }; |
754 | 754 | ||
755 | void __init dz_serial_console_init(void) | 755 | static int __init dz_serial_console_init(void) |
756 | { | 756 | { |
757 | dz_init_ports(); | 757 | if (!IOASIC) { |
758 | 758 | dz_init_ports(); | |
759 | register_console(&dz_sercons); | 759 | register_console(&dz_sercons); |
760 | return 0; | ||
761 | } else | ||
762 | return -ENXIO; | ||
760 | } | 763 | } |
761 | 764 | ||
765 | console_initcall(dz_serial_console_init); | ||
766 | |||
762 | #define SERIAL_DZ_CONSOLE &dz_sercons | 767 | #define SERIAL_DZ_CONSOLE &dz_sercons |
763 | #else | 768 | #else |
764 | #define SERIAL_DZ_CONSOLE NULL | 769 | #define SERIAL_DZ_CONSOLE NULL |
@@ -767,35 +772,29 @@ void __init dz_serial_console_init(void) | |||
767 | static struct uart_driver dz_reg = { | 772 | static struct uart_driver dz_reg = { |
768 | .owner = THIS_MODULE, | 773 | .owner = THIS_MODULE, |
769 | .driver_name = "serial", | 774 | .driver_name = "serial", |
770 | .dev_name = "ttyS%d", | 775 | .dev_name = "ttyS", |
771 | .major = TTY_MAJOR, | 776 | .major = TTY_MAJOR, |
772 | .minor = 64, | 777 | .minor = 64, |
773 | .nr = DZ_NB_PORT, | 778 | .nr = DZ_NB_PORT, |
774 | .cons = SERIAL_DZ_CONSOLE, | 779 | .cons = SERIAL_DZ_CONSOLE, |
775 | }; | 780 | }; |
776 | 781 | ||
777 | int __init dz_init(void) | 782 | static int __init dz_init(void) |
778 | { | 783 | { |
779 | unsigned long flags; | ||
780 | int ret, i; | 784 | int ret, i; |
781 | 785 | ||
786 | if (IOASIC) | ||
787 | return -ENXIO; | ||
788 | |||
782 | printk("%s%s\n", dz_name, dz_version); | 789 | printk("%s%s\n", dz_name, dz_version); |
783 | 790 | ||
784 | dz_init_ports(); | 791 | dz_init_ports(); |
785 | 792 | ||
786 | save_flags(flags); | ||
787 | cli(); | ||
788 | |||
789 | #ifndef CONFIG_SERIAL_DZ_CONSOLE | 793 | #ifndef CONFIG_SERIAL_DZ_CONSOLE |
790 | /* reset the chip */ | 794 | /* reset the chip */ |
791 | dz_reset(&dz_ports[0]); | 795 | dz_reset(&dz_ports[0]); |
792 | #endif | 796 | #endif |
793 | 797 | ||
794 | /* order matters here... the trick is that flags | ||
795 | is updated... in request_irq - to immediatedly obliterate | ||
796 | it is unwise. */ | ||
797 | restore_flags(flags); | ||
798 | |||
799 | if (request_irq(dz_ports[0].port.irq, dz_interrupt, | 798 | if (request_irq(dz_ports[0].port.irq, dz_interrupt, |
800 | IRQF_DISABLED, "DZ", &dz_ports[0])) | 799 | IRQF_DISABLED, "DZ", &dz_ports[0])) |
801 | panic("Unable to register DZ interrupt"); | 800 | panic("Unable to register DZ interrupt"); |
@@ -810,5 +809,7 @@ int __init dz_init(void) | |||
810 | return ret; | 809 | return ret; |
811 | } | 810 | } |
812 | 811 | ||
812 | module_init(dz_init); | ||
813 | |||
813 | MODULE_DESCRIPTION("DECstation DZ serial driver"); | 814 | MODULE_DESCRIPTION("DECstation DZ serial driver"); |
814 | MODULE_LICENSE("GPL"); | 815 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/serial/dz.h b/drivers/serial/dz.h index 86ef417382bb..9674d4e49872 100644 --- a/drivers/serial/dz.h +++ b/drivers/serial/dz.h | |||
@@ -1,20 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | * dz.h: Serial port driver for DECStations equiped | 2 | * dz.h: Serial port driver for DECstations equipped |
3 | * with the DZ chipset. | 3 | * with the DZ chipset. |
4 | * | 4 | * |
5 | * Copyright (C) 1998 Olivier A. D. Lebaillif | 5 | * Copyright (C) 1998 Olivier A. D. Lebaillif |
6 | * | 6 | * |
7 | * Email: olivier.lebaillif@ifrsys.com | 7 | * Email: olivier.lebaillif@ifrsys.com |
8 | * | 8 | * |
9 | * Copyright (C) 2004, 2006 Maciej W. Rozycki | ||
9 | */ | 10 | */ |
10 | #ifndef DZ_SERIAL_H | 11 | #ifndef DZ_SERIAL_H |
11 | #define DZ_SERIAL_H | 12 | #define DZ_SERIAL_H |
12 | 13 | ||
13 | /* | 14 | /* |
14 | * Definitions for the Control and Status Received. | 15 | * Definitions for the Control and Status Register. |
15 | */ | 16 | */ |
16 | #define DZ_TRDY 0x8000 /* Transmitter empty */ | 17 | #define DZ_TRDY 0x8000 /* Transmitter empty */ |
17 | #define DZ_TIE 0x4000 /* Transmitter Interrupt Enable */ | 18 | #define DZ_TIE 0x4000 /* Transmitter Interrupt Enbl */ |
19 | #define DZ_TLINE 0x0300 /* Transmitter Line Number */ | ||
18 | #define DZ_RDONE 0x0080 /* Receiver data ready */ | 20 | #define DZ_RDONE 0x0080 /* Receiver data ready */ |
19 | #define DZ_RIE 0x0040 /* Receive Interrupt Enable */ | 21 | #define DZ_RIE 0x0040 /* Receive Interrupt Enable */ |
20 | #define DZ_MSE 0x0020 /* Master Scan Enable */ | 22 | #define DZ_MSE 0x0020 /* Master Scan Enable */ |
@@ -22,32 +24,44 @@ | |||
22 | #define DZ_MAINT 0x0008 /* Loop Back Mode */ | 24 | #define DZ_MAINT 0x0008 /* Loop Back Mode */ |
23 | 25 | ||
24 | /* | 26 | /* |
25 | * Definitions for the Received buffer. | 27 | * Definitions for the Receiver Buffer Register. |
26 | */ | 28 | */ |
27 | #define DZ_RBUF_MASK 0x00FF /* Data Mask in the Receive Buffer */ | 29 | #define DZ_RBUF_MASK 0x00FF /* Data Mask */ |
28 | #define DZ_LINE_MASK 0x0300 /* Line Mask in the Receive Buffer */ | 30 | #define DZ_LINE_MASK 0x0300 /* Line Mask */ |
29 | #define DZ_DVAL 0x8000 /* Valid Data indicator */ | 31 | #define DZ_DVAL 0x8000 /* Valid Data indicator */ |
30 | #define DZ_OERR 0x4000 /* Overrun error indicator */ | 32 | #define DZ_OERR 0x4000 /* Overrun error indicator */ |
31 | #define DZ_FERR 0x2000 /* Frame error indicator */ | 33 | #define DZ_FERR 0x2000 /* Frame error indicator */ |
32 | #define DZ_PERR 0x1000 /* Parity error indicator */ | 34 | #define DZ_PERR 0x1000 /* Parity error indicator */ |
33 | 35 | ||
34 | #define LINE(x) (x & DZ_LINE_MASK) >> 8 /* Get the line number from the input buffer */ | 36 | #define LINE(x) ((x & DZ_LINE_MASK) >> 8) /* Get the line number |
35 | #define UCHAR(x) (unsigned char)(x & DZ_RBUF_MASK) | 37 | from the input buffer */ |
38 | #define UCHAR(x) ((unsigned char)(x & DZ_RBUF_MASK)) | ||
36 | 39 | ||
37 | /* | 40 | /* |
38 | * Definitions for the Transmit Register. | 41 | * Definitions for the Transmit Control Register. |
39 | */ | 42 | */ |
40 | #define DZ_LINE_KEYBOARD 0x0001 | 43 | #define DZ_LINE_KEYBOARD 0x0001 |
41 | #define DZ_LINE_MOUSE 0x0002 | 44 | #define DZ_LINE_MOUSE 0x0002 |
42 | #define DZ_LINE_MODEM 0x0004 | 45 | #define DZ_LINE_MODEM 0x0004 |
43 | #define DZ_LINE_PRINTER 0x0008 | 46 | #define DZ_LINE_PRINTER 0x0008 |
44 | 47 | ||
48 | #define DZ_MODEM_RTS 0x0800 /* RTS for the modem line (2) */ | ||
45 | #define DZ_MODEM_DTR 0x0400 /* DTR for the modem line (2) */ | 49 | #define DZ_MODEM_DTR 0x0400 /* DTR for the modem line (2) */ |
50 | #define DZ_PRINT_RTS 0x0200 /* RTS for the prntr line (3) */ | ||
51 | #define DZ_PRINT_DTR 0x0100 /* DTR for the prntr line (3) */ | ||
52 | #define DZ_LNENB 0x000f /* Transmitter Line Enable */ | ||
46 | 53 | ||
47 | /* | 54 | /* |
48 | * Definitions for the Modem Status Register. | 55 | * Definitions for the Modem Status Register. |
49 | */ | 56 | */ |
57 | #define DZ_MODEM_RI 0x0800 /* RI for the modem line (2) */ | ||
58 | #define DZ_MODEM_CD 0x0400 /* CD for the modem line (2) */ | ||
50 | #define DZ_MODEM_DSR 0x0200 /* DSR for the modem line (2) */ | 59 | #define DZ_MODEM_DSR 0x0200 /* DSR for the modem line (2) */ |
60 | #define DZ_MODEM_CTS 0x0100 /* CTS for the modem line (2) */ | ||
61 | #define DZ_PRINT_RI 0x0008 /* RI for the printer line (3) */ | ||
62 | #define DZ_PRINT_CD 0x0004 /* CD for the printer line (3) */ | ||
63 | #define DZ_PRINT_DSR 0x0002 /* DSR for the prntr line (3) */ | ||
64 | #define DZ_PRINT_CTS 0x0001 /* CTS for the prntr line (3) */ | ||
51 | 65 | ||
52 | /* | 66 | /* |
53 | * Definitions for the Transmit Data Register. | 67 | * Definitions for the Transmit Data Register. |
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index 8eea69f29989..29823bd60fb0 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c | |||
@@ -555,7 +555,7 @@ mpsc_sdma_start_tx(struct mpsc_port_info *pi) | |||
555 | if (!mpsc_sdma_tx_active(pi)) { | 555 | if (!mpsc_sdma_tx_active(pi)) { |
556 | txre = (struct mpsc_tx_desc *)(pi->txr + | 556 | txre = (struct mpsc_tx_desc *)(pi->txr + |
557 | (pi->txr_tail * MPSC_TXRE_SIZE)); | 557 | (pi->txr_tail * MPSC_TXRE_SIZE)); |
558 | dma_cache_sync((void *) txre, MPSC_TXRE_SIZE, DMA_FROM_DEVICE); | 558 | dma_cache_sync(pi->port.dev, (void *) txre, MPSC_TXRE_SIZE, DMA_FROM_DEVICE); |
559 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | 559 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) |
560 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | 560 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ |
561 | invalidate_dcache_range((ulong)txre, | 561 | invalidate_dcache_range((ulong)txre, |
@@ -931,7 +931,7 @@ mpsc_init_rings(struct mpsc_port_info *pi) | |||
931 | } | 931 | } |
932 | txre->link = cpu_to_be32(pi->txr_p); /* Wrap last back to first */ | 932 | txre->link = cpu_to_be32(pi->txr_p); /* Wrap last back to first */ |
933 | 933 | ||
934 | dma_cache_sync((void *) pi->dma_region, MPSC_DMA_ALLOC_SIZE, | 934 | dma_cache_sync(pi->port.dev, (void *) pi->dma_region, MPSC_DMA_ALLOC_SIZE, |
935 | DMA_BIDIRECTIONAL); | 935 | DMA_BIDIRECTIONAL); |
936 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | 936 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) |
937 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | 937 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ |
@@ -1005,7 +1005,7 @@ mpsc_rx_intr(struct mpsc_port_info *pi) | |||
1005 | 1005 | ||
1006 | rxre = (struct mpsc_rx_desc *)(pi->rxr + (pi->rxr_posn*MPSC_RXRE_SIZE)); | 1006 | rxre = (struct mpsc_rx_desc *)(pi->rxr + (pi->rxr_posn*MPSC_RXRE_SIZE)); |
1007 | 1007 | ||
1008 | dma_cache_sync((void *)rxre, MPSC_RXRE_SIZE, DMA_FROM_DEVICE); | 1008 | dma_cache_sync(pi->port.dev, (void *)rxre, MPSC_RXRE_SIZE, DMA_FROM_DEVICE); |
1009 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | 1009 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) |
1010 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | 1010 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ |
1011 | invalidate_dcache_range((ulong)rxre, | 1011 | invalidate_dcache_range((ulong)rxre, |
@@ -1029,7 +1029,7 @@ mpsc_rx_intr(struct mpsc_port_info *pi) | |||
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | bp = pi->rxb + (pi->rxr_posn * MPSC_RXBE_SIZE); | 1031 | bp = pi->rxb + (pi->rxr_posn * MPSC_RXBE_SIZE); |
1032 | dma_cache_sync((void *) bp, MPSC_RXBE_SIZE, DMA_FROM_DEVICE); | 1032 | dma_cache_sync(pi->port.dev, (void *) bp, MPSC_RXBE_SIZE, DMA_FROM_DEVICE); |
1033 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | 1033 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) |
1034 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | 1034 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ |
1035 | invalidate_dcache_range((ulong)bp, | 1035 | invalidate_dcache_range((ulong)bp, |
@@ -1098,7 +1098,7 @@ next_frame: | |||
1098 | SDMA_DESC_CMDSTAT_F | | 1098 | SDMA_DESC_CMDSTAT_F | |
1099 | SDMA_DESC_CMDSTAT_L); | 1099 | SDMA_DESC_CMDSTAT_L); |
1100 | wmb(); | 1100 | wmb(); |
1101 | dma_cache_sync((void *)rxre, MPSC_RXRE_SIZE, DMA_BIDIRECTIONAL); | 1101 | dma_cache_sync(pi->port.dev, (void *)rxre, MPSC_RXRE_SIZE, DMA_BIDIRECTIONAL); |
1102 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | 1102 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) |
1103 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | 1103 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ |
1104 | flush_dcache_range((ulong)rxre, | 1104 | flush_dcache_range((ulong)rxre, |
@@ -1109,7 +1109,7 @@ next_frame: | |||
1109 | pi->rxr_posn = (pi->rxr_posn + 1) & (MPSC_RXR_ENTRIES - 1); | 1109 | pi->rxr_posn = (pi->rxr_posn + 1) & (MPSC_RXR_ENTRIES - 1); |
1110 | rxre = (struct mpsc_rx_desc *)(pi->rxr + | 1110 | rxre = (struct mpsc_rx_desc *)(pi->rxr + |
1111 | (pi->rxr_posn * MPSC_RXRE_SIZE)); | 1111 | (pi->rxr_posn * MPSC_RXRE_SIZE)); |
1112 | dma_cache_sync((void *)rxre, MPSC_RXRE_SIZE, DMA_FROM_DEVICE); | 1112 | dma_cache_sync(pi->port.dev, (void *)rxre, MPSC_RXRE_SIZE, DMA_FROM_DEVICE); |
1113 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | 1113 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) |
1114 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | 1114 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ |
1115 | invalidate_dcache_range((ulong)rxre, | 1115 | invalidate_dcache_range((ulong)rxre, |
@@ -1143,7 +1143,7 @@ mpsc_setup_tx_desc(struct mpsc_port_info *pi, u32 count, u32 intr) | |||
1143 | SDMA_DESC_CMDSTAT_EI | 1143 | SDMA_DESC_CMDSTAT_EI |
1144 | : 0)); | 1144 | : 0)); |
1145 | wmb(); | 1145 | wmb(); |
1146 | dma_cache_sync((void *) txre, MPSC_TXRE_SIZE, DMA_BIDIRECTIONAL); | 1146 | dma_cache_sync(pi->port.dev, (void *) txre, MPSC_TXRE_SIZE, DMA_BIDIRECTIONAL); |
1147 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | 1147 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) |
1148 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | 1148 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ |
1149 | flush_dcache_range((ulong)txre, | 1149 | flush_dcache_range((ulong)txre, |
@@ -1192,7 +1192,7 @@ mpsc_copy_tx_data(struct mpsc_port_info *pi) | |||
1192 | else /* All tx data copied into ring bufs */ | 1192 | else /* All tx data copied into ring bufs */ |
1193 | return; | 1193 | return; |
1194 | 1194 | ||
1195 | dma_cache_sync((void *) bp, MPSC_TXBE_SIZE, DMA_BIDIRECTIONAL); | 1195 | dma_cache_sync(pi->port.dev, (void *) bp, MPSC_TXBE_SIZE, DMA_BIDIRECTIONAL); |
1196 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | 1196 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) |
1197 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | 1197 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ |
1198 | flush_dcache_range((ulong)bp, | 1198 | flush_dcache_range((ulong)bp, |
@@ -1217,7 +1217,7 @@ mpsc_tx_intr(struct mpsc_port_info *pi) | |||
1217 | txre = (struct mpsc_tx_desc *)(pi->txr + | 1217 | txre = (struct mpsc_tx_desc *)(pi->txr + |
1218 | (pi->txr_tail * MPSC_TXRE_SIZE)); | 1218 | (pi->txr_tail * MPSC_TXRE_SIZE)); |
1219 | 1219 | ||
1220 | dma_cache_sync((void *) txre, MPSC_TXRE_SIZE, DMA_FROM_DEVICE); | 1220 | dma_cache_sync(pi->port.dev, (void *) txre, MPSC_TXRE_SIZE, DMA_FROM_DEVICE); |
1221 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | 1221 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) |
1222 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | 1222 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ |
1223 | invalidate_dcache_range((ulong)txre, | 1223 | invalidate_dcache_range((ulong)txre, |
@@ -1235,7 +1235,7 @@ mpsc_tx_intr(struct mpsc_port_info *pi) | |||
1235 | 1235 | ||
1236 | txre = (struct mpsc_tx_desc *)(pi->txr + | 1236 | txre = (struct mpsc_tx_desc *)(pi->txr + |
1237 | (pi->txr_tail * MPSC_TXRE_SIZE)); | 1237 | (pi->txr_tail * MPSC_TXRE_SIZE)); |
1238 | dma_cache_sync((void *) txre, MPSC_TXRE_SIZE, | 1238 | dma_cache_sync(pi->port.dev, (void *) txre, MPSC_TXRE_SIZE, |
1239 | DMA_FROM_DEVICE); | 1239 | DMA_FROM_DEVICE); |
1240 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | 1240 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) |
1241 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | 1241 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ |
@@ -1652,7 +1652,7 @@ mpsc_console_write(struct console *co, const char *s, uint count) | |||
1652 | count--; | 1652 | count--; |
1653 | } | 1653 | } |
1654 | 1654 | ||
1655 | dma_cache_sync((void *) bp, MPSC_TXBE_SIZE, DMA_BIDIRECTIONAL); | 1655 | dma_cache_sync(pi->port.dev, (void *) bp, MPSC_TXBE_SIZE, DMA_BIDIRECTIONAL); |
1656 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | 1656 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) |
1657 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | 1657 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ |
1658 | flush_dcache_range((ulong)bp, | 1658 | flush_dcache_range((ulong)bp, |
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c new file mode 100644 index 000000000000..83690653b78b --- /dev/null +++ b/drivers/serial/uartlite.c | |||
@@ -0,0 +1,505 @@ | |||
1 | /* | ||
2 | * uartlite.c: Serial driver for Xilinx uartlite serial controller | ||
3 | * | ||
4 | * Peter Korsgaard <jacmet@sunsite.dk> | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public License | ||
7 | * version 2. This program is licensed "as is" without any warranty of any | ||
8 | * kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/console.h> | ||
14 | #include <linux/serial.h> | ||
15 | #include <linux/serial_core.h> | ||
16 | #include <linux/tty.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <asm/io.h> | ||
20 | |||
21 | #define ULITE_MAJOR 204 | ||
22 | #define ULITE_MINOR 187 | ||
23 | #define ULITE_NR_UARTS 4 | ||
24 | |||
25 | /* For register details see datasheet: | ||
26 | http://www.xilinx.com/bvdocs/ipcenter/data_sheet/opb_uartlite.pdf | ||
27 | */ | ||
28 | #define ULITE_RX 0x00 | ||
29 | #define ULITE_TX 0x04 | ||
30 | #define ULITE_STATUS 0x08 | ||
31 | #define ULITE_CONTROL 0x0c | ||
32 | |||
33 | #define ULITE_REGION 16 | ||
34 | |||
35 | #define ULITE_STATUS_RXVALID 0x01 | ||
36 | #define ULITE_STATUS_RXFULL 0x02 | ||
37 | #define ULITE_STATUS_TXEMPTY 0x04 | ||
38 | #define ULITE_STATUS_TXFULL 0x08 | ||
39 | #define ULITE_STATUS_IE 0x10 | ||
40 | #define ULITE_STATUS_OVERRUN 0x20 | ||
41 | #define ULITE_STATUS_FRAME 0x40 | ||
42 | #define ULITE_STATUS_PARITY 0x80 | ||
43 | |||
44 | #define ULITE_CONTROL_RST_TX 0x01 | ||
45 | #define ULITE_CONTROL_RST_RX 0x02 | ||
46 | #define ULITE_CONTROL_IE 0x10 | ||
47 | |||
48 | |||
49 | static struct uart_port ports[ULITE_NR_UARTS]; | ||
50 | |||
51 | static int ulite_receive(struct uart_port *port, int stat) | ||
52 | { | ||
53 | struct tty_struct *tty = port->info->tty; | ||
54 | unsigned char ch = 0; | ||
55 | char flag = TTY_NORMAL; | ||
56 | |||
57 | if ((stat & (ULITE_STATUS_RXVALID | ULITE_STATUS_OVERRUN | ||
58 | | ULITE_STATUS_FRAME)) == 0) | ||
59 | return 0; | ||
60 | |||
61 | /* stats */ | ||
62 | if (stat & ULITE_STATUS_RXVALID) { | ||
63 | port->icount.rx++; | ||
64 | ch = readb(port->membase + ULITE_RX); | ||
65 | |||
66 | if (stat & ULITE_STATUS_PARITY) | ||
67 | port->icount.parity++; | ||
68 | } | ||
69 | |||
70 | if (stat & ULITE_STATUS_OVERRUN) | ||
71 | port->icount.overrun++; | ||
72 | |||
73 | if (stat & ULITE_STATUS_FRAME) | ||
74 | port->icount.frame++; | ||
75 | |||
76 | |||
77 | /* drop byte with parity error if IGNPAR specificed */ | ||
78 | if (stat & port->ignore_status_mask & ULITE_STATUS_PARITY) | ||
79 | stat &= ~ULITE_STATUS_RXVALID; | ||
80 | |||
81 | stat &= port->read_status_mask; | ||
82 | |||
83 | if (stat & ULITE_STATUS_PARITY) | ||
84 | flag = TTY_PARITY; | ||
85 | |||
86 | |||
87 | stat &= ~port->ignore_status_mask; | ||
88 | |||
89 | if (stat & ULITE_STATUS_RXVALID) | ||
90 | tty_insert_flip_char(tty, ch, flag); | ||
91 | |||
92 | if (stat & ULITE_STATUS_FRAME) | ||
93 | tty_insert_flip_char(tty, 0, TTY_FRAME); | ||
94 | |||
95 | if (stat & ULITE_STATUS_OVERRUN) | ||
96 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
97 | |||
98 | return 1; | ||
99 | } | ||
100 | |||
101 | static int ulite_transmit(struct uart_port *port, int stat) | ||
102 | { | ||
103 | struct circ_buf *xmit = &port->info->xmit; | ||
104 | |||
105 | if (stat & ULITE_STATUS_TXFULL) | ||
106 | return 0; | ||
107 | |||
108 | if (port->x_char) { | ||
109 | writeb(port->x_char, port->membase + ULITE_TX); | ||
110 | port->x_char = 0; | ||
111 | port->icount.tx++; | ||
112 | return 1; | ||
113 | } | ||
114 | |||
115 | if (uart_circ_empty(xmit) || uart_tx_stopped(port)) | ||
116 | return 0; | ||
117 | |||
118 | writeb(xmit->buf[xmit->tail], port->membase + ULITE_TX); | ||
119 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE-1); | ||
120 | port->icount.tx++; | ||
121 | |||
122 | /* wake up */ | ||
123 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | ||
124 | uart_write_wakeup(port); | ||
125 | |||
126 | return 1; | ||
127 | } | ||
128 | |||
129 | static irqreturn_t ulite_isr(int irq, void *dev_id) | ||
130 | { | ||
131 | struct uart_port *port = (struct uart_port *)dev_id; | ||
132 | int busy; | ||
133 | |||
134 | do { | ||
135 | int stat = readb(port->membase + ULITE_STATUS); | ||
136 | busy = ulite_receive(port, stat); | ||
137 | busy |= ulite_transmit(port, stat); | ||
138 | } while (busy); | ||
139 | |||
140 | tty_flip_buffer_push(port->info->tty); | ||
141 | |||
142 | return IRQ_HANDLED; | ||
143 | } | ||
144 | |||
145 | static unsigned int ulite_tx_empty(struct uart_port *port) | ||
146 | { | ||
147 | unsigned long flags; | ||
148 | unsigned int ret; | ||
149 | |||
150 | spin_lock_irqsave(&port->lock, flags); | ||
151 | ret = readb(port->membase + ULITE_STATUS); | ||
152 | spin_unlock_irqrestore(&port->lock, flags); | ||
153 | |||
154 | return ret & ULITE_STATUS_TXEMPTY ? TIOCSER_TEMT : 0; | ||
155 | } | ||
156 | |||
157 | static unsigned int ulite_get_mctrl(struct uart_port *port) | ||
158 | { | ||
159 | return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; | ||
160 | } | ||
161 | |||
162 | static void ulite_set_mctrl(struct uart_port *port, unsigned int mctrl) | ||
163 | { | ||
164 | /* N/A */ | ||
165 | } | ||
166 | |||
167 | static void ulite_stop_tx(struct uart_port *port) | ||
168 | { | ||
169 | /* N/A */ | ||
170 | } | ||
171 | |||
172 | static void ulite_start_tx(struct uart_port *port) | ||
173 | { | ||
174 | ulite_transmit(port, readb(port->membase + ULITE_STATUS)); | ||
175 | } | ||
176 | |||
177 | static void ulite_stop_rx(struct uart_port *port) | ||
178 | { | ||
179 | /* don't forward any more data (like !CREAD) */ | ||
180 | port->ignore_status_mask = ULITE_STATUS_RXVALID | ULITE_STATUS_PARITY | ||
181 | | ULITE_STATUS_FRAME | ULITE_STATUS_OVERRUN; | ||
182 | } | ||
183 | |||
184 | static void ulite_enable_ms(struct uart_port *port) | ||
185 | { | ||
186 | /* N/A */ | ||
187 | } | ||
188 | |||
189 | static void ulite_break_ctl(struct uart_port *port, int ctl) | ||
190 | { | ||
191 | /* N/A */ | ||
192 | } | ||
193 | |||
194 | static int ulite_startup(struct uart_port *port) | ||
195 | { | ||
196 | int ret; | ||
197 | |||
198 | ret = request_irq(port->irq, ulite_isr, | ||
199 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, "uartlite", port); | ||
200 | if (ret) | ||
201 | return ret; | ||
202 | |||
203 | writeb(ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX, | ||
204 | port->membase + ULITE_CONTROL); | ||
205 | writeb(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL); | ||
206 | |||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | static void ulite_shutdown(struct uart_port *port) | ||
211 | { | ||
212 | writeb(0, port->membase + ULITE_CONTROL); | ||
213 | readb(port->membase + ULITE_CONTROL); /* dummy */ | ||
214 | free_irq(port->irq, port); | ||
215 | } | ||
216 | |||
217 | static void ulite_set_termios(struct uart_port *port, struct termios *termios, | ||
218 | struct termios *old) | ||
219 | { | ||
220 | unsigned long flags; | ||
221 | unsigned int baud; | ||
222 | |||
223 | spin_lock_irqsave(&port->lock, flags); | ||
224 | |||
225 | port->read_status_mask = ULITE_STATUS_RXVALID | ULITE_STATUS_OVERRUN | ||
226 | | ULITE_STATUS_TXFULL; | ||
227 | |||
228 | if (termios->c_iflag & INPCK) | ||
229 | port->read_status_mask |= | ||
230 | ULITE_STATUS_PARITY | ULITE_STATUS_FRAME; | ||
231 | |||
232 | port->ignore_status_mask = 0; | ||
233 | if (termios->c_iflag & IGNPAR) | ||
234 | port->ignore_status_mask |= ULITE_STATUS_PARITY | ||
235 | | ULITE_STATUS_FRAME | ULITE_STATUS_OVERRUN; | ||
236 | |||
237 | /* ignore all characters if CREAD is not set */ | ||
238 | if ((termios->c_cflag & CREAD) == 0) | ||
239 | port->ignore_status_mask |= | ||
240 | ULITE_STATUS_RXVALID | ULITE_STATUS_PARITY | ||
241 | | ULITE_STATUS_FRAME | ULITE_STATUS_OVERRUN; | ||
242 | |||
243 | /* update timeout */ | ||
244 | baud = uart_get_baud_rate(port, termios, old, 0, 460800); | ||
245 | uart_update_timeout(port, termios->c_cflag, baud); | ||
246 | |||
247 | spin_unlock_irqrestore(&port->lock, flags); | ||
248 | } | ||
249 | |||
250 | static const char *ulite_type(struct uart_port *port) | ||
251 | { | ||
252 | return port->type == PORT_UARTLITE ? "uartlite" : NULL; | ||
253 | } | ||
254 | |||
255 | static void ulite_release_port(struct uart_port *port) | ||
256 | { | ||
257 | release_mem_region(port->mapbase, ULITE_REGION); | ||
258 | iounmap(port->membase); | ||
259 | port->membase = 0; | ||
260 | } | ||
261 | |||
262 | static int ulite_request_port(struct uart_port *port) | ||
263 | { | ||
264 | if (!request_mem_region(port->mapbase, ULITE_REGION, "uartlite")) { | ||
265 | dev_err(port->dev, "Memory region busy\n"); | ||
266 | return -EBUSY; | ||
267 | } | ||
268 | |||
269 | port->membase = ioremap(port->mapbase, ULITE_REGION); | ||
270 | if (!port->membase) { | ||
271 | dev_err(port->dev, "Unable to map registers\n"); | ||
272 | release_mem_region(port->mapbase, ULITE_REGION); | ||
273 | return -EBUSY; | ||
274 | } | ||
275 | |||
276 | return 0; | ||
277 | } | ||
278 | |||
279 | static void ulite_config_port(struct uart_port *port, int flags) | ||
280 | { | ||
281 | ulite_request_port(port); | ||
282 | port->type = PORT_UARTLITE; | ||
283 | } | ||
284 | |||
285 | static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser) | ||
286 | { | ||
287 | /* we don't want the core code to modify any port params */ | ||
288 | return -EINVAL; | ||
289 | } | ||
290 | |||
291 | static struct uart_ops ulite_ops = { | ||
292 | .tx_empty = ulite_tx_empty, | ||
293 | .set_mctrl = ulite_set_mctrl, | ||
294 | .get_mctrl = ulite_get_mctrl, | ||
295 | .stop_tx = ulite_stop_tx, | ||
296 | .start_tx = ulite_start_tx, | ||
297 | .stop_rx = ulite_stop_rx, | ||
298 | .enable_ms = ulite_enable_ms, | ||
299 | .break_ctl = ulite_break_ctl, | ||
300 | .startup = ulite_startup, | ||
301 | .shutdown = ulite_shutdown, | ||
302 | .set_termios = ulite_set_termios, | ||
303 | .type = ulite_type, | ||
304 | .release_port = ulite_release_port, | ||
305 | .request_port = ulite_request_port, | ||
306 | .config_port = ulite_config_port, | ||
307 | .verify_port = ulite_verify_port | ||
308 | }; | ||
309 | |||
310 | #ifdef CONFIG_SERIAL_UARTLITE_CONSOLE | ||
311 | static void ulite_console_wait_tx(struct uart_port *port) | ||
312 | { | ||
313 | int i; | ||
314 | |||
315 | /* wait up to 10ms for the character(s) to be sent */ | ||
316 | for (i = 0; i < 10000; i++) { | ||
317 | if (readb(port->membase + ULITE_STATUS) & ULITE_STATUS_TXEMPTY) | ||
318 | break; | ||
319 | udelay(1); | ||
320 | } | ||
321 | } | ||
322 | |||
323 | static void ulite_console_putchar(struct uart_port *port, int ch) | ||
324 | { | ||
325 | ulite_console_wait_tx(port); | ||
326 | writeb(ch, port->membase + ULITE_TX); | ||
327 | } | ||
328 | |||
329 | static void ulite_console_write(struct console *co, const char *s, | ||
330 | unsigned int count) | ||
331 | { | ||
332 | struct uart_port *port = &ports[co->index]; | ||
333 | unsigned long flags; | ||
334 | unsigned int ier; | ||
335 | int locked = 1; | ||
336 | |||
337 | if (oops_in_progress) { | ||
338 | locked = spin_trylock_irqsave(&port->lock, flags); | ||
339 | } else | ||
340 | spin_lock_irqsave(&port->lock, flags); | ||
341 | |||
342 | /* save and disable interrupt */ | ||
343 | ier = readb(port->membase + ULITE_STATUS) & ULITE_STATUS_IE; | ||
344 | writeb(0, port->membase + ULITE_CONTROL); | ||
345 | |||
346 | uart_console_write(port, s, count, ulite_console_putchar); | ||
347 | |||
348 | ulite_console_wait_tx(port); | ||
349 | |||
350 | /* restore interrupt state */ | ||
351 | if (ier) | ||
352 | writeb(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL); | ||
353 | |||
354 | if (locked) | ||
355 | spin_unlock_irqrestore(&port->lock, flags); | ||
356 | } | ||
357 | |||
358 | static int __init ulite_console_setup(struct console *co, char *options) | ||
359 | { | ||
360 | struct uart_port *port; | ||
361 | int baud = 9600; | ||
362 | int bits = 8; | ||
363 | int parity = 'n'; | ||
364 | int flow = 'n'; | ||
365 | |||
366 | if (co->index < 0 || co->index >= ULITE_NR_UARTS) | ||
367 | return -EINVAL; | ||
368 | |||
369 | port = &ports[co->index]; | ||
370 | |||
371 | /* not initialized yet? */ | ||
372 | if (!port->membase) | ||
373 | return -ENODEV; | ||
374 | |||
375 | if (options) | ||
376 | uart_parse_options(options, &baud, &parity, &bits, &flow); | ||
377 | |||
378 | return uart_set_options(port, co, baud, parity, bits, flow); | ||
379 | } | ||
380 | |||
381 | static struct uart_driver ulite_uart_driver; | ||
382 | |||
383 | static struct console ulite_console = { | ||
384 | .name = "ttyUL", | ||
385 | .write = ulite_console_write, | ||
386 | .device = uart_console_device, | ||
387 | .setup = ulite_console_setup, | ||
388 | .flags = CON_PRINTBUFFER, | ||
389 | .index = -1, /* Specified on the cmdline (e.g. console=ttyUL0 ) */ | ||
390 | .data = &ulite_uart_driver, | ||
391 | }; | ||
392 | |||
393 | static int __init ulite_console_init(void) | ||
394 | { | ||
395 | register_console(&ulite_console); | ||
396 | return 0; | ||
397 | } | ||
398 | |||
399 | console_initcall(ulite_console_init); | ||
400 | |||
401 | #endif /* CONFIG_SERIAL_UARTLITE_CONSOLE */ | ||
402 | |||
403 | static struct uart_driver ulite_uart_driver = { | ||
404 | .owner = THIS_MODULE, | ||
405 | .driver_name = "uartlite", | ||
406 | .dev_name = "ttyUL", | ||
407 | .major = ULITE_MAJOR, | ||
408 | .minor = ULITE_MINOR, | ||
409 | .nr = ULITE_NR_UARTS, | ||
410 | #ifdef CONFIG_SERIAL_UARTLITE_CONSOLE | ||
411 | .cons = &ulite_console, | ||
412 | #endif | ||
413 | }; | ||
414 | |||
415 | static int __devinit ulite_probe(struct platform_device *pdev) | ||
416 | { | ||
417 | struct resource *res, *res2; | ||
418 | struct uart_port *port; | ||
419 | |||
420 | if (pdev->id < 0 || pdev->id >= ULITE_NR_UARTS) | ||
421 | return -EINVAL; | ||
422 | |||
423 | if (ports[pdev->id].membase) | ||
424 | return -EBUSY; | ||
425 | |||
426 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
427 | if (!res) | ||
428 | return -ENODEV; | ||
429 | |||
430 | res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | ||
431 | if (!res2) | ||
432 | return -ENODEV; | ||
433 | |||
434 | port = &ports[pdev->id]; | ||
435 | |||
436 | port->fifosize = 16; | ||
437 | port->regshift = 2; | ||
438 | port->iotype = UPIO_MEM; | ||
439 | port->iobase = 1; /* mark port in use */ | ||
440 | port->mapbase = res->start; | ||
441 | port->membase = 0; | ||
442 | port->ops = &ulite_ops; | ||
443 | port->irq = res2->start; | ||
444 | port->flags = UPF_BOOT_AUTOCONF; | ||
445 | port->dev = &pdev->dev; | ||
446 | port->type = PORT_UNKNOWN; | ||
447 | port->line = pdev->id; | ||
448 | |||
449 | uart_add_one_port(&ulite_uart_driver, port); | ||
450 | platform_set_drvdata(pdev, port); | ||
451 | |||
452 | return 0; | ||
453 | } | ||
454 | |||
455 | static int ulite_remove(struct platform_device *pdev) | ||
456 | { | ||
457 | struct uart_port *port = platform_get_drvdata(pdev); | ||
458 | |||
459 | platform_set_drvdata(pdev, NULL); | ||
460 | |||
461 | if (port) | ||
462 | uart_remove_one_port(&ulite_uart_driver, port); | ||
463 | |||
464 | /* mark port as free */ | ||
465 | port->membase = 0; | ||
466 | |||
467 | return 0; | ||
468 | } | ||
469 | |||
470 | static struct platform_driver ulite_platform_driver = { | ||
471 | .probe = ulite_probe, | ||
472 | .remove = ulite_remove, | ||
473 | .driver = { | ||
474 | .owner = THIS_MODULE, | ||
475 | .name = "uartlite", | ||
476 | }, | ||
477 | }; | ||
478 | |||
479 | int __init ulite_init(void) | ||
480 | { | ||
481 | int ret; | ||
482 | |||
483 | ret = uart_register_driver(&ulite_uart_driver); | ||
484 | if (ret) | ||
485 | return ret; | ||
486 | |||
487 | ret = platform_driver_register(&ulite_platform_driver); | ||
488 | if (ret) | ||
489 | uart_unregister_driver(&ulite_uart_driver); | ||
490 | |||
491 | return ret; | ||
492 | } | ||
493 | |||
494 | void __exit ulite_exit(void) | ||
495 | { | ||
496 | platform_driver_unregister(&ulite_platform_driver); | ||
497 | uart_unregister_driver(&ulite_uart_driver); | ||
498 | } | ||
499 | |||
500 | module_init(ulite_init); | ||
501 | module_exit(ulite_exit); | ||
502 | |||
503 | MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>"); | ||
504 | MODULE_DESCRIPTION("Xilinx uartlite serial driver"); | ||
505 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index c3c0626f550b..270e6211c2e3 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -360,12 +360,13 @@ spi_alloc_master(struct device *dev, unsigned size) | |||
360 | if (!dev) | 360 | if (!dev) |
361 | return NULL; | 361 | return NULL; |
362 | 362 | ||
363 | master = kzalloc(size + sizeof *master, SLAB_KERNEL); | 363 | master = kzalloc(size + sizeof *master, GFP_KERNEL); |
364 | if (!master) | 364 | if (!master) |
365 | return NULL; | 365 | return NULL; |
366 | 366 | ||
367 | class_device_initialize(&master->cdev); | 367 | class_device_initialize(&master->cdev); |
368 | master->cdev.class = &spi_master_class; | 368 | master->cdev.class = &spi_master_class; |
369 | kobj_set_kset_s(&master->cdev, spi_master_class.subsys); | ||
369 | master->cdev.dev = get_device(dev); | 370 | master->cdev.dev = get_device(dev); |
370 | spi_master_set_devdata(master, &master[1]); | 371 | spi_master_set_devdata(master, &master[1]); |
371 | 372 | ||
@@ -447,7 +448,9 @@ static int __unregister(struct device *dev, void *unused) | |||
447 | */ | 448 | */ |
448 | void spi_unregister_master(struct spi_master *master) | 449 | void spi_unregister_master(struct spi_master *master) |
449 | { | 450 | { |
450 | (void) device_for_each_child(master->cdev.dev, NULL, __unregister); | 451 | int dummy; |
452 | |||
453 | dummy = device_for_each_child(master->cdev.dev, NULL, __unregister); | ||
451 | class_device_unregister(&master->cdev); | 454 | class_device_unregister(&master->cdev); |
452 | } | 455 | } |
453 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 456 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
@@ -463,15 +466,13 @@ EXPORT_SYMBOL_GPL(spi_unregister_master); | |||
463 | */ | 466 | */ |
464 | struct spi_master *spi_busnum_to_master(u16 bus_num) | 467 | struct spi_master *spi_busnum_to_master(u16 bus_num) |
465 | { | 468 | { |
466 | if (bus_num) { | 469 | char name[9]; |
467 | char name[8]; | 470 | struct kobject *bus; |
468 | struct kobject *bus; | 471 | |
469 | 472 | snprintf(name, sizeof name, "spi%u", bus_num); | |
470 | snprintf(name, sizeof name, "spi%u", bus_num); | 473 | bus = kset_find_obj(&spi_master_class.subsys.kset, name); |
471 | bus = kset_find_obj(&spi_master_class.subsys.kset, name); | 474 | if (bus) |
472 | if (bus) | 475 | return container_of(bus, struct spi_master, cdev.kobj); |
473 | return container_of(bus, struct spi_master, cdev.kobj); | ||
474 | } | ||
475 | return NULL; | 476 | return NULL; |
476 | } | 477 | } |
477 | EXPORT_SYMBOL_GPL(spi_busnum_to_master); | 478 | EXPORT_SYMBOL_GPL(spi_busnum_to_master); |
@@ -607,7 +608,7 @@ static int __init spi_init(void) | |||
607 | { | 608 | { |
608 | int status; | 609 | int status; |
609 | 610 | ||
610 | buf = kmalloc(SPI_BUFSIZ, SLAB_KERNEL); | 611 | buf = kmalloc(SPI_BUFSIZ, GFP_KERNEL); |
611 | if (!buf) { | 612 | if (!buf) { |
612 | status = -ENOMEM; | 613 | status = -ENOMEM; |
613 | goto err0; | 614 | goto err0; |
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 08c1c57c6128..57289b61d0be 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -196,7 +196,7 @@ int spi_bitbang_setup(struct spi_device *spi) | |||
196 | return -EINVAL; | 196 | return -EINVAL; |
197 | 197 | ||
198 | if (!cs) { | 198 | if (!cs) { |
199 | cs = kzalloc(sizeof *cs, SLAB_KERNEL); | 199 | cs = kzalloc(sizeof *cs, GFP_KERNEL); |
200 | if (!cs) | 200 | if (!cs) |
201 | return -ENOMEM; | 201 | return -ENOMEM; |
202 | spi->controller_state = cs; | 202 | spi->controller_state = cs; |
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c index c2f601f8e4f2..312987a03210 100644 --- a/drivers/spi/spi_butterfly.c +++ b/drivers/spi/spi_butterfly.c | |||
@@ -251,6 +251,8 @@ static void butterfly_attach(struct parport *p) | |||
251 | * setting up a platform device like this is an ugly kluge... | 251 | * setting up a platform device like this is an ugly kluge... |
252 | */ | 252 | */ |
253 | pdev = platform_device_register_simple("butterfly", -1, NULL, 0); | 253 | pdev = platform_device_register_simple("butterfly", -1, NULL, 0); |
254 | if (IS_ERR(pdev)) | ||
255 | return; | ||
254 | 256 | ||
255 | master = spi_alloc_master(&pdev->dev, sizeof *pp); | 257 | master = spi_alloc_master(&pdev->dev, sizeof *pp); |
256 | if (!master) { | 258 | if (!master) { |
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index f2d196fa1e8b..dae4ef1e8fe5 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -64,6 +64,8 @@ | |||
64 | #include <linux/kthread.h> | 64 | #include <linux/kthread.h> |
65 | #include <linux/version.h> | 65 | #include <linux/version.h> |
66 | #include <linux/mutex.h> | 66 | #include <linux/mutex.h> |
67 | #include <linux/freezer.h> | ||
68 | |||
67 | #include <asm/unaligned.h> | 69 | #include <asm/unaligned.h> |
68 | 70 | ||
69 | #include "usbatm.h" | 71 | #include "usbatm.h" |
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index 840442a25b61..c3915dc28608 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c | |||
@@ -93,7 +93,7 @@ void hcd_buffer_destroy (struct usb_hcd *hcd) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | 95 | ||
96 | /* sometimes alloc/free could use kmalloc with SLAB_DMA, for | 96 | /* sometimes alloc/free could use kmalloc with GFP_DMA, for |
97 | * better sharing and to leverage mm/slab.c intelligence. | 97 | * better sharing and to leverage mm/slab.c intelligence. |
98 | */ | 98 | */ |
99 | 99 | ||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 9be41ed1f9a6..2651c2e2a89f 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/usbdevice_fs.h> | 22 | #include <linux/usbdevice_fs.h> |
23 | #include <linux/kthread.h> | 23 | #include <linux/kthread.h> |
24 | #include <linux/mutex.h> | 24 | #include <linux/mutex.h> |
25 | #include <linux/freezer.h> | ||
25 | 26 | ||
26 | #include <asm/semaphore.h> | 27 | #include <asm/semaphore.h> |
27 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
@@ -460,7 +461,7 @@ void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe) | |||
460 | * since each TT has "at least two" buffers that can need it (and | 461 | * since each TT has "at least two" buffers that can need it (and |
461 | * there can be many TTs per hub). even if they're uncommon. | 462 | * there can be many TTs per hub). even if they're uncommon. |
462 | */ | 463 | */ |
463 | if ((clear = kmalloc (sizeof *clear, SLAB_ATOMIC)) == NULL) { | 464 | if ((clear = kmalloc (sizeof *clear, GFP_ATOMIC)) == NULL) { |
464 | dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n"); | 465 | dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n"); |
465 | /* FIXME recover somehow ... RESET_TT? */ | 466 | /* FIXME recover somehow ... RESET_TT? */ |
466 | return; | 467 | return; |
@@ -2371,7 +2372,7 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1) | |||
2371 | struct usb_qualifier_descriptor *qual; | 2372 | struct usb_qualifier_descriptor *qual; |
2372 | int status; | 2373 | int status; |
2373 | 2374 | ||
2374 | qual = kmalloc (sizeof *qual, SLAB_KERNEL); | 2375 | qual = kmalloc (sizeof *qual, GFP_KERNEL); |
2375 | if (qual == NULL) | 2376 | if (qual == NULL) |
2376 | return; | 2377 | return; |
2377 | 2378 | ||
@@ -2922,7 +2923,7 @@ static int config_descriptors_changed(struct usb_device *udev) | |||
2922 | if (len < le16_to_cpu(udev->config[index].desc.wTotalLength)) | 2923 | if (len < le16_to_cpu(udev->config[index].desc.wTotalLength)) |
2923 | len = le16_to_cpu(udev->config[index].desc.wTotalLength); | 2924 | len = le16_to_cpu(udev->config[index].desc.wTotalLength); |
2924 | } | 2925 | } |
2925 | buf = kmalloc (len, SLAB_KERNEL); | 2926 | buf = kmalloc (len, GFP_KERNEL); |
2926 | if (buf == NULL) { | 2927 | if (buf == NULL) { |
2927 | dev_err(&udev->dev, "no mem to re-read configs after reset\n"); | 2928 | dev_err(&udev->dev, "no mem to re-read configs after reset\n"); |
2928 | /* assume the worst */ | 2929 | /* assume the worst */ |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 7390b67c609d..149aa8bfb1fe 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -488,7 +488,7 @@ void usb_sg_wait (struct usb_sg_request *io) | |||
488 | int retval; | 488 | int retval; |
489 | 489 | ||
490 | io->urbs [i]->dev = io->dev; | 490 | io->urbs [i]->dev = io->dev; |
491 | retval = usb_submit_urb (io->urbs [i], SLAB_ATOMIC); | 491 | retval = usb_submit_urb (io->urbs [i], GFP_ATOMIC); |
492 | 492 | ||
493 | /* after we submit, let completions or cancelations fire; | 493 | /* after we submit, let completions or cancelations fire; |
494 | * we handshake using io->status. | 494 | * we handshake using io->status. |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 8b975d15538d..c98316ce8384 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -250,7 +250,7 @@ | |||
250 | #include <linux/slab.h> | 250 | #include <linux/slab.h> |
251 | #include <linux/spinlock.h> | 251 | #include <linux/spinlock.h> |
252 | #include <linux/string.h> | 252 | #include <linux/string.h> |
253 | #include <linux/suspend.h> | 253 | #include <linux/freezer.h> |
254 | #include <linux/utsname.h> | 254 | #include <linux/utsname.h> |
255 | 255 | ||
256 | #include <linux/usb_ch9.h> | 256 | #include <linux/usb_ch9.h> |
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c index 64554acad63f..31351826f2ba 100644 --- a/drivers/usb/gadget/gmidi.c +++ b/drivers/usb/gadget/gmidi.c | |||
@@ -1236,7 +1236,7 @@ autoconf_fail: | |||
1236 | 1236 | ||
1237 | 1237 | ||
1238 | /* ok, we made sense of the hardware ... */ | 1238 | /* ok, we made sense of the hardware ... */ |
1239 | dev = kzalloc(sizeof(*dev), SLAB_KERNEL); | 1239 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
1240 | if (!dev) { | 1240 | if (!dev) { |
1241 | return -ENOMEM; | 1241 | return -ENOMEM; |
1242 | } | 1242 | } |
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index a3076da3f4eb..805a9826842d 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
@@ -1864,7 +1864,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1864 | } | 1864 | } |
1865 | 1865 | ||
1866 | /* alloc, and start init */ | 1866 | /* alloc, and start init */ |
1867 | dev = kmalloc (sizeof *dev, SLAB_KERNEL); | 1867 | dev = kmalloc (sizeof *dev, GFP_KERNEL); |
1868 | if (dev == NULL){ | 1868 | if (dev == NULL){ |
1869 | pr_debug("enomem %s\n", pci_name(pdev)); | 1869 | pr_debug("enomem %s\n", pci_name(pdev)); |
1870 | retval = -ENOMEM; | 1870 | retval = -ENOMEM; |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 86924f9cdd7e..3fb1044a4db0 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -412,7 +412,7 @@ ep_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
412 | /* FIXME readahead for O_NONBLOCK and poll(); careful with ZLPs */ | 412 | /* FIXME readahead for O_NONBLOCK and poll(); careful with ZLPs */ |
413 | 413 | ||
414 | value = -ENOMEM; | 414 | value = -ENOMEM; |
415 | kbuf = kmalloc (len, SLAB_KERNEL); | 415 | kbuf = kmalloc (len, GFP_KERNEL); |
416 | if (unlikely (!kbuf)) | 416 | if (unlikely (!kbuf)) |
417 | goto free1; | 417 | goto free1; |
418 | 418 | ||
@@ -456,7 +456,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
456 | /* FIXME writebehind for O_NONBLOCK and poll(), qlen = 1 */ | 456 | /* FIXME writebehind for O_NONBLOCK and poll(), qlen = 1 */ |
457 | 457 | ||
458 | value = -ENOMEM; | 458 | value = -ENOMEM; |
459 | kbuf = kmalloc (len, SLAB_KERNEL); | 459 | kbuf = kmalloc (len, GFP_KERNEL); |
460 | if (!kbuf) | 460 | if (!kbuf) |
461 | goto free1; | 461 | goto free1; |
462 | if (copy_from_user (kbuf, buf, len)) { | 462 | if (copy_from_user (kbuf, buf, len)) { |
@@ -1898,7 +1898,7 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
1898 | buf += 4; | 1898 | buf += 4; |
1899 | length -= 4; | 1899 | length -= 4; |
1900 | 1900 | ||
1901 | kbuf = kmalloc (length, SLAB_KERNEL); | 1901 | kbuf = kmalloc (length, GFP_KERNEL); |
1902 | if (!kbuf) | 1902 | if (!kbuf) |
1903 | return -ENOMEM; | 1903 | return -ENOMEM; |
1904 | if (copy_from_user (kbuf, buf, length)) { | 1904 | if (copy_from_user (kbuf, buf, length)) { |
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 0b590831582c..3024c679e38e 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -2861,7 +2861,7 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id) | |||
2861 | } | 2861 | } |
2862 | 2862 | ||
2863 | /* alloc, and start init */ | 2863 | /* alloc, and start init */ |
2864 | dev = kzalloc (sizeof *dev, SLAB_KERNEL); | 2864 | dev = kzalloc (sizeof *dev, GFP_KERNEL); |
2865 | if (dev == NULL){ | 2865 | if (dev == NULL){ |
2866 | retval = -ENOMEM; | 2866 | retval = -ENOMEM; |
2867 | goto done; | 2867 | goto done; |
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 48a09fd89d18..030d87c28c2f 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -2581,7 +2581,7 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv) | |||
2581 | /* UDC_PULLUP_EN gates the chip clock */ | 2581 | /* UDC_PULLUP_EN gates the chip clock */ |
2582 | // OTG_SYSCON_1_REG |= DEV_IDLE_EN; | 2582 | // OTG_SYSCON_1_REG |= DEV_IDLE_EN; |
2583 | 2583 | ||
2584 | udc = kzalloc(sizeof(*udc), SLAB_KERNEL); | 2584 | udc = kzalloc(sizeof(*udc), GFP_KERNEL); |
2585 | if (!udc) | 2585 | if (!udc) |
2586 | return -ENOMEM; | 2586 | return -ENOMEM; |
2587 | 2587 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 0f809dd68492..40710ea1b490 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -1190,7 +1190,7 @@ autoconf_fail: | |||
1190 | 1190 | ||
1191 | 1191 | ||
1192 | /* ok, we made sense of the hardware ... */ | 1192 | /* ok, we made sense of the hardware ... */ |
1193 | dev = kzalloc(sizeof(*dev), SLAB_KERNEL); | 1193 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
1194 | if (!dev) | 1194 | if (!dev) |
1195 | return -ENOMEM; | 1195 | return -ENOMEM; |
1196 | spin_lock_init (&dev->lock); | 1196 | spin_lock_init (&dev->lock); |
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 34b7a31cd85b..56349d21e6ea 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
@@ -492,7 +492,7 @@ show_periodic (struct class_device *class_dev, char *buf) | |||
492 | unsigned i; | 492 | unsigned i; |
493 | __le32 tag; | 493 | __le32 tag; |
494 | 494 | ||
495 | if (!(seen = kmalloc (DBG_SCHED_LIMIT * sizeof *seen, SLAB_ATOMIC))) | 495 | if (!(seen = kmalloc (DBG_SCHED_LIMIT * sizeof *seen, GFP_ATOMIC))) |
496 | return 0; | 496 | return 0; |
497 | seen_count = 0; | 497 | seen_count = 0; |
498 | 498 | ||
diff --git a/drivers/usb/host/hc_crisv10.c b/drivers/usb/host/hc_crisv10.c index 87eca6aeacf2..9325e46a68c0 100644 --- a/drivers/usb/host/hc_crisv10.c +++ b/drivers/usb/host/hc_crisv10.c | |||
@@ -188,7 +188,7 @@ static DEFINE_TIMER(bulk_eot_timer, NULL, 0, 0); | |||
188 | #define CHECK_ALIGN(x) if (((__u32)(x)) & 0x00000003) \ | 188 | #define CHECK_ALIGN(x) if (((__u32)(x)) & 0x00000003) \ |
189 | {panic("Alignment check (DWORD) failed at %s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__);} | 189 | {panic("Alignment check (DWORD) failed at %s:%s:%d\n", __FILE__, __FUNCTION__, __LINE__);} |
190 | 190 | ||
191 | #define SLAB_FLAG (in_interrupt() ? SLAB_ATOMIC : SLAB_KERNEL) | 191 | #define SLAB_FLAG (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL) |
192 | #define KMALLOC_FLAG (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL) | 192 | #define KMALLOC_FLAG (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL) |
193 | 193 | ||
194 | /* Most helpful debugging aid */ | 194 | /* Most helpful debugging aid */ |
@@ -275,13 +275,13 @@ static volatile USB_SB_Desc_t TxIntrSB_zout __attribute__ ((aligned (4))); | |||
275 | static int zout_buffer[4] __attribute__ ((aligned (4))); | 275 | static int zout_buffer[4] __attribute__ ((aligned (4))); |
276 | 276 | ||
277 | /* Cache for allocating new EP and SB descriptors. */ | 277 | /* Cache for allocating new EP and SB descriptors. */ |
278 | static kmem_cache_t *usb_desc_cache; | 278 | static struct kmem_cache *usb_desc_cache; |
279 | 279 | ||
280 | /* Cache for the registers allocated in the top half. */ | 280 | /* Cache for the registers allocated in the top half. */ |
281 | static kmem_cache_t *top_half_reg_cache; | 281 | static struct kmem_cache *top_half_reg_cache; |
282 | 282 | ||
283 | /* Cache for the data allocated in the isoc descr top half. */ | 283 | /* Cache for the data allocated in the isoc descr top half. */ |
284 | static kmem_cache_t *isoc_compl_cache; | 284 | static struct kmem_cache *isoc_compl_cache; |
285 | 285 | ||
286 | static struct usb_bus *etrax_usb_bus; | 286 | static struct usb_bus *etrax_usb_bus; |
287 | 287 | ||
@@ -1743,7 +1743,7 @@ static irqreturn_t etrax_usb_tx_interrupt(int irq, void *vhc) | |||
1743 | 1743 | ||
1744 | *R_DMA_CH8_SUB3_CLR_INTR = IO_STATE(R_DMA_CH8_SUB3_CLR_INTR, clr_descr, do); | 1744 | *R_DMA_CH8_SUB3_CLR_INTR = IO_STATE(R_DMA_CH8_SUB3_CLR_INTR, clr_descr, do); |
1745 | 1745 | ||
1746 | comp_data = (usb_isoc_complete_data_t*)kmem_cache_alloc(isoc_compl_cache, SLAB_ATOMIC); | 1746 | comp_data = (usb_isoc_complete_data_t*)kmem_cache_alloc(isoc_compl_cache, GFP_ATOMIC); |
1747 | assert(comp_data != NULL); | 1747 | assert(comp_data != NULL); |
1748 | 1748 | ||
1749 | INIT_WORK(&comp_data->usb_bh, etrax_usb_isoc_descr_interrupt_bottom_half, comp_data); | 1749 | INIT_WORK(&comp_data->usb_bh, etrax_usb_isoc_descr_interrupt_bottom_half, comp_data); |
@@ -3010,7 +3010,7 @@ static void etrax_usb_add_to_isoc_sb_list(struct urb *urb, int epid) | |||
3010 | if (!urb->iso_frame_desc[i].length) | 3010 | if (!urb->iso_frame_desc[i].length) |
3011 | continue; | 3011 | continue; |
3012 | 3012 | ||
3013 | next_sb_desc = (USB_SB_Desc_t*)kmem_cache_alloc(usb_desc_cache, SLAB_ATOMIC); | 3013 | next_sb_desc = (USB_SB_Desc_t*)kmem_cache_alloc(usb_desc_cache, GFP_ATOMIC); |
3014 | assert(next_sb_desc != NULL); | 3014 | assert(next_sb_desc != NULL); |
3015 | 3015 | ||
3016 | if (urb->iso_frame_desc[i].length > 0) { | 3016 | if (urb->iso_frame_desc[i].length > 0) { |
@@ -3063,7 +3063,7 @@ static void etrax_usb_add_to_isoc_sb_list(struct urb *urb, int epid) | |||
3063 | if (TxIsocEPList[epid].sub == 0) { | 3063 | if (TxIsocEPList[epid].sub == 0) { |
3064 | dbg_isoc("Isoc traffic not already running, allocating SB"); | 3064 | dbg_isoc("Isoc traffic not already running, allocating SB"); |
3065 | 3065 | ||
3066 | next_sb_desc = (USB_SB_Desc_t*)kmem_cache_alloc(usb_desc_cache, SLAB_ATOMIC); | 3066 | next_sb_desc = (USB_SB_Desc_t*)kmem_cache_alloc(usb_desc_cache, GFP_ATOMIC); |
3067 | assert(next_sb_desc != NULL); | 3067 | assert(next_sb_desc != NULL); |
3068 | 3068 | ||
3069 | next_sb_desc->command = (IO_STATE(USB_SB_command, tt, in) | | 3069 | next_sb_desc->command = (IO_STATE(USB_SB_command, tt, in) | |
@@ -3317,7 +3317,7 @@ static irqreturn_t etrax_usb_hc_interrupt_top_half(int irq, void *vhc) | |||
3317 | 3317 | ||
3318 | restore_flags(flags); | 3318 | restore_flags(flags); |
3319 | 3319 | ||
3320 | reg = (usb_interrupt_registers_t *)kmem_cache_alloc(top_half_reg_cache, SLAB_ATOMIC); | 3320 | reg = (usb_interrupt_registers_t *)kmem_cache_alloc(top_half_reg_cache, GFP_ATOMIC); |
3321 | 3321 | ||
3322 | assert(reg != NULL); | 3322 | assert(reg != NULL); |
3323 | 3323 | ||
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c index 8293c1d4be3f..0f47a57dac28 100644 --- a/drivers/usb/host/ohci-dbg.c +++ b/drivers/usb/host/ohci-dbg.c | |||
@@ -505,7 +505,7 @@ show_periodic (struct class_device *class_dev, char *buf) | |||
505 | char *next; | 505 | char *next; |
506 | unsigned i; | 506 | unsigned i; |
507 | 507 | ||
508 | if (!(seen = kmalloc (DBG_SCHED_LIMIT * sizeof *seen, SLAB_ATOMIC))) | 508 | if (!(seen = kmalloc (DBG_SCHED_LIMIT * sizeof *seen, GFP_ATOMIC))) |
509 | return 0; | 509 | return 0; |
510 | seen_count = 0; | 510 | seen_count = 0; |
511 | 511 | ||
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c index 2dbb77414905..7f26f9bdbaf1 100644 --- a/drivers/usb/host/ohci-pnx4008.c +++ b/drivers/usb/host/ohci-pnx4008.c | |||
@@ -134,7 +134,7 @@ static int isp1301_attach(struct i2c_adapter *adap, int addr, int kind) | |||
134 | { | 134 | { |
135 | struct i2c_client *c; | 135 | struct i2c_client *c; |
136 | 136 | ||
137 | c = (struct i2c_client *)kzalloc(sizeof(*c), SLAB_KERNEL); | 137 | c = (struct i2c_client *)kzalloc(sizeof(*c), GFP_KERNEL); |
138 | 138 | ||
139 | if (!c) | 139 | if (!c) |
140 | return -ENOMEM; | 140 | return -ENOMEM; |
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 226bf3de8edd..e87692c31be4 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -81,7 +81,7 @@ MODULE_PARM_DESC(debug, "Debug level"); | |||
81 | static char *errbuf; | 81 | static char *errbuf; |
82 | #define ERRBUF_LEN (32 * 1024) | 82 | #define ERRBUF_LEN (32 * 1024) |
83 | 83 | ||
84 | static kmem_cache_t *uhci_up_cachep; /* urb_priv */ | 84 | static struct kmem_cache *uhci_up_cachep; /* urb_priv */ |
85 | 85 | ||
86 | static void suspend_rh(struct uhci_hcd *uhci, enum uhci_rh_state new_state); | 86 | static void suspend_rh(struct uhci_hcd *uhci, enum uhci_rh_state new_state); |
87 | static void wakeup_rh(struct uhci_hcd *uhci); | 87 | static void wakeup_rh(struct uhci_hcd *uhci); |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index 06115f22a4fa..30b88459ac7d 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -498,7 +498,7 @@ static inline struct urb_priv *uhci_alloc_urb_priv(struct uhci_hcd *uhci, | |||
498 | { | 498 | { |
499 | struct urb_priv *urbp; | 499 | struct urb_priv *urbp; |
500 | 500 | ||
501 | urbp = kmem_cache_alloc(uhci_up_cachep, SLAB_ATOMIC); | 501 | urbp = kmem_cache_alloc(uhci_up_cachep, GFP_ATOMIC); |
502 | if (!urbp) | 502 | if (!urbp) |
503 | return NULL; | 503 | return NULL; |
504 | 504 | ||
diff --git a/drivers/usb/input/acecad.c b/drivers/usb/input/acecad.c index 0096373b5f98..909138e5aa04 100644 --- a/drivers/usb/input/acecad.c +++ b/drivers/usb/input/acecad.c | |||
@@ -152,7 +152,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ | |||
152 | if (!acecad || !input_dev) | 152 | if (!acecad || !input_dev) |
153 | goto fail1; | 153 | goto fail1; |
154 | 154 | ||
155 | acecad->data = usb_buffer_alloc(dev, 8, SLAB_KERNEL, &acecad->data_dma); | 155 | acecad->data = usb_buffer_alloc(dev, 8, GFP_KERNEL, &acecad->data_dma); |
156 | if (!acecad->data) | 156 | if (!acecad->data) |
157 | goto fail1; | 157 | goto fail1; |
158 | 158 | ||
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c index bf428184608f..9f52429ce654 100644 --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c | |||
@@ -1988,7 +1988,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1988 | goto fail1; | 1988 | goto fail1; |
1989 | 1989 | ||
1990 | aiptek->data = usb_buffer_alloc(usbdev, AIPTEK_PACKET_LENGTH, | 1990 | aiptek->data = usb_buffer_alloc(usbdev, AIPTEK_PACKET_LENGTH, |
1991 | SLAB_ATOMIC, &aiptek->data_dma); | 1991 | GFP_ATOMIC, &aiptek->data_dma); |
1992 | if (!aiptek->data) | 1992 | if (!aiptek->data) |
1993 | goto fail1; | 1993 | goto fail1; |
1994 | 1994 | ||
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c index ff23318dc301..b724e36f7b92 100644 --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c | |||
@@ -592,7 +592,7 @@ static void ati_remote_irq_in(struct urb *urb) | |||
592 | __FUNCTION__, urb->status); | 592 | __FUNCTION__, urb->status); |
593 | } | 593 | } |
594 | 594 | ||
595 | retval = usb_submit_urb(urb, SLAB_ATOMIC); | 595 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
596 | if (retval) | 596 | if (retval) |
597 | dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb()=%d\n", | 597 | dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb()=%d\n", |
598 | __FUNCTION__, retval); | 598 | __FUNCTION__, retval); |
@@ -604,12 +604,12 @@ static void ati_remote_irq_in(struct urb *urb) | |||
604 | static int ati_remote_alloc_buffers(struct usb_device *udev, | 604 | static int ati_remote_alloc_buffers(struct usb_device *udev, |
605 | struct ati_remote *ati_remote) | 605 | struct ati_remote *ati_remote) |
606 | { | 606 | { |
607 | ati_remote->inbuf = usb_buffer_alloc(udev, DATA_BUFSIZE, SLAB_ATOMIC, | 607 | ati_remote->inbuf = usb_buffer_alloc(udev, DATA_BUFSIZE, GFP_ATOMIC, |
608 | &ati_remote->inbuf_dma); | 608 | &ati_remote->inbuf_dma); |
609 | if (!ati_remote->inbuf) | 609 | if (!ati_remote->inbuf) |
610 | return -1; | 610 | return -1; |
611 | 611 | ||
612 | ati_remote->outbuf = usb_buffer_alloc(udev, DATA_BUFSIZE, SLAB_ATOMIC, | 612 | ati_remote->outbuf = usb_buffer_alloc(udev, DATA_BUFSIZE, GFP_ATOMIC, |
613 | &ati_remote->outbuf_dma); | 613 | &ati_remote->outbuf_dma); |
614 | if (!ati_remote->outbuf) | 614 | if (!ati_remote->outbuf) |
615 | return -1; | 615 | return -1; |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 4295bab4f1e2..f1d0e1d69828 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1079,7 +1079,7 @@ static void hid_irq_in(struct urb *urb) | |||
1079 | warn("input irq status %d received", urb->status); | 1079 | warn("input irq status %d received", urb->status); |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | status = usb_submit_urb(urb, SLAB_ATOMIC); | 1082 | status = usb_submit_urb(urb, GFP_ATOMIC); |
1083 | if (status) { | 1083 | if (status) { |
1084 | clear_bit(HID_IN_RUNNING, &hid->iofl); | 1084 | clear_bit(HID_IN_RUNNING, &hid->iofl); |
1085 | if (status != -EPERM) { | 1085 | if (status != -EPERM) { |
@@ -1864,13 +1864,13 @@ static void hid_find_max_report(struct hid_device *hid, unsigned int type, int * | |||
1864 | 1864 | ||
1865 | static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid) | 1865 | static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid) |
1866 | { | 1866 | { |
1867 | if (!(hid->inbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->inbuf_dma))) | 1867 | if (!(hid->inbuf = usb_buffer_alloc(dev, hid->bufsize, GFP_ATOMIC, &hid->inbuf_dma))) |
1868 | return -1; | 1868 | return -1; |
1869 | if (!(hid->outbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->outbuf_dma))) | 1869 | if (!(hid->outbuf = usb_buffer_alloc(dev, hid->bufsize, GFP_ATOMIC, &hid->outbuf_dma))) |
1870 | return -1; | 1870 | return -1; |
1871 | if (!(hid->cr = usb_buffer_alloc(dev, sizeof(*(hid->cr)), SLAB_ATOMIC, &hid->cr_dma))) | 1871 | if (!(hid->cr = usb_buffer_alloc(dev, sizeof(*(hid->cr)), GFP_ATOMIC, &hid->cr_dma))) |
1872 | return -1; | 1872 | return -1; |
1873 | if (!(hid->ctrlbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->ctrlbuf_dma))) | 1873 | if (!(hid->ctrlbuf = usb_buffer_alloc(dev, hid->bufsize, GFP_ATOMIC, &hid->ctrlbuf_dma))) |
1874 | return -1; | 1874 | return -1; |
1875 | 1875 | ||
1876 | return 0; | 1876 | return 0; |
diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c index 50aa8108a50b..98bd323369c7 100644 --- a/drivers/usb/input/keyspan_remote.c +++ b/drivers/usb/input/keyspan_remote.c | |||
@@ -456,7 +456,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic | |||
456 | remote->in_endpoint = endpoint; | 456 | remote->in_endpoint = endpoint; |
457 | remote->toggle = -1; /* Set to -1 so we will always not match the toggle from the first remote message. */ | 457 | remote->toggle = -1; /* Set to -1 so we will always not match the toggle from the first remote message. */ |
458 | 458 | ||
459 | remote->in_buffer = usb_buffer_alloc(udev, RECV_SIZE, SLAB_ATOMIC, &remote->in_dma); | 459 | remote->in_buffer = usb_buffer_alloc(udev, RECV_SIZE, GFP_ATOMIC, &remote->in_dma); |
460 | if (!remote->in_buffer) { | 460 | if (!remote->in_buffer) { |
461 | retval = -ENOMEM; | 461 | retval = -ENOMEM; |
462 | goto fail1; | 462 | goto fail1; |
diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c index 79a85d46cb13..92c4e07da4c8 100644 --- a/drivers/usb/input/mtouchusb.c +++ b/drivers/usb/input/mtouchusb.c | |||
@@ -164,7 +164,7 @@ static int mtouchusb_alloc_buffers(struct usb_device *udev, struct mtouch_usb *m | |||
164 | dbg("%s - called", __FUNCTION__); | 164 | dbg("%s - called", __FUNCTION__); |
165 | 165 | ||
166 | mtouch->data = usb_buffer_alloc(udev, MTOUCHUSB_REPORT_DATA_SIZE, | 166 | mtouch->data = usb_buffer_alloc(udev, MTOUCHUSB_REPORT_DATA_SIZE, |
167 | SLAB_ATOMIC, &mtouch->data_dma); | 167 | GFP_ATOMIC, &mtouch->data_dma); |
168 | 168 | ||
169 | if (!mtouch->data) | 169 | if (!mtouch->data) |
170 | return -1; | 170 | return -1; |
diff --git a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c index 0bf91778c40d..fea97e5437f8 100644 --- a/drivers/usb/input/powermate.c +++ b/drivers/usb/input/powermate.c | |||
@@ -277,12 +277,12 @@ static int powermate_input_event(struct input_dev *dev, unsigned int type, unsig | |||
277 | static int powermate_alloc_buffers(struct usb_device *udev, struct powermate_device *pm) | 277 | static int powermate_alloc_buffers(struct usb_device *udev, struct powermate_device *pm) |
278 | { | 278 | { |
279 | pm->data = usb_buffer_alloc(udev, POWERMATE_PAYLOAD_SIZE_MAX, | 279 | pm->data = usb_buffer_alloc(udev, POWERMATE_PAYLOAD_SIZE_MAX, |
280 | SLAB_ATOMIC, &pm->data_dma); | 280 | GFP_ATOMIC, &pm->data_dma); |
281 | if (!pm->data) | 281 | if (!pm->data) |
282 | return -1; | 282 | return -1; |
283 | 283 | ||
284 | pm->configcr = usb_buffer_alloc(udev, sizeof(*(pm->configcr)), | 284 | pm->configcr = usb_buffer_alloc(udev, sizeof(*(pm->configcr)), |
285 | SLAB_ATOMIC, &pm->configcr_dma); | 285 | GFP_ATOMIC, &pm->configcr_dma); |
286 | if (!pm->configcr) | 286 | if (!pm->configcr) |
287 | return -1; | 287 | return -1; |
288 | 288 | ||
diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c index 05c0d1ca39ab..2a314b065922 100644 --- a/drivers/usb/input/touchkitusb.c +++ b/drivers/usb/input/touchkitusb.c | |||
@@ -248,7 +248,7 @@ static int touchkit_alloc_buffers(struct usb_device *udev, | |||
248 | struct touchkit_usb *touchkit) | 248 | struct touchkit_usb *touchkit) |
249 | { | 249 | { |
250 | touchkit->data = usb_buffer_alloc(udev, TOUCHKIT_REPORT_DATA_SIZE, | 250 | touchkit->data = usb_buffer_alloc(udev, TOUCHKIT_REPORT_DATA_SIZE, |
251 | SLAB_ATOMIC, &touchkit->data_dma); | 251 | GFP_ATOMIC, &touchkit->data_dma); |
252 | 252 | ||
253 | if (!touchkit->data) | 253 | if (!touchkit->data) |
254 | return -1; | 254 | return -1; |
diff --git a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c index dac88640eab6..8505824848f6 100644 --- a/drivers/usb/input/usbkbd.c +++ b/drivers/usb/input/usbkbd.c | |||
@@ -122,7 +122,7 @@ static void usb_kbd_irq(struct urb *urb) | |||
122 | memcpy(kbd->old, kbd->new, 8); | 122 | memcpy(kbd->old, kbd->new, 8); |
123 | 123 | ||
124 | resubmit: | 124 | resubmit: |
125 | i = usb_submit_urb (urb, SLAB_ATOMIC); | 125 | i = usb_submit_urb (urb, GFP_ATOMIC); |
126 | if (i) | 126 | if (i) |
127 | err ("can't resubmit intr, %s-%s/input0, status %d", | 127 | err ("can't resubmit intr, %s-%s/input0, status %d", |
128 | kbd->usbdev->bus->bus_name, | 128 | kbd->usbdev->bus->bus_name, |
@@ -196,11 +196,11 @@ static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd) | |||
196 | return -1; | 196 | return -1; |
197 | if (!(kbd->led = usb_alloc_urb(0, GFP_KERNEL))) | 197 | if (!(kbd->led = usb_alloc_urb(0, GFP_KERNEL))) |
198 | return -1; | 198 | return -1; |
199 | if (!(kbd->new = usb_buffer_alloc(dev, 8, SLAB_ATOMIC, &kbd->new_dma))) | 199 | if (!(kbd->new = usb_buffer_alloc(dev, 8, GFP_ATOMIC, &kbd->new_dma))) |
200 | return -1; | 200 | return -1; |
201 | if (!(kbd->cr = usb_buffer_alloc(dev, sizeof(struct usb_ctrlrequest), SLAB_ATOMIC, &kbd->cr_dma))) | 201 | if (!(kbd->cr = usb_buffer_alloc(dev, sizeof(struct usb_ctrlrequest), GFP_ATOMIC, &kbd->cr_dma))) |
202 | return -1; | 202 | return -1; |
203 | if (!(kbd->leds = usb_buffer_alloc(dev, 1, SLAB_ATOMIC, &kbd->leds_dma))) | 203 | if (!(kbd->leds = usb_buffer_alloc(dev, 1, GFP_ATOMIC, &kbd->leds_dma))) |
204 | return -1; | 204 | return -1; |
205 | 205 | ||
206 | return 0; | 206 | return 0; |
diff --git a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c index 68a55642c082..64a33e420cfb 100644 --- a/drivers/usb/input/usbmouse.c +++ b/drivers/usb/input/usbmouse.c | |||
@@ -86,7 +86,7 @@ static void usb_mouse_irq(struct urb *urb) | |||
86 | 86 | ||
87 | input_sync(dev); | 87 | input_sync(dev); |
88 | resubmit: | 88 | resubmit: |
89 | status = usb_submit_urb (urb, SLAB_ATOMIC); | 89 | status = usb_submit_urb (urb, GFP_ATOMIC); |
90 | if (status) | 90 | if (status) |
91 | err ("can't resubmit intr, %s-%s/input0, status %d", | 91 | err ("can't resubmit intr, %s-%s/input0, status %d", |
92 | mouse->usbdev->bus->bus_name, | 92 | mouse->usbdev->bus->bus_name, |
@@ -137,7 +137,7 @@ static int usb_mouse_probe(struct usb_interface *intf, const struct usb_device_i | |||
137 | if (!mouse || !input_dev) | 137 | if (!mouse || !input_dev) |
138 | goto fail1; | 138 | goto fail1; |
139 | 139 | ||
140 | mouse->data = usb_buffer_alloc(dev, 8, SLAB_ATOMIC, &mouse->data_dma); | 140 | mouse->data = usb_buffer_alloc(dev, 8, GFP_ATOMIC, &mouse->data_dma); |
141 | if (!mouse->data) | 141 | if (!mouse->data) |
142 | goto fail1; | 142 | goto fail1; |
143 | 143 | ||
diff --git a/drivers/usb/input/usbtouchscreen.c b/drivers/usb/input/usbtouchscreen.c index 49704d4ed0e2..7f3c57da9bc0 100644 --- a/drivers/usb/input/usbtouchscreen.c +++ b/drivers/usb/input/usbtouchscreen.c | |||
@@ -680,7 +680,7 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
680 | type->process_pkt = usbtouch_process_pkt; | 680 | type->process_pkt = usbtouch_process_pkt; |
681 | 681 | ||
682 | usbtouch->data = usb_buffer_alloc(udev, type->rept_size, | 682 | usbtouch->data = usb_buffer_alloc(udev, type->rept_size, |
683 | SLAB_KERNEL, &usbtouch->data_dma); | 683 | GFP_KERNEL, &usbtouch->data_dma); |
684 | if (!usbtouch->data) | 684 | if (!usbtouch->data) |
685 | goto out_free; | 685 | goto out_free; |
686 | 686 | ||
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c index df97e5c803f9..e4bc76ebc835 100644 --- a/drivers/usb/input/xpad.c +++ b/drivers/usb/input/xpad.c | |||
@@ -325,7 +325,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
325 | goto fail1; | 325 | goto fail1; |
326 | 326 | ||
327 | xpad->idata = usb_buffer_alloc(udev, XPAD_PKT_LEN, | 327 | xpad->idata = usb_buffer_alloc(udev, XPAD_PKT_LEN, |
328 | SLAB_ATOMIC, &xpad->idata_dma); | 328 | GFP_ATOMIC, &xpad->idata_dma); |
329 | if (!xpad->idata) | 329 | if (!xpad->idata) |
330 | goto fail1; | 330 | goto fail1; |
331 | 331 | ||
diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c index 2268ca311ade..caff8e6d7448 100644 --- a/drivers/usb/input/yealink.c +++ b/drivers/usb/input/yealink.c | |||
@@ -874,17 +874,17 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
874 | 874 | ||
875 | /* allocate usb buffers */ | 875 | /* allocate usb buffers */ |
876 | yld->irq_data = usb_buffer_alloc(udev, USB_PKT_LEN, | 876 | yld->irq_data = usb_buffer_alloc(udev, USB_PKT_LEN, |
877 | SLAB_ATOMIC, &yld->irq_dma); | 877 | GFP_ATOMIC, &yld->irq_dma); |
878 | if (yld->irq_data == NULL) | 878 | if (yld->irq_data == NULL) |
879 | return usb_cleanup(yld, -ENOMEM); | 879 | return usb_cleanup(yld, -ENOMEM); |
880 | 880 | ||
881 | yld->ctl_data = usb_buffer_alloc(udev, USB_PKT_LEN, | 881 | yld->ctl_data = usb_buffer_alloc(udev, USB_PKT_LEN, |
882 | SLAB_ATOMIC, &yld->ctl_dma); | 882 | GFP_ATOMIC, &yld->ctl_dma); |
883 | if (!yld->ctl_data) | 883 | if (!yld->ctl_data) |
884 | return usb_cleanup(yld, -ENOMEM); | 884 | return usb_cleanup(yld, -ENOMEM); |
885 | 885 | ||
886 | yld->ctl_req = usb_buffer_alloc(udev, sizeof(*(yld->ctl_req)), | 886 | yld->ctl_req = usb_buffer_alloc(udev, sizeof(*(yld->ctl_req)), |
887 | SLAB_ATOMIC, &yld->ctl_req_dma); | 887 | GFP_ATOMIC, &yld->ctl_req_dma); |
888 | if (yld->ctl_req == NULL) | 888 | if (yld->ctl_req == NULL) |
889 | return usb_cleanup(yld, -ENOMEM); | 889 | return usb_cleanup(yld, -ENOMEM); |
890 | 890 | ||
diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c index 9659c79e187e..371bf2b1197d 100644 --- a/drivers/usb/misc/phidgetkit.c +++ b/drivers/usb/misc/phidgetkit.c | |||
@@ -377,7 +377,7 @@ static void interfacekit_irq(struct urb *urb) | |||
377 | schedule_delayed_work(&kit->do_notify, 0); | 377 | schedule_delayed_work(&kit->do_notify, 0); |
378 | 378 | ||
379 | resubmit: | 379 | resubmit: |
380 | status = usb_submit_urb(urb, SLAB_ATOMIC); | 380 | status = usb_submit_urb(urb, GFP_ATOMIC); |
381 | if (status) | 381 | if (status) |
382 | err("can't resubmit intr, %s-%s/interfacekit0, status %d", | 382 | err("can't resubmit intr, %s-%s/interfacekit0, status %d", |
383 | kit->udev->bus->bus_name, | 383 | kit->udev->bus->bus_name, |
@@ -568,7 +568,7 @@ static int interfacekit_probe(struct usb_interface *intf, const struct usb_devic | |||
568 | 568 | ||
569 | kit->dev_no = -1; | 569 | kit->dev_no = -1; |
570 | kit->ifkit = ifkit; | 570 | kit->ifkit = ifkit; |
571 | kit->data = usb_buffer_alloc(dev, URB_INT_SIZE, SLAB_ATOMIC, &kit->data_dma); | 571 | kit->data = usb_buffer_alloc(dev, URB_INT_SIZE, GFP_ATOMIC, &kit->data_dma); |
572 | if (!kit->data) | 572 | if (!kit->data) |
573 | goto out; | 573 | goto out; |
574 | 574 | ||
diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c index 2bb4fa572bb7..5727e1ea2f91 100644 --- a/drivers/usb/misc/phidgetmotorcontrol.c +++ b/drivers/usb/misc/phidgetmotorcontrol.c | |||
@@ -151,7 +151,7 @@ static void motorcontrol_irq(struct urb *urb) | |||
151 | schedule_delayed_work(&mc->do_notify, 0); | 151 | schedule_delayed_work(&mc->do_notify, 0); |
152 | 152 | ||
153 | resubmit: | 153 | resubmit: |
154 | status = usb_submit_urb(urb, SLAB_ATOMIC); | 154 | status = usb_submit_urb(urb, GFP_ATOMIC); |
155 | if (status) | 155 | if (status) |
156 | dev_err(&mc->intf->dev, | 156 | dev_err(&mc->intf->dev, |
157 | "can't resubmit intr, %s-%s/motorcontrol0, status %d", | 157 | "can't resubmit intr, %s-%s/motorcontrol0, status %d", |
@@ -338,7 +338,7 @@ static int motorcontrol_probe(struct usb_interface *intf, const struct usb_devic | |||
338 | goto out; | 338 | goto out; |
339 | 339 | ||
340 | mc->dev_no = -1; | 340 | mc->dev_no = -1; |
341 | mc->data = usb_buffer_alloc(dev, URB_INT_SIZE, SLAB_ATOMIC, &mc->data_dma); | 341 | mc->data = usb_buffer_alloc(dev, URB_INT_SIZE, GFP_ATOMIC, &mc->data_dma); |
342 | if (!mc->data) | 342 | if (!mc->data) |
343 | goto out; | 343 | goto out; |
344 | 344 | ||
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 194065dbb51f..fb321864a92d 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -213,7 +213,7 @@ static struct urb *simple_alloc_urb ( | |||
213 | 213 | ||
214 | if (bytes < 0) | 214 | if (bytes < 0) |
215 | return NULL; | 215 | return NULL; |
216 | urb = usb_alloc_urb (0, SLAB_KERNEL); | 216 | urb = usb_alloc_urb (0, GFP_KERNEL); |
217 | if (!urb) | 217 | if (!urb) |
218 | return urb; | 218 | return urb; |
219 | usb_fill_bulk_urb (urb, udev, pipe, NULL, bytes, simple_callback, NULL); | 219 | usb_fill_bulk_urb (urb, udev, pipe, NULL, bytes, simple_callback, NULL); |
@@ -223,7 +223,7 @@ static struct urb *simple_alloc_urb ( | |||
223 | urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | 223 | urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; |
224 | if (usb_pipein (pipe)) | 224 | if (usb_pipein (pipe)) |
225 | urb->transfer_flags |= URB_SHORT_NOT_OK; | 225 | urb->transfer_flags |= URB_SHORT_NOT_OK; |
226 | urb->transfer_buffer = usb_buffer_alloc (udev, bytes, SLAB_KERNEL, | 226 | urb->transfer_buffer = usb_buffer_alloc (udev, bytes, GFP_KERNEL, |
227 | &urb->transfer_dma); | 227 | &urb->transfer_dma); |
228 | if (!urb->transfer_buffer) { | 228 | if (!urb->transfer_buffer) { |
229 | usb_free_urb (urb); | 229 | usb_free_urb (urb); |
@@ -315,7 +315,7 @@ static int simple_io ( | |||
315 | init_completion (&completion); | 315 | init_completion (&completion); |
316 | if (usb_pipeout (urb->pipe)) | 316 | if (usb_pipeout (urb->pipe)) |
317 | simple_fill_buf (urb); | 317 | simple_fill_buf (urb); |
318 | if ((retval = usb_submit_urb (urb, SLAB_KERNEL)) != 0) | 318 | if ((retval = usb_submit_urb (urb, GFP_KERNEL)) != 0) |
319 | break; | 319 | break; |
320 | 320 | ||
321 | /* NOTE: no timeouts; can't be broken out of by interrupt */ | 321 | /* NOTE: no timeouts; can't be broken out of by interrupt */ |
@@ -374,7 +374,7 @@ alloc_sglist (int nents, int max, int vary) | |||
374 | unsigned i; | 374 | unsigned i; |
375 | unsigned size = max; | 375 | unsigned size = max; |
376 | 376 | ||
377 | sg = kmalloc (nents * sizeof *sg, SLAB_KERNEL); | 377 | sg = kmalloc (nents * sizeof *sg, GFP_KERNEL); |
378 | if (!sg) | 378 | if (!sg) |
379 | return NULL; | 379 | return NULL; |
380 | 380 | ||
@@ -382,7 +382,7 @@ alloc_sglist (int nents, int max, int vary) | |||
382 | char *buf; | 382 | char *buf; |
383 | unsigned j; | 383 | unsigned j; |
384 | 384 | ||
385 | buf = kzalloc (size, SLAB_KERNEL); | 385 | buf = kzalloc (size, GFP_KERNEL); |
386 | if (!buf) { | 386 | if (!buf) { |
387 | free_sglist (sg, i); | 387 | free_sglist (sg, i); |
388 | return NULL; | 388 | return NULL; |
@@ -428,7 +428,7 @@ static int perform_sglist ( | |||
428 | (udev->speed == USB_SPEED_HIGH) | 428 | (udev->speed == USB_SPEED_HIGH) |
429 | ? (INTERRUPT_RATE << 3) | 429 | ? (INTERRUPT_RATE << 3) |
430 | : INTERRUPT_RATE, | 430 | : INTERRUPT_RATE, |
431 | sg, nents, 0, SLAB_KERNEL); | 431 | sg, nents, 0, GFP_KERNEL); |
432 | 432 | ||
433 | if (retval) | 433 | if (retval) |
434 | break; | 434 | break; |
@@ -819,7 +819,7 @@ error: | |||
819 | 819 | ||
820 | /* resubmit if we need to, else mark this as done */ | 820 | /* resubmit if we need to, else mark this as done */ |
821 | if ((status == 0) && (ctx->pending < ctx->count)) { | 821 | if ((status == 0) && (ctx->pending < ctx->count)) { |
822 | if ((status = usb_submit_urb (urb, SLAB_ATOMIC)) != 0) { | 822 | if ((status = usb_submit_urb (urb, GFP_ATOMIC)) != 0) { |
823 | dbg ("can't resubmit ctrl %02x.%02x, err %d", | 823 | dbg ("can't resubmit ctrl %02x.%02x, err %d", |
824 | reqp->bRequestType, reqp->bRequest, status); | 824 | reqp->bRequestType, reqp->bRequest, status); |
825 | urb->dev = NULL; | 825 | urb->dev = NULL; |
@@ -855,7 +855,7 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param) | |||
855 | * as with bulk/intr sglists, sglen is the queue depth; it also | 855 | * as with bulk/intr sglists, sglen is the queue depth; it also |
856 | * controls which subtests run (more tests than sglen) or rerun. | 856 | * controls which subtests run (more tests than sglen) or rerun. |
857 | */ | 857 | */ |
858 | urb = kcalloc(param->sglen, sizeof(struct urb *), SLAB_KERNEL); | 858 | urb = kcalloc(param->sglen, sizeof(struct urb *), GFP_KERNEL); |
859 | if (!urb) | 859 | if (!urb) |
860 | return -ENOMEM; | 860 | return -ENOMEM; |
861 | for (i = 0; i < param->sglen; i++) { | 861 | for (i = 0; i < param->sglen; i++) { |
@@ -981,7 +981,7 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param) | |||
981 | if (!u) | 981 | if (!u) |
982 | goto cleanup; | 982 | goto cleanup; |
983 | 983 | ||
984 | reqp = usb_buffer_alloc (udev, sizeof *reqp, SLAB_KERNEL, | 984 | reqp = usb_buffer_alloc (udev, sizeof *reqp, GFP_KERNEL, |
985 | &u->setup_dma); | 985 | &u->setup_dma); |
986 | if (!reqp) | 986 | if (!reqp) |
987 | goto cleanup; | 987 | goto cleanup; |
@@ -999,7 +999,7 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param) | |||
999 | context.urb = urb; | 999 | context.urb = urb; |
1000 | spin_lock_irq (&context.lock); | 1000 | spin_lock_irq (&context.lock); |
1001 | for (i = 0; i < param->sglen; i++) { | 1001 | for (i = 0; i < param->sglen; i++) { |
1002 | context.status = usb_submit_urb (urb [i], SLAB_ATOMIC); | 1002 | context.status = usb_submit_urb (urb [i], GFP_ATOMIC); |
1003 | if (context.status != 0) { | 1003 | if (context.status != 0) { |
1004 | dbg ("can't submit urb[%d], status %d", | 1004 | dbg ("can't submit urb[%d], status %d", |
1005 | i, context.status); | 1005 | i, context.status); |
@@ -1041,7 +1041,7 @@ static void unlink1_callback (struct urb *urb) | |||
1041 | 1041 | ||
1042 | // we "know" -EPIPE (stall) never happens | 1042 | // we "know" -EPIPE (stall) never happens |
1043 | if (!status) | 1043 | if (!status) |
1044 | status = usb_submit_urb (urb, SLAB_ATOMIC); | 1044 | status = usb_submit_urb (urb, GFP_ATOMIC); |
1045 | if (status) { | 1045 | if (status) { |
1046 | urb->status = status; | 1046 | urb->status = status; |
1047 | complete ((struct completion *) urb->context); | 1047 | complete ((struct completion *) urb->context); |
@@ -1067,7 +1067,7 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async) | |||
1067 | * FIXME want additional tests for when endpoint is STALLing | 1067 | * FIXME want additional tests for when endpoint is STALLing |
1068 | * due to errors, or is just NAKing requests. | 1068 | * due to errors, or is just NAKing requests. |
1069 | */ | 1069 | */ |
1070 | if ((retval = usb_submit_urb (urb, SLAB_KERNEL)) != 0) { | 1070 | if ((retval = usb_submit_urb (urb, GFP_KERNEL)) != 0) { |
1071 | dev_dbg (&dev->intf->dev, "submit fail %d\n", retval); | 1071 | dev_dbg (&dev->intf->dev, "submit fail %d\n", retval); |
1072 | return retval; | 1072 | return retval; |
1073 | } | 1073 | } |
@@ -1251,7 +1251,7 @@ static int ctrl_out (struct usbtest_dev *dev, | |||
1251 | if (length < 1 || length > 0xffff || vary >= length) | 1251 | if (length < 1 || length > 0xffff || vary >= length) |
1252 | return -EINVAL; | 1252 | return -EINVAL; |
1253 | 1253 | ||
1254 | buf = kmalloc(length, SLAB_KERNEL); | 1254 | buf = kmalloc(length, GFP_KERNEL); |
1255 | if (!buf) | 1255 | if (!buf) |
1256 | return -ENOMEM; | 1256 | return -ENOMEM; |
1257 | 1257 | ||
@@ -1403,7 +1403,7 @@ static struct urb *iso_alloc_urb ( | |||
1403 | maxp *= 1 + (0x3 & (le16_to_cpu(desc->wMaxPacketSize) >> 11)); | 1403 | maxp *= 1 + (0x3 & (le16_to_cpu(desc->wMaxPacketSize) >> 11)); |
1404 | packets = (bytes + maxp - 1) / maxp; | 1404 | packets = (bytes + maxp - 1) / maxp; |
1405 | 1405 | ||
1406 | urb = usb_alloc_urb (packets, SLAB_KERNEL); | 1406 | urb = usb_alloc_urb (packets, GFP_KERNEL); |
1407 | if (!urb) | 1407 | if (!urb) |
1408 | return urb; | 1408 | return urb; |
1409 | urb->dev = udev; | 1409 | urb->dev = udev; |
@@ -1411,7 +1411,7 @@ static struct urb *iso_alloc_urb ( | |||
1411 | 1411 | ||
1412 | urb->number_of_packets = packets; | 1412 | urb->number_of_packets = packets; |
1413 | urb->transfer_buffer_length = bytes; | 1413 | urb->transfer_buffer_length = bytes; |
1414 | urb->transfer_buffer = usb_buffer_alloc (udev, bytes, SLAB_KERNEL, | 1414 | urb->transfer_buffer = usb_buffer_alloc (udev, bytes, GFP_KERNEL, |
1415 | &urb->transfer_dma); | 1415 | &urb->transfer_dma); |
1416 | if (!urb->transfer_buffer) { | 1416 | if (!urb->transfer_buffer) { |
1417 | usb_free_urb (urb); | 1417 | usb_free_urb (urb); |
@@ -1481,7 +1481,7 @@ test_iso_queue (struct usbtest_dev *dev, struct usbtest_param *param, | |||
1481 | spin_lock_irq (&context.lock); | 1481 | spin_lock_irq (&context.lock); |
1482 | for (i = 0; i < param->sglen; i++) { | 1482 | for (i = 0; i < param->sglen; i++) { |
1483 | ++context.pending; | 1483 | ++context.pending; |
1484 | status = usb_submit_urb (urbs [i], SLAB_ATOMIC); | 1484 | status = usb_submit_urb (urbs [i], GFP_ATOMIC); |
1485 | if (status < 0) { | 1485 | if (status < 0) { |
1486 | ERROR (dev, "submit iso[%d], error %d\n", i, status); | 1486 | ERROR (dev, "submit iso[%d], error %d\n", i, status); |
1487 | if (i == 0) { | 1487 | if (i == 0) { |
@@ -1900,7 +1900,7 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id) | |||
1900 | } | 1900 | } |
1901 | #endif | 1901 | #endif |
1902 | 1902 | ||
1903 | dev = kzalloc(sizeof(*dev), SLAB_KERNEL); | 1903 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
1904 | if (!dev) | 1904 | if (!dev) |
1905 | return -ENOMEM; | 1905 | return -ENOMEM; |
1906 | info = (struct usbtest_info *) id->driver_info; | 1906 | info = (struct usbtest_info *) id->driver_info; |
@@ -1910,7 +1910,7 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id) | |||
1910 | dev->intf = intf; | 1910 | dev->intf = intf; |
1911 | 1911 | ||
1912 | /* cacheline-aligned scratch for i/o */ | 1912 | /* cacheline-aligned scratch for i/o */ |
1913 | if ((dev->buf = kmalloc (TBUF_SIZE, SLAB_KERNEL)) == NULL) { | 1913 | if ((dev->buf = kmalloc (TBUF_SIZE, GFP_KERNEL)) == NULL) { |
1914 | kfree (dev); | 1914 | kfree (dev); |
1915 | return -ENOMEM; | 1915 | return -ENOMEM; |
1916 | } | 1916 | } |
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c index 7a2346c53284..05cf2c9a8f84 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c | |||
@@ -50,7 +50,7 @@ struct mon_event_text { | |||
50 | 50 | ||
51 | #define SLAB_NAME_SZ 30 | 51 | #define SLAB_NAME_SZ 30 |
52 | struct mon_reader_text { | 52 | struct mon_reader_text { |
53 | kmem_cache_t *e_slab; | 53 | struct kmem_cache *e_slab; |
54 | int nevents; | 54 | int nevents; |
55 | struct list_head e_list; | 55 | struct list_head e_list; |
56 | struct mon_reader r; /* In C, parent class can be placed anywhere */ | 56 | struct mon_reader r; /* In C, parent class can be placed anywhere */ |
@@ -63,7 +63,7 @@ struct mon_reader_text { | |||
63 | char slab_name[SLAB_NAME_SZ]; | 63 | char slab_name[SLAB_NAME_SZ]; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | static void mon_text_ctor(void *, kmem_cache_t *, unsigned long); | 66 | static void mon_text_ctor(void *, struct kmem_cache *, unsigned long); |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * mon_text_submit | 69 | * mon_text_submit |
@@ -147,7 +147,7 @@ static void mon_text_event(struct mon_reader_text *rp, struct urb *urb, | |||
147 | stamp = mon_get_timestamp(); | 147 | stamp = mon_get_timestamp(); |
148 | 148 | ||
149 | if (rp->nevents >= EVENT_MAX || | 149 | if (rp->nevents >= EVENT_MAX || |
150 | (ep = kmem_cache_alloc(rp->e_slab, SLAB_ATOMIC)) == NULL) { | 150 | (ep = kmem_cache_alloc(rp->e_slab, GFP_ATOMIC)) == NULL) { |
151 | rp->r.m_bus->cnt_text_lost++; | 151 | rp->r.m_bus->cnt_text_lost++; |
152 | return; | 152 | return; |
153 | } | 153 | } |
@@ -188,7 +188,7 @@ static void mon_text_error(void *data, struct urb *urb, int error) | |||
188 | struct mon_event_text *ep; | 188 | struct mon_event_text *ep; |
189 | 189 | ||
190 | if (rp->nevents >= EVENT_MAX || | 190 | if (rp->nevents >= EVENT_MAX || |
191 | (ep = kmem_cache_alloc(rp->e_slab, SLAB_ATOMIC)) == NULL) { | 191 | (ep = kmem_cache_alloc(rp->e_slab, GFP_ATOMIC)) == NULL) { |
192 | rp->r.m_bus->cnt_text_lost++; | 192 | rp->r.m_bus->cnt_text_lost++; |
193 | return; | 193 | return; |
194 | } | 194 | } |
@@ -450,7 +450,7 @@ const struct file_operations mon_fops_text = { | |||
450 | /* | 450 | /* |
451 | * Slab interface: constructor. | 451 | * Slab interface: constructor. |
452 | */ | 452 | */ |
453 | static void mon_text_ctor(void *mem, kmem_cache_t *slab, unsigned long sflags) | 453 | static void mon_text_ctor(void *mem, struct kmem_cache *slab, unsigned long sflags) |
454 | { | 454 | { |
455 | /* | 455 | /* |
456 | * Nothing to initialize. No, really! | 456 | * Nothing to initialize. No, really! |
diff --git a/drivers/usb/net/catc.c b/drivers/usb/net/catc.c index 907b820a5faf..4852012735f6 100644 --- a/drivers/usb/net/catc.c +++ b/drivers/usb/net/catc.c | |||
@@ -345,7 +345,7 @@ static void catc_irq_done(struct urb *urb) | |||
345 | } | 345 | } |
346 | } | 346 | } |
347 | resubmit: | 347 | resubmit: |
348 | status = usb_submit_urb (urb, SLAB_ATOMIC); | 348 | status = usb_submit_urb (urb, GFP_ATOMIC); |
349 | if (status) | 349 | if (status) |
350 | err ("can't resubmit intr, %s-%s, status %d", | 350 | err ("can't resubmit intr, %s-%s, status %d", |
351 | catc->usbdev->bus->bus_name, | 351 | catc->usbdev->bus->bus_name, |
diff --git a/drivers/usb/net/net1080.c b/drivers/usb/net/net1080.c index a77410562e12..493635954513 100644 --- a/drivers/usb/net/net1080.c +++ b/drivers/usb/net/net1080.c | |||
@@ -383,7 +383,7 @@ static void nc_ensure_sync(struct usbnet *dev) | |||
383 | int status; | 383 | int status; |
384 | 384 | ||
385 | /* Send a flush */ | 385 | /* Send a flush */ |
386 | urb = usb_alloc_urb(0, SLAB_ATOMIC); | 386 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
387 | if (!urb) | 387 | if (!urb) |
388 | return; | 388 | return; |
389 | 389 | ||
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index b5690b3834e3..d48c024cff59 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
@@ -856,7 +856,7 @@ static void intr_callback(struct urb *urb) | |||
856 | pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4]; | 856 | pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4]; |
857 | } | 857 | } |
858 | 858 | ||
859 | status = usb_submit_urb(urb, SLAB_ATOMIC); | 859 | status = usb_submit_urb(urb, GFP_ATOMIC); |
860 | if (status == -ENODEV) | 860 | if (status == -ENODEV) |
861 | netif_device_detach(pegasus->net); | 861 | netif_device_detach(pegasus->net); |
862 | if (status && netif_msg_timer(pegasus)) | 862 | if (status && netif_msg_timer(pegasus)) |
diff --git a/drivers/usb/net/rndis_host.c b/drivers/usb/net/rndis_host.c index c2a28d88ef3c..99f26b3e502f 100644 --- a/drivers/usb/net/rndis_host.c +++ b/drivers/usb/net/rndis_host.c | |||
@@ -469,7 +469,7 @@ static void rndis_unbind(struct usbnet *dev, struct usb_interface *intf) | |||
469 | struct rndis_halt *halt; | 469 | struct rndis_halt *halt; |
470 | 470 | ||
471 | /* try to clear any rndis state/activity (no i/o from stack!) */ | 471 | /* try to clear any rndis state/activity (no i/o from stack!) */ |
472 | halt = kcalloc(1, sizeof *halt, SLAB_KERNEL); | 472 | halt = kcalloc(1, sizeof *halt, GFP_KERNEL); |
473 | if (halt) { | 473 | if (halt) { |
474 | halt->msg_type = RNDIS_MSG_HALT; | 474 | halt->msg_type = RNDIS_MSG_HALT; |
475 | halt->msg_len = ccpu2(sizeof *halt); | 475 | halt->msg_len = ccpu2(sizeof *halt); |
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c index 72171f94ded4..c54235f73cb6 100644 --- a/drivers/usb/net/rtl8150.c +++ b/drivers/usb/net/rtl8150.c | |||
@@ -587,7 +587,7 @@ static void intr_callback(struct urb *urb) | |||
587 | } | 587 | } |
588 | 588 | ||
589 | resubmit: | 589 | resubmit: |
590 | status = usb_submit_urb (urb, SLAB_ATOMIC); | 590 | status = usb_submit_urb (urb, GFP_ATOMIC); |
591 | if (status == -ENODEV) | 591 | if (status == -ENODEV) |
592 | netif_device_detach(dev->netdev); | 592 | netif_device_detach(dev->netdev); |
593 | else if (status) | 593 | else if (status) |
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index 327f97555679..6e39e9988259 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c | |||
@@ -179,9 +179,9 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf) | |||
179 | period = max ((int) dev->status->desc.bInterval, | 179 | period = max ((int) dev->status->desc.bInterval, |
180 | (dev->udev->speed == USB_SPEED_HIGH) ? 7 : 3); | 180 | (dev->udev->speed == USB_SPEED_HIGH) ? 7 : 3); |
181 | 181 | ||
182 | buf = kmalloc (maxp, SLAB_KERNEL); | 182 | buf = kmalloc (maxp, GFP_KERNEL); |
183 | if (buf) { | 183 | if (buf) { |
184 | dev->interrupt = usb_alloc_urb (0, SLAB_KERNEL); | 184 | dev->interrupt = usb_alloc_urb (0, GFP_KERNEL); |
185 | if (!dev->interrupt) { | 185 | if (!dev->interrupt) { |
186 | kfree (buf); | 186 | kfree (buf); |
187 | return -ENOMEM; | 187 | return -ENOMEM; |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 82cd15b894b0..70f93b18292f 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -363,7 +363,7 @@ static int mos7720_open(struct usb_serial_port *port, struct file * filp) | |||
363 | 363 | ||
364 | /* Initialising the write urb pool */ | 364 | /* Initialising the write urb pool */ |
365 | for (j = 0; j < NUM_URBS; ++j) { | 365 | for (j = 0; j < NUM_URBS; ++j) { |
366 | urb = usb_alloc_urb(0,SLAB_ATOMIC); | 366 | urb = usb_alloc_urb(0,GFP_ATOMIC); |
367 | mos7720_port->write_urb_pool[j] = urb; | 367 | mos7720_port->write_urb_pool[j] = urb; |
368 | 368 | ||
369 | if (urb == NULL) { | 369 | if (urb == NULL) { |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 02c89e10b2cf..5432c6340086 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -826,7 +826,7 @@ static int mos7840_open(struct usb_serial_port *port, struct file *filp) | |||
826 | 826 | ||
827 | /* Initialising the write urb pool */ | 827 | /* Initialising the write urb pool */ |
828 | for (j = 0; j < NUM_URBS; ++j) { | 828 | for (j = 0; j < NUM_URBS; ++j) { |
829 | urb = usb_alloc_urb(0, SLAB_ATOMIC); | 829 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
830 | mos7840_port->write_urb_pool[j] = urb; | 830 | mos7840_port->write_urb_pool[j] = urb; |
831 | 831 | ||
832 | if (urb == NULL) { | 832 | if (urb == NULL) { |
@@ -2786,7 +2786,7 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2786 | i + 1, status); | 2786 | i + 1, status); |
2787 | 2787 | ||
2788 | } | 2788 | } |
2789 | mos7840_port->control_urb = usb_alloc_urb(0, SLAB_ATOMIC); | 2789 | mos7840_port->control_urb = usb_alloc_urb(0, GFP_ATOMIC); |
2790 | mos7840_port->ctrl_buf = kmalloc(16, GFP_KERNEL); | 2790 | mos7840_port->ctrl_buf = kmalloc(16, GFP_KERNEL); |
2791 | 2791 | ||
2792 | } | 2792 | } |
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c index 3a158d58441f..e565d3d2ab29 100644 --- a/drivers/usb/storage/onetouch.c +++ b/drivers/usb/storage/onetouch.c | |||
@@ -76,7 +76,7 @@ static void usb_onetouch_irq(struct urb *urb) | |||
76 | input_sync(dev); | 76 | input_sync(dev); |
77 | 77 | ||
78 | resubmit: | 78 | resubmit: |
79 | status = usb_submit_urb (urb, SLAB_ATOMIC); | 79 | status = usb_submit_urb (urb, GFP_ATOMIC); |
80 | if (status) | 80 | if (status) |
81 | err ("can't resubmit intr, %s-%s/input0, status %d", | 81 | err ("can't resubmit intr, %s-%s/input0, status %d", |
82 | onetouch->udev->bus->bus_name, | 82 | onetouch->udev->bus->bus_name, |
@@ -154,7 +154,7 @@ int onetouch_connect_input(struct us_data *ss) | |||
154 | goto fail1; | 154 | goto fail1; |
155 | 155 | ||
156 | onetouch->data = usb_buffer_alloc(udev, ONETOUCH_PKT_LEN, | 156 | onetouch->data = usb_buffer_alloc(udev, ONETOUCH_PKT_LEN, |
157 | SLAB_ATOMIC, &onetouch->data_dma); | 157 | GFP_ATOMIC, &onetouch->data_dma); |
158 | if (!onetouch->data) | 158 | if (!onetouch->data) |
159 | goto fail1; | 159 | goto fail1; |
160 | 160 | ||
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 47644b5b6155..323293a3e61f 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -427,7 +427,7 @@ static int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe, | |||
427 | US_DEBUGP("%s: xfer %u bytes, %d entries\n", __FUNCTION__, | 427 | US_DEBUGP("%s: xfer %u bytes, %d entries\n", __FUNCTION__, |
428 | length, num_sg); | 428 | length, num_sg); |
429 | result = usb_sg_init(&us->current_sg, us->pusb_dev, pipe, 0, | 429 | result = usb_sg_init(&us->current_sg, us->pusb_dev, pipe, 0, |
430 | sg, num_sg, length, SLAB_NOIO); | 430 | sg, num_sg, length, GFP_NOIO); |
431 | if (result) { | 431 | if (result) { |
432 | US_DEBUGP("usb_sg_init returned %d\n", result); | 432 | US_DEBUGP("usb_sg_init returned %d\n", result); |
433 | return USB_STOR_XFER_ERROR; | 433 | return USB_STOR_XFER_ERROR; |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index b401084b3d22..70644506651f 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -49,7 +49,7 @@ | |||
49 | 49 | ||
50 | #include <linux/sched.h> | 50 | #include <linux/sched.h> |
51 | #include <linux/errno.h> | 51 | #include <linux/errno.h> |
52 | #include <linux/suspend.h> | 52 | #include <linux/freezer.h> |
53 | #include <linux/module.h> | 53 | #include <linux/module.h> |
54 | #include <linux/init.h> | 54 | #include <linux/init.h> |
55 | #include <linux/slab.h> | 55 | #include <linux/slab.h> |
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c index 0d3643fc6293..a454dcb8e215 100644 --- a/drivers/video/geode/gxfb_core.c +++ b/drivers/video/geode/gxfb_core.c | |||
@@ -380,7 +380,7 @@ static void gxfb_remove(struct pci_dev *pdev) | |||
380 | } | 380 | } |
381 | 381 | ||
382 | static struct pci_device_id gxfb_id_table[] = { | 382 | static struct pci_device_id gxfb_id_table[] = { |
383 | { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_VIDEO, | 383 | { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_GX_VIDEO, |
384 | PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16, | 384 | PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16, |
385 | 0xff0000, 0 }, | 385 | 0xff0000, 0 }, |
386 | { 0, } | 386 | { 0, } |
diff --git a/drivers/w1/Makefile b/drivers/w1/Makefile index 93845a2c7c21..6bb0b54965f2 100644 --- a/drivers/w1/Makefile +++ b/drivers/w1/Makefile | |||
@@ -2,10 +2,6 @@ | |||
2 | # Makefile for the Dallas's 1-wire bus. | 2 | # Makefile for the Dallas's 1-wire bus. |
3 | # | 3 | # |
4 | 4 | ||
5 | ifeq ($(CONFIG_W1_DS2433_CRC), y) | ||
6 | EXTRA_CFLAGS += -DCONFIG_W1_F23_CRC | ||
7 | endif | ||
8 | |||
9 | obj-$(CONFIG_W1) += wire.o | 5 | obj-$(CONFIG_W1) += wire.o |
10 | wire-objs := w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o | 6 | wire-objs := w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o |
11 | 7 | ||
diff --git a/drivers/w1/slaves/Makefile b/drivers/w1/slaves/Makefile index 70e21e2d70c3..725dcfdfddb4 100644 --- a/drivers/w1/slaves/Makefile +++ b/drivers/w1/slaves/Makefile | |||
@@ -2,10 +2,6 @@ | |||
2 | # Makefile for the Dallas's 1-wire slaves. | 2 | # Makefile for the Dallas's 1-wire slaves. |
3 | # | 3 | # |
4 | 4 | ||
5 | ifeq ($(CONFIG_W1_SLAVE_DS2433_CRC), y) | ||
6 | EXTRA_CFLAGS += -DCONFIG_W1_F23_CRC | ||
7 | endif | ||
8 | |||
9 | obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o | 5 | obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o |
10 | obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o | 6 | obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o |
11 | obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o | 7 | obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o |
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c index 2ac238f1480e..8ea17a53eed8 100644 --- a/drivers/w1/slaves/w1_ds2433.c +++ b/drivers/w1/slaves/w1_ds2433.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/device.h> | 13 | #include <linux/device.h> |
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #ifdef CONFIG_W1_F23_CRC | 16 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
17 | #include <linux/crc16.h> | 17 | #include <linux/crc16.h> |
18 | 18 | ||
19 | #define CRC16_INIT 0 | 19 | #define CRC16_INIT 0 |
@@ -62,7 +62,7 @@ static inline size_t w1_f23_fix_count(loff_t off, size_t count, size_t size) | |||
62 | return count; | 62 | return count; |
63 | } | 63 | } |
64 | 64 | ||
65 | #ifdef CONFIG_W1_F23_CRC | 65 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
66 | static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data, | 66 | static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data, |
67 | int block) | 67 | int block) |
68 | { | 68 | { |
@@ -89,13 +89,13 @@ static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data, | |||
89 | 89 | ||
90 | return 0; | 90 | return 0; |
91 | } | 91 | } |
92 | #endif /* CONFIG_W1_F23_CRC */ | 92 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
93 | 93 | ||
94 | static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, | 94 | static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, |
95 | size_t count) | 95 | size_t count) |
96 | { | 96 | { |
97 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 97 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
98 | #ifdef CONFIG_W1_F23_CRC | 98 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
99 | struct w1_f23_data *data = sl->family_data; | 99 | struct w1_f23_data *data = sl->family_data; |
100 | int i, min_page, max_page; | 100 | int i, min_page, max_page; |
101 | #else | 101 | #else |
@@ -107,7 +107,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, | |||
107 | 107 | ||
108 | mutex_lock(&sl->master->mutex); | 108 | mutex_lock(&sl->master->mutex); |
109 | 109 | ||
110 | #ifdef CONFIG_W1_F23_CRC | 110 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
111 | 111 | ||
112 | min_page = (off >> W1_PAGE_BITS); | 112 | min_page = (off >> W1_PAGE_BITS); |
113 | max_page = (off + count - 1) >> W1_PAGE_BITS; | 113 | max_page = (off + count - 1) >> W1_PAGE_BITS; |
@@ -119,7 +119,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, | |||
119 | } | 119 | } |
120 | memcpy(buf, &data->memory[off], count); | 120 | memcpy(buf, &data->memory[off], count); |
121 | 121 | ||
122 | #else /* CONFIG_W1_F23_CRC */ | 122 | #else /* CONFIG_W1_SLAVE_DS2433_CRC */ |
123 | 123 | ||
124 | /* read directly from the EEPROM */ | 124 | /* read directly from the EEPROM */ |
125 | if (w1_reset_select_slave(sl)) { | 125 | if (w1_reset_select_slave(sl)) { |
@@ -133,7 +133,7 @@ static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, | |||
133 | w1_write_block(sl->master, wrbuf, 3); | 133 | w1_write_block(sl->master, wrbuf, 3); |
134 | w1_read_block(sl->master, buf, count); | 134 | w1_read_block(sl->master, buf, count); |
135 | 135 | ||
136 | #endif /* CONFIG_W1_F23_CRC */ | 136 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
137 | 137 | ||
138 | out_up: | 138 | out_up: |
139 | mutex_unlock(&sl->master->mutex); | 139 | mutex_unlock(&sl->master->mutex); |
@@ -208,7 +208,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, | |||
208 | if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0) | 208 | if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0) |
209 | return 0; | 209 | return 0; |
210 | 210 | ||
211 | #ifdef CONFIG_W1_F23_CRC | 211 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
212 | /* can only write full blocks in cached mode */ | 212 | /* can only write full blocks in cached mode */ |
213 | if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) { | 213 | if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) { |
214 | dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n", | 214 | dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n", |
@@ -223,7 +223,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, | |||
223 | return -EINVAL; | 223 | return -EINVAL; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | #endif /* CONFIG_W1_F23_CRC */ | 226 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
227 | 227 | ||
228 | mutex_lock(&sl->master->mutex); | 228 | mutex_lock(&sl->master->mutex); |
229 | 229 | ||
@@ -262,7 +262,7 @@ static struct bin_attribute w1_f23_bin_attr = { | |||
262 | static int w1_f23_add_slave(struct w1_slave *sl) | 262 | static int w1_f23_add_slave(struct w1_slave *sl) |
263 | { | 263 | { |
264 | int err; | 264 | int err; |
265 | #ifdef CONFIG_W1_F23_CRC | 265 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
266 | struct w1_f23_data *data; | 266 | struct w1_f23_data *data; |
267 | 267 | ||
268 | data = kmalloc(sizeof(struct w1_f23_data), GFP_KERNEL); | 268 | data = kmalloc(sizeof(struct w1_f23_data), GFP_KERNEL); |
@@ -271,24 +271,24 @@ static int w1_f23_add_slave(struct w1_slave *sl) | |||
271 | memset(data, 0, sizeof(struct w1_f23_data)); | 271 | memset(data, 0, sizeof(struct w1_f23_data)); |
272 | sl->family_data = data; | 272 | sl->family_data = data; |
273 | 273 | ||
274 | #endif /* CONFIG_W1_F23_CRC */ | 274 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
275 | 275 | ||
276 | err = sysfs_create_bin_file(&sl->dev.kobj, &w1_f23_bin_attr); | 276 | err = sysfs_create_bin_file(&sl->dev.kobj, &w1_f23_bin_attr); |
277 | 277 | ||
278 | #ifdef CONFIG_W1_F23_CRC | 278 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
279 | if (err) | 279 | if (err) |
280 | kfree(data); | 280 | kfree(data); |
281 | #endif /* CONFIG_W1_F23_CRC */ | 281 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
282 | 282 | ||
283 | return err; | 283 | return err; |
284 | } | 284 | } |
285 | 285 | ||
286 | static void w1_f23_remove_slave(struct w1_slave *sl) | 286 | static void w1_f23_remove_slave(struct w1_slave *sl) |
287 | { | 287 | { |
288 | #ifdef CONFIG_W1_F23_CRC | 288 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
289 | kfree(sl->family_data); | 289 | kfree(sl->family_data); |
290 | sl->family_data = NULL; | 290 | sl->family_data = NULL; |
291 | #endif /* CONFIG_W1_F23_CRC */ | 291 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
292 | sysfs_remove_bin_file(&sl->dev.kobj, &w1_f23_bin_attr); | 292 | sysfs_remove_bin_file(&sl->dev.kobj, &w1_f23_bin_attr); |
293 | } | 293 | } |
294 | 294 | ||
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index de3e9791f80d..63c07243993c 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/sched.h> | 32 | #include <linux/sched.h> |
33 | #include <linux/kthread.h> | 33 | #include <linux/kthread.h> |
34 | #include <linux/freezer.h> | ||
34 | 35 | ||
35 | #include <asm/atomic.h> | 36 | #include <asm/atomic.h> |
36 | 37 | ||