Re: [PATCH v2 2/3] ata: pata_falcon: add data_swab option to byte-swap disk data

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

 



Hi Finn,

On Fri, Aug 18, 2023 at 9:43 AM Finn Thain <fthain@xxxxxxxxxxxxxx> wrote:
On Fri, 18 Aug 2023, Michael Schmitz wrote:
Some users of pata_falcon on Q40 have IDE disks in default
IDE little endian byte order, whereas legacy disks use
host-native big-endian byte order as on the Atari Falcon.

Add module parameter 'data_swab' to allow connecting drives
with non-native data byte order. Drives selected by the
data_swap bit mask will have their user data byte-swapped to
host byte order, i.e. 'pata_falcon.data_swab=2' will byte-swap
all user data on drive B, leaving data on drive A in native
byte order. On Q40, drives on a second IDE interface may be
added to the bit mask as bits 2 and 3.

Default setting is no byte swapping, i.e. compatibility with
the native Falcon or Q40 operating system disk format.

Cc: William R Sowerbutts <will@xxxxxxxxxxxxxx>
Cc: Finn Thain <fthain@xxxxxxxxxxxxxx>
Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Signed-off-by: Michael Schmitz <schmitzmic@xxxxxxxxx>

--- a/drivers/ata/pata_falcon.c
+++ b/drivers/ata/pata_falcon.c
@@ -199,6 +205,8 @@ static int __init pata_falcon_init_one(struct platform_device *pdev)
      ap->ioaddr.altstatus_addr       = ctl_base + io_offset;
      ap->ioaddr.ctl_addr             = ctl_base + io_offset;

+     ap->private_data = (void *)(uintptr_t)(pata_falcon_swap_mask >> (2 * pdev->id));
+

My compiler doesn't need that extra type cast in there...

Because it's a 32-bit compiler ;-)
With a 64-bit compiler, you would get

    warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]

Alternatively, you can change pata_falcon_swap_mask from int to long.


      irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
      if (irq_res && irq_res->start > 0) {
              irq = irq_res->start;



Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux