Skip to contentSkip to conversation

2.4.19-rc2-ac2 pdc202xx.c update

PATCH support 3 participants 5 messages Jul 22, 2002 – Jul 23, 2002 1 message not in the archive

lore
Share & tools
lore

support

author
#1 lore raw
In reply to a message not in the archive

Giro,

Yes, It's 2.4.18 + patch-2.4.19-rc2 + patch-2.4.19-rc2-ac2 + promise-patch-2.4.19-rc2-ac2.

Sorry, In ide.c (line-918) lack a '{' sign.c

Quoted 2 lines

drivers/ide/idedriver.o(.text+0x3b37): undefined reference to `pdc202xx_marvell_idle'

Sorry, You must not enable CONFIG_BLK_DEV_PDC202XX
Or append follows will be okay.
ide.c (line-172)
#ifdef CONFIG_BLK_DEV_PDC202XX
extern int pdc202xx_marvell_idle (ide_drive_t *);/* needed below -- Promise */
#endif

ide.c (line-918)
if (GET_STAT() & (BUSY_STAT|DRQ_STAT)) {
#ifdef CONFIG_BLK_DEV_PDC202XX
/* Give a breath for Idle Immediate by Promise */
if (HWIF(drive)->pci_devid.vid == PCI_VENDOR_ID_PROMISE)
pdc202xx_marvell_idle(drive);
else
#endif
OUT_BYTE(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG); /* force an abort */
}

Alan or Marcelo, Would you please help us to update above issue? Thanks.

Francois,

We don't occur Oops you said, Please check your patch rule again.

--
Promise Technology, Inc

#2 lore raw

support <[email protected]> :
[...]

Quoted 1 line

We don't occur Oops you said, Please check your patch rule again.

There's a side effect with your macro. Let's expand it:

+#define set_2regs(a, b) \
+ OUT_BYTE((a + adj), indexreg); \
+ OUT_BYTE(b, datareg);
[...]
+ if (speed == XFER_UDMA_2)
+ set_2regs(thold, (IN_BYTE(datareg) & 0x7f));

	if (speed == XFER_UDMA_2)
		OUT_BYTE((thold + adj), indexreg);
	OUT_BYTE((IN_BYTE(datareg) & 0x7f), datareg);

Do you see the problem ?

Signature · 1 line
Ueimor
author
#3 lore raw

We think there is no problems, Acturally it is

if (speed == XFER_UDMA_2) {
        OUT_BYTE((thold + adj), indexreg);
        OUT_BYTE((IN_BYTE(datareg) & 0x7f), datareg);
}

So,
if (speed == XFER_UDMA_2)

        set_2regs(thold, (IN_BYTE(datareg) & 0x7f));

--
Promise Technology, Inc

#4 lore raw

support <[email protected]> :

Quoted 10 lines

We think there is no problems, Acturally it is

if (speed == XFER_UDMA_2) {
        OUT_BYTE((thold + adj), indexreg);
        OUT_BYTE((IN_BYTE(datareg) & 0x7f), datareg);
}

So,
if (speed == XFER_UDMA_2)

        set_2regs(thold, (IN_BYTE(datareg) & 0x7f));

set_2regs() is a macro. Macro have side effects.

Before the change, assuming speed != XFER_UDMA_2

if (speed == XFER_UDMA_2) {
	OUT_BYTE((thold + adj), indexreg); 		<- not executed
	OUT_BYTE((IN_BYTE(datareg) & 0x7f), datareg);	<- not executed
}

-> the block isn't executed

After the change, the code is:

if (speed == XFER_UDMA_2)
OUT_BYTE((thold + adj), indexreg); <- not executed
OUT_BYTE((IN_BYTE(datareg) & 0x7f), datareg); <- executed, damn it !

-> only the first statement of the macro is executed.

Put a pair of {} after the "if", a "do {...} while (0)" in the macro declaration. Please, please, think about it a few minutes.

Signature · 1 line
Ueimor
#5 lore raw
Quoted 8 lines · Francois Romieu

support <[email protected]> :

Quoted 1 line

We think there is no problems,

After the change, the code is:

if (speed == XFER_UDMA_2)
OUT_BYTE((thold + adj), indexreg); <- not executed
OUT_BYTE((IN_BYTE(datareg) & 0x7f), datareg); <- executed, damn it !

I have one more question. Is it really immaterial on the line above in which order 'datareg' occurences are used? Regardless of what 'OUT_BYTE' is now or may become in the future and how these macro are used? It looks to me that we are trying to read some byte from 'datareg', clear a bit in it and write it back but looks can be deceptive. It may turn out that this does or does not work on a particular compiler whim.

Maybe it is ok now but beeing explicit in a macro definition does not really cost anything and may save some future grief.

Michal