History log of /linux-master/arch/parisc/kernel/firmware.c
Revision Date Author Comments
# 735ae74f 03-Jan-2024 Helge Deller <deller@gmx.de>

parisc/firmware: Fix F-extend for PDC addresses

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>


# 9f5989d7 18-Oct-2023 Helge Deller <deller@gmx.de>

parisc/firmware: Use PDC constants for narrow/wide firmware

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>


# 3756597a 07-Sep-2023 Helge Deller <deller@gmx.de>

parisc: firmware: Simplify calling non-PA20 functions

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>


# 510610f9 07-Sep-2023 Helge Deller <deller@gmx.de>

parisc: BTLB: Add BTLB insert and purge firmware function wrappers

Signed-off-by: Helge Deller <deller@gmx.de>


# eed869aa 09-Aug-2023 Helge Deller <deller@gmx.de>

parisc: firmware: Mark pdc_result buffers local

This fixes a sparse warning which suggest to make those static.

Signed-off-by: Helge Deller <deller@gmx.de>


# a07c03e8 09-Aug-2023 Helge Deller <deller@gmx.de>

parisc: firmware: Fix sparse context imbalance warnings

Tell sparse about correct context for pdc_cpu_rendezvous_*lock()
functions.

Signed-off-by: Helge Deller <deller@gmx.de>


# 42758522 29-Jun-2023 Helge Deller <deller@gmx.de>

parisc: firmware: Fix kdoc warnings

Signed-off-by: Helge Deller <deller@gmx.de>


# ededd9d2 14-May-2023 Helge Deller <deller@gmx.de>

sticon/parisc: Allow 64-bit STI calls in PDC firmware abstration

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>


# 829632da 20-Feb-2023 Guilherme G. Piccoli <gpiccoli@igalia.com>

parisc: Replace regular spinlock with spin_trylock on panic path

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>


# 5d1335da 19-Dec-2022 Helge Deller <deller@gmx.de>

parisc: Fix return code of pdc_iodc_print()

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>


# 4934fbfb 21-Oct-2022 Helge Deller <deller@gmx.de>

parisc: Show MPE/iX model string at bootup

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>


# 4add395b 17-Dec-2022 Helge Deller <deller@gmx.de>

parisc: Move pdc_result struct to firmware.c

Signed-off-by: Helge Deller <deller@gmx.de>


# 7236aae5 26-Nov-2022 Helge Deller <deller@gmx.de>

parisc: Fix locking in pdc_iodc_print() firmware call

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+


# db2b0d76 29-Mar-2022 Helge Deller <deller@gmx.de>

parisc: Add PDC locking functions for rendezvous code

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>


# 1e93848a 25-Mar-2022 Helge Deller <deller@gmx.de>

parisc: Ensure set_firmware_width() is called only once

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>


# ecac7036 14-Oct-2021 Sven Schnelle <svens@stackframe.org>

parisc/firmware: add functions to retrieve TOC data

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>


# c0891ac1 02-Aug-2021 Alexey Dobriyan <adobriyan@gmail.com>

isystem: ship and use stdarg.h

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>


# 861e93cf 01-Jun-2020 Helge Deller <deller@gmx.de>

parisc: firmware: Update references to parisc website

The PA-RISC Linux project web page is now hosted at
https://parisc.wiki.kernel.org

Signed-off-by: Helge Deller <deller@gmx.de>


# 507efd63 08-Sep-2019 Sven Schnelle <svens@stackframe.org>

parisc: add __pdc_cpu_rendezvous()

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>


# 2874c5fd 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152

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>


# 1b69085d 10-May-2019 Helge Deller <deller@gmx.de>

parisc: Use __ro_after_init in firmware.c

Signed-off-by: Helge Deller <deller@gmx.de>


# 8207d4ee 08-Feb-2019 Helge Deller <deller@gmx.de>

parisc: Show machine product number during boot

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>


# fe8376db 19-Oct-2018 Helge Deller <deller@gmx.de>

parisc: Add PDC PAT cell_info() and pd_get_pdc_revisions() functions

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>


# 77089c52 17-Sep-2017 Helge Deller <deller@gmx.de>

parisc: Add wrapper for pdc_instr() firmware function

Signed-off-by: Helge Deller <deller@gmx.de>


# f5213b2c 20-Aug-2017 Helge Deller <deller@gmx.de>

parisc: Make existing core files reuseable for bootloader

Signed-off-by: Helge Deller <deller@gmx.de>


# 8a5aa00e 04-Aug-2017 Helge Deller <deller@gmx.de>

parisc: PDT/firmware: Add support to read PDT on older PAT-machines

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>


# 25a9b765 25-Jul-2017 Helge Deller <deller@gmx.de>

parisc: Add function to return DIMM slot of physical address

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>


# f520e552 25-Jul-2017 Helge Deller <deller@gmx.de>

parisc: Fix crash when calling PDC_PAT_MEM PDT firmware function

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>


# c9c2877d 11-May-2017 Helge Deller <deller@gmx.de>

parisc: Add Page Deallocation Table (PDT) support

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>


# 637250cc 17-Nov-2016 Helge Deller <deller@gmx.de>

parisc: Enhance CPU detection code on PAT machines

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>


# 49ea1480 02-Aug-2016 Helge Deller <deller@gmx.de>

parisc: Add break statements to pdc_pat_io_pci_cfg_read()

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>


# 60ffef06 17-Jun-2013 Paul Gortmaker <paul.gortmaker@windriver.com>

parisc: delete __cpuinit usage from all users

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>


# 527dcdcc 28-Mar-2012 David Howells <dhowells@redhat.com>

Disintegrate asm/system.h for PA-RISC

Disintegrate asm/system.h for PA-RISC.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-parisc@vger.kernel.org


# fbea6684 06-Dec-2010 Guy Martin <gmsoft@tuxicoman.be>

parisc : Remove broken line wrapping handling pdc_iodc_print()

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>


# d9b68e5e 03-Aug-2010 Kyle McMartin <kyle@mcmartin.ca>

parisc: pass through '\t' to early (iodc) console

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>


# 445c088f 29-Jan-2009 Colin Watson <cjwatson@canonical.com>

parisc: expose 32/64-bit capabilities in cpuinfo

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>


# 24dc029f 13-Jan-2009 Helge Deller <deller@gmx.de>

parisc: fix section mismatch warnings

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>


# 24b574d0 28-Jul-2008 Kyle McMartin <kyle@mcmartin.ca>

parisc: add pdc_coproc_cfg_unlocked and set_firmware_width_unlocked

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.


# 6c86cb82 28-Jul-2008 Kyle McMartin <kyle@mcmartin.ca>

parisc: move pdc_result to real2.S


# ef1afd4d 19-Feb-2008 Kyle McMartin <kyle@shortfin.cabal.ca>

[PARISC] pdc_console: fix bizarre panic on boot

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>


# 721fdf34 06-Dec-2007 Kyle McMartin <kyle@shortfin.cabal.ca>

[PARISC] print more than one character at a time for pdc console

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>


# 7022672e 11-May-2007 Simon Arlott <simon@octiron.net>

[PARISC] spelling fixes: arch/parisc/

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>


# a8f44e38 28-Jan-2007 Helge Deller <deller@gmx.de>

[PARISC] use CONFIG_64BIT instead of __LP64__

- additionally update my copyright timestamps

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>


# 09690b18 05-Oct-2006 Kyle McMartin <kyle@mako.i.cabal.ca>

[PARISC] Make firmware calls irqsafe-ish...

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>


# c53421b1 01-Oct-2006 Alexey Dobriyan <adobriyan@gmail.com>

[PATCH] proper flags type of spin_lock_irqsave()

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>


# ec1fdc24 21-Jun-2006 Kyle McMartin <kyle@parisc-linux.org>

[PARISC] OS_ID_LINUX == 0x0006

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>


# a9d2d386 16-Jun-2006 Kyle McMartin <kyle@parisc-linux.org>

[PARISC] Ensure Space ID hashing is turned off

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>


# 8ffaeaf4 03-May-2006 Thibaut Varene <varenet@parisc-linux.org>

[PARISC] PDC_CHASSIS is implemented on all machines

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>


# 8039de10 10-Jan-2006 Helge Deller <deller@parisc-linux.org>

[PARISC] Add __read_mostly section for parisc

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>


# 675ec7a5 21-Oct-2005 Grant Grundler <grundler@parisc-linux.org>

[PARISC] Document history of PDC_NARROW as it is now obsolete

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>


# 1da177e4 16-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org>

Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!