* dtc: Remove space from flex command line
From: David Gibson @ 2007-12-06 2:07 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
Author: Geoff Levand <geoffrey.levand@am.sony.com>
Apparently some versions of flex don't correctly parse the -o
parameter, if there's a space between the -o and its argument. So,
this patch removes it.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/Makefile
===================================================================
--- dtc.orig/Makefile 2007-12-06 13:03:41.000000000 +1100
+++ dtc/Makefile 2007-12-06 13:03:45.000000000 +1100
@@ -206,7 +206,7 @@
%.lex.c: %.l
@$(VECHO) LEX $@
- $(LEX) -o $@ $<
+ $(LEX) -o$@ $<
%.tab.c %.tab.h %.output: %.y
@$(VECHO) BISON $@
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* [PATCH 1/2] [POWERPC] iommu_free_table doesn't need the device_node
From: Stephen Rothwell @ 2007-12-06 2:39 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
It only needs the iommu_table address. It also makes use of the node
name to print error messages. So just pass it the things it needs.
This reduces the places that know about the pci_dn by one.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/iommu.c | 8 +++-----
arch/powerpc/platforms/pseries/iommu.c | 2 +-
include/asm-powerpc/iommu.h | 3 +--
3 files changed, 5 insertions(+), 8 deletions(-)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 2d0c9ef..47c3fe5 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -526,16 +526,14 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
return tbl;
}
-void iommu_free_table(struct device_node *dn)
+void iommu_free_table(struct iommu_table *tbl, const char *node_name)
{
- struct pci_dn *pdn = dn->data;
- struct iommu_table *tbl = pdn->iommu_table;
unsigned long bitmap_sz, i;
unsigned int order;
if (!tbl || !tbl->it_map) {
printk(KERN_ERR "%s: expected TCE map for %s\n", __FUNCTION__,
- dn->full_name);
+ node_name);
return;
}
@@ -544,7 +542,7 @@ void iommu_free_table(struct device_node *dn)
for (i = 0; i < (tbl->it_size/64); i++) {
if (tbl->it_map[i] != 0) {
printk(KERN_WARNING "%s: Unexpected TCEs for %s\n",
- __FUNCTION__, dn->full_name);
+ __FUNCTION__, node_name);
break;
}
}
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index be17d23..d4e9d85 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -556,7 +556,7 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti
case PSERIES_RECONFIG_REMOVE:
if (pci && pci->iommu_table &&
of_get_property(np, "ibm,dma-window", NULL))
- iommu_free_table(np);
+ iommu_free_table(pci->iommu_table, np->full_name);
break;
default:
err = NOTIFY_DONE;
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index 4a82fdc..7a3cef7 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -69,10 +69,9 @@ struct iommu_table {
};
struct scatterlist;
-struct device_node;
/* Frees table for an individual device node */
-extern void iommu_free_table(struct device_node *dn);
+extern void iommu_free_table(struct iommu_table *tbl, const char *node_name);
/* Initializes an iommu_table based in values set in the passed-in
* structure
--
1.5.3.7
^ permalink raw reply related
* [PATCH 2/2] [POWERPC] pSeries: remove dependency on pci_dn bussubno
From: Stephen Rothwell @ 2007-12-06 2:40 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
In-Reply-To: <20071206133919.9c609f17.sfr@canb.auug.org.au>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/platforms/pseries/iommu.c | 24 +++++++-----------------
1 files changed, 7 insertions(+), 17 deletions(-)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index d4e9d85..ebb9313 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -296,11 +296,12 @@ static void iommu_table_setparms(struct pci_controller *phb,
static void iommu_table_setparms_lpar(struct pci_controller *phb,
struct device_node *dn,
struct iommu_table *tbl,
- const void *dma_window)
+ const void *dma_window,
+ int bussubno)
{
unsigned long offset, size;
- tbl->it_busno = PCI_DN(dn)->bussubno;
+ tbl->it_busno = bussubno;
of_parse_dma_window(dn, dma_window, &tbl->it_index, &offset, &size);
tbl->it_base = 0;
@@ -420,17 +421,10 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)
pdn->full_name, ppci->iommu_table);
if (!ppci->iommu_table) {
- /* Bussubno hasn't been copied yet.
- * Do it now because iommu_table_setparms_lpar needs it.
- */
-
- ppci->bussubno = bus->number;
-
tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
ppci->phb->node);
-
- iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window);
-
+ iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window,
+ bus->number);
ppci->iommu_table = iommu_init_table(tbl, ppci->phb->node);
DBG(" created table: %p\n", ppci->iommu_table);
}
@@ -523,14 +517,10 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
pci = PCI_DN(pdn);
if (!pci->iommu_table) {
- /* iommu_table_setparms_lpar needs bussubno. */
- pci->bussubno = pci->phb->bus->number;
-
tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
pci->phb->node);
-
- iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window);
-
+ iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window,
+ pci->phb->bus->number);
pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
DBG(" created table: %p\n", pci->iommu_table);
} else {
--
1.5.3.7
^ permalink raw reply related
* Re: [PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources
From: Benjamin Herrenschmidt @ 2007-12-06 3:22 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linuxppc-dev, linux-pci, linux-kernel
In-Reply-To: <20071205064116.D849BDE10A@ozlabs.org>
On Wed, 2007-12-05 at 17:40 +1100, Benjamin Herrenschmidt wrote:
> The current pci_assign_unassigned_resources() code doesn't work properly
> on 32 bits platforms with 64 bits resources. The main reason is the use
> of unsigned long in various places instead of resource_size_t.
>
> This fixes it, along with some tricks to avoid casting to 64 bits on
> platforms that don't need it in every printk around.
>
> This is a pre-requisite for making powerpc use the generic code instead of
> its own half-useful implementation.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> This version fixes some stupid warnings when using 32 bits resources
... and has warnings on 64 bits platforms... GRRRR
This whole issue of printk vs. resource_size_t is a terrible mess :-(
Part of the problem is that resource_size_t can be either u32 or u64..
that is it can be either unsigned int, unsigned long or unsigned long
long... and we have no way to reliably printk that.
Any clever idea before I start pushing filthy macros up linux/types.h ?
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH] Use SLB size from the device tree
From: Paul Mackerras @ 2007-12-06 3:32 UTC (permalink / raw)
To: Michael Neuling; +Cc: Olof Johansson, linuxppc-dev, Will Schmidt
In-Reply-To: <510.1194565218@neuling.org>
Michael Neuling writes:
> Currently we hardwire the number of SLBs but the PAPR says we export an
> ibm,slb-size property to specify the number of SLB entries. This patch
> uses this property instead of assuming 64 always. If no property is
> found, we assume 64 entries as before.
On 32-bit platforms (e.g. powermac) I get:
/home/paulus/kernel/powerpc/arch/powerpc/kernel/prom.c: In function 'check_cpu_slb_size':
/home/paulus/kernel/powerpc/arch/powerpc/kernel/prom.c:592: error: 'mmu_slb_size' undeclared (first use in this function)
/home/paulus/kernel/powerpc/arch/powerpc/kernel/prom.c:592: error: (Each undeclared identifier is reported only once
/home/paulus/kernel/powerpc/arch/powerpc/kernel/prom.c:592: error: for each function it appears in.)
make[2]: *** [arch/powerpc/kernel/prom.o] Error 1
Paul.
^ permalink raw reply
* Re: drivers/net/iseries_veth.c dubious sysfs usage
From: Michael Ellerman @ 2007-12-06 3:48 UTC (permalink / raw)
To: Greg KH; +Cc: linuxppc-dev, Kyle A. Lucke, paulus, linux-kernel, David Gibson
In-Reply-To: <20071205214103.GA7074@kroah.com>
[-- Attachment #1: Type: text/plain, Size: 4596 bytes --]
On Wed, 2007-12-05 at 13:41 -0800, Greg KH wrote:
> On Wed, Dec 05, 2007 at 10:10:31PM +1100, Michael Ellerman wrote:
> > On Wed, 2007-12-05 at 01:30 -0800, Greg KH wrote:
> > > In doing a massive kobject cleanup of the kernel tree, I ran across the
> > > iseries_veth.c driver.
> > >
> > > It looks like the driver is creating a number of subdirectories under
> > > the driver sysfs directory. This is odd and probably wrong. You want
> > > these virtual connections to show up in the main sysfs device tree, not
> > > under the driver directory.
> > >
> > > I'll be glad to totally guess and try to move it around in the sysfs
> > > tree, but odds are I'll get it all wrong as I can't really test this
> > > out :)
> > >
> > > Any hints on what this driver is trying to do in this sysfs directories?
> >
> > I wrote the code, I think, but it's been a while - I'll have a look at
> > it tomorrow.
>
> Yes, can you send me the sysfs tree output of the driver directory, and
> what exactly the different files in there are supposed to be used for?
Sure. My version of tar (1.15.1) doesn't seem to be able to tar up /sys,
so hopefully this is sufficient:
igoeast:~# cd /sys/class/net/eth1/
igoeast:/sys/class/net/eth1# ls -la
total 0
drwxr-xr-x 4 root root 0 Dec 6 10:22 .
drwxr-xr-x 6 root root 0 Dec 6 10:21 ..
-r--r--r-- 1 root root 4096 Dec 6 10:30 addr_len
-r--r--r-- 1 root root 4096 Dec 6 10:30 address
-r--r--r-- 1 root root 4096 Dec 6 10:30 broadcast
-r--r--r-- 1 root root 4096 Dec 6 10:30 carrier
lrwxrwxrwx 1 root root 0 Dec 6 10:22 device -> ../../../devices/vio/3
-r--r--r-- 1 root root 4096 Dec 6 10:30 dormant
-r--r--r-- 1 root root 4096 Dec 6 10:30 features
-rw-r--r-- 1 root root 4096 Dec 6 10:30 flags
-r--r--r-- 1 root root 4096 Dec 6 10:30 ifindex
-r--r--r-- 1 root root 4096 Dec 6 10:30 iflink
-r--r--r-- 1 root root 4096 Dec 6 10:30 link_mode
-rw-r--r-- 1 root root 4096 Dec 6 10:30 mtu
-r--r--r-- 1 root root 4096 Dec 6 10:30 operstate
drwxr-xr-x 2 root root 0 Dec 6 10:30 statistics
lrwxrwxrwx 1 root root 0 Dec 6 10:30 subsystem -> ../../../class/net
-rw-r--r-- 1 root root 4096 Dec 6 10:30 tx_queue_len
-r--r--r-- 1 root root 4096 Dec 6 10:30 type
-rw-r--r-- 1 root root 4096 Dec 6 10:30 uevent
drwxr-xr-x 2 root root 0 Dec 6 10:30 veth_port
Each net device has a port structure associated with it, the fields
should be fairly self explanatory, they're all read only I think.
igoeast:/sys/class/net/eth1# find veth_port/
veth_port/
veth_port/mac_addr
veth_port/lpar_map
veth_port/stopped_map
veth_port/promiscuous
veth_port/num_mcast
igoeast:/sys/class/net/eth1# cd device/driver
igoeast:/sys/class/net/eth1/device/driver# ls -l
total 0
lrwxrwxrwx 1 root root 0 Dec 6 10:21 2 -> ../../../../devices/vio/2
lrwxrwxrwx 1 root root 0 Dec 6 10:21 3 -> ../../../../devices/vio/3
--w------- 1 root root 4096 Dec 6 10:21 bind
drwxr-xr-x 2 root root 0 Dec 6 10:21 cnx00
drwxr-xr-x 2 root root 0 Dec 6 10:21 cnx02
drwxr-xr-x 2 root root 0 Dec 6 10:21 cnx03
drwxr-xr-x 2 root root 0 Dec 6 10:21 cnx04
lrwxrwxrwx 1 root root 0 Dec 6 10:21 module -> ../../../../module/iseries_veth
--w------- 1 root root 4096 Dec 6 10:21 uevent
--w------- 1 root root 4096 Dec 6 10:21 unbind
The driver has a connection to all the other lpars, this is entirely
independent of the net devices.
igoeast:/sys/class/net/eth1/device/driver# find cnx00/
cnx00/
cnx00/outstanding_tx
cnx00/remote_lp
cnx00/num_events
cnx00/reset_timeout
cnx00/last_contact
cnx00/state
cnx00/src_inst
cnx00/dst_inst
cnx00/num_pending_acks
cnx00/num_ack_events
cnx00/ack_timeout
> > Why is it "odd and probably wrong" to create subdirectories under the
> > driver in sysfs?
>
> Because a driver does not have "devices" under it in the sysfs tree.
> All devices liven in the /sys/devices/ tree so we can properly manage
> them that way. A driver will then bind to a device, and the driver core
> will set up the linkages in sysfs properly so that everthing looks
> uniform.
OK. They're not "devices" that we create under the driver, they're just
attributes of the driver, and they happen to be in groups so I put them
in subdirectories.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: Link up/down messages from 5200 ethernet driver
From: Grant Likely @ 2007-12-06 4:46 UTC (permalink / raw)
To: Jon Smirl; +Cc: PowerPC dev list, Domen Puncer
In-Reply-To: <9e4733910712051755l76c0403bo4a60834928a35c2@mail.gmail.com>
T24gMTIvNS8wNywgSm9uIFNtaXJsIDxqb25zbWlybEBnbWFpbC5jb20+IHdyb3RlOgo+IFdoeSBk
b2VzIHRoZSBmZWM1MjAwIGRyaXZlciBzb21ldGltZXMgbm90IHByaW50ICdQSFknIGNvcnJlY3Rs
eT8KPgo+IHBoeUNPUkUtTVBDNTIwMEItdGlueSBsb2dpbjogVNikVu+/vSBmMDAwMzAwMDoxMCAt
IExpbmsgaXMgRG93bgo+IFTvv71ZOiBmMDAwMzAwMDoxMCAtIExpbmsgaXMgVXAgLSAxMDAvRnVs
bAo+IFTvv71ZOiBmMDAwMzAwMDoxMCAtIExpbmsgaXMgRG93bgo+IFBIWTogZjAwMDMwMDA6MTAg
LSBMaW5rIGlzIFVwIC0gMTAwL0Z1bGwKCldlaXJkOyB0aGF0IGxpbmUgY29tZXMgZnJvbSBkcml2
ZXJzL25ldC9waHkvcGh5LmMgaW4KcGh5X3ByaW50X3N0YXR1cygpLCBhbmQgaXQncyBqdXN0IGEg
YSBwcl9pbmZvIHN0YXRlbWVudC4gIEkgc3VwcG9zZSBpdAptaWdodCBiZSBhIHN0YWNrIG92ZXJy
dW4sIGJ1dCBJJ2QgZXhwZWN0IG1vcmUgc2V2ZXJlIHN5bXB0b21zIGlmIHRoYXQKd2FzIHRoZSBj
YXNlLgoKVGhhdCAqbG9va3MqIGxpa2UgYSBzZXJpYWwgc3RyZWFtIGNvcnJ1cHRpb24uICBJcyB0
aGF0IHRoZSBvdXRwdXQgb2YKeW91ciBzZXJpYWwgcG9ydD8gIERvZXMgZG1lc2cgc2hvdyB0aGUg
c2FtZSBjb3JydXB0aW9uPwoKQ2hlZXJzLApnLgoKLS0gCkdyYW50IExpa2VseSwgQi5TYy4sIFAu
RW5nLgpTZWNyZXQgTGFiIFRlY2hub2xvZ2llcyBMdGQuCmdyYW50Lmxpa2VseUBzZWNyZXRsYWIu
Y2EKKDQwMykgMzk5LTAxOTUK
^ permalink raw reply
* Re: Link up/down messages from 5200 ethernet driver
From: Jon Smirl @ 2007-12-06 5:40 UTC (permalink / raw)
To: Grant Likely; +Cc: PowerPC dev list, Domen Puncer
In-Reply-To: <fa686aa40712052046s5887c9fewa61c2921a22f5c80@mail.gmail.com>
T24gMTIvNS8wNywgR3JhbnQgTGlrZWx5IDxncmFudC5saWtlbHlAc2VjcmV0bGFiLmNhPiB3cm90
ZToKPiBPbiAxMi81LzA3LCBKb24gU21pcmwgPGpvbnNtaXJsQGdtYWlsLmNvbT4gd3JvdGU6Cj4g
PiBXaHkgZG9lcyB0aGUgZmVjNTIwMCBkcml2ZXIgc29tZXRpbWVzIG5vdCBwcmludCAnUEhZJyBj
b3JyZWN0bHk/Cj4gPgo+ID4gcGh5Q09SRS1NUEM1MjAwQi10aW55IGxvZ2luOiBU2KRW77+9IGYw
MDAzMDAwOjEwIC0gTGluayBpcyBEb3duCj4gPiBU77+9WTogZjAwMDMwMDA6MTAgLSBMaW5rIGlz
IFVwIC0gMTAwL0Z1bGwKPiA+IFTvv71ZOiBmMDAwMzAwMDoxMCAtIExpbmsgaXMgRG93bgo+ID4g
UEhZOiBmMDAwMzAwMDoxMCAtIExpbmsgaXMgVXAgLSAxMDAvRnVsbAo+Cj4gV2VpcmQ7IHRoYXQg
bGluZSBjb21lcyBmcm9tIGRyaXZlcnMvbmV0L3BoeS9waHkuYyBpbgo+IHBoeV9wcmludF9zdGF0
dXMoKSwgYW5kIGl0J3MganVzdCBhIGEgcHJfaW5mbyBzdGF0ZW1lbnQuICBJIHN1cHBvc2UgaXQK
PiBtaWdodCBiZSBhIHN0YWNrIG92ZXJydW4sIGJ1dCBJJ2QgZXhwZWN0IG1vcmUgc2V2ZXJlIHN5
bXB0b21zIGlmIHRoYXQKPiB3YXMgdGhlIGNhc2UuCj4KPiBUaGF0ICpsb29rcyogbGlrZSBhIHNl
cmlhbCBzdHJlYW0gY29ycnVwdGlvbi4gIElzIHRoYXQgdGhlIG91dHB1dCBvZgo+IHlvdXIgc2Vy
aWFsIHBvcnQ/ICBEb2VzIGRtZXNnIHNob3cgdGhlIHNhbWUgY29ycnVwdGlvbj8KClRoYXQncyB0
aGUgc2VyaWFsIHBvcnQgb3V0cHV0LgpkbWVzZyBpcyBvay4KCk5vdGhpbmcgZWxzZSBJIGRvIGNh
biBtZXNzIHVwIHRoZSBzZXJpYWwgcG9ydC4KCj4KPiBDaGVlcnMsCj4gZy4KPgo+IC0tCj4gR3Jh
bnQgTGlrZWx5LCBCLlNjLiwgUC5FbmcuCj4gU2VjcmV0IExhYiBUZWNobm9sb2dpZXMgTHRkLgo+
IGdyYW50Lmxpa2VseUBzZWNyZXRsYWIuY2EKPiAoNDAzKSAzOTktMDE5NQo+CgoKLS0gCkpvbiBT
bWlybApqb25zbWlybEBnbWFpbC5jb20K
^ permalink raw reply
* Re: Link up/down messages from 5200 ethernet driver
From: Jon Smirl @ 2007-12-06 5:43 UTC (permalink / raw)
To: Grant Likely; +Cc: PowerPC dev list, Domen Puncer
In-Reply-To: <9e4733910712052140j70f48f05qbbf9af082ba4747c@mail.gmail.com>
T24gMTIvNi8wNywgSm9uIFNtaXJsIDxqb25zbWlybEBnbWFpbC5jb20+IHdyb3RlOgo+IE9uIDEy
LzUvMDcsIEdyYW50IExpa2VseSA8Z3JhbnQubGlrZWx5QHNlY3JldGxhYi5jYT4gd3JvdGU6Cj4g
PiBPbiAxMi81LzA3LCBKb24gU21pcmwgPGpvbnNtaXJsQGdtYWlsLmNvbT4gd3JvdGU6Cj4gPiA+
IFdoeSBkb2VzIHRoZSBmZWM1MjAwIGRyaXZlciBzb21ldGltZXMgbm90IHByaW50ICdQSFknIGNv
cnJlY3RseT8KPiA+ID4KPiA+ID4gcGh5Q09SRS1NUEM1MjAwQi10aW55IGxvZ2luOiBU2KRW77+9
IGYwMDAzMDAwOjEwIC0gTGluayBpcyBEb3duCj4gPiA+IFTvv71ZOiBmMDAwMzAwMDoxMCAtIExp
bmsgaXMgVXAgLSAxMDAvRnVsbAo+ID4gPiBU77+9WTogZjAwMDMwMDA6MTAgLSBMaW5rIGlzIERv
d24KPiA+ID4gUEhZOiBmMDAwMzAwMDoxMCAtIExpbmsgaXMgVXAgLSAxMDAvRnVsbAo+ID4KPiA+
IFdlaXJkOyB0aGF0IGxpbmUgY29tZXMgZnJvbSBkcml2ZXJzL25ldC9waHkvcGh5LmMgaW4KPiA+
IHBoeV9wcmludF9zdGF0dXMoKSwgYW5kIGl0J3MganVzdCBhIGEgcHJfaW5mbyBzdGF0ZW1lbnQu
ICBJIHN1cHBvc2UgaXQKPiA+IG1pZ2h0IGJlIGEgc3RhY2sgb3ZlcnJ1biwgYnV0IEknZCBleHBl
Y3QgbW9yZSBzZXZlcmUgc3ltcHRvbXMgaWYgdGhhdAo+ID4gd2FzIHRoZSBjYXNlLgo+ID4KPiA+
IFRoYXQgKmxvb2tzKiBsaWtlIGEgc2VyaWFsIHN0cmVhbSBjb3JydXB0aW9uLiAgSXMgdGhhdCB0
aGUgb3V0cHV0IG9mCj4gPiB5b3VyIHNlcmlhbCBwb3J0PyAgRG9lcyBkbWVzZyBzaG93IHRoZSBz
YW1lIGNvcnJ1cHRpb24/Cj4KPiBUaGF0J3MgdGhlIHNlcmlhbCBwb3J0IG91dHB1dC4KPiBkbWVz
ZyBpcyBvay4KPgo+IE5vdGhpbmcgZWxzZSBJIGRvIGNhbiBtZXNzIHVwIHRoZSBzZXJpYWwgcG9y
dC4KCk1heWJlIHRoZSBLRVJOX0lORk8gcHJlZml4IGlzIHNlbmRpbmcgb3V0IGNvbnRyb2wgY2hh
cmFjdGVycyB0aGF0IG1lc3MKdXAgdGhlIHNlcmlhbCBvdXRwdXQ/Cgo+Cj4gPgo+ID4gQ2hlZXJz
LAo+ID4gZy4KPiA+Cj4gPiAtLQo+ID4gR3JhbnQgTGlrZWx5LCBCLlNjLiwgUC5FbmcuCj4gPiBT
ZWNyZXQgTGFiIFRlY2hub2xvZ2llcyBMdGQuCj4gPiBncmFudC5saWtlbHlAc2VjcmV0bGFiLmNh
Cj4gPiAoNDAzKSAzOTktMDE5NQo+ID4KPgo+Cj4gLS0KPiBKb24gU21pcmwKPiBqb25zbWlybEBn
bWFpbC5jb20KPgoKCi0tIApKb24gU21pcmwKam9uc21pcmxAZ21haWwuY29tCg==
^ permalink raw reply
* dtc: More detailed testing of tree checks
From: David Gibson @ 2007-12-06 5:56 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
This patch modifies the dtc-checkfails.sh testcase wrapper so that
instead of testing just that dtc fails with a particular error code on
the sample input, it scans dtc's stderr output looking for a message
that dtc failed a specific check or checks. This has several advantages:
- It means we more precisely check dtc's checking behaviour
- It means we can check for generation of warnings using the
same script
- It means we can test cases where dtc should generate
multiple errors or warnings from different checks
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/tests/dtc-checkfails.sh
===================================================================
--- dtc.orig/tests/dtc-checkfails.sh 2007-12-06 16:33:21.000000000 +1100
+++ dtc/tests/dtc-checkfails.sh 2007-12-06 16:48:28.000000000 +1100
@@ -2,21 +2,27 @@
. tests.sh
-TMPFILE="tmp.out.$$"
+for x; do
+ shift
+ if [ "$x" = "--" ]; then
+ break;
+ fi
+ CHECKS="$CHECKS $x"
+done
-rm -f $TMPFILE
+LOG="tmp.log.$$"
-verbose_run "$DTC" -o $TMPFILE "$@"
+rm -f $TMPFILE $LOG
+
+verbose_run_log "$LOG" "$DTC" -o /dev/null "$@"
ret="$?"
-if [ -f $TMPFILE ]; then
- FAIL "output file was created despite bad input"
-fi
-
-if [ "$ret" = "2" ]; then
- PASS
-else
- FAIL "dtc returned error code $ret instead of 2 (check failed)"
-fi
+for c in $CHECKS; do
+ if ! grep -E "^(ERROR)|(Warning) \($c\):" $LOG > /dev/null; then
+ FAIL "Failed to trigger check \"%c\""
+ fi
+done
+
+rm -f $LOG
-rm -f $TMPFILE
+PASS
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh 2007-12-06 16:33:21.000000000 +1100
+++ dtc/tests/run_tests.sh 2007-12-06 16:47:15.000000000 +1100
@@ -159,14 +159,14 @@
done
# Check some checks
- run_test dtc-checkfails.sh -I dts -O dtb dup-nodename.dts
- run_test dtc-checkfails.sh -I dts -O dtb dup-propname.dts
- run_test dtc-checkfails.sh -I dts -O dtb dup-phandle.dts
- run_test dtc-checkfails.sh -I dts -O dtb zero-phandle.dts
- run_test dtc-checkfails.sh -I dts -O dtb minusone-phandle.dts
- run_test dtc-checkfails.sh -I dts -O dtb nonexist-node-ref.dts
- run_test dtc-checkfails.sh -I dts -O dtb nonexist-label-ref.dts
- run_test dtc-checkfails.sh -I dts -O dtb bad-name-property.dts
+ run_test dtc-checkfails.sh duplicate_node_names -- -I dts -O dtb dup-nodename.dts
+ run_test dtc-checkfails.sh duplicate_property_names -- -I dts -O dtb dup-propname.dts
+ run_test dtc-checkfails.sh explicit_phandles -- -I dts -O dtb dup-phandle.dts
+ run_test dtc-checkfails.sh explicit_phandles -- -I dts -O dtb zero-phandle.dts
+ run_test dtc-checkfails.sh explicit_phandles -- -I dts -O dtb minusone-phandle.dts
+ run_test dtc-checkfails.sh phandle_references -- -I dts -O dtb nonexist-node-ref.dts
+ run_test dtc-checkfails.sh phandle_references -- -I dts -O dtb nonexist-label-ref.dts
+ run_test dtc-checkfails.sh name_properties -- -I dts -O dtb bad-name-property.dts
}
while getopts "vt:m" ARG ; do
Index: dtc/tests/tests.sh
===================================================================
--- dtc.orig/tests/tests.sh 2007-12-06 16:33:21.000000000 +1100
+++ dtc/tests/tests.sh 2007-12-06 16:35:12.000000000 +1100
@@ -19,3 +19,14 @@
"$@" > /dev/null 2> /dev/null
fi
}
+
+verbose_run_log () {
+ LOG="$1"
+ shift
+ "$@" &> "$LOG"
+ ret=$?
+ if [ -z "$QUIET_TEST" ]; then
+ cat "$LOG" >&2
+ fi
+ return $ret
+}
Index: dtc/tests/Makefile.tests
===================================================================
--- dtc.orig/tests/Makefile.tests 2007-12-06 16:48:35.000000000 +1100
+++ dtc/tests/Makefile.tests 2007-12-06 16:48:39.000000000 +1100
@@ -26,7 +26,7 @@
TESTS_DEPFILES = $(TESTS:%=%.d) \
$(addprefix $(TESTS_PREFIX),testutils.d trees.d dumptrees.d)
-TESTS_CLEANFILES_L = *.output vglog.* vgcore.* *.dtb *.test.dts
+TESTS_CLEANFILES_L = *.output vglog.* vgcore.* *.dtb *.test.dts tmp.*
TESTS_CLEANFILES = $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)
BIN += $(TESTS) $(TESTS_PREFIX)dumptrees
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* dtc: Migrate "one cell" checks to new framework
From: David Gibson @ 2007-12-06 5:59 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
This patch converts to the new tree checking framework those checks
which verify that certain properties (#address-cells and #size-cells)
are exactly one cell in size, when present.
We also drop the old-style check for "linux,phandle" being one cell,
since that is already implied in the the existing new-style checks on
the linux,phandle property.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/checks.c
===================================================================
--- dtc.orig/checks.c 2007-12-06 16:52:00.000000000 +1100
+++ dtc/checks.c 2007-12-06 16:57:02.000000000 +1100
@@ -190,6 +190,23 @@
#define CHECK_IS_STRING(nm, propname, lvl) \
CHECK(nm, NULL, check_is_string, NULL, (propname), (lvl))
+static void check_is_cell(struct check *c, struct node *root,
+ struct node *node)
+{
+ struct property *prop;
+ char *propname = c->data;
+
+ prop = get_property(node, propname);
+ if (!prop)
+ return; /* Not present, assumed ok */
+
+ if (prop->val.len != sizeof(cell_t))
+ FAIL(c, "\"%s\" property in %s is not a single cell",
+ propname, node->fullpath);
+}
+#define CHECK_IS_CELL(nm, propname, lvl) \
+ CHECK(nm, NULL, check_is_cell, NULL, (propname), (lvl))
+
/*
* Structural check functions
*/
@@ -327,11 +344,20 @@
CHECK(path_references, NULL, NULL, fixup_path_references, NULL, ERROR,
&duplicate_node_names);
+/*
+ * Semantic checks
+ */
+CHECK_IS_CELL(address_cells_is_cell, "#address-cells", WARN);
+CHECK_IS_CELL(size_cells_is_cell, "#size-cells", WARN);
+CHECK_IS_CELL(interrupt_cells_is_cell, "#interrupt-cells", WARN);
+
static struct check *check_table[] = {
&duplicate_node_names, &duplicate_property_names,
&name_is_string, &name_properties,
&explicit_phandles,
&phandle_references, &path_references,
+
+ &address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell,
};
int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys);
@@ -381,17 +407,6 @@
#define DO_ERR(...) do {ERRMSG(__VA_ARGS__); ok = 0; } while (0)
-static int must_be_one_cell(struct property *prop, struct node *node)
-{
- if (prop->val.len != sizeof(cell_t)) {
- ERRMSG("\"%s\" property in %s has the wrong length (should be 1 cell)\n",
- prop->name, node->fullpath);
- return 0;
- }
-
- return 1;
-}
-
static int must_be_cells(struct property *prop, struct node *node)
{
if ((prop->val.len % sizeof(cell_t)) != 0) {
@@ -418,9 +433,6 @@
char *propname;
int (*check_fn)(struct property *prop, struct node *node);
} prop_checker_table[] = {
- {"linux,phandle", must_be_one_cell},
- {"#address-cells", must_be_one_cell},
- {"#size-cells", must_be_one_cell},
{"reg", must_be_cells},
{"model", must_be_string},
{"device_type", must_be_string},
Index: dtc/tests/bad-ncells.dts
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/bad-ncells.dts 2007-12-06 16:57:02.000000000 +1100
@@ -0,0 +1,7 @@
+/dts-v1/;
+
+/ {
+ #address-cells = "badthing";
+ #size-cells = "badthing";
+ #interrupt-cells = "badthing";
+};
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh 2007-12-06 16:57:01.000000000 +1100
+++ dtc/tests/run_tests.sh 2007-12-06 16:57:02.000000000 +1100
@@ -167,6 +167,8 @@
run_test dtc-checkfails.sh phandle_references -- -I dts -O dtb nonexist-node-ref.dts
run_test dtc-checkfails.sh phandle_references -- -I dts -O dtb nonexist-label-ref.dts
run_test dtc-checkfails.sh name_properties -- -I dts -O dtb bad-name-property.dts
+
+ run_test dtc-checkfails.sh address_cells_is_cell size_cells_is_cell interrupt_cells_is_cell -- -I dts -O dtb bad-ncells.dts
}
while getopts "vt:m" ARG ; do
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* dtc: Migrate "string property" checks to new framework
From: David Gibson @ 2007-12-06 6:01 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
This patch converts to the new tree checking framework those checks
which verify that certain properties (device_type, model) have a
string value, when present.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/checks.c
===================================================================
--- dtc.orig/checks.c 2007-12-06 16:57:02.000000000 +1100
+++ dtc/checks.c 2007-12-06 16:59:54.000000000 +1100
@@ -351,6 +351,10 @@
CHECK_IS_CELL(size_cells_is_cell, "#size-cells", WARN);
CHECK_IS_CELL(interrupt_cells_is_cell, "#interrupt-cells", WARN);
+CHECK_IS_STRING(device_type_is_string, "device_type", WARN);
+CHECK_IS_STRING(model_is_string, "model", WARN);
+CHECK_IS_STRING(status_is_string, "status", WARN);
+
static struct check *check_table[] = {
&duplicate_node_names, &duplicate_property_names,
&name_is_string, &name_properties,
@@ -358,6 +362,7 @@
&phandle_references, &path_references,
&address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell,
+ &device_type_is_string, &model_is_string, &status_is_string,
};
int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys);
@@ -418,24 +423,11 @@
return 1;
}
-static int must_be_string(struct property *prop, struct node *node)
-{
- if (! data_is_one_string(prop->val)) {
- ERRMSG("\"%s\" property in %s is not a string\n",
- prop->name, node->fullpath);
- return 0;
- }
-
- return 1;
-}
-
static struct {
char *propname;
int (*check_fn)(struct property *prop, struct node *node);
} prop_checker_table[] = {
{"reg", must_be_cells},
- {"model", must_be_string},
- {"device_type", must_be_string},
};
static int check_properties(struct node *node)
Index: dtc/tests/bad-string-props.dts
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/bad-string-props.dts 2007-12-06 16:59:54.000000000 +1100
@@ -0,0 +1,7 @@
+/dts-v1/;
+
+/ {
+ device_type = <0xdeadbeef>;
+ model = <0xdeadbeef>;
+ status = <0xdeadbeef>;
+};
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh 2007-12-06 16:57:02.000000000 +1100
+++ dtc/tests/run_tests.sh 2007-12-06 16:59:54.000000000 +1100
@@ -169,6 +169,8 @@
run_test dtc-checkfails.sh name_properties -- -I dts -O dtb bad-name-property.dts
run_test dtc-checkfails.sh address_cells_is_cell size_cells_is_cell interrupt_cells_is_cell -- -I dts -O dtb bad-ncells.dts
+ run_test dtc-checkfails.sh device_type_is_string model_is_string status_is_string -- -I dts -O dtb bad-string-props.dts
+
}
while getopts "vt:m" ARG ; do
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* dtc: Remove obsolete check_properties() function
From: David Gibson @ 2007-12-06 6:04 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
After the last couple of patches converting various old-style semantic
checks to the new framework, the only thing that the old-style
check_properties() function still checks is that the size of "reg"
properties is a multiple of the cell size.
This patch removes check_properties() and all related code and data.
The check on the size of reg properties is folded into the existing
check for the format of "reg" properties (still old-style for the time
being).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/checks.c
===================================================================
--- dtc.orig/checks.c 2007-12-05 11:08:45.000000000 +1100
+++ dtc/checks.c 2007-12-05 11:08:48.000000000 +1100
@@ -412,46 +412,6 @@
#define DO_ERR(...) do {ERRMSG(__VA_ARGS__); ok = 0; } while (0)
-static int must_be_cells(struct property *prop, struct node *node)
-{
- if ((prop->val.len % sizeof(cell_t)) != 0) {
- ERRMSG("\"%s\" property in %s is not a multiple of cell size\n",
- prop->name, node->fullpath);
- return 0;
- }
-
- return 1;
-}
-
-static struct {
- char *propname;
- int (*check_fn)(struct property *prop, struct node *node);
-} prop_checker_table[] = {
- {"reg", must_be_cells},
-};
-
-static int check_properties(struct node *node)
-{
- struct property *prop;
- struct node *child;
- int i;
- int ok = 1;
-
- for_each_property(node, prop)
- for (i = 0; i < ARRAY_SIZE(prop_checker_table); i++)
- if (streq(prop->name, prop_checker_table[i].propname))
- if (! prop_checker_table[i].check_fn(prop, node)) {
- ok = 0;
- break;
- }
-
- for_each_child(node, child)
- if (! check_properties(child))
- ok = 0;
-
- return ok;
-}
-
#define CHECK_HAVE(node, propname) \
do { \
if (! (prop = get_property((node), (propname)))) \
@@ -672,10 +632,9 @@
prop = get_property(node, "reg");
if (prop) {
- int len = prop->val.len / 4;
-
- if ((len % (addr_cells+size_cells)) != 0)
- DO_ERR("\"reg\" property in %s has invalid length (%d) for given #address-cells (%d) and #size-cells (%d)\n",
+ int reg_entry_len = (addr_cells + size_cells) * sizeof(cell_t);
+ if ((prop->val.len % reg_entry_len) != 0)
+ DO_ERR("\"reg\" property in %s has invalid length (%d bytes) for given #address-cells (%d) and #size-cells (%d)\n",
node->fullpath, prop->val.len,
addr_cells, size_cells);
}
@@ -699,7 +658,6 @@
{
int ok = 1;
- ok = ok && check_properties(dt);
ok = ok && check_addr_size_reg(dt, -1, -1);
ok = ok && check_root(dt);
ok = ok && check_cpus(dt, outversion, boot_cpuid_phys);
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: Link up/down messages from 5200 ethernet driver
From: Grant Likely @ 2007-12-06 6:08 UTC (permalink / raw)
To: Jon Smirl; +Cc: PowerPC dev list, Domen Puncer
In-Reply-To: <9e4733910712052143l581207d4l163b7d1be8b27e1d@mail.gmail.com>
T24gMTIvNS8wNywgSm9uIFNtaXJsIDxqb25zbWlybEBnbWFpbC5jb20+IHdyb3RlOgo+IE9uIDEy
LzYvMDcsIEpvbiBTbWlybCA8am9uc21pcmxAZ21haWwuY29tPiB3cm90ZToKPiA+IE9uIDEyLzUv
MDcsIEdyYW50IExpa2VseSA8Z3JhbnQubGlrZWx5QHNlY3JldGxhYi5jYT4gd3JvdGU6Cj4gPiA+
IE9uIDEyLzUvMDcsIEpvbiBTbWlybCA8am9uc21pcmxAZ21haWwuY29tPiB3cm90ZToKPiA+ID4g
PiBXaHkgZG9lcyB0aGUgZmVjNTIwMCBkcml2ZXIgc29tZXRpbWVzIG5vdCBwcmludCAnUEhZJyBj
b3JyZWN0bHk/Cj4gPiA+ID4KPiA+ID4gPiBwaHlDT1JFLU1QQzUyMDBCLXRpbnkgbG9naW46IFTY
pFbvv70gZjAwMDMwMDA6MTAgLSBMaW5rIGlzIERvd24KPiA+ID4gPiBU77+9WTogZjAwMDMwMDA6
MTAgLSBMaW5rIGlzIFVwIC0gMTAwL0Z1bGwKPiA+ID4gPiBU77+9WTogZjAwMDMwMDA6MTAgLSBM
aW5rIGlzIERvd24KPiA+ID4gPiBQSFk6IGYwMDAzMDAwOjEwIC0gTGluayBpcyBVcCAtIDEwMC9G
dWxsCj4gPiA+Cj4gPiA+IFdlaXJkOyB0aGF0IGxpbmUgY29tZXMgZnJvbSBkcml2ZXJzL25ldC9w
aHkvcGh5LmMgaW4KPiA+ID4gcGh5X3ByaW50X3N0YXR1cygpLCBhbmQgaXQncyBqdXN0IGEgYSBw
cl9pbmZvIHN0YXRlbWVudC4gIEkgc3VwcG9zZSBpdAo+ID4gPiBtaWdodCBiZSBhIHN0YWNrIG92
ZXJydW4sIGJ1dCBJJ2QgZXhwZWN0IG1vcmUgc2V2ZXJlIHN5bXB0b21zIGlmIHRoYXQKPiA+ID4g
d2FzIHRoZSBjYXNlLgo+ID4gPgo+ID4gPiBUaGF0ICpsb29rcyogbGlrZSBhIHNlcmlhbCBzdHJl
YW0gY29ycnVwdGlvbi4gIElzIHRoYXQgdGhlIG91dHB1dCBvZgo+ID4gPiB5b3VyIHNlcmlhbCBw
b3J0PyAgRG9lcyBkbWVzZyBzaG93IHRoZSBzYW1lIGNvcnJ1cHRpb24/Cj4gPgo+ID4gVGhhdCdz
IHRoZSBzZXJpYWwgcG9ydCBvdXRwdXQuCj4gPiBkbWVzZyBpcyBvay4KPiA+Cj4gPiBOb3RoaW5n
IGVsc2UgSSBkbyBjYW4gbWVzcyB1cCB0aGUgc2VyaWFsIHBvcnQuCj4KPiBNYXliZSB0aGUgS0VS
Tl9JTkZPIHByZWZpeCBpcyBzZW5kaW5nIG91dCBjb250cm9sIGNoYXJhY3RlcnMgdGhhdCBtZXNz
Cj4gdXAgdGhlIHNlcmlhbCBvdXRwdXQ/CgpNb3JlIGxpa2VseSB0aGUgRXRoZXJuZXQgbGluayBz
dGF0ZSBjaGFuZ2UgaXMgaW50ZXJmZXJpbmcgd2l0aCB0aGUKc2VyaWFsIGxpbmUgYXQgdGhlIGVs
ZWN0cmljYWwgbGV2ZWwuICBUcnkgdHdlYWtpbmcgdGhlIHNlcmlhbCBjbG9jayB1cApvciBkb3du
IGEgdGlueSBiaXQsIHRoYXQgbWlnaHQgbWFrZSBpdCBtb3JlIHN0YWJsZS4gIChJJ3ZlIGhhZCB0
byBkbwp0aGF0IG9uIG9uZSBvZiBteSBib2FyZHMgaGVyZSB0byBnZXQgc3RhYmxlIHNlcmlhbCBv
dXRwdXQpLgoKQ2hlZXJzLApnLgoKCi0tIApHcmFudCBMaWtlbHksIEIuU2MuLCBQLkVuZy4KU2Vj
cmV0IExhYiBUZWNobm9sb2dpZXMgTHRkLgpncmFudC5saWtlbHlAc2VjcmV0bGFiLmNhCig0MDMp
IDM5OS0wMTk1Cg==
^ permalink raw reply
* Re: Link up/down messages from 5200 ethernet driver
From: Jon Smirl @ 2007-12-06 6:19 UTC (permalink / raw)
To: Grant Likely, Matt Sealey; +Cc: PowerPC dev list, Domen Puncer
In-Reply-To: <fa686aa40712052208o3722cf60qfcac9b56ecc6184f@mail.gmail.com>
T24gMTIvNi8wNywgR3JhbnQgTGlrZWx5IDxncmFudC5saWtlbHlAc2VjcmV0bGFiLmNhPiB3cm90
ZToKPiBPbiAxMi81LzA3LCBKb24gU21pcmwgPGpvbnNtaXJsQGdtYWlsLmNvbT4gd3JvdGU6Cj4g
PiBPbiAxMi82LzA3LCBKb24gU21pcmwgPGpvbnNtaXJsQGdtYWlsLmNvbT4gd3JvdGU6Cj4gPiA+
IE9uIDEyLzUvMDcsIEdyYW50IExpa2VseSA8Z3JhbnQubGlrZWx5QHNlY3JldGxhYi5jYT4gd3Jv
dGU6Cj4gPiA+ID4gT24gMTIvNS8wNywgSm9uIFNtaXJsIDxqb25zbWlybEBnbWFpbC5jb20+IHdy
b3RlOgo+ID4gPiA+ID4gV2h5IGRvZXMgdGhlIGZlYzUyMDAgZHJpdmVyIHNvbWV0aW1lcyBub3Qg
cHJpbnQgJ1BIWScgY29ycmVjdGx5Pwo+ID4gPiA+ID4KPiA+ID4gPiA+IHBoeUNPUkUtTVBDNTIw
MEItdGlueSBsb2dpbjogVNikVu+/vSBmMDAwMzAwMDoxMCAtIExpbmsgaXMgRG93bgo+ID4gPiA+
ID4gVO+/vVk6IGYwMDAzMDAwOjEwIC0gTGluayBpcyBVcCAtIDEwMC9GdWxsCj4gPiA+ID4gPiBU
77+9WTogZjAwMDMwMDA6MTAgLSBMaW5rIGlzIERvd24KPiA+ID4gPiA+IFBIWTogZjAwMDMwMDA6
MTAgLSBMaW5rIGlzIFVwIC0gMTAwL0Z1bGwKPiA+ID4gPgo+ID4gPiA+IFdlaXJkOyB0aGF0IGxp
bmUgY29tZXMgZnJvbSBkcml2ZXJzL25ldC9waHkvcGh5LmMgaW4KPiA+ID4gPiBwaHlfcHJpbnRf
c3RhdHVzKCksIGFuZCBpdCdzIGp1c3QgYSBhIHByX2luZm8gc3RhdGVtZW50LiAgSSBzdXBwb3Nl
IGl0Cj4gPiA+ID4gbWlnaHQgYmUgYSBzdGFjayBvdmVycnVuLCBidXQgSSdkIGV4cGVjdCBtb3Jl
IHNldmVyZSBzeW1wdG9tcyBpZiB0aGF0Cj4gPiA+ID4gd2FzIHRoZSBjYXNlLgo+ID4gPiA+Cj4g
PiA+ID4gVGhhdCAqbG9va3MqIGxpa2UgYSBzZXJpYWwgc3RyZWFtIGNvcnJ1cHRpb24uICBJcyB0
aGF0IHRoZSBvdXRwdXQgb2YKPiA+ID4gPiB5b3VyIHNlcmlhbCBwb3J0PyAgRG9lcyBkbWVzZyBz
aG93IHRoZSBzYW1lIGNvcnJ1cHRpb24/Cj4gPiA+Cj4gPiA+IFRoYXQncyB0aGUgc2VyaWFsIHBv
cnQgb3V0cHV0Lgo+ID4gPiBkbWVzZyBpcyBvay4KPiA+ID4KPiA+ID4gTm90aGluZyBlbHNlIEkg
ZG8gY2FuIG1lc3MgdXAgdGhlIHNlcmlhbCBwb3J0Lgo+ID4KPiA+IE1heWJlIHRoZSBLRVJOX0lO
Rk8gcHJlZml4IGlzIHNlbmRpbmcgb3V0IGNvbnRyb2wgY2hhcmFjdGVycyB0aGF0IG1lc3MKPiA+
IHVwIHRoZSBzZXJpYWwgb3V0cHV0Pwo+Cj4gTW9yZSBsaWtlbHkgdGhlIEV0aGVybmV0IGxpbmsg
c3RhdGUgY2hhbmdlIGlzIGludGVyZmVyaW5nIHdpdGggdGhlCj4gc2VyaWFsIGxpbmUgYXQgdGhl
IGVsZWN0cmljYWwgbGV2ZWwuICBUcnkgdHdlYWtpbmcgdGhlIHNlcmlhbCBjbG9jayB1cAo+IG9y
IGRvd24gYSB0aW55IGJpdCwgdGhhdCBtaWdodCBtYWtlIGl0IG1vcmUgc3RhYmxlLiAgKEkndmUg
aGFkIHRvIGRvCj4gdGhhdCBvbiBvbmUgb2YgbXkgYm9hcmRzIGhlcmUgdG8gZ2V0IHN0YWJsZSBz
ZXJpYWwgb3V0cHV0KS4KClRoYXQgYXBwZWFycyB0byBiZSB0aGUgcHJvYmxlbS4gSXQncyBteSBF
ZmlrYSB0aGF0IGlzIGNvcnJ1cHRpbmcgdGhlCm1lc3NhZ2UuIE9uIHRoZSBFZmlrYSBFdGhlcm5l
dCBhbmQgc2VyaWFsIGFyZSByaWdodCBuZXh0IHRvIGVhY2gKb3RoZXIuIE15IFBoeXRlYyBzeXN0
ZW0gaXMgb2ssIHNlcmlhbCBhbmQgRXRoZXJuZXQgYXJlIGF0IG9wcG9zaXRlCmVuZHMgb2YgdGhl
IGJvYXJkLgoKPgo+IENoZWVycywKPiBnLgo+Cj4KPiAtLQo+IEdyYW50IExpa2VseSwgQi5TYy4s
IFAuRW5nLgo+IFNlY3JldCBMYWIgVGVjaG5vbG9naWVzIEx0ZC4KPiBncmFudC5saWtlbHlAc2Vj
cmV0bGFiLmNhCj4gKDQwMykgMzk5LTAxOTUKPgoKCi0tIApKb24gU21pcmwKam9uc21pcmxAZ21h
aWwuY29tCg==
^ permalink raw reply
* [PATCH] Use SLB size from the device tree
From: Michael Neuling @ 2007-12-06 6:24 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Olof Johansson, linuxppc-dev, Will Schmidt
In-Reply-To: <18263.27999.950921.122870@cargo.ozlabs.ibm.com>
Currently we hardwire the number of SLBs but PAPR says we export an
ibm,slb-size property to specify the number of SLB entries. This
patch uses this property instead of assuming 64. If no property is
found, we assume 64 entries as before.
This soft patches the SLB handler, so it won't change performance at
all.
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
> On 32-bit platforms (e.g. powermac) I get:
>
> /home/paulus/kernel/powerpc/arch/powerpc/kernel/prom.c: In function 'check_cp
u_slb_size':
> /home/paulus/kernel/powerpc/arch/powerpc/kernel/prom.c:592: error: 'mmu_slb_s
ize' undeclared (first use in this function)
> /home/paulus/kernel/powerpc/arch/powerpc/kernel/prom.c:592: error: (Each unde
clared identifier is reported only once
> /home/paulus/kernel/powerpc/arch/powerpc/kernel/prom.c:592: error: for each f
unction it appears in.)
> make[2]: *** [arch/powerpc/kernel/prom.o] Error 1
Here's a nickel kid, buy yourself another 32bits! :-)
Or in other words.... Sorry about that! Below should fix it.
arch/powerpc/kernel/prom.c | 15 +++++++++++++++
arch/powerpc/mm/hash_utils_64.c | 1 +
arch/powerpc/mm/slb.c | 3 +++
arch/powerpc/mm/slb_low.S | 5 +++--
arch/powerpc/platforms/pasemi/setup.c | 3 ++-
arch/powerpc/xmon/xmon.c | 2 +-
include/asm-powerpc/mmu-hash64.h | 1 +
include/asm-powerpc/reg.h | 6 ------
8 files changed, 26 insertions(+), 10 deletions(-)
Index: linux-2.6-ozlabs/arch/powerpc/kernel/prom.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/prom.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/prom.c
@@ -583,6 +583,20 @@ static void __init check_cpu_pa_features
ibm_pa_features, ARRAY_SIZE(ibm_pa_features));
}
+#ifdef CONFIG_PPC64
+static void __init check_cpu_slb_size(unsigned long node)
+{
+ u32 *slb_size_ptr;
+
+ slb_size_ptr = of_get_flat_dt_prop(node, "ibm,slb-size", NULL);
+ if (slb_size_ptr != NULL) {
+ mmu_slb_size = *slb_size_ptr;
+ }
+}
+#else
+#define check_cpu_slb_size(node) do { } while(0)
+#endif
+
static struct feature_property {
const char *name;
u32 min_value;
@@ -713,6 +727,7 @@ static int __init early_init_dt_scan_cpu
check_cpu_feature_properties(node);
check_cpu_pa_features(node);
+ check_cpu_slb_size(node);
#ifdef CONFIG_PPC_PSERIES
if (nthreads > 1)
Index: linux-2.6-ozlabs/arch/powerpc/mm/hash_utils_64.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/mm/hash_utils_64.c
+++ linux-2.6-ozlabs/arch/powerpc/mm/hash_utils_64.c
@@ -96,6 +96,7 @@ int mmu_vmalloc_psize = MMU_PAGE_4K;
int mmu_io_psize = MMU_PAGE_4K;
int mmu_kernel_ssize = MMU_SEGSIZE_256M;
int mmu_highuser_ssize = MMU_SEGSIZE_256M;
+u16 mmu_slb_size = 64;
#ifdef CONFIG_HUGETLB_PAGE
int mmu_huge_psize = MMU_PAGE_16M;
unsigned int HPAGE_SHIFT;
Index: linux-2.6-ozlabs/arch/powerpc/mm/slb.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/mm/slb.c
+++ linux-2.6-ozlabs/arch/powerpc/mm/slb.c
@@ -256,6 +256,7 @@ void slb_initialize(void)
static int slb_encoding_inited;
extern unsigned int *slb_miss_kernel_load_linear;
extern unsigned int *slb_miss_kernel_load_io;
+ extern unsigned int *slb_compare_rr_to_size;
/* Prepare our SLB miss handler based on our page size */
linear_llp = mmu_psize_defs[mmu_linear_psize].sllp;
@@ -269,6 +270,8 @@ void slb_initialize(void)
SLB_VSID_KERNEL | linear_llp);
patch_slb_encoding(slb_miss_kernel_load_io,
SLB_VSID_KERNEL | io_llp);
+ patch_slb_encoding(slb_compare_rr_to_size,
+ mmu_slb_size);
DBG("SLB: linear LLP = %04x\n", linear_llp);
DBG("SLB: io LLP = %04x\n", io_llp);
Index: linux-2.6-ozlabs/arch/powerpc/mm/slb_low.S
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/mm/slb_low.S
+++ linux-2.6-ozlabs/arch/powerpc/mm/slb_low.S
@@ -227,8 +227,9 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISER
7: ld r10,PACASTABRR(r13)
addi r10,r10,1
- /* use a cpu feature mask if we ever change our slb size */
- cmpldi r10,SLB_NUM_ENTRIES
+ /* This gets soft patched on boot. */
+_GLOBAL(slb_compare_rr_to_size)
+ cmpldi r10,0
blt+ 4f
li r10,SLB_NUM_BOLTED
Index: linux-2.6-ozlabs/arch/powerpc/platforms/pasemi/setup.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/platforms/pasemi/setup.c
+++ linux-2.6-ozlabs/arch/powerpc/platforms/pasemi/setup.c
@@ -36,6 +36,7 @@
#include <asm/smp.h>
#include <asm/time.h>
#include <asm/of_platform.h>
+#include <asm/mmu.h>
#include <pcmcia/ss.h>
#include <pcmcia/cistpl.h>
@@ -295,7 +296,7 @@ static int pas_machine_check_handler(str
int i;
printk(KERN_ERR "slb contents:\n");
- for (i = 0; i < SLB_NUM_ENTRIES; i++) {
+ for (i = 0; i < mmu_slb_size; i++) {
asm volatile("slbmfee %0,%1" : "=r" (e) : "r" (i));
asm volatile("slbmfev %0,%1" : "=r" (v) : "r" (i));
printk(KERN_ERR "%02d %016lx %016lx\n", i, e, v);
Index: linux-2.6-ozlabs/arch/powerpc/xmon/xmon.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/xmon/xmon.c
+++ linux-2.6-ozlabs/arch/powerpc/xmon/xmon.c
@@ -2543,7 +2543,7 @@ static void dump_slb(void)
printf("SLB contents of cpu %x\n", smp_processor_id());
- for (i = 0; i < SLB_NUM_ENTRIES; i++) {
+ for (i = 0; i < mmu_slb_size; i++) {
asm volatile("slbmfee %0,%1" : "=r" (tmp) : "r" (i));
printf("%02d %016lx ", i, tmp);
Index: linux-2.6-ozlabs/include/asm-powerpc/mmu-hash64.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-powerpc/mmu-hash64.h
+++ linux-2.6-ozlabs/include/asm-powerpc/mmu-hash64.h
@@ -180,6 +180,7 @@ extern int mmu_vmalloc_psize;
extern int mmu_io_psize;
extern int mmu_kernel_ssize;
extern int mmu_highuser_ssize;
+extern u16 mmu_slb_size;
/*
* If the processor supports 64k normal pages but not 64k cache
Index: linux-2.6-ozlabs/include/asm-powerpc/reg.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-powerpc/reg.h
+++ linux-2.6-ozlabs/include/asm-powerpc/reg.h
@@ -691,12 +691,6 @@
#define PV_BE 0x0070
#define PV_PA6T 0x0090
-/*
- * Number of entries in the SLB. If this ever changes we should handle
- * it with a use a cpu feature fixup.
- */
-#define SLB_NUM_ENTRIES 64
-
/* Macros for setting and retrieving special purpose registers */
#ifndef __ASSEMBLY__
#define mfmsr() ({unsigned long rval; \
^ permalink raw reply
* Re: [PATCH 1/3] cell: fix undefined reference to mmio_nvram_init
From: Ishizaki Kou @ 2007-12-06 6:36 UTC (permalink / raw)
To: arnd; +Cc: linuxppc-dev, paulus
In-Reply-To: <200712041410.43736.arnd@arndb.de>
Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 04 December 2007, Ishizaki Kou wrote:
> >
> > +#ifdef CONFIG_MMIO_NVRAM
> > mmio_nvram_init();
> > +#endif
> > }
>
> The patch is technically correct, but the preferred way of doing this is
> to define a conditional inline function in the header, like:
>
> #ifdef CONFIG_MMIO_NVRAM
> extern int mmio_nvram_init(void);
> #else
> static inline int mmio_nvram_init(void)
> {
> return 0;
> }
> #endif
>
> so that the caller does not need to know about it.
Okay, I'll change my patch to rewrite include/asm-powerpc/nvram.h.
Best regards,
Kou Ishizaki
^ permalink raw reply
* Re: [PATCH 2/3] celleb: add supporting for native CBE
From: Ishizaki Kou @ 2007-12-06 6:43 UTC (permalink / raw)
To: arnd; +Cc: linuxppc-dev, paulus
In-Reply-To: <200712041421.47378.arnd@arndb.de>
Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 04 December 2007, Ishizaki Kou wrote:
> > This patch adds supporting for native CBE on Celleb. Many codes in
> > platforms/cell/ are used when native CBE environment.
> >
> > Signed-off-by: Kou Ishizaki <Kou.Ishizaki@toshiba.co.jp>
>
> Ah, excellent to hear that this is now working!
>
> I'd suggest doing the initialization in a different way, so that you don't
> need to decide on so many attributes dynamically. The easiest way would
> probably be to have two separate define_machine() calls in the celleb
> definition, like
>
> define_machine(celleb_beat) {
> .probe = celleb_probe_beat,
> .setup_arch = celleb_setup_arch_native,
> .show_cpuinfo = celleb_show_cpuinfo,
> .restart = beat_restart,
> .power_off = beat_power_off,
> .halt = beat_halt,
> .get_rtc_time = beat_get_rtc_time,
> .set_rtc_time = beat_set_rtc_time,
> .calibrate_decr = generic_calibrate_decr,
> .progress = celleb_progress,
> .power_save = beat_power_save,
> .nvram_size = beat_nvram_get_size,
> .nvram_read = beat_nvram_read,
> .nvram_write = beat_nvram_write,
> .set_dabr = beat_set_xdabr,
> .init_IRQ = beatic_init_IRQ,
> .get_irq = beatic_get_irq,
> .pci_probe_mode = celleb_pci_probe_mode,
> .pci_setup_phb = celleb_setup_phb,
> ...
> };
>
> define_machine(celleb_native) {
> .probe = celleb_probe_native,
> .setup_arch = celleb_setup_arch_native,
> .show_cpuinfo = celleb_show_cpuinfo,
> .restart = rtas_restart,
> .power_off = rtas_power_off,
> .halt = rtas_halt,
> .get_rtc_time = rtas_get_rtc_time,
> .set_rtc_time = rtas_set_rtc_time,
> .calibrate_decr = generic_calibrate_decr,
> .progress = celleb_progress,
> .init_IRQ = celleb_init_IRQ_native,
> .get_irq = celleb_get_irq_native,
> .pci_probe_mode = celleb_pci_probe_mode,
> .pci_setup_phb = celleb_setup_phb,
> ...
> };
>
> For this, you can either have the two machine definitions in the
> same celleb/setup.c, or split setup.c into machine specific files,
> depending on how much ends up being shared in the end.
Thanks for your suggestion. I'll try to split into two machine
definitions.
> An interesting question still is how close the native celleb machine
> definition is to the one from platforms/cell/setup.c. Maybe it's best
> to have a common machine definition for these two in the end.
You know celleb-native is between celleb-beat and cell blade. I also
think it's best if we can use a common machine definition and a common
setup code. But there are many differences mainly caused by their
firmwares, and this disturbs the integration. I think celleb-native is
closer to celleb-beat than to cell blade. So I put celleb-native code
in platforms/celleb.
> Arnd <><
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
Best regards,
Kou Ishizaki
^ permalink raw reply
* Re: [PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources
From: Greg KH @ 2007-12-06 6:39 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-pci, linux-kernel
In-Reply-To: <1196911347.7033.15.camel@pasglop>
On Thu, Dec 06, 2007 at 02:22:27PM +1100, Benjamin Herrenschmidt wrote:
>
> On Wed, 2007-12-05 at 17:40 +1100, Benjamin Herrenschmidt wrote:
> > The current pci_assign_unassigned_resources() code doesn't work properly
> > on 32 bits platforms with 64 bits resources. The main reason is the use
> > of unsigned long in various places instead of resource_size_t.
> >
> > This fixes it, along with some tricks to avoid casting to 64 bits on
> > platforms that don't need it in every printk around.
> >
> > This is a pre-requisite for making powerpc use the generic code instead of
> > its own half-useful implementation.
> >
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > ---
> >
> > This version fixes some stupid warnings when using 32 bits resources
>
> ... and has warnings on 64 bits platforms... GRRRR
>
> This whole issue of printk vs. resource_size_t is a terrible mess :-(
>
> Part of the problem is that resource_size_t can be either u32 or u64..
>
> that is it can be either unsigned int, unsigned long or unsigned long
> long... and we have no way to reliably printk that.
We do this already just fine. Take a look in the kernel, I think we
just always cast it to long long to be uniform.
> Any clever idea before I start pushing filthy macros up linux/types.h ?
I don't think any macros are needed.
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources
From: Benjamin Herrenschmidt @ 2007-12-06 7:58 UTC (permalink / raw)
To: Greg KH; +Cc: linuxppc-dev, linux-pci, linux-kernel
In-Reply-To: <20071206063940.GA16474@kroah.com>
On Wed, 2007-12-05 at 22:39 -0800, Greg KH wrote:
> > that is it can be either unsigned int, unsigned long or unsigned
> long
> > long... and we have no way to reliably printk that.
>
> We do this already just fine. Take a look in the kernel, I think we
> just always cast it to long long to be uniform.
I wanted to avoid that for two reasons:
- casts are fugly
- it adds support code to cast & handle 64 bits to 32 bits platforms
that wouldn't normally need it
Now, if you really think that's the way to go, I'll respin with casts
(I've used cast in subsequent patches merging bits & pieces of the
powerpc 32 and 64 bits PCI code too in fact).
I was just hoping somebody had a better idea, like a way to add a new
format specifier to printk without losing gcc type checking :-)
Cheers,
Ben.
^ permalink raw reply
* [PATCH 0/25] powerpc: 4xx PCI, PCI-X and PCI-Express support among others
From: Benjamin Herrenschmidt @ 2007-12-06 7:59 UTC (permalink / raw)
To: linuxppc-dev
Here's a set of patches that bring PCI, PCI-X and PCI-Express
support to 4xx on arch/powerpc. It also changes/fixed various
bits and pieces, such as a bit of rework of arch/powerpc/boot
4xx code, adding a couple of new platforms along the way.
There are some issues with the SCSI stack vs. non-coherent
DMA that I'm working on fixing separately, and there's a
problem I noticed with the e1000 driver vs. 64 bits resources
on 32 bits architectures for which I also have a patch that
I posted separately. Appart from that, I got it working fine
with a USB2 card in an ebony and 2 USB storage devices.
^ permalink raw reply
* [PATCH 1/25] powerpc: Make isa_mem_base common to 32 and 64 bits
From: Benjamin Herrenschmidt @ 2007-12-06 8:00 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1196927999.714593.205329520306.qpush@grosgo>
This defines isa_mem_base on both 32 and 64 bits (it used to be 32 bits
only). This avoids a few ifdef's in later patches and potentially can
allow support for VGA text mode on 64 bits powerpc.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
Small cleanup pre-requisite for my next patch
arch/powerpc/kernel/pci-common.c | 4 ++++
arch/powerpc/kernel/pci_32.c | 1 -
include/asm-powerpc/io.h | 5 +++--
3 files changed, 7 insertions(+), 3 deletions(-)
Index: linux-work/arch/powerpc/kernel/pci-common.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/pci-common.c 2007-11-20 14:42:49.000000000 +1100
+++ linux-work/arch/powerpc/kernel/pci-common.c 2007-11-20 15:03:02.000000000 +1100
@@ -52,6 +52,10 @@ int global_phb_number; /* Global phb co
extern struct list_head hose_list;
+/* ISA Memory physical address */
+resource_size_t isa_mem_base;
+
+
/*
* pci_controller(phb) initialized common variables.
*/
Index: linux-work/include/asm-powerpc/io.h
===================================================================
--- linux-work.orig/include/asm-powerpc/io.h 2007-11-20 14:42:49.000000000 +1100
+++ linux-work/include/asm-powerpc/io.h 2007-11-20 14:47:11.000000000 +1100
@@ -50,15 +50,16 @@ extern int check_legacy_ioport(unsigned
#define PCI_DRAM_OFFSET pci_dram_offset
#else
#define _IO_BASE pci_io_base
-#define _ISA_MEM_BASE 0
+#define _ISA_MEM_BASE isa_mem_base
#define PCI_DRAM_OFFSET 0
#endif
extern unsigned long isa_io_base;
-extern unsigned long isa_mem_base;
extern unsigned long pci_io_base;
extern unsigned long pci_dram_offset;
+extern resource_size_t isa_mem_base;
+
#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_INDIRECT_IO)
#error CONFIG_PPC_INDIRECT_IO is not yet supported on 32 bits
#endif
Index: linux-work/arch/powerpc/kernel/pci_32.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/pci_32.c 2007-11-20 14:42:49.000000000 +1100
+++ linux-work/arch/powerpc/kernel/pci_32.c 2007-11-20 15:02:43.000000000 +1100
@@ -32,7 +32,6 @@
#endif
unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
unsigned long pci_dram_offset = 0;
int pcibios_assign_bus_offset = 1;
^ permalink raw reply
* [PATCH 2/25] powerpc: Merge pci_process_bridge_OF_ranges()
From: Benjamin Herrenschmidt @ 2007-12-06 8:00 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1196927999.714593.205329520306.qpush@grosgo>
This patch merges the 32 and 64 bits implementations of
pci_process_bridge_OF_ranges(). The new function is cleaner than both
the old ones supports 64 bits ranges on ppc32 which is necessary for
the 4xx port.
It also adds some better (hopefully) output to the kernel log which
should help disagnose problems and makes better use of existing OF
parsing helpers (avoiding a few bugs of both implementations along
the way).
There are still a few unfortunate ifdef's but there is no way around
these for now at least not until some other bits of the PCI code are
made common.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
Tested on a few pSeries, PowerMac G5, and a 32 bits PowerMacs and
a BriQ. Please let me know if it misbehaves anywhere else.
arch/powerpc/kernel/pci-common.c | 177 +++++++++++++++++++++++++++++++++++++++
arch/powerpc/kernel/pci_32.c | 114 -------------------------
arch/powerpc/kernel/pci_64.c | 93 --------------------
include/asm-powerpc/pci-bridge.h | 1
4 files changed, 178 insertions(+), 207 deletions(-)
Index: linux-work/arch/powerpc/kernel/pci-common.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/pci-common.c 2007-12-03 12:00:58.000000000 +1100
+++ linux-work/arch/powerpc/kernel/pci-common.c 2007-12-03 12:01:55.000000000 +1100
@@ -479,3 +479,180 @@ void pci_resource_to_user(const struct p
*start = rsrc->start - offset;
*end = rsrc->end - offset;
}
+
+/**
+ * pci_process_bridge_OF_ranges - Parse PCI bridge resources from device tree
+ * @hose: newly allocated pci_controller to be setup
+ * @dev: device node of the host bridge
+ * @primary: set if primary bus (32 bits only, soon to be deprecated)
+ *
+ * This function will parse the "ranges" property of a PCI host bridge device
+ * node and setup the resource mapping of a pci controller based on its
+ * content.
+ *
+ * Life would be boring if it wasn't for a few issues that we have to deal
+ * with here:
+ *
+ * - We can only cope with one IO space range and up to 3 Memory space
+ * ranges. However, some machines (thanks Apple !) tend to split their
+ * space into lots of small contiguous ranges. So we have to coalesce.
+ *
+ * - We can only cope with all memory ranges having the same offset
+ * between CPU addresses and PCI addresses. Unfortunately, some bridges
+ * are setup for a large 1:1 mapping along with a small "window" which
+ * maps PCI address 0 to some arbitrary high address of the CPU space in
+ * order to give access to the ISA memory hole.
+ * The way out of here that I've chosen for now is to always set the
+ * offset based on the first resource found, then override it if we
+ * have a different offset and the previous was set by an ISA hole.
+ *
+ * - Some busses have IO space not starting at 0, which causes trouble with
+ * the way we do our IO resource renumbering. The code somewhat deals with
+ * it for 64 bits but I would expect problems on 32 bits.
+ *
+ * - Some 32 bits platforms such as 4xx can have physical space larger than
+ * 32 bits so we need to use 64 bits values for the parsing
+ */
+void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
+ struct device_node *dev,
+ int primary)
+{
+ const u32 *ranges;
+ int rlen;
+ int pna = of_n_addr_cells(dev);
+ int np = pna + 5;
+ int memno = 0, isa_hole = -1;
+ u32 pci_space;
+ unsigned long long pci_addr, cpu_addr, pci_next, cpu_next, size;
+ unsigned long long isa_mb = 0;
+ struct resource *res;
+
+ printk(KERN_INFO "PCI host bridge %s %s ranges:\n",
+ dev->full_name, primary ? "(primary)" : "");
+
+ /* Get ranges property */
+ ranges = of_get_property(dev, "ranges", &rlen);
+ if (ranges == NULL)
+ return;
+
+ /* Parse it */
+ while ((rlen -= np * 4) >= 0) {
+ /* Read next ranges element */
+ pci_space = ranges[0];
+ pci_addr = of_read_number(ranges + 1, 2);
+ cpu_addr = of_translate_address(dev, ranges + 3);
+ size = of_read_number(ranges + pna + 3, 2);
+ ranges += np;
+ if (cpu_addr == OF_BAD_ADDR || size == 0)
+ continue;
+
+ /* Now consume following elements while they are contiguous */
+ for (; rlen >= np * sizeof(u32);
+ ranges += np, rlen -= np * 4) {
+ if (ranges[0] != pci_space)
+ break;
+ pci_next = of_read_number(ranges + 1, 2);
+ cpu_next = of_translate_address(dev, ranges + 3);
+ if (pci_next != pci_addr + size ||
+ cpu_next != cpu_addr + size)
+ break;
+ size += of_read_number(ranges + pna + 3, 2);
+ }
+
+ /* Act based on address space type */
+ res = NULL;
+ switch ((pci_space >> 24) & 0x3) {
+ case 1: /* PCI IO space */
+ printk(KERN_INFO
+ " IO 0x%016llx..0x%016llx -> 0x%016llx\n",
+ cpu_addr, cpu_addr + size - 1, pci_addr);
+
+ /* We support only one IO range */
+ if (hose->pci_io_size) {
+ printk(KERN_WARNING
+ " \\--> Skipped (too many) !\n");
+ continue;
+ }
+#ifdef CONFIG_PPC32
+ /* On 32 bits, limit I/O space to 16MB */
+ if (size > 0x01000000)
+ size = 0x01000000;
+
+ /* 32 bits needs to map IOs here */
+ hose->io_base_virt = ioremap(cpu_addr, size);
+
+ /* Expect trouble if pci_addr is not 0 */
+ if (primary)
+ isa_io_base =
+ (unsigned long)hose->io_base_virt;
+#endif /* CONFIG_PPC32 */
+ /* pci_io_size and io_base_phys always represent IO
+ * space starting at 0 so we factor in pci_addr
+ */
+ hose->pci_io_size = pci_addr + size;
+ hose->io_base_phys = cpu_addr - pci_addr;
+
+ /* Build resource */
+ res = &hose->io_resource;
+ res->flags = IORESOURCE_IO;
+ res->start = pci_addr;
+ break;
+ case 2: /* PCI Memory space */
+ printk(KERN_INFO
+ " MEM 0x%016llx..0x%016llx -> 0x%016llx %s\n",
+ cpu_addr, cpu_addr + size - 1, pci_addr,
+ (pci_space & 0x40000000) ? "Prefetch" : "");
+
+ /* We support only 3 memory ranges */
+ if (memno >= 3) {
+ printk(KERN_WARNING
+ " \\--> Skipped (too many) !\n");
+ continue;
+ }
+ /* Handles ISA memory hole space here */
+ if (pci_addr == 0) {
+ isa_mb = cpu_addr;
+ isa_hole = memno;
+ if (primary || isa_mem_base == 0)
+ isa_mem_base = cpu_addr;
+ }
+
+ /* We get the PCI/Mem offset from the first range or
+ * the, current one if the offset came from an ISA
+ * hole. If they don't match, bugger.
+ */
+ if (memno == 0 ||
+ (isa_hole >= 0 && pci_addr != 0 &&
+ hose->pci_mem_offset == isa_mb))
+ hose->pci_mem_offset = cpu_addr - pci_addr;
+ else if (pci_addr != 0 &&
+ hose->pci_mem_offset != cpu_addr - pci_addr) {
+ printk(KERN_WARNING
+ " \\--> Skipped (offset mismatch) !\n");
+ continue;
+ }
+
+ /* Build resource */
+ res = &hose->mem_resources[memno++];
+ res->flags = IORESOURCE_MEM;
+ if (pci_space & 0x40000000)
+ res->flags |= IORESOURCE_PREFETCH;
+ res->start = cpu_addr;
+ break;
+ }
+ if (res != NULL) {
+ res->name = dev->full_name;
+ res->end = res->start + size - 1;
+ res->parent = NULL;
+ res->sibling = NULL;
+ res->child = NULL;
+ }
+ }
+
+ /* Out of paranoia, let's put the ISA hole last if any */
+ if (isa_hole >= 0 && memno > 0 && isa_hole != (memno-1)) {
+ struct resource tmp = hose->mem_resources[isa_hole];
+ hose->mem_resources[isa_hole] = hose->mem_resources[memno-1];
+ hose->mem_resources[memno-1] = tmp;
+ }
+}
Index: linux-work/arch/powerpc/kernel/pci_32.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/pci_32.c 2007-12-03 12:00:58.000000000 +1100
+++ linux-work/arch/powerpc/kernel/pci_32.c 2007-12-03 12:01:02.000000000 +1100
@@ -842,120 +842,6 @@ pci_device_from_OF_node(struct device_no
}
EXPORT_SYMBOL(pci_device_from_OF_node);
-void __init
-pci_process_bridge_OF_ranges(struct pci_controller *hose,
- struct device_node *dev, int primary)
-{
- static unsigned int static_lc_ranges[256] __initdata;
- const unsigned int *dt_ranges;
- unsigned int *lc_ranges, *ranges, *prev, size;
- int rlen = 0, orig_rlen;
- int memno = 0;
- struct resource *res;
- int np, na = of_n_addr_cells(dev);
- np = na + 5;
-
- /* First we try to merge ranges to fix a problem with some pmacs
- * that can have more than 3 ranges, fortunately using contiguous
- * addresses -- BenH
- */
- dt_ranges = of_get_property(dev, "ranges", &rlen);
- if (!dt_ranges)
- return;
- /* Sanity check, though hopefully that never happens */
- if (rlen > sizeof(static_lc_ranges)) {
- printk(KERN_WARNING "OF ranges property too large !\n");
- rlen = sizeof(static_lc_ranges);
- }
- lc_ranges = static_lc_ranges;
- memcpy(lc_ranges, dt_ranges, rlen);
- orig_rlen = rlen;
-
- /* Let's work on a copy of the "ranges" property instead of damaging
- * the device-tree image in memory
- */
- ranges = lc_ranges;
- prev = NULL;
- while ((rlen -= np * sizeof(unsigned int)) >= 0) {
- if (prev) {
- if (prev[0] == ranges[0] && prev[1] == ranges[1] &&
- (prev[2] + prev[na+4]) == ranges[2] &&
- (prev[na+2] + prev[na+4]) == ranges[na+2]) {
- prev[na+4] += ranges[na+4];
- ranges[0] = 0;
- ranges += np;
- continue;
- }
- }
- prev = ranges;
- ranges += np;
- }
-
- /*
- * The ranges property is laid out as an array of elements,
- * each of which comprises:
- * cells 0 - 2: a PCI address
- * cells 3 or 3+4: a CPU physical address
- * (size depending on dev->n_addr_cells)
- * cells 4+5 or 5+6: the size of the range
- */
- ranges = lc_ranges;
- rlen = orig_rlen;
- while (ranges && (rlen -= np * sizeof(unsigned int)) >= 0) {
- res = NULL;
- size = ranges[na+4];
- switch ((ranges[0] >> 24) & 0x3) {
- case 1: /* I/O space */
- if (ranges[2] != 0)
- break;
- hose->io_base_phys = ranges[na+2];
- /* limit I/O space to 16MB */
- if (size > 0x01000000)
- size = 0x01000000;
- hose->io_base_virt = ioremap(ranges[na+2], size);
- if (primary)
- isa_io_base = (unsigned long) hose->io_base_virt;
- res = &hose->io_resource;
- res->flags = IORESOURCE_IO;
- res->start = ranges[2];
- DBG("PCI: IO 0x%llx -> 0x%llx\n",
- (u64)res->start, (u64)res->start + size - 1);
- break;
- case 2: /* memory space */
- memno = 0;
- if (ranges[1] == 0 && ranges[2] == 0
- && ranges[na+4] <= (16 << 20)) {
- /* 1st 16MB, i.e. ISA memory area */
- if (primary)
- isa_mem_base = ranges[na+2];
- memno = 1;
- }
- while (memno < 3 && hose->mem_resources[memno].flags)
- ++memno;
- if (memno == 0)
- hose->pci_mem_offset = ranges[na+2] - ranges[2];
- if (memno < 3) {
- res = &hose->mem_resources[memno];
- res->flags = IORESOURCE_MEM;
- if(ranges[0] & 0x40000000)
- res->flags |= IORESOURCE_PREFETCH;
- res->start = ranges[na+2];
- DBG("PCI: MEM[%d] 0x%llx -> 0x%llx\n", memno,
- (u64)res->start, (u64)res->start + size - 1);
- }
- break;
- }
- if (res != NULL) {
- res->name = dev->full_name;
- res->end = res->start + size - 1;
- res->parent = NULL;
- res->sibling = NULL;
- res->child = NULL;
- }
- ranges += np;
- }
-}
-
/* We create the "pci-OF-bus-map" property now so it appears in the
* /proc device tree
*/
Index: linux-work/arch/powerpc/kernel/pci_64.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/pci_64.c 2007-12-03 11:48:04.000000000 +1100
+++ linux-work/arch/powerpc/kernel/pci_64.c 2007-12-03 12:01:02.000000000 +1100
@@ -592,99 +592,6 @@ int pci_proc_domain(struct pci_bus *bus)
}
}
-void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
- struct device_node *dev, int prim)
-{
- const unsigned int *ranges;
- unsigned int pci_space;
- unsigned long size;
- int rlen = 0;
- int memno = 0;
- struct resource *res;
- int np, na = of_n_addr_cells(dev);
- unsigned long pci_addr, cpu_phys_addr;
-
- np = na + 5;
-
- /* From "PCI Binding to 1275"
- * The ranges property is laid out as an array of elements,
- * each of which comprises:
- * cells 0 - 2: a PCI address
- * cells 3 or 3+4: a CPU physical address
- * (size depending on dev->n_addr_cells)
- * cells 4+5 or 5+6: the size of the range
- */
- ranges = of_get_property(dev, "ranges", &rlen);
- if (ranges == NULL)
- return;
- hose->io_base_phys = 0;
- while ((rlen -= np * sizeof(unsigned int)) >= 0) {
- res = NULL;
- pci_space = ranges[0];
- pci_addr = ((unsigned long)ranges[1] << 32) | ranges[2];
- cpu_phys_addr = of_translate_address(dev, &ranges[3]);
- size = ((unsigned long)ranges[na+3] << 32) | ranges[na+4];
- ranges += np;
- if (size == 0)
- continue;
-
- /* Now consume following elements while they are contiguous */
- while (rlen >= np * sizeof(unsigned int)) {
- unsigned long addr, phys;
-
- if (ranges[0] != pci_space)
- break;
- addr = ((unsigned long)ranges[1] << 32) | ranges[2];
- phys = ranges[3];
- if (na >= 2)
- phys = (phys << 32) | ranges[4];
- if (addr != pci_addr + size ||
- phys != cpu_phys_addr + size)
- break;
-
- size += ((unsigned long)ranges[na+3] << 32)
- | ranges[na+4];
- ranges += np;
- rlen -= np * sizeof(unsigned int);
- }
-
- switch ((pci_space >> 24) & 0x3) {
- case 1: /* I/O space */
- hose->io_base_phys = cpu_phys_addr - pci_addr;
- /* handle from 0 to top of I/O window */
- hose->pci_io_size = pci_addr + size;
-
- res = &hose->io_resource;
- res->flags = IORESOURCE_IO;
- res->start = pci_addr;
- DBG("phb%d: IO 0x%lx -> 0x%lx\n", hose->global_number,
- res->start, res->start + size - 1);
- break;
- case 2: /* memory space */
- memno = 0;
- while (memno < 3 && hose->mem_resources[memno].flags)
- ++memno;
-
- if (memno == 0)
- hose->pci_mem_offset = cpu_phys_addr - pci_addr;
- if (memno < 3) {
- res = &hose->mem_resources[memno];
- res->flags = IORESOURCE_MEM;
- res->start = cpu_phys_addr;
- DBG("phb%d: MEM 0x%lx -> 0x%lx\n", hose->global_number,
- res->start, res->start + size - 1);
- }
- break;
- }
- if (res != NULL) {
- res->name = dev->full_name;
- res->end = res->start + size - 1;
- res->parent = NULL;
- res->sibling = NULL;
- res->child = NULL;
- }
- }
-}
#ifdef CONFIG_HOTPLUG
Index: linux-work/include/asm-powerpc/pci-bridge.h
===================================================================
--- linux-work.orig/include/asm-powerpc/pci-bridge.h 2007-12-03 11:48:04.000000000 +1100
+++ linux-work/include/asm-powerpc/pci-bridge.h 2007-12-03 12:01:02.000000000 +1100
@@ -27,6 +27,7 @@ struct pci_controller {
void __iomem *io_base_virt;
resource_size_t io_base_phys;
+ resource_size_t pci_io_size;
/* Some machines (PReP) have a non 1:1 mapping of
* the PCI memory space in the CPU bus space
^ permalink raw reply
* [PATCH 3/25] powerpc: Fix powerpc 32 bits resource fixup for 64 bits resources
From: Benjamin Herrenschmidt @ 2007-12-06 8:00 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1196927999.714593.205329520306.qpush@grosgo>
The 32bits powerpc resource fixup code uses unsigned longs to do the
offseting of resources which overflows on platforms such as 4xx where
resources can be 64 bits.
This fixes it by using resource_size_t instead.
However, the IO stuff does rely on some 32 bits arithmetic, so we hack
by cropping the result of the fixups for IO resources with a 32 bits
mask.
This isn't the prettiest but should work for now until we change the
32 bits PCI code to do IO mappings like 64 bits does, within a reserved
are of the kernel address space.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
This needs some regression testing.
arch/powerpc/kernel/pci_32.c | 46 ++++++++++++++++++++++++-------------------
1 file changed, 26 insertions(+), 20 deletions(-)
Index: linux-work/arch/powerpc/kernel/pci_32.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/pci_32.c 2007-12-03 12:01:02.000000000 +1100
+++ linux-work/arch/powerpc/kernel/pci_32.c 2007-12-03 12:05:49.000000000 +1100
@@ -104,7 +104,7 @@ pcibios_fixup_resources(struct pci_dev *
{
struct pci_controller* hose = (struct pci_controller *)dev->sysdata;
int i;
- unsigned long offset;
+ resource_size_t offset, mask;
if (!hose) {
printk(KERN_ERR "No hose for PCI dev %s!\n", pci_name(dev));
@@ -123,15 +123,17 @@ pcibios_fixup_resources(struct pci_dev *
continue;
}
offset = 0;
+ mask = (resource_size_t)-1;
if (res->flags & IORESOURCE_MEM) {
offset = hose->pci_mem_offset;
} else if (res->flags & IORESOURCE_IO) {
offset = (unsigned long) hose->io_base_virt
- isa_io_base;
+ mask = 0xffffffffu;
}
if (offset != 0) {
- res->start += offset;
- res->end += offset;
+ res->start = (res->start + offset) & mask;
+ res->end = (res->end + offset) & mask;
DBG("Fixup res %d (%lx) of dev %s: %llx -> %llx\n",
i, res->flags, pci_name(dev),
(u64)res->start - offset, (u64)res->start);
@@ -147,30 +149,32 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PC
void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
struct resource *res)
{
- unsigned long offset = 0;
+ resource_size_t offset = 0, mask = (resource_size_t)-1;
struct pci_controller *hose = dev->sysdata;
- if (hose && res->flags & IORESOURCE_IO)
+ if (hose && res->flags & IORESOURCE_IO) {
offset = (unsigned long)hose->io_base_virt - isa_io_base;
- else if (hose && res->flags & IORESOURCE_MEM)
+ mask = 0xffffffffu;
+ } else if (hose && res->flags & IORESOURCE_MEM)
offset = hose->pci_mem_offset;
- region->start = res->start - offset;
- region->end = res->end - offset;
+ region->start = (res->start - offset) & mask;
+ region->end = (res->end - offset) & mask;
}
EXPORT_SYMBOL(pcibios_resource_to_bus);
void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
struct pci_bus_region *region)
{
- unsigned long offset = 0;
+ resource_size_t offset = 0, mask = (resource_size_t)-1;
struct pci_controller *hose = dev->sysdata;
- if (hose && res->flags & IORESOURCE_IO)
+ if (hose && res->flags & IORESOURCE_IO) {
offset = (unsigned long)hose->io_base_virt - isa_io_base;
- else if (hose && res->flags & IORESOURCE_MEM)
+ mask = 0xffffffffu;
+ } else if (hose && res->flags & IORESOURCE_MEM)
offset = hose->pci_mem_offset;
- res->start = region->start + offset;
- res->end = region->end + offset;
+ res->start = (region->start + offset) & mask;
+ res->end = (region->end + offset) & mask;
}
EXPORT_SYMBOL(pcibios_bus_to_resource);
@@ -334,9 +338,9 @@ static int __init
pci_relocate_bridge_resource(struct pci_bus *bus, int i)
{
struct resource *res, *pr, *conflict;
- unsigned long try, size;
- int j;
+ resource_size_t try, size;
struct pci_bus *parent = bus->parent;
+ int j;
if (parent == NULL) {
/* shouldn't ever happen */
@@ -438,7 +442,7 @@ update_bridge_resource(struct pci_dev *d
u8 io_base_lo, io_limit_lo;
u16 mem_base, mem_limit;
u16 cmd;
- unsigned long start, end, off;
+ resource_size_t start, end, off;
struct pci_controller *hose = dev->sysdata;
if (!hose) {
@@ -1157,8 +1161,8 @@ void pcibios_fixup_bus(struct pci_bus *b
res->end = IO_SPACE_LIMIT;
res->flags = IORESOURCE_IO;
}
- res->start += io_offset;
- res->end += io_offset;
+ res->start = (res->start + io_offset) & 0xffffffffu;
+ res->end = (res->end + io_offset) & 0xffffffffu;
for (i = 0; i < 3; ++i) {
res = &hose->mem_resources[i];
@@ -1183,8 +1187,10 @@ void pcibios_fixup_bus(struct pci_bus *b
if (!res->flags || bus->self->transparent)
continue;
if (io_offset && (res->flags & IORESOURCE_IO)) {
- res->start += io_offset;
- res->end += io_offset;
+ res->start = (res->start + io_offset) &
+ 0xffffffffu;
+ res->end = (res->end + io_offset) &
+ 0xffffffffu;
} else if (hose->pci_mem_offset
&& (res->flags & IORESOURCE_MEM)) {
res->start += hose->pci_mem_offset;
^ permalink raw reply
* [PATCH 4/25] powerpc: Reworking machine check handling and Fix 440/440A
From: Benjamin Herrenschmidt @ 2007-12-06 8:00 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1196927999.714593.205329520306.qpush@grosgo>
This adds a cputable function pointer for the CPU-side machine
check handling. The semantic is still the same as the old one,
the one in ppc_md. overrides the one in cputable, though
ultimately we'll want to change that so the CPU gets first.
This removes CONFIG_440A which was a problem for multiplatform
kernels and instead fixes up the IVOR at runtime from a setup_cpu
function. The "A" version of the machine check also tweaks the
regs->trap value to differenciate the 2 versions at the C level.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/kernel/cpu_setup_44x.S | 9 +++
arch/powerpc/kernel/cputable.c | 105 ++++++++++++++++++++++++++++++++++++
arch/powerpc/kernel/head_44x.S | 14 +++-
arch/powerpc/kernel/head_booke.h | 2
arch/powerpc/kernel/traps.c | 62 ++++++++++++++++-----
arch/powerpc/platforms/44x/Kconfig | 5 -
include/asm-powerpc/cputable.h | 13 ++++
include/asm-powerpc/ptrace.h | 3 -
include/asm-powerpc/reg_booke.h | 3 -
9 files changed, 190 insertions(+), 26 deletions(-)
Index: linux-work/arch/powerpc/kernel/cpu_setup_44x.S
===================================================================
--- linux-work.orig/arch/powerpc/kernel/cpu_setup_44x.S 2007-12-03 11:48:03.000000000 +1100
+++ linux-work/arch/powerpc/kernel/cpu_setup_44x.S 2007-12-03 14:40:28.000000000 +1100
@@ -23,11 +23,20 @@ _GLOBAL(__setup_cpu_440epx)
mflr r4
bl __init_fpu_44x
bl __plb_disable_wrp
+ bl __fixup_440A_mcheck
mtlr r4
blr
_GLOBAL(__setup_cpu_440grx)
b __plb_disable_wrp
+_GLOBAL(__setup_cpu_440gx)
+_GLOBAL(__setup_cpu_440spe)
+ b __fixup_440A_mcheck
+ /* Temporary fixup for arch/ppc until we kill the whole thing */
+#ifndef CONFIG_PPC_MERGE
+_GLOBAL(__fixup_440A_mcheck)
+ blr
+#endif
/* enable APU between CPU and FPU */
_GLOBAL(__init_fpu_44x)
Index: linux-work/arch/powerpc/kernel/cputable.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/cputable.c 2007-12-03 11:48:03.000000000 +1100
+++ linux-work/arch/powerpc/kernel/cputable.c 2007-12-03 14:46:51.000000000 +1100
@@ -33,7 +33,9 @@ EXPORT_SYMBOL(cur_cpu_spec);
#ifdef CONFIG_PPC32
extern void __setup_cpu_440ep(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec);
+extern void __setup_cpu_440gx(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_440grx(unsigned long offset, struct cpu_spec* spec);
+extern void __setup_cpu_440spe(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec);
@@ -85,6 +87,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type = PPC_PMC_IBM,
.oprofile_cpu_type = "ppc64/power3",
.oprofile_type = PPC_OPROFILE_RS64,
+ .machine_check = machine_check_generic,
.platform = "power3",
},
{ /* Power3+ */
@@ -99,6 +102,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type = PPC_PMC_IBM,
.oprofile_cpu_type = "ppc64/power3",
.oprofile_type = PPC_OPROFILE_RS64,
+ .machine_check = machine_check_generic,
.platform = "power3",
},
{ /* Northstar */
@@ -113,6 +117,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type = PPC_PMC_IBM,
.oprofile_cpu_type = "ppc64/rs64",
.oprofile_type = PPC_OPROFILE_RS64,
+ .machine_check = machine_check_generic,
.platform = "rs64",
},
{ /* Pulsar */
@@ -127,6 +132,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type = PPC_PMC_IBM,
.oprofile_cpu_type = "ppc64/rs64",
.oprofile_type = PPC_OPROFILE_RS64,
+ .machine_check = machine_check_generic,
.platform = "rs64",
},
{ /* I-star */
@@ -141,6 +147,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type = PPC_PMC_IBM,
.oprofile_cpu_type = "ppc64/rs64",
.oprofile_type = PPC_OPROFILE_RS64,
+ .machine_check = machine_check_generic,
.platform = "rs64",
},
{ /* S-star */
@@ -155,6 +162,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type = PPC_PMC_IBM,
.oprofile_cpu_type = "ppc64/rs64",
.oprofile_type = PPC_OPROFILE_RS64,
+ .machine_check = machine_check_generic,
.platform = "rs64",
},
{ /* Power4 */
@@ -169,6 +177,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type = PPC_PMC_IBM,
.oprofile_cpu_type = "ppc64/power4",
.oprofile_type = PPC_OPROFILE_POWER4,
+ .machine_check = machine_check_generic,
.platform = "power4",
},
{ /* Power4+ */
@@ -183,6 +192,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type = PPC_PMC_IBM,
.oprofile_cpu_type = "ppc64/power4",
.oprofile_type = PPC_OPROFILE_POWER4,
+ .machine_check = machine_check_generic,
.platform = "power4",
},
{ /* PPC970 */
@@ -200,6 +210,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_restore = __restore_cpu_ppc970,
.oprofile_cpu_type = "ppc64/970",
.oprofile_type = PPC_OPROFILE_POWER4,
+ .machine_check = machine_check_generic,
.platform = "ppc970",
},
{ /* PPC970FX */
@@ -217,6 +228,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_restore = __restore_cpu_ppc970,
.oprofile_cpu_type = "ppc64/970",
.oprofile_type = PPC_OPROFILE_POWER4,
+ .machine_check = machine_check_generic,
.platform = "ppc970",
},
{ /* PPC970MP DD1.0 - no DEEPNAP, use regular 970 init */
@@ -234,6 +246,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_restore = __restore_cpu_ppc970,
.oprofile_cpu_type = "ppc64/970MP",
.oprofile_type = PPC_OPROFILE_POWER4,
+ .machine_check = machine_check_generic,
.platform = "ppc970",
},
{ /* PPC970MP */
@@ -251,6 +264,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_restore = __restore_cpu_ppc970,
.oprofile_cpu_type = "ppc64/970MP",
.oprofile_type = PPC_OPROFILE_POWER4,
+ .machine_check = machine_check_generic,
.platform = "ppc970",
},
{ /* PPC970GX */
@@ -267,6 +281,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_ppc970,
.oprofile_cpu_type = "ppc64/970",
.oprofile_type = PPC_OPROFILE_POWER4,
+ .machine_check = machine_check_generic,
.platform = "ppc970",
},
{ /* Power5 GR */
@@ -286,6 +301,7 @@ static struct cpu_spec __initdata cpu_sp
*/
.oprofile_mmcra_sihv = MMCRA_SIHV,
.oprofile_mmcra_sipr = MMCRA_SIPR,
+ .machine_check = machine_check_generic,
.platform = "power5",
},
{ /* Power5++ */
@@ -301,6 +317,7 @@ static struct cpu_spec __initdata cpu_sp
.oprofile_type = PPC_OPROFILE_POWER4,
.oprofile_mmcra_sihv = MMCRA_SIHV,
.oprofile_mmcra_sipr = MMCRA_SIPR,
+ .machine_check = machine_check_generic,
.platform = "power5+",
},
{ /* Power5 GS */
@@ -317,6 +334,7 @@ static struct cpu_spec __initdata cpu_sp
.oprofile_type = PPC_OPROFILE_POWER4,
.oprofile_mmcra_sihv = MMCRA_SIHV,
.oprofile_mmcra_sipr = MMCRA_SIPR,
+ .machine_check = machine_check_generic,
.platform = "power5+",
},
{ /* POWER6 in P5+ mode; 2.04-compliant processor */
@@ -327,6 +345,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_POWER5_PLUS,
.icache_bsize = 128,
.dcache_bsize = 128,
+ .machine_check = machine_check_generic,
.platform = "power5+",
},
{ /* Power6 */
@@ -346,6 +365,7 @@ static struct cpu_spec __initdata cpu_sp
.oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
.oprofile_mmcra_clear = POWER6_MMCRA_THRM |
POWER6_MMCRA_OTHER,
+ .machine_check = machine_check_generic,
.platform = "power6x",
},
{ /* 2.05-compliant processor, i.e. Power6 "architected" mode */
@@ -356,6 +376,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_POWER6,
.icache_bsize = 128,
.dcache_bsize = 128,
+ .machine_check = machine_check_generic,
.platform = "power6",
},
{ /* Cell Broadband Engine */
@@ -372,6 +393,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type = PPC_PMC_IBM,
.oprofile_cpu_type = "ppc64/cell-be",
.oprofile_type = PPC_OPROFILE_CELL,
+ .machine_check = machine_check_generic,
.platform = "ppc-cell-be",
},
{ /* PA Semi PA6T */
@@ -388,6 +410,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_restore = __restore_cpu_pa6t,
.oprofile_cpu_type = "ppc64/pa6t",
.oprofile_type = PPC_OPROFILE_PA6T,
+ .machine_check = machine_check_generic,
.platform = "pa6t",
},
{ /* default match */
@@ -400,6 +423,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 128,
.num_pmcs = 6,
.pmc_type = PPC_PMC_IBM,
+ .machine_check = machine_check_generic,
.platform = "power4",
}
#endif /* CONFIG_PPC64 */
@@ -414,6 +438,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_generic,
.platform = "ppc601",
},
{ /* 603 */
@@ -425,6 +450,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_603,
+ .machine_check = machine_check_generic,
.platform = "ppc603",
},
{ /* 603e */
@@ -436,6 +462,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_603,
+ .machine_check = machine_check_generic,
.platform = "ppc603",
},
{ /* 603ev */
@@ -447,6 +474,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_603,
+ .machine_check = machine_check_generic,
.platform = "ppc603",
},
{ /* 604 */
@@ -459,6 +487,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 2,
.cpu_setup = __setup_cpu_604,
+ .machine_check = machine_check_generic,
.platform = "ppc604",
},
{ /* 604e */
@@ -471,6 +500,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_604,
+ .machine_check = machine_check_generic,
.platform = "ppc604",
},
{ /* 604r */
@@ -483,6 +513,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_604,
+ .machine_check = machine_check_generic,
.platform = "ppc604",
},
{ /* 604ev */
@@ -495,6 +526,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_604,
+ .machine_check = machine_check_generic,
.platform = "ppc604",
},
{ /* 740/750 (0x4202, don't support TAU ?) */
@@ -507,6 +539,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 750CX (80100 and 8010x?) */
@@ -519,6 +552,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750cx,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 750CX (82201 and 82202) */
@@ -531,6 +565,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750cx,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 750CXe (82214) */
@@ -543,6 +578,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750cx,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 750CXe "Gekko" (83214) */
@@ -555,6 +591,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750cx,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 750CL */
@@ -567,6 +604,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 745/755 */
@@ -579,6 +617,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 750FX rev 1.x */
@@ -591,6 +630,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 750FX rev 2.0 must disable HID0[DPM] */
@@ -603,6 +643,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 750FX (All revs except 2.0) */
@@ -615,6 +656,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750fx,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 750GX */
@@ -627,6 +669,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750fx,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 740/750 (L2CR bit need fixup for 740) */
@@ -639,6 +682,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_750,
+ .machine_check = machine_check_generic,
.platform = "ppc750",
},
{ /* 7400 rev 1.1 ? (no TAU) */
@@ -652,6 +696,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_7400,
+ .machine_check = machine_check_generic,
.platform = "ppc7400",
},
{ /* 7400 */
@@ -665,6 +710,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_7400,
+ .machine_check = machine_check_generic,
.platform = "ppc7400",
},
{ /* 7410 */
@@ -678,6 +724,7 @@ static struct cpu_spec __initdata cpu_sp
.dcache_bsize = 32,
.num_pmcs = 4,
.cpu_setup = __setup_cpu_7410,
+ .machine_check = machine_check_generic,
.platform = "ppc7400",
},
{ /* 7450 2.0 - no doze/nap */
@@ -693,6 +740,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_745x,
.oprofile_cpu_type = "ppc/7450",
.oprofile_type = PPC_OPROFILE_G4,
+ .machine_check = machine_check_generic,
.platform = "ppc7450",
},
{ /* 7450 2.1 */
@@ -708,6 +756,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_745x,
.oprofile_cpu_type = "ppc/7450",
.oprofile_type = PPC_OPROFILE_G4,
+ .machine_check = machine_check_generic,
.platform = "ppc7450",
},
{ /* 7450 2.3 and newer */
@@ -723,6 +772,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_745x,
.oprofile_cpu_type = "ppc/7450",
.oprofile_type = PPC_OPROFILE_G4,
+ .machine_check = machine_check_generic,
.platform = "ppc7450",
},
{ /* 7455 rev 1.x */
@@ -738,6 +788,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_745x,
.oprofile_cpu_type = "ppc/7450",
.oprofile_type = PPC_OPROFILE_G4,
+ .machine_check = machine_check_generic,
.platform = "ppc7450",
},
{ /* 7455 rev 2.0 */
@@ -753,6 +804,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_745x,
.oprofile_cpu_type = "ppc/7450",
.oprofile_type = PPC_OPROFILE_G4,
+ .machine_check = machine_check_generic,
.platform = "ppc7450",
},
{ /* 7455 others */
@@ -768,6 +820,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_745x,
.oprofile_cpu_type = "ppc/7450",
.oprofile_type = PPC_OPROFILE_G4,
+ .machine_check = machine_check_generic,
.platform = "ppc7450",
},
{ /* 7447/7457 Rev 1.0 */
@@ -783,6 +836,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_745x,
.oprofile_cpu_type = "ppc/7450",
.oprofile_type = PPC_OPROFILE_G4,
+ .machine_check = machine_check_generic,
.platform = "ppc7450",
},
{ /* 7447/7457 Rev 1.1 */
@@ -798,6 +852,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_745x,
.oprofile_cpu_type = "ppc/7450",
.oprofile_type = PPC_OPROFILE_G4,
+ .machine_check = machine_check_generic,
.platform = "ppc7450",
},
{ /* 7447/7457 Rev 1.2 and later */
@@ -812,6 +867,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_745x,
.oprofile_cpu_type = "ppc/7450",
.oprofile_type = PPC_OPROFILE_G4,
+ .machine_check = machine_check_generic,
.platform = "ppc7450",
},
{ /* 7447A */
@@ -827,6 +883,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_745x,
.oprofile_cpu_type = "ppc/7450",
.oprofile_type = PPC_OPROFILE_G4,
+ .machine_check = machine_check_generic,
.platform = "ppc7450",
},
{ /* 7448 */
@@ -842,6 +899,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_setup = __setup_cpu_745x,
.oprofile_cpu_type = "ppc/7450",
.oprofile_type = PPC_OPROFILE_G4,
+ .machine_check = machine_check_generic,
.platform = "ppc7450",
},
{ /* 82xx (8240, 8245, 8260 are all 603e cores) */
@@ -853,6 +911,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_603,
+ .machine_check = machine_check_generic,
.platform = "ppc603",
},
{ /* All G2_LE (603e core, plus some) have the same pvr */
@@ -864,6 +923,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_603,
+ .machine_check = machine_check_generic,
.platform = "ppc603",
},
{ /* e300c1 (a 603e core, plus some) on 83xx */
@@ -875,6 +935,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_603,
+ .machine_check = machine_check_generic,
.platform = "ppc603",
},
{ /* e300c2 (an e300c1 core, plus some, minus FPU) on 83xx */
@@ -886,6 +947,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_603,
+ .machine_check = machine_check_generic,
.platform = "ppc603",
},
{ /* e300c3 on 83xx */
@@ -897,6 +959,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_603,
+ .machine_check = machine_check_generic,
.platform = "ppc603",
},
{ /* default match, we assume split I/D cache & TB (non-601)... */
@@ -907,6 +970,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_generic,
.platform = "ppc603",
},
#endif /* CLASSIC_PPC */
@@ -933,6 +997,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
.icache_bsize = 16,
.dcache_bsize = 16,
+ .machine_check = machine_check_4xx,
.platform = "ppc403",
},
{ /* 403GCX */
@@ -944,6 +1009,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB,
.icache_bsize = 16,
.dcache_bsize = 16,
+ .machine_check = machine_check_4xx,
.platform = "ppc403",
},
{ /* 403G ?? */
@@ -954,6 +1020,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
.icache_bsize = 16,
.dcache_bsize = 16,
+ .machine_check = machine_check_4xx,
.platform = "ppc403",
},
{ /* 405GP */
@@ -965,6 +1032,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* STB 03xxx */
@@ -976,6 +1044,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* STB 04xxx */
@@ -987,6 +1056,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* NP405L */
@@ -998,6 +1068,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* NP4GS3 */
@@ -1009,6 +1080,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* NP405H */
@@ -1020,6 +1092,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* 405GPr */
@@ -1031,6 +1104,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* STBx25xx */
@@ -1042,6 +1116,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* 405LP */
@@ -1052,6 +1127,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* Xilinx Virtex-II Pro */
@@ -1063,6 +1139,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* Xilinx Virtex-4 FX */
@@ -1074,6 +1151,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* 405EP */
@@ -1085,6 +1163,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
{ /* 405EX */
@@ -1096,6 +1175,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc405",
},
@@ -1109,6 +1189,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_BOOKE,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc440",
},
{ /* Use logical PVR for 440EP (logical pvr = pvr | 0x8) */
@@ -1120,6 +1201,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_440ep,
+ .machine_check = machine_check_4xx,
.platform = "ppc440",
},
{
@@ -1130,6 +1212,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc440",
},
{ /* Use logical PVR for 440EP (logical pvr = pvr | 0x8) */
@@ -1141,6 +1224,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_440ep,
+ .machine_check = machine_check_4xx,
.platform = "ppc440",
},
{ /* 440GRX */
@@ -1152,6 +1236,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_440grx,
+ .machine_check = machine_check_4xx,
.platform = "ppc440",
},
{ /* Use logical PVR for 440EPx (logical pvr = pvr | 0x8) */
@@ -1163,6 +1248,7 @@ static struct cpu_spec __initdata cpu_sp
.icache_bsize = 32,
.dcache_bsize = 32,
.cpu_setup = __setup_cpu_440epx,
+ .machine_check = machine_check_440A,
.platform = "ppc440",
},
{ /* 440GP Rev. B */
@@ -1173,6 +1259,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_BOOKE,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc440gp",
},
{ /* 440GP Rev. C */
@@ -1183,6 +1270,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_BOOKE,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc440gp",
},
{ /* 440GX Rev. A */
@@ -1193,6 +1281,8 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_BOOKE,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .cpu_setup = __setup_cpu_440gx,
+ .machine_check = machine_check_440A,
.platform = "ppc440",
},
{ /* 440GX Rev. B */
@@ -1203,6 +1293,8 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_BOOKE,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .cpu_setup = __setup_cpu_440gx,
+ .machine_check = machine_check_440A,
.platform = "ppc440",
},
{ /* 440GX Rev. C */
@@ -1213,6 +1305,8 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_BOOKE,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .cpu_setup = __setup_cpu_440gx,
+ .machine_check = machine_check_440A,
.platform = "ppc440",
},
{ /* 440GX Rev. F */
@@ -1223,6 +1317,8 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_BOOKE,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .cpu_setup = __setup_cpu_440gx,
+ .machine_check = machine_check_440A,
.platform = "ppc440",
},
{ /* 440SP Rev. A */
@@ -1233,6 +1329,7 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_BOOKE,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .machine_check = machine_check_4xx,
.platform = "ppc440",
},
{ /* 440SPe Rev. A */
@@ -1243,6 +1340,8 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_BOOKE,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .cpu_setup = __setup_cpu_440spe,
+ .machine_check = machine_check_440A,
.platform = "ppc440",
},
{ /* 440SPe Rev. B */
@@ -1253,6 +1352,8 @@ static struct cpu_spec __initdata cpu_sp
.cpu_user_features = COMMON_USER_BOOKE,
.icache_bsize = 32,
.dcache_bsize = 32,
+ .cpu_setup = __setup_cpu_440spe,
+ .machine_check = machine_check_440A,
.platform = "ppc440",
},
#endif /* CONFIG_44x */
@@ -1267,6 +1368,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_EFP_SINGLE |
PPC_FEATURE_UNIFIED_CACHE,
.dcache_bsize = 32,
+ .machine_check = machine_check_e200,
.platform = "ppc5554",
},
{ /* e200z6 */
@@ -1280,6 +1382,7 @@ static struct cpu_spec __initdata cpu_sp
PPC_FEATURE_HAS_EFP_SINGLE_COMP |
PPC_FEATURE_UNIFIED_CACHE,
.dcache_bsize = 32,
+ .machine_check = machine_check_e200,
.platform = "ppc5554",
},
{ /* e500 */
@@ -1296,6 +1399,7 @@ static struct cpu_spec __initdata cpu_sp
.num_pmcs = 4,
.oprofile_cpu_type = "ppc/e500",
.oprofile_type = PPC_OPROFILE_BOOKE,
+ .machine_check = machine_check_e500,
.platform = "ppc8540",
},
{ /* e500v2 */
@@ -1313,6 +1417,7 @@ static struct cpu_spec __initdata cpu_sp
.num_pmcs = 4,
.oprofile_cpu_type = "ppc/e500",
.oprofile_type = PPC_OPROFILE_BOOKE,
+ .machine_check = machine_check_e500,
.platform = "ppc8548",
},
#endif
Index: linux-work/arch/powerpc/kernel/head_44x.S
===================================================================
--- linux-work.orig/arch/powerpc/kernel/head_44x.S 2007-12-03 11:48:03.000000000 +1100
+++ linux-work/arch/powerpc/kernel/head_44x.S 2007-12-03 12:05:58.000000000 +1100
@@ -289,11 +289,8 @@ interrupt_base:
CRITICAL_EXCEPTION(0x0100, CriticalInput, unknown_exception)
/* Machine Check Interrupt */
-#ifdef CONFIG_440A
- MCHECK_EXCEPTION(0x0200, MachineCheck, machine_check_exception)
-#else
CRITICAL_EXCEPTION(0x0200, MachineCheck, machine_check_exception)
-#endif
+ MCHECK_EXCEPTION(0x0210, MachineCheckA, machine_check_exception)
/* Data Storage Interrupt */
START_EXCEPTION(DataStorage)
@@ -674,6 +671,15 @@ finish_tlb_load:
*/
/*
+ * Adjust the machine check IVOR on 440A cores
+ */
+_GLOBAL(__fixup_440A_mcheck)
+ li r3,MachineCheckA@l
+ mtspr SPRN_IVOR1,r3
+ sync
+ blr
+
+/*
* extern void giveup_altivec(struct task_struct *prev)
*
* The 44x core does not have an AltiVec unit.
Index: linux-work/arch/powerpc/kernel/traps.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/traps.c 2007-12-03 11:48:03.000000000 +1100
+++ linux-work/arch/powerpc/kernel/traps.c 2007-12-03 15:00:10.000000000 +1100
@@ -334,18 +334,25 @@ static inline int check_io_access(struct
#define clear_single_step(regs) ((regs)->msr &= ~MSR_SE)
#endif
-static int generic_machine_check_exception(struct pt_regs *regs)
+#if defined(CONFIG_4xx)
+int machine_check_4xx(struct pt_regs *regs)
{
unsigned long reason = get_mc_reason(regs);
-#if defined(CONFIG_4xx) && !defined(CONFIG_440A)
if (reason & ESR_IMCP) {
printk("Instruction");
mtspr(SPRN_ESR, reason & ~ESR_IMCP);
} else
printk("Data");
printk(" machine check in kernel mode.\n");
-#elif defined(CONFIG_440A)
+
+ return 0;
+}
+
+int machine_check_440A(struct pt_regs *regs)
+{
+ unsigned long reason = get_mc_reason(regs);
+
printk("Machine check in kernel mode.\n");
if (reason & ESR_IMCP){
printk("Instruction Synchronous Machine Check exception\n");
@@ -375,7 +382,13 @@ static int generic_machine_check_excepti
/* Clear MCSR */
mtspr(SPRN_MCSR, mcsr);
}
-#elif defined (CONFIG_E500)
+ return 0;
+}
+#elif defined(CONFIG_E500)
+int machine_check_e500(struct pt_regs *regs)
+{
+ unsigned long reason = get_mc_reason(regs);
+
printk("Machine check in kernel mode.\n");
printk("Caused by (from MCSR=%lx): ", reason);
@@ -403,7 +416,14 @@ static int generic_machine_check_excepti
printk("Bus - Instruction Parity Error\n");
if (reason & MCSR_BUS_RPERR)
printk("Bus - Read Parity Error\n");
-#elif defined (CONFIG_E200)
+
+ return 0;
+}
+#elif defined(CONFIG_E200)
+int machine_check_e200(struct pt_regs *regs)
+{
+ unsigned long reason = get_mc_reason(regs);
+
printk("Machine check in kernel mode.\n");
printk("Caused by (from MCSR=%lx): ", reason);
@@ -421,7 +441,14 @@ static int generic_machine_check_excepti
printk("Bus - Read Bus Error on data load\n");
if (reason & MCSR_BUS_WRERR)
printk("Bus - Write Bus Error on buffered store or cache line push\n");
-#else /* !CONFIG_4xx && !CONFIG_E500 && !CONFIG_E200 */
+
+ return 0;
+}
+#else
+int machine_check_generic(struct pt_regs *regs)
+{
+ unsigned long reason = get_mc_reason(regs);
+
printk("Machine check in kernel mode.\n");
printk("Caused by (from SRR1=%lx): ", reason);
switch (reason & 0x601F0000) {
@@ -451,22 +478,26 @@ static int generic_machine_check_excepti
default:
printk("Unknown values in msr\n");
}
-#endif /* CONFIG_4xx */
-
return 0;
}
+#endif /* everything else */
void machine_check_exception(struct pt_regs *regs)
{
int recover = 0;
- /* See if any machine dependent calls */
+ /* See if any machine dependent calls. In theory, we would want
+ * to call the CPU first, and call the ppc_md. one if the CPU
+ * one returns a positive number. However there is existing code
+ * that assumes the board gets a first chance, so let's keep it
+ * that way for now and fix things later. --BenH.
+ */
if (ppc_md.machine_check_exception)
recover = ppc_md.machine_check_exception(regs);
- else
- recover = generic_machine_check_exception(regs);
+ else if (cur_cpu_spec->machine_check)
+ recover = cur_cpu_spec->machine_check(regs);
- if (recover)
+ if (recover > 0)
return;
if (user_mode(regs)) {
@@ -476,7 +507,12 @@ void machine_check_exception(struct pt_r
}
#if defined(CONFIG_8xx) && defined(CONFIG_PCI)
- /* the qspan pci read routines can cause machine checks -- Cort */
+ /* the qspan pci read routines can cause machine checks -- Cort
+ *
+ * yuck !!! that totally needs to go away ! There are better ways
+ * to deal with that than having a wart in the mcheck handler.
+ * -- BenH
+ */
bad_page_fault(regs, regs->dar, SIGBUS);
return;
#endif
Index: linux-work/arch/powerpc/platforms/44x/Kconfig
===================================================================
--- linux-work.orig/arch/powerpc/platforms/44x/Kconfig 2007-12-03 11:48:03.000000000 +1100
+++ linux-work/arch/powerpc/platforms/44x/Kconfig 2007-12-03 14:28:01.000000000 +1100
@@ -62,11 +62,6 @@ config 440GX
config 440SP
bool
-config 440A
- bool
- depends on 440GX || 440EPX
- default y
-
# 44x errata/workaround config symbols, selected by the CPU models above
config IBM440EP_ERR42
bool
Index: linux-work/arch/powerpc/kernel/head_booke.h
===================================================================
--- linux-work.orig/arch/powerpc/kernel/head_booke.h 2007-12-03 11:48:03.000000000 +1100
+++ linux-work/arch/powerpc/kernel/head_booke.h 2007-12-03 12:05:58.000000000 +1100
@@ -166,7 +166,7 @@ label:
mfspr r5,SPRN_ESR; \
stw r5,_ESR(r11); \
addi r3,r1,STACK_FRAME_OVERHEAD; \
- EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
+ EXC_XFER_TEMPLATE(hdlr, n+4, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
NOCOPY, mcheck_transfer_to_handler, \
ret_from_mcheck_exc)
Index: linux-work/include/asm-powerpc/ptrace.h
===================================================================
--- linux-work.orig/include/asm-powerpc/ptrace.h 2007-12-03 11:48:03.000000000 +1100
+++ linux-work/include/asm-powerpc/ptrace.h 2007-12-03 12:05:58.000000000 +1100
@@ -106,7 +106,8 @@ extern int ptrace_put_reg(struct task_st
*/
#define FULL_REGS(regs) (((regs)->trap & 1) == 0)
#ifndef __powerpc64__
-#define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) == 0)
+#define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0)
+#define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0)
#endif /* ! __powerpc64__ */
#define TRAP(regs) ((regs)->trap & ~0xF)
#ifdef __powerpc64__
Index: linux-work/include/asm-powerpc/reg_booke.h
===================================================================
--- linux-work.orig/include/asm-powerpc/reg_booke.h 2007-12-03 11:48:03.000000000 +1100
+++ linux-work/include/asm-powerpc/reg_booke.h 2007-12-03 12:05:58.000000000 +1100
@@ -207,7 +207,6 @@
#define CCR1_TCS 0x00000080 /* Timer Clock Select */
/* Bit definitions for the MCSR. */
-#ifdef CONFIG_440A
#define MCSR_MCS 0x80000000 /* Machine Check Summary */
#define MCSR_IB 0x40000000 /* Instruction PLB Error */
#define MCSR_DRB 0x20000000 /* Data Read PLB Error */
@@ -217,7 +216,7 @@
#define MCSR_DCSP 0x02000000 /* D-Cache Search Parity Error */
#define MCSR_DCFP 0x01000000 /* D-Cache Flush Parity Error */
#define MCSR_IMPE 0x00800000 /* Imprecise Machine Check Exception */
-#endif
+
#ifdef CONFIG_E500
#define MCSR_MCP 0x80000000UL /* Machine Check Input Pin */
#define MCSR_ICPERR 0x40000000UL /* I-Cache Parity Error */
Index: linux-work/include/asm-powerpc/cputable.h
===================================================================
--- linux-work.orig/include/asm-powerpc/cputable.h 2007-12-03 14:28:42.000000000 +1100
+++ linux-work/include/asm-powerpc/cputable.h 2007-12-03 14:56:04.000000000 +1100
@@ -57,6 +57,14 @@ enum powerpc_pmc_type {
PPC_PMC_PA6T = 2,
};
+struct pt_regs;
+
+extern int machine_check_generic(struct pt_regs *regs);
+extern int machine_check_4xx(struct pt_regs *regs);
+extern int machine_check_440A(struct pt_regs *regs);
+extern int machine_check_e500(struct pt_regs *regs);
+extern int machine_check_e200(struct pt_regs *regs);
+
/* NOTE WELL: Update identify_cpu() if fields are added or removed! */
struct cpu_spec {
/* CPU is matched via (PVR & pvr_mask) == pvr_value */
@@ -97,6 +105,11 @@ struct cpu_spec {
/* Name of processor class, for the ELF AT_PLATFORM entry */
char *platform;
+
+ /* Processor specific machine check handling. Return negative
+ * if the error is fatal, 1 if it was fully recovered and 0 to
+ * pass up (not CPU originated) */
+ int (*machine_check)(struct pt_regs *regs);
};
extern struct cpu_spec *cur_cpu_spec;
^ 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