LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Start arch/powerpc/boot code reorganization
From: Mark A. Greer @ 2006-09-22 20:40 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Matt Porter, Paul Mackerras, linuxppc-dev
In-Reply-To: <45143B2B.7060501@ru.mvista.com>

On Fri, Sep 22, 2006 at 11:36:11PM +0400, Sergei Shtylyov wrote:

> >3) The number of cells in the "size" portion of the tuple is indicated
> >by the nearest #size-cells as you go up the tree.  Just like the "reg"
> >property.
> 
>    Well, is there need for duplication of size if "reg" prop must be 
>    present anyway?

We're not adding another #size-cells, we're using the same one that
"reg" uses.  No duplication, just reuse.

Mark

^ permalink raw reply

* Re: [PATCH] Start arch/powerpc/boot code reorganization
From: Sergei Shtylyov @ 2006-09-22 20:43 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: Matt Porter, Paul Mackerras, linuxppc-dev
In-Reply-To: <20060922204013.GA29524@mag.az.mvista.com>

Hello.

Mark A. Greer wrote:

>>>3) The number of cells in the "size" portion of the tuple is indicated
>>>by the nearest #size-cells as you go up the tree.  Just like the "reg"
>>>property.

>>   Well, is there need for duplication of size if "reg" prop must be 
>>   present anyway?

> We're not adding another #size-cells, we're using the same one that
> "reg" uses.  No duplication, just reuse.

    I mean size could have been gotten from "reg" prop.

> Mark

WBR, Sergei

^ permalink raw reply

* Re: [PATCH] Start arch/powerpc/boot code reorganization
From: Mark A. Greer @ 2006-09-22 20:52 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Matt Porter, Paul Mackerras, linuxppc-dev
In-Reply-To: <45144AFB.7030309@ru.mvista.com>

On Sat, Sep 23, 2006 at 12:43:39AM +0400, Sergei Shtylyov wrote:
> Hello.
> 
> Mark A. Greer wrote:
> 
> >>>3) The number of cells in the "size" portion of the tuple is indicated
> >>>by the nearest #size-cells as you go up the tree.  Just like the "reg"
> >>>property.
> 
> >>  Well, is there need for duplication of size if "reg" prop must be 
> >>  present anyway?
> 
> >We're not adding another #size-cells, we're using the same one that
> >"reg" uses.  No duplication, just reuse.
> 
>    I mean size could have been gotten from "reg" prop.

Oh.  Nah, seems like a violation of how things usually work and it only
adds work to look up yet another property.

Mark

^ permalink raw reply

* Re: [PATCH] Start arch/powerpc/boot code reorganization
From: Sergei Shtylyov @ 2006-09-22 20:56 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: Matt Porter, Paul Mackerras, linuxppc-dev
In-Reply-To: <20060922205207.GB29524@mag.az.mvista.com>

Hello.

Mark A. Greer wrote:

>>>>>3) The number of cells in the "size" portion of the tuple is indicated
>>>>>by the nearest #size-cells as you go up the tree.  Just like the "reg"
>>>>>property.

>>>> Well, is there need for duplication of size if "reg" prop must be 
>>>> present anyway?

>>>We're not adding another #size-cells, we're using the same one that
>>>"reg" uses.  No duplication, just reuse.

>>   I mean size could have been gotten from "reg" prop.

> Oh.  Nah, seems like a violation of how things usually work and it only

    Since you're cloning the "address" prop which consisted only of the 
address value, this doesn't seem so obvious.

> adds work to look up yet another property.

    Oh, that's another story. :-)

> Mark

WBR, Sergei

^ permalink raw reply

* Re: [PATCH]: PCI Error Recovery: Symbios SCSI device driver
From: Luca @ 2006-09-22 22:06 UTC (permalink / raw)
  To: Linas Vepstas; +Cc: linuxppc-dev, linux-pci, linux-kernel, linux-scsi
In-Reply-To: <20060921231314.GW29167@austin.ibm.com>


Hi Linas,

Linas Vepstas <linas@austin.ibm.com> ha scritto:
> Index: linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_glue.c
> ===================================================================
> --- linux-2.6.18-rc7-git1.orig/drivers/scsi/sym53c8xx_2/sym_glue.c      2006-09-21 17:32:54.000000000 -0500
> +++ linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_glue.c   2006-09-21 17:35:37.000000000 -0500
> +/**
> + * sym2_io_slot_reset() -- called when the pci bus has been reset.
> + * @pdev: pointer to PCI device
> + *
> + * Restart the card from scratch.
> + */
> +static pci_ers_result_t sym2_io_slot_reset (struct pci_dev *pdev)
> +{
> +       struct sym_hcb *np = pci_get_drvdata(pdev);
> +
> +       printk (KERN_INFO "%s: recovering from a PCI slot reset\n",

Space after function name? You put in other places too, it's not
consistent with the rest of the patch.

> +           sym_name(np));
> +
> +       if (pci_enable_device(pdev))
> +               printk (KERN_ERR "%s: device setup failed most egregiously\n",
> +                           sym_name(np));

Is the failure of pci_enable_device ignored on purpose?
(plus extra space)

> +
> +       pci_set_master(pdev);
> +       enable_irq (pdev->irq);

Spurious space.

> +
> +       /* Perform host reset only on one instance of the card */
> +       if (0 == PCI_FUNC (pdev->devfn)) {

Ditto.

> +               if (sym_reset_scsi_bus(np, 0)) {
> +                  printk(KERN_ERR "%s: Unable to reset scsi host controller\n",
> +                                                 sym_name(np));
> +                       return PCI_ERS_RESULT_DISCONNECT;
> +               }
> +               sym_start_up (np, 1);

Ditto.

> +       }
> +
> +       return PCI_ERS_RESULT_RECOVERED;
> +}


Luca
-- 
"L'abilita` politica e` l'abilita` di prevedere quello che
 accadra` domani, la prossima settimana, il prossimo mese e
 l'anno prossimo. E di essere cosi` abili, piu` tardi,
 da spiegare  perche' non e` accaduto."

^ permalink raw reply

* Re: [PATCH]: PCI Error Recovery: Symbios SCSI device driver
From: Linas Vepstas @ 2006-09-22 23:32 UTC (permalink / raw)
  To: Luca; +Cc: linuxppc-dev, linux-pci, linux-kernel, linux-scsi
In-Reply-To: <20060922220629.GA4600@dreamland.darkstar.lan>

On Sat, Sep 23, 2006 at 12:06:29AM +0200, Luca wrote:
> 
> Space after function name? You put in other places too, it's not
> consistent with the rest of the patch.

Oops. I was also coding on a different project recently, with a
different style.  I'll send a revised patch in a moment.

> > +       if (pci_enable_device(pdev))
> > +               printk (KERN_ERR "%s: device setup failed most egregiously\n",
> > +                           sym_name(np));
> 
> Is the failure of pci_enable_device ignored on purpose?

No. :-( Thanks for the catch. I think I got cross-eyed staring at the code.

--linas

^ permalink raw reply

* [PATCH]: (revised) PCI Error Recovery: Symbios SCSI device driver
From: Linas Vepstas @ 2006-09-22 23:43 UTC (permalink / raw)
  To: matthew; +Cc: linuxppc-dev, linux-pci, Luca, linux-kernel, linux-scsi
In-Reply-To: <20060922220629.GA4600@dreamland.darkstar.lan>


Matthew, 

Revised patch per comments from Luca, 
Please review, apply and forward upstream.

--linas

Various PCI bus errors can be signaled by newer PCI controllers.  
This patch adds the PCI error recovery callbacks to the Symbios 
SCSI device driver.  The patch has been tested, and appears to 
work well.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

--
 drivers/scsi/sym53c8xx_2/sym_glue.c |   99 ++++++++++++++++++++++++++++++++++++
 drivers/scsi/sym53c8xx_2/sym_glue.h |    4 +
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   10 +++
 3 files changed, 113 insertions(+)

Index: linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_glue.c
===================================================================
--- linux-2.6.18-rc7-git1.orig/drivers/scsi/sym53c8xx_2/sym_glue.c	2006-09-22 18:33:06.000000000 -0500
+++ linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_glue.c	2006-09-22 18:37:34.000000000 -0500
@@ -659,6 +659,11 @@ static irqreturn_t sym53c8xx_intr(int ir
 
 	if (DEBUG_FLAGS & DEBUG_TINY) printf_debug ("[");
 
+	/* Avoid spinloop trying to handle interrupts on frozen device */
+	if ((np->s.device->error_state != pci_channel_io_normal) &&
+	    (np->s.device->error_state != 0))
+		return IRQ_HANDLED;
+
 	spin_lock_irqsave(np->s.host->host_lock, flags);
 	sym_interrupt(np);
 	spin_unlock_irqrestore(np->s.host->host_lock, flags);
@@ -726,6 +731,19 @@ static int sym_eh_handler(int op, char *
 
 	dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname);
 
+	/* We may be in an error condition because the PCI bus
+	 * went down. In this case, we need to wait until the
+	 * PCI bus is reset, the card is reset, and only then
+	 * proceed with the scsi error recovery.  There's no
+	 * point in hurrying; take a leisurely wait.
+	 */
+#define WAIT_FOR_PCI_RECOVERY	35
+	if ((np->s.device->error_state != pci_channel_io_normal) &&
+	    (np->s.device->error_state != 0) &&
+		 (0 == wait_for_completion_timeout(&np->s.io_reset_wait,
+		                                 WAIT_FOR_PCI_RECOVERY*HZ)))
+			return SCSI_FAILED;
+
 	spin_lock_irq(host->host_lock);
 	/* This one is queued in some place -> to wait for completion */
 	FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) {
@@ -1510,6 +1528,7 @@ static struct Scsi_Host * __devinit sym_
 	np->maxoffs	= dev->chip.offset_max;
 	np->maxburst	= dev->chip.burst_max;
 	np->myaddr	= dev->host_id;
+	init_completion(&np->s.io_reset_wait);
 
 	/*
 	 *  Edit its name.
@@ -1948,6 +1967,79 @@ static void __devexit sym2_remove(struct
 	attach_count--;
 }
 
+/**
+ * sym2_io_error_detected() -- called when PCI error is detected
+ * @pdev: pointer to PCI device
+ * @state: current state of the PCI slot
+ */
+static pci_ers_result_t sym2_io_error_detected (struct pci_dev *pdev,
+                                         enum pci_channel_state state)
+{
+	struct sym_hcb *np = pci_get_drvdata(pdev);
+
+	/* If slot is permanently frozen, turn everything off */
+	if (state == pci_channel_io_perm_failure) {
+		sym2_remove(pdev);
+		return PCI_ERS_RESULT_DISCONNECT;
+	}
+
+	init_completion(&np->s.io_reset_wait);
+	disable_irq(pdev->irq);
+	pci_disable_device(pdev);
+
+	/* Request a slot reset. */
+	return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/**
+ * sym2_io_slot_reset() -- called when the pci bus has been reset.
+ * @pdev: pointer to PCI device
+ *
+ * Restart the card from scratch.
+ */
+static pci_ers_result_t sym2_io_slot_reset (struct pci_dev *pdev)
+{
+	struct sym_hcb *np = pci_get_drvdata(pdev);
+
+	printk(KERN_INFO "%s: recovering from a PCI slot reset\n",
+	    sym_name(np));
+
+	if (pci_enable_device(pdev)) {
+		printk(KERN_ERR "%s: device setup failed most egregiously\n",
+			    sym_name(np));
+		return PCI_ERS_RESULT_DISCONNECT;
+	}
+
+	pci_set_master(pdev);
+	enable_irq(pdev->irq);
+
+	/* Perform host reset only on one instance of the card */
+	if (0 == PCI_FUNC (pdev->devfn)) {
+		if (sym_reset_scsi_bus(np, 0)) {
+		   printk(KERN_ERR "%s: Unable to reset scsi host controller\n",
+					          sym_name(np));
+			return PCI_ERS_RESULT_DISCONNECT;
+		}
+		sym_start_up(np, 1);
+	}
+
+	return PCI_ERS_RESULT_RECOVERED;
+}
+
+/**
+ * sym2_io_resume() -- resume normal ops after PCI reset
+ * @pdev: pointer to PCI device
+ *
+ * Called when the error recovery driver tells us that its
+ * OK to resume normal operation. Use completion to allow
+ * halted scsi ops to resume.
+ */
+static void sym2_io_resume (struct pci_dev *pdev)
+{
+	struct sym_hcb *np = pci_get_drvdata(pdev);
+	complete_all(&np->s.io_reset_wait);
+}
+
 static void sym2_get_signalling(struct Scsi_Host *shost)
 {
 	struct sym_hcb *np = sym_get_hcb(shost);
@@ -2110,11 +2202,18 @@ static struct pci_device_id sym2_id_tabl
 
 MODULE_DEVICE_TABLE(pci, sym2_id_table);
 
+static struct pci_error_handlers sym2_err_handler = {
+	.error_detected = sym2_io_error_detected,
+	.slot_reset = sym2_io_slot_reset,
+	.resume = sym2_io_resume,
+};
+
 static struct pci_driver sym2_driver = {
 	.name		= NAME53C8XX,
 	.id_table	= sym2_id_table,
 	.probe		= sym2_probe,
 	.remove		= __devexit_p(sym2_remove),
+	.err_handler = &sym2_err_handler,
 };
 
 static int __init sym2_init(void)
Index: linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_glue.h
===================================================================
--- linux-2.6.18-rc7-git1.orig/drivers/scsi/sym53c8xx_2/sym_glue.h	2006-09-22 18:33:06.000000000 -0500
+++ linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_glue.h	2006-09-22 18:33:26.000000000 -0500
@@ -40,6 +40,7 @@
 #ifndef SYM_GLUE_H
 #define SYM_GLUE_H
 
+#include <linux/completion.h>
 #include <linux/delay.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
@@ -179,6 +180,9 @@ struct sym_shcb {
 	char		chip_name[8];
 	struct pci_dev	*device;
 
+	/* Waiter for clearing of frozen PCI bus */
+	struct completion io_reset_wait;
+
 	struct Scsi_Host *host;
 
 	void __iomem *	ioaddr;		/* MMIO kernel io address	*/
Index: linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_hipd.c
===================================================================
--- linux-2.6.18-rc7-git1.orig/drivers/scsi/sym53c8xx_2/sym_hipd.c	2006-09-22 18:33:06.000000000 -0500
+++ linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_hipd.c	2006-09-22 18:33:26.000000000 -0500
@@ -2761,6 +2761,7 @@ void sym_interrupt (struct sym_hcb *np)
 	u_char	istat, istatc;
 	u_char	dstat;
 	u_short	sist;
+	u_int    icnt;
 
 	/*
 	 *  interrupt on the fly ?
@@ -2802,6 +2803,7 @@ void sym_interrupt (struct sym_hcb *np)
 	sist	= 0;
 	dstat	= 0;
 	istatc	= istat;
+	icnt = 0;
 	do {
 		if (istatc & SIP)
 			sist  |= INW(np, nc_sist);
@@ -2809,6 +2811,14 @@ void sym_interrupt (struct sym_hcb *np)
 			dstat |= INB(np, nc_dstat);
 		istatc = INB(np, nc_istat);
 		istat |= istatc;
+
+		/* Prevent deadlock waiting on a condition that may never clear. */
+		icnt ++;
+		if (100 < icnt) {
+			if ((np->s.device->error_state != pci_channel_io_normal)
+			   && (np->s.device->error_state != 0))
+				return;
+		}
 	} while (istatc & (SIP|DIP));
 
 	if (DEBUG_FLAGS & DEBUG_TINY)

^ permalink raw reply

* Re: [PATCH]: PCI Error Recovery: Symbios SCSI device driver
From: Randy.Dunlap @ 2006-09-22 23:39 UTC (permalink / raw)
  To: Linas Vepstas; +Cc: linuxppc-dev, linux-pci, Luca, linux-kernel, linux-scsi
In-Reply-To: <20060922233235.GB14213@austin.ibm.com>

On Fri, 22 Sep 2006 18:32:35 -0500 Linas Vepstas wrote:

> On Sat, Sep 23, 2006 at 12:06:29AM +0200, Luca wrote:
> > 
> > Space after function name? You put in other places too, it's not
> > consistent with the rest of the patch.
> 
> Oops. I was also coding on a different project recently, with a
> different style.  I'll send a revised patch in a moment.

Please change if()'s to use

	if (var == constant)
instead of
	if (constant == var)

also.  (or whatever condition is being used)  Thanks.


> > > +       if (pci_enable_device(pdev))
> > > +               printk (KERN_ERR "%s: device setup failed most egregiously\n",
> > > +                           sym_name(np));
> > 
> > Is the failure of pci_enable_device ignored on purpose?
> 
> No. :-( Thanks for the catch. I think I got cross-eyed staring at the code.

---
~Randy

^ permalink raw reply

* Re: [PATCH]: PCI Error Recovery: Symbios SCSI device driver
From: Linas Vepstas @ 2006-09-22 23:50 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linuxppc-dev, linux-pci, Luca, linux-kernel, linux-scsi
In-Reply-To: <20060922163929.bb870ee1.rdunlap@xenotime.net>

On Fri, Sep 22, 2006 at 04:39:29PM -0700, Randy.Dunlap wrote:
> On Fri, 22 Sep 2006 18:32:35 -0500 Linas Vepstas wrote:
> 
> > On Sat, Sep 23, 2006 at 12:06:29AM +0200, Luca wrote:
> > > 
> > > Space after function name? You put in other places too, it's not
> > > consistent with the rest of the patch.
> > 
> > Oops. I was also coding on a different project recently, with a
> > different style.  I'll send a revised patch in a moment.
> 
> Please change if()'s to use
> 
> 	if (var == constant)
> instead of
> 	if (constant == var)

Yuck! Horrid coding style! No rational excuse for coding like that.
Advice taken under protest; new patch shortly.

--linas

^ permalink raw reply

* [PATCH]: (revised 2) PCI Error Recovery: Symbios SCSI device driver
From: Linas Vepstas @ 2006-09-22 23:55 UTC (permalink / raw)
  To: matthew
  Cc: Luca, linux-scsi, linux-kernel, linuxppc-dev, Randy.Dunlap,
	linux-pci
In-Reply-To: <20060922163929.bb870ee1.rdunlap@xenotime.net>


Matthew, 

Second revised patch, based on comments from Luca and Randy.Dunlap
Please review, apply and forward upstream.

--linas

Various PCI bus errors can be signaled by newer PCI controllers.  
This patch adds the PCI error recovery callbacks to the Symbios 
SCSI device driver.  The patch has been tested, and appears to 
work well.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

--
 drivers/scsi/sym53c8xx_2/sym_glue.c |   99 ++++++++++++++++++++++++++++++++++++
 drivers/scsi/sym53c8xx_2/sym_glue.h |    4 +
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   10 +++
 3 files changed, 113 insertions(+)

Index: linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_glue.c
===================================================================
--- linux-2.6.18-rc7-git1.orig/drivers/scsi/sym53c8xx_2/sym_glue.c	2006-09-22 18:33:06.000000000 -0500
+++ linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_glue.c	2006-09-22 18:50:31.000000000 -0500
@@ -659,6 +659,11 @@ static irqreturn_t sym53c8xx_intr(int ir
 
 	if (DEBUG_FLAGS & DEBUG_TINY) printf_debug ("[");
 
+	/* Avoid spinloop trying to handle interrupts on frozen device */
+	if ((np->s.device->error_state != pci_channel_io_normal) &&
+	    (np->s.device->error_state != 0))
+		return IRQ_HANDLED;
+
 	spin_lock_irqsave(np->s.host->host_lock, flags);
 	sym_interrupt(np);
 	spin_unlock_irqrestore(np->s.host->host_lock, flags);
@@ -726,6 +731,19 @@ static int sym_eh_handler(int op, char *
 
 	dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname);
 
+	/* We may be in an error condition because the PCI bus
+	 * went down. In this case, we need to wait until the
+	 * PCI bus is reset, the card is reset, and only then
+	 * proceed with the scsi error recovery.  There's no
+	 * point in hurrying; take a leisurely wait.
+	 */
+#define WAIT_FOR_PCI_RECOVERY	35
+	if ((np->s.device->error_state != pci_channel_io_normal) &&
+	    (np->s.device->error_state != 0) &&
+		 (wait_for_completion_timeout(&np->s.io_reset_wait,
+		                                 WAIT_FOR_PCI_RECOVERY*HZ) == 0))
+			return SCSI_FAILED;
+
 	spin_lock_irq(host->host_lock);
 	/* This one is queued in some place -> to wait for completion */
 	FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) {
@@ -1510,6 +1528,7 @@ static struct Scsi_Host * __devinit sym_
 	np->maxoffs	= dev->chip.offset_max;
 	np->maxburst	= dev->chip.burst_max;
 	np->myaddr	= dev->host_id;
+	init_completion(&np->s.io_reset_wait);
 
 	/*
 	 *  Edit its name.
@@ -1948,6 +1967,79 @@ static void __devexit sym2_remove(struct
 	attach_count--;
 }
 
+/**
+ * sym2_io_error_detected() -- called when PCI error is detected
+ * @pdev: pointer to PCI device
+ * @state: current state of the PCI slot
+ */
+static pci_ers_result_t sym2_io_error_detected (struct pci_dev *pdev,
+                                         enum pci_channel_state state)
+{
+	struct sym_hcb *np = pci_get_drvdata(pdev);
+
+	/* If slot is permanently frozen, turn everything off */
+	if (state == pci_channel_io_perm_failure) {
+		sym2_remove(pdev);
+		return PCI_ERS_RESULT_DISCONNECT;
+	}
+
+	init_completion(&np->s.io_reset_wait);
+	disable_irq(pdev->irq);
+	pci_disable_device(pdev);
+
+	/* Request a slot reset. */
+	return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/**
+ * sym2_io_slot_reset() -- called when the pci bus has been reset.
+ * @pdev: pointer to PCI device
+ *
+ * Restart the card from scratch.
+ */
+static pci_ers_result_t sym2_io_slot_reset (struct pci_dev *pdev)
+{
+	struct sym_hcb *np = pci_get_drvdata(pdev);
+
+	printk(KERN_INFO "%s: recovering from a PCI slot reset\n",
+	    sym_name(np));
+
+	if (pci_enable_device(pdev)) {
+		printk(KERN_ERR "%s: device setup failed most egregiously\n",
+			    sym_name(np));
+		return PCI_ERS_RESULT_DISCONNECT;
+	}
+
+	pci_set_master(pdev);
+	enable_irq(pdev->irq);
+
+	/* Perform host reset only on one instance of the card */
+	if (PCI_FUNC (pdev->devfn) == 0) {
+		if (sym_reset_scsi_bus(np, 0)) {
+		   printk(KERN_ERR "%s: Unable to reset scsi host controller\n",
+					          sym_name(np));
+			return PCI_ERS_RESULT_DISCONNECT;
+		}
+		sym_start_up(np, 1);
+	}
+
+	return PCI_ERS_RESULT_RECOVERED;
+}
+
+/**
+ * sym2_io_resume() -- resume normal ops after PCI reset
+ * @pdev: pointer to PCI device
+ *
+ * Called when the error recovery driver tells us that its
+ * OK to resume normal operation. Use completion to allow
+ * halted scsi ops to resume.
+ */
+static void sym2_io_resume (struct pci_dev *pdev)
+{
+	struct sym_hcb *np = pci_get_drvdata(pdev);
+	complete_all(&np->s.io_reset_wait);
+}
+
 static void sym2_get_signalling(struct Scsi_Host *shost)
 {
 	struct sym_hcb *np = sym_get_hcb(shost);
@@ -2110,11 +2202,18 @@ static struct pci_device_id sym2_id_tabl
 
 MODULE_DEVICE_TABLE(pci, sym2_id_table);
 
+static struct pci_error_handlers sym2_err_handler = {
+	.error_detected = sym2_io_error_detected,
+	.slot_reset = sym2_io_slot_reset,
+	.resume = sym2_io_resume,
+};
+
 static struct pci_driver sym2_driver = {
 	.name		= NAME53C8XX,
 	.id_table	= sym2_id_table,
 	.probe		= sym2_probe,
 	.remove		= __devexit_p(sym2_remove),
+	.err_handler = &sym2_err_handler,
 };
 
 static int __init sym2_init(void)
Index: linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_glue.h
===================================================================
--- linux-2.6.18-rc7-git1.orig/drivers/scsi/sym53c8xx_2/sym_glue.h	2006-09-22 18:33:06.000000000 -0500
+++ linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_glue.h	2006-09-22 18:33:26.000000000 -0500
@@ -40,6 +40,7 @@
 #ifndef SYM_GLUE_H
 #define SYM_GLUE_H
 
+#include <linux/completion.h>
 #include <linux/delay.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
@@ -179,6 +180,9 @@ struct sym_shcb {
 	char		chip_name[8];
 	struct pci_dev	*device;
 
+	/* Waiter for clearing of frozen PCI bus */
+	struct completion io_reset_wait;
+
 	struct Scsi_Host *host;
 
 	void __iomem *	ioaddr;		/* MMIO kernel io address	*/
Index: linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_hipd.c
===================================================================
--- linux-2.6.18-rc7-git1.orig/drivers/scsi/sym53c8xx_2/sym_hipd.c	2006-09-22 18:33:06.000000000 -0500
+++ linux-2.6.18-rc7-git1/drivers/scsi/sym53c8xx_2/sym_hipd.c	2006-09-22 18:51:48.000000000 -0500
@@ -2761,6 +2761,7 @@ void sym_interrupt (struct sym_hcb *np)
 	u_char	istat, istatc;
 	u_char	dstat;
 	u_short	sist;
+	u_int    icnt;
 
 	/*
 	 *  interrupt on the fly ?
@@ -2802,6 +2803,7 @@ void sym_interrupt (struct sym_hcb *np)
 	sist	= 0;
 	dstat	= 0;
 	istatc	= istat;
+	icnt = 0;
 	do {
 		if (istatc & SIP)
 			sist  |= INW(np, nc_sist);
@@ -2809,6 +2811,14 @@ void sym_interrupt (struct sym_hcb *np)
 			dstat |= INB(np, nc_dstat);
 		istatc = INB(np, nc_istat);
 		istat |= istatc;
+
+		/* Prevent deadlock waiting on a condition that may never clear. */
+		icnt ++;
+		if (icnt > 100) {
+			if ((np->s.device->error_state != pci_channel_io_normal)
+			   && (np->s.device->error_state != 0))
+				return;
+		}
 	} while (istatc & (SIP|DIP));
 
 	if (DEBUG_FLAGS & DEBUG_TINY)

^ permalink raw reply

* [PATCH] aoa is pmac-only
From: Al Viro @ 2006-09-23  0:24 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev, linux-kernel

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 sound/aoa/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/aoa/Kconfig b/sound/aoa/Kconfig
index 2f4334d..5d5813c 100644
--- a/sound/aoa/Kconfig
+++ b/sound/aoa/Kconfig
@@ -1,5 +1,5 @@
 menu "Apple Onboard Audio driver"
-	depends on SND!=n && PPC
+	depends on SND!=n && PPC_PMAC
 
 config SND_AOA
 	tristate "Apple Onboard Audio driver"
-- 
1.4.2.GIT

^ permalink raw reply related

* [PATCH] asm/backlight.h is ppc-only
From: Al Viro @ 2006-09-23  0:25 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev, linux-kernel

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 drivers/macintosh/adbhid.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index c69d23b..efd51e0 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -45,8 +45,8 @@ #include <linux/cuda.h>
 #include <linux/pmu.h>
 
 #include <asm/machdep.h>
-#include <asm/backlight.h>
 #ifdef CONFIG_PPC_PMAC
+#include <asm/backlight.h>
 #include <asm/pmac_feature.h>
 #endif
 
-- 
1.4.2.GIT

^ permalink raw reply related

* [PATCH] ppc math-emu needs -fno-builtin-fabs for math.c and fabs.c
From: Al Viro @ 2006-09-23  0:37 UTC (permalink / raw)
  To: linuxppc-dev


... since they deal with internal function with that name.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/powerpc/math-emu/Makefile |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/math-emu/Makefile b/arch/powerpc/math-emu/Makefile
index 754143e..29bc912 100644
--- a/arch/powerpc/math-emu/Makefile
+++ b/arch/powerpc/math-emu/Makefile
@@ -11,3 +11,6 @@ obj-$(CONFIG_MATH_EMULATION)	+= fabs.o f
 					mcrfs.o mffs.o mtfsb0.o mtfsb1.o \
 					mtfsf.o mtfsfi.o stfiwx.o stfs.o \
 					udivmodti4.o
+
+CFLAGS_fabs.o = -fno-builtin-fabs
+CFLAGS_math.o = -fno-builtin-fabs
-- 
1.4.2.GIT

^ permalink raw reply related

* [PATCH] NULL noise removal: spufs
From: Al Viro @ 2006-09-23  0:37 UTC (permalink / raw)
  To: linuxppc-dev


Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/powerpc/platforms/cell/spufs/file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 58e794f..51fd197 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1342,7 +1342,7 @@ static u64 spufs_id_get(void *data)
 
 	return num;
 }
-DEFINE_SIMPLE_ATTRIBUTE(spufs_id_ops, spufs_id_get, 0, "0x%llx\n")
+DEFINE_SIMPLE_ATTRIBUTE(spufs_id_ops, spufs_id_get, NULL, "0x%llx\n")
 
 struct tree_descr spufs_dir_contents[] = {
 	{ "mem",  &spufs_mem_fops,  0666, },
-- 
1.4.2.GIT

^ permalink raw reply related

* [PATCH] maple/pci iomem annotations
From: Al Viro @ 2006-09-23  0:37 UTC (permalink / raw)
  To: linuxppc-dev


Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/powerpc/platforms/maple/pci.c |   60 ++++++++++++++++++------------------
 1 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 63a1670..141d172 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -90,14 +90,14 @@ #define U3_AGP_CFA1(bus, devfn, off)	\
 	|(((unsigned long)(off)) & 0xFCUL) \
 	|1UL)
 
-static unsigned long u3_agp_cfg_access(struct pci_controller* hose,
+static volatile void __iomem *u3_agp_cfg_access(struct pci_controller* hose,
 				       u8 bus, u8 dev_fn, u8 offset)
 {
 	unsigned int caddr;
 
 	if (bus == hose->first_busno) {
 		if (dev_fn < (11 << 3))
-			return 0;
+			return NULL;
 		caddr = U3_AGP_CFA0(dev_fn, offset);
 	} else
 		caddr = U3_AGP_CFA1(bus, dev_fn, offset);
@@ -108,14 +108,14 @@ static unsigned long u3_agp_cfg_access(s
 	} while (in_le32(hose->cfg_addr) != caddr);
 
 	offset &= 0x07;
-	return ((unsigned long)hose->cfg_data) + offset;
+	return hose->cfg_data + offset;
 }
 
 static int u3_agp_read_config(struct pci_bus *bus, unsigned int devfn,
 			      int offset, int len, u32 *val)
 {
 	struct pci_controller *hose;
-	unsigned long addr;
+	volatile void __iomem *addr;
 
 	hose = pci_bus_to_host(bus);
 	if (hose == NULL)
@@ -130,13 +130,13 @@ static int u3_agp_read_config(struct pci
 	 */
 	switch (len) {
 	case 1:
-		*val = in_8((u8 *)addr);
+		*val = in_8(addr);
 		break;
 	case 2:
-		*val = in_le16((u16 *)addr);
+		*val = in_le16(addr);
 		break;
 	default:
-		*val = in_le32((u32 *)addr);
+		*val = in_le32(addr);
 		break;
 	}
 	return PCIBIOS_SUCCESSFUL;
@@ -146,7 +146,7 @@ static int u3_agp_write_config(struct pc
 			       int offset, int len, u32 val)
 {
 	struct pci_controller *hose;
-	unsigned long addr;
+	volatile void __iomem *addr;
 
 	hose = pci_bus_to_host(bus);
 	if (hose == NULL)
@@ -161,16 +161,16 @@ static int u3_agp_write_config(struct pc
 	 */
 	switch (len) {
 	case 1:
-		out_8((u8 *)addr, val);
-		(void) in_8((u8 *)addr);
+		out_8(addr, val);
+		(void) in_8(addr);
 		break;
 	case 2:
-		out_le16((u16 *)addr, val);
-		(void) in_le16((u16 *)addr);
+		out_le16(addr, val);
+		(void) in_le16(addr);
 		break;
 	default:
-		out_le32((u32 *)addr, val);
-		(void) in_le32((u32 *)addr);
+		out_le32(addr, val);
+		(void) in_le32(addr);
 		break;
 	}
 	return PCIBIOS_SUCCESSFUL;
@@ -190,22 +190,22 @@ #define U3_HT_CFA1(bus, devfn, off)	\
 		+ (((unsigned long)bus) << 16) \
 		+ 0x01000000UL)
 
-static unsigned long u3_ht_cfg_access(struct pci_controller* hose,
+static volatile void __iomem *u3_ht_cfg_access(struct pci_controller* hose,
 				      u8 bus, u8 devfn, u8 offset)
 {
 	if (bus == hose->first_busno) {
 		if (PCI_SLOT(devfn) == 0)
-			return 0;
-		return ((unsigned long)hose->cfg_data) + U3_HT_CFA0(devfn, offset);
+			return NULL;
+		return hose->cfg_data + U3_HT_CFA0(devfn, offset);
 	} else
-		return ((unsigned long)hose->cfg_data) + U3_HT_CFA1(bus, devfn, offset);
+		return hose->cfg_data + U3_HT_CFA1(bus, devfn, offset);
 }
 
 static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
 			     int offset, int len, u32 *val)
 {
 	struct pci_controller *hose;
-	unsigned long addr;
+	volatile void __iomem *addr;
 
 	hose = pci_bus_to_host(bus);
 	if (hose == NULL)
@@ -221,13 +221,13 @@ static int u3_ht_read_config(struct pci_
 	 */
 	switch (len) {
 	case 1:
-		*val = in_8((u8 *)addr);
+		*val = in_8(addr);
 		break;
 	case 2:
-		*val = in_le16((u16 *)addr);
+		*val = in_le16(addr);
 		break;
 	default:
-		*val = in_le32((u32 *)addr);
+		*val = in_le32(addr);
 		break;
 	}
 	return PCIBIOS_SUCCESSFUL;
@@ -237,7 +237,7 @@ static int u3_ht_write_config(struct pci
 			      int offset, int len, u32 val)
 {
 	struct pci_controller *hose;
-	unsigned long addr;
+	volatile void __iomem *addr;
 
 	hose = pci_bus_to_host(bus);
 	if (hose == NULL)
@@ -252,16 +252,16 @@ static int u3_ht_write_config(struct pci
 	 */
 	switch (len) {
 	case 1:
-		out_8((u8 *)addr, val);
-		(void) in_8((u8 *)addr);
+		out_8(addr, val);
+		(void) in_8(addr);
 		break;
 	case 2:
-		out_le16((u16 *)addr, val);
-		(void) in_le16((u16 *)addr);
+		out_le16(addr, val);
+		(void) in_le16(addr);
 		break;
 	default:
-		out_le32((u32 *)addr, val);
-		(void) in_le32((u32 *)addr);
+		out_le32(addr, val);
+		(void) in_le32(addr);
 		break;
 	}
 	return PCIBIOS_SUCCESSFUL;
@@ -301,7 +301,7 @@ static void __init setup_u3_ht(struct pc
 	 * the reg address cell, we shall fix that by killing struct
 	 * reg_property and using some accessor functions instead
 	 */
-	hose->cfg_data = (volatile unsigned char *)ioremap(0xf2000000, 0x02000000);
+	hose->cfg_data = ioremap(0xf2000000, 0x02000000);
 
 	hose->first_busno = 0;
 	hose->last_busno = 0xef;
-- 
1.4.2.GIT

^ permalink raw reply related

* [PATCH] rewrite mkprep and mkbugboot in sane C
From: Al Viro @ 2006-09-23  0:37 UTC (permalink / raw)
  To: linuxppc-dev


Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/ppc/boot/utils/mkbugboot.c |  208 ++++++++------------
 arch/ppc/boot/utils/mkprep.c    |  416 +++++++++++++++++----------------------
 2 files changed, 267 insertions(+), 357 deletions(-)

diff --git a/arch/ppc/boot/utils/mkbugboot.c b/arch/ppc/boot/utils/mkbugboot.c
index 29115e0..1640c41 100644
--- a/arch/ppc/boot/utils/mkbugboot.c
+++ b/arch/ppc/boot/utils/mkbugboot.c
@@ -19,36 +19,13 @@ #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <netinet/in.h>
 #ifdef __sun__
 #include <inttypes.h>
 #else
 #include <stdint.h>
 #endif
 
-#ifdef __i386__
-#define cpu_to_be32(x) le32_to_cpu(x)
-#define cpu_to_be16(x) le16_to_cpu(x)
-#else
-#define cpu_to_be32(x) (x)
-#define cpu_to_be16(x) (x)
-#endif
-
-#define cpu_to_le32(x) le32_to_cpu((x))
-unsigned long le32_to_cpu(unsigned long x)
-{
-     	return (((x & 0x000000ffU) << 24) |
-		((x & 0x0000ff00U) <<  8) |
-		((x & 0x00ff0000U) >>  8) |
-		((x & 0xff000000U) >> 24));
-}
-
-#define cpu_to_le16(x) le16_to_cpu((x))
-unsigned short le16_to_cpu(unsigned short x)
-{
-	return (((x & 0x00ff) << 8) |
-		((x & 0xff00) >> 8));
-}
-
 /* size of read buffer */
 #define SIZE 0x1000
 
@@ -62,124 +39,109 @@ typedef struct bug_boot_header {
 
 #define HEADER_SIZE	sizeof(bug_boot_header_t)
 
-uint32_t copy_image(int32_t in_fd, int32_t out_fd)
+void update_checksum(void *buf, size_t size, uint16_t *sum)
 {
-  uint8_t buf[SIZE];
-  int n;
-  uint32_t image_size = 0;
-  uint8_t zero = 0;
-
-  lseek(in_fd, ELF_HEADER_SIZE, SEEK_SET);
-
-  /* Copy an image while recording its size */
-  while ( (n = read(in_fd, buf, SIZE)) > 0 )
-    {
-    image_size = image_size + n;
-    write(out_fd, buf, n);
-    }
-
-  /* BUG romboot requires that our size is divisible by 2 */
-  /* align image to 2 byte boundary */
-  if (image_size % 2)
-    {
-    image_size++;
-    write(out_fd, &zero, 1);
-    }
-
-  return image_size;
+	uint32_t csum = *sum;
+
+	while (size) {
+		csum += *(uint16_t *)buf;
+		if (csum > 0xffff)
+			csum -= 0xffff;
+		buf = (uint16_t *)buf + 1;
+		size -= 2;
+	}
+	*sum = csum;
 }
 
-void write_bugboot_header(int32_t out_fd, uint32_t boot_size)
+uint32_t copy_image(int in_fd, int out_fd, uint16_t *sum)
 {
-  uint8_t header_block[HEADER_SIZE];
-  bug_boot_header_t *bbh = (bug_boot_header_t *)&header_block[0];
-
-  memset(header_block, 0, HEADER_SIZE);
-
-  /* Fill in the PPCBUG ROM boot header */
-  strncpy(bbh->magic_word, "BOOT", 4);		/* PPCBUG magic word */
-  bbh->entry_offset = cpu_to_be32(HEADER_SIZE);	/* Entry address */
-  bbh->routine_length= cpu_to_be32(HEADER_SIZE+boot_size+2);	/* Routine length */
-  strncpy(bbh->routine_name, "LINUXROM", 8);		/* Routine name   */
-
-  /* Output the header and bootloader to the file */
-  write(out_fd, header_block, HEADER_SIZE);
+	uint8_t buf[SIZE];
+	int offset = 0;
+	int n;
+	uint32_t image_size = 0;
+
+	lseek(in_fd, ELF_HEADER_SIZE, SEEK_SET);
+
+	/* Copy an image while recording its size */
+	while ( (n = read(in_fd, buf + offset, SIZE - offset)) > 0 ) {
+		n += offset;
+		offset = n & 1;
+		n -= offset;
+		image_size = image_size + n;
+		/* who's going to deal with short writes? */
+		write(out_fd, buf, n);
+		update_checksum(buf, n, sum);
+		if (offset)
+			buf[0] = buf[n];
+	}
+
+	/* BUG romboot requires that our size is divisible by 2 */
+	/* align image to 2 byte boundary */
+	if (offset) {
+		image_size += 2;
+		buf[1] = '\0';
+		write(out_fd, buf, 2);
+		update_checksum(buf, 2, sum);
+	}
+	return image_size;
 }
 
-uint16_t calc_checksum(int32_t bug_fd)
+void write_bugboot_header(int out_fd, uint32_t boot_size, uint16_t *sum)
 {
-  uint32_t checksum_var = 0;
-  uint8_t buf[2];
-  int n;
-
-  /* Checksum loop */
-  while ( (n = read(bug_fd, buf, 2) ) )
-  {
-    checksum_var = checksum_var + *(uint16_t *)buf;
-
-    /* If we carry out, mask it and add one to the checksum */
-    if (checksum_var >> 16)
-      checksum_var = (checksum_var & 0x0000ffff) + 1;
-  }
-
-  return checksum_var;
+	static bug_boot_header_t bbh = {
+		.magic_word = "BOOT",
+		.routine_name = "LINUXROM"
+	};
+
+	/* Fill in the PPCBUG ROM boot header */
+	bbh.entry_offset = htonl(HEADER_SIZE);	/* Entry address */
+	bbh.routine_length= htonl(HEADER_SIZE+boot_size+2);	/* Routine length */
+
+	/* Output the header and bootloader to the file */
+	write(out_fd, &bbh, sizeof(bug_boot_header_t));
+	update_checksum(&bbh, sizeof(bug_boot_header_t), sum);
 }
 
 int main(int argc, char *argv[])
 {
-  int32_t image_fd, bugboot_fd;
-  int argptr = 1;
-  uint32_t kernel_size = 0;
-  uint16_t checksum = 0;
-  uint8_t bugbootname[256];
-
-  if ( (argc != 3) )
-  {
-    fprintf(stderr, "usage: %s <kernel_image> <bugboot>\n",argv[0]);
-    exit(-1);
-  }
-
-  /* Get file args */
-
-  /* kernel image file */
-    if ((image_fd = open( argv[argptr] , 0)) < 0)
-      exit(-1);
-  argptr++;
+	int image_fd, bugboot_fd;
+	uint32_t kernel_size = 0;
+	uint16_t checksum = 0;
 
-  /* bugboot file */
-  if ( !strcmp( argv[argptr], "-" ) )
-    bugboot_fd = 1;			/* stdout */
-  else
-    if ((bugboot_fd = creat( argv[argptr] , 0755)) < 0)
-      exit(-1);
-    else
-      strcpy(bugbootname, argv[argptr]);
-  argptr++;
+	if (argc != 3) {
+		fprintf(stderr, "usage: %s <kernel_image> <bugboot>\n",argv[0]);
+		exit(-1);
+	}
 
-  /* Set file position after ROM header block where zImage will be written */
-  lseek(bugboot_fd, HEADER_SIZE, SEEK_SET);
+	/* Get file args */
 
-  /* Copy kernel image into bugboot image */
-  kernel_size = copy_image(image_fd, bugboot_fd);
-  close(image_fd);
+	/* kernel image file */
+	if ((image_fd = open(argv[1] , 0)) < 0)
+		exit(-1);
 
-  /* Set file position to beginning where header/romboot will be written */
-  lseek(bugboot_fd, 0, SEEK_SET);
+	/* bugboot file */
+	if (!strcmp(argv[2], "-"))
+		bugboot_fd = 1;			/* stdout */
+	else if ((bugboot_fd = creat(argv[2] , 0755)) < 0)
+		exit(-1);
 
-  /* Write out BUG header/romboot */
-  write_bugboot_header(bugboot_fd, kernel_size);
+	/* Set file position after ROM header block where zImage will be written */
+	lseek(bugboot_fd, HEADER_SIZE, SEEK_SET);
 
-  /* Close bugboot file */
-  close(bugboot_fd);
+	/* Copy kernel image into bugboot image */
+	kernel_size = copy_image(image_fd, bugboot_fd, &checksum);
 
-  /* Reopen it as read/write */
-  bugboot_fd = open(bugbootname, O_RDWR);
+	/* Set file position to beginning where header/romboot will be written */
+	lseek(bugboot_fd, 0, SEEK_SET);
 
-  /* Calculate checksum */
-  checksum = calc_checksum(bugboot_fd);
+	/* Write out BUG header/romboot */
+	write_bugboot_header(bugboot_fd, kernel_size, &checksum);
 
-  /* Write out the calculated checksum */
-  write(bugboot_fd, &checksum, 2);
+	/* Write out the calculated checksum */
+	lseek(bugboot_fd, 0, SEEK_END);
+	write(bugboot_fd, &checksum, 2);
 
-  return 0;
+	/* Close bugboot file */
+	close(bugboot_fd);
+	return 0;
 }
diff --git a/arch/ppc/boot/utils/mkprep.c b/arch/ppc/boot/utils/mkprep.c
index f6d5a2f..192bb39 100644
--- a/arch/ppc/boot/utils/mkprep.c
+++ b/arch/ppc/boot/utils/mkprep.c
@@ -15,279 +15,227 @@
  * Modified for Sparc hosted builds by Peter Wahl <PeterWahl@web.de>
  */
 
-#include <fcntl.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <strings.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#define cpu_to_le32(x) le32_to_cpu((x))
-unsigned long le32_to_cpu(unsigned long x)
-{
-     	return (((x & 0x000000ffU) << 24) |
-		((x & 0x0000ff00U) <<  8) |
-		((x & 0x00ff0000U) >>  8) |
-		((x & 0xff000000U) >> 24));
-}
-
-
-#define cpu_to_le16(x) le16_to_cpu((x))
-unsigned short le16_to_cpu(unsigned short x)
-{
-	return (((x & 0x00ff) << 8) |
-		((x & 0xff00) >> 8));
-}
-
-#define cpu_to_be32(x) (x)
-#define be32_to_cpu(x) (x)
-#define cpu_to_be16(x) (x)
-#define be16_to_cpu(x) (x)
+#include <stdlib.h>
 
 /* size of read buffer */
 #define SIZE 0x1000
 
-
-typedef unsigned long dword_t;
-typedef unsigned short word_t;
-typedef unsigned char byte_t;
-typedef byte_t block_t[512];
-typedef byte_t page_t[4096];
-
-
 /*
  * Partition table entry
  *  - from the PReP spec
  */
 typedef struct partition_entry {
-  byte_t	boot_indicator;
-  byte_t	starting_head;
-  byte_t	starting_sector;
-  byte_t	starting_cylinder;
-
-  byte_t	system_indicator;
-  byte_t	ending_head;
-  byte_t	ending_sector;
-  byte_t	ending_cylinder;
-
-  dword_t	beginning_sector;
-  dword_t	number_of_sectors;
+	unsigned char boot_indicator;
+	unsigned char starting_head;
+	unsigned char starting_sector;
+	unsigned char starting_cylinder;
+
+	unsigned char system_indicator;
+	unsigned char ending_head;
+	unsigned char ending_sector;
+	unsigned char ending_cylinder;
+
+	unsigned char beginning_sector[4];
+	unsigned char number_of_sectors[4];
 } partition_entry_t;
 
 #define BootActive	0x80
 #define SystemPrep	0x41
 
-void copy_image(int , int);
-void write_prep_partition(int , int );
-void write_asm_data( int in, int out );
+void copy_image(FILE *, FILE *);
+void write_prep_partition(FILE *, FILE *);
+void write_asm_data(FILE *, FILE *);
 
 unsigned int elfhdr_size = 65536;
 
 int main(int argc, char *argv[])
 {
-  int in_fd, out_fd;
-  int argptr = 1;
-  unsigned int prep = 0;
-  unsigned int asmoutput = 0;
-
-  if ( (argc < 3) || (argc > 4) )
-  {
-    fprintf(stderr, "usage: %s [-pbp] [-asm] <boot-file> <image>\n",argv[0]);
-    exit(-1);
-  }
-
-  /* needs to handle args more elegantly -- but this is a small/simple program */
-
-  /* check for -pbp */
-  if ( !strcmp( argv[argptr], "-pbp" ) )
-  {
-    prep = 1;
-    argptr++;
-  }
-
-  /* check for -asm */
-  if ( !strcmp( argv[argptr], "-asm" ) )
-  {
-    asmoutput = 1;
-    argptr++;
-  }
-
-  /* input file */
-  if ( !strcmp( argv[argptr], "-" ) )
-    in_fd = 0;			/* stdin */
-  else
-    if ((in_fd = open( argv[argptr] , 0)) < 0)
-      exit(-1);
-  argptr++;
-
-  /* output file */
-  if ( !strcmp( argv[argptr], "-" ) )
-    out_fd = 1;			/* stdout */
-  else
-    if ((out_fd = creat( argv[argptr] , 0755)) < 0)
-      exit(-1);
-  argptr++;
-
-  /* skip elf header in input file */
-  /*if ( !prep )*/
-  lseek(in_fd, elfhdr_size, SEEK_SET);
-
-  /* write prep partition if necessary */
-  if ( prep )
-	  write_prep_partition( in_fd, out_fd );
-
-  /* write input image to bootimage */
-  if ( asmoutput )
-	  write_asm_data( in_fd, out_fd );
-  else
-	  copy_image(in_fd, out_fd);
-
-  return 0;
+	FILE *in, *out;
+	int argptr = 1;
+	int prep = 0;
+	int asmoutput = 0;
+
+	if (argc < 3 || argc > 4) {
+		fprintf(stderr, "usage: %s [-pbp] [-asm] <boot-file> <image>\n",
+			argv[0]);
+		exit(-1);
+	}
+
+/* needs to handle args more elegantly -- but this is a small/simple program */
+
+	/* check for -pbp */
+	if (!strcmp(argv[argptr], "-pbp")) {
+		prep = 1;
+		argptr++;
+	}
+
+	/* check for -asm */
+	if (!strcmp(argv[argptr], "-asm")) {
+		asmoutput = 1;
+		argptr++;
+	}
+
+	/* input file */
+	if (!strcmp(argv[argptr], "-"))
+		in = stdin;
+	else if (!(in = fopen(argv[argptr], "r")))
+		exit(-1);
+	argptr++;
+
+	/* output file */
+	if (!strcmp(argv[argptr], "-"))
+		out = stdout;
+	else if (!(out = fopen(argv[argptr], "w")))
+		exit(-1);
+	argptr++;
+
+	/* skip elf header in input file */
+	/*if ( !prep )*/
+	fseek(in, elfhdr_size, SEEK_SET);
+
+	/* write prep partition if necessary */
+	if (prep)
+		write_prep_partition(in, out);
+
+	/* write input image to bootimage */
+	if (asmoutput)
+		write_asm_data(in, out);
+	else
+		copy_image(in, out);
+
+	return 0;
 }
 
-void write_prep_partition(int in, int out)
+void store_le32(unsigned int v, unsigned char *p)
 {
-  unsigned char block[512];
-  partition_entry_t pe;
-  dword_t *entry  = (dword_t *)&block[0];
-  dword_t *length = (dword_t *)&block[sizeof(long)];
-  struct stat info;
-
-  if (fstat(in, &info) < 0)
-  {
-    fprintf(stderr,"info failed\n");
-    exit(-1);
-  }
-
-  bzero( block, sizeof block );
-
-  /* set entry point and boot image size skipping over elf header */
-#ifdef __i386__
-  *entry = 0x400/*+65536*/;
-  *length = info.st_size-elfhdr_size+0x400;
-#else
-  *entry = cpu_to_le32(0x400/*+65536*/);
-  *length = cpu_to_le32(info.st_size-elfhdr_size+0x400);
-#endif /* __i386__ */
-
-  /* sets magic number for msdos partition (used by linux) */
-  block[510] = 0x55;
-  block[511] = 0xAA;
-
-  /*
-   * Build a "PReP" partition table entry in the boot record
-   *  - "PReP" may only look at the system_indicator
-   */
-  pe.boot_indicator   = BootActive;
-  pe.system_indicator = SystemPrep;
-  /*
-   * The first block of the diskette is used by this "boot record" which
-   * actually contains the partition table. (The first block of the
-   * partition contains the boot image, but I digress...)  We'll set up
-   * one partition on the diskette and it shall contain the rest of the
-   * diskette.
-   */
-  pe.starting_head     = 0;	/* zero-based			     */
-  pe.starting_sector   = 2;	/* one-based			     */
-  pe.starting_cylinder = 0;	/* zero-based			     */
-  pe.ending_head       = 1;	/* assumes two heads		     */
-  pe.ending_sector     = 18;	/* assumes 18 sectors/track	     */
-  pe.ending_cylinder   = 79;	/* assumes 80 cylinders/diskette     */
-
-  /*
-   * The "PReP" software ignores the above fields and just looks at
-   * the next two.
-   *   - size of the diskette is (assumed to be)
-   *     (2 tracks/cylinder)(18 sectors/tracks)(80 cylinders/diskette)
-   *   - unlike the above sector numbers, the beginning sector is zero-based!
-   */
+	p[0] = v;
+	p[1] = v >>= 8;
+	p[2] = v >>= 8;
+	p[3] = v >> 8;
+}
+
+void write_prep_partition(FILE *in, FILE *out)
+{
+	unsigned char block[512];
+	partition_entry_t pe;
+	unsigned char *entry  = block;
+	unsigned char *length = block + 4;
+	long pos = ftell(in), size;
+
+	if (fseek(in, 0, SEEK_END) < 0) {
+		fprintf(stderr,"info failed\n");
+		exit(-1);
+	}
+	size = ftell(in);
+	if (fseek(in, pos, SEEK_SET) < 0) {
+		fprintf(stderr,"info failed\n");
+		exit(-1);
+	}
+
+	memset(block, '\0', sizeof(block));
+
+	/* set entry point and boot image size skipping over elf header */
+	store_le32(0x400/*+65536*/, entry);
+	store_le32(size-elfhdr_size+0x400, length);
+
+	/* sets magic number for msdos partition (used by linux) */
+	block[510] = 0x55;
+	block[511] = 0xAA;
+
+	/*
+	* Build a "PReP" partition table entry in the boot record
+	*  - "PReP" may only look at the system_indicator
+	*/
+	pe.boot_indicator   = BootActive;
+	pe.system_indicator = SystemPrep;
+	/*
+	* The first block of the diskette is used by this "boot record" which
+	* actually contains the partition table. (The first block of the
+	* partition contains the boot image, but I digress...)  We'll set up
+	* one partition on the diskette and it shall contain the rest of the
+	* diskette.
+	*/
+	pe.starting_head     = 0;	/* zero-based			     */
+	pe.starting_sector   = 2;	/* one-based			     */
+	pe.starting_cylinder = 0;	/* zero-based			     */
+	pe.ending_head       = 1;	/* assumes two heads		     */
+	pe.ending_sector     = 18;	/* assumes 18 sectors/track	     */
+	pe.ending_cylinder   = 79;	/* assumes 80 cylinders/diskette     */
+
+	/*
+	* The "PReP" software ignores the above fields and just looks at
+	* the next two.
+	*   - size of the diskette is (assumed to be)
+	*     (2 tracks/cylinder)(18 sectors/tracks)(80 cylinders/diskette)
+	*   - unlike the above sector numbers, the beginning sector is zero-based!
+	*/
 #if 0
-  pe.beginning_sector  = cpu_to_le32(1);
-#else
-  /* This has to be 0 on the PowerStack? */
-#ifdef __i386__
-  pe.beginning_sector  = 0;
+	store_le32(1, pe.beginning_sector);
 #else
-  pe.beginning_sector  = cpu_to_le32(0);
-#endif /* __i386__ */
+	/* This has to be 0 on the PowerStack? */
+	store_le32(0, pe.beginning_sector);
 #endif
 
-#ifdef __i386__
-  pe.number_of_sectors = 2*18*80-1;
-#else
-  pe.number_of_sectors = cpu_to_le32(2*18*80-1);
-#endif /* __i386__ */
+	store_le32(2*18*80-1, pe.number_of_sectors);
 
-  memcpy(&block[0x1BE], &pe, sizeof(pe));
+	memcpy(&block[0x1BE], &pe, sizeof(pe));
 
-  write( out, block, sizeof(block) );
-  write( out, entry, sizeof(*entry) );
-  write( out, length, sizeof(*length) );
-  /* set file position to 2nd sector where image will be written */
-  lseek( out, 0x400, SEEK_SET );
+	fwrite(block, sizeof(block), 1, out);
+	fwrite(entry, 4, 1, out);
+	fwrite(length, 4, 1, out);
+	/* set file position to 2nd sector where image will be written */
+	fseek( out, 0x400, SEEK_SET );
 }
 
 
 
-void
-copy_image(int in, int out)
+void copy_image(FILE *in, FILE *out)
 {
-  char buf[SIZE];
-  int n;
+	char buf[SIZE];
+	int n;
 
-  while ( (n = read(in, buf, SIZE)) > 0 )
-    write(out, buf, n);
+	while ( (n = fread(buf, 1, SIZE, in)) > 0 )
+		fwrite(buf, 1, n, out);
 }
 
 
 void
-write_asm_data( int in, int out )
+write_asm_data(FILE *in, FILE *out)
 {
-  int i, cnt, pos, len;
-  unsigned int cksum, val;
-  unsigned char *lp;
-  unsigned char buf[SIZE];
-  unsigned char str[256];
-
-  write( out, "\t.data\n\t.globl input_data\ninput_data:\n",
-	 strlen( "\t.data\n\t.globl input_data\ninput_data:\n" ) );
-  pos = 0;
-  cksum = 0;
-  while ((len = read(in, buf, sizeof(buf))) > 0)
-  {
-    cnt = 0;
-    lp = (unsigned char *)buf;
-    len = (len + 3) & ~3;  /* Round up to longwords */
-    for (i = 0;  i < len;  i += 4)
-    {
-      if (cnt == 0)
-      {
-	write( out, "\t.long\t", strlen( "\t.long\t" ) );
-      }
-      sprintf( str, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]);
-      write( out, str, strlen(str) );
-      val = *(unsigned long *)lp;
-      cksum ^= val;
-      lp += 4;
-      if (++cnt == 4)
-      {
-	cnt = 0;
-	sprintf( str, " # %x \n", pos+i-12);
-	write( out, str, strlen(str) );
-      } else
-      {
-	write( out, ",", 1 );
-      }
-    }
-    if (cnt)
-    {
-      write( out, "0\n", 2 );
-    }
-    pos += len;
-  }
-  sprintf(str, "\t.globl input_len\ninput_len:\t.long\t0x%x\n", pos);
-  write( out, str, strlen(str) );
-
-  fprintf(stderr, "cksum = %x\n", cksum);
+	int i, cnt, pos = 0;
+	unsigned int cksum = 0, val;
+	unsigned char *lp;
+	unsigned char buf[SIZE];
+	size_t len;
+
+	fputs("\t.data\n\t.globl input_data\ninput_data:\n", out);
+	while ((len = fread(buf, 1, sizeof(buf), in)) > 0) {
+		cnt = 0;
+		lp = buf;
+		/* Round up to longwords */
+		while (len & 3)
+			buf[len++] = '\0';
+		for (i = 0;  i < len;  i += 4) {
+			if (cnt == 0)
+				fputs("\t.long\t", out);
+			fprintf(out, "0x%02X%02X%02X%02X",
+				lp[0], lp[1], lp[2], lp[3]);
+			val = *(unsigned long *)lp;
+			cksum ^= val;
+			lp += 4;
+			if (++cnt == 4) {
+				cnt = 0;
+				fprintf(out, " # %x \n", pos+i-12);
+			} else {
+				fputs(",", out);
+			}
+		}
+		if (cnt)
+			fputs("0\n", out);
+		pos += len;
+	}
+	fprintf(out, "\t.globl input_len\ninput_len:\t.long\t0x%x\n", pos);
+	fprintf(stderr, "cksum = %x\n", cksum);
 }
-- 
1.4.2.GIT

^ permalink raw reply related

* [PATCH] cell spufs iomem annotations
From: Al Viro @ 2006-09-23  0:37 UTC (permalink / raw)
  To: linuxppc-dev


Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/powerpc/platforms/cell/spu_base.c     |    4 ++--
 arch/powerpc/platforms/cell/spufs/hw_ops.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index d06042d..20f74e7 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -538,7 +538,7 @@ static void __iomem * __init map_spe_pro
 
 	void *p;
 	int proplen;
-	void* ret = NULL;
+	void __iomem *ret = NULL;
 	int err = 0;
 
 	p = get_property(n, name, &proplen);
@@ -562,7 +562,7 @@ static void spu_unmap(struct spu *spu)
 	iounmap(spu->priv2);
 	iounmap(spu->priv1);
 	iounmap(spu->problem);
-	iounmap((u8 __iomem *)spu->local_store);
+	iounmap((__force u8 __iomem *)spu->local_store);
 }
 
 /* This function shall be abstracted for HV platforms */
diff --git a/arch/powerpc/platforms/cell/spufs/hw_ops.c b/arch/powerpc/platforms/cell/spufs/hw_ops.c
index c8670f5..efc452e 100644
--- a/arch/powerpc/platforms/cell/spufs/hw_ops.c
+++ b/arch/powerpc/platforms/cell/spufs/hw_ops.c
@@ -234,7 +234,7 @@ static void spu_hw_runcntl_stop(struct s
 
 static int spu_hw_set_mfc_query(struct spu_context * ctx, u32 mask, u32 mode)
 {
-	struct spu_problem *prob = ctx->spu->problem;
+	struct spu_problem __iomem *prob = ctx->spu->problem;
 	int ret;
 
 	spin_lock_irq(&ctx->spu->register_lock);
@@ -263,7 +263,7 @@ static int spu_hw_send_mfc_command(struc
 					struct mfc_dma_command *cmd)
 {
 	u32 status;
-	struct spu_problem *prob = ctx->spu->problem;
+	struct spu_problem __iomem *prob = ctx->spu->problem;
 
 	spin_lock_irq(&ctx->spu->register_lock);
 	out_be32(&prob->mfc_lsa_W, cmd->lsa);
-- 
1.4.2.GIT

^ permalink raw reply related

* [PATCH] powerpc oprofile __user annotations
From: Al Viro @ 2006-09-23  0:37 UTC (permalink / raw)
  To: linuxppc-dev


Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/powerpc/oprofile/backtrace.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/oprofile/backtrace.c b/arch/powerpc/oprofile/backtrace.c
index 75f57bc..b4278cf 100644
--- a/arch/powerpc/oprofile/backtrace.c
+++ b/arch/powerpc/oprofile/backtrace.c
@@ -11,6 +11,7 @@ #include <linux/oprofile.h>
 #include <linux/sched.h>
 #include <asm/processor.h>
 #include <asm/uaccess.h>
+#include <asm/compat.h>
 
 #define STACK_SP(STACK)		*(STACK)
 
@@ -26,8 +27,9 @@ #endif
 static unsigned int user_getsp32(unsigned int sp, int is_first)
 {
 	unsigned int stack_frame[2];
+	void __user *p = compat_ptr(sp);
 
-	if (!access_ok(VERIFY_READ, sp, sizeof(stack_frame)))
+	if (!access_ok(VERIFY_READ, p, sizeof(stack_frame)))
 		return 0;
 
 	/*
@@ -35,8 +37,7 @@ static unsigned int user_getsp32(unsigne
 	 * which means that we've done all that we can do from
 	 * interrupt context.
 	 */
-	if (__copy_from_user_inatomic(stack_frame, (void *)(long)sp,
-					sizeof(stack_frame)))
+	if (__copy_from_user_inatomic(stack_frame, p, sizeof(stack_frame)))
 		return 0;
 
 	if (!is_first)
@@ -54,10 +55,10 @@ static unsigned long user_getsp64(unsign
 {
 	unsigned long stack_frame[3];
 
-	if (!access_ok(VERIFY_READ, sp, sizeof(stack_frame)))
+	if (!access_ok(VERIFY_READ, (void __user *)sp, sizeof(stack_frame)))
 		return 0;
 
-	if (__copy_from_user_inatomic(stack_frame, (void *)sp,
+	if (__copy_from_user_inatomic(stack_frame, (void __user *)sp,
 					sizeof(stack_frame)))
 		return 0;
 
-- 
1.4.2.GIT

^ permalink raw reply related

* [PATCH] UPIO_TSI cleanup
From: Al Viro @ 2006-09-23  0:39 UTC (permalink / raw)
  To: linuxppc-dev


(le32_to_cpu(x) >> 8) & 0xff is a very odd way to spell (x >> 16) & 0xff,
even if that code is hit only on ppc.  The value is host-endian - we've
got it from readl(), after all...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 drivers/serial/8250.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 0ae9ced..10c2daa 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -320,8 +320,8 @@ #endif
 
 	case UPIO_TSI:
 		if (offset == UART_IIR) {
-			tmp = readl((u32 *)(up->port.membase + UART_RX));
-			return (cpu_to_le32(tmp) >> 8) & 0xff;
+			tmp = readl(up->port.membase + (UART_IIR & ~3));
+			return (tmp >> 16) & 0xff; /* UART_IIR % 4 == 2 */
 		} else
 			return readb(up->port.membase + offset);
 
-- 
1.4.2.GIT

^ permalink raw reply related

* Re: [PATCH]: PCI Error Recovery: Symbios SCSI device driver
From: Randy.Dunlap @ 2006-09-23  0:57 UTC (permalink / raw)
  To: Linas Vepstas; +Cc: linuxppc-dev, linux-pci, Luca, linux-kernel, linux-scsi
In-Reply-To: <20060922235017.GD14213@austin.ibm.com>

On Fri, 22 Sep 2006 18:50:17 -0500 Linas Vepstas wrote:

> On Fri, Sep 22, 2006 at 04:39:29PM -0700, Randy.Dunlap wrote:
> > On Fri, 22 Sep 2006 18:32:35 -0500 Linas Vepstas wrote:
> > 
> > > On Sat, Sep 23, 2006 at 12:06:29AM +0200, Luca wrote:
> > > > 
> > > > Space after function name? You put in other places too, it's not
> > > > consistent with the rest of the patch.
> > > 
> > > Oops. I was also coding on a different project recently, with a
> > > different style.  I'll send a revised patch in a moment.
> > 
> > Please change if()'s to use
> > 
> > 	if (var == constant)
> > instead of
> > 	if (constant == var)
> 
> Yuck! Horrid coding style! No rational excuse for coding like that.
> Advice taken under protest; new patch shortly.

Just after my email, I saw this :)
http://marc.theaimsgroup.com/?l=linux-mm-commits&m=115896769322020&w=2

---
~Randy

^ permalink raw reply

* Re: [PATCH] Start arch/powerpc/boot code reorganization
From: Segher Boessenkool @ 2006-09-23  0:57 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Matt Porter, Paul Mackerras, linuxppc-dev
In-Reply-To: <45143B2B.7060501@ru.mvista.com>

>    Well, is there need for duplication of size if "reg" prop must  
> be present anyway?

No, not really.  But this way, "reg" can be absent, actually.


Segher

^ permalink raw reply

* Re: [PATCH 2.6.19-rc1] ehca firmware interface based on Anton Blanchard's new hvcall interface
From: Roland Dreier @ 2006-09-23  1:21 UTC (permalink / raw)
  To: Hoang-Nam Nguyen
  Cc: pmac, linux-kernel, openib-general, openfabrics-ewg, linuxppc-dev,
	Christoph.Raisch/Germany/IBM
In-Reply-To: <200609222200.12722.hnguyen@de.ibm.com>

Thanks, I rolled this up in the ehca patch in my tree.

Anyway both Paul and I merged with Linus today, so the hcall cleanup
and ehca are both upstream.  It would be great if you could do a quick
check to make sure that ehca works in Linus's current git tree.

Thanks,
  Roland

^ permalink raw reply

* Re: [PATCH] Start arch/powerpc/boot code reorganization
From: Segher Boessenkool @ 2006-09-23  0:54 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: Paul Mackerras, Matt Porter, linuxppc-dev
In-Reply-To: <20060922185923.GB25738@mag.az.mvista.com>

> Oh, okay.  I didn't realize there was an actual "64-bit" property.
> I thought you just meant "/cpus/#address-cells = <2>".
> I should've googled first.

No, cpus/"#address-cells" is required to be 1, as that's the number
of address cells required to identify a CPU itself.

> So, yes, that probably does give us the info we need.

> Here is where I think we are for getting the effective base addr
> of the regs for the console uart in the bootwrapper:
>
> 1) We add the "fw,address" property to the uart's dt node.  That
> property provides the effective base address of the uart's registers
> left over by the firmware.  The format is similar to that of the
> "reg" property in that it contains an "address size" tuple.

I completely lost you here, sorry.  Maybe it's me.  Care to
repeat this in a (perhaps more verbose) way that I might
understand?

> 2) The effective address width (32 or 64 bits) (i.e., the # cells in
> the "address" portion of the tuple) is indicated by the presence of  
> the
> "/cpus/64-bit" property.  If it exists, the effective addr space is
> 64-bits wide (2 cells); if not, its 32-bits wide (1 cell).

Yes.  Except a "cell" is not what you think it is.  A "cell" is the
size of numbers OF deals with internally; just deal with it.  Of
course, there's things like "#address-cells", which really mean
"#-32bit-things-per-address".

> 3) The number of cells in the "size" portion of the tuple is indicated
> by the nearest #size-cells as you go up the tree.  Just like the "reg"
> property.

Yes, sounds fine.


Segher

^ permalink raw reply

* Re: bsp for Linux kernel 2.6
From: shenbagaraj @ 2006-09-23 17:15 UTC (permalink / raw)
  To: Yang, Steve; +Cc: linuxppc-embedded
In-Reply-To: <D9055C0A0A86BD4E89AD96A89EA767DB8D34CD@ALA-MAIL03.corp.ad.wrs.com>

Hi Steve,
Thank you for information,I need the older version of windriver which
support 2.6.11.11 kernel with some patch to build in open source
kernel.Where do i get those patch.

regards,
shenbagaraj.

----- Original Message ----- 
From: "Yang, Steve" <steve.yang@windriver.com>
To: "shenbagaraj" <shenbagaraj@esds.in>
Cc: <linuxppc-embedded@ozlabs.org>
Sent: Friday, September 22, 2006 5:57 AM
Subject: RE: bsp for Linux kernel 2.6


Shen,

Wind River Linux 1.3 has BSP support for this board. The kernel version
is 2.6.14.

Regards,
Steve Yang

-----Original Message-----
From: linuxppc-embedded-bounces+syang=windriver.com@ozlabs.org
[mailto:linuxppc-embedded-bounces+syang=windriver.com@ozlabs.org] On
Behalf Of shenbagaraj
Sent: Thursday, September 21, 2006 5:07 PM
To: linuxppc-embedded@ozlabs.org
Subject: bsp for Linux kernel 2.6

Hi,
I ma working on Windriver powerquicc board 8260.where do i get the
required patches for linux 2.6.11.11.
regards,
shen

_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

^ permalink raw reply

* Re: [PATCH] Start arch/powerpc/boot code reorganization
From: Mark A. Greer @ 2006-09-23  8:18 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Paul Mackerras, Matt Porter, linuxppc-dev
In-Reply-To: <74E4B2E4-B59C-4998-B9FC-A77245C6AF6B@kernel.crashing.org>

On Sat, Sep 23, 2006 at 02:54:12AM +0200, Segher Boessenkool wrote:
> >Here is where I think we are for getting the effective base addr
> >of the regs for the console uart in the bootwrapper:
> >
> >1) We add the "fw,address" property to the uart's dt node.  That
> >property provides the effective base address of the uart's registers
> >left over by the firmware.  The format is similar to that of the
> >"reg" property in that it contains an "address size" tuple.
> 
> I completely lost you here, sorry.  Maybe it's me.  Care to
> repeat this in a (perhaps more verbose) way that I might
> understand?

Well, I'm still new to the dt stuff and probably use the wrong
terminology all the time.  I tried to use the same type of description
that is used in ./Documentation/powerpc/booting-without-of.txt.

For example:

	'"reg" properties are always a tuple of the type "address size"
	where the number of cells of address and size is specified by
	the bus #address-cells and #size-cells.'

All I'm try to say is that "fw,address" is just like the "reg" property
except that it holds the effective addr not the physical addr and the
size of the address is determined by the existence of "/cpus/64-bit"
not #address-cells.  That's all.

> >2) The effective address width (32 or 64 bits) (i.e., the # cells in
> >the "address" portion of the tuple) is indicated by the presence of  
> >the
> >"/cpus/64-bit" property.  If it exists, the effective addr space is
> >64-bits wide (2 cells); if not, its 32-bits wide (1 cell).
> 
> Yes.  Except a "cell" is not what you think it is.  A "cell" is the
> size of numbers OF deals with internally; just deal with it.  Of
> course, there's things like "#address-cells", which really mean
> "#-32bit-things-per-address".

Okay, well, when I talked about cells I meant "#-32bit-things-per-address".
Obviously it was silly of me to think that "#address-cells" meant the # of
address cells...

Mark

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox