Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'parisc-5.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc updates from Helge Deller:

- Added fw_cfg support for parisc on qemu

- Added font support in sti text console driver for byte- and word-mode
ROMs

- Switch to more fine grained lws locks and improve spinlock handling

- Add ioread64_hi_lo() and iowrite64_hi_lo() to avoid 0-day linking
errors

- Mark pointers volatile in __xchg8(), __xchg32() and __xchg64() to
help compiler

- Header file cleanups, mostly removal of unused HP-UX compat defines

- Drop one bit from our O_NONBLOCK define to become now 000200000

- Add MAP_UNINITIALIZED define to avoid userspace compile errors

- Drop CONFIG_IDE from defconfigs

- Speed up synchronize_caches() on UP machines

- Rewrite tlb flush threshold calculation

- Comment fixes and cleanups

* 'parisc-5.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
parisc/sticon: Add user font support
parisc/sticon: Always register sticon console driver
parisc: Add MAP_UNINITIALIZED define
parisc: Improve spinlock handling
parisc: Install vmlinuz instead of zImage file
parisc: Rewrite tlb flush threshold calculation
parisc: Switch to more fine grained lws locks
parisc: Mark pointers volatile in __xchg8(), __xchg32() and __xchg64()
parisc: Fix comments and enable interrupts later
parisc: Add alternative patching to synchronize_caches define
parisc: Add ioread64_hi_lo() and iowrite64_hi_lo()
parisc: disable CONFIG_IDE in defconfigs
parisc: Drop useless comments in uapi/asm/signal.h
parisc: Define O_NONBLOCK to become 000200000
parisc: Drop HP-UX specific fcntl and signal flags
parisc: Avoid external interrupts when IPI finishes
parisc: Add qemu fw_cfg interface
fw_cfg: Add support for parisc architecture

+453 -346
+1
arch/parisc/Kconfig
··· 375 375 376 376 endmenu 377 377 378 + source "drivers/firmware/Kconfig" 378 379 379 380 source "drivers/parisc/Kconfig"
+2 -4
arch/parisc/configs/generic-32bit_defconfig
··· 52 52 CONFIG_BLK_DEV_CRYPTOLOOP=y 53 53 CONFIG_BLK_DEV_RAM=y 54 54 CONFIG_BLK_DEV_RAM_SIZE=6144 55 - CONFIG_IDE=y 56 - CONFIG_BLK_DEV_IDECD=y 57 - CONFIG_BLK_DEV_GENERIC=y 58 - CONFIG_BLK_DEV_NS87415=y 59 55 CONFIG_BLK_DEV_SD=y 60 56 CONFIG_CHR_DEV_ST=y 61 57 CONFIG_BLK_DEV_SR=y ··· 61 65 CONFIG_SCSI_ZALON=y 62 66 CONFIG_SCSI_DH=y 63 67 CONFIG_ATA=y 68 + CONFIG_ATA_GENERIC=y 69 + CONFIG_PATA_NS87415=y 64 70 CONFIG_MD=y 65 71 CONFIG_BLK_DEV_MD=m 66 72 CONFIG_MD_LINEAR=m
+1 -5
arch/parisc/configs/generic-64bit_defconfig
··· 58 58 CONFIG_DEVTMPFS=y 59 59 CONFIG_DEVTMPFS_MOUNT=y 60 60 CONFIG_BLK_DEV_LOOP=y 61 - CONFIG_IDE=y 62 - CONFIG_IDE_GD=m 63 - CONFIG_IDE_GD_ATAPI=y 64 - CONFIG_BLK_DEV_IDECD=m 65 - CONFIG_BLK_DEV_NS87415=y 66 61 # CONFIG_SCSI_PROC_FS is not set 67 62 CONFIG_BLK_DEV_SD=y 68 63 CONFIG_BLK_DEV_SR=y ··· 71 76 CONFIG_SCSI_QLA_ISCSI=m 72 77 CONFIG_SCSI_DH=y 73 78 CONFIG_ATA=y 79 + CONFIG_PATA_NS87415=y 74 80 CONFIG_PATA_SIL680=y 75 81 CONFIG_ATA_GENERIC=y 76 82 CONFIG_MD=y
+5 -1
arch/parisc/include/asm/barrier.h
··· 2 2 #ifndef __ASM_BARRIER_H 3 3 #define __ASM_BARRIER_H 4 4 5 + #include <asm/alternative.h> 6 + 5 7 #ifndef __ASSEMBLY__ 6 8 7 9 /* The synchronize caches instruction executes as a nop on systems in 8 10 which all memory references are performed in order. */ 9 - #define synchronize_caches() __asm__ __volatile__ ("sync" : : : "memory") 11 + #define synchronize_caches() asm volatile("sync" \ 12 + ALTERNATIVE(ALT_COND_NO_SMP, INSN_NOP) \ 13 + : : : "memory") 10 14 11 15 #if defined(CONFIG_SMP) 12 16 #define mb() do { synchronize_caches(); } while (0)
+7 -7
arch/parisc/include/asm/cmpxchg.h
··· 14 14 extern void __xchg_called_with_bad_pointer(void); 15 15 16 16 /* __xchg32/64 defined in arch/parisc/lib/bitops.c */ 17 - extern unsigned long __xchg8(char, char *); 18 - extern unsigned long __xchg32(int, int *); 17 + extern unsigned long __xchg8(char, volatile char *); 18 + extern unsigned long __xchg32(int, volatile int *); 19 19 #ifdef CONFIG_64BIT 20 - extern unsigned long __xchg64(unsigned long, unsigned long *); 20 + extern unsigned long __xchg64(unsigned long, volatile unsigned long *); 21 21 #endif 22 22 23 23 /* optimizer better get rid of switch since size is a constant */ 24 24 static inline unsigned long 25 - __xchg(unsigned long x, __volatile__ void *ptr, int size) 25 + __xchg(unsigned long x, volatile void *ptr, int size) 26 26 { 27 27 switch (size) { 28 28 #ifdef CONFIG_64BIT 29 - case 8: return __xchg64(x, (unsigned long *) ptr); 29 + case 8: return __xchg64(x, (volatile unsigned long *) ptr); 30 30 #endif 31 - case 4: return __xchg32((int) x, (int *) ptr); 32 - case 1: return __xchg8((char) x, (char *) ptr); 31 + case 4: return __xchg32((int) x, (volatile int *) ptr); 32 + case 1: return __xchg8((char) x, (volatile char *) ptr); 33 33 } 34 34 __xchg_called_with_bad_pointer(); 35 35 return x;
+2 -2
arch/parisc/include/asm/futex.h
··· 16 16 _futex_spin_lock_irqsave(u32 __user *uaddr, unsigned long int *flags) 17 17 { 18 18 extern u32 lws_lock_start[]; 19 - long index = ((long)uaddr & 0xf0) >> 2; 19 + long index = ((long)uaddr & 0x3f8) >> 1; 20 20 arch_spinlock_t *s = (arch_spinlock_t *)&lws_lock_start[index]; 21 21 local_irq_save(*flags); 22 22 arch_spin_lock(s); ··· 26 26 _futex_spin_unlock_irqrestore(u32 __user *uaddr, unsigned long int *flags) 27 27 { 28 28 extern u32 lws_lock_start[]; 29 - long index = ((long)uaddr & 0xf0) >> 2; 29 + long index = ((long)uaddr & 0x3f8) >> 1; 30 30 arch_spinlock_t *s = (arch_spinlock_t *)&lws_lock_start[index]; 31 31 arch_spin_unlock(s); 32 32 local_irq_restore(*flags);
+2 -2
arch/parisc/include/asm/socket.h
··· 4 4 5 5 #include <uapi/asm/socket.h> 6 6 7 - /* O_NONBLOCK clashes with the bits used for socket types. Therefore we 8 - * have to define SOCK_NONBLOCK to a different value here. 7 + /* O_NONBLOCK clashed with the bits used for socket types. Therefore we 8 + * had to define SOCK_NONBLOCK to a different value here. 9 9 */ 10 10 #define SOCK_NONBLOCK 0x40000000 11 11
+13 -10
arch/parisc/include/asm/spinlock.h
··· 10 10 static inline int arch_spin_is_locked(arch_spinlock_t *x) 11 11 { 12 12 volatile unsigned int *a = __ldcw_align(x); 13 - return *a == 0; 13 + return READ_ONCE(*a) == 0; 14 14 } 15 15 16 - #define arch_spin_lock(lock) arch_spin_lock_flags(lock, 0) 16 + static inline void arch_spin_lock(arch_spinlock_t *x) 17 + { 18 + volatile unsigned int *a; 19 + 20 + a = __ldcw_align(x); 21 + while (__ldcw(a) == 0) 22 + while (*a == 0) 23 + continue; 24 + } 17 25 18 26 static inline void arch_spin_lock_flags(arch_spinlock_t *x, 19 - unsigned long flags) 27 + unsigned long flags) 20 28 { 21 29 volatile unsigned int *a; 22 30 ··· 33 25 while (*a == 0) 34 26 if (flags & PSW_SM_I) { 35 27 local_irq_enable(); 36 - cpu_relax(); 37 28 local_irq_disable(); 38 - } else 39 - cpu_relax(); 29 + } 40 30 } 41 31 #define arch_spin_lock_flags arch_spin_lock_flags 42 32 ··· 50 44 static inline int arch_spin_trylock(arch_spinlock_t *x) 51 45 { 52 46 volatile unsigned int *a; 53 - int ret; 54 47 55 48 a = __ldcw_align(x); 56 - ret = __ldcw(a) != 0; 57 - 58 - return ret; 49 + return __ldcw(a) != 0; 59 50 } 60 51 61 52 /*
+2 -5
arch/parisc/include/uapi/asm/fcntl.h
··· 3 3 #define _PARISC_FCNTL_H 4 4 5 5 #define O_APPEND 000000010 6 - #define O_BLKSEEK 000000100 /* HPUX only */ 7 6 #define O_CREAT 000000400 /* not fcntl */ 8 7 #define O_EXCL 000002000 /* not fcntl */ 9 8 #define O_LARGEFILE 000004000 10 9 #define __O_SYNC 000100000 11 10 #define O_SYNC (__O_SYNC|O_DSYNC) 12 - #define O_NONBLOCK 000200004 /* HPUX has separate NDELAY & NONBLOCK */ 11 + #define O_NONBLOCK 000200000 13 12 #define O_NOCTTY 000400000 /* not fcntl */ 14 - #define O_DSYNC 001000000 /* HPUX only */ 15 - #define O_RSYNC 002000000 /* HPUX only */ 13 + #define O_DSYNC 001000000 16 14 #define O_NOATIME 004000000 17 15 #define O_CLOEXEC 010000000 /* set close_on_exec */ 18 16 19 17 #define O_DIRECTORY 000010000 /* must be a directory */ 20 18 #define O_NOFOLLOW 000000200 /* don't follow links */ 21 - #define O_INVISIBLE 004000000 /* invisible I/O, for DMAPI/XDSM */ 22 19 23 20 #define O_PATH 020000000 24 21 #define __O_TMPFILE 040000000
+1
arch/parisc/include/uapi/asm/mman.h
··· 25 25 #define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */ 26 26 #define MAP_HUGETLB 0x80000 /* create a huge page mapping */ 27 27 #define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ 28 + #define MAP_UNINITIALIZED 0 /* uninitialized anonymous mmap */ 28 29 29 30 #define MS_SYNC 1 /* synchronous memory sync */ 30 31 #define MS_ASYNC 2 /* sync memory asynchronously */
+2 -3
arch/parisc/include/uapi/asm/signal.h
··· 35 35 #define SIGURG 29 36 36 #define SIGXFSZ 30 37 37 #define SIGUNUSED 31 38 - #define SIGSYS 31 /* Linux doesn't use this */ 38 + #define SIGSYS 31 39 39 40 40 /* These should not be considered constants from userland. */ 41 41 #define SIGRTMIN 32 42 - #define SIGRTMAX _NSIG /* it's 44 under HP/UX */ 42 + #define SIGRTMAX _NSIG 43 43 44 44 /* 45 45 * SA_FLAGS values: ··· 61 61 #define SA_NODEFER 0x00000020 62 62 #define SA_RESTART 0x00000040 63 63 #define SA_NOCLDWAIT 0x00000080 64 - #define _SA_SIGGFAULT 0x00000100 /* HPUX */ 65 64 66 65 #define SA_NOMASK SA_NODEFER 67 66 #define SA_ONESHOT SA_RESETHAND
+1 -1
arch/parisc/install.sh
··· 43 43 44 44 # Default install 45 45 46 - if [ "$(basename $2)" = "zImage" ]; then 46 + if [ "$(basename $2)" = "vmlinuz" ]; then 47 47 # Compressed install 48 48 echo "Installing compressed kernel" 49 49 base=vmlinuz
+8 -10
arch/parisc/kernel/cache.c
··· 383 383 static unsigned long parisc_cache_flush_threshold __ro_after_init = FLUSH_THRESHOLD; 384 384 385 385 #define FLUSH_TLB_THRESHOLD (16*1024) /* 16 KiB minimum TLB threshold */ 386 - static unsigned long parisc_tlb_flush_threshold __ro_after_init = FLUSH_TLB_THRESHOLD; 386 + static unsigned long parisc_tlb_flush_threshold __ro_after_init = ~0UL; 387 387 388 388 void __init parisc_setup_cache_timing(void) 389 389 { 390 390 unsigned long rangetime, alltime; 391 - unsigned long size, start; 391 + unsigned long size; 392 392 unsigned long threshold; 393 393 394 394 alltime = mfctl(16); ··· 422 422 goto set_tlb_threshold; 423 423 } 424 424 425 - size = 0; 426 - start = (unsigned long) _text; 425 + size = (unsigned long)_end - (unsigned long)_text; 427 426 rangetime = mfctl(16); 428 - while (start < (unsigned long) _end) { 429 - flush_tlb_kernel_range(start, start + PAGE_SIZE); 430 - start += PAGE_SIZE; 431 - size += PAGE_SIZE; 432 - } 427 + flush_tlb_kernel_range((unsigned long)_text, (unsigned long)_end); 433 428 rangetime = mfctl(16) - rangetime; 434 429 435 430 alltime = mfctl(16); ··· 439 444 threshold/1024); 440 445 441 446 set_tlb_threshold: 442 - if (threshold > parisc_tlb_flush_threshold) 447 + if (threshold > FLUSH_TLB_THRESHOLD) 443 448 parisc_tlb_flush_threshold = threshold; 449 + else 450 + parisc_tlb_flush_threshold = FLUSH_TLB_THRESHOLD; 451 + 444 452 printk(KERN_INFO "TLB flush threshold set to %lu KiB\n", 445 453 parisc_tlb_flush_threshold/1024); 446 454 }
+7 -7
arch/parisc/kernel/entry.S
··· 899 899 * Only do signals if we are returning to user space 900 900 */ 901 901 LDREG PT_IASQ0(%r16), %r20 902 - cmpib,COND(=),n LINUX_GATEWAY_SPACE, %r20, intr_restore /* backward */ 902 + cmpib,COND(=),n LINUX_GATEWAY_SPACE, %r20, intr_restore /* forward */ 903 903 LDREG PT_IASQ1(%r16), %r20 904 - cmpib,COND(=),n LINUX_GATEWAY_SPACE, %r20, intr_restore /* backward */ 905 - 906 - /* NOTE: We need to enable interrupts if we have to deliver 907 - * signals. We used to do this earlier but it caused kernel 908 - * stack overflows. */ 909 - ssm PSW_SM_I, %r0 904 + cmpib,COND(=),n LINUX_GATEWAY_SPACE, %r20, intr_restore /* forward */ 910 905 911 906 copy %r0, %r25 /* long in_syscall = 0 */ 912 907 #ifdef CONFIG_64BIT 913 908 ldo -16(%r30),%r29 /* Reference param save area */ 914 909 #endif 910 + 911 + /* NOTE: We need to enable interrupts if we have to deliver 912 + * signals. We used to do this earlier but it caused kernel 913 + * stack overflows. */ 914 + ssm PSW_SM_I, %r0 915 915 916 916 BL do_notify_resume,%r2 917 917 copy %r16, %r26 /* struct pt_regs *regs */
+30
arch/parisc/kernel/inventory.c
··· 19 19 #include <linux/init.h> 20 20 #include <linux/slab.h> 21 21 #include <linux/mm.h> 22 + #include <linux/platform_device.h> 22 23 #include <asm/hardware.h> 23 24 #include <asm/io.h> 24 25 #include <asm/mmzone.h> ··· 641 640 pa_serialize_tlb_flushes = machine_has_merced_bus(); 642 641 if (pa_serialize_tlb_flushes) 643 642 pr_info("Merced bus found: Enable PxTLB serialization.\n"); 643 + #endif 644 + 645 + #if defined(CONFIG_FW_CFG_SYSFS) 646 + if (running_on_qemu) { 647 + struct resource res[3] = {0,}; 648 + unsigned int base; 649 + 650 + base = ((unsigned long long) PAGE0->pad0[2] << 32) 651 + | PAGE0->pad0[3]; /* SeaBIOS stored it here */ 652 + 653 + res[0].name = "fw_cfg"; 654 + res[0].start = base; 655 + res[0].end = base + 8 - 1; 656 + res[0].flags = IORESOURCE_MEM; 657 + 658 + res[1].name = "ctrl"; 659 + res[1].start = 0; 660 + res[1].flags = IORESOURCE_REG; 661 + 662 + res[2].name = "data"; 663 + res[2].start = 4; 664 + res[2].flags = IORESOURCE_REG; 665 + 666 + if (base) { 667 + pr_info("Found qemu fw_cfg interface at %#08x\n", base); 668 + platform_device_register_simple("fw_cfg", 669 + PLATFORM_DEVID_NONE, res, 3); 670 + } 671 + } 644 672 #endif 645 673 }
+6 -3
arch/parisc/kernel/smp.c
··· 173 173 this_cpu, which); 174 174 return IRQ_NONE; 175 175 } /* Switch */ 176 - /* let in any pending interrupts */ 177 - local_irq_enable(); 178 - local_irq_disable(); 176 + 177 + /* before doing more, let in any pending interrupts */ 178 + if (ops) { 179 + local_irq_enable(); 180 + local_irq_disable(); 181 + } 179 182 } /* while (ops) */ 180 183 } 181 184 return IRQ_HANDLED;
+5 -5
arch/parisc/kernel/syscall.S
··· 571 571 ldil L%lws_lock_start, %r20 572 572 ldo R%lws_lock_start(%r20), %r28 573 573 574 - /* Extract four bits from r26 and hash lock (Bits 4-7) */ 575 - extru %r26, 27, 4, %r20 574 + /* Extract eight bits from r26 and hash lock (Bits 3-11) */ 575 + extru %r26, 28, 8, %r20 576 576 577 577 /* Find lock to use, the hash is either one of 0 to 578 578 15, multiplied by 16 (keep it 16-byte aligned) ··· 761 761 ldil L%lws_lock_start, %r20 762 762 ldo R%lws_lock_start(%r20), %r28 763 763 764 - /* Extract four bits from r26 and hash lock (Bits 4-7) */ 765 - extru %r26, 27, 4, %r20 764 + /* Extract eight bits from r26 and hash lock (Bits 3-11) */ 765 + extru %r26, 28, 8, %r20 766 766 767 767 /* Find lock to use, the hash is either one of 0 to 768 768 15, multiplied by 16 (keep it 16-byte aligned) ··· 950 950 .align L1_CACHE_BYTES 951 951 ENTRY(lws_lock_start) 952 952 /* lws locks */ 953 - .rept 16 953 + .rept 256 954 954 /* Keep locks aligned at 16-bytes */ 955 955 .word 1 956 956 .word 0
+3 -3
arch/parisc/lib/bitops.c
··· 18 18 #endif 19 19 20 20 #ifdef CONFIG_64BIT 21 - unsigned long __xchg64(unsigned long x, unsigned long *ptr) 21 + unsigned long __xchg64(unsigned long x, volatile unsigned long *ptr) 22 22 { 23 23 unsigned long temp, flags; 24 24 ··· 30 30 } 31 31 #endif 32 32 33 - unsigned long __xchg32(int x, int *ptr) 33 + unsigned long __xchg32(int x, volatile int *ptr) 34 34 { 35 35 unsigned long flags; 36 36 long temp; ··· 43 43 } 44 44 45 45 46 - unsigned long __xchg8(char x, char *ptr) 46 + unsigned long __xchg8(char x, volatile char *ptr) 47 47 { 48 48 unsigned long flags; 49 49 long temp;
+18
arch/parisc/lib/iomap.c
··· 346 346 return *((u64 *)addr); 347 347 } 348 348 349 + u64 ioread64_hi_lo(const void __iomem *addr) 350 + { 351 + u32 low, high; 352 + 353 + high = ioread32(addr + sizeof(u32)); 354 + low = ioread32(addr); 355 + 356 + return low + ((u64)high << 32); 357 + } 358 + 349 359 void iowrite8(u8 datum, void __iomem *addr) 350 360 { 351 361 if (unlikely(INDIRECT_ADDR(addr))) { ··· 417 407 } else { 418 408 *((u64 *)addr) = datum; 419 409 } 410 + } 411 + 412 + void iowrite64_hi_lo(u64 val, void __iomem *addr) 413 + { 414 + iowrite32(val >> 32, addr + sizeof(u32)); 415 + iowrite32(val, addr); 420 416 } 421 417 422 418 /* Repeating interfaces */ ··· 527 511 EXPORT_SYMBOL(ioread32be); 528 512 EXPORT_SYMBOL(ioread64); 529 513 EXPORT_SYMBOL(ioread64be); 514 + EXPORT_SYMBOL(ioread64_hi_lo); 530 515 EXPORT_SYMBOL(iowrite8); 531 516 EXPORT_SYMBOL(iowrite16); 532 517 EXPORT_SYMBOL(iowrite16be); ··· 535 518 EXPORT_SYMBOL(iowrite32be); 536 519 EXPORT_SYMBOL(iowrite64); 537 520 EXPORT_SYMBOL(iowrite64be); 521 + EXPORT_SYMBOL(iowrite64_hi_lo); 538 522 EXPORT_SYMBOL(ioread8_rep); 539 523 EXPORT_SYMBOL(ioread16_rep); 540 524 EXPORT_SYMBOL(ioread32_rep);
+1 -1
drivers/firmware/Kconfig
··· 186 186 187 187 config FW_CFG_SYSFS 188 188 tristate "QEMU fw_cfg device support in sysfs" 189 - depends on SYSFS && (ARM || ARM64 || PPC_PMAC || SPARC || X86) 189 + depends on SYSFS && (ARM || ARM64 || PARISC || PPC_PMAC || SPARC || X86) 190 190 depends on HAS_IOPORT_MAP 191 191 default n 192 192 help
+3
drivers/firmware/qemu_fw_cfg.c
··· 215 215 # define FW_CFG_CTRL_OFF 0x08 216 216 # define FW_CFG_DATA_OFF 0x00 217 217 # define FW_CFG_DMA_OFF 0x10 218 + # elif defined(CONFIG_PARISC) /* parisc */ 219 + # define FW_CFG_CTRL_OFF 0x00 220 + # define FW_CFG_DATA_OFF 0x04 218 221 # elif (defined(CONFIG_PPC_PMAC) || defined(CONFIG_SPARC32)) /* ppc/mac,sun4m */ 219 222 # define FW_CFG_CTRL_OFF 0x00 220 223 # define FW_CFG_DATA_OFF 0x02
+1
drivers/video/console/Kconfig
··· 119 119 bool "STI text console" 120 120 depends on PARISC && HAS_IOMEM 121 121 select FONT_SUPPORT 122 + select CRC32 122 123 default y 123 124 help 124 125 The STI console is the builtin display/keyboard on HP-PARISC
+170 -127
drivers/video/console/sticon.c
··· 2 2 * linux/drivers/video/console/sticon.c - console driver using HP's STI firmware 3 3 * 4 4 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> 5 - * Copyright (C) 2002 Helge Deller <deller@gmx.de> 5 + * Copyright (C) 2002-2020 Helge Deller <deller@gmx.de> 6 6 * 7 7 * Based on linux/drivers/video/vgacon.c and linux/drivers/video/fbcon.c, 8 8 * which were ··· 43 43 #include <linux/kd.h> 44 44 #include <linux/selection.h> 45 45 #include <linux/module.h> 46 + #include <linux/slab.h> 47 + #include <linux/font.h> 48 + #include <linux/crc32.h> 46 49 47 50 #include <asm/io.h> 48 51 ··· 55 52 #define BLANK 0 56 53 static int vga_is_gfx; 57 54 55 + #define STI_DEF_FONT sticon_sti->font 56 + 57 + /* borrowed from fbcon.c */ 58 + #define FNTREFCOUNT(fd) (fd->refcount) 59 + #define FNTCRC(fd) (fd->crc) 60 + static struct sti_cooked_font *font_data[MAX_NR_CONSOLES]; 61 + 58 62 /* this is the sti_struct used for this console */ 59 63 static struct sti_struct *sticon_sti; 60 - 61 - /* Software scrollback */ 62 - static unsigned long softback_buf, softback_curr; 63 - static unsigned long softback_in; 64 - static unsigned long /* softback_top, */ softback_end; 65 - static int softback_lines; 66 - 67 - /* software cursor */ 68 - static int cursor_drawn; 69 - #define CURSOR_DRAW_DELAY (1) 70 - #define DEFAULT_CURSOR_BLINK_RATE (20) 71 - 72 - static int vbl_cursor_cnt; 73 - 74 - static inline void cursor_undrawn(void) 75 - { 76 - vbl_cursor_cnt = 0; 77 - cursor_drawn = 0; 78 - } 79 64 80 65 static const char *sticon_startup(void) 81 66 { ··· 72 81 73 82 static void sticon_putc(struct vc_data *conp, int c, int ypos, int xpos) 74 83 { 75 - int redraw_cursor = 0; 76 - 77 84 if (vga_is_gfx || console_blanked) 78 85 return; 79 86 80 87 if (conp->vc_mode != KD_TEXT) 81 88 return; 82 - #if 0 83 - if ((p->cursor_x == xpos) && (p->cursor_y == ypos)) { 84 - cursor_undrawn(); 85 - redraw_cursor = 1; 86 - } 87 - #endif 88 89 89 - sti_putc(sticon_sti, c, ypos, xpos); 90 - 91 - if (redraw_cursor) 92 - vbl_cursor_cnt = CURSOR_DRAW_DELAY; 90 + sti_putc(sticon_sti, c, ypos, xpos, font_data[conp->vc_num]); 93 91 } 94 92 95 93 static void sticon_putcs(struct vc_data *conp, const unsigned short *s, 96 94 int count, int ypos, int xpos) 97 95 { 98 - int redraw_cursor = 0; 99 - 100 96 if (vga_is_gfx || console_blanked) 101 97 return; 102 98 103 99 if (conp->vc_mode != KD_TEXT) 104 100 return; 105 101 106 - #if 0 107 - if ((p->cursor_y == ypos) && (xpos <= p->cursor_x) && 108 - (p->cursor_x < (xpos + count))) { 109 - cursor_undrawn(); 110 - redraw_cursor = 1; 111 - } 112 - #endif 113 - 114 102 while (count--) { 115 - sti_putc(sticon_sti, scr_readw(s++), ypos, xpos++); 103 + sti_putc(sticon_sti, scr_readw(s++), ypos, xpos++, 104 + font_data[conp->vc_num]); 116 105 } 117 - 118 - if (redraw_cursor) 119 - vbl_cursor_cnt = CURSOR_DRAW_DELAY; 120 106 } 121 107 122 108 static void sticon_cursor(struct vc_data *conp, int mode) 123 109 { 124 110 unsigned short car1; 125 111 112 + /* no cursor update if screen is blanked */ 113 + if (vga_is_gfx || console_blanked) 114 + return; 115 + 126 116 car1 = conp->vc_screenbuf[conp->state.x + conp->state.y * conp->vc_cols]; 127 117 switch (mode) { 128 118 case CM_ERASE: 129 - sti_putc(sticon_sti, car1, conp->state.y, conp->state.x); 119 + sti_putc(sticon_sti, car1, conp->state.y, conp->state.x, 120 + font_data[conp->vc_num]); 130 121 break; 131 122 case CM_MOVE: 132 123 case CM_DRAW: ··· 119 146 case CUR_TWO_THIRDS: 120 147 case CUR_BLOCK: 121 148 sti_putc(sticon_sti, (car1 & 255) + (0 << 8) + (7 << 11), 122 - conp->state.y, conp->state.x); 149 + conp->state.y, conp->state.x, font_data[conp->vc_num]); 123 150 break; 124 151 } 125 152 break; ··· 138 165 139 166 switch (dir) { 140 167 case SM_UP: 141 - sti_bmove(sti, t + count, 0, t, 0, b - t - count, conp->vc_cols); 142 - sti_clear(sti, b - count, 0, count, conp->vc_cols, conp->vc_video_erase_char); 168 + sti_bmove(sti, t + count, 0, t, 0, b - t - count, conp->vc_cols, 169 + font_data[conp->vc_num]); 170 + sti_clear(sti, b - count, 0, count, conp->vc_cols, 171 + conp->vc_video_erase_char, font_data[conp->vc_num]); 143 172 break; 144 173 145 174 case SM_DOWN: 146 - sti_bmove(sti, t, 0, t + count, 0, b - t - count, conp->vc_cols); 147 - sti_clear(sti, t, 0, count, conp->vc_cols, conp->vc_video_erase_char); 175 + sti_bmove(sti, t, 0, t + count, 0, b - t - count, conp->vc_cols, 176 + font_data[conp->vc_num]); 177 + sti_clear(sti, t, 0, count, conp->vc_cols, 178 + conp->vc_video_erase_char, font_data[conp->vc_num]); 148 179 break; 149 180 } 150 181 151 182 return false; 183 + } 184 + 185 + static int sticon_set_def_font(int unit, struct console_font *op) 186 + { 187 + if (font_data[unit] != STI_DEF_FONT) { 188 + if (--FNTREFCOUNT(font_data[unit]) == 0) { 189 + kfree(font_data[unit]->raw_ptr); 190 + kfree(font_data[unit]); 191 + } 192 + font_data[unit] = STI_DEF_FONT; 193 + } 194 + 195 + return 0; 196 + } 197 + 198 + static int sticon_set_font(struct vc_data *vc, struct console_font *op) 199 + { 200 + struct sti_struct *sti = sticon_sti; 201 + int vc_cols, vc_rows, vc_old_cols, vc_old_rows; 202 + int unit = vc->vc_num; 203 + int w = op->width; 204 + int h = op->height; 205 + int size, i, bpc, pitch; 206 + struct sti_rom_font *new_font; 207 + struct sti_cooked_font *cooked_font; 208 + unsigned char *data = op->data, *p; 209 + 210 + if ((w < 6) || (h < 6) || (w > 32) || (h > 32) 211 + || (op->charcount != 256 && op->charcount != 512)) 212 + return -EINVAL; 213 + pitch = ALIGN(w, 8) / 8; 214 + bpc = pitch * h; 215 + size = bpc * op->charcount; 216 + 217 + new_font = kmalloc(sizeof(*new_font) + size, STI_LOWMEM); 218 + if (!new_font) 219 + return -ENOMEM; 220 + 221 + new_font->first_char = 0; 222 + new_font->last_char = op->charcount - 1; 223 + new_font->width = w; 224 + new_font->height = h; 225 + new_font->font_type = STI_FONT_HPROMAN8; 226 + new_font->bytes_per_char = bpc; 227 + new_font->underline_height = 0; 228 + new_font->underline_pos = 0; 229 + 230 + cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL); 231 + if (!cooked_font) { 232 + kfree(new_font); 233 + return -ENOMEM; 234 + } 235 + cooked_font->raw = new_font; 236 + cooked_font->raw_ptr = new_font; 237 + cooked_font->width = w; 238 + cooked_font->height = h; 239 + FNTREFCOUNT(cooked_font) = 0; /* usage counter */ 240 + 241 + p = (unsigned char *) new_font; 242 + p += sizeof(*new_font); 243 + for (i = 0; i < op->charcount; i++) { 244 + memcpy(p, data, bpc); 245 + data += pitch*32; 246 + p += bpc; 247 + } 248 + FNTCRC(cooked_font) = crc32(0, new_font, size + sizeof(*new_font)); 249 + sti_font_convert_bytemode(sti, cooked_font); 250 + new_font = cooked_font->raw_ptr; 251 + 252 + /* check if font is already used by other console */ 253 + for (i = 0; i < MAX_NR_CONSOLES; i++) { 254 + if (font_data[i] != STI_DEF_FONT 255 + && (FNTCRC(font_data[i]) == FNTCRC(cooked_font))) { 256 + kfree(new_font); 257 + kfree(cooked_font); 258 + /* current font is the same as the new one */ 259 + if (i == unit) 260 + return 0; 261 + cooked_font = font_data[i]; 262 + new_font = cooked_font->raw_ptr; 263 + break; 264 + } 265 + } 266 + 267 + /* clear screen with old font: we now may have less rows */ 268 + vc_old_rows = vc->vc_rows; 269 + vc_old_cols = vc->vc_cols; 270 + sti_clear(sticon_sti, 0, 0, vc_old_rows, vc_old_cols, 271 + vc->vc_video_erase_char, font_data[vc->vc_num]); 272 + 273 + /* delete old font in case it is a user font */ 274 + sticon_set_def_font(unit, NULL); 275 + 276 + FNTREFCOUNT(cooked_font)++; 277 + font_data[unit] = cooked_font; 278 + 279 + vc_cols = sti_onscreen_x(sti) / cooked_font->width; 280 + vc_rows = sti_onscreen_y(sti) / cooked_font->height; 281 + vc_resize(vc, vc_cols, vc_rows); 282 + 283 + /* need to repaint screen if cols & rows are same as old font */ 284 + if (vc_cols == vc_old_cols && vc_rows == vc_old_rows) 285 + update_screen(vc); 286 + 287 + return 0; 288 + } 289 + 290 + static int sticon_font_default(struct vc_data *vc, struct console_font *op, char *name) 291 + { 292 + return sticon_set_def_font(vc->vc_num, op); 293 + } 294 + 295 + static int sticon_font_set(struct vc_data *vc, struct console_font *font, 296 + unsigned int flags) 297 + { 298 + return sticon_set_font(vc, font); 152 299 } 153 300 154 301 static void sticon_init(struct vc_data *c, int init) ··· 277 184 int vc_cols, vc_rows; 278 185 279 186 sti_set(sti, 0, 0, sti_onscreen_y(sti), sti_onscreen_x(sti), 0); 280 - vc_cols = sti_onscreen_x(sti) / sti->font_width; 281 - vc_rows = sti_onscreen_y(sti) / sti->font_height; 187 + vc_cols = sti_onscreen_x(sti) / sti->font->width; 188 + vc_rows = sti_onscreen_y(sti) / sti->font->height; 282 189 c->vc_can_do_color = 1; 283 190 284 191 if (init) { 285 192 c->vc_cols = vc_cols; 286 193 c->vc_rows = vc_rows; 287 194 } else { 288 - /* vc_rows = (c->vc_rows > vc_rows) ? vc_rows : c->vc_rows; */ 289 - /* vc_cols = (c->vc_cols > vc_cols) ? vc_cols : c->vc_cols; */ 290 195 vc_resize(c, vc_cols, vc_rows); 291 - /* vc_resize_con(vc_rows, vc_cols, c->vc_num); */ 292 196 } 293 197 } 294 198 295 199 static void sticon_deinit(struct vc_data *c) 296 200 { 201 + int i; 202 + 203 + /* free memory used by user font */ 204 + for (i = 0; i < MAX_NR_CONSOLES; i++) 205 + sticon_set_def_font(i, NULL); 297 206 } 298 207 299 208 static void sticon_clear(struct vc_data *conp, int sy, int sx, int height, ··· 304 209 if (!height || !width) 305 210 return; 306 211 307 - sti_clear(sticon_sti, sy, sx, height, width, conp->vc_video_erase_char); 212 + sti_clear(sticon_sti, sy, sx, height, width, 213 + conp->vc_video_erase_char, font_data[conp->vc_num]); 308 214 } 309 215 310 216 static int sticon_switch(struct vc_data *conp) ··· 320 224 vga_is_gfx = 0; 321 225 return 1; 322 226 } 323 - sti_clear(sticon_sti, 0,0, c->vc_rows, c->vc_cols, BLANK); 227 + sti_clear(sticon_sti, 0, 0, c->vc_rows, c->vc_cols, BLANK, 228 + font_data[c->vc_num]); 324 229 if (mode_switch) 325 230 vga_is_gfx = 1; 326 231 return 1; 327 - } 328 - 329 - static u16 *sticon_screen_pos(const struct vc_data *conp, int offset) 330 - { 331 - int line; 332 - unsigned long p; 333 - 334 - if (conp->vc_num != fg_console || !softback_lines) 335 - return (u16 *)(conp->vc_origin + offset); 336 - line = offset / conp->vc_size_row; 337 - if (line >= softback_lines) 338 - return (u16 *)(conp->vc_origin + offset - softback_lines * conp->vc_size_row); 339 - p = softback_curr + offset; 340 - if (p >= softback_end) 341 - p += softback_buf - softback_end; 342 - return (u16 *)p; 343 - } 344 - 345 - static unsigned long sticon_getxy(struct vc_data *conp, unsigned long pos, 346 - int *px, int *py) 347 - { 348 - int x, y; 349 - unsigned long ret; 350 - if (pos >= conp->vc_origin && pos < conp->vc_scr_end) { 351 - unsigned long offset = (pos - conp->vc_origin) / 2; 352 - 353 - x = offset % conp->vc_cols; 354 - y = offset / conp->vc_cols; 355 - if (conp->vc_num == fg_console) 356 - y += softback_lines; 357 - ret = pos + (conp->vc_cols - x) * 2; 358 - } else if (conp->vc_num == fg_console && softback_lines) { 359 - unsigned long offset = pos - softback_curr; 360 - 361 - if (pos < softback_curr) 362 - offset += softback_end - softback_buf; 363 - offset /= 2; 364 - x = offset % conp->vc_cols; 365 - y = offset / conp->vc_cols; 366 - ret = pos + (conp->vc_cols - x) * 2; 367 - if (ret == softback_end) 368 - ret = softback_buf; 369 - if (ret == softback_in) 370 - ret = conp->vc_origin; 371 - } else { 372 - /* Should not happen */ 373 - x = y = 0; 374 - ret = conp->vc_origin; 375 - } 376 - if (px) *px = x; 377 - if (py) *py = y; 378 - return ret; 379 232 } 380 233 381 234 static u8 sticon_build_attr(struct vc_data *conp, u8 color, ··· 357 312 } 358 313 } 359 314 360 - static void sticon_save_screen(struct vc_data *conp) 361 - { 362 - } 363 - 364 315 static const struct consw sti_con = { 365 316 .owner = THIS_MODULE, 366 317 .con_startup = sticon_startup, ··· 369 328 .con_scroll = sticon_scroll, 370 329 .con_switch = sticon_switch, 371 330 .con_blank = sticon_blank, 372 - .con_save_screen = sticon_save_screen, 331 + .con_font_set = sticon_font_set, 332 + .con_font_default = sticon_font_default, 373 333 .con_build_attr = sticon_build_attr, 374 334 .con_invert_region = sticon_invert_region, 375 - .con_screen_pos = sticon_screen_pos, 376 - .con_getxy = sticon_getxy, 377 335 }; 378 336 379 337 380 338 381 339 static int __init sticonsole_init(void) 382 340 { 383 - int err; 341 + int err, i; 342 + 384 343 /* already initialized ? */ 385 344 if (sticon_sti) 386 345 return 0; ··· 389 348 if (!sticon_sti) 390 349 return -ENODEV; 391 350 392 - if (conswitchp == &dummy_con) { 393 - printk(KERN_INFO "sticon: Initializing STI text console.\n"); 394 - console_lock(); 395 - err = do_take_over_console(&sti_con, 0, MAX_NR_CONSOLES - 1, 1); 396 - console_unlock(); 397 - return err; 398 - } 399 - return 0; 351 + for (i = 0; i < MAX_NR_CONSOLES; i++) 352 + font_data[i] = STI_DEF_FONT; 353 + 354 + pr_info("sticon: Initializing STI text console.\n"); 355 + console_lock(); 356 + err = do_take_over_console(&sti_con, 0, MAX_NR_CONSOLES - 1, 357 + PAGE0->mem_cons.cl_class != CL_DUPLEX); 358 + console_unlock(); 359 + 360 + return err; 400 361 } 401 362 402 363 module_init(sticonsole_init);
+149 -135
drivers/video/console/sticore.c
··· 4 4 * core code for console driver using HP's STI firmware 5 5 * 6 6 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> 7 - * Copyright (C) 2001-2013 Helge Deller <deller@gmx.de> 7 + * Copyright (C) 2001-2020 Helge Deller <deller@gmx.de> 8 8 * Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@alpha.franken.de> 9 9 * 10 10 * TODO: ··· 13 13 * - try to make it work on m68k hp workstations ;) 14 14 * 15 15 */ 16 + 17 + #define pr_fmt(fmt) "%s: " fmt, KBUILD_MODNAME 16 18 17 19 #include <linux/module.h> 18 20 #include <linux/types.h> ··· 135 133 }; 136 134 137 135 void 138 - sti_putc(struct sti_struct *sti, int c, int y, int x) 136 + sti_putc(struct sti_struct *sti, int c, int y, int x, 137 + struct sti_cooked_font *font) 139 138 { 140 139 struct sti_font_inptr *inptr = &sti->sti_data->font_inptr; 141 140 struct sti_font_inptr inptr_default = { 142 - .font_start_addr= STI_PTR(sti->font->raw), 141 + .font_start_addr = STI_PTR(font->raw), 143 142 .index = c_index(sti, c), 144 143 .fg_color = c_fg(sti, c), 145 144 .bg_color = c_bg(sti, c), 146 - .dest_x = x * sti->font_width, 147 - .dest_y = y * sti->font_height, 145 + .dest_x = x * font->width, 146 + .dest_y = y * font->height, 148 147 }; 149 148 struct sti_font_outptr *outptr = &sti->sti_data->font_outptr; 150 149 s32 ret; ··· 196 193 197 194 void 198 195 sti_clear(struct sti_struct *sti, int src_y, int src_x, 199 - int height, int width, int c) 196 + int height, int width, int c, struct sti_cooked_font *font) 200 197 { 201 198 struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; 202 199 struct sti_blkmv_inptr inptr_default = { 203 200 .fg_color = c_fg(sti, c), 204 201 .bg_color = c_bg(sti, c), 205 - .src_x = src_x * sti->font_width, 206 - .src_y = src_y * sti->font_height, 207 - .dest_x = src_x * sti->font_width, 208 - .dest_y = src_y * sti->font_height, 209 - .width = width * sti->font_width, 210 - .height = height* sti->font_height, 202 + .src_x = src_x * font->width, 203 + .src_y = src_y * font->height, 204 + .dest_x = src_x * font->width, 205 + .dest_y = src_y * font->height, 206 + .width = width * font->width, 207 + .height = height * font->height, 211 208 }; 212 209 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; 213 210 s32 ret; ··· 228 225 229 226 void 230 227 sti_bmove(struct sti_struct *sti, int src_y, int src_x, 231 - int dst_y, int dst_x, int height, int width) 228 + int dst_y, int dst_x, int height, int width, 229 + struct sti_cooked_font *font) 232 230 { 233 231 struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; 234 232 struct sti_blkmv_inptr inptr_default = { 235 - .src_x = src_x * sti->font_width, 236 - .src_y = src_y * sti->font_height, 237 - .dest_x = dst_x * sti->font_width, 238 - .dest_y = dst_y * sti->font_height, 239 - .width = width * sti->font_width, 240 - .height = height* sti->font_height, 233 + .src_x = src_x * font->width, 234 + .src_y = src_y * font->height, 235 + .dest_x = dst_x * font->width, 236 + .dest_y = dst_y * font->height, 237 + .width = width * font->width, 238 + .height = height * font->height, 241 239 }; 242 240 struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; 243 241 s32 ret; ··· 305 301 306 302 307 303 308 - static char *font_name[MAX_STI_ROMS]; 309 - static int font_index[MAX_STI_ROMS], 310 - font_height[MAX_STI_ROMS], 311 - font_width[MAX_STI_ROMS]; 304 + static char *font_name; 305 + static int font_index, 306 + font_height, 307 + font_width; 312 308 #ifndef MODULE 313 309 static int sti_font_setup(char *str) 314 310 { 315 - char *x; 316 - int i = 0; 311 + /* 312 + * The default font can be selected in various ways. 313 + * a) sti_font=VGA8x16, sti_font=10x20, sti_font=10*20 selects 314 + * an built-in Linux framebuffer font. 315 + * b) sti_font=<index>, where index is (1..x) with 1 selecting 316 + * the first HP STI ROM built-in font.. 317 + */ 317 318 318 - /* we accept sti_font=VGA8x16, sti_font=10x20, sti_font=10*20 319 - * or sti_font=7 style command lines. */ 319 + if (*str >= '0' && *str <= '9') { 320 + char *x; 320 321 321 - while (i<MAX_STI_ROMS && str && *str) { 322 - if (*str>='0' && *str<='9') { 323 - if ((x = strchr(str, 'x')) || (x = strchr(str, '*'))) { 324 - font_height[i] = simple_strtoul(str, NULL, 0); 325 - font_width[i] = simple_strtoul(x+1, NULL, 0); 326 - } else { 327 - font_index[i] = simple_strtoul(str, NULL, 0); 328 - } 322 + if ((x = strchr(str, 'x')) || (x = strchr(str, '*'))) { 323 + font_height = simple_strtoul(str, NULL, 0); 324 + font_width = simple_strtoul(x+1, NULL, 0); 329 325 } else { 330 - font_name[i] = str; /* fb font name */ 326 + font_index = simple_strtoul(str, NULL, 0); 331 327 } 332 - 333 - if ((x = strchr(str, ','))) 334 - *x++ = 0; 335 - str = x; 336 - 337 - i++; 328 + } else { 329 + font_name = str; /* fb font name */ 338 330 } 339 331 340 332 return 1; ··· 344 344 * framebuffer font names (e.g. VGA8x16, SUN22x18). 345 345 * This is only available if the fonts have been statically compiled 346 346 * in with e.g. the CONFIG_FONT_8x16 or CONFIG_FONT_SUN12x22 options. 347 - * - sti_font=<number> 347 + * - sti_font=<number> (<number> = 1,2,3,...) 348 348 * most STI ROMs have built-in HP specific fonts, which can be selected 349 349 * by giving the desired number to the sticon driver. 350 350 * NOTE: This number is machine and STI ROM dependend. ··· 364 364 { 365 365 struct sti_glob_cfg_ext *cfg; 366 366 367 - DPRINTK((KERN_INFO 368 - "%d text planes\n" 367 + pr_debug("%d text planes\n" 369 368 "%4d x %4d screen resolution\n" 370 369 "%4d x %4d offscreen\n" 371 370 "%4d x %4d layout\n" ··· 381 382 glob_cfg->region_ptrs[4], glob_cfg->region_ptrs[5], 382 383 glob_cfg->region_ptrs[6], glob_cfg->region_ptrs[7], 383 384 glob_cfg->reent_lvl, 384 - glob_cfg->save_addr)); 385 + glob_cfg->save_addr); 385 386 386 387 /* dump extended cfg */ 387 388 cfg = PTR_STI((unsigned long)glob_cfg->ext_ptr); 388 - DPRINTK(( KERN_INFO 389 - "monitor %d\n" 389 + pr_debug("monitor %d\n" 390 390 "in friendly mode: %d\n" 391 391 "power consumption %d watts\n" 392 392 "freq ref %d\n" ··· 394 396 cfg->friendly_boot, 395 397 cfg->power, 396 398 cfg->freq_ref, 397 - cfg->sti_mem_addr, sti_mem_request)); 399 + cfg->sti_mem_addr, sti_mem_request); 398 400 } 399 401 400 402 static void sti_dump_outptr(struct sti_struct *sti) 401 403 { 402 - DPRINTK((KERN_INFO 403 - "%d bits per pixel\n" 404 + pr_debug("%d bits per pixel\n" 404 405 "%d used bits\n" 405 406 "%d planes\n" 406 407 "attributes %08x\n", 407 408 sti->sti_data->inq_outptr.bits_per_pixel, 408 409 sti->sti_data->inq_outptr.bits_used, 409 410 sti->sti_data->inq_outptr.planes, 410 - sti->sti_data->inq_outptr.attributes)); 411 + sti->sti_data->inq_outptr.attributes); 411 412 } 412 413 413 414 static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, ··· 445 448 if (offs != PCI_ROM_ADDRESS && 446 449 (offs < PCI_BASE_ADDRESS_0 || 447 450 offs > PCI_BASE_ADDRESS_5)) { 448 - printk (KERN_WARNING 449 - "STI pci region mapping for region %d (%02x) can't be mapped\n", 451 + pr_warn("STI pci region mapping for region %d (%02x) can't be mapped\n", 450 452 i,sti->rm_entry[i]); 451 453 continue; 452 454 } ··· 460 464 if (len) 461 465 glob_cfg->region_ptrs[i] = sti->regions_phys[i]; 462 466 463 - DPRINTK(("region #%d: phys %08lx, region_ptr %08x, len=%lukB, " 467 + pr_debug("region #%d: phys %08lx, region_ptr %08x, len=%lukB, " 464 468 "btlb=%d, sysonly=%d, cache=%d, last=%d\n", 465 469 i, sti->regions_phys[i], glob_cfg->region_ptrs[i], 466 470 len/1024, 467 471 sti->regions[i].region_desc.btlb, 468 472 sti->regions[i].region_desc.sys_only, 469 473 sti->regions[i].region_desc.cache, 470 - sti->regions[i].region_desc.last)); 474 + sti->regions[i].region_desc.last); 471 475 472 476 /* last entry reached ? */ 473 477 if (sti->regions[i].region_desc.last) ··· 475 479 } 476 480 477 481 if (++i<8 && sti->regions[i].region) 478 - printk(KERN_WARNING "%s: *future ptr (0x%8x) not yet supported !\n", 479 - __FILE__, sti->regions[i].region); 482 + pr_warn("future ptr (0x%8x) not yet supported !\n", 483 + sti->regions[i].region); 480 484 481 485 glob_cfg_ext->sti_mem_addr = STI_PTR(sti_mem_addr); 482 486 ··· 534 538 } 535 539 536 540 cooked_font->raw = nf; 541 + cooked_font->raw_ptr = nf; 537 542 cooked_font->next_font = NULL; 538 543 539 544 cooked_rom->font_start = cooked_font; ··· 549 552 } 550 553 #endif 551 554 552 - static struct sti_cooked_font *sti_select_font(struct sti_cooked_rom *rom, 553 - int (*search_font_fnc)(struct sti_cooked_rom *, int, int)) 555 + static int sti_search_font(struct sti_cooked_rom *rom, int height, int width) 556 + { 557 + struct sti_cooked_font *font; 558 + int i = 0; 559 + 560 + for (font = rom->font_start; font; font = font->next_font, i++) { 561 + if ((font->raw->width == width) && 562 + (font->raw->height == height)) 563 + return i; 564 + } 565 + return 0; 566 + } 567 + 568 + static struct sti_cooked_font *sti_select_font(struct sti_cooked_rom *rom) 554 569 { 555 570 struct sti_cooked_font *font; 556 571 int i; 557 - int index = num_sti_roms; 558 572 559 573 /* check for framebuffer-font first */ 560 - if ((font = sti_select_fbfont(rom, font_name[index]))) 561 - return font; 574 + if (!font_index) { 575 + font = sti_select_fbfont(rom, font_name); 576 + if (font) 577 + return font; 578 + } 562 579 563 - if (font_width[index] && font_height[index]) 564 - font_index[index] = search_font_fnc(rom, 565 - font_height[index], font_width[index]); 580 + if (font_width && font_height) 581 + font_index = sti_search_font(rom, 582 + font_height, font_width); 566 583 567 - for (font = rom->font_start, i = font_index[index]; 568 - font && (i > 0); 569 - font = font->next_font, i--); 584 + for (font = rom->font_start, i = font_index - 1; 585 + font && (i > 0); 586 + font = font->next_font, i--); 570 587 571 588 if (font) 572 589 return font; ··· 589 578 } 590 579 591 580 592 - static void sti_dump_rom(struct sti_rom *rom) 581 + static void sti_dump_rom(struct sti_struct *sti) 593 582 { 594 - printk(KERN_INFO " id %04x-%04x, conforms to spec rev. %d.%02x\n", 583 + struct sti_rom *rom = sti->rom->raw; 584 + struct sti_cooked_font *font_start; 585 + int nr; 586 + 587 + pr_info(" id %04x-%04x, conforms to spec rev. %d.%02x\n", 595 588 rom->graphics_id[0], 596 589 rom->graphics_id[1], 597 590 rom->revno[0] >> 4, 598 591 rom->revno[0] & 0x0f); 599 - DPRINTK((" supports %d monitors\n", rom->num_mons)); 600 - DPRINTK((" font start %08x\n", rom->font_start)); 601 - DPRINTK((" region list %08x\n", rom->region_list)); 602 - DPRINTK((" init_graph %08x\n", rom->init_graph)); 603 - DPRINTK((" bus support %02x\n", rom->bus_support)); 604 - DPRINTK((" ext bus support %02x\n", rom->ext_bus_support)); 605 - DPRINTK((" alternate code type %d\n", rom->alt_code_type)); 592 + pr_debug(" supports %d monitors\n", rom->num_mons); 593 + pr_debug(" font start %08x\n", rom->font_start); 594 + pr_debug(" region list %08x\n", rom->region_list); 595 + pr_debug(" init_graph %08x\n", rom->init_graph); 596 + pr_debug(" bus support %02x\n", rom->bus_support); 597 + pr_debug(" ext bus support %02x\n", rom->ext_bus_support); 598 + pr_debug(" alternate code type %d\n", rom->alt_code_type); 599 + 600 + font_start = sti->rom->font_start; 601 + nr = 0; 602 + while (font_start) { 603 + struct sti_rom_font *f = font_start->raw; 604 + 605 + pr_info(" built-in font #%d: size %dx%d, chars %d-%d, bpc %d\n", ++nr, 606 + f->width, f->height, 607 + f->first_char, f->last_char, f->bytes_per_char); 608 + font_start = font_start->next_font; 609 + } 606 610 } 607 611 608 612 ··· 654 628 return 1; 655 629 } 656 630 657 - 658 - static int sti_search_font(struct sti_cooked_rom *rom, int height, int width) 659 - { 660 - struct sti_cooked_font *font; 661 - int i = 0; 662 - 663 - for (font = rom->font_start; font; font = font->next_font, i++) { 664 - if ((font->raw->width == width) && 665 - (font->raw->height == height)) 666 - return i; 667 - } 668 - return 0; 669 - } 670 - 671 631 #define BMODE_RELOCATE(offset) offset = (offset) / 4; 672 632 #define BMODE_LAST_ADDR_OFFS 0x50 673 633 674 - static void *sti_bmode_font_raw(struct sti_cooked_font *f) 634 + void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f) 675 635 { 676 636 unsigned char *n, *p, *q; 677 - int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font); 678 - 637 + int size = f->raw->bytes_per_char * 256 + sizeof(struct sti_rom_font); 638 + struct sti_rom_font *old_font; 639 + 640 + if (sti->wordmode) 641 + return; 642 + 643 + old_font = f->raw_ptr; 679 644 n = kcalloc(4, size, STI_LOWMEM); 645 + f->raw_ptr = n; 680 646 if (!n) 681 - return NULL; 647 + return; 682 648 p = n + 3; 683 - q = (unsigned char *)f->raw; 649 + q = (unsigned char *) f->raw; 684 650 while (size--) { 685 651 *p = *q++; 686 - p+=4; 652 + p += 4; 687 653 } 688 - return n + 3; 654 + /* store new ptr to byte-mode font and delete old font */ 655 + f->raw = (struct sti_rom_font *) (n + 3); 656 + kfree(old_font); 689 657 } 658 + EXPORT_SYMBOL(sti_font_convert_bytemode); 690 659 691 660 static void sti_bmode_rom_copy(unsigned long base, unsigned long count, 692 661 void *dest) ··· 768 747 goto out_err; 769 748 770 749 if (!sti_cook_fonts(cooked, raw)) { 771 - printk(KERN_ERR "No font found for STI at %08lx\n", address); 750 + pr_warn("No font found for STI at %08lx\n", address); 772 751 goto out_err; 773 752 } 774 753 ··· 777 756 778 757 address = (unsigned long) STI_PTR(raw); 779 758 780 - pr_info("STI ROM supports 32 %sbit firmware functions.\n", 759 + pr_info("STI %s ROM supports 32 %sbit firmware functions.\n", 760 + wordmode ? "word mode" : "byte mode", 781 761 raw->alt_code_type == ALT_CODE_TYPE_PA_RISC_64 782 762 ? "and 64 " : ""); 783 763 ··· 789 767 790 768 sti->rom = cooked; 791 769 sti->rom->raw = raw; 792 - 793 - sti->font = sti_select_font(sti->rom, sti_search_font); 794 - sti->font_width = sti->font->raw->width; 795 - sti->font_height = sti->font->raw->height; 796 - if (!wordmode) 797 - sti->font->raw = sti_bmode_font_raw(sti->font); 770 + sti_dump_rom(sti); 771 + 772 + sti->wordmode = wordmode; 773 + sti->font = sti_select_font(sti->rom); 774 + sti->font->width = sti->font->raw->width; 775 + sti->font->height = sti->font->raw->height; 776 + sti_font_convert_bytemode(sti, sti->font); 798 777 799 778 sti->sti_mem_request = raw->sti_mem_req; 800 779 sti->graphics_id[0] = raw->graphics_id[0]; 801 780 sti->graphics_id[1] = raw->graphics_id[1]; 802 - 803 - sti_dump_rom(raw); 804 781 805 782 /* check if the ROM routines in this card are compatible */ 806 783 if (wordmode || sti->graphics_id[1] != 0x09A02587) ··· 825 804 return 1; 826 805 827 806 msg_not_supported: 828 - printk(KERN_ERR "Sorry, this GSC/STI card is not yet supported.\n"); 829 - printk(KERN_ERR "Please see http://parisc-linux.org/faq/" 830 - "graphics-howto.html for more info.\n"); 807 + pr_warn("Sorry, this GSC/STI card is not yet supported.\n"); 808 + pr_warn("Please see https://parisc.wiki.kernel.org/" 809 + "index.php/Graphics_howto for more info.\n"); 831 810 /* fall through */ 832 811 out_err: 833 812 kfree(raw); ··· 844 823 u32 sig; 845 824 846 825 if (num_sti_roms >= MAX_STI_ROMS) { 847 - printk(KERN_WARNING "maximum number of STI ROMS reached !\n"); 826 + pr_warn("maximum number of STI ROMS reached !\n"); 848 827 return NULL; 849 828 } 850 829 ··· 870 849 if (i != 1) { 871 850 /* The ROM could have multiple architecture 872 851 * dependent images (e.g. i386, parisc,...) */ 873 - printk(KERN_WARNING 874 - "PCI ROM is not a STI ROM type image (0x%8x)\n", i); 852 + pr_warn("PCI ROM is not a STI ROM type image (0x%8x)\n", i); 875 853 goto out_err; 876 854 } 877 855 878 856 sti->pd = pd; 879 857 880 858 i = gsc_readl(address+0x0c); 881 - DPRINTK(("PCI ROM size (from header) = %d kB\n", 882 - le16_to_cpu(i>>16)*512/1024)); 859 + pr_debug("PCI ROM size (from header) = %d kB\n", 860 + le16_to_cpu(i>>16)*512/1024); 883 861 rm_offset = le16_to_cpu(i & 0xffff); 884 862 if (rm_offset) { 885 863 /* read 16 bytes from the pci region mapper array */ ··· 887 867 *rm++ = gsc_readl(address+rm_offset+0x04); 888 868 *rm++ = gsc_readl(address+rm_offset+0x08); 889 869 *rm++ = gsc_readl(address+rm_offset+0x0c); 890 - DPRINTK(("PCI region Mapper offset = %08x: ", 891 - rm_offset)); 892 - for (i=0; i<16; i++) 893 - DPRINTK(("%02x ", sti->rm_entry[i])); 894 - DPRINTK(("\n")); 895 870 } 896 871 897 872 address += le32_to_cpu(gsc_readl(address+8)); 898 - DPRINTK(("sig %04x, PCI STI ROM at %08lx\n", sig, address)); 873 + pr_debug("sig %04x, PCI STI ROM at %08lx\n", sig, address); 899 874 goto test_rom; 900 875 } 901 876 902 877 ok = 0; 903 878 904 879 if ((sig & 0xff) == 0x01) { 905 - DPRINTK((" byte mode ROM at %08lx, hpa at %08lx\n", 906 - address, hpa)); 880 + pr_debug(" byte mode ROM at %08lx, hpa at %08lx\n", 881 + address, hpa); 907 882 ok = sti_read_rom(0, sti, address); 908 883 } 909 884 910 885 if ((sig & 0xffff) == 0x0303) { 911 - DPRINTK((" word mode ROM at %08lx, hpa at %08lx\n", 912 - address, hpa)); 886 + pr_debug(" word mode ROM at %08lx, hpa at %08lx\n", 887 + address, hpa); 913 888 ok = sti_read_rom(1, sti, address); 914 889 } 915 890 ··· 921 906 unsigned long rom_base; 922 907 rom_base = pci_resource_start(sti->pd, PCI_ROM_RESOURCE); 923 908 pci_write_config_dword(sti->pd, PCI_ROM_ADDRESS, rom_base & ~PCI_ROM_ADDRESS_ENABLE); 924 - DPRINTK((KERN_DEBUG "STI PCI ROM disabled\n")); 909 + pr_debug("STI PCI ROM disabled\n"); 925 910 } 926 911 927 912 if (sti_init_graph(sti)) ··· 996 981 rom_len = pci_resource_len(pd, PCI_ROM_RESOURCE); 997 982 if (rom_base) { 998 983 pci_write_config_dword(pd, PCI_ROM_ADDRESS, rom_base | PCI_ROM_ADDRESS_ENABLE); 999 - DPRINTK((KERN_DEBUG "STI PCI ROM enabled at 0x%08lx\n", rom_base)); 984 + pr_debug("STI PCI ROM enabled at 0x%08lx\n", rom_base); 1000 985 } 1001 986 1002 - printk(KERN_INFO "STI PCI graphic ROM found at %08lx (%u kB), fb at %08lx (%u MB)\n", 987 + pr_info("STI PCI graphic ROM found at %08lx (%u kB), fb at %08lx (%u MB)\n", 1003 988 rom_base, rom_len/1024, fb_base, fb_len/1024/1024); 1004 989 1005 - DPRINTK((KERN_DEBUG "Trying PCI STI ROM at %08lx, PCI hpa at %08lx\n", 1006 - rom_base, fb_base)); 990 + pr_debug("Trying PCI STI ROM at %08lx, PCI hpa at %08lx\n", 991 + rom_base, fb_base); 1007 992 1008 993 sti = sti_try_rom_generic(rom_base, fb_base, pd); 1009 994 if (sti) { ··· 1013 998 } 1014 999 1015 1000 if (!sti) { 1016 - printk(KERN_WARNING "Unable to handle STI device '%s'\n", 1017 - pci_name(pd)); 1001 + pr_warn("Unable to handle STI device '%s'\n", pci_name(pd)); 1018 1002 return -ENODEV; 1019 1003 } 1020 1004 #endif /* CONFIG_PCI */ ··· 1072 1058 1073 1059 sticore_initialized = 1; 1074 1060 1075 - printk(KERN_INFO "STI GSC/PCI core graphics driver " 1061 + pr_info("STI GSC/PCI core graphics driver " 1076 1062 STI_DRIVERVERSION "\n"); 1077 1063 1078 1064 /* Register drivers for native & PCI cards */
+13 -14
drivers/video/fbdev/sticore.h
··· 4 4 5 5 /* generic STI structures & functions */ 6 6 7 - #if 0 8 - #define DPRINTK(x) printk x 9 - #else 10 - #define DPRINTK(x) 11 - #endif 12 - 13 7 #define MAX_STI_ROMS 4 /* max no. of ROMs which this driver handles */ 14 8 15 9 #define STI_REGION_MAX 8 /* hardcoded STI constants */ ··· 240 246 /* sticore internal font handling */ 241 247 242 248 struct sti_cooked_font { 243 - struct sti_rom_font *raw; 249 + struct sti_rom_font *raw; /* native ptr for STI functions */ 250 + void *raw_ptr; /* kmalloc'ed font data */ 244 251 struct sti_cooked_font *next_font; 252 + int height, width; 253 + int refcount; 254 + u32 crc; 245 255 }; 246 256 247 257 struct sti_cooked_rom { ··· 339 341 struct sti_struct { 340 342 spinlock_t lock; 341 343 342 - /* the following fields needs to be filled in by the word/byte routines */ 343 - int font_width; 344 - int font_height; 345 344 /* char **mon_strings; */ 346 345 int sti_mem_request; 347 346 u32 graphics_id[2]; ··· 357 362 358 363 struct sti_glob_cfg *glob_cfg; /* points into sti_all_data */ 359 364 365 + int wordmode; 360 366 struct sti_cooked_font *font; /* ptr to selected font (cooked) */ 361 367 362 368 struct pci_dev *pd; ··· 376 380 /* sticore interface functions */ 377 381 378 382 struct sti_struct *sti_get_rom(unsigned int index); /* 0: default sti */ 383 + void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f); 379 384 380 385 381 386 /* sticore main function to call STI firmware */ ··· 388 391 389 392 /* functions to call the STI ROM directly */ 390 393 391 - void sti_putc(struct sti_struct *sti, int c, int y, int x); 394 + void sti_putc(struct sti_struct *sti, int c, int y, int x, 395 + struct sti_cooked_font *font); 392 396 void sti_set(struct sti_struct *sti, int src_y, int src_x, 393 - int height, int width, u8 color); 397 + int height, int width, u8 color); 394 398 void sti_clear(struct sti_struct *sti, int src_y, int src_x, 395 - int height, int width, int c); 399 + int height, int width, int c, struct sti_cooked_font *font); 396 400 void sti_bmove(struct sti_struct *sti, int src_y, int src_x, 397 - int dst_y, int dst_x, int height, int width); 401 + int dst_y, int dst_x, int height, int width, 402 + struct sti_cooked_font *font); 398 403 399 404 #endif /* STICORE_H */
-1
tools/arch/parisc/include/uapi/asm/mman.h
··· 39 39 #define MADV_SOFT_OFFLINE 101 40 40 /* MAP_32BIT is undefined on parisc, fix it for perf */ 41 41 #define MAP_32BIT 0 42 - /* MAP_UNINITIALIZED is undefined on parisc, fix it for perf */ 43 42 #define MAP_UNINITIALIZED 0 44 43 #endif