[PATCH 04/11] rust: io: add PortIo

Arnd Bergmann arnd at arndb.de
Fri May 9 06:05:06 UTC 2025


On Fri, May 9, 2025, at 05:15, Andrew Ballance wrote:
> +
> +#define define_rust_pio_read_helper(name, type)     \
> +	type rust_helper_##name(unsigned long port) \
> +	{                                           \
> +		return name(port);                  \
> +	}
> +
> +#define define_rust_pio_write_helper(name, type)                \
> +	void rust_helper_##name(type value, unsigned long port) \
> +	{                                                       \
> +		name(value, port);                              \
> +	}
> +
> +define_rust_pio_read_helper(inb, u8);
> +define_rust_pio_read_helper(inw, u16);
> +define_rust_pio_read_helper(inl, u32);
> +
> +define_rust_pio_write_helper(outb, u8);
> +define_rust_pio_write_helper(outw, u16);
> +define_rust_pio_write_helper(outl, u32);

These have to be guarded with "#ifdef CONFIG_HAS_PIO", since
most modern machines no longer support PIO at all, even behind
PCI.

The option is still enabled by default for a number of
architectures that normally don't have PIO, but it should
eventually become optional on pretty much anything but
x86 and a few 1990s-era workstations that implement x86-style
on-board devices.

     Arnd


More information about the Nouveau mailing list