Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5e4797b authored by Aruna Balakrishnaiah's avatar Aruna Balakrishnaiah Committed by Benjamin Herrenschmidt
Browse files

powerpc/pseries: Read common partition via pstore



This patch exploits pstore subsystem to read details of common partition
in NVRAM to a separate file in /dev/pstore. For instance, common partition
details will be stored in a file named [common-nvram-6].

Signed-off-by: default avatarAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Reviewed-by: default avatarJim Keniston <jkenisto@us.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent f33f748c
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -138,10 +138,17 @@ static struct nvram_os_partition of_config_partition = {
	.os_partition = false
};

static struct nvram_os_partition common_partition = {
	.name = "common",
	.index = -1,
	.os_partition = false
};

static enum pstore_type_id nvram_type_ids[] = {
	PSTORE_TYPE_DMESG,
	PSTORE_TYPE_PPC_RTAS,
	PSTORE_TYPE_PPC_OF,
	PSTORE_TYPE_PPC_COMMON,
	-1
};
static int read_type;
@@ -530,7 +537,7 @@ static int nvram_pstore_write(enum pstore_type_id type,
}

/*
 * Reads the oops/panic report, rtas and of-config partition.
 * Reads the oops/panic report, rtas, of-config and common partition.
 * Returns the length of the data we read from each partition.
 * Returns 0 if we've been called before.
 */
@@ -566,6 +573,14 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
		time->tv_sec = 0;
		time->tv_nsec = 0;
		break;
	case PSTORE_TYPE_PPC_COMMON:
		sig = NVRAM_SIG_SYS;
		part = &common_partition;
		*type = PSTORE_TYPE_PPC_COMMON;
		*id = PSTORE_TYPE_PPC_COMMON;
		time->tv_sec = 0;
		time->tv_nsec = 0;
		break;
	default:
		return 0;
	}
+3 −0
Original line number Diff line number Diff line
@@ -330,6 +330,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
	case PSTORE_TYPE_PPC_OF:
		sprintf(name, "powerpc-ofw-%s-%lld", psname, id);
		break;
	case PSTORE_TYPE_PPC_COMMON:
		sprintf(name, "powerpc-common-%s-%lld", psname, id);
		break;
	case PSTORE_TYPE_UNKNOWN:
		sprintf(name, "unknown-%s-%lld", psname, id);
		break;
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ enum pstore_type_id {
	/* PPC64 partition types */
	PSTORE_TYPE_PPC_RTAS	= 4,
	PSTORE_TYPE_PPC_OF	= 5,
	PSTORE_TYPE_PPC_COMMON	= 6,
	PSTORE_TYPE_UNKNOWN	= 255
};