⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ips.c

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 C
📖 第 1 页 / 共 5 页
字号:
               mem_addr = dev[i]->resource[j].start;               mem_len = dev[i]->resource[j].end - dev[i]->resource[j].start + 1;            }#else            if (!dev[i]->base_address[j])               break;            if ((dev[i]->base_address[j] & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) {               barnum = PCI_BASE_ADDRESS_0 + (j * 4);               io_addr = dev[i]->base_address[j] & PCI_BASE_ADDRESS_IO_MASK;               /* Get Size */               pci_read_config_dword(dev[i], barnum, &currbar);               pci_write_config_dword(dev[i], barnum, ~0);               pci_read_config_dword(dev[i], barnum, &maskbar);               pci_write_config_dword(dev[i], barnum, currbar);               io_len = ~(maskbar & PCI_BASE_ADDRESS_IO_MASK) + 1;            } else {               barnum = PCI_BASE_ADDRESS_0 + (j * 4);               mem_addr = dev[i]->base_address[j] & PCI_BASE_ADDRESS_MEM_MASK;               /* Get Size */               pci_read_config_dword(dev[i], barnum, &currbar);               pci_write_config_dword(dev[i], barnum, ~0);               pci_read_config_dword(dev[i], barnum, &maskbar);               pci_write_config_dword(dev[i], barnum, currbar);               mem_len = ~(maskbar & PCI_BASE_ADDRESS_MEM_MASK) + 1;            }#endif         }         /* setup memory mapped area (if applicable) */         if (mem_addr) {            u_int32_t base;            u_int32_t offs;            DEBUG_VAR(1, "(%s%d) detect, Memory region %x, size: %d",                      ips_name, ips_next_controller, mem_addr, mem_len);#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,17)            if (check_mem_region(mem_addr, mem_len)) {               /* Couldn't allocate io space */               printk(KERN_WARNING "(%s%d) couldn't allocate IO space %x len %d.\n",                      ips_name, ips_next_controller, io_addr, io_len);               ips_next_controller++;               continue;            }            request_mem_region(mem_addr, mem_len, "ips");#endif            base = mem_addr & PAGE_MASK;            offs = mem_addr - base;            ioremap_ptr = ioremap(base, PAGE_SIZE);            mem_ptr = ioremap_ptr + offs;         } else {            ioremap_ptr = NULL;            mem_ptr = NULL;         }         /* setup I/O mapped area (if applicable) */         if (io_addr) {            DEBUG_VAR(1, "(%s%d) detect, IO region %x, size: %d",                      ips_name, ips_next_controller, io_addr, io_len);            if (check_region(io_addr, io_len)) {               /* Couldn't allocate io space */               printk(KERN_WARNING "(%s%d) couldn't allocate IO space %x len %d.\n",                      ips_name, ips_next_controller, io_addr, io_len);               ips_next_controller++;               continue;            }            request_region(io_addr, io_len, "ips");         }         /* get planer status */         if (pci_read_config_word(dev[i], 0x04, &planer)) {            printk(KERN_WARNING "(%s%d) can't get planer status.\n",                   ips_name, ips_next_controller);            ips_next_controller++;            continue;         }         /* check to see if an onboard planer controller is disabled */         if (!(planer & 0x000C)) {            DEBUG_VAR(1, "(%s%d) detect, Onboard ServeRAID disabled by BIOS",                      ips_name, ips_next_controller);            ips_next_controller++;            continue;         }         DEBUG_VAR(1, "(%s%d) detect bus %d, func %x, irq %d, io %x, mem: %x, ptr: %p",                   ips_name, ips_next_controller, bus, func, irq, io_addr, mem_addr, mem_ptr);         /* get the revision ID */         if (pci_read_config_byte(dev[i], PCI_REVISION_ID, &revision_id)) {            printk(KERN_WARNING "(%s%d) can't get revision id.\n",                   ips_name, ips_next_controller);            ips_next_controller++;            continue;         }#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,15)         /* get the subdevice id */         if (pci_read_config_word(dev[i], PCI_SUBSYSTEM_ID, &subdevice_id)) {            printk(KERN_WARNING "(%s%d) can't get subdevice id.\n",                   ips_name, ips_next_controller);            ips_next_controller++;            continue;         }#else         subdevice_id = dev[i]->subsystem_device;#endif         /* found a controller */         sh = scsi_register(SHT, sizeof(ips_ha_t));         if (sh == NULL) {            printk(KERN_WARNING "(%s%d) Unable to register controller with SCSI subsystem - skipping controller\n",                   ips_name, ips_next_controller);            ips_next_controller++;            continue;         }         ha = IPS_HA(sh);         memset(ha, 0, sizeof(ips_ha_t));         /* Initialize spin lock */         spin_lock_init(&ha->scb_lock);         spin_lock_init(&ha->copp_lock);         spin_lock_init(&ha->ips_lock);         spin_lock_init(&ha->copp_waitlist.lock);         spin_lock_init(&ha->scb_waitlist.lock);         spin_lock_init(&ha->scb_activelist.lock);         ips_sh[ips_next_controller] = sh;         ips_ha[ips_next_controller] = ha;         ips_num_controllers++;         ha->active = 1;         ha->enq = kmalloc(sizeof(IPS_ENQ), GFP_KERNEL);         if (!ha->enq) {            printk(KERN_WARNING "(%s%d) Unable to allocate host inquiry structure - skipping contoller\n",                   ips_name, ips_next_controller);            ha->active = 0;            ips_free(ha);            scsi_unregister(sh);            ips_ha[ips_next_controller] = 0;            ips_sh[ips_next_controller] = 0;            ips_next_controller++;            ips_num_controllers--;            continue;         }         ha->adapt = kmalloc(sizeof(IPS_ADAPTER), GFP_KERNEL);         if (!ha->adapt) {            printk(KERN_WARNING "(%s%d) Unable to allocate host adapt structure - skipping controller\n",                   ips_name, ips_next_controller);            ha->active = 0;            ips_free(ha);            scsi_unregister(sh);            ips_ha[ips_next_controller] = 0;            ips_sh[ips_next_controller] = 0;            ips_next_controller++;            ips_num_controllers--;            continue;         }         ha->conf = kmalloc(sizeof(IPS_CONF), GFP_KERNEL);         if (!ha->conf) {            printk(KERN_WARNING "(%s%d) Unable to allocate host conf structure - skipping controller\n",                   ips_name, ips_next_controller);            ha->active = 0;            ips_free(ha);            scsi_unregister(sh);            ips_ha[ips_next_controller] = 0;            ips_sh[ips_next_controller] = 0;            ips_next_controller++;            ips_num_controllers--;            continue;         }         ha->nvram = kmalloc(sizeof(IPS_NVRAM_P5), GFP_KERNEL);         if (!ha->nvram) {            printk(KERN_WARNING "(%s%d) Unable to allocate host nvram structure - skipping controller\n",                   ips_name, ips_next_controller);            ha->active = 0;            ips_free(ha);            scsi_unregister(sh);            ips_ha[ips_next_controller] = 0;            ips_sh[ips_next_controller] = 0;            ips_next_controller++;            ips_num_controllers--;            continue;         }         ha->subsys = kmalloc(sizeof(IPS_SUBSYS), GFP_KERNEL);         if (!ha->subsys) {            printk(KERN_WARNING "(%s%d) Unable to allocate host subsystem structure - skipping controller\n",                   ips_name, ips_next_controller);            ha->active = 0;            ips_free(ha);            scsi_unregister(sh);            ips_ha[ips_next_controller] = 0;            ips_sh[ips_next_controller] = 0;            ips_next_controller++;            ips_num_controllers--;            continue;         }         ha->dummy = kmalloc(sizeof(IPS_IO_CMD), GFP_KERNEL);         if (!ha->dummy) {            printk(KERN_WARNING "(%s%d) Unable to allocate host dummy structure - skipping controller\n",                   ips_name, ips_next_controller);            ha->active = 0;            ips_free(ha);            scsi_unregister(sh);            ips_ha[ips_next_controller] = 0;            ips_sh[ips_next_controller] = 0;            ips_next_controller++;            ips_num_controllers--;            continue;         }         for (count = PAGE_SIZE, ha->ioctl_order = 0;              count < ips_ioctlsize;              ha->ioctl_order++, count <<= 1);         ha->ioctl_data = (char *) __get_free_pages(GFP_KERNEL, ha->ioctl_order);         ha->ioctl_datasize = count;         if (!ha->ioctl_data) {            printk(KERN_WARNING "(%s%d) Unable to allocate ioctl data\n",                   ips_name, ips_next_controller);            ha->ioctl_data = NULL;            ha->ioctl_order = 0;            ha->ioctl_datasize = 0;         }         /* Store away needed values for later use */         sh->io_port = io_addr;         sh->n_io_port = io_addr ? 255 : 0;         sh->unique_id = (io_addr) ? io_addr : mem_addr;         sh->irq = irq;         sh->select_queue_depths = ips_select_queue_depth;         sh->sg_tablesize = sh->hostt->sg_tablesize;         sh->can_queue = sh->hostt->can_queue;         sh->cmd_per_lun = sh->hostt->cmd_per_lun;         sh->unchecked_isa_dma = sh->hostt->unchecked_isa_dma;         sh->use_clustering = sh->hostt->use_clustering;#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,7)         sh->max_sectors = 128;#endif#if LINUX_VERSION_CODE < LinuxVersionCode(2,3,32)         sh->wish_block = FALSE;#endif         /* Store info in HA structure */         ha->irq = irq;         ha->io_addr = io_addr;         ha->io_len = io_len;         ha->mem_addr = mem_addr;         ha->mem_len = mem_len;         ha->mem_ptr = mem_ptr;         ha->ioremap_ptr = ioremap_ptr;         ha->host_num = ips_next_controller;         ha->revision_id = revision_id;         ha->slot_num = PCI_SLOT(dev[i]->devfn);         ha->device_id = deviceID[i];         ha->subdevice_id = subdevice_id;         ha->pcidev = dev[i];         /*          * Setup Functions          */         if (IPS_IS_MORPHEUS(ha)) {            /* morpheus */            ha->func.isintr = ips_isintr_morpheus;            ha->func.isinit = ips_isinit_morpheus;            ha->func.issue = ips_issue_i2o_memio;            ha->func.init = ips_init_morpheus;            ha->func.statupd = ips_statupd_morpheus;            ha->func.reset = ips_reset_morpheus;            ha->func.intr = ips_intr_morpheus;            ha->func.enableint = ips_enable_int_morpheus;         } else if (IPS_USE_MEMIO(ha)) {            /* copperhead w/MEMIO */            ha->func.isintr = ips_isintr_copperhead_memio;            ha->func.isinit = ips_isinit_copperhead_memio;            ha->func.init = ips_init_copperhead_memio;            ha->func.statupd = ips_statupd_copperhead_memio;            ha->func.statinit = ips_statinit_memio;            ha->func.reset = ips_reset_copperhead_memio;            ha->func.intr = ips_intr_copperhead;            ha->func.erasebios = ips_erase_bios_memio;            ha->func.programbios = ips_program_bios_memio;            ha->func.verifybios = ips_verify_bios_memio;            ha->func.enableint = ips_enable_int_copperhead_memio;            if (IPS_USE_I2O_DELIVER(ha))               ha->func.issue = ips_issue_i2o_memio;            else               ha->func.issue = ips_issue_copperhead_memio;         } else {            /* copperhead */            ha->func.isintr = ips_isintr_copperhead;            ha->func.isinit = ips_isinit_copperhead;            ha->func.init = ips_init_copperhead;            ha->func.statupd = ips_statupd_copperhead;            ha->func.statinit = ips_statinit;            ha->func.reset = ips_reset_copperhead;            ha->func.intr = ips_intr_copperhead;            ha->func.erasebios = ips_erase_bios;            ha->func.programbios = ips_program_bios;            ha->func.verifybios = ips_verify_bios;            ha->func.enableint = ips_enable_int_copperhead;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -