History

floppy: separate the FDC's base address from its registers

FDC registers FD_STATUS, FD_DATA, FD_DOR, FD_DIR and FD_DCR used to be defined relative to FD_IOPORT, which is the FDC's base address, itself a macro depending on the "fdc" local or global variable. This patch changes this so that the register macros above now only reference the address offset, and that the FDC's address is explicitly passed in each call to fd_inb() and fd_outb(), thus removing the macro. With this change there is no more implicit usage of the local/global "fdc" variable. One place in the ARM code used to check if the port was equal to FD_DOR, this was changed to testing the register by applying a mask to the port, as was already done in the sparc code. There are still occurrences of fd_inb() and fd_outb() in the PARISC code and these ones remain unaffected since they already used to work with a base address and a register offset. The sparc, m68k and parisc code could now be slightly cleaned up to benefit from the macro definitions above instead of the equivalent hard-coded values.

Willy Tarreau committed 6 years ago

Commit e2032461 parent ac701863 files · +10 −19Browse files

Showing the changes to include/uapi/linux (1 of 3 files). Show all

Unified · Split

include/uapi/linux/fdreg.h+5−13
@@ -7,26 +7,18 @@ · 6 unmodified lines
77 * Handbook", Sanches and Canton.
88 */
99
10−#ifdef FDPATCHES
11−#define FD_IOPORT fdc_state[fdc].address
12−#else
13−/* It would be a lot saner just to force fdc_state[fdc].address to always
14− be set ! FIXME */
15−#define FD_IOPORT 0x3f0
16−#endif
17−
1810 /* Fd controller regs. S&C, about page 340 */
19−#define FD_STATUS (4 + FD_IOPORT )
20−#define FD_DATA (5 + FD_IOPORT )
11+#define FD_STATUS 4
12+#define FD_DATA 5
2113
2214 /* Digital Output Register */
23−#define FD_DOR (2 + FD_IOPORT )
15+#define FD_DOR 2
2416
2517 /* Digital Input Register (read) */
26−#define FD_DIR (7 + FD_IOPORT )
18+#define FD_DIR 7
2719
2820 /* Diskette Control Register (write)*/
29−#define FD_DCR (7 + FD_IOPORT )
21+#define FD_DCR 7
3022
3123 /* Bits of main status register */
3224 #define STATUS_BUSYMASK 0x0F /* drive busy mask */