From: Willy Tarreau <w@1wt.eu>
To: Denis Efremov <efremov@linux.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Willy Tarreau <w@1wt.eu>, "David S. Miller" <davem@davemloft.net>
Subject: [PATCH 07/23] floppy: use symbolic register names in the sparc64 port
Date: Tue, 31 Mar 2020 11:40:38 +0200 [thread overview]
Message-ID: <20200331094054.24441-8-w@1wt.eu> (raw)
In-Reply-To: <20200331094054.24441-1-w@1wt.eu>
Now by splitting the base address from the register index we can
use the symbolic register names instead of the hard-coded numeric
values.
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
arch/sparc/include/asm/floppy_64.h | 59 ++++++++++++++++--------------
1 file changed, 32 insertions(+), 27 deletions(-)
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index c0cf157e5b15..bd7847f2c64a 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -47,8 +47,9 @@ unsigned long fdc_status;
static struct platform_device *floppy_op = NULL;
struct sun_floppy_ops {
- unsigned char (*fd_inb) (unsigned long port);
- void (*fd_outb) (unsigned char value, unsigned long port);
+ unsigned char (*fd_inb) (unsigned long port, unsigned int reg);
+ void (*fd_outb) (unsigned char value, unsigned long base,
+ unsigned int reg);
void (*fd_enable_dma) (void);
void (*fd_disable_dma) (void);
void (*fd_set_dma_mode) (int);
@@ -62,8 +63,8 @@ struct sun_floppy_ops {
static struct sun_floppy_ops sun_fdops;
-#define fd_inb(base, reg) sun_fdops.fd_inb((base) + (reg))
-#define fd_outb(value, base, reg) sun_fdops.fd_outb(value, (base) + (reg))
+#define fd_inb(base, reg) sun_fdops.fd_inb(base, reg)
+#define fd_outb(value, base, reg) sun_fdops.fd_outb(value, base, reg)
#define fd_enable_dma() sun_fdops.fd_enable_dma()
#define fd_disable_dma() sun_fdops.fd_disable_dma()
#define fd_request_dma() (0) /* nothing... */
@@ -97,42 +98,43 @@ static int sun_floppy_types[2] = { 0, 0 };
/* No 64k boundary crossing problems on the Sparc. */
#define CROSS_64KB(a,s) (0)
-static unsigned char sun_82077_fd_inb(unsigned long port)
+static unsigned char sun_82077_fd_inb(unsigned long base, unsigned int reg)
{
udelay(5);
- switch(port & 7) {
+ switch (reg) {
default:
- printk("floppy: Asked to read unknown port %lx\n", port);
+ printk("floppy: Asked to read unknown port %lx\n", reg);
panic("floppy: Port bolixed.");
- case 4: /* FD_STATUS */
+ case FD_STATUS:
return sbus_readb(&sun_fdc->status_82077) & ~STATUS_DMA;
- case 5: /* FD_DATA */
+ case FD_DATA:
return sbus_readb(&sun_fdc->data_82077);
- case 7: /* FD_DIR */
+ case FD_DIR:
/* XXX: Is DCL on 0x80 in sun4m? */
return sbus_readb(&sun_fdc->dir_82077);
}
panic("sun_82072_fd_inb: How did I get here?");
}
-static void sun_82077_fd_outb(unsigned char value, unsigned long port)
+static void sun_82077_fd_outb(unsigned char value, unsigned long base,
+ unsigned int reg)
{
udelay(5);
- switch(port & 7) {
+ switch (reg) {
default:
- printk("floppy: Asked to write to unknown port %lx\n", port);
+ printk("floppy: Asked to write to unknown port %lx\n", reg);
panic("floppy: Port bolixed.");
- case 2: /* FD_DOR */
+ case FD_DOR:
/* Happily, the 82077 has a real DOR register. */
sbus_writeb(value, &sun_fdc->dor_82077);
break;
- case 5: /* FD_DATA */
+ case FD_DATA:
sbus_writeb(value, &sun_fdc->data_82077);
break;
- case 7: /* FD_DCR */
+ case FD_DCR:
sbus_writeb(value, &sun_fdc->dcr_82077);
break;
- case 4: /* FD_STATUS */
+ case FD_DSR:
sbus_writeb(value, &sun_fdc->status_82077);
break;
}
@@ -298,19 +300,21 @@ static struct sun_pci_dma_op sun_pci_dma_pending = { -1U, 0, 0, NULL};
irqreturn_t floppy_interrupt(int irq, void *dev_id);
-static unsigned char sun_pci_fd_inb(unsigned long port)
+static unsigned char sun_pci_fd_inb(unsigned long base, unsigned int reg)
{
udelay(5);
- return inb(port);
+ return inb(base + reg);
}
-static void sun_pci_fd_outb(unsigned char val, unsigned long port)
+static void sun_pci_fd_outb(unsigned char val, unsigned long base,
+ unsigned int reg)
{
udelay(5);
- outb(val, port);
+ outb(val, base + reg);
}
-static void sun_pci_fd_broken_outb(unsigned char val, unsigned long port)
+static void sun_pci_fd_broken_outb(unsigned char val, unsigned long base,
+ unsigned int reg)
{
udelay(5);
/*
@@ -320,16 +324,17 @@ static void sun_pci_fd_broken_outb(unsigned char val, unsigned long port)
* this does not hurt correct hardware like the AXmp.
* (Eddie, Sep 12 1998).
*/
- if (port == ((unsigned long)sun_fdc) + 2) {
+ if (reg == FD_DOR) {
if (((val & 0x03) == sun_pci_broken_drive) && (val & 0x20)) {
val |= 0x10;
}
}
- outb(val, port);
+ outb(val, base + reg);
}
#ifdef PCI_FDC_SWAP_DRIVES
-static void sun_pci_fd_lde_broken_outb(unsigned char val, unsigned long port)
+static void sun_pci_fd_lde_broken_outb(unsigned char val, unsigned long base,
+ unsigned int reg)
{
udelay(5);
/*
@@ -339,13 +344,13 @@ static void sun_pci_fd_lde_broken_outb(unsigned char val, unsigned long port)
* this does not hurt correct hardware like the AXmp.
* (Eddie, Sep 12 1998).
*/
- if (port == ((unsigned long)sun_fdc) + 2) {
+ if (reg == FD_DOR) {
if (((val & 0x03) == sun_pci_broken_drive) && (val & 0x10)) {
val &= ~(0x03);
val |= 0x21;
}
}
- outb(val, port);
+ outb(val, base + reg);
}
#endif /* PCI_FDC_SWAP_DRIVES */
--
2.20.1
next prev parent reply other threads:[~2020-03-31 9:42 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-31 9:40 [PATCH 00/23] Floppy driver cleanups Willy Tarreau
2020-03-31 9:40 ` [PATCH 01/23] floppy: split the base port from the register in I/O accesses Willy Tarreau
2020-03-31 9:40 ` [PATCH 02/23] floppy: add references to 82077's extra registers Willy Tarreau
2020-03-31 9:40 ` [PATCH 03/23] floppy: use symbolic register names in the m68k port Willy Tarreau
2020-03-31 9:40 ` [PATCH 04/23] floppy: use symbolic register names in the parisc port Willy Tarreau
2020-03-31 9:40 ` [PATCH 05/23] floppy: use symbolic register names in the powerpc port Willy Tarreau
2020-03-31 9:40 ` [PATCH 06/23] floppy: use symbolic register names in the sparc32 port Willy Tarreau
2020-03-31 9:40 ` Willy Tarreau [this message]
2020-04-14 9:20 ` [PATCH 07/23] floppy: use symbolic register names in the sparc64 port Denis Efremov
2020-03-31 9:40 ` [PATCH 08/23] floppy: use symbolic register names in the x86 port Willy Tarreau
2020-03-31 9:40 ` [PATCH 09/23] floppy: cleanup: make twaddle() not rely on current_{fdc,drive} anymore Willy Tarreau
2020-03-31 9:40 ` [PATCH 10/23] floppy: cleanup: make reset_fdc_info() not rely on current_fdc anymore Willy Tarreau
2020-03-31 9:40 ` [PATCH 11/23] floppy: cleanup: make show_floppy() " Willy Tarreau
2020-03-31 9:40 ` [PATCH 12/23] floppy: cleanup: make wait_til_ready() " Willy Tarreau
2020-03-31 9:40 ` [PATCH 13/23] floppy: cleanup: make output_byte() " Willy Tarreau
2020-03-31 9:40 ` [PATCH 14/23] floppy: cleanup: make result() " Willy Tarreau
2020-03-31 9:40 ` [PATCH 15/23] floppy: cleanup: make need_more_output() " Willy Tarreau
2020-03-31 9:40 ` [PATCH 16/23] floppy: cleanup: make perpendicular_mode() " Willy Tarreau
2020-03-31 9:40 ` [PATCH 17/23] floppy: cleanup: make fdc_configure() " Willy Tarreau
2020-03-31 9:40 ` [PATCH 18/23] floppy: cleanup: make fdc_specify() not rely on current_{fdc,drive} anymore Willy Tarreau
2020-03-31 9:40 ` [PATCH 19/23] floppy: cleanup: make check_wp() " Willy Tarreau
2020-03-31 9:40 ` [PATCH 20/23] floppy: cleanup: make next_valid_format() not rely on current_drive anymore Willy Tarreau
2020-03-31 9:40 ` [PATCH 21/23] floppy: cleanup: make get_fdc_version() not rely on current_fdc anymore Willy Tarreau
2020-03-31 9:40 ` [PATCH 22/23] floppy: cleanup: do not iterate on current_fdc in DMA grab/release functions Willy Tarreau
2020-04-10 8:35 ` Denis Efremov
2020-04-10 8:45 ` Willy Tarreau
2020-04-10 8:48 ` Denis Efremov
2020-04-10 9:32 ` Willy Tarreau
2020-04-10 9:30 ` [PATCH 24/23] floppy: cleanup: do not iterate on current_fdc in do_floppy_init() Willy Tarreau
2020-04-10 10:19 ` [PATCH 25/23] floppy: make sure to reset all FDCs upon resume() Willy Tarreau
2020-04-10 10:19 ` [PATCH 26/23] floppy: cleanup: get rid of current_reqD in favor of current_drive Willy Tarreau
2020-04-10 10:19 ` [PATCH 27/23] floppy: cleanup: make set_fdc() always set current_drive and current_fd Willy Tarreau
2020-03-31 9:40 ` [PATCH 23/23] floppy: cleanup: add a few comments about expectations in certain functions Willy Tarreau
2020-03-31 10:10 ` [PATCH 00/23] Floppy driver cleanups Christoph Hellwig
2020-03-31 11:01 ` Willy Tarreau
2020-03-31 15:28 ` Christoph Hellwig
2020-03-31 15:49 ` Willy Tarreau
2020-04-13 22:46 ` Jens Axboe
2020-04-14 5:31 ` Willy Tarreau
2020-04-14 10:29 ` Denis Efremov
2020-04-14 16:12 ` Willy Tarreau
2020-04-21 13:15 ` Denis Efremov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200331094054.24441-8-w@1wt.eu \
--to=w@1wt.eu \
--cc=axboe@kernel.dk \
--cc=davem@davemloft.net \
--cc=efremov@linux.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).