// SPDX-License-Identifier: GPL-2.0 /* Tests for presence or absence of hardware registers. * This code was originally in atari/config.c, but I noticed * that it was also in drivers/nubus/nubus.c and I wanted to * use it in hp300/config.c, so it seemed sensible to pull it * out into its own file. * * The test is for use when trying to read a hardware register * that isn't present would cause a bus error. We set up a * temporary handler so that this doesn't kill the kernel. * * There is a test-by-reading and a test-by-writing; I present * them here complete with the comments from the original atari * config.c... * -- PMM <pmaydell@chiark.greenend.org.uk>, 05/1998
*/
/* This function tests for the presence of an address, specially a * hardware register address. It is called very early in the kernel * initialization process, when the VBR register isn't set up yet. On * an Atari, it still points to address 0, which is unmapped. So a bus * error would cause another bus error while fetching the exception * vector, and the CPU would do nothing at all. So we needed to set up * a temporary VBR and a vector table for the duration of the test.
*/
#include <linux/module.h>
#include <asm/hwtest.h>
int hwreg_present(volatilevoid *regp)
{ int ret = 0; unsignedlong flags; long save_sp, save_vbr; long tmp_vectors[3];
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.