floppy: prepare ARM code to simplify base address separation

The fd_outb() macro on ARM relies on a special fd_setdor() macro when
the register is FD_DOR and both will need to be changed to accept a
separate base address. Let's just remerge them to simplify the change
and make this code more easily reviewable.

Link: https://lore.kernel.org/r/20200301195555.11154-4-w@1wt.eu
Cc: Ian Molton <spyro@f2s.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Willy Tarreau 2020-03-01 20:55:52 +01:00 committed by Jens Axboe
parent 336eae3733
commit fc0c5c0c85

View File

@ -9,12 +9,17 @@
#ifndef __ASM_ARM_FLOPPY_H #ifndef __ASM_ARM_FLOPPY_H
#define __ASM_ARM_FLOPPY_H #define __ASM_ARM_FLOPPY_H
#define fd_outb(val,port) \ #define fd_outb(val,port) \
do { \ do { \
if ((port) == (u32)FD_DOR) \ int new_val = (val); \
fd_setdor((val)); \ if ((port) == (u32)FD_DOR) { \
else \ if (new_val & 0xf0) \
outb((val),(port)); \ new_val = (new_val & 0x0c) | \
floppy_selects[new_val & 3]; \
else \
new_val &= 0x0c; \
} \
outb(new_val, (port)); \
} while(0) } while(0)
#define fd_inb(port) inb((port)) #define fd_inb(port) inb((port))
@ -52,16 +57,6 @@ static inline int fd_dma_setup(void *data, unsigned int length,
*/ */
static unsigned char floppy_selects[4] = { 0x10, 0x21, 0x23, 0x33 }; static unsigned char floppy_selects[4] = { 0x10, 0x21, 0x23, 0x33 };
#define fd_setdor(dor) \
do { \
int new_dor = (dor); \
if (new_dor & 0xf0) \
new_dor = (new_dor & 0x0c) | floppy_selects[new_dor & 3]; \
else \
new_dor &= 0x0c; \
outb(new_dor, FD_DOR); \
} while (0)
#define FDC1 (0x3f0) #define FDC1 (0x3f0)
#define FLOPPY0_TYPE 4 #define FLOPPY0_TYPE 4