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

📄 sym53c8xx_comm.h

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 H
📖 第 1 页 / 共 5 页
字号:
		}		p = ep;	}	return DEF_DEPTH;}/*===================================================================****	Print out information about driver configuration.****===================================================================*/static void __init ncr_print_driver_setup(void){#define YesNo(y)	y ? 'y' : 'n'	printk (NAME53C8XX ": setup=disc:%c,specf:%d,tags:%d,sync:%d,"		"burst:%d,wide:%c,diff:%d,revprob:%c,buschk:0x%x\n",		YesNo(driver_setup.disconnection),		driver_setup.special_features,		driver_setup.default_tags,		driver_setup.default_sync,		driver_setup.burst_max,		YesNo(driver_setup.max_wide),		driver_setup.diff_support,		YesNo(driver_setup.reverse_probe),		driver_setup.bus_check);	printk (NAME53C8XX ": setup=mpar:%c,spar:%c,fsn=%c,verb:%d,debug:0x%x,"		"led:%c,settle:%d,irqm:0x%x,nvram:0x%x,pcifix:0x%x\n",		YesNo(driver_setup.master_parity),		YesNo(driver_setup.scsi_parity),		YesNo(driver_setup.force_sync_nego),		driver_setup.verbose,		driver_setup.debug,		YesNo(driver_setup.led_pin),		driver_setup.settle_delay,		driver_setup.irqm,		driver_setup.use_nvram,		driver_setup.pci_fix_up);#undef YesNo}/*===================================================================****   SYM53C8XX devices description table.****===================================================================*/static ncr_chip	ncr_chip_table[] __initdata	= SCSI_NCR_CHIP_TABLE;#ifdef	SCSI_NCR_PQS_PDS_SUPPORT/*===================================================================****    Detect all NCR PQS/PDS boards and keep track of their bus nr.****    The NCR PQS or PDS card is constructed as a DEC bridge**    behind which sit a proprietary NCR memory controller and**    four or two 53c875s as separate devices.  In its usual mode**    of operation, the 875s are slaved to the memory controller**    for all transfers.  We can tell if an 875 is part of a**    PQS/PDS or not since if it is, it will be on the same bus**    as the memory controller.  To operate with the Linux**    driver, the memory controller is disabled and the 875s**    freed to function independently.  The only wrinkle is that**    the preset SCSI ID (which may be zero) must be read in from**    a special configuration space register of the 875.****===================================================================*/#define	SCSI_NCR_MAX_PQS_BUS	16static int pqs_bus[SCSI_NCR_MAX_PQS_BUS] __initdata = { 0 };static void __init ncr_detect_pqs_pds(void){	short index;	pcidev_t dev = PCIDEV_NULL;	for(index=0; index < SCSI_NCR_MAX_PQS_BUS; index++) {		u_char tmp;		dev = pci_find_device(0x101a, 0x0009, dev);		if (dev == PCIDEV_NULL) {			pqs_bus[index] = -1;			break;		}		printk(KERN_INFO NAME53C8XX ": NCR PQS/PDS memory controller detected on bus %d\n", PciBusNumber(dev));		pci_read_config_byte(dev, 0x44, &tmp);		/* bit 1: allow individual 875 configuration */		tmp |= 0x2;		pci_write_config_byte(dev, 0x44, tmp);		pci_read_config_byte(dev, 0x45, &tmp);		/* bit 2: drive individual 875 interrupts to the bus */		tmp |= 0x4;		pci_write_config_byte(dev, 0x45, tmp);		pqs_bus[index] = PciBusNumber(dev);	}}#endif /* SCSI_NCR_PQS_PDS_SUPPORT *//*===================================================================****   Read and check the PCI configuration for any detected NCR **   boards and save data for attaching after all boards have **   been detected.****===================================================================*/static int __initsym53c8xx_pci_init(Scsi_Host_Template *tpnt, pcidev_t pdev, ncr_device *device){	u_short vendor_id, device_id, command;	u_char cache_line_size, latency_timer;	u_char suggested_cache_line_size = 0;	u_char pci_fix_up = driver_setup.pci_fix_up;	u_char revision;	u_int irq;	u_long base, base_c, base_2, base_2_c, io_port; 	int i;	ncr_chip *chip;	printk(KERN_INFO NAME53C8XX ": at PCI bus %d, device %d, function %d\n",		PciBusNumber(pdev),		(int) (PciDeviceFn(pdev) & 0xf8) >> 3,		(int) (PciDeviceFn(pdev) & 7));#ifdef SCSI_NCR_DYNAMIC_DMA_MAPPING	if (!pci_dma_supported(pdev, 0xffffffff)) {		printk(KERN_WARNING NAME53C8XX		       "32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n");		return -1;	}#endif	/*	**    Read info from the PCI config space.	**    pci_read_config_xxx() functions are assumed to be used for 	**    successfully detected PCI devices.	*/	vendor_id = PciVendorId(pdev);	device_id = PciDeviceId(pdev);	irq	  = PciIrqLine(pdev);	i = pci_get_base_address(pdev, 0, &io_port);	io_port = pci_get_base_cookie(pdev, 0);	base_c = pci_get_base_cookie(pdev, i);	i = pci_get_base_address(pdev, i, &base);	base_2_c = pci_get_base_cookie(pdev, i);	(void) pci_get_base_address(pdev, i, &base_2);	pci_read_config_word(pdev, PCI_COMMAND,		&command);	pci_read_config_byte(pdev, PCI_CLASS_REVISION,	&revision);	pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE,	&cache_line_size);	pci_read_config_byte(pdev, PCI_LATENCY_TIMER,	&latency_timer);#ifdef SCSI_NCR_PQS_PDS_SUPPORT	/*	**    Match the BUS number for PQS/PDS devices.	**    Read the SCSI ID from a special register mapped	**    into the configuration space of the individual	**    875s.  This register is set up by the PQS bios	*/	for(i = 0; i < SCSI_NCR_MAX_PQS_BUS && pqs_bus[i] != -1; i++) {		u_char tmp;		if (pqs_bus[i] == PciBusNumber(pdev)) {			pci_read_config_byte(pdev, 0x84, &tmp);			device->pqs_pds = 1;			device->host_id = tmp;			break;		}	}#endif /* SCSI_NCR_PQS_PDS_SUPPORT */	/*	**	If user excludes this chip, donnot initialize it.	*/	for (i = 0 ; i < SCSI_NCR_MAX_EXCLUDES ; i++) {		if (driver_setup.excludes[i] ==				(io_port & PCI_BASE_ADDRESS_IO_MASK))			return -1;	}	/*	**    Check if the chip is supported	*/	if ((device_id == PCI_DEVICE_ID_LSI_53C1010) ||			(device_id == PCI_DEVICE_ID_LSI_53C1010_66)){		printk(NAME53C8XX ": not initializing, device not supported\n");		return -1;	}	chip = 0;	for (i = 0; i < sizeof(ncr_chip_table)/sizeof(ncr_chip_table[0]); i++) {		if (device_id != ncr_chip_table[i].device_id)			continue;		if (revision > ncr_chip_table[i].revision_id)			continue;		chip = &device->chip;		memcpy(chip, &ncr_chip_table[i], sizeof(*chip));		chip->revision_id = revision;		break;	}	/*	**	Ignore Symbios chips controlled by SISL RAID controller.	**	This controller sets value 0x52414944 at RAM end - 16.	*/#if defined(__i386__) && !defined(SCSI_NCR_PCI_MEM_NOT_SUPPORTED)	if (chip && (base_2_c & PCI_BASE_ADDRESS_MEM_MASK)) {		unsigned int ram_size, ram_val;		u_long ram_ptr;		if (chip->features & FE_RAM8K)			ram_size = 8192;		else			ram_size = 4096;		ram_ptr = remap_pci_mem(base_2_c & PCI_BASE_ADDRESS_MEM_MASK,					ram_size);		if (ram_ptr) {			ram_val = readl_raw(ram_ptr + ram_size - 16);			unmap_pci_mem(ram_ptr, ram_size);			if (ram_val == 0x52414944) {				printk(NAME53C8XX": not initializing, "				       "driven by SISL RAID controller.\n");				return -1;			}		}	}#endif /* i386 and PCI MEMORY accessible */	if (!chip) {		printk(NAME53C8XX ": not initializing, device not supported\n");		return -1;	}#ifdef __powerpc__	/*	**	Fix-up for power/pc.	**	Should not be performed by the driver.	*/	if ((command & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY))		    != (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {		printk(NAME53C8XX ": setting%s%s...\n",		(command & PCI_COMMAND_IO)     ? "" : " PCI_COMMAND_IO",		(command & PCI_COMMAND_MEMORY) ? "" : " PCI_COMMAND_MEMORY");		command |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY);		pci_write_config_word(pdev, PCI_COMMAND, command);	}#if LINUX_VERSION_CODE < LinuxVersionCode(2,2,0)	if ( is_prep ) {		if (io_port >= 0x10000000) {			printk(NAME53C8XX ": reallocating io_port (Wacky IBM)");			io_port = (io_port & 0x00FFFFFF) | 0x01000000;			pci_write_config_dword(pdev,					       PCI_BASE_ADDRESS_0, io_port);		}		if (base >= 0x10000000) {			printk(NAME53C8XX ": reallocating base (Wacky IBM)");			base = (base & 0x00FFFFFF) | 0x01000000;			pci_write_config_dword(pdev,					       PCI_BASE_ADDRESS_1, base);		}		if (base_2 >= 0x10000000) {			printk(NAME53C8XX ": reallocating base2 (Wacky IBM)");			base_2 = (base_2 & 0x00FFFFFF) | 0x01000000;			pci_write_config_dword(pdev,					       PCI_BASE_ADDRESS_2, base_2);		}	}#endif#endif	/* __powerpc__ */#if defined(__i386__) && !defined(MODULE)	if (!cache_line_size) {#if LINUX_VERSION_CODE < LinuxVersionCode(2,1,75)		extern char x86;		switch(x86) {#else		switch(boot_cpu_data.x86) {#endif		case 4:	suggested_cache_line_size = 4; break;		case 6:		case 5:	suggested_cache_line_size = 8; break;		}	}#endif	/* __i386__ */	/*	**    Check availability of IO space, memory space.	**    Enable master capability if not yet.	**	**    We shouldn't have to care about the IO region when 	**    we are using MMIO. But calling check_region() from 	**    both the ncr53c8xx and the sym53c8xx drivers prevents 	**    from attaching devices from the both drivers.	**    If you have a better idea, let me know.	*//* #ifdef SCSI_NCR_IOMAPPED */#if 1	if (!(command & PCI_COMMAND_IO)) { 		printk(NAME53C8XX ": I/O base address (0x%lx) disabled.\n",			(long) io_port);		io_port = 0;	}#endif	if (!(command & PCI_COMMAND_MEMORY)) {		printk(NAME53C8XX ": PCI_COMMAND_MEMORY not set.\n");		base	= 0;		base_2	= 0;	}	io_port &= PCI_BASE_ADDRESS_IO_MASK;	base	&= PCI_BASE_ADDRESS_MEM_MASK;	base_2	&= PCI_BASE_ADDRESS_MEM_MASK;/* #ifdef SCSI_NCR_IOMAPPED */#if 1	if (io_port && check_region (io_port, 128)) {		printk(NAME53C8XX ": IO region 0x%lx[0..127] is in use\n",			(long) io_port);		io_port = 0;	}	if (!io_port)		return -1;#endif#ifndef SCSI_NCR_IOMAPPED	if (!base) {		printk(NAME53C8XX ": MMIO base address disabled.\n");		return -1;	}#endif/* The ncr53c8xx driver never did set the PCI parity bit.	*//* Since setting this bit is known to trigger spurious MDPE	*//* errors on some 895 controllers when noise on power lines is	*//* too high, I donnot want to change previous ncr53c8xx driver	*//* behaviour on that point (the sym53c8xx driver set this bit).	*/#if 0	/*	**    Set MASTER capable and PARITY bit, if not yet.	*/	if ((command & (PCI_COMMAND_MASTER | PCI_COMMAND_PARITY))		     != (PCI_COMMAND_MASTER | PCI_COMMAND_PARITY)) {		printk(NAME53C8XX ": setting%s%s...(fix-up)\n",		(command & PCI_COMMAND_MASTER) ? "" : " PCI_COMMAND_MASTER",		(command & PCI_COMMAND_PARITY) ? "" : " PCI_COMMAND_PARITY");		command |= (PCI_COMMAND_MASTER | PCI_COMMAND_PARITY);		pci_write_config_word(pdev, PCI_COMMAND, command);	}#else	/*	**    Set MASTER capable if not yet.	*/	if ((command & PCI_COMMAND_MASTER) != PCI_COMMAND_MASTER) {		printk(NAME53C8XX ": setting PCI_COMMAND_MASTER...(fix-up)\n");		command |= PCI_COMMAND_MASTER;		pci_write_config_word(pdev, PCI_COMMAND, command);	}#endif	/*	**    Fix some features according to driver setup.	*/	if (!(driver_setup.special_features & 1))		chip->features &= ~FE_SPECIAL_SET;	else {		if (driver_setup.special_features & 2)			chip->features &= ~FE_WRIE;		if (driver_setup.special_features & 4)			chip->features &= ~FE_NOPM;	}	/*	**	Some features are required to be enabled in order to 	**	work around some chip problems. :) ;)	**	(ITEM 12 of a DEL about the 896 I haven't yet).	**	We must ensure the chip will use WRITE AND INVALIDATE.	**	The revision number limit is for now arbitrary.	*/	if (device_id == PCI_DEVICE_ID_NCR_53C896 && revision <= 0x10) {		chip->features	|= (FE_WRIE | FE_CLSE);		pci_fix_up	|=  3;	/* Force appropriate PCI fix-up */	}#ifdef	SCSI_NCR_PCI_FIX_UP_SUPPORT	/*	**    Try to fix up PCI config according to wished features.	*/	if ((pci_fix_up & 1) && (chip->features & FE_CLSE) && 	    !cache_line_size && suggested_cache_line_size) {		cache_line_size = suggested_cache_line_size;		pci_write_config_byte(pdev,				      PCI_CACHE_LINE_SIZE, cache_line_size);		printk(NAME53C8XX ": PCI_CACHE_LINE_SIZE set to %d (fix-up).\n",			cache_line_size);	}	if ((pci_fix_up & 2) && cache_line_size &&	    (chip->features & FE_WRIE) && !(command & PCI_COMMAND_INVALIDATE)) {		printk(NAME53C8XX": setting PCI_COMMAND_INVALIDATE (fix-up)\n");		command |= PCI_COMMAND_INVALIDATE;		pci_write_config_word(pdev, PCI_COMMAND, command);	}	/*	**    Tune PCI LATENCY TIMER according to burst max length transfer.	**    (latency timer >= burst length + 6, we add 10 to be quite sure)	*/	if (chip->burst_max && (latency_timer == 0 || (pci_fix_up & 4))) {		u_char lt = (1 << chip->burst_max) + 6 + 10;		if (latency_timer < lt) {			printk(NAME53C8XX 			       ": changing PCI_LATENCY_TIMER from %d to %d.\n",			       (int) latency_timer, (int) lt);			latency_timer = lt;			pci_write_config_byte(pdev,					      PCI_LATENCY_TIMER, latency_timer);		}	}#endif	/* SCSI_NCR_PCI_FIX_UP_SUPPORT */ 	/*	**    Initialise ncr_device structure with items required by ncr_attach.	*/	device->pdev		= pdev;	device->slot.bus	= PciBusNumber(pdev);	device->slot.device_fn	= PciDeviceFn(pdev);	device->slot.base	= base;	device->slot.base_2	= base_2;	device->slot.base_c	= base_c;	device->slot.base_2_c	= base_2_c;	device->slot.io_port	= io_port;	device->slot.irq	= irq;	device->attach_done	= 0;	return 0;}/*===================================================================****    Detect all 53c8xx hosts and then attach them.****    If we are using NVRAM, once all hosts are detected, we need to **    check any NVRAM for boot order in case detect and boot order **    differ and attach them using the order in the NVRAM.****    If no NVRAM is found or data appears invalid attach boards in **    the the order they are detected.****===================================================================*/static int __init sym53c8xx__detect(Scsi_Host_Template *tpnt, u_short ncr_chip_ids[], int chips){	pcidev_t pcidev;	int i, j, hosts, count;	int attach_count = 0;	ncr_device *devtbl, *devp;#ifdef SCSI_NCR_NVRAM_SUPPORT	ncr_nvram  nvram0, nvram, *nvp;#endif	/*	**    PCI is required.	*/	if (!pci_present())		return 0;#ifdef SCSI_NCR_DEBUG_INFO_SUPPORT	ncr_debug = driver_setup.debug;#endif	if (initverbose >= 2)		ncr_print_driver_setup();	/*	**	Allocate the device table since we donnot want to 	**	overflow the kernel stack.	**	1 x 4K PAGE is enough for more than 40 devices for i386.	*/	devtbl = m_calloc(PAGE_SIZE, "devtbl");	if (!devtbl)		return 0;	/*	**    Detect all NCR PQS/PDS memory controllers.	*/#ifdef	SCSI_NCR_PQS_PDS_SUPPORT	ncr_detect_pqs_pds();#endif	/* 	**    Detect all 53c8xx hosts.	**    Save the first Symbios NVRAM content if any 	**    for the boot order.	*/	hosts	= PAGE_SIZE		/ sizeof(*devtbl);#ifdef SCSI_NCR_NVRAM_SUPPORT	nvp = (driver_setup.use_nvram & 0x1) ? &nvram0 : 0;#endif	j = 0;	count = 0;	pcidev = PCIDEV_NULL;	while (1) {		char *msg = "";		if (count >= hosts)			break;		if (j >= chips)			break;		i = driver_setup.reverse_probe ? chips - 1 - j : j;		pcidev = pci_find_device(PCI_VENDOR_ID_NCR, nc

⌨️ 快捷键说明

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