~ubuntu-branches/ubuntu/trusty/linux-linaro-omap/trusty

« back to all changes in this revision

Viewing changes to drivers/scsi/mvsas/mv_init.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-57i0gl3v99b3lkfg
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *
4
4
 * Copyright 2007 Red Hat, Inc.
5
5
 * Copyright 2008 Marvell. <kewei@marvell.com>
 
6
 * Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
6
7
 *
7
8
 * This file is licensed under GPLv2.
8
9
 *
25
26
 
26
27
#include "mv_sas.h"
27
28
 
 
29
static int lldd_max_execute_num = 1;
 
30
module_param_named(collector, lldd_max_execute_num, int, S_IRUGO);
 
31
MODULE_PARM_DESC(collector, "\n"
 
32
        "\tIf greater than one, tells the SAS Layer to run in Task Collector\n"
 
33
        "\tMode.  If 1 or 0, tells the SAS Layer to run in Direct Mode.\n"
 
34
        "\tThe mvsas SAS LLDD supports both modes.\n"
 
35
        "\tDefault: 1 (Direct Mode).\n");
 
36
 
28
37
static struct scsi_transport_template *mvs_stt;
 
38
struct kmem_cache *mvs_task_list_cache;
29
39
static const struct mvs_chip_info mvs_chips[] = {
30
40
        [chip_6320] =   { 1, 2, 0x400, 17, 16,  9, &mvs_64xx_dispatch, },
31
41
        [chip_6440] =   { 1, 4, 0x400, 17, 16,  9, &mvs_64xx_dispatch, },
32
42
        [chip_6485] =   { 1, 8, 0x800, 33, 32, 10, &mvs_64xx_dispatch, },
33
43
        [chip_9180] =   { 2, 4, 0x800, 17, 64,  9, &mvs_94xx_dispatch, },
34
44
        [chip_9480] =   { 2, 4, 0x800, 17, 64,  9, &mvs_94xx_dispatch, },
 
45
        [chip_9445] =   { 1, 4, 0x800, 17, 64, 11, &mvs_94xx_dispatch, },
 
46
        [chip_9485] =   { 2, 4, 0x800, 17, 64, 11, &mvs_94xx_dispatch, },
35
47
        [chip_1300] =   { 1, 4, 0x400, 17, 16,  9, &mvs_64xx_dispatch, },
36
48
        [chip_1320] =   { 2, 4, 0x800, 17, 64,  9, &mvs_94xx_dispatch, },
37
49
};
107
119
 
108
120
static void mvs_free(struct mvs_info *mvi)
109
121
{
110
 
        int i;
111
122
        struct mvs_wq *mwq;
112
123
        int slot_nr;
113
124
 
119
130
        else
120
131
                slot_nr = MVS_SLOTS;
121
132
 
122
 
        for (i = 0; i < mvi->tags_num; i++) {
123
 
                struct mvs_slot_info *slot = &mvi->slot_info[i];
124
 
                if (slot->buf)
125
 
                        dma_free_coherent(mvi->dev, MVS_SLOT_BUF_SZ,
126
 
                                          slot->buf, slot->buf_dma);
127
 
        }
 
133
        if (mvi->dma_pool)
 
134
                pci_pool_destroy(mvi->dma_pool);
128
135
 
129
136
        if (mvi->tx)
130
137
                dma_free_coherent(mvi->dev,
213
220
static int __devinit mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost)
214
221
{
215
222
        int i = 0, slot_nr;
 
223
        char pool_name[32];
216
224
 
217
225
        if (mvi->flags & MVF_FLAG_SOC)
218
226
                slot_nr = MVS_SOC_SLOTS;
272
280
        if (!mvi->bulk_buffer)
273
281
                goto err_out;
274
282
#endif
275
 
        for (i = 0; i < slot_nr; i++) {
276
 
                struct mvs_slot_info *slot = &mvi->slot_info[i];
277
 
 
278
 
                slot->buf = dma_alloc_coherent(mvi->dev, MVS_SLOT_BUF_SZ,
279
 
                                               &slot->buf_dma, GFP_KERNEL);
280
 
                if (!slot->buf) {
281
 
                        printk(KERN_DEBUG"failed to allocate slot->buf.\n");
 
283
        sprintf(pool_name, "%s%d", "mvs_dma_pool", mvi->id);
 
284
        mvi->dma_pool = pci_pool_create(pool_name, mvi->pdev, MVS_SLOT_BUF_SZ, 16, 0);
 
285
        if (!mvi->dma_pool) {
 
286
                        printk(KERN_DEBUG "failed to create dma pool %s.\n", pool_name);
282
287
                        goto err_out;
283
 
                }
284
 
                memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
285
 
                ++mvi->tags_num;
286
288
        }
 
289
        mvi->tags_num = slot_nr;
 
290
 
287
291
        /* Initialize tags */
288
292
        mvs_tag_init(mvi);
289
293
        return 0;
484
488
 
485
489
        sha->num_phys = nr_core * chip_info->n_phy;
486
490
 
487
 
        sha->lldd_max_execute_num = 1;
 
491
        sha->lldd_max_execute_num = lldd_max_execute_num;
488
492
 
489
493
        if (mvi->flags & MVF_FLAG_SOC)
490
494
                can_queue = MVS_SOC_CAN_QUEUE;
670
674
        { PCI_VDEVICE(TTI, 0x2740), chip_9480 },
671
675
        { PCI_VDEVICE(TTI, 0x2744), chip_9480 },
672
676
        { PCI_VDEVICE(TTI, 0x2760), chip_9480 },
 
677
        {
 
678
                .vendor         = 0x1b4b,
 
679
                .device         = 0x9445,
 
680
                .subvendor      = PCI_ANY_ID,
 
681
                .subdevice      = 0x9480,
 
682
                .class          = 0,
 
683
                .class_mask     = 0,
 
684
                .driver_data    = chip_9445,
 
685
        },
 
686
        {
 
687
                .vendor         = 0x1b4b,
 
688
                .device         = 0x9485,
 
689
                .subvendor      = PCI_ANY_ID,
 
690
                .subdevice      = 0x9480,
 
691
                .class          = 0,
 
692
                .class_mask     = 0,
 
693
                .driver_data    = chip_9485,
 
694
        },
673
695
 
674
696
        { }     /* terminate list */
675
697
};
690
712
        if (!mvs_stt)
691
713
                return -ENOMEM;
692
714
 
 
715
        mvs_task_list_cache = kmem_cache_create("mvs_task_list", sizeof(struct mvs_task_list),
 
716
                                                         0, SLAB_HWCACHE_ALIGN, NULL);
 
717
        if (!mvs_task_list_cache) {
 
718
                rc = -ENOMEM;
 
719
                mv_printk("%s: mvs_task_list_cache alloc failed! \n", __func__);
 
720
                goto err_out;
 
721
        }
 
722
 
693
723
        rc = pci_register_driver(&mvs_pci_driver);
694
724
 
695
725
        if (rc)
706
736
{
707
737
        pci_unregister_driver(&mvs_pci_driver);
708
738
        sas_release_transport(mvs_stt);
 
739
        kmem_cache_destroy(mvs_task_list_cache);
709
740
}
710
741
 
711
742
module_init(mvs_init);