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

Commit e8222502 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Paul Mackerras
Browse files

[PATCH] powerpc: Kill _machine and hard-coded platform numbers



This removes statically assigned platform numbers and reworks the
powerpc platform probe code to use a better mechanism.  With this,
board support files can simply declare a new machine type with a
macro, and implement a probe() function that uses the flattened
device-tree to detect if they apply for a given machine.

We now have a machine_is() macro that replaces the comparisons of
_machine with the various PLATFORM_* constants.  This commit also
changes various drivers to use the new macro instead of looking at
_machine.

Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 056cb48a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -719,6 +719,11 @@ address which can extend beyond that limit.
    - model : this is your board name/model
    - #address-cells : address representation for "root" devices
    - #size-cells: the size representation for "root" devices
    - device_type : This property shouldn't be necessary. However, if
      you decide to create a device_type for your root node, make sure it
      is _not_ "chrp" unless your platform is a pSeries or PAPR compliant
      one for 64-bit, or a CHRP-type machine for 32-bit as this will
      matched by the kernel this way.

  Additionally, some recommended properties are:

+0 −2
Original line number Diff line number Diff line
@@ -105,8 +105,6 @@ int main(void)
	DEFINE(ICACHEL1LINESIZE, offsetof(struct ppc64_caches, iline_size));
	DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_iline_size));
	DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, ilines_per_page));
	DEFINE(PLATFORM_LPAR, PLATFORM_LPAR);

	/* paca */
	DEFINE(PACA_SIZE, sizeof(struct paca_struct));
	DEFINE(PACAPACAINDEX, offsetof(struct paca_struct, paca_index));
+2 −2
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ static int dev_nvram_ioctl(struct inode *inode, struct file *file,
	case IOC_NVRAM_GET_OFFSET: {
		int part, offset;

		if (_machine != PLATFORM_POWERMAC)
		if (!machine_is(powermac))
			return -EINVAL;
		if (copy_from_user(&part, (void __user*)arg, sizeof(part)) != 0)
			return -EFAULT;
@@ -444,7 +444,7 @@ static int nvram_setup_partition(void)
	 * in our nvram, as Apple defined partitions use pretty much
	 * all of the space
	 */
	if (_machine == PLATFORM_POWERMAC)
	if (machine_is(powermac))
		return -ENOSPC;

	/* see if we have an OS partition that meets our needs.
+2 −2
Original line number Diff line number Diff line
@@ -787,7 +787,7 @@ pci_busdev_to_OF_node(struct pci_bus *bus, int devfn)
	 * fix has to be done by making the remapping per-host and always
	 * filling the pci_to_OF map. --BenH
	 */
	if (_machine == _MACH_Pmac && busnr >= 0xf0)
	if (machine_is(powermac) && busnr >= 0xf0)
		busnr -= 0xf0;
	else
#endif
@@ -1728,7 +1728,7 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
	 * (bus 0 is HT root), we return the AGP one instead.
	 */
#ifdef CONFIG_PPC_PMAC
	if (_machine == _MACH_Pmac && machine_is_compatible("MacRISC4"))
	if (machine_is(powermac) && machine_is_compatible("MacRISC4"))
		if (bus == 0)
			bus = 0xf0;
#endif /* CONFIG_PPC_PMAC */
+2 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <linux/slab.h>
#include <linux/kernel.h>

#include <asm/machdep.h>
#include <asm/vdso_datapage.h>
#include <asm/rtas.h>
#include <asm/uaccess.h>
@@ -51,7 +52,7 @@ static int __init proc_ppc64_create(void)
	if (!root)
		return 1;

	if (!(platform_is_pseries() || _machine == PLATFORM_CELL))
	if (!machine_is(pseries) && !machine_is(cell))
		return 0;

	if (!proc_mkdir("rtas", root))
Loading