This is an automated email from Gerrit.

"zapb <[email protected]>" just uploaded a new patch set to Gerrit, which you can 
find at https://review.openocd.org/c/openocd/+/9155

-- gerrit

commit 02ef01f6ff5707e6c10e05859f4ddc8c42c3434a
Author: Marc Schink <[email protected]>
Date:   Sun Aug 17 16:38:01 2025 +0000

    adapter/parport: Drop direct I/O support
    
    Direct I/O support has been deprecated for one release and can now be
    dropped.
    
    Change-Id: I7247cbed96c52f141d55fdff0749e42250c57713
    Signed-off-by: Marc Schink <[email protected]>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index bdf90bd07d..ae434a47c7 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3231,10 +3231,6 @@ The parallel port device file is usually 
@file{/dev/parportX} on Linux and @file
 
 For legacy reason, the port number @var{X} can be specified instead of the 
device file.
 @b{Note:} Using the port number is a deprecated feature and will be removed in 
the future.
-
-When using direct I/O, the number is the I/O port number.
-The default port number is 0x378 (LTP1).
-@b{Note:} Direct I/O support is deprecated and will be removed in the future.
 @end deffn
 
 @deffn {Config Command} {parport toggling_time} time
diff --git a/src/jtag/drivers/parport.c b/src/jtag/drivers/parport.c
index 606b01aedc..4f668a4013 100644
--- a/src/jtag/drivers/parport.c
+++ b/src/jtag/drivers/parport.c
@@ -24,7 +24,6 @@
        i386_set_ioperm((startport), (length), (enable))
 #endif /* __FreeBSD__ */
 
-#if PARPORT_USE_PPDEV == 1
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #include <dev/ppbus/ppi.h>
 #include <dev/ppbus/ppbconf.h>
@@ -35,15 +34,6 @@
 #include <linux/ppdev.h>
 #endif
 #include <sys/ioctl.h>
-#else /* not PARPORT_USE_PPDEV */
-#ifndef _WIN32
-#include <sys/io.h>
-#endif
-#endif
-
-#if PARPORT_USE_GIVEIO == 1 && IS_CYGWIN == 1
-#include <windows.h>
-#endif
 
 static const struct adapter_gpio_config *adapter_gpio_config;
 
@@ -54,12 +44,7 @@ static int wait_states;
 // Interface variables.
 static uint8_t dataport_value;
 
-#if PARPORT_USE_PPDEV == 1
 static int device_handle;
-#else
-static unsigned long dataport;
-static unsigned long statusport;
-#endif
 
 // Bitmask map for the input pins.
 static struct {
@@ -79,11 +64,7 @@ static enum bb_value parport_read(void)
 {
        int data = 0;
 
-#if PARPORT_USE_PPDEV == 1
        ioctl(device_handle, PPRSTATUS, &data);
-#else
-       data = inb(statusport);
-#endif
 
        const struct adapter_gpio_config *gpio_config = 
&adapter_gpio_config[ADAPTER_GPIO_IDX_TDO];
        const bool tdo_state = data & 
input_pin_bitmask_map[gpio_config->gpio_num].mask;
@@ -95,15 +76,7 @@ static void parport_write_data(void)
 {
        const uint8_t output = dataport_value;
 
-#if PARPORT_USE_PPDEV == 1
        ioctl(device_handle, PPWDATA, &output);
-#else
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-       outb(dataport, output);
-#else
-       outb(output, dataport);
-#endif
-#endif
 }
 
 static bool is_gpio_configured(enum adapter_gpio_config_index gpio_index)
@@ -186,34 +159,6 @@ static int parport_speed_div(int speed, int *khz)
        return ERROR_OK;
 }
 
-#if PARPORT_USE_GIVEIO == 1
-static bool parport_get_giveio_access(void)
-{
-       OSVERSIONINFO version;
-
-       version.dwOSVersionInfoSize = sizeof(version);
-       if (!GetVersionEx(&version)) {
-               errno = EINVAL;
-               return false;
-       }
-
-       if (version.dwPlatformId != VER_PLATFORM_WIN32_NT)
-               return true;
-
-       HANDLE h = CreateFile("\\\\.\\giveio", GENERIC_READ, 0, NULL, 
OPEN_EXISTING,
-               FILE_ATTRIBUTE_NORMAL, NULL);
-
-       if (h == INVALID_HANDLE_VALUE) {
-               errno = ENODEV;
-               return false;
-       }
-
-       CloseHandle(h);
-
-       return true;
-}
-#endif
-
 static const struct bitbang_interface parport_bitbang = {
        .read = &parport_read,
        .write = &parport_write,
@@ -288,7 +233,6 @@ static int parport_init(void)
                        set_pin_state(gpio_index, false);
        }
 
-#if PARPORT_USE_PPDEV == 1
        if (device_handle > 0) {
                LOG_ERROR("Parallel port is already open");
                goto init_fail;
@@ -341,37 +285,6 @@ static int parport_init(void)
        }
 #endif /* not __FreeBSD__, __FreeBSD_kernel__ */
 
-#else /* not PARPORT_USE_PPDEV */
-       LOG_WARNING("DEPRECATED: Parallel port access with direct I/O is 
deprecated and support will be removed in the next release");
-
-       if (!parport_port) {
-               parport_port = 0x378;
-               LOG_WARNING("No parallel port specified, using default 0x378 
(LPT1)");
-       }
-
-       LOG_DEBUG("Using parallel port 0x%x", parport_port);
-
-       dataport = parport_port;
-       statusport = parport_port + 1;
-
-#if PARPORT_USE_GIVEIO == 1
-       if (!parport_get_giveio_access()) {
-#else /* PARPORT_USE_GIVEIO */
-       if (ioperm(dataport, 3, 1) != 0) {
-#endif /* PARPORT_USE_GIVEIO */
-               LOG_ERROR("Missing privileges for direct I/O");
-               goto init_fail;
-       }
-
-       // Make sure parallel port is in right mode (clear tristate and 
interrupt).
-       #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-               outb(parport_port + 2, 0x0);
-       #else
-               outb(0x0, parport_port + 2);
-       #endif
-
-#endif /* PARPORT_USE_PPDEV */
-
        if (parport_reset(0, 0) != ERROR_OK)
                goto init_fail;
 

-- 

Reply via email to