A question about right-shift in ahci_port_start()
Hi, Jeff
When reading ahci_port_start(), I found the
following code segments:
.......
if (hpriv->cap & HOST_CAP_64)
writel((pp->cmd_slot_dma >> 16) >> 16, port_mmio +
PORT_LST_ADDR_HI);
writel(pp->cmd_slot_dma & 0xffffffff, port_mmio +PORT_LST_ADDR);
readl(port_mmio + PORT_LST_ADDR); /* flush */
......
I can't figure out why you use ">>16>>16" instead of ">>32" for right-shift 32 bits.
Would you please give me some hint?
Thanks,
Forrest
Quoted 10 lines · forrest
Hi, Jeff
When reading
ahci_port_start(), I found the
following code segments:.......
if (hpriv->cap&HOST_CAP_64)writel((pp->cmd_slot_dma >> 16) >> 16, port_mmio + PORT_LST_ADDR_HI); writel(pp->cmd_slot_dma & 0xffffffff, port_mmio +
Quoted 7 lines
PORT_LST_ADDR);
readl(port_mmio + PORT_LST_ADDR); /* flush */
......I can't figure out why you use ">>16>>16" instead of ">>32" for right-shift 32 bits.
dma_addr_t is 32bits on some architectures and C hates when you do 32 bit shift to 32bit variable.
$ cat test.c #include <sys/types.h>
int main(void)
{
u_int32_t t = 1234;
t = t >> 32;
return 0;
}$ gcc test.c test.c: In function 'main': test.c:6: warning: right shift count >= width of type
Signature · 1 line
tejun