History log of /linux-master/arch/powerpc/platforms/ps3/repository.c
Revision Date Author Comments
# f94a84a0 16-Aug-2023 Justin Stitt <justinstitt@google.com>

powerpc/ps3: refactor strncpy usage

`strncpy` is deprecated for use on NUL-terminated destination strings [1].

`make_first_field()` should use similar implementation to `make_field()`
due to memcpy having more obvious behavior here. The end result yields
the same behavior as the previous `strncpy`-based implementation
including the NUL-padding.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Link: https://github.com/KSPP/linux/issues/90
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Tested-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230816-strncpy-arch-powerpc-platforms-ps3-repository-v1-1-88283b02fb09@google.com


# f1ba9b94 16-Dec-2021 Nick Child <nick.child@ibm.com>

powerpc/ps3: Add __init attribute to eligible functions

Some functions defined in 'arch/powerpc/platforms/ps3' are deserving of an
`__init` macro attribute. These functions are only called by other
initialization functions and therefore should inherit the attribute.
Also, change function declarations in header files to include `__init`.

Signed-off-by: Nick Child <nick.child@ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211216220035.605465-14-nick.child@ibm.com


# 873e65bc 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

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

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 version 2 of the license this program
is distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details you should have received a copy of the gnu general
public license along with this program if not write to the free
software foundation inc 59 temple place suite 330 boston ma 02111
1307 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 83 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070034.021731668@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c9599881 29-May-2018 Christophe Leroy <christophe.leroy@c-s.fr>

powerpc/64: Fix strncpy() related build failures with GCC 8.1

GCC 8.1 warns about possible string truncation:

arch/powerpc/kernel/nvram_64.c:1042:2: error: 'strncpy' specified
bound 12 equals destination size [-Werror=stringop-truncation]
strncpy(new_part->header.name, name, 12);

arch/powerpc/platforms/ps3/repository.c:106:2: error: 'strncpy'
output truncated before terminating nul copying 8 bytes from a
string of the same length [-Werror=stringop-truncation]
strncpy((char *)&n, text, 8);

Fix it by using memcpy(). To make that safe we need to ensure the
destination is pre-zeroed. Use kzalloc() in the nvram code and
initialise the u64 to zero in the ps3 code.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
[mpe: Use kzalloc() in the nvram code, flesh out change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>


# 7f2462ac 06-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: Squash lines for simple wrapper functions

Remove unneeded variables and assignments.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>


# 53775c43 05-Jul-2016 Andrew Donnellan <andrew.donnellan@au1.ibm.com>

powerpc/ps3: Fix typo in comment reference to CONFIG_PS3_REPOSITORY_WRITE

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>


# cad5cef6 21-Dec-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

POWERPC: drivers: remove __dev* attributes.

CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6750edbd 11-Aug-2011 Andre Heider <a.heider@gmail.com>

powerpc/ps3: Add highmem repository read routines

Add repository helper routines to read highmem region info.

Bootloaders that preallocate highmem regions must place the
region info into the repository at these well known nodes.
These routines allow second stage kernles to read the region
info from those nodes.

Signed-off-by: Andre Heider <a.heider@gmail.com>
CC: Nathan Whitehorn <nwhitehorn@freebsd.org>
Signed-off-by: Geoff Levand <geoff@infradead.org>


# 79f2a81b 31-Mar-2012 Geoff Levand <geoff@infradead.org>

powerpc/ps3: Add highmem repository write routines

Add routines to allow Linux based bootloaders to create and/or
modify highmem region info in the PS3 system repository where
it can be retrived by later boot stages.

Signed-off-by: Geoff Levand <geoff@infradead.org>


# 07c044c8 31-Mar-2012 Geoff Levand <geoff@infradead.org>

powerpc/ps3: Add PS3 repository write support

Add a new config option CONFIG_PS3_REPOSITORY_WRITE that
conditionally builds in support to create, write and delete
nodes in the PS3 system repository.

This support will allow Linux based bootloaders to manage data
in the system repository for use by later boot stages,

Signed-off-by: Geoff Levand <geoff@infradead.org>


# 4bf94ae3 01-Dec-2011 Geoff Levand <geoff@infradead.org>

powerpc/ps3: Fix PS3 repository build warnings

Fix some PS3 repository.c build warnings when DEBUG is
defined. Also change most pr_debug calls to pr_devel calls.

Fixes warnings like these:

format '%lx' expects type 'long unsigned int', but argument 7 has type 'u64'

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


# 7f8cd352 29-Nov-2011 Geoff Levand <geoff@infradead.org>

powerpc/ps3: Fix hcall lv1_read_repository_node

The lv1 hcall #91 should be named lv1_read_repository_node, and
not lv1_get_repository_node_value. Adjust the lv1 hcall table
and all calls.

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


# 5233e26e 12-Oct-2011 Geoff Levand <geoff@infradead.org>

powerpc/ps3: Fix PS3 repository build warnings

Fix uninitialized variable warnings in build of repository.c

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


# 5c949070 13-Jan-2009 Stephen Rothwell <sfr@canb.auug.org.au>

powerpc/ps3: Printing fixups for l64 to ll64 conversion arch/powerpc

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


# c2b16e1c 18-Jan-2008 Takashi Yamamoto <TakashiA.Yamamoto@jp.sony.com>

[POWERPC] PS3: Add logical performance monitor repository routines

Add repository routines for the PS3 Logical Performance Monitor.

Signed-off-by: Takashi Yamamoto <TakashiA.Yamamoto@jp.sony.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# 720c9133 18-Jan-2008 Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>

[POWERPC] PS3: Checkpatch cleanups for arch/powerpc/platforms/ps3/repository.c

Cleanup coding errors in arch/powerpc/platforms/ps3/repository.c as
reported by sparse and checkpatch.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# ad7d8193 18-Jan-2008 Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>

[POWERPC] PS3: Refactor ps3_repository_find_device()

PS3: Refactor ps3_repository_find_device() to use the existing
ps3_repository_read_bus_id() routine.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# b4cb2941 18-Jan-2008 Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>

[POWERPC] PS3: Use the HVs storage device notification mechanism properly

The PS3 hypervisor has a storage device notification mechanism to wait
until a storage device is ready. Unfortunately the storage device
probing code used this mechanism in an incorrect way, needing a
polling loop and handling of devices that are not yet ready.

This change corrects this by:
- First waiting for the reception of an asynchronous notification
that a new storage device became ready,
- Then looking up the storage device in the device repository.

On shutdown, the storage probe thread is stopped and the storage
notification device is closed using a reboot notifier.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# e06bcf3c 18-Jan-2008 Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>

[POWERPC] PS3: Add ps3_repository_find_device_by_id()

The storage probe feature of the PS3 hypervisor returns device IDs. Add
the corresponding repository routine ps3_repository_find_device_by_id()
which can be used to retrieve the device info from the repository.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# 034e0ab5 18-Jan-2008 Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>

[POWERPC] PS3: Make bus_id and dev_id u64

Change the PS3 bus_id and dev_id from type unsigned int to u64. These
IDs are 64-bit in the repository, and the special storage notification
device has a device ID of ULONG_MAX.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# d51dd3de 06-Sep-2007 Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>

[POWERPC] cell/PS3: Ignore storage devices that are still being probed

On PS3, A storage device may show up in the repository before the hypervisor
has finished probing:
- If its type is not yet known, it shows up as PS3_DEV_TYPE_STOR_DUMMY,
- If its regions are being probed, it shows up as having zero regions.
If any of these happen, consider the device not yet present. The storage
probe thread will retry later.

This fixes the timing-dependent problem where a kernel booted from FLASH ROM
sometimes cannot find the hard disk.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# a3323d1a 15-Jun-2007 Geoff Levand <geoffrey.levand@am.sony.com>

[POWERPC] PS3: Repository probe cleanups

Repository updates:
- Extract ps3_repository_find_bus() from ps3_repository_find_device(), as the
storage driver needs it.
- Make ps3_repository_find_device() return -ENODEV if a device is not found,
just like if a bus is not found.
- Add ps3_repository_read_vuart_sysmgr_port() and
ps3_repository_read_vuart_av_port() to get vuart port info.
- Add device enumeration routines ps3_repository_find_device() and
ps3_repository_find_devices().
- Cleanup debug routines.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# 2a08ea69 30-Jan-2007 Geoff Levand <geoffrey.levand@am.sony.com>

[POWERPC] PS3: Move system bus to platform directory

Move the PS3 system bus routines from drivers/ps3 to
arch/powerpc/platforms/ps3.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# 6c7be7d3 26-Jan-2007 Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>

[POWERPC] ps3: repository storage support

Handle storage-related repository data:
- Add missing implementations of ps3_repository_read_stor_*() repository
accessors.
- Dump storage properties in debug mode
- Add PS3_DEV_TYPE_STOR_{DISK,ROM,FLASH} device types (which are identical to
the corresponding SCSI device types) to enum ps3_dev_type

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# eebb81c1 26-Jan-2007 Geoff Levand <geoffrey.levand@am.sony.com>

[POWERPC] ps3: repository misc fixes

Various fixes for the PS3 repository code:

- Sync signatures of function prototypes and implementations (enum vs.
unsigned int)
- Correct references to `regions' as `registers':
o Correct enum ps3_region_type as enum ps3_reg_type,
o Correct PS3_REGION_TYPE_* as PS3_REG_TYPE_*,
o Correct ps3_repository_find_region() as ps3_repository_find_reg().
- Correct function name in pr_debug() call
- Minor error condition improvements.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# 6e74b38a 22-Nov-2006 Geoff Levand <geoffrey.levand@am.sony.com>

[POWERPC] ps3: add repository support

Adds support for the PS3 repository.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>