Re: [git patches] IDE updates (part 2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 13 October 2007, Alan Cox wrote:
> > Comment in pmac_ide_init_hwif_ports() is highly misleading as this function
> > returns early only for "normal" IDE PCI devices (pmac_ide_init_hwif_ports()
> > can be called outside ide-pmac driver through ppc_ide_md).
> 
> Follow the code you pasted
> 
> > 	pmif->regbase = (unsigned long) base + 0x2000;
> > ...
> > 	rc = pmac_ide_setup_device(pmif, hwif);
> 
> Ok so regbase is set
> 
> > ...
> > }
> > 
> > static int
> > pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
> > {
> > ...
> > 	pmac_ide_init_hwif_ports(&hwif->hw, pmif->regbase, 0, &hwif->irq);
> 
> Now we pass a honking great zero for the ctrl_port
> > ...
> > }
> > 
> > void
> > pmac_ide_init_hwif_ports(hw_regs_t *hw,
> > 			      unsigned long data_port, unsigned long ctrl_port,
> > 			      int *irq)
> > {
> > ...
> > 	for (ix = 0; ix < MAX_HWIFS; ++ix)

this loop is a tricky part, regbase is set so we break out early

> > 		if (data_port == pmac_ide[ix].regbase)
> > 			break;
> > ---> since pmif->regbase was set earlier ix will be < MAX_HWIFS
                                             ^^^^^^^^^^^^^^^^^^^^^^
> > 	if (ix >= MAX_HWIFS) {
            ^^^^^^^^^^^^^^^
> > 		/* Probably a PCI interface... */
> > 		for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; ++i)
> > 			hw->io_ports[i] = data_port + i - IDE_DATA_OFFSET;
> > 		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
> 
> Which is zero..
> 
> 
> See the problem ?
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux