* Re: SMU-base PowerMac and server_mode
From: Olof Johansson @ 2009-10-06 16:07 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Romain Goyet, linuxppc-dev
In-Reply-To: <1254823882.6035.5.camel@pasglop>
On Tue, Oct 06, 2009 at 09:11:22PM +1100, Benjamin Herrenschmidt wrote:
> On Tue, 2009-10-06 at 11:16 +0200, Romain Goyet wrote:
> > Hi there,
> >
> >
> > I have this Quad G5 here, running GentooPPC64. Runs fine. Had a hard
> > time getting it to boot without a screen attached, but I eventually
> > managed to (yaboot was the culprit). However, this machine is
> > SMU-based, and I couldn't find a way to enable the equivalent of the
> > PMU's "server_mode" (i.e. automatically reboot after a power failure).
> > Is there any known way to do that ?
>
> I'm pretty sure I reverse engineered the necessary command a while back
> and somebody wrote a userland tool to set it, but I can't find it
> anymore :-)
Yeah, I had one but I have since lost it. I suspect it was on the
drive of my second quad that I wiped before I sold it, thinking there
was nothing of value on it. :(
-Olof
^ permalink raw reply
* Re: [v7 PATCH 0/7]: cpuidle/x86/POWER: Cleanup idle power management code in x86, cleanup drivers/cpuidle/cpuidle.c and introduce cpuidle to POWER.
From: Arun R Bharadwaj @ 2009-10-06 16:35 UTC (permalink / raw)
To: Peter Zijlstra, Joel Schopp, Benjamin Herrenschmidt,
Paul Mackerras, Ingo Molnar, Vaidyanathan Srinivasan,
Dipankar Sarma, Balbir Singh, Gautham R Shenoy,
Venkatesh Pallipadi, Arun Bharadwaj
Cc: linux-arch, linuxppc-dev, linux-kernel
In-Reply-To: <20091006152421.GA7278@linux.vnet.ibm.com>
* Arun R Bharadwaj <arun@linux.vnet.ibm.com> [2009-10-06 20:54:21]:
> Hi
>
> Please consider this for inclusion into the testing tree.
>
> This patchset introduces cpuidle infrastructure to POWER, prototyping
> for pSeries, and also does a major refactoring of current x86 idle
> power management and a cleanup of cpuidle infrastructure.
>
> Earlier discussions on the same can be found at:
>
> v6 --> http://lkml.org/lkml/2009/9/22/180
> v5 --> http://lkml.org/lkml/2009/9/22/26
> v4 --> http://lkml.org/lkml/2009/9/1/133
> v3 --> http://lkml.org/lkml/2009/8/27/124
> v2 --> http://lkml.org/lkml/2009/8/26/233
> v1 --> http://lkml.org/lkml/2009/8/19/150
>
>
> Changes in this version:
> -----------------------------------------
>
> * Earlier implementation maintained a list of cpuidle devices and
> the list was traversed to disable and enable the cpuidle devices
> when switching governors. This list is not necessary and is removed.
> Now, we get the per cpu structure cpuidle_devices and disable and
> enable it for each online cpu while switching governors.
>
> * Earlier iterations were buggy w.r.t the sysfs interface of the cpuidle.
> This iteration removes the bug in PATCH 1/7.
>
> * In PATCH 7/7, smt_snooze_delay was not being updated whenever it was
> changed through the sysfs interface. Provide a helper routine to
> update it.
>
> * In PATCH 7/7, the idle loops are renamed to denote the idle states
> to avoid any confusion.
>
Also, the per-cpu nature of registration/unregistration of cpuidle
has been maintained as ACPI needs this.
>
> thanks,
> arun
^ permalink raw reply
* RE: [PATCH] [V2] USB: Add support for Xilinx USB host controller
From: Julie Zhu @ 2009-10-06 17:07 UTC (permalink / raw)
To: John Linn, jwboyer, greg, linuxppc-dev, linux-usb, grant.likely,
benh
In-Reply-To: <689CB232690D8D4E97DA6C76DA098E6C08A73362@XCO-EXCHVS1.xlnx.xilinx.com>
Hi, Greg K-H,
I think we have put in all the suggested changes. Are you planning to
put it into your tree? Or is there something we need to do?
Thank you,
Julie.
> > -----Original Message-----
> > From: Julie Zhu [mailto:julie.zhu@xilinx.com]
> > Sent: Monday, September 21, 2009 4:08 PM
> > To: John Linn; jwboyer@linux.vnet.ibm.com; greg@kroah.com; linuxppc-
> dev@ozlabs.org; linux-
> > usb@vger.kernel.org; grant.likely@secretlab.ca;
benh@kernel.crashing.org
> > Cc: Julie Zhu
> > Subject: [PATCH] [V2] USB: Add support for Xilinx USB host
controller
> >
> > Add bus glue driver for Xilinx USB host controller. The controller
can
> be
> > configured as HS only or HS/FS hybrid. The driver uses the device
tree
> file
> > to configure the driver according to the setting in the hardware
system.
> >
> > This driver has been tested with usbtest using the NET2280 PCI card.
> >
> > Signed-off-by: Julie Zhu <julie.zhu@xilinx.com>
> > Signed-off-by: John Linn <john.linn@xilinx.com>
> > Acked-by: Grant Likely <grant.likely@secretlab.ca>
> >
> > ---
> >
> > V1 - Updated per comments from Benjamin Herrenschmidt
> > <benh@kernel.crashing.org> and Grant Likely
> <grant.likely@secretlab.ca>
> > V2 - Updated per comments from Benjamin Herrenschmidt and Grant
Likely:
> > removed repetitive compatible lists, and removed
> irq_dispose_mapping call
> > upon failure.
> > ---
> > Documentation/powerpc/dts-bindings/xilinx.txt | 11 +
> > drivers/usb/host/Kconfig | 15 +-
> > drivers/usb/host/ehci-hcd.c | 5 +
> > drivers/usb/host/ehci-xilinx-of.c | 300
> +++++++++++++++++++++++++
> > 4 files changed, 329 insertions(+), 2 deletions(-)
> > create mode 100644 drivers/usb/host/ehci-xilinx-of.c
> >
> > diff --git a/Documentation/powerpc/dts-bindings/xilinx.txt
> b/Documentation/powerpc/dts-
> > bindings/xilinx.txt
> > index 80339fe..ea68046 100644
> > --- a/Documentation/powerpc/dts-bindings/xilinx.txt
> > +++ b/Documentation/powerpc/dts-bindings/xilinx.txt
> > @@ -292,4 +292,15 @@
> > - reg-offset : A value of 3 is required
> > - reg-shift : A value of 2 is required
> >
> > + vii) Xilinx USB Host controller
> > +
> > + The Xilinx USB host controller is EHCI compatible but with a
> different
> > + base address for the EHCI registers, and it is always a big-
> endian
> > + USB Host controller. The hardware can be configured as high
speed
> only,
> > + or high speed/full speed hybrid.
> > +
> > + Required properties:
> > + - xlnx,support-usb-fs: A value 0 means the core is built as
high
> speed
> > + only. A value 1 means the core also
> supports
> > + full speed devices.
> >
> > diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> > index 1a920c7..95e4689 100644
> > --- a/drivers/usb/host/Kconfig
> > +++ b/drivers/usb/host/Kconfig
> > @@ -90,14 +90,25 @@ config USB_EHCI_TT_NEWSCHED
> >
> > config USB_EHCI_BIG_ENDIAN_MMIO
> > bool
> > - depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX ||
> ARCH_IXP4XX)
> > + depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX ||
> ARCH_IXP4XX ||
> > XPS_USB_HCD_XILINX)
> > default y
> >
> > config USB_EHCI_BIG_ENDIAN_DESC
> > bool
> > - depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX)
> > + depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX ||
> XPS_USB_HCD_XILINX)
> > default y
> >
> > +config XPS_USB_HCD_XILINX
> > + bool "Use Xilinx usb host EHCI controller core"
> > + depends on USB_EHCI_HCD && (PPC32 || MICROBLAZE)
> > + select USB_EHCI_BIG_ENDIAN_DESC
> > + select USB_EHCI_BIG_ENDIAN_MMIO
> > + ---help---
> > + Xilinx xps USB host controller core is EHCI compilant
and has
> > + transaction translator built-in. It can be configured to
> either
> > + support both high speed and full speed devices, or high
speed
> > + devices only.
> > +
> > config USB_EHCI_FSL
> > bool "Support for Freescale on-chip EHCI USB controller"
> > depends on USB_EHCI_HCD && FSL_SOC
> > diff --git a/drivers/usb/host/ehci-hcd.c
b/drivers/usb/host/ehci-hcd.c
> > index 11c627c..7672624 100644
> > --- a/drivers/usb/host/ehci-hcd.c
> > +++ b/drivers/usb/host/ehci-hcd.c
> > @@ -1107,6 +1107,11 @@ MODULE_LICENSE ("GPL");
> > #define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver
> > #endif
> >
> > +#ifdef CONFIG_XPS_USB_HCD_XILINX
> > +#include "ehci-xilinx-of.c"
> > +#define OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver
> > +#endif
> > +
> > #ifdef CONFIG_PLAT_ORION
> > #include "ehci-orion.c"
> > #define PLATFORM_DRIVER ehci_orion_driver
> > diff --git a/drivers/usb/host/ehci-xilinx-of.c
b/drivers/usb/host/ehci-
> xilinx-of.c
> > new file mode 100644
> > index 0000000..a586153
> > --- /dev/null
> > +++ b/drivers/usb/host/ehci-xilinx-of.c
> > @@ -0,0 +1,300 @@
> > +/*
> > + * EHCI HCD (Host Controller Driver) for USB.
> > + *
> > + * Bus Glue for Xilinx EHCI core on the of_platform bus
> > + *
> > + * Copyright (c) 2009 Xilinx, Inc.
> > + *
> > + * Based on "ehci-ppc-of.c" by Valentine Barshak
> <vbarshak@ru.mvista.com>
> > + * and "ehci-ppc-soc.c" by Stefan Roese <sr@denx.de>
> > + * and "ohci-ppc-of.c" by Sylvain Munaut <tnt@246tNt.com>
> > + *
> > + * 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.
> > + *
> > + * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
> > + *
> > + */
> > +
> > +#include <linux/signal.h>
> > +
> > +#include <linux/of.h>
> > +#include <linux/of_platform.h>
> > +
> > +/**
> > + * ehci_xilinx_of_setup - Initialize the device for ehci_reset()
> > + * @hcd: Pointer to the usb_hcd device to which the host
controller
> bound
> > + *
> > + * called during probe() after chip reset completes.
> > + */
> > +static int ehci_xilinx_of_setup(struct usb_hcd *hcd)
> > +{
> > + struct ehci_hcd *ehci =3D hcd_to_ehci(hcd);
> > + int retval;
> > +
> > + retval =3D ehci_halt(ehci);
> > + if (retval)
> > + return retval;
> > +
> > + retval =3D ehci_init(hcd);
> > + if (retval)
> > + return retval;
> > +
> > + ehci->sbrn =3D 0x20;
> > +
> > + return ehci_reset(ehci);
> > +}
> > +
> > +/**
> > + * ehci_xilinx_port_handed_over - hand the port out if failed to
enable
> it
> > + * @hcd: Pointer to the usb_hcd device to which the host
controller
> bound
> > + * @portnum:Port number to which the device is attached.
> > + *
> > + * This function is used as a place to tell the user that the
Xilinx
> USB host
> > + * controller does support LS devices. And in an HS only
configuration,
> it
> > + * does not support FS devices either. It is hoped that this can
help a
> > + * confused user.
> > + *
> > + * There are cases when the host controller fails to enable the
port
> due to,
> > + * for example, insufficient power that can be supplied to the
device
> from
> > + * the USB bus. In those cases, the messages printed here are not
> helpful.
> > + */
> > +static int ehci_xilinx_port_handed_over(struct usb_hcd *hcd, int
> portnum)
> > +{
> > + dev_warn(hcd->self.controller, "port %d cannot be enabled\n",
> portnum);
> > + if (hcd->has_tt) {
> > + dev_warn(hcd->self.controller,
> > + "Maybe you have connected a low speed
device?\n");
> > +
> > + dev_warn(hcd->self.controller,
> > + "We do not support low speed devices\n");
> > + } else {
> > + dev_warn(hcd->self.controller,
> > + "Maybe your device is not a high speed
device?\n");
> > + dev_warn(hcd->self.controller,
> > + "The USB host controller does not support full
speed "
> > + "nor low speed devices\n");
> > + dev_warn(hcd->self.controller,
> > + "You can reconfigure the host controller to have
"
> > + "full speed support\n");
> > + }
> > +
> > + return 0;
> > +}
> > +
> > +
> > +static const struct hc_driver ehci_xilinx_of_hc_driver =3D {
> > + .description =3D hcd_name,
> > + .product_desc =3D "OF EHCI",
> > + .hcd_priv_size =3D sizeof(struct ehci_hcd),
> > +
> > + /*
> > + * generic hardware linkage
> > + */
> > + .irq =3D ehci_irq,
> > + .flags =3D HCD_MEMORY | HCD_USB2,
> > +
> > + /*
> > + * basic lifecycle operations
> > + */
> > + .reset =3D ehci_xilinx_of_setup,
> > + .start =3D ehci_run,
> > + .stop =3D ehci_stop,
> > + .shutdown =3D ehci_shutdown,
> > +
> > + /*
> > + * managing i/o requests and associated device resources
> > + */
> > + .urb_enqueue =3D ehci_urb_enqueue,
> > + .urb_dequeue =3D ehci_urb_dequeue,
> > + .endpoint_disable =3D ehci_endpoint_disable,
> > +
> > + /*
> > + * scheduling support
> > + */
> > + .get_frame_number =3D ehci_get_frame,
> > +
> > + /*
> > + * root hub support
> > + */
> > + .hub_status_data =3D ehci_hub_status_data,
> > + .hub_control =3D ehci_hub_control,
> > +#ifdef CONFIG_PM
> > + .bus_suspend =3D ehci_bus_suspend,
> > + .bus_resume =3D ehci_bus_resume,
> > +#endif
> > + .relinquish_port =3D NULL,
> > + .port_handed_over =3D ehci_xilinx_port_handed_over,
> > +
> > + .clear_tt_buffer_complete =3D ehci_clear_tt_buffer_complete,
> > +};
> > +
> > +/**
> > + * ehci_hcd_xilinx_of_probe - Probe method for the USB host
controller
> > + * @op: pointer to the of_device to which the host
controller
> bound
> > + * @match: pointer to of_device_id structure, not used
> > + *
> > + * This function requests resources and sets up appropriate
properties
> for the
> > + * host controller. Because the Xilinx USB host controller can be
> configured
> > + * as HS only or HS/FS only, it checks the configuration in the
device
> tree
> > + * entry, and sets an appropriate value for hcd->has_tt.
> > + */
> > +static int __devinit
> > +ehci_hcd_xilinx_of_probe(struct of_device *op, const struct
> of_device_id *match)
> > +{
> > + struct device_node *dn =3D op->node;
> > + struct usb_hcd *hcd;
> > + struct ehci_hcd *ehci;
> > + struct resource res;
> > + int irq;
> > + int rv;
> > + int *value;
> > +
> > + if (usb_disabled())
> > + return -ENODEV;
> > +
> > + dev_dbg(&op->dev, "initializing XILINX-OF USB Controller\n");
> > +
> > + rv =3D of_address_to_resource(dn, 0, &res);
> > + if (rv)
> > + return rv;
> > +
> > + hcd =3D usb_create_hcd(&ehci_xilinx_of_hc_driver, &op->dev,
> > + "XILINX-OF USB");
> > + if (!hcd)
> > + return -ENOMEM;
> > +
> > + hcd->rsrc_start =3D res.start;
> > + hcd->rsrc_len =3D res.end - res.start + 1;
> > +
> > + if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
hcd_name)) {
> > + printk(KERN_ERR __FILE__ ": request_mem_region
failed\n");
> > + rv =3D -EBUSY;
> > + goto err_rmr;
> > + }
> > +
> > + irq =3D irq_of_parse_and_map(dn, 0);
> > + if (irq =3D=3D NO_IRQ) {
> > + printk(KERN_ERR __FILE__ ": irq_of_parse_and_map
failed\n");
> > + rv =3D -EBUSY;
> > + goto err_irq;
> > + }
> > +
> > + hcd->regs =3D ioremap(hcd->rsrc_start, hcd->rsrc_len);
> > + if (!hcd->regs) {
> > + printk(KERN_ERR __FILE__ ": ioremap failed\n");
> > + rv =3D -ENOMEM;
> > + goto err_ioremap;
> > + }
> > +
> > + ehci =3D hcd_to_ehci(hcd);
> > +
> > + /* This core always has big-endian register interface and uses
> > + * big-endian memory descriptors.
> > + */
> > + ehci->big_endian_mmio =3D 1;
> > + ehci->big_endian_desc =3D 1;
> > +
> > + /* Check whether the FS support option is selected in the
hardware.
> > + */
> > + value =3D (int *)of_get_property(dn, "xlnx,support-usb-fs", NULL);
> > + if (value && (*value =3D=3D 1)) {
> > + ehci_dbg(ehci, "USB host controller supports FS
devices\n");
> > + hcd->has_tt =3D 1;
> > + } else {
> > + ehci_dbg(ehci,
> > + "USB host controller is HS only\n");
> > + hcd->has_tt =3D 0;
> > + }
> > +
> > + /* Debug registers are at the first 0x100 region
> > + */
> > + ehci->caps =3D hcd->regs + 0x100;
> > + ehci->regs =3D hcd->regs + 0x100 +
> > + HC_LENGTH(ehci_readl(ehci,
&ehci->caps->hc_capbase));
> > +
> > + /* cache this readonly data; minimize chip reads */
> > + ehci->hcs_params =3D ehci_readl(ehci, &ehci->caps->hcs_params);
> > +
> > + rv =3D usb_add_hcd(hcd, irq, 0);
> > + if (rv =3D=3D 0)
> > + return 0;
> > +
> > + iounmap(hcd->regs);
> > +
> > +err_ioremap:
> > +err_irq:
> > + release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
> > +err_rmr:
> > + usb_put_hcd(hcd);
> > +
> > + return rv;
> > +}
> > +
> > +/**
> > + * ehci_hcd_xilinx_of_remove - shutdown hcd and release resources
> > + * @op: pointer to of_device structure that is to be
removed
> > + *
> > + * Remove the hcd structure, and release resources that has been
> requested
> > + * during probe.
> > + */
> > +static int ehci_hcd_xilinx_of_remove(struct of_device *op)
> > +{
> > + struct usb_hcd *hcd =3D dev_get_drvdata(&op->dev);
> > + dev_set_drvdata(&op->dev, NULL);
> > +
> > + dev_dbg(&op->dev, "stopping XILINX-OF USB Controller\n");
> > +
> > + usb_remove_hcd(hcd);
> > +
> > + iounmap(hcd->regs);
> > + release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
> > +
> > + usb_put_hcd(hcd);
> > +
> > + return 0;
> > +}
> > +
> > +/**
> > + * ehci_hcd_xilinx_of_shutdown - shutdown the hcd
> > + * @op: pointer to of_device structure that is to be
removed
> > + *
> > + * Properly shutdown the hcd, call driver's shutdown routine.
> > + */
> > +static int ehci_hcd_xilinx_of_shutdown(struct of_device *op)
> > +{
> > + struct usb_hcd *hcd =3D dev_get_drvdata(&op->dev);
> > +
> > + if (hcd->driver->shutdown)
> > + hcd->driver->shutdown(hcd);
> > +
> > + return 0;
> > +}
> > +
> > +
> > +static struct of_device_id ehci_hcd_xilinx_of_match[] =3D {
> > + {.compatible =3D "xlnx,xps-usb-host-1.00.a",},
> > + {},
> > +};
> > +MODULE_DEVICE_TABLE(of, ehci_hcd_xilinx_of_match);
> > +
> > +static struct of_platform_driver ehci_hcd_xilinx_of_driver =3D {
> > + .name =3D "xilinx-of-ehci",
> > + .match_table =3D ehci_hcd_xilinx_of_match,
> > + .probe =3D ehci_hcd_xilinx_of_probe,
> > + .remove =3D ehci_hcd_xilinx_of_remove,
> > + .shutdown =3D ehci_hcd_xilinx_of_shutdown,
> > + .driver =3D {
> > + .name =3D "xilinx-of-ehci",
> > + .owner =3D THIS_MODULE,
> > + },
> > +};
> > --
> > 1.5.6.6
> >
This email and any attachments are intended for the sole use of the named r=
ecipient(s) and contain(s) confidential information that may be proprietary=
, privileged or copyrighted under applicable law. If you are not the intend=
ed recipient, do not read, copy, or forward this email message or any attac=
hments. Delete this email message and any attachments immediately.
^ permalink raw reply
* Re: [PATCH 3/6] 8xx: get rid of _PAGE_HWWRITE dependency in MMU.
From: Joakim Tjernlund @ 2009-10-06 17:28 UTC (permalink / raw)
Cc: Scott Wood, Rex Feany, linuxppc-dev@ozlabs.org
In-Reply-To: <OF8881FD0B.21715064-ONC1257647.005485CA-C1257647.00561D2D@transmode.se>
>
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote on 06/10/2009 08:45:47:
> >
> > On Tue, 2009-10-06 at 08:15 +0200, Joakim Tjernlund wrote:
> >
> > > Yes, I would too but TLB Miss knows nothing about load/store, protection etc.
> > > because DSISR isn't set. So I cannot see any other way than the TLB Error way.
> >
> > Hrm... that MMU really sucks more than I thought :-(
> >
> > I'll go read the manual and think about that a bit more.
>
> I realise now that for an ITLB Miss I can work out everything I need.
> an ITLB must be a read en everything else is in the linux pte.
> Just check present and user, add accessed if not already there.
> I blame that on too little sleep :)
bugger, more bugs I think. Need to fix the TLB code some more
^ permalink raw reply
* Re: [PATCH] [V2] USB: Add support for Xilinx USB host controller
From: Greg KH @ 2009-10-06 17:29 UTC (permalink / raw)
To: Julie Zhu; +Cc: linux-usb, linuxppc-dev, John Linn
In-Reply-To: <24d11f7b-3f0d-4489-9eca-1d74c400504e@SG2EHSMHS006.ehs.local>
On Tue, Oct 06, 2009 at 11:07:32AM -0600, Julie Zhu wrote:
> Hi, Greg K-H,
>
> I think we have put in all the suggested changes. Are you planning to
> put it into your tree? Or is there something we need to do?
I will queue it up in my tree.
thanks,
greg k-h
^ permalink raw reply
* Re: [v7 PATCH 0/7]: cpuidle/x86/POWER: Cleanup idle power management code in x86, cleanup drivers/cpuidle/cpuidle.c and introduce cpuidle to POWER.
From: Peter Zijlstra @ 2009-10-06 18:04 UTC (permalink / raw)
To: arun
Cc: linux-arch, Gautham R Shenoy, Venkatesh Pallipadi, linux-kernel,
Paul Mackerras, Ingo Molnar, linuxppc-dev
In-Reply-To: <20091006163521.GA10425@linux.vnet.ibm.com>
On Tue, 2009-10-06 at 22:05 +0530, Arun R Bharadwaj wrote:
> Also, the per-cpu nature of registration/unregistration of cpuidle
> has been maintained as ACPI needs this.
Right, so can't we ditch that and have acpi default to the lowest common
C-state and warn when various cpus report different C-states?
^ permalink raw reply
* Re: [PATCH 3/6] 8xx: get rid of _PAGE_HWWRITE dependency in MMU.
From: Joakim Tjernlund @ 2009-10-06 22:05 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Scott Wood, linuxppc-dev@ozlabs.org, Rex Feany
In-Reply-To: <1254789255.7122.95.camel@pasglop>
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote on 06/10/2009 02:34:15:
>
> On Tue, 2009-10-06 at 01:35 +0200, Joakim Tjernlund wrote:
> >
> > > Well, if the HW has the ability to enforce trap when store with !
> > DIRTY,
> >
> > Yes, provided that the kernel invalidates the TLB too so the next
> > access
> > will provoke a TLB Miss, which will then provoke a TLB error. The TLB
> > error routine checks VALID, RW and USER(if not a kernel access), then
> > sets
> > ACCESSED & DIRTY and writes the TLB(RPN reg).
> >
> > Perhaps the missing invalidate is haunting us here?
>
> No, the kernel will invalidate when clearing dirty or accessed, I don't
> think that's our problem.
>
> This is still all inefficient, we end up basically with two traps.
>
> 8xx provides backup GPRs when doing TLB misses ? What does it cost to
> jump out of a TLB miss back into "normal" context ?
>
> IE. What I do on 440 is I set a mask of required bits, basically
> _PAGE_PRESENT | _PAGE_ACCESSED is the base. The DTLB miss also sticks
> in _PAGE_RW | _PAGE_DIRTY when it's a store fault.
After some more thinking I don't think I do TLB Miss/Error correctly yet.
The problem is ACCESSED. Since I don't know if load or store in TLB Miss
I must choose:
- Assume load and do what you do above. That will incorrectly
set ACCESSED on store ops when mapped as RO(plus whatever more I haven't thought about yet)
- Trap to TLB Error and do the above. That will set ACCESSED correctly
but won't trap kernel space so these remain what they are.
Is anything depending on ACCESSED for kernel pages?
if so, what if we set ACCESSED on all kernel pages when mapping them at boot?
Will SWAP or some other service(accounting?) not like that?
Finally, why do you need to include DIRTY when a store OP?
Do you need to do COW before dirtying the page?
Seems to work for me to just set DIRTY in TLB Error if RW is set too
and not trap to C.
^ permalink raw reply
* Re: [PATCH 3/6] 8xx: get rid of _PAGE_HWWRITE dependency in MMU.
From: Benjamin Herrenschmidt @ 2009-10-06 23:25 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: Scott Wood, linuxppc-dev@ozlabs.org, Rex Feany
In-Reply-To: <OFC64CFB37.E5E17F42-ONC1257647.0068299A-C1257647.00795ECE@transmode.se>
> After some more thinking I don't think I do TLB Miss/Error correctly yet.
> The problem is ACCESSED. Since I don't know if load or store in TLB Miss
> I must choose:
> - Assume load and do what you do above. That will incorrectly
> set ACCESSED on store ops when mapped as RO(plus whatever more I haven't thought about yet)
>
> - Trap to TLB Error and do the above. That will set ACCESSED correctly
> but won't trap kernel space so these remain what they are.
> Is anything depending on ACCESSED for kernel pages?
> if so, what if we set ACCESSED on all kernel pages when mapping them at boot?
> Will SWAP or some other service(accounting?) not like that?
Kernel pages always have ACCESSED set and never clear it.
I think the only solution here is that if -anything- doesn't look right,
the TLB miss should create one of those "unpopulated" entries and we
need to make sure they are properly invalidated in the subsequent fault
path. I'll read the 8xx doco asap to make sure I get it right.
> Finally, why do you need to include DIRTY when a store OP?
> Do you need to do COW before dirtying the page?
> Seems to work for me to just set DIRTY in TLB Error if RW is set too
> and not trap to C.
You can, but what about a load ? That shouldn't set dirty. So if you set
dirty only on stores, then a load will bring in a page without dirty,
you need to make sure you get another TLB error when writing to it so
you get a chance to set dirty.
Ben.
^ permalink raw reply
* Re: [PATCH 3/6] 8xx: get rid of _PAGE_HWWRITE dependency in MMU.
From: Benjamin Herrenschmidt @ 2009-10-07 1:07 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: Scott Wood, linuxppc-dev@ozlabs.org, Rex Feany
In-Reply-To: <OFC64CFB37.E5E17F42-ONC1257647.0068299A-C1257647.00795ECE@transmode.se>
Allright, did a bit of reading of doco and code..
Doco isn't totally clear though. At some stage, it -hints- that in case
of a TLB "error" (match on EA/ASID but incorrect
protection/valid/changed/...) the offending TLB entry is automatically
invalidated. Do you know if that is correct ?
I would hope so since we never do anything to remove the "invalid"
entries we write to the TLB when hitting non-present PTEs but then, that
may also explain some of our problems...
Now, a few comments from what I read in the code:
- The whole writeback could be avoided in Instruction/Data TLB miss,
but for that, you need to make sure that the TLB entry we create has
valid set only if -both- present and accessed are set. That would save
in the case of CONFIG_SWAP, a store and a read back of TWC I suppose,
but you do need to find a way to do that ANDing of ACCESSED and PRESENT.
- I think we can get rid of HWWRITE. We can make CHANGED be the current
HWWRITE value, I agree with you, which matches the HW changed bit. We
need to be a bit careful of how we setup the PP bits tho. At this stage,
I see several approaches:
* One is to basically "generate" the right PP bits based on a
combination of _PAGE_USER and _PAGE_RW. That's the simpler approach but
probably uses more code in the TLB miss handler. It would look like
that, with MxCTR:PPCS=0
_PAGE_USER _PAGE_RW PP (bits 20..27)
0 0 011C1111 (C is _PAGE_DIRTY)
0 1 000C1111
1 0 110C1111
1 1 100C1111
One easy way to do that is to have _PAGE_USER and _PAGE_RW sit next to
each other in bit position 28 and 29 (0xc). Load a GPR with something
like 0110000011001000 and rotate it left by PTE & 0xc, then move the
resulting 3 bits into position, or something along those lines. You can
also give up on kernel read-only support and go down to 2 PP bits and
never use the extended encoding.
* Another one is to use MxCTR:PPCS=1 a mask of 100C1U00 (U is
_PAGE_USER) and or in ^_PAGE_RW (it could actually be made
reverse-polarity in the PTE but that would mean some changes to non-8xx
specific headers, so let's avoid it for now at least).
At least that's the best options I can see from my reading of the doco,
though it's not totally clear to me what really happens when doing the
PPCS trick, will it generate a TLB error on a non-match or will it try
to TLB miss, which could be bad.
* Last but not least, it wouldn't be hard to use either of the above
encodings, and have the PTE actually contain the right bit combination
already. You don't need to have a _PAGE_RW, you don't need to have a
_PAGE_USER :-) Look at how I do things for book3e, where I layout the
6 BookE protection bit directly in the PTE. That's a bit harder and maybe
will need subtle changes to pte-common.h and such to accomodate it, and
so probably something to experiment with as a second step, but it's the
most efficient approach in the long run for obvious reasons.
- I think we could have more bits pre-set to the right values in the
PTE, look how we play with defining some of the constants in
pte-common.h, might be worth having a look, but -after- we have
something that works :-)
- Possible bug: I'm very disturbed by the fact that DataTLBError sets
HWWRITE and DIRTY on a non-present PTE. It should not. Just like
ACCESSED. That's going to cause trouble and swap corruption, even more
as we move DIRTY around.
- Maybe we can completely remove that mucking around with dirty,
setting of accessed etc... from DataTLBError. Just make it go to C code
just like InstructionAccess, as we discussed earlier, the generic code
will fix it up and we'll speed up page faults. It should be fairly rare
to take a fault due to a missing _PAGE_ACCESSED or _PAGE_DIRTY in any
case, so all that fixup in those exceptions is just overhead.
- Later on, if it rocks your boat, you may want to look into removing
the mucking around with swapper_pg_dir in the TLB miss. Instead, what
you can do is lazily copy the kernel PMDs into the user PMDs. IE. On the
first kernel access from a new user context, you fault, and from the
do_page_fault() code, we can detect that and fixup the user PMD to point
to the kernel page tables, thus avoiding that whole bunch of code in the
TLB miss. When creating new user page tables, we can pre-fill the kernel
PMDs too. I think x86 does that. We could do that for BookE too, though
it's less of a win since we have to fixup the TID in MMUCR/MAS but for
8xx it would save a few instructions & conditionals in the TLB miss fast
path.
- I still have problems with the comment next to the "workaround"
tlbil_va() we have in the icache/dcache flush. It doesn't make much
sense to me since dcbst is going to be done by the kernel on a kernel
address, not a user address, so I don't see how the thing we invalidate
relates to the flush we do just below.... So that raises a few
questions:
* If this is to avoid write faults on kernel pages, then we may just
want to have a fixup in do_page_fault() to ignore them when coming from
flush_dcache_icache_* using the exception table mechanism instead ?
* I don't see how it works around user faults but maybe you have a
clear scenario in mind
* It appears still reasonably obvious that we need that tlbil_va
somewhere in that fault path, but I don't know what for, I'm not sure
it's really what the comment says it's about. That raises back the whole
question of when are those "invalid" TLB entries that we create when
_PAGE_PRESENT is not set are going to be removed. The doc hints that
they go a way on TLB error, but the doc really only says so for missing
changed bit... so I'm tempted to say we need to basically stick a
tlbil_va on 8xx on both set_pte_at() and ptep_set_access_flags() for any
non-kernel page. What do you think ? That would be the safest.
- The "fake" DataAccess and InstructionAccess are useless... just a
spurious jump for nothing. We could implement those straight in
DataTLBError and InstructionTLBError, we just need to make sure that
the trap numbers we put in the exception frame are 0x300 and 0x400, but
that's just a matter of passing the right bits to EXC_XFER_EE_LITE().
- Finally, another boat-rocking optimisation to do is preload. You
could hook in update_mmu_cache() for 8xx to go whack an entry in the TLB
as well, which would avoid a TLB miss right after a page fault. But
again, only when things work.
None of the above of course address your DAR-not-updated concern. I
think your approach of "clobbering" the DAR on every storage exception
after it's been snapshotted and then testing for the clobber and
emulating the instruction is the way to go, though your patch could use
some cleaning there.
I'll post comments on it separately.
At the end of the day, I can't help that much without HW access and/or a
simulator, as you can guess, and no, I'm not asking for people to send
me an 8xx board :-) (especially useless without a BDI imho). So I rely
on Scott and yourself to sort this out. But thanks for showing up, and
please, do port your board to 2.6 so you can test your stuff :-)
Cheers,
Ben.
^ permalink raw reply
* [RFC PATCH 00/12] Merge common OpenFirmware device tree code
From: Grant Likely @ 2009-10-07 4:29 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
Well, I've got to start somewhere...
So here goes. I've begun the work to merge and clean up the OF device
tree handling code and this is my first set of patches. Not fully
tested yet, but I'm getting them out to the lists so that I can start
responding to comments and collecting acks. This first batch isn't
anything exciting, just a merge of common code
---
Grant Likely (12):
of: merge of_find_all_nodes() implementations
of: merge other miscellaneous prototypes
of: merge of_*_flat_dt*() functions
of: merge of_node_get(), of_node_put() and of_find_all_nodes()
of: merge of_read_number() an of_read_ulong()
of: merge of_node_*_flag() and set_node_proc_entry()
of: merge struct boot_param_header from Microblaze and PowerPC
of: add common header for flattened device tree representation
of: Move OF_IS_DYNAMIC and OF_MARK_DYNAMIC macros to of.h
of: merge struct device_node
of: merge phandle, ihandle and struct property
of: Rework linux/of.h and asm/prom.h include ordering
arch/microblaze/include/asm/prom.h | 135 +--------------------------------
arch/microblaze/kernel/prom.c | 23 ------
arch/powerpc/include/asm/prom.h | 147 ------------------------------------
arch/powerpc/kernel/prom.c | 23 ------
arch/sparc/include/asm/prom.h | 55 -------------
drivers/of/base.c | 26 ++++++
include/linux/of.h | 103 +++++++++++++++++++++++++
include/linux/of_fdt.h | 87 +++++++++++++++++++++
8 files changed, 221 insertions(+), 378 deletions(-)
create mode 100644 include/linux/of_fdt.h
--
Signature
^ permalink raw reply
* [RFC PATCH 01/12] of: Rework linux/of.h and asm/prom.h include ordering
From: Grant Likely @ 2009-10-07 4:30 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
In preparation to prune things out of the Sparc, PowerPC and Microblaze
asm/prom.h files, change the #include statements to ensure that
even if asm/prom.h is included first, linux/of.h gets to determine the
order in which files are processed.
This patch adds a #include <linux/of.h> to each of the prom.h files
*above* the multi-include protection macros to ensure that linux/of.h
can define things before prom.h gets processed.
At the end of the merge the cross dependencies between the files should
be gone and a sane #include scheme can be restored.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/include/asm/prom.h | 8 ++------
arch/powerpc/include/asm/prom.h | 7 +------
arch/sparc/include/asm/prom.h | 7 +------
3 files changed, 4 insertions(+), 18 deletions(-)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 37e6f30..6636889 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -12,6 +12,8 @@
* 2 of the License, or (at your option) any later version.
*/
+#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
+
#ifndef _ASM_MICROBLAZE_PROM_H
#define _ASM_MICROBLAZE_PROM_H
#ifdef __KERNEL__
@@ -305,12 +307,6 @@ extern int of_irq_to_resource(struct device_node *dev, int index,
*/
extern void __iomem *of_iomap(struct device_node *device, int index);
-/*
- * NB: This is here while we transition from using asm/prom.h
- * to linux/of.h
- */
-#include <linux/of.h>
-
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* _ASM_MICROBLAZE_PROM_H */
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index 6ff0418..b0a84ea 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -1,3 +1,4 @@
+#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
#ifndef _POWERPC_PROM_H
#define _POWERPC_PROM_H
#ifdef __KERNEL__
@@ -349,11 +350,5 @@ extern int of_irq_to_resource(struct device_node *dev, int index,
*/
extern void __iomem *of_iomap(struct device_node *device, int index);
-/*
- * NB: This is here while we transition from using asm/prom.h
- * to linux/of.h
- */
-#include <linux/of.h>
-
#endif /* __KERNEL__ */
#endif /* _POWERPC_PROM_H */
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index 82a190d..0733170 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -1,3 +1,4 @@
+#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
#ifndef _SPARC_PROM_H
#define _SPARC_PROM_H
#ifdef __KERNEL__
@@ -108,12 +109,6 @@ static inline void irq_dispose_mapping(unsigned int virq)
{
}
-/*
- * NB: This is here while we transition from using asm/prom.h
- * to linux/of.h
- */
-#include <linux/of.h>
-
extern struct device_node *of_console_device;
extern char *of_console_path;
extern char *of_console_options;
^ permalink raw reply related
* [RFC PATCH 02/12] of: merge phandle, ihandle and struct property
From: Grant Likely @ 2009-10-07 4:30 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
Merge of common code duplicated between Sparc, PowerPC and Microblaze
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/include/asm/prom.h | 10 ----------
arch/powerpc/include/asm/prom.h | 12 ------------
arch/sparc/include/asm/prom.h | 12 ------------
include/linux/of.h | 12 ++++++++++++
4 files changed, 12 insertions(+), 34 deletions(-)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 6636889..11cb484 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -73,16 +73,6 @@ struct boot_param_header {
u32 dt_struct_size; /* size of the DT structure block */
};
-typedef u32 phandle;
-typedef u32 ihandle;
-
-struct property {
- char *name;
- int length;
- void *value;
- struct property *next;
-};
-
struct device_node {
const char *name;
const char *type;
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index b0a84ea..c236326 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -71,18 +71,6 @@ struct boot_param_header
u32 dt_struct_size; /* size of the DT structure block */
};
-
-
-typedef u32 phandle;
-typedef u32 ihandle;
-
-struct property {
- char *name;
- int length;
- void *value;
- struct property *next;
-};
-
struct device_node {
const char *name;
const char *type;
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index 0733170..b34f988 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -29,18 +29,6 @@
#define of_prop_cmp(s1, s2) strcasecmp((s1), (s2))
#define of_node_cmp(s1, s2) strcmp((s1), (s2))
-typedef u32 phandle;
-typedef u32 ihandle;
-
-struct property {
- char *name;
- int length;
- void *value;
- struct property *next;
- unsigned long _flags;
- unsigned int unique_id;
-};
-
struct of_irq_controller;
struct device_node {
const char *name;
diff --git a/include/linux/of.h b/include/linux/of.h
index 7be2d10..4668b29 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -19,6 +19,18 @@
#include <linux/bitops.h>
#include <linux/mod_devicetable.h>
+typedef u32 phandle;
+typedef u32 ihandle;
+
+struct property {
+ char *name;
+ int length;
+ void *value;
+ struct property *next;
+ unsigned long _flags;
+ unsigned int unique_id;
+};
+
#include <asm/prom.h>
/* flag descriptions */
^ permalink raw reply related
* [RFC PATCH 03/12] of: merge struct device_node
From: Grant Likely @ 2009-10-07 4:30 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
Merge of common code duplicated between Sparc, PowerPC and Microblaze
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/include/asm/prom.h | 20 --------------------
arch/powerpc/include/asm/prom.h | 20 --------------------
arch/sparc/include/asm/prom.h | 24 ------------------------
include/linux/of.h | 32 ++++++++++++++++++++++++++++++++
4 files changed, 32 insertions(+), 64 deletions(-)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 11cb484..64e8b3a 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -73,26 +73,6 @@ struct boot_param_header {
u32 dt_struct_size; /* size of the DT structure block */
};
-struct device_node {
- const char *name;
- const char *type;
- phandle node;
- phandle linux_phandle;
- char *full_name;
-
- struct property *properties;
- struct property *deadprops; /* removed properties */
- struct device_node *parent;
- struct device_node *child;
- struct device_node *sibling;
- struct device_node *next; /* next device of same type */
- struct device_node *allnext; /* next in list of all nodes */
- struct proc_dir_entry *pde; /* this node's proc directory */
- struct kref kref;
- unsigned long _flags;
- void *data;
-};
-
extern struct device_node *of_chosen;
static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index c236326..c918db5 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -71,26 +71,6 @@ struct boot_param_header
u32 dt_struct_size; /* size of the DT structure block */
};
-struct device_node {
- const char *name;
- const char *type;
- phandle node;
- phandle linux_phandle;
- char *full_name;
-
- struct property *properties;
- struct property *deadprops; /* removed properties */
- struct device_node *parent;
- struct device_node *child;
- struct device_node *sibling;
- struct device_node *next; /* next device of same type */
- struct device_node *allnext; /* next in list of all nodes */
- struct proc_dir_entry *pde; /* this node's proc directory */
- struct kref kref;
- unsigned long _flags;
- void *data;
-};
-
extern struct device_node *of_chosen;
static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index b34f988..e5f4a1d 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -29,30 +29,6 @@
#define of_prop_cmp(s1, s2) strcasecmp((s1), (s2))
#define of_node_cmp(s1, s2) strcmp((s1), (s2))
-struct of_irq_controller;
-struct device_node {
- const char *name;
- const char *type;
- phandle node;
- char *path_component_name;
- char *full_name;
-
- struct property *properties;
- struct property *deadprops; /* removed properties */
- struct device_node *parent;
- struct device_node *child;
- struct device_node *sibling;
- struct device_node *next; /* next device of same type */
- struct device_node *allnext; /* next in list of all nodes */
- struct proc_dir_entry *pde; /* this node's proc directory */
- struct kref kref;
- unsigned long _flags;
- void *data;
- unsigned int unique_id;
-
- struct of_irq_controller *irq_trans;
-};
-
struct of_irq_controller {
unsigned int (*irq_build)(struct device_node *, unsigned int, void *);
void *data;
diff --git a/include/linux/of.h b/include/linux/of.h
index 4668b29..65a158d 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -17,6 +17,7 @@
*/
#include <linux/types.h>
#include <linux/bitops.h>
+#include <linux/kref.h>
#include <linux/mod_devicetable.h>
typedef u32 phandle;
@@ -31,6 +32,37 @@ struct property {
unsigned int unique_id;
};
+#if defined(CONFIG_SPARC)
+struct of_irq_controller;
+#endif
+
+struct device_node {
+ const char *name;
+ const char *type;
+ phandle node;
+#if !defined(CONFIG_SPARC)
+ phandle linux_phandle;
+#endif
+ char *full_name;
+
+ struct property *properties;
+ struct property *deadprops; /* removed properties */
+ struct device_node *parent;
+ struct device_node *child;
+ struct device_node *sibling;
+ struct device_node *next; /* next device of same type */
+ struct device_node *allnext; /* next in list of all nodes */
+ struct proc_dir_entry *pde; /* this node's proc directory */
+ struct kref kref;
+ unsigned long _flags;
+ void *data;
+#if defined(CONFIG_SPARC)
+ char *path_component_name;
+ unsigned int unique_id;
+ struct of_irq_controller *irq_trans;
+#endif
+};
+
#include <asm/prom.h>
/* flag descriptions */
^ permalink raw reply related
* [RFC PATCH 04/12] of: Move OF_IS_DYNAMIC and OF_MARK_DYNAMIC macros to of.h
From: Grant Likely @ 2009-10-07 4:30 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
Merge of common code duplicated between Sparc, PowerPC and Microblaze
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/sparc/include/asm/prom.h | 3 ---
include/linux/of.h | 3 +++
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index e5f4a1d..ddbd870 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -34,9 +34,6 @@ struct of_irq_controller {
void *data;
};
-#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
-#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
-
extern struct device_node *of_find_node_by_cpuid(int cpuid);
extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
extern struct mutex of_set_property_mutex;
diff --git a/include/linux/of.h b/include/linux/of.h
index 65a158d..a66c1eb 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -69,6 +69,9 @@ struct device_node {
#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
#define OF_DETACHED 2 /* node has been detached from the device tree */
+#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
+#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
+
#define OF_BAD_ADDR ((u64)-1)
extern struct device_node *of_find_node_by_name(struct device_node *from,
^ permalink raw reply related
* [RFC PATCH 05/12] of: add common header for flattened device tree representation
From: Grant Likely @ 2009-10-07 4:30 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
Add a common header file for working with the flattened device tree
data structure and merge the shared data tags used by Microblaze and
PowerPC
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/include/asm/prom.h | 12 +-----------
arch/powerpc/include/asm/prom.h | 12 +-----------
include/linux/of_fdt.h | 30 ++++++++++++++++++++++++++++++
3 files changed, 32 insertions(+), 22 deletions(-)
create mode 100644 include/linux/of_fdt.h
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 64e8b3a..5f461f0 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -17,20 +17,10 @@
#ifndef _ASM_MICROBLAZE_PROM_H
#define _ASM_MICROBLAZE_PROM_H
#ifdef __KERNEL__
-
-/* Definitions used by the flattened device tree */
-#define OF_DT_HEADER 0xd00dfeed /* marker */
-#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
-#define OF_DT_END_NODE 0x2 /* End node */
-#define OF_DT_PROP 0x3 /* Property: name off, size, content */
-#define OF_DT_NOP 0x4 /* nop */
-#define OF_DT_END 0x9
-
-#define OF_DT_VERSION 0x10
-
#ifndef __ASSEMBLY__
#include <linux/types.h>
+#include <linux/of_fdt.h>
#include <linux/proc_fs.h>
#include <linux/platform_device.h>
#include <asm/irq.h>
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index c918db5..7181f8a 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -17,6 +17,7 @@
* 2 of the License, or (at your option) any later version.
*/
#include <linux/types.h>
+#include <linux/of_fdt.h>
#include <linux/proc_fs.h>
#include <linux/platform_device.h>
#include <asm/irq.h>
@@ -29,17 +30,6 @@
#define of_prop_cmp(s1, s2) strcmp((s1), (s2))
#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
-/* Definitions used by the flattened device tree */
-#define OF_DT_HEADER 0xd00dfeed /* marker */
-#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
-#define OF_DT_END_NODE 0x2 /* End node */
-#define OF_DT_PROP 0x3 /* Property: name off, size,
- * content */
-#define OF_DT_NOP 0x4 /* nop */
-#define OF_DT_END 0x9
-
-#define OF_DT_VERSION 0x10
-
/*
* This is what gets passed to the kernel by prom_init or kexec
*
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
new file mode 100644
index 0000000..f81d3f8
--- /dev/null
+++ b/include/linux/of_fdt.h
@@ -0,0 +1,30 @@
+/*
+ * Definitions for working with the Flattened Device Tree data format
+ *
+ * Copyright (C) 1996-2005 Paul Mackerras.
+ *
+ * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
+ * Updates for SPARC by David S. Miller
+ * Merged to common code by Grant Likely
+ *
+ * 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.
+ */
+
+#ifndef _LINUX_OF_FDT_H
+#define _LINUX_OF_FDT_H
+
+/* Definitions used by the flattened device tree */
+#define OF_DT_HEADER 0xd00dfeed /* marker */
+#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
+#define OF_DT_END_NODE 0x2 /* End node */
+#define OF_DT_PROP 0x3 /* Property: name off, size,
+ * content */
+#define OF_DT_NOP 0x4 /* nop */
+#define OF_DT_END 0x9
+
+#define OF_DT_VERSION 0x10
+
+#endif /* _LINUX_OF_FDT_H */
^ permalink raw reply related
* [RFC PATCH 06/12] of: merge struct boot_param_header from Microblaze and PowerPC
From: Grant Likely @ 2009-10-07 4:31 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
Merge common code for working with Flattened Device Tree data structure
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/include/asm/prom.h | 30 ------------------------------
arch/powerpc/include/asm/prom.h | 31 -------------------------------
include/linux/of_fdt.h | 30 ++++++++++++++++++++++++++++++
3 files changed, 30 insertions(+), 61 deletions(-)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 5f461f0..dfc4afc 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -33,36 +33,6 @@
#define of_prop_cmp(s1, s2) strcmp((s1), (s2))
#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
-/*
- * This is what gets passed to the kernel by prom_init or kexec
- *
- * The dt struct contains the device tree structure, full pathes and
- * property contents. The dt strings contain a separate block with just
- * the strings for the property names, and is fully page aligned and
- * self contained in a page, so that it can be kept around by the kernel,
- * each property name appears only once in this page (cheap compression)
- *
- * the mem_rsvmap contains a map of reserved ranges of physical memory,
- * passing it here instead of in the device-tree itself greatly simplifies
- * the job of everybody. It's just a list of u64 pairs (base/size) that
- * ends when size is 0
- */
-struct boot_param_header {
- u32 magic; /* magic word OF_DT_HEADER */
- u32 totalsize; /* total size of DT block */
- u32 off_dt_struct; /* offset to structure */
- u32 off_dt_strings; /* offset to strings */
- u32 off_mem_rsvmap; /* offset to memory reserve map */
- u32 version; /* format version */
- u32 last_comp_version; /* last compatible version */
- /* version 2 fields below */
- u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
- /* version 3 fields below */
- u32 dt_strings_size; /* size of the DT strings block */
- /* version 17 fields below */
- u32 dt_struct_size; /* size of the DT structure block */
-};
-
extern struct device_node *of_chosen;
static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index 7181f8a..ef20e6c 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -30,37 +30,6 @@
#define of_prop_cmp(s1, s2) strcmp((s1), (s2))
#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
-/*
- * This is what gets passed to the kernel by prom_init or kexec
- *
- * The dt struct contains the device tree structure, full pathes and
- * property contents. The dt strings contain a separate block with just
- * the strings for the property names, and is fully page aligned and
- * self contained in a page, so that it can be kept around by the kernel,
- * each property name appears only once in this page (cheap compression)
- *
- * the mem_rsvmap contains a map of reserved ranges of physical memory,
- * passing it here instead of in the device-tree itself greatly simplifies
- * the job of everybody. It's just a list of u64 pairs (base/size) that
- * ends when size is 0
- */
-struct boot_param_header
-{
- u32 magic; /* magic word OF_DT_HEADER */
- u32 totalsize; /* total size of DT block */
- u32 off_dt_struct; /* offset to structure */
- u32 off_dt_strings; /* offset to strings */
- u32 off_mem_rsvmap; /* offset to memory reserve map */
- u32 version; /* format version */
- u32 last_comp_version; /* last compatible version */
- /* version 2 fields below */
- u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
- /* version 3 fields below */
- u32 dt_strings_size; /* size of the DT strings block */
- /* version 17 fields below */
- u32 dt_struct_size; /* size of the DT structure block */
-};
-
extern struct device_node *of_chosen;
static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index f81d3f8..8b87bcb 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -27,4 +27,34 @@
#define OF_DT_VERSION 0x10
+/*
+ * This is what gets passed to the kernel by prom_init or kexec
+ *
+ * The dt struct contains the device tree structure, full pathes and
+ * property contents. The dt strings contain a separate block with just
+ * the strings for the property names, and is fully page aligned and
+ * self contained in a page, so that it can be kept around by the kernel,
+ * each property name appears only once in this page (cheap compression)
+ *
+ * the mem_rsvmap contains a map of reserved ranges of physical memory,
+ * passing it here instead of in the device-tree itself greatly simplifies
+ * the job of everybody. It's just a list of u64 pairs (base/size) that
+ * ends when size is 0
+ */
+struct boot_param_header {
+ u32 magic; /* magic word OF_DT_HEADER */
+ u32 totalsize; /* total size of DT block */
+ u32 off_dt_struct; /* offset to structure */
+ u32 off_dt_strings; /* offset to strings */
+ u32 off_mem_rsvmap; /* offset to memory reserve map */
+ u32 version; /* format version */
+ u32 last_comp_version; /* last compatible version */
+ /* version 2 fields below */
+ u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
+ /* version 3 fields below */
+ u32 dt_strings_size; /* size of the DT strings block */
+ /* version 17 fields below */
+ u32 dt_struct_size; /* size of the DT structure block */
+};
+
#endif /* _LINUX_OF_FDT_H */
^ permalink raw reply related
* [RFC PATCH 07/12] of: merge of_node_*_flag() and set_node_proc_entry()
From: Grant Likely @ 2009-10-07 4:31 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
Merge common code between PowerPC and Microblaze
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/include/asm/prom.h | 16 ----------------
arch/powerpc/include/asm/prom.h | 17 -----------------
include/linux/of.h | 16 ++++++++++++++++
3 files changed, 16 insertions(+), 33 deletions(-)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index dfc4afc..180d844 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -35,24 +35,8 @@
extern struct device_node *of_chosen;
-static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
-{
- return test_bit(flag, &n->_flags);
-}
-
-static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
-{
- set_bit(flag, &n->_flags);
-}
-
#define HAVE_ARCH_DEVTREE_FIXUPS
-static inline void set_node_proc_entry(struct device_node *dn,
- struct proc_dir_entry *de)
-{
- dn->pde = de;
-}
-
extern struct device_node *allnodes; /* temporary while merging */
extern rwlock_t devtree_lock; /* temporary while merging */
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index ef20e6c..2cfd432 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -32,25 +32,8 @@
extern struct device_node *of_chosen;
-static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
-{
- return test_bit(flag, &n->_flags);
-}
-
-static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
-{
- set_bit(flag, &n->_flags);
-}
-
-
#define HAVE_ARCH_DEVTREE_FIXUPS
-static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
-{
- dn->pde = de;
-}
-
-
extern struct device_node *of_find_all_nodes(struct device_node *prev);
extern struct device_node *of_node_get(struct device_node *node);
extern void of_node_put(struct device_node *node);
diff --git a/include/linux/of.h b/include/linux/of.h
index a66c1eb..d5f6662 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -63,6 +63,22 @@ struct device_node {
#endif
};
+static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
+{
+ return test_bit(flag, &n->_flags);
+}
+
+static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
+{
+ set_bit(flag, &n->_flags);
+}
+
+static inline void
+set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
+{
+ dn->pde = de;
+}
+
#include <asm/prom.h>
/* flag descriptions */
^ permalink raw reply related
* [RFC PATCH 08/12] of: merge of_read_number() an of_read_ulong()
From: Grant Likely @ 2009-10-07 4:31 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
Merge common code between Microblaze and PowerPC
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/include/asm/prom.h | 12 ------------
arch/powerpc/include/asm/prom.h | 20 --------------------
include/linux/of.h | 23 +++++++++++++++++++++++
3 files changed, 23 insertions(+), 32 deletions(-)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 180d844..d4f57ff 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -82,18 +82,6 @@ extern int release_OF_resource(struct device_node *node, int index);
* OF address retreival & translation
*/
-/* Helper to read a big number; size is in cells (not bytes) */
-static inline u64 of_read_number(const u32 *cell, int size)
-{
- u64 r = 0;
- while (size--)
- r = (r << 32) | *(cell++);
- return r;
-}
-
-/* Like of_read_number, but we want an unsigned long result */
-#define of_read_ulong(cell, size) of_read_number(cell, size)
-
/* Translate an OF address block into a CPU physical address
*/
extern u64 of_translate_address(struct device_node *np, const u32 *addr);
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index 2cfd432..d8c0525 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -89,26 +89,6 @@ extern int release_OF_resource(struct device_node* node, int index);
* OF address retreival & translation
*/
-
-/* Helper to read a big number; size is in cells (not bytes) */
-static inline u64 of_read_number(const u32 *cell, int size)
-{
- u64 r = 0;
- while (size--)
- r = (r << 32) | *(cell++);
- return r;
-}
-
-/* Like of_read_number, but we want an unsigned long result */
-#ifdef CONFIG_PPC32
-static inline unsigned long of_read_ulong(const u32 *cell, int size)
-{
- return cell[size-1];
-}
-#else
-#define of_read_ulong(cell, size) of_read_number(cell, size)
-#endif
-
/* Translate an OF address block into a CPU physical address
*/
extern u64 of_translate_address(struct device_node *np, const u32 *addr);
diff --git a/include/linux/of.h b/include/linux/of.h
index d5f6662..18e4379 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -79,6 +79,29 @@ set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
dn->pde = de;
}
+/*
+ * OF address retreival & translation
+ */
+
+/* Helper to read a big number; size is in cells (not bytes) */
+static inline u64 of_read_number(const u32 *cell, int size)
+{
+ u64 r = 0;
+ while (size--)
+ r = (r << 32) | *(cell++);
+ return r;
+}
+
+/* Like of_read_number, but we want an unsigned long result */
+#ifdef CONFIG_PPC32
+static inline unsigned long of_read_ulong(const u32 *cell, int size)
+{
+ return cell[size-1];
+}
+#else
+#define of_read_ulong(cell, size) of_read_number(cell, size)
+#endif
+
#include <asm/prom.h>
/* flag descriptions */
^ permalink raw reply related
* [RFC PATCH 09/12] of: merge of_node_get(), of_node_put() and of_find_all_nodes()
From: Grant Likely @ 2009-10-07 4:31 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
Merge common code between Sparc, PowerPC and Microblaze.
Sparc differs in the implementation at this point, so this patch uses
a #ifdef to handle sparc differently for now. The merging of
implementations will occur in a later patch
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/include/asm/prom.h | 4 ----
arch/powerpc/include/asm/prom.h | 4 ----
arch/sparc/include/asm/prom.h | 9 ---------
include/linux/of.h | 16 ++++++++++++++++
4 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index d4f57ff..c92b4a9 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -40,10 +40,6 @@ extern struct device_node *of_chosen;
extern struct device_node *allnodes; /* temporary while merging */
extern rwlock_t devtree_lock; /* temporary while merging */
-extern struct device_node *of_find_all_nodes(struct device_node *prev);
-extern struct device_node *of_node_get(struct device_node *node);
-extern void of_node_put(struct device_node *node);
-
/* For scanning the flat device-tree at boot time */
extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
const char *uname, int depth,
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index d8c0525..622769c 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -34,10 +34,6 @@ extern struct device_node *of_chosen;
#define HAVE_ARCH_DEVTREE_FIXUPS
-extern struct device_node *of_find_all_nodes(struct device_node *prev);
-extern struct device_node *of_node_get(struct device_node *node);
-extern void of_node_put(struct device_node *node);
-
/* For scanning the flat device-tree at boot time */
extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
const char *uname, int depth,
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index ddbd870..f845828 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -51,15 +51,6 @@ extern void prom_build_devicetree(void);
extern void of_populate_present_mask(void);
extern void of_fill_in_cpu_data(void);
-/* Dummy ref counting routines - to be implemented later */
-static inline struct device_node *of_node_get(struct device_node *node)
-{
- return node;
-}
-static inline void of_node_put(struct device_node *node)
-{
-}
-
/* These routines are here to provide compatibility with how powerpc
* handles IRQ mapping for OF device nodes. We precompute and permanently
* register them in the of_device objects, whereas powerpc computes them
diff --git a/include/linux/of.h b/include/linux/of.h
index 18e4379..4636bba 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -79,6 +79,22 @@ set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
dn->pde = de;
}
+#if defined(CONFIG_SPARC)
+/* Dummy ref counting routines - to be implemented later */
+static inline struct device_node *of_node_get(struct device_node *node)
+{
+ return node;
+}
+static inline void of_node_put(struct device_node *node)
+{
+}
+
+#else
+extern struct device_node *of_find_all_nodes(struct device_node *prev);
+extern struct device_node *of_node_get(struct device_node *node);
+extern void of_node_put(struct device_node *node);
+#endif
+
/*
* OF address retreival & translation
*/
^ permalink raw reply related
* [RFC PATCH 10/12] of: merge of_*_flat_dt*() functions
From: Grant Likely @ 2009-10-07 4:32 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
Merge common flattened device tree code between Microblaze and PowerPC
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/include/asm/prom.h | 11 -----------
arch/powerpc/include/asm/prom.h | 10 ----------
include/linux/of_fdt.h | 14 ++++++++++++++
3 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index c92b4a9..be4db2a 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -40,17 +40,6 @@ extern struct device_node *of_chosen;
extern struct device_node *allnodes; /* temporary while merging */
extern rwlock_t devtree_lock; /* temporary while merging */
-/* For scanning the flat device-tree at boot time */
-extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
- const char *uname, int depth,
- void *data),
- void *data);
-extern void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
- unsigned long *size);
-extern int __init
- of_flat_dt_is_compatible(unsigned long node, const char *name);
-extern unsigned long __init of_get_flat_dt_root(void);
-
/* For updating the device tree at runtime */
extern void of_attach_node(struct device_node *);
extern void of_detach_node(struct device_node *);
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index 622769c..c8b5933 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -34,16 +34,6 @@ extern struct device_node *of_chosen;
#define HAVE_ARCH_DEVTREE_FIXUPS
-/* For scanning the flat device-tree at boot time */
-extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
- const char *uname, int depth,
- void *data),
- void *data);
-extern void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
- unsigned long *size);
-extern int __init of_flat_dt_is_compatible(unsigned long node, const char *name);
-extern unsigned long __init of_get_flat_dt_root(void);
-
/* For updating the device tree at runtime */
extern void of_attach_node(struct device_node *);
extern void of_detach_node(struct device_node *);
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 8b87bcb..ac31d4f 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -16,6 +16,9 @@
#ifndef _LINUX_OF_FDT_H
#define _LINUX_OF_FDT_H
+#include <linux/types.h>
+#include <linux/init.h>
+
/* Definitions used by the flattened device tree */
#define OF_DT_HEADER 0xd00dfeed /* marker */
#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
@@ -57,4 +60,15 @@ struct boot_param_header {
u32 dt_struct_size; /* size of the DT structure block */
};
+/* For scanning the flat device-tree at boot time */
+extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
+ const char *uname, int depth,
+ void *data),
+ void *data);
+extern void __init *of_get_flat_dt_prop(unsigned long node, const char *name,
+ unsigned long *size);
+extern int __init of_flat_dt_is_compatible(unsigned long node,
+ const char *name);
+extern unsigned long __init of_get_flat_dt_root(void);
+
#endif /* _LINUX_OF_FDT_H */
^ permalink raw reply related
* [RFC PATCH 11/12] of: merge other miscellaneous prototypes
From: Grant Likely @ 2009-10-07 4:32 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
Merge common prototypes used by Microblaze and PowerPC
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/include/asm/prom.h | 12 ------------
arch/powerpc/include/asm/prom.h | 14 --------------
include/linux/of_fdt.h | 13 +++++++++++++
3 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index be4db2a..ef3ec1d 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -45,19 +45,7 @@ extern void of_attach_node(struct device_node *);
extern void of_detach_node(struct device_node *);
/* Other Prototypes */
-extern void finish_device_tree(void);
-extern void unflatten_device_tree(void);
extern int early_uartlite_console(void);
-extern void early_init_devtree(void *);
-extern int machine_is_compatible(const char *compat);
-extern void print_properties(struct device_node *node);
-extern int prom_n_intr_cells(struct device_node *np);
-extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
-extern int prom_add_property(struct device_node *np, struct property *prop);
-extern int prom_remove_property(struct device_node *np, struct property *prop);
-extern int prom_update_property(struct device_node *np,
- struct property *newprop,
- struct property *oldprop);
extern struct resource *request_OF_resource(struct device_node *node,
int index, const char *name_postfix);
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index c8b5933..2ab9cbd 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -38,20 +38,6 @@ extern struct device_node *of_chosen;
extern void of_attach_node(struct device_node *);
extern void of_detach_node(struct device_node *);
-/* Other Prototypes */
-extern void finish_device_tree(void);
-extern void unflatten_device_tree(void);
-extern void early_init_devtree(void *);
-extern int machine_is_compatible(const char *compat);
-extern void print_properties(struct device_node *node);
-extern int prom_n_intr_cells(struct device_node* np);
-extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
-extern int prom_add_property(struct device_node* np, struct property* prop);
-extern int prom_remove_property(struct device_node *np, struct property *prop);
-extern int prom_update_property(struct device_node *np,
- struct property *newprop,
- struct property *oldprop);
-
#ifdef CONFIG_PPC32
/*
* PCI <-> OF matching functions
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ac31d4f..b41bd18 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -71,4 +71,17 @@ extern int __init of_flat_dt_is_compatible(unsigned long node,
const char *name);
extern unsigned long __init of_get_flat_dt_root(void);
+/* Other Prototypes */
+extern void finish_device_tree(void);
+extern void unflatten_device_tree(void);
+extern void early_init_devtree(void *);
+extern int machine_is_compatible(const char *compat);
+extern void print_properties(struct device_node *node);
+extern int prom_n_intr_cells(struct device_node* np);
+extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
+extern int prom_add_property(struct device_node* np, struct property* prop);
+extern int prom_remove_property(struct device_node *np, struct property *prop);
+extern int prom_update_property(struct device_node *np,
+ struct property *newprop,
+ struct property *oldprop);
#endif /* _LINUX_OF_FDT_H */
^ permalink raw reply related
* [RFC PATCH 12/12] of: merge of_find_all_nodes() implementations
From: Grant Likely @ 2009-10-07 4:32 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
Merge common code between Microblaze and PowerPC, and make it available
to Sparc
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/microblaze/kernel/prom.c | 23 -----------------------
arch/powerpc/kernel/prom.c | 23 -----------------------
drivers/of/base.c | 26 +++++++++++++++++++++++++-
include/linux/of.h | 3 ++-
4 files changed, 27 insertions(+), 48 deletions(-)
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index c005cc6..b817df1 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -860,29 +860,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
EXPORT_SYMBOL(of_find_node_by_phandle);
/**
- * of_find_all_nodes - Get next node in global list
- * @prev: Previous node or NULL to start iteration
- * of_node_put() will be called on it
- *
- * Returns a node pointer with refcount incremented, use
- * of_node_put() on it when done.
- */
-struct device_node *of_find_all_nodes(struct device_node *prev)
-{
- struct device_node *np;
-
- read_lock(&devtree_lock);
- np = prev ? prev->allnext : allnodes;
- for (; np != NULL; np = np->allnext)
- if (of_node_get(np))
- break;
- of_node_put(prev);
- read_unlock(&devtree_lock);
- return np;
-}
-EXPORT_SYMBOL(of_find_all_nodes);
-
-/**
* of_node_get - Increment refcount of a node
* @node: Node to inc refcount, NULL is supported to
* simplify writing of callers
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index d4405b9..4ec3008 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1317,29 +1317,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
}
/**
- * of_find_all_nodes - Get next node in global list
- * @prev: Previous node or NULL to start iteration
- * of_node_put() will be called on it
- *
- * Returns a node pointer with refcount incremented, use
- * of_node_put() on it when done.
- */
-struct device_node *of_find_all_nodes(struct device_node *prev)
-{
- struct device_node *np;
-
- read_lock(&devtree_lock);
- np = prev ? prev->allnext : allnodes;
- for (; np != 0; np = np->allnext)
- if (of_node_get(np))
- break;
- of_node_put(prev);
- read_unlock(&devtree_lock);
- return np;
-}
-EXPORT_SYMBOL(of_find_all_nodes);
-
-/**
* of_node_get - Increment refcount of a node
* @node: Node to inc refcount, NULL is supported to
* simplify writing of callers
diff --git a/drivers/of/base.c b/drivers/of/base.c
index ddf224d..e6627b2 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -9,7 +9,8 @@
*
* Adapted for sparc and sparc64 by David S. Miller davem@davemloft.net
*
- * Reconsolidated from arch/x/kernel/prom.c by Stephen Rothwell.
+ * Reconsolidated from arch/x/kernel/prom.c by Stephen Rothwell and
+ * Grant Likely.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -82,6 +83,29 @@ struct property *of_find_property(const struct device_node *np,
}
EXPORT_SYMBOL(of_find_property);
+/**
+ * of_find_all_nodes - Get next node in global list
+ * @prev: Previous node or NULL to start iteration
+ * of_node_put() will be called on it
+ *
+ * Returns a node pointer with refcount incremented, use
+ * of_node_put() on it when done.
+ */
+struct device_node *of_find_all_nodes(struct device_node *prev)
+{
+ struct device_node *np;
+
+ read_lock(&devtree_lock);
+ np = prev ? prev->allnext : allnodes;
+ for (; np != NULL; np = np->allnext)
+ if (of_node_get(np))
+ break;
+ of_node_put(prev);
+ read_unlock(&devtree_lock);
+ return np;
+}
+EXPORT_SYMBOL(of_find_all_nodes);
+
/*
* Find a property with a given name for a given node
* and return the value.
diff --git a/include/linux/of.h b/include/linux/of.h
index 4636bba..e7facd8 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -79,6 +79,8 @@ set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
dn->pde = de;
}
+extern struct device_node *of_find_all_nodes(struct device_node *prev);
+
#if defined(CONFIG_SPARC)
/* Dummy ref counting routines - to be implemented later */
static inline struct device_node *of_node_get(struct device_node *node)
@@ -90,7 +92,6 @@ static inline void of_node_put(struct device_node *node)
}
#else
-extern struct device_node *of_find_all_nodes(struct device_node *prev);
extern struct device_node *of_node_get(struct device_node *node);
extern void of_node_put(struct device_node *node);
#endif
^ permalink raw reply related
* Re: [RFC PATCH 00/12] Merge common OpenFirmware device tree code
From: Grant Likely @ 2009-10-07 4:49 UTC (permalink / raw)
To: linuxppc-dev, benh, Stephen Rothwell, davem, sparclinux, monstr,
microblaze-uclinux, devicetree-discuss
In-Reply-To: <20091007041007.16890.62194.stgit@angua>
On Tue, Oct 6, 2009 at 10:29 PM, Grant Likely <grant.likely@secretlab.ca> w=
rote:
> Well, I've got to start somewhere...
>
> So here goes. =A0I've begun the work to merge and clean up the OF device
> tree handling code and this is my first set of patches. =A0Not fully
> tested yet, but I'm getting them out to the lists so that I can start
> responding to comments and collecting acks. =A0This first batch isn't
> anything exciting, just a merge of common code
Shoot.... most of what I wrote got trimmed accidentally. Here's the
rest of the text:
However, I've completely devoted to this work for at least the next
two months, so there are plenty more patches to follow. Once I've
got all the common code merged between Microblaze, PowerPC and Sparc
I'll be fix the endian problems and making it easily usable by other
architectures like ARM and MIPS. Lots of work to be done.
As for merging this stuff, because the patches cross architecture
boundaries, I've been thinking of publishing a new git tree for
collecting device tree related changes and getting it added to the
linux-next tree list. I'll commit changes to that tree once I get
acks from each of the affected arch maintainers. Then, either Linus
can pull my tree directly, or I could ask a more senior maintainer
to pull into their tree before sending a pull request to Linus. Ben,
David and Michal, how does that sound to you? Stephen, would you be
willing to add my tree to the linux-next list?
Also, I'd like to take on responsibility for maintaining the cross-
architecture device tree code. If there are no objections, I'll
write a patch to add a device tree section to MAINTAINERS.
Cheers,
g.
> ---
>
> Grant Likely (12):
> =A0 =A0 =A0of: merge of_find_all_nodes() implementations
> =A0 =A0 =A0of: merge other miscellaneous prototypes
> =A0 =A0 =A0of: merge of_*_flat_dt*() functions
> =A0 =A0 =A0of: merge of_node_get(), of_node_put() and of_find_all_nodes()
> =A0 =A0 =A0of: merge of_read_number() an of_read_ulong()
> =A0 =A0 =A0of: merge of_node_*_flag() and set_node_proc_entry()
> =A0 =A0 =A0of: merge struct boot_param_header from Microblaze and PowerPC
> =A0 =A0 =A0of: add common header for flattened device tree representation
> =A0 =A0 =A0of: Move OF_IS_DYNAMIC and OF_MARK_DYNAMIC macros to of.h
> =A0 =A0 =A0of: merge struct device_node
> =A0 =A0 =A0of: merge phandle, ihandle and struct property
> =A0 =A0 =A0of: Rework linux/of.h and asm/prom.h include ordering
>
>
> =A0arch/microblaze/include/asm/prom.h | =A0135 +-------------------------=
-------
> =A0arch/microblaze/kernel/prom.c =A0 =A0 =A0| =A0 23 ------
> =A0arch/powerpc/include/asm/prom.h =A0 =A0| =A0147 ----------------------=
--------------
> =A0arch/powerpc/kernel/prom.c =A0 =A0 =A0 =A0 | =A0 23 ------
> =A0arch/sparc/include/asm/prom.h =A0 =A0 =A0| =A0 55 -------------
> =A0drivers/of/base.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0| =A0 26 ++++++
> =A0include/linux/of.h =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0103 ++++++++++=
+++++++++++++++
> =A0include/linux/of_fdt.h =A0 =A0 =A0 =A0 =A0 =A0 | =A0 87 ++++++++++++++=
+++++++
> =A08 files changed, 221 insertions(+), 378 deletions(-)
> =A0create mode 100644 include/linux/of_fdt.h
^ permalink raw reply
* Re: [RFC PATCH 05/12] of: add common header for flattened device tree representation
From: Stephen Rothwell @ 2009-10-07 4:57 UTC (permalink / raw)
To: Grant Likely
Cc: monstr, devicetree-discuss, microblaze-uclinux, sparclinux,
linuxppc-dev, davem
In-Reply-To: <20091007043052.16890.15975.stgit@angua>
[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]
Hi Grant,
Just first obvious thing:
On Tue, 06 Oct 2009 22:30:59 -0600 Grant Likely <grant.likely@secretlab.ca> wrote:
>
> diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
> index 64e8b3a..5f461f0 100644
> --- a/arch/microblaze/include/asm/prom.h
> +++ b/arch/microblaze/include/asm/prom.h
> @@ -17,20 +17,10 @@
> #ifndef _ASM_MICROBLAZE_PROM_H
> #define _ASM_MICROBLAZE_PROM_H
> #ifdef __KERNEL__
> -
> -/* Definitions used by the flattened device tree */
> -#define OF_DT_HEADER 0xd00dfeed /* marker */
This is used in arch/microblaze/kernel/head.S, but you move its
definition inside "#ifndef __ASSEMBLY__" below. You should probably
replace the include of asm/prom.h in arch/microblaze/kernel/head.S with
linux/of_fdt.h (assuming that the comment in there is correct).
> -#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
> -#define OF_DT_END_NODE 0x2 /* End node */
> -#define OF_DT_PROP 0x3 /* Property: name off, size, content */
> -#define OF_DT_NOP 0x4 /* nop */
> -#define OF_DT_END 0x9
> -
> -#define OF_DT_VERSION 0x10
> -
> #ifndef __ASSEMBLY__
>
> #include <linux/types.h>
> +#include <linux/of_fdt.h>
> #include <linux/proc_fs.h>
> #include <linux/platform_device.h>
> #include <asm/irq.h>
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: [RFC PATCH 05/12] of: add common header for flattened device tree representation
From: Benjamin Herrenschmidt @ 2009-10-07 5:14 UTC (permalink / raw)
To: Grant Likely
Cc: Stephen Rothwell, monstr, microblaze-uclinux, devicetree-discuss,
sparclinux, linuxppc-dev, davem
In-Reply-To: <20091007043052.16890.15975.stgit@angua>
On Tue, 2009-10-06 at 22:30 -0600, Grant Likely wrote:
> --- /dev/null
> +++ b/include/linux/of_fdt.h
> @@ -0,0 +1,30 @@
> +/*
> + * Definitions for working with the Flattened Device Tree data format
> + *
> + * Copyright (C) 1996-2005 Paul Mackerras.
> + *
> + * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
> + * Updates for SPARC by David S. Miller
> + * Merged to common code by Grant Likely
I think you should prune the above. Make it (c) myself since I wrote the
FDT code initially. You can add back (c) of other people as you add more
stuff here I suppose.
No big deal tho.
Ben.
> + * 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.
> + */
> +
> +#ifndef _LINUX_OF_FDT_H
> +#define _LINUX_OF_FDT_H
> +
> +/* Definitions used by the flattened device tree */
> +#define OF_DT_HEADER 0xd00dfeed /* marker */
> +#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
> +#define OF_DT_END_NODE 0x2 /* End node */
> +#define OF_DT_PROP 0x3 /* Property: name off, size,
> + * content */
> +#define OF_DT_NOP 0x4 /* nop */
> +#define OF_DT_END 0x9
> +
> +#define OF_DT_VERSION 0x10
> +
> +#endif /* _LINUX_OF_FDT_H */
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox