Skip to contentSkip to conversation

pata_parport: second preview

PATCH In review Ondrej Zary 3 participants 3 messages Feb 20, 2022 – Feb 22, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pata_parport: second preview

Hello,
here's a second version of pata_parport. Now a complete patch with protocol drivers (cleaned up coding style).

The device model is complete now (pata_parport bus, protocol drivers and manually created devices). Devices can also be deleted:

# echo pata_parport.0 > /sys/bus/pata_parport/delete_device 

Protocol registration could be improved - I don't like protocols[] and protocol numbers, devices should probably be created by protocol name. Also the LPT port base addresses should probably be replaced by port names (like parport0).

The bpck driver seems to need to know if a CD drive is attached (weird) but I doubt that I can get such info from libata.

I haven't tested other devices yet, only the Imation SuperDisk drive:

[ 4297.947270] paride: epat registered as protocol 0
[ 4302.019782] pata_parport pata_parport.0: 0x378 is parport0
[ 4302.030573] pata_parport pata_parport.0: epat: port 0x378, mode 0, ccr 0, test=(0,256,0)
[ 4302.030587] pata_parport pata_parport.0: Sharing parport0 at 0x378
[ 4302.030719] pata_parport pata_parport.0: epat, Shuttle EPAT chip c6 at 0x378, mode 0 (4-bit), delay 0
[ 4302.062891] scsi host4: pata_parport-epat
[ 4302.063036] ata6: PATA max PIO0 port parport0 protocol epat
[ 4302.277720] ata6.00: ATAPI: LS-120 COSM   04              UHD Floppy, 0270M09T, max PIO2
[ 4302.358986] scsi 4:0:0:0: Direct-Access     MATSHITA LS-120 COSM   04 0270 PQ: 0 ANSI: 5
[ 4302.394406] sd 4:0:0:0: Attached scsi generic sg1 type 0
[ 4302.429152] sd 4:0:0:0: [sdb] Media removed, stopped polling
[ 4302.461007] sd 4:0:0:0: [sdb] Attached SCSI removable disk
---
 drivers/ata/Kconfig                     |  25 +
 drivers/ata/Makefile                    |   2 +
 drivers/ata/pata_parport/Kconfig        | 189 ++++++
 drivers/ata/pata_parport/Makefile       |  24 +
 drivers/ata/pata_parport/aten.c         | 139 +++++
 drivers/ata/pata_parport/bpck.c         | 481 +++++++++++++++
 drivers/ata/pata_parport/bpck6.c        | 164 +++++
 drivers/ata/pata_parport/comm.c         | 198 ++++++
 drivers/ata/pata_parport/dstr.c         | 226 +++++++
 drivers/ata/pata_parport/epat.c         | 320 ++++++++++
 drivers/ata/pata_parport/epia.c         | 308 ++++++++++
 drivers/ata/pata_parport/fit2.c         | 135 +++++
 drivers/ata/pata_parport/fit3.c         | 195 ++++++
 drivers/ata/pata_parport/friq.c         | 263 ++++++++
 drivers/ata/pata_parport/frpw.c         | 292 +++++++++
 drivers/ata/pata_parport/kbic.c         | 292 +++++++++
 drivers/ata/pata_parport/ktti.c         | 112 ++++
 drivers/ata/pata_parport/on20.c         | 136 +++++
 drivers/ata/pata_parport/on26.c         | 302 +++++++++
 drivers/ata/pata_parport/pata_parport.c | 773 ++++++++++++++++++++++++
 drivers/ata/pata_parport/pata_parport.h | 114 ++++
 drivers/ata/pata_parport/ppc6lnx.c      | 486 +++++++++++++++
 22 files changed, 5176 insertions(+)
 create mode 100644 drivers/ata/pata_parport/Kconfig
 create mode 100644 drivers/ata/pata_parport/Makefile
 create mode 100644 drivers/ata/pata_parport/aten.c
 create mode 100644 drivers/ata/pata_parport/bpck.c
 create mode 100644 drivers/ata/pata_parport/bpck6.c
 create mode 100644 drivers/ata/pata_parport/comm.c
 create mode 100644 drivers/ata/pata_parport/dstr.c
 create mode 100644 drivers/ata/pata_parport/epat.c
 create mode 100644 drivers/ata/pata_parport/epia.c
 create mode 100644 drivers/ata/pata_parport/fit2.c
 create mode 100644 drivers/ata/pata_parport/fit3.c
 create mode 100644 drivers/ata/pata_parport/friq.c
 create mode 100644 drivers/ata/pata_parport/frpw.c
 create mode 100644 drivers/ata/pata_parport/kbic.c
 create mode 100644 drivers/ata/pata_parport/ktti.c
 create mode 100644 drivers/ata/pata_parport/on20.c
 create mode 100644 drivers/ata/pata_parport/on26.c
 create mode 100644 drivers/ata/pata_parport/pata_parport.c
 create mode 100644 drivers/ata/pata_parport/pata_parport.h
 create mode 100644 drivers/ata/pata_parport/ppc6lnx.c
drivers/ata/Kconfig +25 -0
index cb54631fd950..de4548471398 100644
@@ -1161,6 +1161,31 @@ config PATA_WINBOND_VLB
 	  Support for the Winbond W83759A controller on Vesa Local Bus
 	  systems.
 
+config PATA_PARPORT
+	tristate "Parallel port IDE device support (PARIDE replacement)"
+	depends on PARPORT_PC
+	help
+	  There are many external CD-ROM and disk devices that connect through
+	  your computer's parallel port. Most of them are actually IDE devices
+	  using a parallel port IDE adapter. This option enables the PATA_PARPORT
+	  subsystem which contains drivers for many of these external drives.
+	  Read <file:Documentation/admin-guide/blockdev/paride.rst> for more information.
+
+	  If you have said Y to the "Parallel-port support" configuration
+	  option, you may share a single port between your printer and other
+	  parallel port devices. Answer Y to build PATA_PARPORT support into your
+	  kernel, or M if you would like to build it as a loadable module. If
+	  your parallel port support is in a loadable module, you must build
+	  PATA_PARPORT as a module. If you built PATA_PARPORT support into your kernel,
+	  you may still build the individual protocol modules as loadable
+	  modules. If you build this support as a module, it will be called pata_parport.
+
+	  Unlike the old PARIDE, there are no high-level drivers needed.
+	  The IDE devices behind parallel port adapters are handled by the
+	  ATA layer.
+
+source "drivers/ata/pata_parport/Kconfig"
+
 comment "Generic fallback / legacy drivers"
 
 config PATA_ACPI
drivers/ata/Makefile +2 -0
index b8aebfb14e82..bd6b5fdc004e 100644
@@ -114,6 +114,8 @@ obj-$(CONFIG_PATA_SAMSUNG_CF)	+= pata_samsung_cf.o
 
 obj-$(CONFIG_PATA_PXA)		+= pata_pxa.o
 
+obj-$(CONFIG_PATA_PARPORT)	+= pata_parport/
+
 # Should be last but two libata driver
 obj-$(CONFIG_PATA_ACPI)		+= pata_acpi.o
 # Should be last but one libata driver
drivers/ata/pata_parport/Kconfig new file +189 -0

189 lines not on this page · raw message

drivers/ata/pata_parport/Makefile new file +24 -0
new file mode 100644
index 000000000000..fc6d3b60b63e
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for Parallel port IDE device drivers.
+#
+# 7 October 2000, Bartlomiej Zolnierkiewicz <[email protected]>
+# Rewritten to use lists instead of if-statements.
+#
+
+obj-$(CONFIG_PATA_PARPORT)		+= pata_parport.o
+obj-$(CONFIG_PATA_PARPORT_ATEN)		+= aten.o
+obj-$(CONFIG_PATA_PARPORT_BPCK)		+= bpck.o
+obj-$(CONFIG_PATA_PARPORT_COMM)		+= comm.o
+obj-$(CONFIG_PATA_PARPORT_DSTR)		+= dstr.o
+obj-$(CONFIG_PATA_PARPORT_KBIC)		+= kbic.o
+obj-$(CONFIG_PATA_PARPORT_EPAT)		+= epat.o
+obj-$(CONFIG_PATA_PARPORT_EPIA)		+= epia.o
+obj-$(CONFIG_PATA_PARPORT_FRPW)		+= frpw.o
+obj-$(CONFIG_PATA_PARPORT_FRIQ)		+= friq.o
+obj-$(CONFIG_PATA_PARPORT_FIT2)		+= fit2.o
+obj-$(CONFIG_PATA_PARPORT_FIT3)		+= fit3.o
+obj-$(CONFIG_PATA_PARPORT_ON20)		+= on20.o
+obj-$(CONFIG_PATA_PARPORT_ON26)		+= on26.o
+obj-$(CONFIG_PATA_PARPORT_KTTI)		+= ktti.o
+obj-$(CONFIG_PATA_PARPORT_BPCK6)	+= bpck6.o
drivers/ata/pata_parport/aten.c new file +139 -0

139 lines not on this page · raw message

drivers/ata/pata_parport/bpck.c new file +481 -0

481 lines not on this page · raw message

drivers/ata/pata_parport/bpck6.c new file +164 -0

164 lines not on this page · raw message

drivers/ata/pata_parport/comm.c new file +198 -0

198 lines not on this page · raw message

drivers/ata/pata_parport/dstr.c new file +226 -0

226 lines not on this page · raw message

drivers/ata/pata_parport/epat.c new file +320 -0

320 lines not on this page · raw message

drivers/ata/pata_parport/epia.c new file +308 -0

308 lines not on this page · raw message

drivers/ata/pata_parport/fit2.c new file +135 -0

135 lines not on this page · raw message

drivers/ata/pata_parport/fit3.c new file +195 -0

195 lines not on this page · raw message

drivers/ata/pata_parport/friq.c new file +263 -0

263 lines not on this page · raw message

drivers/ata/pata_parport/frpw.c new file +292 -0

292 lines not on this page · raw message

drivers/ata/pata_parport/kbic.c new file +292 -0

27 lines not on this page · raw message

drivers/ata/pata_parport/ktti.c new file +112 -0

112 lines not on this page · raw message

drivers/ata/pata_parport/on20.c new file +136 -0

136 lines not on this page · raw message

drivers/ata/pata_parport/on26.c new file +302 -0

302 lines not on this page · raw message

drivers/ata/pata_parport/pata_parport.c new file +773 -0

773 lines not on this page · raw message

drivers/ata/pata_parport/pata_parport.h new file +114 -0

114 lines not on this page · raw message

drivers/ata/pata_parport/ppc6lnx.c new file +486 -0

486 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
Ondrej Zary

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 46 lines · Ondrej Zary

Hello,
here's a second version of pata_parport. Now a complete patch with protocol drivers (cleaned up coding style).

The device model is complete now (pata_parport bus, protocol drivers and manually created devices). Devices can also be deleted:

# echo pata_parport.0 > /sys/bus/pata_parport/delete_device 

Protocol registration could be improved - I don't like protocols[] and protocol numbers, devices should probably be created by protocol name. Also the LPT port base addresses should probably be replaced by port names (like parport0).

The bpck driver seems to need to know if a CD drive is attached (weird) but I doubt that I can get such info from libata.

I haven't tested other devices yet, only the Imation SuperDisk drive:

[ 4297.947270] paride: epat registered as protocol 0
[ 4302.019782] pata_parport pata_parport.0: 0x378 is parport0
[ 4302.030573] pata_parport pata_parport.0: epat: port 0x378, mode 0, ccr 0, test=(0,256,0)
[ 4302.030587] pata_parport pata_parport.0: Sharing parport0 at 0x378
[ 4302.030719] pata_parport pata_parport.0: epat, Shuttle EPAT chip c6 at 0x378, mode 0 (4-bit), delay 0
[ 4302.062891] scsi host4: pata_parport-epat
[ 4302.063036] ata6: PATA max PIO0 port parport0 protocol epat
[ 4302.277720] ata6.00: ATAPI: LS-120 COSM   04              UHD Floppy, 0270M09T, max PIO2
[ 4302.358986] scsi 4:0:0:0: Direct-Access     MATSHITA LS-120 COSM   04 0270 PQ: 0 ANSI: 5
[ 4302.394406] sd 4:0:0:0: Attached scsi generic sg1 type 0
[ 4302.429152] sd 4:0:0:0: [sdb] Media removed, stopped polling
[ 4302.461007] sd 4:0:0:0: [sdb] Attached SCSI removable disk
---
 drivers/ata/Kconfig                     |  25 +
 drivers/ata/Makefile                    |   2 +
 drivers/ata/pata_parport/Kconfig        | 189 ++++++
 drivers/ata/pata_parport/Makefile       |  24 +
 drivers/ata/pata_parport/aten.c         | 139 +++++
 drivers/ata/pata_parport/bpck.c         | 481 +++++++++++++++
 drivers/ata/pata_parport/bpck6.c        | 164 +++++
 drivers/ata/pata_parport/comm.c         | 198 ++++++
 drivers/ata/pata_parport/dstr.c         | 226 +++++++
 drivers/ata/pata_parport/epat.c         | 320 ++++++++++
 drivers/ata/pata_parport/epia.c         | 308 ++++++++++
 drivers/ata/pata_parport/fit2.c         | 135 +++++
 drivers/ata/pata_parport/fit3.c         | 195 ++++++
Quoted 8 lines
 drivers/ata/pata_parport/friq.c         | 263 ++++++++
 drivers/ata/pata_parport/frpw.c         | 292 +++++++++
 drivers/ata/pata_parport/kbic.c         | 292 +++++++++
 drivers/ata/pata_parport/ktti.c         | 112 ++++
 drivers/ata/pata_parport/on20.c         | 136 +++++
 drivers/ata/pata_parport/on26.c         | 302 +++++++++
 drivers/ata/pata_parport/pata_parport.c | 773 ++++++++++++++++++++++++
 drivers/ata/pata_parport/pata_parport.h | 114 ++++

This is a very large patch... Could you split this into multiple patches ?
1) The first patch adds the generic pata_parport & Kconfig
2) Following patches add pata_parport drivers, one patch per driver.

That will make reviewing easier.

Signature · 2 lines
Damien Le Moal
Western Digital Research
#2 lore raw
In reply to Ondrej Zary
Quoted 7 lines · Ondrej Zary

Protocol registration could be improved - I don't like protocols[] and protocol numbers, devices should probably be created by protocol name. Also the LPT port base addresses should probably be replaced by port names (like parport0).

The bpck driver seems to need to know if a CD drive is attached (weird) but I doubt that I can get such info from libata.

You can check adev->class == ATA_DEV_ATAPI, there's a bunch of drivers that already do that.

I'll try to take a look at the actual patch once I find a bit of time.