Only build PawnIO support in 64-bit builds, provide non-functional stub implementations in super_io.cpp for 32-bit builds

This commit is contained in:
Adam Honse
2025-09-08 20:25:53 -05:00
parent b349c3ff2c
commit 8d8f70bfdf
4 changed files with 33 additions and 25 deletions

View File

@@ -198,6 +198,7 @@ HEADERS +=
scsiapi/scsiapi.h \
serial_port/find_usb_serial_port.h \
serial_port/serial_port.h \
super_io/super_io.h \
StringUtils.h \
SuspendResume/SuspendResume.h \
AutoStart/AutoStart.h \
@@ -342,8 +343,6 @@ win32:SOURCES +=
dependencies/NVFC/nvapi.cpp \
i2c_smbus/Windows/i2c_smbus_amdadl.cpp \
i2c_smbus/Windows/i2c_smbus_nvapi.cpp \
i2c_smbus/Windows/i2c_smbus_pawnio.cpp \
super_io/super_io_pawnio.cpp \
scsiapi/scsiapi_windows.c \
serial_port/find_usb_serial_port_win.cpp \
SuspendResume/SuspendResume_Windows.cpp \
@@ -362,12 +361,15 @@ win32:HEADERS +=
i2c_smbus/Windows/i2c_smbus_amdadl.h \
i2c_smbus/Windows/i2c_smbus_nvapi.h \
i2c_smbus/Windows/i2c_smbus_pawnio.h \
super_io/super_io_pawnio.h \
wmi/wmi.h \
AutoStart/AutoStart-Windows.h \
SuspendResume/SuspendResume_Windows.h \
win32:contains(QMAKE_TARGET.arch, x86_64) {
win32:SOURCES += \
i2c_smbus/Windows/i2c_smbus_pawnio.cpp \
super_io/super_io_pawnio.cpp \
LIBS += \
-lws2_32 \
-liphlpapi \
@@ -378,6 +380,9 @@ win32:contains(QMAKE_TARGET.arch, x86_64) {
}
win32:contains(QMAKE_TARGET.arch, x86) {
win32:SOURCES += \
super_io/super_io.cpp \
LIBS += \
-lws2_32 \
-liphlpapi \

View File

@@ -10,10 +10,10 @@
\*---------------------------------------------------------*/
#include "super_io.h"
#include "super_io_pawnio.h"
#if _MACOSX_X86_X64
#if defined(_MACOSX_X86_X64)
#include "macUSPCIOAccess.h"
#elif defined(_WIN32)
#else
#include <unistd.h>
#include <sys/types.h>
@@ -35,6 +35,13 @@ void superio_enter(int ioreg)
#if defined(_MACOSX_X86_X64)
WriteIoPortByte(ioreg, 0x87);
WriteIoPortByte(ioreg, 0x87);
#elif defined(_WIN32)
/*-----------------------------------------------------*\
| This function is not defined for Windows |
| For 64-bit Windows, super_io_pawnio.cpp is used |
| instead. For 32-bit Windows, this function provides|
| a nonfunctional stub implementation. |
\*-----------------------------------------------------*/
#else
unsigned char temp = 0x87;
dev_port_fd = open("/dev/port", O_RDWR, "rw");
@@ -72,6 +79,13 @@ void superio_outb(int ioreg, int reg, int val)
#if defined(_MACOSX_X86_X64)
WriteIoPortByte(ioreg, reg);
WriteIoPortByte(ioreg + 1, val);
#elif defined(_WIN32)
/*-----------------------------------------------------*\
| This function is not defined for Windows |
| For 64-bit Windows, super_io_pawnio.cpp is used |
| instead. For 32-bit Windows, this function provides|
| a nonfunctional stub implementation. |
\*-----------------------------------------------------*/
#else
dev_port_fd = open("/dev/port", O_RDWR, "rw");
@@ -107,6 +121,14 @@ int superio_inb(int ioreg, int reg)
#if defined(_MACOSX_X86_X64)
WriteIoPortByte(ioreg, reg);
return ReadIoPortByte(ioreg + 1);
#elif defined(_WIN32)
/*-----------------------------------------------------*\
| This function is not defined for Windows |
| For 64-bit Windows, super_io_pawnio.cpp is used |
| instead. For 32-bit Windows, this function provides|
| a nonfunctional stub implementation. |
\*-----------------------------------------------------*/
return -1;
#else
unsigned char temp = 0;
dev_port_fd = open("/dev/port", O_RDWR, "rw");

View File

@@ -9,13 +9,12 @@
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#include "super_io_pawnio.h"
#include "super_io.h"
#include <Windows.h>
#include "PawnIOLib.h"
#include "i2c_smbus_pawnio.h"
static HANDLE pawnio_handle = NULL;
static int pawnio_chip_type = 0;

View File

@@ -1,18 +0,0 @@
/*---------------------------------------------------------*\
| super_io_pawnio.h |
| |
| Functions for interfacing with Super-IO using PawnIO |
| |
| Stephen Horvath (Steve-Tech) 05 May 2025 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#pragma once
void superio_enter(int ioreg);
void superio_outb(int ioreg, int reg, int val);
int superio_inb(int ioreg, int reg);