From a488ee4a27cda3264bfdc9134558175ec2c3d1d3 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Thu, 18 Jan 2024 16:56:56 +0100 Subject: parisc: Add F_EXTEND() and ROM_EXTEND() helper macros They are used to translate 32-bit addresses into I/O and Firmware regions on 64-bit machines. Signed-off-by: Helge Deller --- src/parisc/hppa.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/parisc/hppa.h b/src/parisc/hppa.h index 03cd9f9..ec149a2 100644 --- a/src/parisc/hppa.h +++ b/src/parisc/hppa.h @@ -208,6 +208,22 @@ static inline u32 ror(u32 word, unsigned int shift) return (word >> (shift & 31)) | (word << ((-shift) & 31)); } + +/* F_EXTEND() is used to access I/O ports. ROM_EXTEND() to access firmware ROM/RAM */ +#if defined(__LP64__) +#define F_EXTEND(x) ((unsigned long)(0xfffffffful<<32) | (x)) +#define ROM_EXTEND(x) ((unsigned long)(0xfffffff0ul<<32) | (x)) +#else +#define F_EXTEND(x) ((unsigned long)(x)) +#define ROM_EXTEND(x) ((unsigned long)(x)) +#endif + +static inline void builtin_console_out(char c) +{ + asm volatile("copy %0,%%r26 ! diag 0x101" : : "r" (c) : "r26"); +} + + extern char has_astro; /* false for B160L machine with Dino PCI chip */ extern unsigned long hppa_port_pci_cmd; extern unsigned long hppa_port_pci_data; @@ -216,7 +232,7 @@ extern unsigned long hppa_port_pci_data; #define pci_ioport_addr(port) ((port >= 0x1000) && (port < FIRMWARE_START)) #define is_astro_ioport(port) (has_astro && (port < IOS_DIST_BASE_SIZE)) -#define astro_ioport_addr(port) ((void *)(portaddr_t)(IOS_DIST_BASE_ADDR + port)) +#define astro_ioport_addr(port) ((void *)(portaddr_t) F_EXTEND(IOS_DIST_BASE_ADDR + port)) /* inb()/outb() accesses little-endian memory and does byteswapping to host endianess */ -- cgit v1.1