From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-ide@vger.kernel.org, bob@evoria.net,
nabble@theanthonys.net, alan@lxorguk.ukuu.org.uk,
matthias@urlichs.de, romieu@fr.zoreil.com,
carlosmarcelomartinez@gmail.com
Subject: Re: [PATCH 2/2] sata_inic162x: driver for initio 162x SATA controllers, take 2
Date: Wed, 03 Jan 2007 17:18:02 +0900 [thread overview]
Message-ID: <459B66BA.2010405@gmail.com> (raw)
In-Reply-To: <45899560.8090401@pobox.com>
Jeff Garzik wrote:
>> + * - ATA disks work.
>> + * - Hotplug works.
>> + * - ATAPI read works but burning doesn't. This thing is really
>> + * peculiar about ATAPI and I couldn't figure out how ATAPI PIO and
>> + * ATAPI DMA WRITE should be programmed. If you've got a clue, be
>> + * my guest.
>> + * - Both STR and STD work.
>
> Do everyday users get a sane error, or something bad like a lockup, when
> trying to ATAPI write?
It will simply fail. No lock up.
>> +struct inic_port_priv {
>> + u8 dfl_prdctl, cached_prdctl;
>
>> + u8 cached_pirq_mask;
>
> apply standard struct style:
>
> 1) one struct member per line
> 2) indent between type and member name
Okay.
>> +static void set_pirq_mask(struct ata_port *ap, u8 mask)
>> +{
>> + struct inic_port_priv *pp = ap->private_data;
>> +
>> + if (pp->cached_pirq_mask != mask)
>> + __set_pirq_mask(ap, mask);
>> +}
>
>
> You should either flush here, or in the one case you need it, ->thaw
Still dazed and scared about those flushes. Will add it to ->freeze and
->thaw.
>> +static u32 inic_scr_read(struct ata_port *ap, unsigned sc_reg)
>> +{
>> + void __iomem *scr_addr = (void __iomem *)ap->ioaddr.scr_addr;
>> + if (sc_reg < ARRAY_SIZE(scr_map)) {
>> + void __iomem *addr;
>> + u32 val;
>> +
>> + addr = scr_addr + scr_map[sc_reg] * 4;
>> + val = readl(scr_addr + scr_map[sc_reg] * 4);
>> +
>> + /* this controller has stuck DIAG.N, ignore it */
>> + if (sc_reg == SCR_ERROR)
>> + val &= ~SERR_PHYRDY_CHG;
>> + return val;
>> + }
>> + return 0xffffffffU;
>> +}
>
> style: the main body of code should not be indented.
>
> more appropriate:
>
> if (unlikely(sc_reg >= ARRAY_SIZE(scr_map)))
> return 0xffffffffU;
> ...
>
> Or perhaps audit the code and ensure that the core never calls with an
> SCR index greater than 2 (SCR_CONTROL), and then add
>
> BUG_ON(sc_ref > SCR_CONTROL);
I'll take the first option for the time being.
>> +static void inic_error_handler(struct ata_port *ap)
>> +{
>> + void __iomem *port_base = get_port_base(ap);
>> + struct inic_port_priv *pp = ap->private_data;
>> + unsigned long flags;
>> +
>> + /* reset PIO HSM and stop DMA engine */
>> + reset_port(port_base);
>
> This function name is a bit too generic, and more difficult to narrow
> down to the single driver when viewed in an oops stack trace
Will add inic_ prefixes.
>> +static void inic_dev_config(struct ata_port *ap, struct ata_device *dev)
>> +{
>> + /* inic can only handle upto LBA28 max sectors */
>> + if (dev->max_sectors > ATA_MAX_SECTORS)
>> + dev->max_sectors = ATA_MAX_SECTORS;
>> +}
>
> why is this needed? scsi host template should take care of this, right?
No, not really. This is the only and correct place to configure max
sectors. We do 'blk_queue_max_sectors(sdev->request_queue,
dev->max_sectors)' unconditionally during slave_config().
Thanks.
--
tejun
next prev parent reply other threads:[~2007-01-03 8:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-17 1:48 [PATCH 1/2] libata: kill qc->nsect and cursect Tejun Heo
2006-12-17 1:50 ` [PATCH 2/2] sata_inic162x: finally, driver for initio 162x SATA controllers Tejun Heo
2006-12-17 12:24 ` Alan
2006-12-18 0:04 ` Tejun Heo
2006-12-18 0:25 ` Bob Stewart
2006-12-20 6:21 ` sata_inic162x driver for 2.6.19 Tejun Heo
2006-12-21 0:06 ` Bob Stewart
2006-12-21 1:48 ` Bob Stewart
2006-12-21 4:16 ` Bob Stewart
2007-01-10 23:34 ` Richard Purdie
2007-01-11 0:04 ` Alan
2007-01-11 2:00 ` Bob Stewart
2006-12-20 6:25 ` [PATCH 2/2] sata_inic162x: driver for initio 162x SATA controllers, take 2 Tejun Heo
2006-12-20 19:56 ` Jeff Garzik
2007-01-03 8:18 ` Tejun Heo [this message]
2007-01-03 8:30 ` [PATCH 1/2] libata: kill qc->nsect and cursect Tejun Heo
2007-01-03 8:32 ` [PATCH 2/2] sata_inic162x: finally, driver for initio 162x SATA controllers, take #2 Tejun Heo
2007-01-20 0:04 ` Jeff Garzik
2007-01-20 0:04 ` [PATCH 1/2] libata: kill qc->nsect and cursect Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=459B66BA.2010405@gmail.com \
--to=htejun@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=bob@evoria.net \
--cc=carlosmarcelomartinez@gmail.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=matthias@urlichs.de \
--cc=nabble@theanthonys.net \
--cc=romieu@fr.zoreil.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).