summaryrefslogtreecommitdiff
path: root/arch/parisc/kernel/firmware.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-08parisc/firmware: Fix F-extend for PDC addressesHelge Deller1-2/+2
When running with narrow firmware (64-bit kernel using a 32-bit firmware), extend PDC addresses into the 0xfffffff0.00000000 region instead of the 0xf0f0f0f0.00000000 region. This fixes the power button on the C3700 machine in qemu (64-bit CPU with 32-bit firmware), and my assumption is that the previous code was really never used (because most 64-bit machines have a 64-bit firmware), or it just worked on very old machines because they may only decode 40-bit of virtual addresses. Cc: stable@vger.kernel.org Signed-off-by: Helge Deller <deller@gmx.de>
2023-10-30parisc/firmware: Use PDC constants for narrow/wide firmwareHelge Deller1-7/+7
PDC uses the PDC_MODEL_OS64 and PDC_MODEL_OS32 constants, so use those constants for the internal WIDE_FIRMWARE/NARROW_FIRMWARE too. Signed-off-by: Helge Deller <deller@gmx.de>
2023-09-07parisc: firmware: Simplify calling non-PA20 functionsHelge Deller1-2/+12
Instead of usig #ifdefs, simply return PDC_BAD_PROC for functions which aren't available on 64-bit CPUs. Signed-off-by: Helge Deller <deller@gmx.de>
2023-09-07parisc: BTLB: Add BTLB insert and purge firmware function wrappersHelge Deller1-9/+33
Signed-off-by: Helge Deller <deller@gmx.de>
2023-08-10parisc: firmware: Mark pdc_result buffers localHelge Deller1-2/+2
This fixes a sparse warning which suggest to make those static. Signed-off-by: Helge Deller <deller@gmx.de>
2023-08-10parisc: firmware: Fix sparse context imbalance warningsHelge Deller1-2/+2
Tell sparse about correct context for pdc_cpu_rendezvous_*lock() functions. Signed-off-by: Helge Deller <deller@gmx.de>
2023-06-30parisc: firmware: Fix kdoc warningsHelge Deller1-18/+21
Signed-off-by: Helge Deller <deller@gmx.de>
2023-06-30sticon/parisc: Allow 64-bit STI calls in PDC firmware abstrationHelge Deller1-7/+15
Some 64-bit machines require us to call the STI ROM in 64-bit mode, e.g. with the VisFXe graphic card. This patch allows drivers to use such 64-bit calling conventions. Tested-by: John David Anglin <dave.anglin@bell.net> Signed-off-by: Helge Deller <deller@gmx.de>
2023-05-03parisc: Replace regular spinlock with spin_trylock on panic pathGuilherme G. Piccoli1-4/+23
The panic notifiers' callbacks execute in an atomic context, with interrupts/preemption disabled, and all CPUs not running the panic function are off, so it's very dangerous to wait on a regular spinlock, there's a risk of deadlock. Refactor the panic notifier of parisc/power driver to make use of spin_trylock - for that, we've added a second version of the soft-power function. Also, some comments were reorganized and trailing white spaces, useless header inclusion and blank lines were removed. Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> Cc: Jeroen Roovers <jer@xs4all.nl> Acked-by: Helge Deller <deller@gmx.de> # parisc Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com> Signed-off-by: Helge Deller <deller@gmx.de>
2023-01-09parisc: Fix return code of pdc_iodc_print()Helge Deller1-2/+3
There is an off-by-one if the printed string includes a new-line char. Cc: stable@vger.kernel.org Signed-off-by: Helge Deller <deller@gmx.de>
2022-12-19parisc: Show MPE/iX model string at bootupHelge Deller1-2/+2
Some (mostly 64-bit machines) machines allow to run MPE/iX and report the MPE model string via firmware call. Enhance the pdc_model_sysmodel() function to report that model string. Note that some 32-bit machines like the B160L wrongly report success for the firmware call, so include a check to prevent showing wrong info. Signed-off-by: Helge Deller <deller@gmx.de>
2022-12-19parisc: Move pdc_result struct to firmware.cHelge Deller1-2/+2
Signed-off-by: Helge Deller <deller@gmx.de>
2022-12-19parisc: Fix locking in pdc_iodc_print() firmware callHelge Deller1-11/+13
Utilize pdc_lock spinlock to protect parallel modifications of the iodc_dbuf[] buffer, check length to prevent buffer overflow of iodc_dbuf[], drop the iodc_retbuf[] buffer and fix some wrong indentings. Signed-off-by: Helge Deller <deller@gmx.de> Cc: <stable@vger.kernel.org> # 6.0+
2022-03-29parisc: Add PDC locking functions for rendezvous codeHelge Deller1-0/+37
Add pdc_cpu_rendezvous_lock() and pdc_cpu_rendezvous_unlock() to lock PDC while CPU is transitioning into rendezvous state. This is needed, because the transition phase may take up to 8 seconds. Add pdc_pat_get_PDC_entrypoint() to get PDC entry point for current CPU. Signed-off-by: Helge Deller <deller@gmx.de>
2022-03-29parisc: Ensure set_firmware_width() is called only onceHelge Deller1-1/+6
Call set_firmware_width() only once at runtime. This prevents that hotplugged CPUs will get stuck in spinlocks later on. Signed-off-by: Helge Deller <deller@gmx.de>
2021-11-01parisc/firmware: add functions to retrieve TOC dataSven Schnelle1-0/+32
Add functions to retrieve TOC data from firmware both for 1.1 and 2.0 PDC. Signed-off-by: Sven Schnelle <svens@stackframe.org> Signed-off-by: Helge Deller <deller@gmx.de>
2021-08-19isystem: ship and use stdarg.hAlexey Dobriyan1-1/+1
Ship minimal stdarg.h (1 type, 4 macros) as <linux/stdarg.h>. stdarg.h is the only userspace header commonly used in the kernel. GPL 2 version of <stdarg.h> can be extracted from http://archive.debian.org/debian/pool/main/g/gcc-4.2/gcc-4.2_4.2.4.orig.tar.gz Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-06-02parisc: firmware: Update references to parisc websiteHelge Deller1-1/+2
The PA-RISC Linux project web page is now hosted at https://parisc.wiki.kernel.org Signed-off-by: Helge Deller <deller@gmx.de>
2019-09-08parisc: add __pdc_cpu_rendezvous()Sven Schnelle1-0/+13
When stopping SMP cpus send them into rendezvous, so we can start them again later (when kexec'ing a new kernel). Signed-off-by: Sven Schnelle <svens@stackframe.org> Signed-off-by: Helge Deller <deller@gmx.de>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner1-6/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-10parisc: Use __ro_after_init in firmware.cHelge Deller1-1/+1
Signed-off-by: Helge Deller <deller@gmx.de>
2019-02-21parisc: Show machine product number during bootHelge Deller1-0/+24
Ask PDC firmware during boot for the original and current product number as well as the serial number and show it (if available). Signed-off-by: Helge Deller <deller@gmx.de>
2018-10-19parisc: Add PDC PAT cell_info() and pd_get_pdc_revisions() functionsHelge Deller1-0/+57
Add wrappers for the PDC_PAT_CELL_GET_INFO and PDC_PAT_PD_GET_PDC_INTERF_REV PAT PDC subfunctions. Both provide access to the PAT capability bitfield which can guide us if simultaneous PTLBs are allowed on the bus, and if firmware will rendezvous all processors within PDCE_Check in case of an HPMC. Signed-off-by: Helge Deller <deller@gmx.de>
2017-09-22parisc: Add wrapper for pdc_instr() firmware functionHelge Deller1-0/+20
Signed-off-by: Helge Deller <deller@gmx.de>
2017-08-22parisc: Make existing core files reuseable for bootloaderHelge Deller1-1/+14
Signed-off-by: Helge Deller <deller@gmx.de>
2017-08-22parisc: PDT/firmware: Add support to read PDT on older PAT-machinesHelge Deller1-8/+39
Older machines with a PAT firmware (e.g. the rp5470) return their Page Deallocation Table (PDT) info per cell via the PDC_PAT_MEM_PD_INFO PDC call. This patch adds the necessary structures and wrappers to call firmware. Signed-off-by: Helge Deller <deller@gmx.de>
2017-07-25parisc: Add function to return DIMM slot of physical addressHelge Deller1-0/+25
Add a firmware wrapper function, which asks PDC firmware for the DIMM slot of a physical address. This is needed to show users which DIMM module needs replacement in case a broken DIMM was encountered. Signed-off-by: Helge Deller <deller@gmx.de>
2017-07-25parisc: Fix crash when calling PDC_PAT_MEM PDT firmware functionHelge Deller1-2/+9
Commit c9c2877d08d9 ("parisc: Add Page Deallocation Table (PDT) support") introduced the pdc_pat_mem_read_pd_pdt() firmware helper function, which crashed the system because it trashed the stack if the pdc_pat_mem_read_pd_retinfo struct was located on the stack (and which is in size less than the required 32 64-bit values). Fix it by using the pdc_result struct instead when calling firmware and copy the return values back into the result struct when finished sucessfully. While debugging this code I noticed that the pdc_type wasn't set correctly either, so let's fix that too. Fixes: c9c2877d08d9 ("parisc: Add Page Deallocation Table (PDT) support") Signed-off-by: Helge Deller <deller@gmx.de>
2017-05-12parisc: Add Page Deallocation Table (PDT) supportHelge Deller1-0/+108
The firmare in most parisc machines maintains a Page Deallocation Table (PDT) which holds a list of physical memory addresses where hardware detected memory errors (single bit and double bit errors). This patch adds the missing PDC firmware calls and the logic to read the PDT from firmware, report all current PDT entries and exclude the reported bad memory from being used by Linux. Signed-off-by: Helge Deller <deller@gmx.de>
2016-12-13parisc: Enhance CPU detection code on PAT machinesHelge Deller1-1/+1
This patch fixes the debug code which runs during the inventory scan on machines with PAT firmware. Additionally print out the relationship between the detected logical CPU number and it's physical location and physical cpu number. This leads to information which can be used to feed numa-structures in the kernel in later patches. An example output is from my single-CPU (2 cores) C8000 machine is: Logical CPU #0 is physical cpu #0 at 0xffff0000ffff15, hpa 0xfffffffffe780000 Logical CPU #1 is physical cpu #1 at 0xffff0000ffff15, hpa 0xfffffffffe781000 Signed-off-by: Helge Deller <deller@gmx.de>
2016-08-02parisc: Add break statements to pdc_pat_io_pci_cfg_read()Helge Deller1-3/+3
Dan Carpenter noticed that pdc_pat_io_pci_cfg_read() is problematic because it's missing some break statements so it copies 4 bytes regardless of whether you asked for only 1 or 2. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Helge Deller <deller@gmx.de>
2013-07-15parisc: delete __cpuinit usage from all usersPaul Gortmaker1-6/+8
The __cpuinit type of throwaway sections might have made sense some time ago when RAM was more constrained, but now the savings do not offset the cost and complications. For example, the fix in commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time") is a good example of the nasty type of bugs that can be created with improper use of the various __init prefixes. After a discussion on LKML[1] it was decided that cpuinit should go the way of devinit and be phased out. Once all the users are gone, we can then finally remove the macros themselves from linux/init.h. This removes all the parisc uses of the __cpuinit macros. [1] https://lkml.org/lkml/2013/5/20/589 Acked-by: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: Helge Deller <deller@gmx.de> Cc: linux-parisc@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2012-03-28Disintegrate asm/system.h for PA-RISCDavid Howells1-1/+0
Disintegrate asm/system.h for PA-RISC. Signed-off-by: David Howells <dhowells@redhat.com> cc: linux-parisc@vger.kernel.org
2011-01-15parisc : Remove broken line wrapping handling pdc_iodc_print()Guy Martin1-12/+1
Remove the broken line wrapping handling in pdc_iodc_print(). It is broken in 3 ways : - It doesn't keep track of the current screen position, it just assumes that the new buffer will be printed at the begining of the screen. - It doesn't take in account that non printable characters won't increase the current position on the screen. - And last but not least, it triggers a kernel panic if a backspace is the first char in the provided buffer : Backtrace: [<0000000040128ec4>] pdc_console_write+0x44/0x78 [<0000000040128f18>] pdc_console_tty_write+0x20/0x38 [<000000004032f1ac>] n_tty_write+0x2a4/0x550 [<000000004032b158>] tty_write+0x1e0/0x2d8 [<00000000401bb420>] vfs_write+0xb8/0x188 [<00000000401bb630>] sys_write+0x68/0xb8 [<0000000040104eb8>] syscall_exit+0x0/0x14 Most terminals handle the line wrapping just fine. I've confirmed that it works correctly on a C8000 with both vga and serial output. Signed-off-by: Guy Martin <gmsoft@tuxicoman.be> Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-08-04parisc: pass through '\t' to early (iodc) consoleKyle McMartin1-10/+2
The firmware handles '\t' internally, so stop trying to emulate it (which, incidentally, had a bug in it.) Fixes a really weird hang at bootup in rcu_bootup_announce, which, as far as I can tell, is the first printk in the core kernel to use a tab as the first character. Cc: stable@kernel.org Signed-off-by: Kyle McMartin <kyle@parisc-linux.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-03-31parisc: expose 32/64-bit capabilities in cpuinfoColin Watson1-1/+5
It'd be rather useful for debian-installer if we could get hold of accurate firmware information on whether only 32-bit kernels are supported, only 64-bit kernels, or both; this would allow us to present an accurate menu of kernel packages if more than one is available, rather than the user having to guess. This patch attempts to expose it in cpuinfo. I adjusted pdc_model_capabilities to cope with a potential PDC_INVALID_ARG return as the firmware manual instructs, by assuming 32-bit only. This may be the wrong place for it. I made up user-visible capability names by total fiat and for the moment ignored the other bits that may appear in the capabilities word. I have no PA-RISC machine myself to test on, and no PA experience either, so I rather hope that somebody will kind-heartedly take this and fix it up if needed. I ran it past Dann Frazier on IRC and he said "looks good to me", but I think without testing. Also, this is against the Ubuntu 2.6.28 kernel tree since that's what I had handy and I was a bit tight on disk space to slurp down another tree. Sorry if it's skewed in any relevant way; I'll be happy to adjust if necessary. Thanks in advance! Signed-off-by: Colin Watson <cjwatson@canonical.com> Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
2009-03-13parisc: fix section mismatch warningsHelge Deller1-6/+6
Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
2008-10-10parisc: add pdc_coproc_cfg_unlocked and set_firmware_width_unlockedKyle McMartin1-21/+44
These functions are called only when bringing up the monarch cpu, so it is safe to call them without taking the pdc spinlock. In the future, this may become relevant for lockdep, since these functions were taking spinlocks before start_kernel called the lockdep initializers.
2008-10-10parisc: move pdc_result to real2.SKyle McMartin1-2/+2
2008-03-16[PARISC] pdc_console: fix bizarre panic on bootKyle McMartin1-10/+17
Commit 721fdf34167580ff98263c74cead8871d76936e6 introduced a subtle bug by accidently removing the "static" from iodc_dbuf. This resulted in, what appeared to be, a trap without *current set to a task. Probably the result of a trap in real mode while calling firmware. Also do other misc clean ups. Since the only input from firmware is non blocking, share iodc_dbuf between input and output, and spinlock the only callers. Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2007-12-06[PARISC] print more than one character at a time for pdc consoleKyle McMartin1-54/+34
There's really no reason not to print more than one character at a time to the PDC console... Booting is measurably speedier, and now I don't have to watch individual characters get drawn. Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
2007-05-23[PARISC] spelling fixes: arch/parisc/Simon Arlott1-2/+2
Spelling fixes in arch/parisc/. Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Acked-by: Grant Grundler <grundler@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2007-02-17[PARISC] use CONFIG_64BIT instead of __LP64__Helge Deller1-13/+13
- additionally update my copyright timestamps Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2006-10-07[PARISC] Make firmware calls irqsafe-ish...Kyle McMartin1-96/+154
There's no reason why we shouldn't be using _irqsave instead of _irq for any of these calls. fwiw, this fixes the "start_kernel(): bug: interrupts were enabled early" message displayed on bootup recently. Signed-off-by: Kyle McMartin <kyle@parisc-linux.org> Signed-off-by: Matthew Wilcox <matthew@wil.cx>
2006-10-01[PATCH] proper flags type of spin_lock_irqsave()Alexey Dobriyan1-3/+4
Convert various spin_lock_irqsave() callers to correctly use `unsigned long'. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp> Cc: "Luck, Tony" <tony.luck@intel.com> Acked-by: Kyle McMartin <kyle@mcmartin.ca> Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-28[PARISC] OS_ID_LINUX == 0x0006Kyle McMartin1-1/+3
We were assigned an OS_ID of 0x0006. Consistently use OS_ID_LINUX instead of using the magic number. Also update the OS_ID_ defines in asm/pdc.h to reflect this. Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2006-06-28[PARISC] Ensure Space ID hashing is turned offKyle McMartin1-0/+20
Check PDC_CACHE to see if spaceid hashing is turned on, and fail to boot if that is the case. However, some old machines do not implement the PDC_CACHE_RET_SPID firmware call, so continue to boot if the call fails because of PDC_BAD_OPTION (but fail in all other error returns). Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2006-06-28[PARISC] PDC_CHASSIS is implemented on all machinesThibaut Varene1-4/+18
This patch removes a limitation of the original code, so that CHASSIS codes can be sent to all machines. On machines with a LCD panel, this code displays "INI" during bootup, "RUN" when the system is booted and running, "FLT" when a panic occurs, etc. This part of the code can be enabled/disabled through CONFIG_PDC_CHASSIS This patch also adds minimalistic support for Chassis warnings, through a proc entry '/proc/chassis', which will reflect the warnings status (PSU or fans failure when they happen, NVRAM battery level and temperature thresholds overflows). This part of the code can be enabled/disabled through CONFIG_PDC_CHASSIS_WARN Signed-off-by: Thibaut VARENE <varenet@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2006-01-11[PARISC] Add __read_mostly section for pariscHelge Deller1-1/+1
Flag a whole bunch of things as __read_mostly on parisc. Also flag a few branches as unlikely() and cleanup a bit of code. Signed-off-by: Helge Deller <deller@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2005-10-22[PARISC] Document history of PDC_NARROW as it is now obsoleteGrant Grundler1-8/+8
Document history of PDC_NARROW a bit as it will still show up in an older kernel's .config file. Signed-off-by: Grant Grundler <grundler@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>