Beispiel #1
0
int cycx_setup(cycxhw_t *hw, void *cfm, u32 len)
{
	unsigned long dpmbase = hw->dpmbase;
	int err;

	/* Verify IRQ configuration options */
	if (!get_option_index(cycx_2x_irq_options, hw->irq)) {
		printk(KERN_ERR "%s: IRQ %d is illegal!\n", modname, hw->irq);
		return -EINVAL;
	} 

	/* Setup adapter dual-port memory window and test memory */
	if (!hw->dpmbase) {
		printk(KERN_ERR "%s: you must specify the dpm address!\n",
				modname);
 		return -EINVAL;
	} else if (!get_option_index(cyc2x_dpmbase_options, hw->dpmbase)) {
		printk(KERN_ERR "%s: memory address 0x%lX is illegal!\n",
				modname, dpmbase);
		return -EINVAL;
	}

	hw->dpmbase = (u32)ioremap(dpmbase, CYCX_WINDOWSIZE);
	hw->dpmsize = CYCX_WINDOWSIZE;

	if (!detect_cyc2x(hw->dpmbase)) {
		printk(KERN_ERR "%s: adapter Cyclom 2X not found at "
				"address 0x%lX!\n", modname, dpmbase);
		return -EINVAL;
	}

	printk(KERN_INFO "%s: found Cyclom 2X card at address 0x%lX.\n",
			 modname, dpmbase);

	/* Load firmware. If loader fails then shut down adapter */
	err = load_cyc2x(hw, cfm, len);

	if (err)
		cycx_down(hw);         /* shutdown adapter */

	return err;
} 
int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len, unsigned long dpmbase)
{
	int err;

	/* Verify IRQ configuration options */
	if (!get_option_index(cycx_2x_irq_options, hw->irq)) {
		pr_err("IRQ %d is invalid!\n", hw->irq);
		return -EINVAL;
	}

	/* Setup adapter dual-port memory window and test memory */
	if (!dpmbase) {
		pr_err("you must specify the dpm address!\n");
		return -EINVAL;
	} else if (!get_option_index(cyc2x_dpmbase_options, dpmbase)) {
		pr_err("memory address 0x%lX is invalid!\n", dpmbase);
		return -EINVAL;
	}

	hw->dpmbase = ioremap(dpmbase, CYCX_WINDOWSIZE);
	hw->dpmsize = CYCX_WINDOWSIZE;

	if (!detect_cyc2x(hw->dpmbase)) {
		pr_err("adapter Cyclom 2X not found at address 0x%lX!\n",
		       dpmbase);
		return -EINVAL;
	}

	pr_info("found Cyclom 2X card at address 0x%lX\n", dpmbase);

	/* Load firmware. If loader fails then shut down adapter */
	err = load_cyc2x(hw, cfm, len);

	if (err)
		cycx_down(hw);         /* shutdown adapter */

	return err;
}