dtc: Fix silly typo in dtc-checkfails.sh

2007-12-06 Thread David Gibson
Too much C coding makes for dumb errors in shell.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: dtc/tests/dtc-checkfails.sh
===
--- dtc.orig/tests/dtc-checkfails.sh2007-12-07 17:14:52.0 +1100
+++ dtc/tests/dtc-checkfails.sh 2007-12-07 17:15:21.0 +1100
@@ -23,7 +23,7 @@ fi
 
 for c in $CHECKS; do
 if ! grep -E "^(ERROR)|(Warning) \($c\):" $LOG > /dev/null; then
-   FAIL "Failed to trigger check \"%c\""
+   FAIL "Failed to trigger check \"$c\""
 fi
 done
 

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


dtc: Allow gcc format warnings for check_msg()

2007-12-06 Thread David Gibson
check_msg() takes printf() like arguments, so tell gcc to produce
printf() like warnings for it.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: dtc/checks.c
===
--- dtc.orig/checks.c   2007-12-07 17:10:23.0 +1100
+++ dtc/checks.c2007-12-07 17:13:16.0 +1100
@@ -87,6 +87,9 @@ struct check {
 #define BATCH_CHECK(nm, lvl, ...) \
CHECK(nm, NULL, NULL, NULL, NULL, lvl, __VA_ARGS__)
 
+#ifdef __GNUC__
+static inline void check_msg(struct check *c, const char *fmt, ...) 
__attribute__((format (printf, 2, 3)));
+#endif
 static inline void check_msg(struct check *c, const char *fmt, ...)
 {
va_list ap;

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 11/25] powerpc: 4xx PLB to PCI Express support

2007-12-06 Thread Stefan Roese
On Thursday 06 December 2007, Benjamin Herrenschmidt wrote:
> > > +/* Check that the core has been initied and if not, do it */
> > > +static int __init ppc4xx_pciex_check_core_init(struct device_node *np)
> > > +{
> > > + static int core_init;
> > > + int count = -ENODEV;
> > > +
> > > + if (core_init++)
> > > + return 0;
> > > +
> > > +#ifdef CONFIG_44x
> > > + if (of_device_is_compatible(np, "ibm,plb-pciex-440speA"))
> > > + ppc4xx_pciex_hwops = &ppc440speA_pcie_hwops;
> > > + else if (of_device_is_compatible(np, "ibm,plb-pciex-440speB"))
> > > + ppc4xx_pciex_hwops = &ppc440speB_pcie_hwops;
> >
> > We need some runtime detection of the 440SPe revision here. There are
> > boards out there (e.g. AMCC Yucca) which can be equipped with both PPC
> > revisions. :-(
>
> Ah... crap ! Do you think we should put that in the boot wrapper and
> fixup the device-tree or should we put it in the PCIe code proper ?

How about this: We change the compatible node to "plb-pciex-440spe" 
(without "A" and "B) and make a PVR runtime detection in the 4xx-pci driver.

What do you think? Should I prepare a patch for this?

> > > +#endif /* CONFIG_44x*/
> > > +#ifdef CONFIG_40x
> > > + if (of_device_is_compatible(np, "ibm,plb-pciex-405ex"))
> > > + ppc4xx_pciex_hwops = &ppc405ex_pcie_hwops;
> > > +#endif
> >
> > Why those #ifdef's? Just code-size reasons, since 40x and 44x will most
> > likely never be built into one image?
>
> Code size... I know how keen embedded people are to keep their kernel
> small and as of today, you can't build 40x and 44x support in the same
> image, so I didn't want to be blamed for adding bloat in that case :-)

Ok. Thanks.

Best regards,
Stefan
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [POWERPC] eeh: avoid a possible NULL pointer dereference

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/pseries/eeh_driver.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c 
b/arch/powerpc/platforms/pseries/eeh_driver.c
index 06b89b5..68ea5ee 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -310,8 +310,6 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
const char *location, *pci_str, *drv_str;
 
frozen_dn = find_device_pe(event->dn);
-   frozen_bus = pcibios_find_pci_bus(frozen_dn);
-
if (!frozen_dn) {
 
location = of_get_property(event->dn, "ibm,loc-code", NULL);
@@ -321,6 +319,8 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
location, pci_name(event->dev));
return NULL;
}
+
+   frozen_bus = pcibios_find_pci_bus(frozen_dn);
location = of_get_property(frozen_dn, "ibm,loc-code", NULL);
location = location ? location : "unknown";
 
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[RFC][POWERPC] Provide a way to protect 4k subpages when using 64k pages

2007-12-06 Thread Paul Mackerras
Using 64k pages on 64-bit PowerPC systems makes life difficult for
emulators that are trying to emulate an ISA, such as x86, which use a
smaller page size, since the emulator can no longer use the MMU and
the normal system calls for controlling page protections.  Of course,
the emulator can emulate the MMU by checking and possibly remapping
the address for each memory access in software, but that is pretty
slow.

This patch provides a facility for such programs to control the access
permissions on individual 4k sub-pages of a 64k page.  The idea is
that the emulator supplies an array of protection masks to apply to a
specified range of virtual addresses.  These masks are applied at the
level where hardware PTEs are inserted into the hardware page table
based on the Linux PTEs, so the Linux PTEs are not affected.  Note
that this new mechanism does not allow any access that would otherwise
be prohibited; it can only prohibit accesses that would otherwise be
allowed.  This new facility is only available on 64-bit PowerPC and
only when the kernel is configured for 64k pages.

The masks are supplied using a new subpage_prot system call, which
takes a starting virtual address and length, and a pointer to an array
of protection masks in memory.  The array has a 32-bit word per 64k
page to be protected; each 32-bit word consists of 16 2-bit fields,
for which 0 allows any access (that is otherwise allowed), 1 prevents
write accesses, and 2 or 3 prevent any access.

Implicit in this is that the regions of the address space that are
protected are switched to use 4k hardware pages rather than 64k
hardware pages (on machines with hardware 64k page support).  In fact
the whole process is switched to use 4k hardware pages when the
subpage_prot system call is used, but this could be improved in future
to switch only the affected segments.

I have re-purposed the ioperm system call for this.  The old ioperm
system call never did anything (except return an ENOSYS error) and in
fact never could have actually been useful for anything on the PowerPC
architecture, so nothing ever used it.

Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 232c298..0f5b968 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -340,6 +340,14 @@ config PPC_64K_PAGES
  while on hardware with such support, it will be used to map
  normal application pages.
 
+config PPC_SUBPAGE_PROT
+   bool "Support setting protections for 4k subpages"
+   depends on PPC_64K_PAGES
+   help
+ This option adds support for a system call to allow user programs
+ to set access permissions (read/write, readonly, or no access)
+ on the 4k subpages of each 64k page.
+
 config SCHED_SMT
bool "SMT (Hyperthreading) scheduler support"
depends on PPC64 && SMP
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index c349868..11b4f6d 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -903,6 +903,7 @@ handle_page_fault:
  * the PTE insertion
  */
 12:bl  .save_nvgprs
+   mr  r5,r3
addir3,r1,STACK_FRAME_OVERHEAD
ld  r4,_DAR(r1)
bl  .low_hash_fault
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 3b1d5dd..5aabf48 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -36,12 +36,14 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 /*
  * sys_ipc() is the de-multiplexer for the SysV IPC calls..
@@ -328,3 +330,174 @@ void do_show_syscall_exit(unsigned long r3)
 {
printk(" -> %lx, current=%p cpu=%d\n", r3, current, smp_processor_id());
 }
+
+#ifdef CONFIG_PPC_SUBPAGE_PROT
+/*
+ * Clear the subpage protection map for an address range, allowing
+ * all accesses that are allowed by the pte permissions.
+ */
+static void subpage_prot_clear(unsigned long addr, unsigned long len)
+{
+   struct mm_struct *mm = current->mm;
+   pgd_t *pgd;
+   pud_t *pud;
+   pmd_t *pmd, *spm;
+   pte_t *pte;
+   u32 *spp;
+   spinlock_t *ptl;
+   int i, nw;
+   unsigned long next, limit;
+
+   down_write(&mm->mmap_sem);
+   for (limit = addr + len; addr < limit; addr = next) {
+   next = pmd_addr_end(addr, limit);
+   pgd = pgd_offset(mm, addr);
+   if (pgd_none(*pgd))
+   continue;   /* can't happen with 3-level tables */
+   pud = pud_offset(pgd, addr);
+   if (pud_none(*pud))
+   continue;
+   pmd = pmd_offset(pud, addr);
+   if (!pmd)
+   continue;
+   for (; addr < next; ++pmd) {
+   spm = pmd + PTRS_PER_PMD;
+   spp = (u32 *) pmd_val(*spm);
+   i = (addr >> PAG

[PATCH 3/3] [POWERPC] iSeries: merge vpdinfo.c intp pci.c

2007-12-06 Thread Stephen Rothwell
There was only one global function in vpdinfo.c and it was only called
from pci.c, so merge them and make the function static.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/Makefile  |2 +-
 arch/powerpc/platforms/iseries/pci.c |  218 ++
 arch/powerpc/platforms/iseries/pci.h |6 -
 arch/powerpc/platforms/iseries/vpdinfo.c |  252 --
 4 files changed, 219 insertions(+), 259 deletions(-)
 delete mode 100644 arch/powerpc/platforms/iseries/vpdinfo.c

diff --git a/arch/powerpc/platforms/iseries/Makefile 
b/arch/powerpc/platforms/iseries/Makefile
index a65f1b4..cc7161f 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -5,7 +5,7 @@ extra-y += dt.o
 obj-y += exception.o
 obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \
hvcall.o proc.o htab.o iommu.o misc.o irq.o
-obj-$(CONFIG_PCI) += pci.o vpdinfo.o
+obj-$(CONFIG_PCI) += pci.o
 obj-$(CONFIG_SMP) += smp.o
 obj-$(CONFIG_VIOPATH) += viopath.o vio.o
 obj-$(CONFIG_MODULES) += ksyms.o
diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index 5466975..68f248b 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2001 Allan Trautman, IBM Corporation
+ * Copyright (C) 2005,2007  Stephen Rothwell, IBM Corp
  *
  * iSeries specific routines for PCI.
  *
@@ -26,6 +27,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -35,6 +37,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -80,6 +83,221 @@ static inline u64 iseries_ds_addr(struct device_node *node)
 }
 
 /*
+ * Size of Bus VPD data
+ */
+#define BUS_VPDSIZE  1024
+
+/*
+ * Bus Vpd Tags
+ */
+#define VPD_END_OF_AREA0x79
+#define VPD_ID_STRING  0x82
+#define VPD_VENDOR_AREA0x84
+
+/*
+ * Mfg Area Tags
+ */
+#define VPD_FRU_FRAME_ID   0x4649  /* "FI" */
+#define VPD_SLOT_MAP_FORMAT0x4D46  /* "MF" */
+#define VPD_SLOT_MAP   0x534D  /* "SM" */
+
+/*
+ * Structures of the areas
+ */
+struct mfg_vpd_area {
+   u16 tag;
+   u8  length;
+   u8  data1;
+   u8  data2;
+};
+#define MFG_ENTRY_SIZE   3
+
+struct slot_map {
+   u8  agent;
+   u8  secondary_agent;
+   u8  phb;
+   charcard_location[3];
+   charparms[8];
+   charreserved[2];
+};
+#define SLOT_ENTRY_SIZE   16
+
+/*
+ * Parse the Slot Area
+ */
+static void __init iseries_parse_slot_area(struct slot_map *map, int len,
+   HvAgentId agent, u8 *phb, char card[4])
+{
+   /*
+* Parse Slot label until we find the one requested
+*/
+   while (len > 0) {
+   if (map->agent == agent) {
+   /*
+* If Phb wasn't found, grab the entry first one found.
+*/
+   if (*phb == 0xff)
+   *phb = map->phb;
+   /* Found it, extract the data. */
+   if (map->phb == *phb) {
+   memcpy(card, &map->card_location, 3);
+   card[3]  = 0;
+   break;
+   }
+   }
+   /* Point to the next Slot */
+   map = (struct slot_map *)((char *)map + SLOT_ENTRY_SIZE);
+   len -= SLOT_ENTRY_SIZE;
+   }
+}
+
+/*
+ * Parse the Mfg Area
+ */
+static void __init iseries_parse_mfg_area(struct mfg_vpd_area *area, int len,
+   HvAgentId agent, u8 *phb, u8 *frame, char card[4])
+{
+   u16 slot_map_fmt = 0;
+
+   /* Parse Mfg Data */
+   while (len > 0) {
+   int mfg_tag_len = area->length;
+   /* Frame ID (FI 4649020310 ) */
+   if (area->tag == VPD_FRU_FRAME_ID)
+   *frame = area->data1;
+   /* Slot Map Format  (MF 4D46020004 ) */
+   else if (area->tag == VPD_SLOT_MAP_FORMAT)
+   slot_map_fmt = (area->data1 * 256)
+   + area->data2;
+   /* Slot Map (SM 534D90 */
+   else if (area->tag == VPD_SLOT_MAP) {
+   struct slot_map *slot_map;
+
+   if (slot_map_fmt == 0x1004)
+   slot_map = (struct slot_map *)((char *)area
+   + MFG_ENTRY_SIZE + 1);
+   else
+   slot_map = (struct slot_map *)((char *)area
+   + MFG_ENTRY_SIZE);
+   iseries_parse_slot_area(slot_map, mfg_tag_len,
+   agent, phb, card);
+   }
+   /*
+

[PATCH 2/3] [POWERPC] iSeries: clean up and simplify vdpinfo.c

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/vpdinfo.c |  100 ++
 1 files changed, 46 insertions(+), 54 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/vpdinfo.c 
b/arch/powerpc/platforms/iseries/vpdinfo.c
index f9415bf..aec82e3 100644
--- a/arch/powerpc/platforms/iseries/vpdinfo.c
+++ b/arch/powerpc/platforms/iseries/vpdinfo.c
@@ -82,62 +82,56 @@ struct slot_map {
 static void __init iseries_parse_slot_area(struct slot_map *map, int len,
HvAgentId agent, u8 *phb, char card[4])
 {
-   int slot_map_len = len;
-   struct slot_map *slot_map = map;
-
/*
 * Parse Slot label until we find the one requested
 */
-   while (slot_map_len > 0) {
-   if (slot_map->agent == agent) {
+   while (len > 0) {
+   if (map->agent == agent) {
/*
 * If Phb wasn't found, grab the entry first one found.
 */
if (*phb == 0xff)
-   *phb = slot_map->phb;
+   *phb = map->phb;
/* Found it, extract the data. */
-   if (slot_map->phb == *phb) {
-   memcpy(card, &slot_map->card_location, 3);
+   if (map->phb == *phb) {
+   memcpy(card, &map->card_location, 3);
card[3]  = 0;
break;
}
}
/* Point to the next Slot */
-   slot_map = (struct slot_map *)((char *)slot_map + 
SLOT_ENTRY_SIZE);
-   slot_map_len -= SLOT_ENTRY_SIZE;
+   map = (struct slot_map *)((char *)map + SLOT_ENTRY_SIZE);
+   len -= SLOT_ENTRY_SIZE;
}
 }
 
 /*
  * Parse the Mfg Area
  */
-static void __init iseries_parse_mfg_area(u8 *area, int len,
-   HvAgentId agent, u8 *phb,
-   u8 *frame, char card[4])
+static void __init iseries_parse_mfg_area(struct mfg_vpd_area *area, int len,
+   HvAgentId agent, u8 *phb, u8 *frame, char card[4])
 {
-   struct mfg_vpd_area *mfg_area = (struct mfg_vpd_area *)area;
-   int mfg_area_len = len;
u16 slot_map_fmt = 0;
 
/* Parse Mfg Data */
-   while (mfg_area_len > 0) {
-   int mfg_tag_len = mfg_area->length;
+   while (len > 0) {
+   int mfg_tag_len = area->length;
/* Frame ID (FI 4649020310 ) */
-   if (mfg_area->tag == VPD_FRU_FRAME_ID)
-   *frame = mfg_area->data1;
+   if (area->tag == VPD_FRU_FRAME_ID)
+   *frame = area->data1;
/* Slot Map Format  (MF 4D46020004 ) */
-   else if (mfg_area->tag == VPD_SLOT_MAP_FORMAT)
-   slot_map_fmt = (mfg_area->data1 * 256)
-   + mfg_area->data2;
+   else if (area->tag == VPD_SLOT_MAP_FORMAT)
+   slot_map_fmt = (area->data1 * 256)
+   + area->data2;
/* Slot Map (SM 534D90 */
-   else if (mfg_area->tag == VPD_SLOT_MAP) {
+   else if (area->tag == VPD_SLOT_MAP) {
struct slot_map *slot_map;
 
if (slot_map_fmt == 0x1004)
-   slot_map = (struct slot_map *)((char *)mfg_area
+   slot_map = (struct slot_map *)((char *)area
+ MFG_ENTRY_SIZE + 1);
else
-   slot_map = (struct slot_map *)((char *)mfg_area
+   slot_map = (struct slot_map *)((char *)area
+ MFG_ENTRY_SIZE);
iseries_parse_slot_area(slot_map, mfg_tag_len,
agent, phb, card);
@@ -146,9 +140,9 @@ static void __init iseries_parse_mfg_area(u8 *area, int len,
 * Point to the next Mfg Area
 * Use defined size, sizeof give wrong answer
 */
-   mfg_area = (struct mfg_vpd_area *)((char *)mfg_area + 
mfg_tag_len
+   area = (struct mfg_vpd_area *)((char *)area + mfg_tag_len
+ MFG_ENTRY_SIZE);
-   mfg_area_len -= (mfg_tag_len + MFG_ENTRY_SIZE);
+   len -= (mfg_tag_len + MFG_ENTRY_SIZE);
}
 }
 
@@ -156,48 +150,46 @@ static void __init iseries_parse_mfg_area(u8 *area, int 
len,
  * Look for "BUS".. Data is not Null terminated.
  * PHBID of 0xFF indicates PHB was not found in VPD Data.
  */
-static int __init iseries_parse_phbid(u8 *area, int len)
+static u8 __init iseries_parse_phbid(u8 *area, int len)
 {
-   u8 *phb_ptr = area;
-   

[PATCH 1/3] [POWERPC] iSeries: DeCamelCase vpdinfo.c

2007-12-06 Thread Stephen Rothwell
This is a purely mechanical transformation.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |2 +-
 arch/powerpc/platforms/iseries/pci.h |2 +-
 arch/powerpc/platforms/iseries/vpdinfo.c |  188 +++---
 3 files changed, 95 insertions(+), 97 deletions(-)

These three follow on from the 19 I posted last night.

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index 3071a30..5466975 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -227,7 +227,7 @@ void __init iSeries_pci_final_fixup(void)
pdev->sysdata = node;
PCI_DN(node)->pcidev = pdev;
allocate_device_bars(pdev);
-   iSeries_Device_Information(pdev, num_dev, bus, *sub_bus);
+   iseries_device_information(pdev, num_dev, bus, *sub_bus);
iommu_devnode_init_iSeries(pdev, node);
}
iSeries_activate_IRQs();
diff --git a/arch/powerpc/platforms/iseries/pci.h 
b/arch/powerpc/platforms/iseries/pci.h
index b142873..5f517cf 100644
--- a/arch/powerpc/platforms/iseries/pci.h
+++ b/arch/powerpc/platforms/iseries/pci.h
@@ -47,7 +47,7 @@ struct pci_dev;   /* For Forward 
Reference */
 #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7)
 #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)   ((subbus >> 2) & 0x7)
 
-extern voidiSeries_Device_Information(struct pci_dev *PciDev, int count,
+extern voidiseries_device_information(struct pci_dev *pdev, int count,
u16 bus, HvSubBusNumber subbus);
 #ifdef CONFIG_PCI
 extern voidiSeries_pcibios_init(void);
diff --git a/arch/powerpc/platforms/iseries/vpdinfo.c 
b/arch/powerpc/platforms/iseries/vpdinfo.c
index 25dc0bb..f9415bf 100644
--- a/arch/powerpc/platforms/iseries/vpdinfo.c
+++ b/arch/powerpc/platforms/iseries/vpdinfo.c
@@ -44,113 +44,111 @@
 /*
  * Bus Vpd Tags
  */
-#define  VpdEndOfAreaTag   0x79
-#define  VpdIdStringTag0x82
-#define  VpdVendorAreaTag  0x84
+#define VPD_END_OF_AREA0x79
+#define VPD_ID_STRING  0x82
+#define VPD_VENDOR_AREA0x84
 
 /*
  * Mfg Area Tags
  */
-#define  VpdFruFrameId0x4649 // "FI"
-#define  VpdSlotMapFormat 0x4D46 // "MF"
-#define  VpdSlotMap   0x534D // "SM"
+#define VPD_FRU_FRAME_ID   0x4649  /* "FI" */
+#define VPD_SLOT_MAP_FORMAT0x4D46  /* "MF" */
+#define VPD_SLOT_MAP   0x534D  /* "SM" */
 
 /*
  * Structures of the areas
  */
-struct MfgVpdAreaStruct {
-   u16 Tag;
-   u8  TagLength;
-   u8  AreaData1;
-   u8  AreaData2;
+struct mfg_vpd_area {
+   u16 tag;
+   u8  length;
+   u8  data1;
+   u8  data2;
 };
-typedef struct MfgVpdAreaStruct MfgArea;
 #define MFG_ENTRY_SIZE   3
 
-struct SlotMapStruct {
-   u8   AgentId;
-   u8   SecondaryAgentId;
-   u8   PhbId;
-   char CardLocation[3];
-   char Parms[8];
-   char Reserved[2];
+struct slot_map {
+   u8  agent;
+   u8  secondary_agent;
+   u8  phb;
+   charcard_location[3];
+   charparms[8];
+   charreserved[2];
 };
-typedef struct SlotMapStruct SlotMap;
 #define SLOT_ENTRY_SIZE   16
 
 /*
  * Parse the Slot Area
  */
-static void __init iSeries_Parse_SlotArea(SlotMap *MapPtr, int MapLen,
-   HvAgentId agent, u8 *PhbId, char card[4])
+static void __init iseries_parse_slot_area(struct slot_map *map, int len,
+   HvAgentId agent, u8 *phb, char card[4])
 {
-   int SlotMapLen = MapLen;
-   SlotMap *SlotMapPtr = MapPtr;
+   int slot_map_len = len;
+   struct slot_map *slot_map = map;
 
/*
 * Parse Slot label until we find the one requested
 */
-   while (SlotMapLen > 0) {
-   if (SlotMapPtr->AgentId == agent) {
+   while (slot_map_len > 0) {
+   if (slot_map->agent == agent) {
/*
 * If Phb wasn't found, grab the entry first one found.
 */
-   if (*PhbId == 0xff)
-   *PhbId = SlotMapPtr->PhbId;
+   if (*phb == 0xff)
+   *phb = slot_map->phb;
/* Found it, extract the data. */
-   if (SlotMapPtr->PhbId == *PhbId) {
-   memcpy(card, &SlotMapPtr->CardLocation, 3);
+   if (slot_map->phb == *phb) {
+   memcpy(card, &slot_map->card_location, 3);
card[3]  = 0;
break;
}
}
/* Point to the next Slot */
-   SlotMapPtr = (SlotMap *)((char *)SlotMapPtr + SLOT_ENTRY_SIZE);
-   SlotMapLen -= SLOT

Re: [PATCH 1/3] POWERPC: don't cast a pointer to pointer of list_head

2007-12-06 Thread Li Zefan
Nick Piggin 写道:
> On Thursday 06 December 2007 20:33, Li Zefan wrote:
>> The casting is safe only when the list_head member is the
>> first member of the structure.
> 
> Even so, I don't think too safe :) It might technically work,
> but it could break more easily.
> 
> So even if you find places where list_head is the first member of
> a structure, it would be nice to explicitly use the list_head member
> and avoid casts IMO.
> 

This is exactly what I think. Those patches actually fix no bugs, but
avoid this kind of technically and currently correct casting.

> 
>> Signed-off-by: Li Zefan <[EMAIL PROTECTED]>
>>
>> ---
>>  arch/ppc/syslib/ocp.c |2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c
>> index 3f5be2c..d42d408 100644
>> --- a/arch/ppc/syslib/ocp.c
>> +++ b/arch/ppc/syslib/ocp.c
>> @@ -376,7 +376,7 @@ ocp_remove_one_device(unsigned int vendor, unsigned int
>> function, int index)
>>
>>  down_write(&ocp_devices_sem);
>>  dev = __ocp_find_device(vendor, function, index);
>> -list_del((struct list_head *)dev);
>> +list_del(&dev->link);
>>  up_write(&ocp_devices_sem);
>>
>>  DBG(("ocp: ocp_remove_one_device(vendor: %x, function: %x, index: %d)...
>> done.\n", vendor, function, index));
> 
> 


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

dtc: Make dtc-checfails.sh script catch deaths-by-signal

2007-12-06 Thread David Gibson
Since commit 5ba0086bfd0fa6ab25f7ce1870417301a26c104f, the
dtc-checkfails.sh script does not check the return code from dtc.
That's reasonable, since depending on the checks we're testing, dtc
could either complete succesfully or return an error.

However, it's never right for dtc to SEGV or otherwise be killed by a
signal.  So the script should catch that, and fail the testcase if it
happens.  This patch implements this behaviour.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: dtc/tests/dtc-checkfails.sh
===
--- dtc.orig/tests/dtc-checkfails.sh2007-12-07 15:34:17.0 +1100
+++ dtc/tests/dtc-checkfails.sh 2007-12-07 15:35:22.0 +1100
@@ -17,6 +17,10 @@ rm -f $TMPFILE $LOG
 verbose_run_log "$LOG" "$DTC" -o /dev/null "$@"
 ret="$?"
 
+if [ "$ret" -gt 127 ]; then
+FAIL "dtc killed by signal (ret=$ret)"
+fi
+
 for c in $CHECKS; do
 if ! grep -E "^(ERROR)|(Warning) \($c\):" $LOG > /dev/null; then
FAIL "Failed to trigger check \"%c\""

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: dtc: Reinstate full old-style reference-to-path for v0 dts files

2007-12-06 Thread David Gibson
On Thu, Dec 06, 2007 at 09:39:28PM -0600, Josh Boyer wrote:
> On Fri, 7 Dec 2007 14:38:26 +1100
> David Gibson <[EMAIL PROTECTED]> wrote:
> 
> > Commit 7c44c2f9cb1cc2df7aacd13decfc4e64b73d1730 broke backwards
> > compatibility more badly than I realised.  Contrary to what I thought
> > there are in-kernel, in-use dts files which relied on
> > references-to-path with paths including a comma, which no longer
> > compile after that commit.
> 
> There won't be shortly.  I'm reworking them anyway.

I know, but I'd prefer that there was a broken range of dtc versions
than a broken range of kernel versions.

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/3] POWERPC: don't cast a pointer to pointer of list_head

2007-12-06 Thread Nick Piggin
On Thursday 06 December 2007 20:33, Li Zefan wrote:
> The casting is safe only when the list_head member is the
> first member of the structure.

Even so, I don't think too safe :) It might technically work,
but it could break more easily.

So even if you find places where list_head is the first member of
a structure, it would be nice to explicitly use the list_head member
and avoid casts IMO.

Thanks,
Nick

> Signed-off-by: Li Zefan <[EMAIL PROTECTED]>
>
> ---
>  arch/ppc/syslib/ocp.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c
> index 3f5be2c..d42d408 100644
> --- a/arch/ppc/syslib/ocp.c
> +++ b/arch/ppc/syslib/ocp.c
> @@ -376,7 +376,7 @@ ocp_remove_one_device(unsigned int vendor, unsigned int
> function, int index)
>
>   down_write(&ocp_devices_sem);
>   dev = __ocp_find_device(vendor, function, index);
> - list_del((struct list_head *)dev);
> + list_del(&dev->link);
>   up_write(&ocp_devices_sem);
>
>   DBG(("ocp: ocp_remove_one_device(vendor: %x, function: %x, index: %d)...
> done.\n", vendor, function, index));
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: dtc: Reinstate full old-style reference-to-path for v0 dts files

2007-12-06 Thread Josh Boyer
On Fri, 7 Dec 2007 14:38:26 +1100
David Gibson <[EMAIL PROTECTED]> wrote:

> Commit 7c44c2f9cb1cc2df7aacd13decfc4e64b73d1730 broke backwards
> compatibility more badly than I realised.  Contrary to what I thought
> there are in-kernel, in-use dts files which relied on
> references-to-path with paths including a comma, which no longer
> compile after that commit.

There won't be shortly.  I'm reworking them anyway.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


dtc: Reinstate full old-style reference-to-path for v0 dts files

2007-12-06 Thread David Gibson
Commit 7c44c2f9cb1cc2df7aacd13decfc4e64b73d1730 broke backwards
compatibility more badly than I realised.  Contrary to what I thought
there are in-kernel, in-use dts files which relied on
references-to-path with paths including a comma, which no longer
compile after that commit.

So, this patch reinstates full support for bare references-to-path in
dts-v0 input.  This means there will be some rather surprising lexical
corner cases when using path-expanded references in v0 files.  But,
since path-expanded references are new, v0 files shouldn't typically
be using them anyway.  If the corner cases cause a problem, you can
always convert to dts-v1 which handles the lexical issues here more
nicely.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: dtc/dtc-lexer.l
===
--- dtc.orig/dtc-lexer.l2007-12-07 14:22:19.0 +1100
+++ dtc/dtc-lexer.l 2007-12-07 14:32:04.0 +1100
@@ -27,7 +27,6 @@
 
 PROPNODECHAR   [a-zA-Z0-9,[EMAIL PROTECTED]
 PATHCHAR   ({PROPNODECHAR}|[/])
-LEGACYPATHCHAR [a-zA-Z0-9_@/]
 LABEL  [a-zA-Z_][a-zA-Z0-9_]*
 
 %{
@@ -158,7 +157,7 @@ static int dts_version; /* = 0 */
return DT_REF;
}
 
-"&/"{LEGACYPATHCHAR}+ {   /* old-style path reference */
+"&/"{PATHCHAR}+ { /* old-style path reference */
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
DPRINT("Ref: %s\n", yytext+1);

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 23/25] powerpc: Rework 4xx clock probing in boot wrapper

2007-12-06 Thread Josh Boyer
On Thu, 06 Dec 2007 19:00:22 +1100
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:

> Index: linux-work/arch/powerpc/boot/reg.h
> ===
> --- linux-work.orig/arch/powerpc/boot/reg.h   2007-12-03 14:26:09.0 
> +1100
> +++ linux-work/arch/powerpc/boot/reg.h2007-12-03 14:26:09.0 
> +1100
> @@ -24,6 +24,14 @@ static inline u32 mfpvr(void)
>   : "=r" (rval)); rval; })
>  #define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v))
> 
> +#define __stringify_1(x) #x
> +#define __stringify(x)   __stringify_1(x)
> +
> +#define mfspr(rn)({unsigned long rval; \
> + asm volatile("mfspr %0," __stringify(rn) \
> + : "=r" (rval)); rval; })
> +#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v))
> +

You felt like duplicating this?  It was added in the previous patch. :)

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 21/25] powerpc: Adds decoding of 440SPE memory size to boot wrapper library

2007-12-06 Thread Josh Boyer
On Thu, 06 Dec 2007 19:00:20 +1100
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:

> This adds a function to the bootwrapper 4xx library to decode memory
> size on 440SPE processors.

Why did you rename the fixup_memsize function?  Could you add that to
the changelog, and perhaps a bit about adding the SDRAM0_{READ,WRITE}
macros.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 19/25] powerpc: Wire up PCI on Bamboo board

2007-12-06 Thread Josh Boyer
On Thu, 06 Dec 2007 19:00:19 +1100
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:

> This adds the device-tree bits & call to ppc4xx_pci_find_bridges()
> to make PCI work on the Bamboo board
> 
> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
> ---
> 
>  arch/powerpc/boot/dts/bamboo.dts |   40 
> ++-
>  1 file changed, 39 insertions(+), 1 deletion(-)
> 
> Index: linux-work/arch/powerpc/boot/dts/bamboo.dts
> ===
> --- linux-work.orig/arch/powerpc/boot/dts/bamboo.dts  2007-11-30 
> 13:40:21.0 +1100
> +++ linux-work/arch/powerpc/boot/dts/bamboo.dts   2007-11-30 
> 13:40:45.0 +1100
> @@ -239,10 +239,48 @@
>   zmii-channel = <1>;
>   };
>   };
> +
> + PCI0: [EMAIL PROTECTED] {
> + device_type = "pci";
> + #interrupt-cells = <1>;
> + #size-cells = <2>;
> + #address-cells = <3>;
> + compatible = "ibm,plb440ep-pci", "ibm,plb-pci";
> + primary;
> + reg = <0 eec0 8 /* Config space access */
> +0 eed8 4 /* IACK */
> +0 eed8 4 /* Special cycle */
> +0 ef48 40>;  /* Internal registers */
> +
> + /* Outbound ranges, one memory and one IO,
> +  * later cannot be changed. Chip supports a second
> +  * IO range but we don't use it for now
> +  */
> + ranges = <0200 0 a000 0 a000 0 2000
> +   0100 0  0 e800 0 0001>;
> +
> + /* Inbound 2GB range starting at 0 */
> + dma-ranges = <4200 0 0 0 0 0 8000>;
> +
> + /* Walnut has all 4 IRQ pins tied together per slot */

Not a Walnut board.

> + interrupt-map-mask = ;
> + interrupt-map = <
> + /* IDSEL 1 */
> + 0800 0 0 0 &UIC0 1c 8
> +
> + /* IDSEL 2 */
> + 1000 0 0 0 &UIC0 1b 8
> +
> + /* IDSEL 3 */
> + 1800 0 0 0 &UIC0 1a 8
> +
> + /* IDSEL 4 */
> + 2000 0 0 0 &UIC0 19 8
> + >;
> + };
>   };
> 
>   chosen {
>   linux,stdout-path = "/plb/opb/[EMAIL PROTECTED]";
> - bootargs = "console=ttyS0,115200";

Did you remove that for a reason?

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 18/25] powerpc: Base support for 440GX Taishan eval board

2007-12-06 Thread Josh Boyer
On Thu, 06 Dec 2007 19:00:18 +1100
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:

> From: Hugh Blemings <[EMAIL PROTECTED]>
> 
> 
> Signed-off-by: Hugh Blemings <[EMAIL PROTECTED]>
> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
> ---

> Index: linux-work/arch/powerpc/platforms/44x/Kconfig
> ===
> --- linux-work.orig/arch/powerpc/platforms/44x/Kconfig2007-12-03 
> 12:05:58.0 +1100
> +++ linux-work/arch/powerpc/platforms/44x/Kconfig 2007-12-03 
> 13:52:59.0 +1100
> @@ -22,6 +22,14 @@ config SEQUOIA
>   help
> This option enables support for the AMCC PPC440EPX evaluation board.
> 
> +config TAISHAN
> + bool "Taishan"
> + depends on 44x
> + default n
> + select 440GX
> + help
> +   This option enables support for the IBM PPC440GX "Taishan" evaluation 
> board.

AMCC Taishan board.

> +
>  #config LUAN
>  #bool "Luan"
>  #depends on 44x
> @@ -58,6 +66,10 @@ config 440GP
> 
>  config 440GX
>   bool
> +select IBM_NEW_EMAC_EMAC4
> + select IBM_NEW_EMAC_RGMII
> +select IBM_NEW_EMAC_ZMII #test only
> +select IBM_NEW_EMAC_TAH  #test only
> 
>  config 440SP
>   bool
> Index: linux-work/arch/powerpc/platforms/44x/Makefile
> ===
> --- linux-work.orig/arch/powerpc/platforms/44x/Makefile   2007-12-03 
> 11:48:01.0 +1100
> +++ linux-work/arch/powerpc/platforms/44x/Makefile2007-12-03 
> 13:52:59.0 +1100
> @@ -1,4 +1,5 @@
>  obj-$(CONFIG_44x):= misc_44x.o
>  obj-$(CONFIG_EBONY)  += ebony.o
> +obj-$(CONFIG_TAISHAN)+= taishan.o
>  obj-$(CONFIG_BAMBOO) += bamboo.o
>  obj-$(CONFIG_SEQUOIA)+= sequoia.o
> Index: linux-work/arch/powerpc/platforms/44x/taishan.c
> ===
> --- /dev/null 1970-01-01 00:00:00.0 +
> +++ linux-work/arch/powerpc/platforms/44x/taishan.c   2007-12-03 
> 13:39:01.0 +1100
> @@ -0,0 +1,74 @@
> +/*
> + * Taishan board specific routines based off ebony.c code
> + * original copyrights below
> + *
> + * Matt Porter <[EMAIL PROTECTED]>
> + * Copyright 2002-2005 MontaVista Software Inc.
> + *
> + * Eugene Surovegin <[EMAIL PROTECTED]> or <[EMAIL PROTECTED]>
> + * Copyright (c) 2003-2005 Zultys Technologies
> + *
> + * Rewritten and ported to the merged powerpc tree:
> + * Copyright 2007 David Gibson <[EMAIL PROTECTED]>, IBM Corporation.
> + *
> + * Modified from ebony.c for taishan:
> + * Copyright 2007 Hugh Blemings <[EMAIL PROTECTED]>, IBM Corporation.
> + *
> + * This program is free software; you can redistribute  it and/or modify it
> + * under  the terms of  the GNU General  Public License as published by the
> + * Free Software Foundation;  either version 2 of the  License, or (at your
> + * option) any later version.
> + */
> +
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "44x.h"
> +
> +static struct of_device_id taishan_of_bus[] = {
> + { .compatible = "ibm,plb4", },
> + { .compatible = "ibm,opb", },
> + { .compatible = "ibm,ebc", },
> + {},
> +};
> +
> +static int __init taishan_device_probe(void)
> +{
> + if (!machine_is(taishan))
> + return 0;
> +
> + of_platform_bus_probe(NULL, taishan_of_bus, NULL);
> +
> + return 0;
> +}
> +device_initcall(taishan_device_probe);
> +
> +/*
> + * Called very early, MMU is off, device-tree isn't unflattened
> + */
> +static int __init taishan_probe(void)
> +{
> + unsigned long root = of_get_flat_dt_root();
> +
> + if (!of_flat_dt_is_compatible(root, "ibm,taishan"))
> + return 0;

amcc,taishan

> +
> + return 1;
> +}
> +
> +define_machine(taishan) {
> + .name   = "Taishan",
> + .probe  = taishan_probe,
> + .progress   = udbg_progress,
> + .init_IRQ   = uic_init_tree,
> + .get_irq= uic_get_irq,
> + .restart= ppc44x_reset_system,
> + .calibrate_decr = generic_calibrate_decr,
> +};
> Index: linux-work/arch/powerpc/boot/dts/taishan.dts
> ===
> --- /dev/null 1970-01-01 00:00:00.0 +
> +++ linux-work/arch/powerpc/boot/dts/taishan.dts  2007-12-03 
> 13:39:01.0 +1100
> @@ -0,0 +1,414 @@
> +/*
> + * Device Tree Source for IBM/AMCC Taishan
> + *



> + *
> + * To build:
> + *   dtc -I dts -O asm -o taishan.S -b 0 taishan.dts
> + *   dtc -I dts -O dtb -o taishan.dtb -b 0 taishan.dts

Remove this please.  It's not really needed anymore.
> + */
> +
> +/ {
> + #address-cells = <2>;
> + #size-cells = <1>;
> + model = "ibm,taishan";
> + compatible = "ibm,taishan";

amcc,taishan

> + dcr-parent = <&/cpus/PowerPC,[EMAIL PROTECTED]>;
> +
> + cpus {

Re: [PATCH 16/25] powerpc: EP405 boards support for arch/powerpc

2007-12-06 Thread Josh Boyer
On Thu, 06 Dec 2007 19:00:15 +1100
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:

> 
> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
> ---
> Index: linux-work/arch/powerpc/boot/dts/ep405.dts
> ===
> --- /dev/null 1970-01-01 00:00:00.0 +
> +++ linux-work/arch/powerpc/boot/dts/ep405.dts2007-12-03 
> 12:58:45.0 +1100
> @@ -0,0 +1,221 @@
> +/*
> + * Device Tree Source for EP405
> + *
> + * Copyright 2007 IBM Corp.
> + * Josh Boyer <[EMAIL PROTECTED]>

I still don't think I wrote this ;)



> +static struct of_device_id ep405_of_bus[] = {
> + { .compatible = "ibm,plb3", },
> + { .compatible = "ibm,opb", },
> + { .compatible = "ibm,ebc", },
> + {},
> +};
> +
> +static int __init ep405_device_probe(void)
> +{
> + if (!machine_is(ep405))
> + return 0;
> +
> + /* FIXME: do bus probe here */

I should really remove this stupid FIXME from my files so people stop
copying it into theirs ;)

> + of_platform_bus_probe(NULL, ep405_of_bus, NULL);
> +
> + return 0;
> +}
> +device_initcall(ep405_device_probe);
> +
> +static void __init ep405_init_bcsr(void)
> +{
> + const u8 *irq_routing;
> + int i;
> +
> + /* Find the bloody thing & map it */
> + bcsr_node = of_find_compatible_node(NULL, NULL, "ep405-bcsr");
> + if (bcsr_node == NULL) {
> + printk(KERN_ERR "EP405 BCSR not found !\n");
> + return;
> + }
> + bcsr_regs = of_iomap(bcsr_node, 0);
> + if (bcsr_regs == NULL) {
> + printk(KERN_ERR "EP405 BCSR failed to map !\n");
> + return;
> + }

Is there a reason you have bcsr_node and bcsr_regs as static globals
and leave the mapping present?  I can't see another use of them outside
of this function, which only gets called once.

> +
> + /* Get the irq-routing property and apply the routing to the CPLD */
> + irq_routing = of_get_property(bcsr_node, "irq-routing", NULL);
> + if (irq_routing == NULL)
> + return;
> + for (i = 0; i < 16; i++) {
> + u8 irq = irq_routing[i];
> + out_8(bcsr_regs + BCSR_XIRQ_SELECT, i);
> + out_8(bcsr_regs + BCSR_XIRQ_ROUTING, irq);
> + }
> + in_8(bcsr_regs + BCSR_XIRQ_SELECT);
> + mb();
> + out_8(bcsr_regs + BCSR_GPIO_IRQ_PAR_CTRL, 0xfe);
> +}
> +
> +static void __init ep405_setup_arch(void)
> +{
> + /* Find & init the BCSR CPLD */
> + ep405_init_bcsr();
> +}
> +
> +static int __init ep405_probe(void)
> +{
> + unsigned long root = of_get_flat_dt_root();
> +
> + if (!of_flat_dt_is_compatible(root, "ep405"))
> + return 0;
> +
> + return 1;
> +}
> +
> +define_machine(ep405) {
> + .name   = "EP405",
> + .probe  = ep405_probe,
> + .setup_arch = ep405_setup_arch,
> + .progress   = udbg_progress,
> + .init_IRQ   = uic_init_tree,
> + .get_irq= uic_get_irq,
> + .calibrate_decr = generic_calibrate_decr,
> +};

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


dtc: Convert #address-cells and #size-cells related checks

2007-12-06 Thread David Gibson
This patch converts checks related to #address-cells and #size-cells
to the new framework.  Specifically, it reimplements the check that
"reg" properties have a valid size based on the relevant
#address-cells and #size-cells values.  The new implementation uses
the correct default value, unlike the old-style check which assumed
the values were inherited by default.

It also implements a new, similar test for "ranges" properties.

Finally, since relying on the default values of these variables is
considered not-good-practice these days, it implements a "style" check
which will give a warning if the tree ever relies on the default
values (that is if any node with either "reg" or "ranges" appears
under a parent which has no #address-cells or #size-cells property).

Index: dtc/checks.c
===
--- dtc.orig/checks.c   2007-12-07 12:54:59.0 +1100
+++ dtc/checks.c2007-12-07 13:16:38.0 +1100
@@ -355,6 +355,127 @@ CHECK_IS_STRING(device_type_is_string, "
 CHECK_IS_STRING(model_is_string, "model", WARN);
 CHECK_IS_STRING(status_is_string, "status", WARN);
 
+static void fixup_addr_size_cells(struct check *c, struct node *dt,
+ struct node *node)
+{
+   struct property *prop;
+
+   node->addr_cells = -1;
+   node->size_cells = -1;
+
+   prop = get_property(node, "#address-cells");
+   if (prop)
+   node->addr_cells = propval_cell(prop);
+
+   prop = get_property(node, "#size-cells");
+   if (prop)
+   node->size_cells = propval_cell(prop);
+}
+CHECK(addr_size_cells, NULL, fixup_addr_size_cells, NULL, NULL, WARN,
+  &address_cells_is_cell, &size_cells_is_cell);
+
+#define node_addr_cells(n) \
+   (((n)->addr_cells == -1) ? 2 : (n)->addr_cells)
+#define node_size_cells(n) \
+   (((n)->size_cells == -1) ? 1 : (n)->size_cells)
+
+static void check_reg_format(struct check *c, struct node *dt,
+struct node *node)
+{
+   struct property *prop;
+   int addr_cells, size_cells, entrylen;
+
+   prop = get_property(node, "reg");
+   if (!prop)
+   return; /* No "reg", that's fine */
+
+   if (!node->parent) {
+   FAIL(c, "Root node has a \"reg\" property");
+   return;
+   }
+
+   if (prop->val.len == 0)
+   FAIL(c, "\"reg\" property in %s is empty", node->fullpath);
+
+   addr_cells = node_addr_cells(node->parent);
+   size_cells = node_size_cells(node->parent);
+   entrylen = (addr_cells + size_cells) * sizeof(cell_t);
+
+   if ((prop->val.len % entrylen) != 0)
+   FAIL(c, "\"reg\" property in %s has invalid length (%d bytes) "
+"(#address-cells == %d, #size-cells == %d)",
+node->fullpath, prop->val.len, addr_cells, size_cells);
+}
+NODE_CHECK(reg_format, NULL, WARN, &addr_size_cells);
+
+static void check_ranges_format(struct check *c, struct node *dt,
+   struct node *node)
+{
+   struct property *prop;
+   int c_addr_cells, p_addr_cells, c_size_cells, p_size_cells, entrylen;
+
+   prop = get_property(node, "ranges");
+   if (!prop)
+   return;
+
+   if (!node->parent) {
+   FAIL(c, "Root node has a \"ranges\" property");
+   return;
+   }
+
+   p_addr_cells = node_addr_cells(node->parent);
+   p_size_cells = node_size_cells(node->parent);
+   c_addr_cells = node_addr_cells(node);
+   c_size_cells = node_size_cells(node);
+   entrylen = (p_addr_cells + c_addr_cells + c_size_cells) * 
sizeof(cell_t);
+
+   if (prop->val.len == 0) {
+   if (p_addr_cells != c_addr_cells)
+   FAIL(c, "%s has empty \"ranges\" property but its "
+"#address-cells (%d) differs from %s (%d)",
+node->fullpath, c_addr_cells, 
node->parent->fullpath,
+p_addr_cells);
+   if (p_size_cells != c_size_cells)
+   FAIL(c, "%s has empty \"ranges\" property but its "
+"#size-cells (%d) differs from %s (%d)",
+node->fullpath, c_size_cells, 
node->parent->fullpath,
+p_size_cells);
+   } else if ((prop->val.len % entrylen) != 0) {
+   FAIL(c, "\"ranges\" property in %s has invalid length (%d 
bytes) "
+"(parent #address-cells == %d, child #address-cells == %d, 
"
+"#size-cells == %d)", node->fullpath, prop->val.len,
+p_addr_cells, c_addr_cells, c_size_cells);
+   }
+}
+NODE_CHECK(ranges_format, NULL, WARN, &addr_size_cells);
+
+/*
+ * Style checks
+ */
+static void check_avoid_default_addr_size(struct check *c, struct node *dt,
+ struct node *node)
+{
+   struc

dtc: Convert check for obsolete /chosen property

2007-12-06 Thread David Gibson
This converts the test for the obsolete "interrupt-controller"
property in /chosen to the new framework.  That was the only thing
left in the old-style check_chosen() function, so that function is
removed, too.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: dtc/checks.c
===
--- dtc.orig/checks.c   2007-12-07 13:46:11.0 +1100
+++ dtc/checks.c2007-12-07 13:53:24.0 +1100
@@ -476,6 +476,23 @@ static void check_avoid_default_addr_siz
 }
 NODE_CHECK(avoid_default_addr_size, NULL, WARN, &addr_size_cells);
 
+static void check_obsolete_chosen_interrupt_controller(struct check *c,
+  struct node *dt)
+{
+   struct node *chosen;
+   struct property *prop;
+
+   chosen = get_node_by_path(dt, "/chosen");
+   if (!chosen)
+   return;
+
+   prop = get_property(chosen, "interrupt-controller");
+   if (prop)
+   FAIL(c, "/chosen has obsolete \"interrupt-controller\" "
+"property");
+}
+TREE_CHECK(obsolete_chosen_interrupt_controller, NULL, WARN);
+
 static struct check *check_table[] = {
&duplicate_node_names, &duplicate_property_names,
&name_is_string, &name_properties,
@@ -488,6 +505,7 @@ static struct check *check_table[] = {
&addr_size_cells, ®_format, &ranges_format,
 
&avoid_default_addr_size,
+   &obsolete_chosen_interrupt_controller,
 };
 
 int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys);
@@ -715,27 +733,6 @@ static int check_memory(struct node *roo
return ok;
 }
 
-static int check_chosen(struct node *root)
-{
-   struct node *chosen;
-   struct property *prop;
-   int ok = 1;
-
-   chosen = get_subnode(root, "chosen");
-   if (!chosen)
-   return ok;
-
-/* give warning for obsolete interrupt-controller property */
-   do {
-   if ((prop = get_property(chosen, "interrupt-controller")) != 
NULL) {
-   WARNMSG("%s has obsolete \"%s\" property\n",
- chosen->fullpath, "interrupt-controller");
-}
-   } while (0);
-
-   return ok;
-}
-
 int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys)
 {
int ok = 1;
@@ -743,7 +740,6 @@ int check_semantics(struct node *dt, int
ok = ok && check_root(dt);
ok = ok && check_cpus(dt, outversion, boot_cpuid_phys);
ok = ok && check_memory(dt);
-   ok = ok && check_chosen(dt);
if (! ok)
return 0;
 
Index: dtc/tests/obsolete-chosen-interrupt-controller.dts
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ dtc/tests/obsolete-chosen-interrupt-controller.dts  2007-12-07 
13:51:34.0 +1100
@@ -0,0 +1,13 @@
+/dts-v1/;
+
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   PIC: [EMAIL PROTECTED] {
+   reg = <0x0 0x10>;
+   interrupt-controller;
+   };
+   chosen {
+   interrupt-controller = <&PIC>;
+   };
+};
Index: dtc/tests/run_tests.sh
===
--- dtc.orig/tests/run_tests.sh 2007-12-07 13:51:44.0 +1100
+++ dtc/tests/run_tests.sh  2007-12-07 13:52:06.0 +1100
@@ -173,6 +173,7 @@ dtc_tests () {
 run_test dtc-checkfails.sh reg_format ranges_format -- -I dts -O dtb 
bad-reg-ranges.dts
 run_test dtc-checkfails.sh ranges_format -- -I dts -O dtb 
bad-empty-ranges.dts
 run_test dtc-checkfails.sh avoid_default_addr_size -- -I dts -O dtb 
default-addr-size.dts
+run_test dtc-checkfails.sh obsolete_chosen_interrupt_controller -- -I dts 
-O dtb obsolete-chosen-interrupt-controller.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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 8/25] powerpc: Improve support for 4xx indirect DCRs

2007-12-06 Thread Josh Boyer
On Thu, 06 Dec 2007 19:00:06 +1100
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:

> Accessing indirect DCRs is done via a pair of address/data DCRs.
> 
> Such accesses are thus inherently racy, vs. interrupts, preemption
> and possibly SMP if 4xx SMP cores are ever used.
> 
> This updates the mfdcri/mtdcri macros in dcr-native.h (which were
> so far unused) to use a spinlock.
> 
> In addition, add some common definitions to a new dcr-regs.h file.
> 
> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
> ---
> 
> 
>  arch/powerpc/sysdev/dcr.c|1 
>  include/asm-powerpc/dcr-native.h |   30 +++-
>  include/asm-powerpc/dcr-regs.h   |   72 
> +++
>  include/asm-powerpc/dcr.h|1 
>  4 files changed, 96 insertions(+), 8 deletions(-)
> 
> Index: linux-work/arch/powerpc/sysdev/dcr.c
> ===
> --- linux-work.orig/arch/powerpc/sysdev/dcr.c 2007-11-28 13:34:45.0 
> +1100
> +++ linux-work/arch/powerpc/sysdev/dcr.c  2007-11-28 13:34:48.0 
> +1100
> @@ -139,3 +139,4 @@ void dcr_unmap(dcr_host_t host, unsigned
>  EXPORT_SYMBOL_GPL(dcr_unmap);
> 
>  #endif /* !defined(CONFIG_PPC_DCR_NATIVE) */
> +

Somehow I doubt this single extraneous whitespace addition is really
needed.


> Index: linux-work/include/asm-powerpc/dcr-native.h
> ===
> --- linux-work.orig/include/asm-powerpc/dcr-native.h  2007-11-28 
> 13:33:51.0 +1100
> +++ linux-work/include/asm-powerpc/dcr-native.h   2007-11-28 
> 15:22:22.0 +1100
> @@ -22,6 +22,8 @@
>  #ifdef __KERNEL__
>  #ifndef __ASSEMBLY__
> 
> +#include 
> +
>  typedef struct {
>   unsigned int base;
>  } dcr_host_t;
> @@ -55,18 +57,30 @@ do {  
> \
>  } while (0)
> 
>  /* R/W of indirect DCRs make use of standard naming conventions for DCRs */
> -#define mfdcri(base, reg)\
> -({   \
> - mtdcr(base ## _CFGADDR, base ## _ ## reg);  \
> - mfdcr(base ## _CFGDATA);\
> +extern spinlock_t dcr_ind_lock;
> +
> +#define mfdcri(base, reg)\
> +({   \
> + unsigned long flags;\
> + unsigned int val;   \
> + spin_lock_irqsave(&dcr_ind_lock, flags);\
> + mtdcr(DCRN_ ## base ## _CONFIG_ADDR, reg);  \
> + val = mfdcr(DCRN_ ## base ## _CONFIG_DATA); \
> + spin_unlock_irqrestore(&dcr_ind_lock, flags);   \
> + val;\
>  })
> 
> -#define mtdcri(base, reg, data)  \
> -do { \
> - mtdcr(base ## _CFGADDR, base ## _ ## reg);  \
> - mtdcr(base ## _CFGDATA, data);  \
> +#define mtdcri(base, reg, data)  \
> +do { \
> + unsigned long flags;\
> + spin_lock_irqsave(&dcr_ind_lock, flags);\
> + mtdcr(DCRN_ ## base ## _CONFIG_ADDR, reg);  \
> + mtdcr(DCRN_ ## base ## _CONFIG_DATA, data); \
> + spin_unlock_irqrestore(&dcr_ind_lock, flags);   \
>  } while (0)
> 
> +
> +

More bogus whitespace.


>  #endif /* __ASSEMBLY__ */
>  #endif /* __KERNEL__ */
>  #endif /* _ASM_POWERPC_DCR_NATIVE_H */
> Index: linux-work/include/asm-powerpc/dcr.h
> ===
> --- linux-work.orig/include/asm-powerpc/dcr.h 2007-11-28 13:40:13.0 
> +1100
> +++ linux-work/include/asm-powerpc/dcr.h  2007-11-28 13:49:37.0 
> +1100
> @@ -40,6 +40,7 @@ extern unsigned int dcr_resource_len(str
>unsigned int index);
>  #endif /* CONFIG_PPC_MERGE */
> 
> +

You really like whitespace.  Again I don't see anything needed for this
file :)

>  #endif /* CONFIG_PPC_DCR */
>  #endif /* __KERNEL__ */
>  #endif /* _ASM_POWERPC_DCR_H */
> Index: linux-work/include/asm-powerpc/dcr-regs.h
> ===
> --- /dev/null 1970-01-01 00:00:00.0 +
> +++ linux-work/include/asm-powerpc/dcr-regs.h 2007-11-28 14:43:25.0 
> +1100
> @@ -0,0 +1,72 @@
> +/*
> + * Common DCR / SDR / CPR register definitions used on various IBM/AMCC
> + * 4xx processors
> + *
> + *Copyright 2007 Benjamin Herrenschmidt, IBM Corp
> + *   <[EMAIL PROTECTED]>
> + *
> + * Mostly lifted from asm-ppc/ibm4xx.h by
> + *
> + *Copyright (c) 1999 Grant Erickson <[EMAIL PROTECTED]>
> + *
> + */
> +
> +#ifndef __DCR_REGS_H__
> +#define __DCR_REGS_H__
> +
> +/*
> + * Most DCRs used for controlling devices such as the MAL, DMA engine,
> + * etc... are obtained for the device tree.
> + *
> 

Re: [PATCH] add MPC837x MDS board default device tree

2007-12-06 Thread David Gibson
On Wed, Dec 05, 2007 at 06:37:53PM +0800, Li Yang wrote:
> Signed-off-by: Li Yang <[EMAIL PROTECTED]>
> ---
> Update SATA nodes; remove serdes nodes; add aliases and labels.
> 
>  arch/powerpc/boot/dts/mpc8377_mds.dts |  270 +++
>  arch/powerpc/boot/dts/mpc8378_mds.dts |  256 +
>  arch/powerpc/boot/dts/mpc8379_mds.dts |  284 
> +
>  3 files changed, 810 insertions(+), 0 deletions(-)
>  create mode 100644 arch/powerpc/boot/dts/mpc8377_mds.dts
>  create mode 100644 arch/powerpc/boot/dts/mpc8378_mds.dts
>  create mode 100644 arch/powerpc/boot/dts/mpc8379_mds.dts
> 
> diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts 
> b/arch/powerpc/boot/dts/mpc8377_mds.dts
> new file mode 100644
> index 000..919ffd0
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
[snip]
> + aliases {
> + ethernet0 = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]";
> + ethernet1 = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]";
> + serial0 = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]";
> + serial1 = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]";
> + pci0 = "/[EMAIL PROTECTED]";

You can use path references for these now.

> + };
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + PowerPC,[EMAIL PROTECTED] {

This should absolutely not have a "x" in it.  Either have an exact
model, or just use "[EMAIL PROTECTED]" (in which case you can put the model in
"compatible").

[snip]
> + [EMAIL PROTECTED] {
> + device_type = "i2c";

Drop the device_type.  No "i2c" device_type class is defined.

[snip]
> + /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
> + [EMAIL PROTECTED] {
> + device_type = "usb";

Drop device_type here too.

> + compatible = "fsl-usb2-dr";
> + reg = <23000 1000>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + interrupt-parent = < &ipic >;
> + interrupts = <26 8>;
> + phy_type = "utmi_wide";
> + };
> +
> + [EMAIL PROTECTED] {
> + device_type = "mdio";
> + compatible = "gianfar";

Grr... not your fault, but this crap in the gianfar driver where it
uses the same compatible property for the mdio and MAC has to be
fixed.

[snip]

> + serial1:[EMAIL PROTECTED] {

Standard style puts a space after the colon.

> + device_type = "serial";
> + compatible = "ns16550";
> + reg = <4600 100>;
> + clock-frequency = <0>;
> + interrupts = ;
> + interrupt-parent = < &ipic >;
> + };
> +
> + [EMAIL PROTECTED] {
> + model = "SEC3";
> + compatible = "talitos";

This driver, also, needs fixing to recognize a better formatted
compatible property.

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Please pull powerpc.git merge branch

2007-12-06 Thread Paul Mackerras
Linus,

I have added another commit to my powerpc.git tree merge branch, so
please do:

git pull \
master.kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc.git merge

(the mirroring seems to be slow today).

The diffstat and log below reflect the new commit plus the 4 in my
last pull request.

Thanks,
Paul.

 arch/powerpc/configs/bamboo_defconfig|   22 +-
 arch/powerpc/configs/cell_defconfig  |  176 ++
 arch/powerpc/configs/celleb_defconfig|  170 +
 arch/powerpc/configs/chrp32_defconfig|  163 +
 arch/powerpc/configs/ebony_defconfig |   25 +--
 arch/powerpc/configs/ep88xc_defconfig|   92 +
 arch/powerpc/configs/g5_defconfig|  150 ---
 arch/powerpc/configs/holly_defconfig |  136 +++---
 arch/powerpc/configs/iseries_defconfig   |  123 ++--
 arch/powerpc/configs/kilauea_defconfig   |   79 +++-
 arch/powerpc/configs/linkstation_defconfig   |  152 ---
 arch/powerpc/configs/lite5200_defconfig  |  119 ++--
 arch/powerpc/configs/maple_defconfig |  126 ++---
 arch/powerpc/configs/mpc7448_hpc2_defconfig  |  137 +++---
 arch/powerpc/configs/mpc8272_ads_defconfig   |  106 ++-
 arch/powerpc/configs/mpc8313_rdb_defconfig   |  173 +-
 arch/powerpc/configs/mpc832x_mds_defconfig   |  155 
 arch/powerpc/configs/mpc832x_rdb_defconfig   |  167 -
 arch/powerpc/configs/mpc834x_itx_defconfig   |  156 
 arch/powerpc/configs/mpc834x_itxgp_defconfig |  161 +---
 arch/powerpc/configs/mpc834x_mds_defconfig   |  149 +++
 arch/powerpc/configs/mpc836x_mds_defconfig   |  155 
 arch/powerpc/configs/mpc8540_ads_defconfig   |  101 +-
 arch/powerpc/configs/mpc8544_ds_defconfig|  130 +++--
 arch/powerpc/configs/mpc8560_ads_defconfig   |  104 +--
 arch/powerpc/configs/mpc8568mds_defconfig|  161 
 arch/powerpc/configs/mpc8572_ds_defconfig|  130 +++--
 arch/powerpc/configs/mpc85xx_cds_defconfig   |  126 ++---
 arch/powerpc/configs/mpc8610_hpcd_defconfig  |  114 +---
 arch/powerpc/configs/mpc8641_hpcn_defconfig  |  131 +++--
 arch/powerpc/configs/mpc866_ads_defconfig|  107 +--
 arch/powerpc/configs/mpc885_ads_defconfig|   98 +-
 arch/powerpc/configs/pasemi_defconfig|8 +
 arch/powerpc/configs/pmac32_defconfig|  217 ++
 arch/powerpc/configs/ppc64_defconfig |9 +
 arch/powerpc/configs/pq2fads_defconfig   |  148 +--
 arch/powerpc/configs/prpmc2800_defconfig |  150 ---
 arch/powerpc/configs/ps3_defconfig   |  177 +-
 arch/powerpc/configs/pseries_defconfig   |  156 +---
 arch/powerpc/configs/sequoia_defconfig   |  111 ++-
 arch/powerpc/configs/walnut_defconfig|   22 +-
 arch/powerpc/kernel/process.c|2 
 arch/ppc/platforms/4xx/xparameters/xparameters.h |8 +
 arch/ppc/syslib/virtex_devices.c |8 -
 include/asm-powerpc/time.h   |8 -
 45 files changed, 2662 insertions(+), 2456 deletions(-)

Geoff Levand (1):
  [POWERPC] PS3: Update ps3_defconfig

Grant Likely (1):
  [POWERPC] virtex bug fix: Use canonical value for AC97 interrupt xparams

Paul Mackerras (1):
  [POWERPC] Update defconfigs

Stephen Rothwell (1):
  [POWERPC] Update iseries_defconfig

Tony Breeds (1):
  [POWERPC] Fix hardware IRQ time accounting problem.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: MPC85xx DMA drivers, first testing results.

2007-12-06 Thread Timur Tabi
Clemens Koller wrote:
> Hi There!
> 
> I just tried to use the fsldma on the mpc8540. It seems to work fine
> here, but I would be glad if somebody can confirm before I move on:
> 
> I added the following to my mpc8540ads compatible board's .dts
> (see my comments, where the not yet available documentation
> was unclear):
> 
> [EMAIL PROTECTED] {
>  #address-cells = <1>;
>  #size-cells = <1>;
>  compatible = "fsl,mpc8540-dma", "fsl,eloplus-dma";
>  device-id = <0>;
>  reg = <21300 4>;/* DGSR - DMA general status register */
>  /* reg = <21000 4>;*/   /* or use offset of DMA machine ??? */
>  ranges = <0 21100 200>; /* we have 4 DMA channels at 21100, size=80 
> each */
>  [EMAIL PROTECTED] {
>  compatible = "fsl,mpc8540-dma-channel", 
> "fsl,eloplus-dma-channel";
>  device-id = <0>; /* or cell-index ??? */
>  reg = <0 80>;
>  interrupt-parent = <&mpic>;
>  interrupts = <14 2>;
>  };

Do this:

 [EMAIL PROTECTED] {
 #address-cells = <1>;
 #size-cells = <1>;
 compatible = "fsl,mpc8540-dma", "fsl,eloplus-dma";
 cell-index = <0>;
 reg = <21300 4>; /* DMA general status register */
 ranges = <0 21100 200>;

 [EMAIL PROTECTED] {
 compatible = "fsl,mpc8540-dma-channel", 
"fsl,eloplus-dma-channel";
 cell-index = <0>;
 reg = <0 80>;
 interrupt-parent = <&mpic>;
 interrupts = <14 2>;
 };


-- 
Timur Tabi
Linux Kernel Developer @ Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources

2007-12-06 Thread Greg KH
On Thu, Dec 06, 2007 at 06:58:54PM +1100, Benjamin Herrenschmidt wrote:
> 
> 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

But that is how we already handle this today, in numerous places in the
kernel for this very type.

So, you can disagree that this is what we need to do, and if so, feel
free to fix up a whole lot of files in the tree :)

thanks,

greg k-h
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/5] PowerPC 74xx: Katana Qp device tree

2007-12-06 Thread Mark A. Greer
David, et. al.,

This is a big blob patch of what I've changed for the prpmc2800.  It
includes the necessary changes in the kernel which you can probably
ignore but they're there for reference.  If you like the dts, then I'll
split the blob up into logical pieces and Andrei can make similar
changes for the Katana Qp.

Let me know what you think.

Mark
---
This patch is based on the latest powerpc.git tree
(44032af0e7d5467b12f998dbf2f1cd23c5324fd5) with the following patches
applied:

http://patchwork.ozlabs.org/linuxppc/patch?id=14339
http://patchwork.ozlabs.org/linuxppc/patch?id=14397
http://patchwork.ozlabs.org/linuxppc/patch?id=14396
http://patchwork.ozlabs.org/linuxppc/patch?id=14631
http://patchwork.ozlabs.org/linuxppc/patch?id=14632
http://patchwork.ozlabs.org/linuxppc/patch?id=14633
http://patchwork.ozlabs.org/linuxppc/patch?id=15007

 arch/powerpc/boot/dts/prpmc2800.dts|  320 +++
 arch/powerpc/boot/mpsc.c   |2 
 arch/powerpc/boot/serial.c |2 
 arch/powerpc/platforms/embedded6xx/prpmc2800.c |4 
 arch/powerpc/sysdev/mv64x60_dev.c  |   29 -
 arch/powerpc/sysdev/mv64x60_pci.c  |6 
 arch/powerpc/sysdev/mv64x60_pic.c  |4 
 arch/powerpc/sysdev/mv64x60_udbg.c |4 
 8 files changed, 181 insertions(+), 190 deletions(-)


diff --git a/arch/powerpc/boot/dts/prpmc2800.dts 
b/arch/powerpc/boot/dts/prpmc2800.dts
index 24944ca..080130e 100644
--- a/arch/powerpc/boot/dts/prpmc2800.dts
+++ b/arch/powerpc/boot/dts/prpmc2800.dts
@@ -11,6 +11,8 @@
  * if it can determine the exact PrPMC type.
  */
 
+/dts-v1/;
+
 / {
#address-cells = <1>;
#size-cells = <1>;
@@ -25,64 +27,64 @@
PowerPC,7447 {
device_type = "cpu";
reg = <0>;
-   clock-frequency = <2bb0b140>;   /* Default (733 MHz) */
-   bus-frequency = <7f28155>;  /* 133.33 MHz */
-   timebase-frequency = <1fca055>; /* 33.33 MHz */
-   i-cache-line-size = <20>;
-   d-cache-line-size = <20>;
-   i-cache-size = <8000>;
-   d-cache-size = <8000>;
+   clock-frequency = <7>;  /* Default */
+   bus-frequency = <1>;
+   timebase-frequency = <>;
+   i-cache-line-size = <0x20>;
+   d-cache-line-size = <0x20>;
+   i-cache-size = <0x8000>;
+   d-cache-size = <0x8000>;
};
};
 
memory {
device_type = "memory";
-   reg = < 2000>;  /* Default (512MB) */
+   reg = <0x 0x2000>;  /* Default (512MB) */
};
 
[EMAIL PROTECTED] { /* Marvell Discovery */
#address-cells = <1>;
#size-cells = <1>;
model = "mv64360";  /* Default */
-   compatible = "marvell,mv64x60";
-   clock-frequency = <7f28155>;/* 133.33 MHz */
-   reg = ;
-   virtual-reg = ;
-   ranges = <8800 8800 0100/* PCI 0 I/O Space */
- 8000 8000 0800/* PCI 0 MEM Space */
- a000 a000 0400/* User FLASH */
-  f100 0001/* Bridge's regs */
- f200 f200 0004>;  /* Integrated SRAM */
+   compatible = "marvell,mv64360";
+   clock-frequency = <1>;
+   reg = <0xf100 0x0001>;
+   virtual-reg = <0xf100>;
+   ranges = <0x8800 0x8800 0x0100 /* PCI 0 I/O Space */
+ 0x8000 0x8000 0x0800 /* PCI 0 MEM Space */
+ 0xa000 0xa000 0x0400 /* User FLASH */
+ 0x 0xf100 0x0001 /* Bridge's regs */
+ 0xf200 0xf200 0x0004>;/* Integrated SRAM*/
 
[EMAIL PROTECTED] {
compatible = "cfi-flash";
-   reg = ;
+   reg = <0xa000 0x0400>;
bank-width = <4>;
device-width = <2>;
#address-cells = <1>;
#size-cells = <1>;
[EMAIL PROTECTED] {
label = "FW Image A";
-   reg = < 0010>;
+   reg = <0x 0x0010>;
read-only;
};
[EMAIL PROTECTED] {
label = "FW Config Data";   /* R

[PATCH 3/3] [POWERPC] MPC8349E-mITX: Vitesse 7385 PHY is not connected to the MDIO bus

2007-12-06 Thread Vitaly Bordug

...thus use fixed-link to register proper "Fixed PHY"

Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]>
Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>

---

 arch/powerpc/boot/dts/mpc8349emitx.dts |   11 ++-
 1 files changed, 2 insertions(+), 9 deletions(-)


diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts 
b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 5072f6d..877ee6d 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -115,14 +115,6 @@
reg = <1c>;
device_type = "ethernet-phy";
};
-
-   /* Vitesse 7385 */
-   phy1f: [EMAIL PROTECTED] {
-   interrupt-parent = < &ipic >;
-   interrupts = <12 8>;
-   reg = <1f>;
-   device_type = "ethernet-phy";
-   };
};
 
[EMAIL PROTECTED] {
@@ -159,7 +151,8 @@
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <23 8 24 8 25 8>;
interrupt-parent = < &ipic >;
-   phy-handle = < &phy1f >;
+   /* Vitesse 7385 isn't on the MDIO bus */
+   fixed-link = <1 1 d#1000 0 0>;
linux,network-index = <1>;
};
 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property

2007-12-06 Thread Vitaly Bordug

fixed-link says: register new "Fixed/emulated PHY", i.e. PHY that
not connected to the real MDIO bus.

Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]>

---

 Documentation/powerpc/booting-without-of.txt |4 +
 arch/powerpc/sysdev/fsl_soc.c|   79 --
 2 files changed, 66 insertions(+), 17 deletions(-)


diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..9dfd308 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1254,6 +1254,10 @@ platforms are moved over to use the 
flattened-device-tree model.
   services interrupts for this device.
 - phy-handle : The phandle for the PHY connected to this ethernet
   controller.
+- fixed-link :  where a is emulated phy id - choose any,
+  but unique to the all specified fixed-links, b is duplex - 0 half,
+  1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no
+  pause, 1 pause, e is asym_pause - 0 no asym_pause, 1 asym_pause.
 
   Recommended properties:
 
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 3ace747..a008e32 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -130,6 +131,37 @@ u32 get_baudrate(void)
 EXPORT_SYMBOL(get_baudrate);
 #endif /* CONFIG_CPM2 */
 
+#ifdef CONFIG_FIXED_PHY
+static int __init of_add_fixed_phys(void)
+{
+   int ret;
+   struct device_node *np;
+   u32 *fixed_link;
+   struct fixed_phy_status status = {};
+
+   for_each_node_by_name(np, "ethernet") {
+   fixed_link  = (u32 *)of_get_property(np, "fixed-link", NULL);
+   if (!fixed_link)
+   continue;
+
+   status.link = 1;
+   status.duplex = fixed_link[1];
+   status.speed = fixed_link[2];
+   status.pause = fixed_link[3];
+   status.asym_pause = fixed_link[4];
+
+   ret = fixed_phy_add(PHY_POLL, fixed_link[0], &status);
+   if (ret) {
+   of_node_put(np);
+   return ret;
+   }
+   }
+
+   return 0;
+}
+arch_initcall(of_add_fixed_phys);
+#endif /* CONFIG_FIXED_PHY */
+
 static int __init gfar_mdio_of_init(void)
 {
struct device_node *np;
@@ -193,7 +225,6 @@ static const char *gfar_tx_intr = "tx";
 static const char *gfar_rx_intr = "rx";
 static const char *gfar_err_intr = "error";
 
-
 static int __init gfar_of_init(void)
 {
struct device_node *np;
@@ -277,29 +308,43 @@ static int __init gfar_of_init(void)
gfar_data.interface = PHY_INTERFACE_MODE_MII;
 
ph = of_get_property(np, "phy-handle", NULL);
-   phy = of_find_node_by_phandle(*ph);
+   if (ph == NULL) {
+   u32 *fixed_link;
 
-   if (phy == NULL) {
-   ret = -ENODEV;
-   goto unreg;
-   }
+   fixed_link = (u32 *)of_get_property(np, "fixed-link",
+  NULL);
+   if (!fixed_link) {
+   ret = -ENODEV;
+   goto unreg;
+   }
 
-   mdio = of_get_parent(phy);
+   gfar_data.bus_id = 0;
+   gfar_data.phy_id = fixed_link[0];
+   } else {
+   phy = of_find_node_by_phandle(*ph);
+
+   if (phy == NULL) {
+   ret = -ENODEV;
+   goto unreg;
+   }
+
+   mdio = of_get_parent(phy);
+
+   id = of_get_property(phy, "reg", NULL);
+   ret = of_address_to_resource(mdio, 0, &res);
+   if (ret) {
+   of_node_put(phy);
+   of_node_put(mdio);
+   goto unreg;
+   }
+
+   gfar_data.phy_id = *id;
+   gfar_data.bus_id = res.start;
 
-   id = of_get_property(phy, "reg", NULL);
-   ret = of_address_to_resource(mdio, 0, &res);
-   if (ret) {
of_node_put(phy);
of_node_put(mdio);
-   goto unreg;
}
 
-   gfar_data.phy_id = *id;
-   gfar_data.bus_id = res.start;
-
-   of_node_put(phy);
-   of_node_put(mdio);
-
ret =
platform_device_add_data(gfar_dev, &gfar_data,
 sizeof(struct

__

[PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality

2007-12-06 Thread Vitaly Bordug

With that patch fixed.c now fully emulates MDIO bus, thus no need
to duplicate PHY layer functionality. That, in turn, drastically
simplifies the code, and drops down line count.

As an additional bonus, now there is no need to register MDIO bus
for each PHY, all emulated PHYs placed on the platform fixed MDIO bus.
There is also no more need to pre-allocate PHYs via .config option,
this is all now handled dynamically.


Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]>
Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
Acked-by: Jeff Garzik <[EMAIL PROTECTED]>

---

 drivers/net/phy/Kconfig   |   32 +--
 drivers/net/phy/fixed.c   |  445 +
 include/linux/phy_fixed.h |   51 ++---
 3 files changed, 195 insertions(+), 333 deletions(-)


diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 54b2ba9..7fe03ce 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -61,34 +61,12 @@ config ICPLUS_PHY
  Currently supports the IP175C PHY.
 
 config FIXED_PHY
-   tristate "Drivers for PHY emulation on fixed speed/link"
+   bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
---help---
- Adds the driver to PHY layer to cover the boards that do not have any 
PHY bound,
- but with the ability to manipulate the speed/link in software. The 
relevant MII
- speed/duplex parameters could be effectively handled in a 
user-specified function.
- Currently tested with mpc866ads.
-
-config FIXED_MII_10_FDX
-   bool "Emulation for 10M Fdx fixed PHY behavior"
-   depends on FIXED_PHY
-
-config FIXED_MII_100_FDX
-   bool "Emulation for 100M Fdx fixed PHY behavior"
-   depends on FIXED_PHY
-
-config FIXED_MII_1000_FDX
-   bool "Emulation for 1000M Fdx fixed PHY behavior"
-   depends on FIXED_PHY
-
-config FIXED_MII_AMNT
-int "Number of emulated PHYs to allocate "
-depends on FIXED_PHY
-default "1"
----help---
-Sometimes it is required to have several independent emulated
-PHYs on the bus (in case of multi-eth but phy-less HW for instance).
-This control will have specified number allocated for each fixed
-PHY type enabled.
+ Adds the platform "fixed" MDIO Bus to cover the boards that use
+ PHYs that are not connected to the real MDIO bus.
+
+ Currently tested with mpc866ads and mpc8349e-mitx.
 
 config MDIO_BITBANG
tristate "Support for bitbanged MDIO buses"
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
index 5619182..73b6d39 100644
--- a/drivers/net/phy/fixed.c
+++ b/drivers/net/phy/fixed.c
@@ -1,362 +1,253 @@
 /*
- * drivers/net/phy/fixed.c
+ * Fixed MDIO bus (MDIO bus emulation with fixed PHYs)
  *
- * Driver for fixed PHYs, when transceiver is able to operate in one fixed 
mode.
+ * Author: Vitaly Bordug <[EMAIL PROTECTED]>
+ * Anton Vorontsov <[EMAIL PROTECTED]>
  *
- * Author: Vitaly Bordug
- *
- * Copyright (c) 2006 MontaVista Software, Inc.
+ * Copyright (c) 2006-2007 MontaVista Software, Inc.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
- *
  */
+
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
+#include 
+#include 
 #include 
-#include 
 #include 
 #include 
 
-#include 
-#include 
-#include 
+#define MII_REGS_NUM 29
 
-/* we need to track the allocated pointers in order to free them on exit */
-static struct fixed_info *fixed_phy_ptrs[CONFIG_FIXED_MII_AMNT*MAX_PHY_AMNT];
-
-/*-
- *  If something weird is required to be done with link/speed,
- * network driver is able to assign a function to implement this.
- * May be useful for PHY's that need to be software-driven.
- 
*-*/
-int fixed_mdio_set_link_update(struct phy_device *phydev,
-  int (*link_update) (struct net_device *,
-  struct fixed_phy_status *))
-{
-   struct fixed_info *fixed;
-
-   if (link_update == NULL)
-   return -EINVAL;
-
-   if (phydev) {
-   if (phydev->bus) {
-   fixed = phydev->bus->priv;
-   fixed->link_update = link_update;
-   return 0;
-   }
-   }
-   return -EINVAL;
-}
-
-EXPORT_SYMBOL(fixed_mdio_set_link_update);
+struct fixed_mdio_bus {
+   int irqs[PHY_MAX_ADDR];
+   struct mii_bus mii_bus;
+   struct list_head phys;
+};
 
-struct fixed_info *fixed_mdio_get_phydev (int phydev_ind)
-{
- 

Re: [PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources

2007-12-06 Thread Benjamin Herrenschmidt

> It's been discussed before.  Some of the solutions discussed:
> 
>  - Add something like PRI_RES which can be concatenated into a printk.
>Ugly.
>  - Patch gcc to allow user-definable types.  I think OpenBSD has a patch
>for this.  Then we have to get that patch propagated to all the
>people who compile the kernel.  Unappetising.
>  - Disable gcc's printk checking, teach sparse to typecheck printk.
>Most people don't run sparse yet.

So you seem to dislike all 3, which one do you dislike the less ?

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [POWERPC] 4xx: Add 405GPr and 405EP support in boot wrapper

2007-12-06 Thread Matthias Fuchs
This patch adds support for 405GPr processors with optional
new mode strapping. ibm405gp_fixup_clocks() can now be used
for 405GP and 405GPr CPUs.

This is in preparation of porting the cpci405 platform support
from arch/ppc to arch/powerpc.

This patch also adds ibm405ep_fixup_clocks() to support
405EP CPUs from the boot wrapper.

Signed-off-by: Matthias Fuchs <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/4xx.c |   81 ++
 arch/powerpc/boot/4xx.h |1 +
 arch/powerpc/boot/dcr.h |5 +++
 3 files changed, 80 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/boot/4xx.c b/arch/powerpc/boot/4xx.c
index 4dc0909..4ac9cb4 100644
--- a/arch/powerpc/boot/4xx.c
+++ b/arch/powerpc/boot/4xx.c
@@ -498,20 +498,45 @@ void ibm405gp_fixup_clocks(unsigned int sys_clk, unsigned 
int ser_clk)
u32 pllmr = mfdcr(DCRN_CPC0_PLLMR);
u32 cpc0_cr0 = mfdcr(DCRN_405_CPC0_CR0);
u32 cpc0_cr1 = mfdcr(DCRN_405_CPC0_CR1);
+   u32 psr = mfdcr(DCRN_405_CPC0_PSR);
u32 cpu, plb, opb, ebc, tb, uart0, uart1, m;
-   u32 fwdv, fbdv, cbdv, opdv, epdv, udiv;
+   u32 fwdv, fwdvb, fbdv, cbdv, opdv, epdv, ppdv, udiv;
 
fwdv = (8 - ((pllmr & 0xe000) >> 29));
fbdv = (pllmr & 0x1e00) >> 25;
-   cbdv = ((pllmr & 0x0006) >> 17) + 1;
-   opdv = ((pllmr & 0x00018000) >> 15) + 1;
-   epdv = ((pllmr & 0x1800) >> 13) + 2;
+   if (fbdv == 0)
+   fbdv = 16;
+   cbdv = ((pllmr & 0x0006) >> 17) + 1; /* CPU:PLB */
+   opdv = ((pllmr & 0x00018000) >> 15) + 1; /* PLB:OPB */
+   ppdv = ((pllmr & 0x1800) >> 13) + 1; /* PLB:PCI */
+   epdv = ((pllmr & 0x1800) >> 11) + 2; /* PLB:EBC */
udiv = ((cpc0_cr0 & 0x3e) >> 1) + 1;
 
-   m = fwdv * fbdv * cbdv;
+   /* check for 405GPr */
+   if ((mfpvr() & 0xfff0) == (0x50910951 & 0xfff0)) {
+   fwdvb = 8 - (pllmr & 0x0007);
+   if (!(psr & 0x1000)) /* PCI async mode enable == 0 */
+   if (psr & 0x0020) /* New mode enable */
+   m = fwdvb * 2 * ppdv;
+   else
+   m = fwdvb * cbdv * ppdv;
+   else if (psr & 0x0020) /* New mode enable */
+   if (psr & 0x0800) /* PerClk synch mode */
+   m = fwdvb * 2 * epdv;
+   else
+   m = fbdv * fwdv;
+   else if (epdv == fbdv)
+   m = fbdv * cbdv * epdv;
+   else
+   m = fbdv * fwdvb * cbdv;
 
-   cpu = sys_clk * m / fwdv;
-   plb = cpu / cbdv;
+   cpu = sys_clk * m / fwdv;
+   plb = sys_clk * m / (fwdvb * cbdv);
+   } else {
+   m = fwdv * fbdv * cbdv;
+   cpu = sys_clk * m / fwdv;
+   plb = cpu / cbdv;
+   }
opb = plb / opdv;
ebc = plb / epdv;
 
@@ -542,3 +567,45 @@ void ibm405gp_fixup_clocks(unsigned int sys_clk, unsigned 
int ser_clk)
dt_fixup_clock("/plb/opb/[EMAIL PROTECTED]", uart1);
 }
 
+
+void ibm405ep_fixup_clocks(unsigned int sys_clk)
+{
+   u32 pllmr0 = mfdcr(DCRN_CPC0_PLLMR0);
+   u32 pllmr1 = mfdcr(DCRN_CPC0_PLLMR1);
+   u32 cpc0_ucr = mfdcr(DCRN_CPC0_UCR);
+   u32 cpu, plb, opb, ebc, uart0, uart1;
+   u32 fwdva, fwdvb, fbdv, cbdv, opdv, epdv;
+   u32 pllmr0_ccdv, tb, m;
+
+   fwdva = 8 - ((pllmr1 & 0x0007) >> 16);
+   fwdvb = 8 - ((pllmr1 & 0x7000) >> 12);
+   fbdv = (pllmr1 & 0x00f0) >> 20;
+   if (fbdv == 0)
+   fbdv = 16;
+
+   cbdv = ((pllmr0 & 0x0003) >> 16) + 1; /* CPU:PLB */
+   epdv = ((pllmr0 & 0x0300) >> 8) + 2;  /* PLB:EBC */
+   opdv = ((pllmr0 & 0x3000) >> 12) + 1; /* PLB:OPB */
+
+   m = fbdv * fwdvb;
+
+   pllmr0_ccdv = ((pllmr0 & 0x0030) >> 20) + 1;
+   if (pllmr1 & 0x8000)
+   cpu = sys_clk * m / (fwdva * pllmr0_ccdv);
+   else
+   cpu = sys_clk / pllmr0_ccdv;
+
+   plb = cpu / cbdv;
+   opb = plb / opdv;
+   ebc = plb / epdv;
+   tb = cpu;
+   uart0 = cpu / (cpc0_ucr & 0x007f);
+   uart1 = cpu / ((cpc0_ucr & 0x7f00) >> 8);
+
+   dt_fixup_cpu_clocks(cpu, tb, 0);
+   dt_fixup_clock("/plb", plb);
+   dt_fixup_clock("/plb/opb", opb);
+   dt_fixup_clock("/plb/ebc", ebc);
+   dt_fixup_clock("/plb/opb/[EMAIL PROTECTED]", uart0);
+   dt_fixup_clock("/plb/opb/[EMAIL PROTECTED]", uart1);
+}
diff --git a/arch/powerpc/boot/4xx.h b/arch/powerpc/boot/4xx.h
index fbe0632..2606e64 100644
--- a/arch/powerpc/boot/4xx.h
+++ b/arch/powerpc/boot/4xx.h
@@ -20,6 +20,7 @@ void ibm4xx_quiesce_eth(u32 *emac0, u32 *emac1);
 void ibm4xx_fixup_ebc_ranges(const char *ebc);
 
 void ibm405gp_fixup_clocks(unsigned int sys_clk, unsigned int ser_clk);
+void ibm405ep_fixup_clocks(unsigned int sys_cl

Re: [PATCH 11/25] powerpc: 4xx PLB to PCI Express support

2007-12-06 Thread Benjamin Herrenschmidt

> > +/* Check that the core has been initied and if not, do it */
> > +static int __init ppc4xx_pciex_check_core_init(struct device_node *np)
> > +{
> > +   static int core_init;
> > +   int count = -ENODEV;
> > +
> > +   if (core_init++)
> > +   return 0;
> > +
> > +#ifdef CONFIG_44x
> > +   if (of_device_is_compatible(np, "ibm,plb-pciex-440speA"))
> > +   ppc4xx_pciex_hwops = &ppc440speA_pcie_hwops;
> > +   else if (of_device_is_compatible(np, "ibm,plb-pciex-440speB"))
> > +   ppc4xx_pciex_hwops = &ppc440speB_pcie_hwops;
> 
> We need some runtime detection of the 440SPe revision here. There are boards 
> out there (e.g. AMCC Yucca) which can be equipped with both PPC 
> revisions. :-(

Ah... crap ! Do you think we should put that in the boot wrapper and
fixup the device-tree or should we put it in the PCIe code proper ?

> > +#endif /* CONFIG_44x*/
> > +#ifdef CONFIG_40x
> > +   if (of_device_is_compatible(np, "ibm,plb-pciex-405ex"))
> > +   ppc4xx_pciex_hwops = &ppc405ex_pcie_hwops;
> > +#endif
> 
> Why those #ifdef's? Just code-size reasons, since 40x and 44x will most 
> likely 
> never be built into one image? 

Code size... I know how keen embedded people are to keep their kernel
small and as of today, you can't build 40x and 44x support in the same
image, so I didn't want to be blamed for adding bloat in that case :-)

Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] qe: add ability to upload QE firmware

2007-12-06 Thread Timur Tabi
Kumar Gala wrote:

> When I wait you come up with a new version.. so I'm waiting to see if v3 
> comes out :)

Well, I guess I can't blame you for that. :-)

I think these patches are final:

[PATCH 1/2] qe: add function qe_clock_source (dated 12/3)
[PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree 
properties 
(dated 12/3)
[PATCH v2] qe: add ability to upload QE firmware

-- 
Timur Tabi
Linux kernel developer at Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


MPC85xx DMA drivers, first testing results.

2007-12-06 Thread Clemens Koller
Hi There!

I just tried to use the fsldma on the mpc8540. It seems to work fine
here, but I would be glad if somebody can confirm before I move on:

I added the following to my mpc8540ads compatible board's .dts
(see my comments, where the not yet available documentation
was unclear):

[EMAIL PROTECTED] {
 #address-cells = <1>;
 #size-cells = <1>;
 compatible = "fsl,mpc8540-dma", "fsl,eloplus-dma";
 device-id = <0>;
 reg = <21300 4>;/* DGSR - DMA general status register */
 /* reg = <21000 4>;*/   /* or use offset of DMA machine ??? */
 ranges = <0 21100 200>; /* we have 4 DMA channels at 21100, size=80 
each */
 [EMAIL PROTECTED] {
 compatible = "fsl,mpc8540-dma-channel", 
"fsl,eloplus-dma-channel";
 device-id = <0>; /* or cell-index ??? */
 reg = <0 80>;
 interrupt-parent = <&mpic>;
 interrupts = <14 2>;
 };
 [EMAIL PROTECTED] {/* or use 0,1,2,3 instead of 0,80,100,180 
??? */
 compatible = "fsl,mpc8540-dma-channel", 
"fsl,eloplus-dma-channel";
 device-id = <1>;
 reg = <80 80>;
 interrupt-parent = <&mpic>;
 interrupts = <15 2>;
 };
 [EMAIL PROTECTED] {
 compatible = "fsl,mpc8540-dma-channel", 
"fsl,eloplus-dma-channel";
 device-id = <2>;
 reg = <100 80>;
 interrupt-parent = <&mpic>;
 interrupts = <16 2>;
 };
 [EMAIL PROTECTED] {
 compatible = "fsl,mpc8540-dma-channel", 
"fsl,eloplus-dma-channel";
 device-id = <3>;
 reg = <180 80>;
 interrupt-parent = <&mpic>;
 interrupts = <17 2>;
 };
};


$ dmesg then says:

of-fsl-dma e0021300.dma: Probe the Freescale DMA driver for fsl,mpc8540-dma 
controller at 0xe0021300...
of-fsl-dma-channel e0021100.dma-channe: selftest: start...
of-fsl-dma-channel e0021100.dma-channe: selftest: finished, err=0.
of-fsl-dma-channel e0021100.dma-channe: #0 (fsl,mpc8540-dma-channel), irq 21
of-fsl-dma-channel e0021180.dma-channe: selftest: start...
of-fsl-dma-channel e0021180.dma-channe: selftest: finished, err=0.
of-fsl-dma-channel e0021180.dma-channe: #1 (fsl,mpc8540-dma-channel), irq 22
of-fsl-dma-channel e0021200.dma-channe: selftest: start...
of-fsl-dma-channel e0021200.dma-channe: selftest: finished, err=0.
of-fsl-dma-channel e0021200.dma-channe: #2 (fsl,mpc8540-dma-channel), irq 23
of-fsl-dma-channel e0021280.dma-channe: selftest: start...
of-fsl-dma-channel e0021280.dma-channe: selftest: finished, err=0.
of-fsl-dma-channel e0021280.dma-channe: #3 (fsl,mpc8540-dma-channel), irq 24

I added another dev_info() to get at least a glue that the selftest is run.
It looks like dev_info(fsl_chan->dev, ...); seems to be truncated.

I have no idea if interrupts are working well... the callback isn't
used yet.

Otherwise, nice work! :-) I'm looking forward to see this functionality
in mainline.

Regards,
-- 
Clemens Koller
__
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Straße 45/1
Linhof Werksgelände
D-81379 München
Tel.089-741518-50
Fax 089-741518-19
http://www.anagramm-technology.com
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] usb: Remove OHCI useless masking/unmasking of WDH interrupt

2007-12-06 Thread David Brownell
From: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Subject: [PATCH 2/2] usb: Remove OHCI useless masking/unmasking of WDH interrupt

The OHCI driver's IRQ handler, while processing a WDH interrupt, masks
and unmasks it.  I believe this is both broken (the write may still be
posted during the donelist processing it's trying to safeguard) and
useless as this IRQ may not be reissued until it's acked (unless this
legacy code is an uncommented workaround for some chip erratum).

Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Signed-off-by: David Brownell <[EMAIL PROTECTED]>
---
Worth IMO holding till 2.6.25-early.

--- g26.orig/drivers/usb/host/ohci-hcd.c2007-12-06 08:42:24.0 
-0800
+++ g26/drivers/usb/host/ohci-hcd.c 2007-12-06 08:42:29.0 -0800
@@ -807,13 +807,9 @@ static irqreturn_t ohci_irq (struct usb_
}
 
if (ints & OHCI_INTR_WDH) {
-   if (HC_IS_RUNNING(hcd->state))
-   ohci_writel (ohci, OHCI_INTR_WDH, ®s->intrdisable);
spin_lock (&ohci->lock);
dl_done_list (ohci);
spin_unlock (&ohci->lock);
-   if (HC_IS_RUNNING(hcd->state))
-   ohci_writel (ohci, OHCI_INTR_WDH, ®s->intrenable);
}
 
if (quirk_zfmicro(ohci) && (ints & OHCI_INTR_SF)) {
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] usb: Remove broken optimisation in OHCI IRQ handler

2007-12-06 Thread David Brownell
From: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Subject: [PATCH 1/2] usb: Remove broken optimisation in OHCI IRQ handler

The OHCI IRQ handler has an optimisation that avoids reading some
chip registers when the controller reports that the interrupt was
triggered *only* because completed requests were written into the
controller's "done list" and handed to the host.

This mechanism can't be used on some controllers.  Among others, it
fails for the SA and the AMCC 440EP PowerPC processor.

This patch removes the optimisation and makes the code clearer.

Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Signed-off-by: David Brownell <[EMAIL PROTECTED]>
---
Suitable IMO for 2.6.24 final.

 drivers/usb/host/ohci-hcd.c |   23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

--- g26.orig/drivers/usb/host/ohci-hcd.c2007-10-28 17:46:53.0 
-0700
+++ g26/drivers/usb/host/ohci-hcd.c 2007-12-06 09:29:57.0 -0800
@@ -732,24 +732,27 @@ static irqreturn_t ohci_irq (struct usb_
struct ohci_regs __iomem *regs = ohci->regs;
int ints;
 
-   /* we can eliminate a (slow) ohci_readl()
-* if _only_ WDH caused this irq
+   /* Read interrupt status (and flush pending writes).  We ignore the
+* optimization of checking the LSB of hcca->done_head; it doesn't
+* work on all systems (edge triggering for OHCI can be a factor).
 */
-   if ((ohci->hcca->done_head != 0)
-   && ! (hc32_to_cpup (ohci, &ohci->hcca->done_head)
-   & 0x01)) {
-   ints =  OHCI_INTR_WDH;
+   ints = ohci_readl(ohci, ®s->intrstatus);
 
-   /* cardbus/... hardware gone before remove() */
-   } else if ((ints = ohci_readl (ohci, ®s->intrstatus)) == ~(u32)0) {
+   /* Check for an all 1's result which is a typical consequence
+* of dead, unclocked, or unplugged (CardBus...) devices
+*/
+   if (ints == ~(u32)0) {
disable (ohci);
ohci_dbg (ohci, "device removed!\n");
return IRQ_HANDLED;
+   }
+
+   /* We only care about interrupts that are enabled */
+   ints &= ohci_readl(ohci, ®s->intrenable);
 
/* interrupt for some other device? */
-   } else if ((ints &= ohci_readl (ohci, ®s->intrenable)) == 0) {
+   if (ints == 0)
return IRQ_NOTMINE;
-   }
 
if (ints & OHCI_INTR_UE) {
// e.g. due to PCI Master/Target Abort
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v3] update xmon slb code.

2007-12-06 Thread Will Schmidt
[powerpc] update xmon slb code

This adds a bit more detail to the xmon SLB output.  When the valid bit is
set, This displays the ESID and VSID values, as well as decoding the
segment size, (1T or 256M) and displaying the LLP bits.  This supresses the
output for any slb entries that contain only zeros.

sample output from power6 (1T segment support):
00 c800 40004f7ca3000500  1T  ESID=   c0  VSID=   4f7ca3 
LLP:100
01 d800 4000eb71b400  1T  ESID=   d0  VSID=   eb71b0 
LLP:  0
08 1800 c8499f8ccc80 256M ESID=1  VSID=c8499f8cc 
LLP:  0
09 f800 d2c1a8e46c80 256M ESID=f  VSID=d2c1a8e46 
LLP:  0
10 4800 ca87eab1dc80 256M ESID=4  VSID=ca87eab1d 
LLP:  0
43 cf000800 400011b26500  1T  ESID=   cf  VSID=   11b260 
LLP:100

sample output from power5 (notice the non-valid but non-zero entries)
10 0800 4fd0e077ac80 256M ESID=0  VSID=4fd0e077a 
LLP:  0
11 f800 5b085830fc80 256M ESID=f  VSID=5b085830f 
LLP:  0
12 4800 52ce99fe6c80 256M ESID=4  VSID=52ce99fe6 
LLP:  0
13 1800 50904ed95c80 256M ESID=1  VSID=50904ed95 
LLP:  0
14 cf000800 d59aca40f500 256M ESID=cf000  VSID=d59aca40f 
LLP:100
15 c0007800 45cb97751500 256M ESID=c0007  VSID=45cb97751 
LLP:100

Tested on power5 and power6.

Signed-Off-By: Will Schmidt <[EMAIL PROTECTED]>

---
This is a resend..  this latest respin is updated to apply on top of Mikeys 
slb_mmu_size change.

(earlier Updates made per comments from Olof and Ben and Paul).
This version adds padding around the ESID and VSID fields, and the LLP bits
are displayed too.
Counting bits, the VSID output looks to be as large as 51 bits, which requires
up to 13 spaces.  This doesnt count the B field bits which are now masked off
the top end of the VSID output.

I'll try to follow up sometime later with code that will handle decoding page
sizes.  I dont have a testcase handy to properly exercise that yet. :-)
---

 arch/powerpc/xmon/xmon.c |   29 +++--
 1 files changed, 23 insertions(+), 6 deletions(-)


diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 121b04d..5314db7 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2539,16 +2539,33 @@ static void xmon_print_symbol(unsigned long address, 
const char *mid,
 static void dump_slb(void)
 {
int i;
-   unsigned long tmp;
+   unsigned long esid,vsid,valid;
+   unsigned long llp;
 
printf("SLB contents of cpu %x\n", smp_processor_id());
 
for (i = 0; i < mmu_slb_size; i++) {
-   asm volatile("slbmfee  %0,%1" : "=r" (tmp) : "r" (i));
-   printf("%02d %016lx ", i, tmp);
-
-   asm volatile("slbmfev  %0,%1" : "=r" (tmp) : "r" (i));
-   printf("%016lx\n", tmp);
+   asm volatile("slbmfee  %0,%1" : "=r" (esid) : "r" (i));
+   asm volatile("slbmfev  %0,%1" : "=r" (vsid) : "r" (i));
+   valid = (esid & SLB_ESID_V);
+   if (valid | esid | vsid) {
+   printf("%02d %016lx %016lx", i, esid, vsid);
+   if (valid) {
+   llp = vsid & SLB_VSID_LLP;
+   if (vsid & SLB_VSID_B_1T) {
+   printf("  1T  ESID=%9lx  VSID=%13lx 
LLP:%3lx \n",
+   GET_ESID_1T(esid),
+   (vsid & ~SLB_VSID_B) >> 
SLB_VSID_SHIFT_1T,
+   llp);
+   } else {
+   printf(" 256M ESID=%9lx  VSID=%13lx 
LLP:%3lx \n",
+   GET_ESID(esid),
+   (vsid & ~SLB_VSID_B) >> 
SLB_VSID_SHIFT,
+   llp);
+   }
+   } else
+   printf("\n");
+   }
}
 }
 





___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 2.6.25-candidates branch updated in 4xx tree

2007-12-06 Thread Josh Boyer
On Tue, 4 Dec 2007 13:11:39 -0600
Josh Boyer <[EMAIL PROTECTED]> wrote:

> For those following my tree, I've added a 2.6.25-candidates branch and
> based it off of Paul's latest master.  (If you've already pulled
> you'll have to reset, sorry.)

I've updated this again with BenH's latest PCI patch series.  There are
a couple more commits from Stefan and Valentine for various platform
fixes, and I've also fixed the 4xx DTS files to work with both the old
and new DTC versions.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 0/25] powerpc: 4xx PCI, PCI-X and PCI-Express support among others

2007-12-06 Thread Josh Boyer
On Thu, 06 Dec 2007 18:59:59 +1100
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:

> 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.
> 

These are now in my 2.6.25-candidates tree.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 18/25] powerpc: Base support for 440GX Taishan eval board

2007-12-06 Thread Josh Boyer
On Thu, 06 Dec 2007 19:00:18 +1100
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:

> From: Hugh Blemings <[EMAIL PROTECTED]>
> 
> 
> Signed-off-by: Hugh Blemings <[EMAIL PROTECTED]>
> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
> ---
> 
> This needs a bit of cleanup still, probably not to be merged as-is
> just yet (like using mtdcri/mfdcri for CPR access).

A defconfig for it would be nice.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [PPC] virtex bug fix: Use canonical value for AC97 interrupt xparams

2007-12-06 Thread Josh Boyer
On Thu, 06 Dec 2007 12:16:44 -0700
Grant Likely <[EMAIL PROTECTED]> wrote:

> From: Grant Likely <[EMAIL PROTECTED]>
> 
> The ml300 and ml403 xparameters.h files use different macros for the AC97
> interrupt pin assignments.  This patch normalizes them to a canonical
> value similar to what EDK generates for most other devices
> 
> Signed-off-by: Grant Likely <[EMAIL PROTECTED]>

Acked-by: Josh Boyer <[EMAIL PROTECTED]>

Paul, can you just grab this one?  I don't have any other fixes for .24
queued at the moment.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] qe: add ability to upload QE firmware

2007-12-06 Thread Timur Tabi
Arnd Bergmann wrote:

> Ok, looks you were right from the start (again), thanks for your patience
> explaining this to me.

No problem.  No all I need is for Kumar to apply the patches!


-- 
Timur Tabi
Linux kernel developer at Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Are the MPC85xx DMA drivers already in a tree?

2007-12-06 Thread Clemens Koller
Clemens Koller schrieb:
 > I want to update a driver to test my mileage with the
 > Freescale DMA drivers for MPC85xx from Zhang Wei from 2007-09-07.
 >
 > Are those already available in some git tree to pull from?
 > What are the most current trees for powerpc development?
 > (galak, paulus, ?)

Okay, I've found that stuff in 2.6.24-rc4-mm1
I'll see if I can get something to work.

Regards,
-- 
Clemens Koller
__
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Straße 45/1
Linhof Werksgelände
D-81379 München
Tel.089-741518-50
Fax 089-741518-19
http://www.anagramm-technology.com

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [PPC] virtex bug fix: Use canonical value for AC97 interrupt xparams

2007-12-06 Thread Grant Likely
From: Grant Likely <[EMAIL PROTECTED]>

The ml300 and ml403 xparameters.h files use different macros for the AC97
interrupt pin assignments.  This patch normalizes them to a canonical
value similar to what EDK generates for most other devices

Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
---

Josh, Paulus; this is a bug fix needed to get ml300 support to compile
in arch/ppc.  Please merge for 2.6.24

Thanks,
g.

 arch/ppc/platforms/4xx/xparameters/xparameters.h |8 
 arch/ppc/syslib/virtex_devices.c |8 
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/ppc/platforms/4xx/xparameters/xparameters.h 
b/arch/ppc/platforms/4xx/xparameters/xparameters.h
index 01aa043..8ef0887 100644
--- a/arch/ppc/platforms/4xx/xparameters/xparameters.h
+++ b/arch/ppc/platforms/4xx/xparameters/xparameters.h
@@ -15,8 +15,16 @@
 
 #if defined(CONFIG_XILINX_ML300)
   #include "xparameters_ml300.h"
+  #define XPAR_INTC_0_AC97_CONTROLLER_REF_0_PLAYBACK_VEC_ID \
+   XPAR_DCR_INTC_0_OPB_AC97_CONTROLLER_REF_0_PLAYBACK_INTERRUPT_INTR
+  #define XPAR_INTC_0_AC97_CONTROLLER_REF_0_RECORD_VEC_ID \
+   XPAR_DCR_INTC_0_OPB_AC97_CONTROLLER_REF_0_RECORD_INTERRUPT_INTR
 #elif defined(CONFIG_XILINX_ML403)
   #include "xparameters_ml403.h"
+  #define XPAR_INTC_0_AC97_CONTROLLER_REF_0_PLAYBACK_VEC_ID \
+   XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_0_PLAYBACK_INTERRUPT_INTR
+  #define XPAR_INTC_0_AC97_CONTROLLER_REF_0_RECORD_VEC_ID \
+   XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_0_RECORD_INTERRUPT_INTR
 #else
   /* Add other board xparameter includes here before the #else */
   #error No xparameters_*.h file included
diff --git a/arch/ppc/syslib/virtex_devices.c b/arch/ppc/syslib/virtex_devices.c
index f658ff3..7322781 100644
--- a/arch/ppc/syslib/virtex_devices.c
+++ b/arch/ppc/syslib/virtex_devices.c
@@ -98,13 +98,13 @@
.flags = IORESOURCE_MEM, \
}, \
{ \
-   .start = 
XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_PLAYBACK_INTERRUPT_INTR, \
-   .end = 
XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_PLAYBACK_INTERRUPT_INTR, \
+   .start = 
XPAR_INTC_0_AC97_CONTROLLER_REF_##num##_PLAYBACK_VEC_ID, \
+   .end = 
XPAR_INTC_0_AC97_CONTROLLER_REF_##num##_PLAYBACK_VEC_ID, \
.flags = IORESOURCE_IRQ, \
}, \
{ \
-   .start = 
XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_RECORD_INTERRUPT_INTR, \
-   .end = 
XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_RECORD_INTERRUPT_INTR, \
+   .start = 
XPAR_INTC_0_AC97_CONTROLLER_REF_##num##_RECORD_VEC_ID, \
+   .end = 
XPAR_INTC_0_AC97_CONTROLLER_REF_##num##_RECORD_VEC_ID, \
.flags = IORESOURCE_IRQ, \
}, \
}, \

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Please pull from 'for-2.6.24' branch

2007-12-06 Thread Kumar Gala
Please pull from 'for-2.6.24' branch of

master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git for-2.6.24

to receive the following updates:

 arch/powerpc/kernel/asm-offsets.c|3 +--
 arch/powerpc/kernel/head_32.S|2 +-
 arch/powerpc/kernel/head_40x.S   |2 +-
 arch/powerpc/kernel/head_44x.S   |2 +-
 arch/powerpc/kernel/head_fsl_booke.S |2 +-
 include/asm-powerpc/pgtable-ppc32.h  |5 +
 6 files changed, 10 insertions(+), 6 deletions(-)

Kumar Gala (1):
  [POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE

commit bee86f14d51a5a9a3b1897e301da1e415df0ba23
Author: Kumar Gala <[EMAIL PROTECTED]>
Date:   Thu Dec 6 13:11:04 2007 -0600

[POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE

The size of swapper_pg_dir is 8k instead of 4k when using 64-bit PTEs
(CONFIG_PTE_64BIT).

This was reported by Cedric Hombourger <[EMAIL PROTECTED]>

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>

diff --git a/arch/powerpc/kernel/asm-offsets.c 
b/arch/powerpc/kernel/asm-offsets.c
index d67bcd8..ed083fe 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -326,8 +326,7 @@ int main(void)
DEFINE(VMALLOC_START_VSID, KERNEL_VSID(VMALLOC_START));
 #endif

-#ifdef CONFIG_PPC64
DEFINE(PGD_TABLE_SIZE, PGD_TABLE_SIZE);
-#endif
+
return 0;
 }
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index a5b13ae..0f4fac5 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -1311,7 +1311,7 @@ empty_zero_page:

.globl  swapper_pg_dir
 swapper_pg_dir:
-   .space  4096
+   .space  PGD_TABLE_SIZE

.globl intercept_table
 intercept_table:
diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index cfefc2d..8552e67 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -994,7 +994,7 @@ empty_zero_page:
.space  4096
.globl  swapper_pg_dir
 swapper_pg_dir:
-   .space  4096
+   .space  PGD_TABLE_SIZE


 /* Stack for handling critical exceptions from kernel mode */
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index 409db61..56aba84 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -722,7 +722,7 @@ empty_zero_page:
  */
.globl  swapper_pg_dir
 swapper_pg_dir:
-   .space  8192
+   .space  PGD_TABLE_SIZE

 /* Reserved 4k for the critical exception stack & 4k for the machine
  * check stack per CPU for kernel mode exceptions */
diff --git a/arch/powerpc/kernel/head_fsl_booke.S 
b/arch/powerpc/kernel/head_fsl_booke.S
index 4b98227..7aecb39 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -1035,7 +1035,7 @@ empty_zero_page:
.space  4096
.globl  swapper_pg_dir
 swapper_pg_dir:
-   .space  4096
+   .space  PGD_TABLE_SIZE

 /* Reserved 4k for the critical exception stack & 4k for the machine
  * check stack per CPU for kernel mode exceptions */
diff --git a/include/asm-powerpc/pgtable-ppc32.h 
b/include/asm-powerpc/pgtable-ppc32.h
index fea2d8f..d1332bb 100644
--- a/include/asm-powerpc/pgtable-ppc32.h
+++ b/include/asm-powerpc/pgtable-ppc32.h
@@ -86,6 +86,11 @@ extern int icache_44x_need_flush;
  * entries per page directory level: our page-table tree is two-level, so
  * we don't really have any PMD directory.
  */
+#ifndef __ASSEMBLY__
+#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_SHIFT)
+#define PGD_TABLE_SIZE (sizeof(pgd_t) << (32 - PGDIR_SHIFT))
+#endif /* __ASSEMBLY__ */
+
 #define PTRS_PER_PTE   (1 << PTE_SHIFT)
 #define PTRS_PER_PMD   1
 #define PTRS_PER_PGD   (1 << (32 - PGDIR_SHIFT))
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE

2007-12-06 Thread Kumar Gala
The size of swapper_pg_dir is 8k instead of 4k when using 64-bit PTEs
(CONFIG_PTE_64BIT).

This was reported by Cedric Hombourger <[EMAIL PROTECTED]>

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---

This is in my git tree, branch for-2.6.24 and I'll forward on a pull
request to Paul & Linus for it.

 arch/powerpc/kernel/asm-offsets.c|3 +--
 arch/powerpc/kernel/head_32.S|2 +-
 arch/powerpc/kernel/head_40x.S   |2 +-
 arch/powerpc/kernel/head_44x.S   |2 +-
 arch/powerpc/kernel/head_fsl_booke.S |2 +-
 include/asm-powerpc/pgtable-ppc32.h  |5 +
 6 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/asm-offsets.c 
b/arch/powerpc/kernel/asm-offsets.c
index d67bcd8..ed083fe 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -326,8 +326,7 @@ int main(void)
DEFINE(VMALLOC_START_VSID, KERNEL_VSID(VMALLOC_START));
 #endif

-#ifdef CONFIG_PPC64
DEFINE(PGD_TABLE_SIZE, PGD_TABLE_SIZE);
-#endif
+
return 0;
 }
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index a5b13ae..0f4fac5 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -1311,7 +1311,7 @@ empty_zero_page:

.globl  swapper_pg_dir
 swapper_pg_dir:
-   .space  4096
+   .space  PGD_TABLE_SIZE

.globl intercept_table
 intercept_table:
diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index cfefc2d..8552e67 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -994,7 +994,7 @@ empty_zero_page:
.space  4096
.globl  swapper_pg_dir
 swapper_pg_dir:
-   .space  4096
+   .space  PGD_TABLE_SIZE


 /* Stack for handling critical exceptions from kernel mode */
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index 409db61..56aba84 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -722,7 +722,7 @@ empty_zero_page:
  */
.globl  swapper_pg_dir
 swapper_pg_dir:
-   .space  8192
+   .space  PGD_TABLE_SIZE

 /* Reserved 4k for the critical exception stack & 4k for the machine
  * check stack per CPU for kernel mode exceptions */
diff --git a/arch/powerpc/kernel/head_fsl_booke.S 
b/arch/powerpc/kernel/head_fsl_booke.S
index 4b98227..7aecb39 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -1035,7 +1035,7 @@ empty_zero_page:
.space  4096
.globl  swapper_pg_dir
 swapper_pg_dir:
-   .space  4096
+   .space  PGD_TABLE_SIZE

 /* Reserved 4k for the critical exception stack & 4k for the machine
  * check stack per CPU for kernel mode exceptions */
diff --git a/include/asm-powerpc/pgtable-ppc32.h 
b/include/asm-powerpc/pgtable-ppc32.h
index fea2d8f..d1332bb 100644
--- a/include/asm-powerpc/pgtable-ppc32.h
+++ b/include/asm-powerpc/pgtable-ppc32.h
@@ -86,6 +86,11 @@ extern int icache_44x_need_flush;
  * entries per page directory level: our page-table tree is two-level, so
  * we don't really have any PMD directory.
  */
+#ifndef __ASSEMBLY__
+#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_SHIFT)
+#define PGD_TABLE_SIZE (sizeof(pgd_t) << (32 - PGDIR_SHIFT))
+#endif /* __ASSEMBLY__ */
+
 #define PTRS_PER_PTE   (1 << PTE_SHIFT)
 #define PTRS_PER_PMD   1
 #define PTRS_PER_PGD   (1 << (32 - PGDIR_SHIFT))
-- 
1.5.3.4

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 07/19] [POWERPC] iSeries: unindent and clean iSeries_pci_final_fixup

2007-12-06 Thread Olof Johansson
On Fri, Dec 07, 2007 at 01:51:48AM +1100, Stephen Rothwell wrote:
> 
> Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
> ---
>  arch/powerpc/platforms/iseries/pci.c |   68 +
>  1 files changed, 35 insertions(+), 33 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/iseries/pci.c 
> b/arch/powerpc/platforms/iseries/pci.c
> index cff832a..8e2ac3d 100644
> --- a/arch/powerpc/platforms/iseries/pci.c
> +++ b/arch/powerpc/platforms/iseries/pci.c
> @@ -177,47 +177,49 @@ void __init iSeries_pci_final_fixup(void)
>  
>   printk("pcibios_final_fixup\n");
>   for_each_pci_dev(pdev) {
> + struct pci_dn *pdn;
> + const u32 *agent;
> +
>   node = find_device_node(pdev->bus->number, pdev->devfn);
>   printk("pci dev %p (%x.%x), node %p\n", pdev,
>  pdev->bus->number, pdev->devfn, node);
> + if (!node) {
> + printk("PCI: Device Tree not found for 0x%016lX\n",
> + (unsigned long)pdev);

Hi,

Care to add KERN_ levels, while you're touching it? (both printks above
lack them).


-Olof
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] IB/ehca: Serialize HCA-related hCalls on POWER5

2007-12-06 Thread Roland Dreier
 > > +   ehca_lock_hcalls = !(cur_cpu_spec->cpu_user_features
 > > +        & PPC_FEATURE_ARCH_2_05);

 > We already talked about this yesterday, but I still feel that checking the
 > instruction set of the CPU should not be used to determine whether a
 > specific device driver implementation is used int hypervisor.

I had the same reaction... is testing cpu_user_features really the
best way to detect this issue?

I'll hold off applying this for a few days so you guys can decide the
best thing to do.  We'll definitely get some fix into 2.6.24 but we
have time to make a good decision.

 > Regarding the performance problem, have you checked whether converting all
 > your spin_lock_irqsave to spin_lock/spin_lock_irq improves your performance
 > on the older machines? Maybe it's already fast enough that way.

It does seem that the only places that the hcall_lock is taken also
use msleep, so they must always be in process context.  So you can
safely just use spin_lock(), right?

 - R.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Regarding MPC8641D

2007-12-06 Thread Siva Prasad

Hello Bala,

I don't think the ioremap issues are related with low memory offset
mode. But again, I am not sure if you (system by default does not do it)
are reserving that area (from 256 to 512 which is low memory offset
region). Further, where do you get this 504 number specifically?

If you want, I can try out your code on my 8641D board.

Thanks
Siva


Date: Wed, 5 Dec 2007 17:45:01 -0800 (PST)
From: sivaji <[EMAIL PROTECTED]>
Subject: Re: Regarding MPC8641D
To: linuxppc-dev@ozlabs.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii


Hi,
   We need only SMP mode, asper ur idea let me disable the Low
memory offset mode. We face some issues when ioremap in the kernel, we
guess
the problem is related to Low memory offset mode so only we go for that.
Consider now the Low memory offset is disable the bootargs
(root=/dev/ram
console=ttyS0, mem=504M). When mem=504 or greater than  we are not able
to
ioremap, if mem is less than 500 there was no issues on ioremap. We
can't
understand why ioremap was failed for 504M?

Thanks and Regards
S.Balamurugan


Siva Prasad-3 wrote:
> 
> Hi,
> 
> If you want to use SMP, do not enable low memory offset mode. That is
> only and only for AMP, not for SMP. All the exception vectors go into
a
> different address range for core1, once you enable that, resulting in
a
> need for entirely different copy of OS (be it Linux, or any other OS).
> 
> You are in the right path. Just don't enable low memory offset mode,
> unless you are looking for Assymetric multi-processing.
> 
> - siva
> 
> 
> 
> 
> Message: 6
> Date: Wed, 5 Dec 2007 16:45:31 -0800 (PST)
> From: sivaji <[EMAIL PROTECTED]>
> Subject: Re: Regarding MPC8641D
> To: linuxppc-dev@ozlabs.org
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=us-ascii
> 
> 
> Hai,
>  The kernel was compiled in SMP mode. The low memory
offset
> mode
> is only for AMP mode means, then how we test both the core 0 and 1 in
> the
> linux kernel ?. Asper my understanding if we enable the Low Memory
> Offset
> mode, then only the core1 translation is enabled. If we disalbed the
Low
> Memory offset mode, Only Core 0  will work in SMP mode and Core 1 will
> idle.
> If we want to test the efficient of Dual core means we need to enable
> both
> the core and Low Memory Offset Mode. For this configuration linux
kernel
> was
> not up.
> ( Please correct me if I am wrong )
> 
> Thanks and Regards
> Sivaji
> 
> 
> Chris Fester wrote:
>> 
>> On Tue, 2007-12-04 at 23:51 -0800, sivaji wrote:
>>> We have designed  a MPC8641D based AMC card. We are
using
> the
>>> kernel (2.6.23-rc4) and uboot (1.2.0).  When we disable the core1
Low
>>> Memory
>>> offset mode the kernel was up and when we enable this core1 Low
> Memory
>>> offset mode kernel was not up, It was hang after MPIC
initialization.
>> [snip!]
>>>  After this the kernel was hang, i want to know
> why
>>> kernel was hang when we enalbe Low memory Offset mode. Please help
me
> to
>>> fix
>>> this issue.
>> 
>> Have you compiled your kernel for SMP mode?  I believe the Low memory
>> offset mode is only for AMP mode (vxworks can use this, probably
other
>> OSes).  I don't know if the kernel has support for any
multiprocessing
>> mode other than SMP.
>> 
>> Hope that helps,
>> Chris
>> 
> 
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
> 
> 


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


RE: Linuxppc-dev Digest, Vol 40, Issue 57

2007-12-06 Thread Siva Prasad
ck_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.


--

Message: 8
Date: Thu, 06 Dec 2007 14:48:18 +1100
From: Michael Ellerman <[EMAIL PROTECTED]>
Subject: Re: drivers/net/iseries_veth.c dubious sysfs usage
To: Greg KH <[EMAIL PROTECTED]>
Cc: linuxppc-dev@ozlabs.org, "Kyle A. Lucke" <[EMAIL PROTECTED]>,
[EMAIL PROTECTED], [EMAIL PROTECTED],   David Gibson
<[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"

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 root0 Dec  6 10:22 .
drwxr-xr-x  6 root root0 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 root0 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 root0 Dec  6 10:30 statistics
lrwxrwxrwx  1 root root0 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 root0 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 root0 Dec  6 10:21 2 -> ../../../../devices/vio/2
lrwxrwxrwx  1 root root0 Dec  6 10:21 3 -> ../../../../devices/vio/3
--w---  1 root root 4096 Dec  6 10:21 bind
drwxr-xr-x  2 root root0 Dec  6 10:21 cnx00
drwxr-xr-x  2 root root0 Dec  6 10:21 cnx02
drwxr-xr-x  2 root root0 Dec  6 10:21 cnx03
drwxr-xr-x  2 root root0 Dec  6 10:21 cnx04
lrwxrwxrwx  1 root root0 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 sys

[PATCH v3] qe: add ability to upload QE firmware

2007-12-06 Thread Timur Tabi
Define the layout of a binary blob that contains a QE firmware and instructions
on how to upload it.  Add function qe_upload_firmware() to parse the blob
and perform the actual upload.  Fully define 'struct rsp' in immap_qe.h to
include the actual RISC Special Registers.  Added description of a new
QE firmware node to booting-without-of.txt.

Signed-off-by: Timur Tabi <[EMAIL PROTECTED]>
---

Forgot to include booting-without-of.txt

This patch is for Kumar's for-2.6.25 branch.  This code is necessary for
my QE UART driver.

 Documentation/powerpc/00-INDEX   |3 +
 Documentation/powerpc/booting-without-of.txt |   33 +++-
 Documentation/powerpc/qe_firmware.txt|  295 ++
 arch/powerpc/platforms/Kconfig   |1 +
 arch/powerpc/sysdev/qe_lib/qe.c  |  240 +
 include/asm-powerpc/immap_qe.h   |   34 +++-
 include/asm-powerpc/qe.h |   61 ++
 7 files changed, 663 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/powerpc/qe_firmware.txt

diff --git a/Documentation/powerpc/00-INDEX b/Documentation/powerpc/00-INDEX
index 94a3c57..3be84aa 100644
--- a/Documentation/powerpc/00-INDEX
+++ b/Documentation/powerpc/00-INDEX
@@ -28,3 +28,6 @@ sound.txt
- info on sound support under Linux/PPC
 zImage_layout.txt
- info on the kernel images for Linux/PPC
+qe_firmware.txt
+   - describes the layout of firmware binaries for the Freescale QUICC
+ Engine and the code that parses and uploads the microcode therein.
diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..9c69995 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -52,7 +52,10 @@ Table of Contents
   i) Freescale QUICC Engine module (QE)
   j) CFI or JEDEC memory-mapped NOR flash
   k) Global Utilities Block
-  l) Xilinx IP cores
+  l) Freescale Communications Processor Module
+  m) Chipselect/Local Bus
+  n) 4xx/Axon EMAC ethernet nodes
+  o) Xilinx IP cores
 
   VII - Specifying interrupt information for devices
 1) interrupts property
@@ -1772,6 +1775,32 @@ platforms are moved over to use the 
flattened-device-tree model.
};
};
 
+   viii) Uploaded QE firmware
+
+If a new firwmare has been uploaded to the QE (usually by the
+boot loader), then a 'firmware' child node should be added to the QE
+node.  This node provides information on the uploaded firmware that
+device drivers may need.
+
+Required properties:
+- name: The string name of the firmware.  This is taken from the
+'id' member of the qe_firmware structure of the uploaded
+firmware.  Device drivers can search this string to determine
+if the firmware they want is already present.
+- extended_modes: The Extended Modes bitfield, taken from the
+  firmware binary.  It is a 64-bit number represented
+  as an array of two 32-bit numbers.
+- vtraps: The virtual traps, taken from the firmware binary.  It is an
+  array of 16 32-bit numbers.
+
+   Example:
+
+   firmware {
+   name = "Soft-UART";
+   extended_modes = <0 0>;
+   vtraps = <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>;
+   }
+
j) CFI or JEDEC memory-mapped NOR flash
 
 Flash chips (Memory Technology Devices) are often used for solid state
@@ -2254,7 +2283,7 @@ platforms are moved over to use the flattened-device-tree 
model.
   available.
   For Axon: 0x012a
 
-   l) Xilinx IP cores
+   o) Xilinx IP cores
 
The Xilinx EDK toolchain ships with a set of IP cores (devices) for use
in Xilinx Spartan and Virtex FPGAs.  The devices cover the whole range
diff --git a/Documentation/powerpc/qe_firmware.txt 
b/Documentation/powerpc/qe_firmware.txt
new file mode 100644
index 000..8962664
--- /dev/null
+++ b/Documentation/powerpc/qe_firmware.txt
@@ -0,0 +1,295 @@
+  Freescale QUICC Engine Firmware Uploading
+  -
+
+(c) 2007 Timur Tabi ,
+Freescale Semiconductor
+
+Table of Contents
+=
+
+  I - Software License for Firmware
+
+  II - Microcode Availability
+
+  III - Description and Terminology
+
+  IV - Microcode Programming Details
+
+  V - Firmware Structure Layout
+
+  VI - Sample Code for Creating Firmware Files
+
+Revision Information
+
+
+November 30, 2007: Rev 1.0 - Initial version
+
+I - Software License for Firmware
+=
+
+Each firmware file comes with its own software license.  For information on
+the particular license, please see the license text that is distribu

Re: [PATCH v2] qe: add ability to upload QE firmware

2007-12-06 Thread Timur Tabi
Timur Tabi wrote:

> I think these patches are final:
> 
> [PATCH 1/2] qe: add function qe_clock_source (dated 12/3)
> [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree 
> properties (dated 12/3)
> [PATCH v2] qe: add ability to upload QE firmware

I lied.  This last patch is missing a file.  v3 is coming soon.  Sorry.

-- 
Timur Tabi
Linux kernel developer at Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] usb: Remove broken optimisation in OHCI IRQ handler

2007-12-06 Thread David Brownell
On Sunday 25 November 2007, Benjamin Herrenschmidt wrote:
> While there, any reason why we do the read of the interenable register
> and mask ? Is that actually useful in practice ? I haven't removed it
> but it might be a good candidate if we want to save on MMIO reads.

The code uses that register to keep track of which IRQs are enabled
or disabled, and those enabled IRQs are changed from time to time.

I don't know of any good reason not to keep an in-memory copy of the
resulting mask, though I'd keep an eye out for chip errata.

- Dave


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


ucc_geth 10 Mbit/s locks up CPU even though NAPI is enabled

2007-12-06 Thread Joakim Tjernlund
Injecting a 10 MBit/s stream with 64 bytes pkgs locks up my
MPC832x CPU even though I got NAPI enabled. Kernel 2.6.23

Any ideas?

 Jocke
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC/PATCH 5/10] powerpc: pci32: Remove obsolete PowerMac bus number hack

2007-12-06 Thread Jon Loeliger
On Thu, 2007-12-06 at 02:11, Benjamin Herrenschmidt wrote:
> The 32 bits PCI code carries an old hack that was only useful for G5
> machines. Nowdays, the 32 bits kernel doesn't support any of those
> machines anymore so the hack is basically never used, remove it.
> 
> Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
> ---
> 
>  arch/powerpc/kernel/pci_32.c |   11 ---
>  1 file changed, 11 deletions(-)
> 
> Index: linux-work/arch/powerpc/kernel/pci_32.c
> ===
> --- linux-work.orig/arch/powerpc/kernel/pci_32.c  2007-12-05 
> 11:36:30.0 +1100
> +++ linux-work/arch/powerpc/kernel/pci_32.c   2007-12-05 11:36:36.0 
> +1100
> @@ -922,17 +922,6 @@ long sys_pciconfig_iobase(long which, un
>   struct pci_controller* hose;
>   long result = -EOPNOTSUPP;
>  
> - /* Argh ! Please forgive me for that hack, but that's the
> -  * simplest way to get existing XFree to not lockup on some
> -  * G5 machines... So when something asks for bus 0 io base
> -  * (bus 0 is HT root), we return the AGP one instead.
> -  */
> -#ifdef CONFIG_PPC_PMAC
> - if (machine_is(powermac) && machine_is_compatible("MacRISC4"))
> - if (bus == 0)
> - bus = 0xf0;
> -#endif /* CONFIG_PPC_PMAC */
> -

I believe, with this patch, you are officially forgiven. :-)

jdl


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 19/19] [POWERPC] pci_controller->arch_data really is a struct device_node *

2007-12-06 Thread Jon Loeliger
On Thu, 2007-12-06 at 09:05, Stephen Rothwell wrote:
> Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
> ---
>  arch/powerpc/kernel/pci_32.c   |6 +++---
>  arch/powerpc/kernel/pci_64.c   |6 ++
>  arch/powerpc/kernel/pci_dn.c   |2 +-
>  arch/powerpc/platforms/85xx/mpc85xx_ds.c   |2 +-
>  arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |2 +-
>  arch/powerpc/platforms/powermac/pci.c  |2 +-
>  arch/powerpc/platforms/pseries/iommu.c |2 +-
>  include/asm-powerpc/pci-bridge.h   |5 +++--
>  8 files changed, 13 insertions(+), 14 deletions(-)

I see that 86xx tinkering, so...

Acked-by:  Jon Loeliger <[EMAIL PROTECTED]>

that.

Thanks,
jdl


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] qe: add ability to upload QE firmware

2007-12-06 Thread Kumar Gala

On Dec 6, 2007, at 9:59 AM, Timur Tabi wrote:

> Arnd Bergmann wrote:
>
>> Ok, looks you were right from the start (again), thanks for your  
>> patience
>> explaining this to me.
>
> No problem.  No all I need is for Kumar to apply the patches!

When I wait you come up with a new version.. so I'm waiting to see if  
v3 comes out :)

- k
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] qe: add ability to upload QE firmware

2007-12-06 Thread Arnd Bergmann
On Thursday 06 December 2007, Timur Tabi wrote:
> In reality, having the boot loader load the firmware will usually be the 
> preferred approach, because that's simpler.  Having it in both U-Boot and the 
> kernel covers all situations, though.  There would be no need for the 
> bootloader 
> to pass the firmware to the kernel.

Ok, looks you were right from the start (again), thanks for your patience
explaining this to me.

Arnd <><
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] IB/ehca: Serialize HCA-related hCalls on POWER5

2007-12-06 Thread Arnd Bergmann
On Thursday 06 December 2007, Joachim Fenkes wrote:
> printk(KERN_INFO "eHCA Infiniband Device Driver "
>        "(Version " HCAD_VERSION ")\n");
>  
> +   /* Autodetect hCall locking -- we can't read the firmware version
> +    * directly, but we know that starting with POWER6, all firmware
> +    * versions are good.
> +    */
> +   if (ehca_lock_hcalls == -1)
> +   ehca_lock_hcalls = !(cur_cpu_spec->cpu_user_features
> +        & PPC_FEATURE_ARCH_2_05);
> +
> ret = ehca_create_comp_pool();
> if (ret) {
> ehca_gen_err("Cannot create comp pool.");

We already talked about this yesterday, but I still feel that checking the
instruction set of the CPU should not be used to determine whether a
specific device driver implementation is used int hypervisor.

At the very least, I think you should change this to read the hypervisor
version number from the device tree, though the ideal solution would be
to have the absence of this bug encoded in the device node for the ehca
device itself.

Regarding the performance problem, have you checked whether converting all
your spin_lock_irqsave to spin_lock/spin_lock_irq improves your performance
on the older machines? Maybe it's already fast enough that way.

Arnd <><
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Powerpc PCI cleanups (mainly iSeries)

2007-12-06 Thread Josh Boyer
On Fri, 7 Dec 2007 02:07:26 +1100
Stephen Rothwell <[EMAIL PROTECTED]> wrote:

> On Thu, 6 Dec 2007 18:00:45 +1100 Stephen Rothwell <[EMAIL PROTECTED]> wrote:
> >
> > I started out looking for ways to remove our dependencies on pci_dn and
> > got sidetracked into clening up the iSeries PCI code.  The intention of
> > the following set of patches is that there be no semantic changes
> > (mostly).
> 
> Some of these will clearly conflict with Benh's PCI work.  We will sot
> that out between us.  :-)

In the meantime...

My tree is going to carry BenH's patches since they're obviously
important to 4xx.  If these conflicts get sorted out soon, that would
be good :).  At some point I'm going to start sending stuff to Paul.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] qe: add ability to upload QE firmware

2007-12-06 Thread Timur Tabi
Arnd Bergmann wrote:

> My point is that you could have some extra code that calls your
> qe_upload_firmware() when the device tree contains the blob but the boot
> loader did not already load it.

The current design of the 'firmware' node is such that if present, that means 
that the firmware has already been uploaded.

We can't use the device tree to tell the kernel which firmware to upload, 
because that is determined exclusively by the user's application.  The drivers 
are ultimately responsible for deciding which firmware to use.

> This helps e.g. for the case where you
> want to be able to install a generic Linux distribution that is not
> able to ship with your firmware blob in the kernel or the root file system.
> Putting the blob in the device tree makes it easier to get to a running
> system then.

But where would the blob come from?  Probably from flash or a TFTP server.  In 
that case, the boot loader can still handle it.

> You can argue that the boot loader can always load the firmware in the
> first place, but then you wouldn't need an implementation of
> qe_upload_firmware in the kernel any more.

You might want to do runtime swapping of firmwares.  One of the drawbacks of 
the 
QE microcode design is that you can only have one microcode uploaded at a time. 
  If you need to have two different microcodes (e.g. Soft-UART and 
interworking), then you need to merge the source code for those two into a new 
microcode and compile that.

You might need to do full reset of the QE, which would require re-uploading.

You might not know until after the kernel boots which firmware you want.

In reality, having the boot loader load the firmware will usually be the 
preferred approach, because that's simpler.  Having it in both U-Boot and the 
kernel covers all situations, though.  There would be no need for the 
bootloader 
to pass the firmware to the kernel.

-- 
Timur Tabi
Linux kernel developer at Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] qe: add ability to upload QE firmware

2007-12-06 Thread Arnd Bergmann
On Thursday 06 December 2007, Timur Tabi wrote:
> > I'm not trying to convince you of this if it's completely pointless for
> > all your systems, just want to make sure you're aware of this option,
> > because spending a few extra code lines on it now may save you some trouble
> > if you need this later.
> 
> Um, I think I'm a little confused as to what your point is.  My code is just 
> a 
> generic QE firmware uploader.

My point is that you could have some extra code that calls your
qe_upload_firmware() when the device tree contains the blob but the boot
loader did not already load it. This helps e.g. for the case where you
want to be able to install a generic Linux distribution that is not
able to ship with your firmware blob in the kernel or the root file system.
Putting the blob in the device tree makes it easier to get to a running
system then.

You can argue that the boot loader can always load the firmware in the
first place, but then you wouldn't need an implementation of
qe_upload_firmware in the kernel any more.

Arnd <><
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] windfarm: add PowerMac 12,1 support

2007-12-06 Thread Étienne Bersac
Hi,

> + /* First, locate the params for this model */
> + for (i = 0; i < PM121_NUM_CONFIGS; i++) {
> + param = &(pm121_sys_all_params[loop_id][i]);
> + if (param->model_id == pm121_mach_model)
> + break;
> + }
> +
> + /* No params found, put fans to max */
> + if (param == NULL) {
> + printk(KERN_WARNING "pm121: %s fan config not found "
> +" for this machine model\n",
> +loop_names[loop_id]);
> + goto fail;
> + }

This part might be buggy. param NULL only when PM121_NUM_CONFIGS is 0.
The original code was :


+   for (i = 0; i < PM121_NUM_CONFIGS; i++) {
+   if (pm121_sys_all_params[loop_id][i].model_id == 
pm121_mach_model) {
+   param = &(pm121_sys_all_params[loop_id][i]);
+   break;
+   }
+   }

But the line is wider than 80 chars. An alternative would be  :


+   for (i = 0; i < PM121_NUM_CONFIGS; i++) {
+   param = &(pm121_sys_all_params[loop_id][i]);
+   if (param->model_id == pm121_mach_model)
+   break;
+   else
+   param = NULL;
+   }

I wonder if that's more readable.


Regards,
Étienne.
-- 
E Ultreïa !


signature.asc
Description: Ceci est une partie de message	numériquement signée
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: dtc: Remove obsolete check_properties() function

2007-12-06 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
> 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 <[EMAIL PROTECTED]>

Applied.

jdl
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: dtc: Migrate "string property" checks to new framework

2007-12-06 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
> 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 <[EMAIL PROTECTED]>

Applied.

jdl
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: dtc: Migrate "one cell" checks to new framework

2007-12-06 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
> 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 <[EMAIL PROTECTED]>

Applied.

jdl
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: dtc: More detailed testing of tree checks

2007-12-06 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
> 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 <[EMAIL PROTECTED]>

Applied.

jdl
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: dtc: Remove space from flex command line

2007-12-06 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
> Author: Geoff Levand <[EMAIL PROTECTED]>
> 
> 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 <[EMAIL PROTECTED]>

Applied.

Note, the way to specify the Author of a git patch is to
include the "From: Name " line at the beginning of
the patch's log message.

Oh, and, the author's SOB should be there too...? :-)

Thanks,
jdl

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] IB/ehca: Serialize HCA-related hCalls on POWER5

2007-12-06 Thread Joachim Fenkes
All firmware versions on POWER5 systems have a locking issue in the
HCA-related hCalls that can cause loss of Infiniband connectivity if
allocate and free calls happen in parallel. This may for example be caused
if two processes are using OpenMPI in parallel.
Circumvent this by serializing all HCA-related hCalls on POWER5.

Signed-off-by: Joachim Fenkes <[EMAIL PROTECTED]>
---

We tested this patch, especially the autodetection, and it works okay.
Please review and apply for 2.6.24-rc5 - thanks!

 drivers/infiniband/hw/ehca/ehca_main.c |   16 
 drivers/infiniband/hw/ehca/hcp_if.c|   28 +++-
 2 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_main.c 
b/drivers/infiniband/hw/ehca/ehca_main.c
index 90d4334..8f33d06 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -43,6 +43,9 @@
 #ifdef CONFIG_PPC_64K_PAGES
 #include 
 #endif
+
+#include 
+
 #include "ehca_classes.h"
 #include "ehca_iverbs.h"
 #include "ehca_mrmw.h"
@@ -66,6 +69,7 @@ int ehca_poll_all_eqs  = 1;
 int ehca_static_rate   = -1;
 int ehca_scaling_code  = 0;
 int ehca_mr_largepage  = 1;
+int ehca_lock_hcalls   = -1;
 
 module_param_named(open_aqp1, ehca_open_aqp1, int, S_IRUGO);
 module_param_named(debug_level,   ehca_debug_level,   int, S_IRUGO);
@@ -77,6 +81,7 @@ module_param_named(poll_all_eqs,  ehca_poll_all_eqs,  int, 
S_IRUGO);
 module_param_named(static_rate,   ehca_static_rate,   int, S_IRUGO);
 module_param_named(scaling_code,  ehca_scaling_code,  int, S_IRUGO);
 module_param_named(mr_largepage,  ehca_mr_largepage,  int, S_IRUGO);
+module_param_named(lock_hcalls,   ehca_lock_hcalls,   bool, S_IRUGO);
 
 MODULE_PARM_DESC(open_aqp1,
 "AQP1 on startup (0: no (default), 1: yes)");
@@ -102,6 +107,9 @@ MODULE_PARM_DESC(scaling_code,
 MODULE_PARM_DESC(mr_largepage,
 "use large page for MR (0: use PAGE_SIZE (default), "
 "1: use large page depending on MR size");
+MODULE_PARM_DESC(lock_hcalls,
+"serialize all hCalls made by the driver "
+"(default: autodetect)");
 
 DEFINE_RWLOCK(ehca_qp_idr_lock);
 DEFINE_RWLOCK(ehca_cq_idr_lock);
@@ -924,6 +932,14 @@ int __init ehca_module_init(void)
printk(KERN_INFO "eHCA Infiniband Device Driver "
   "(Version " HCAD_VERSION ")\n");
 
+   /* Autodetect hCall locking -- we can't read the firmware version
+* directly, but we know that starting with POWER6, all firmware
+* versions are good.
+*/
+   if (ehca_lock_hcalls == -1)
+   ehca_lock_hcalls = !(cur_cpu_spec->cpu_user_features
+& PPC_FEATURE_ARCH_2_05);
+
ret = ehca_create_comp_pool();
if (ret) {
ehca_gen_err("Cannot create comp pool.");
diff --git a/drivers/infiniband/hw/ehca/hcp_if.c 
b/drivers/infiniband/hw/ehca/hcp_if.c
index c16a213..331b5e8 100644
--- a/drivers/infiniband/hw/ehca/hcp_if.c
+++ b/drivers/infiniband/hw/ehca/hcp_if.c
@@ -89,6 +89,7 @@
 #define HCALL9_REGS_FORMAT HCALL7_REGS_FORMAT " r11=%lx r12=%lx"
 
 static DEFINE_SPINLOCK(hcall_lock);
+extern int ehca_lock_hcalls;
 
 static u32 get_longbusy_msecs(int longbusy_rc)
 {
@@ -120,26 +121,21 @@ static long ehca_plpar_hcall_norets(unsigned long opcode,
unsigned long arg7)
 {
long ret;
-   int i, sleep_msecs, do_lock;
-   unsigned long flags;
+   int i, sleep_msecs;
+   unsigned long flags = 0;
 
ehca_gen_dbg("opcode=%lx " HCALL7_REGS_FORMAT,
 opcode, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
 
-   /* lock H_FREE_RESOURCE(MR) against itself and H_ALLOC_RESOURCE(MR) */
-   if ((opcode == H_FREE_RESOURCE) && (arg7 == 5)) {
-   arg7 = 0; /* better not upset firmware */
-   do_lock = 1;
-   }
-
for (i = 0; i < 5; i++) {
-   if (do_lock)
+   /* serialize hCalls to work around firmware issue */
+   if (ehca_lock_hcalls)
spin_lock_irqsave(&hcall_lock, flags);
 
ret = plpar_hcall_norets(opcode, arg1, arg2, arg3, arg4,
 arg5, arg6, arg7);
 
-   if (do_lock)
+   if (ehca_lock_hcalls)
spin_unlock_irqrestore(&hcall_lock, flags);
 
if (H_IS_LONG_BUSY(ret)) {
@@ -174,24 +170,22 @@ static long ehca_plpar_hcall9(unsigned long opcode,
  unsigned long arg9)
 {
long ret;
-   int i, sleep_msecs, do_lock;
+   int i, sleep_msecs;
unsigned long flags = 0;
 
ehca_gen_dbg("INPUT -- opcode=%lx " HCALL9_REGS_FORMAT, opcode,
 arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
 
-   /* lock H_ALLOC_RESOURCE(MR) against itself and H_FREE_RESOURCE(MR) */
-   do_lock = ((opco

Re: Powerpc PCI cleanups (mainly iSeries)

2007-12-06 Thread Stephen Rothwell
On Thu, 6 Dec 2007 18:00:45 +1100 Stephen Rothwell <[EMAIL PROTECTED]> wrote:
>
> I started out looking for ways to remove our dependencies on pci_dn and
> got sidetracked into clening up the iSeries PCI code.  The intention of
> the following set of patches is that there be no semantic changes
> (mostly).

Some of these will clearly conflict with Benh's PCI work.  We will sot
that out between us.  :-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpTkpanFBdxW.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[PATCH 19/19] [POWERPC] pci_controller->arch_data really is a struct device_node *

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/pci_32.c   |6 +++---
 arch/powerpc/kernel/pci_64.c   |6 ++
 arch/powerpc/kernel/pci_dn.c   |2 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |2 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |2 +-
 arch/powerpc/platforms/powermac/pci.c  |2 +-
 arch/powerpc/platforms/pseries/iommu.c |2 +-
 include/asm-powerpc/pci-bridge.h   |5 +++--
 8 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index e1151b5..3a05f4f 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -661,8 +661,8 @@ pcibios_make_OF_bus_map(void)
 
/* For each hose, we begin searching bridges */
list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
-   struct device_node* node;   
-   node = (struct device_node *)hose->arch_data;
+   struct device_node* node = hose->arch_data;
+
if (!node)
continue;
make_one_node_map(node, hose->first_busno);
@@ -813,7 +813,7 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, 
u8* devfn)
hose = pci_find_hose_for_OF_device(node);
if (!hose || !hose->arch_data)
return -ENODEV;
-   if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child,
+   if (!scan_OF_pci_childs(hose->arch_data->child,
find_OF_pci_device_filter, (void *)node))
return -ENODEV;
reg = of_get_property(node, "reg", NULL);
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index acf1219..b452031 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -612,8 +612,7 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
if (hose->io_base_alloc == 0)
return 0;
 
-   DBG("IO unmapping for PHB %s\n",
-   ((struct device_node *)hose->arch_data)->full_name);
+   DBG("IO unmapping for PHB %s\n", hose->arch_data->full_name);
DBG("  alloc=0x%p\n", hose->io_base_alloc);
 
/* This is a PHB, we fully unmap the IO area */
@@ -672,8 +671,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
hose->io_base_virt = (void __iomem *)(area->addr +
  hose->io_base_phys - phys_page);
 
-   DBG("IO mapping for PHB %s\n",
-   ((struct device_node *)hose->arch_data)->full_name);
+   DBG("IO mapping for PHB %s\n", hose->arch_data->full_name);
DBG("  phys=0x%016lx, virt=0x%p (alloc=0x%p)\n",
hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc);
DBG("  size=0x%016lx (alloc=0x%016lx)\n",
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index b483903..f326e91 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -133,7 +133,7 @@ void *traverse_pci_devices(struct device_node *start, 
traverse_func pre,
  */
 void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb)
 {
-   struct device_node * dn = (struct device_node *) phb->arch_data;
+   struct device_node *dn = phb->arch_data;
struct pci_dn *pdn;
 
/* PHB nodes themselves must not match */
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 59c121a..d084829 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -123,7 +123,7 @@ static int mpc85xx_exclude_device(struct pci_controller 
*hose,
struct device_node* node;
struct resource rsrc;
 
-   node = (struct device_node *)hose->arch_data;
+   node = hose->arch_data;
of_address_to_resource(node, 0, &rsrc);
 
if ((rsrc.start & 0xf) == primary_phb_addr) {
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c 
b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 32a531a..49b2bee 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -116,7 +116,7 @@ static int mpc86xx_exclude_device(struct pci_controller 
*hose,
struct device_node* node;   
struct resource rsrc;
 
-   node = (struct device_node *)hose->arch_data;
+   node = hose->arch_data;
of_address_to_resource(node, 0, &rsrc);
 
if ((rsrc.start & 0xf) == 0x8000) {
diff --git a/arch/powerpc/platforms/powermac/pci.c 
b/arch/powerpc/platforms/powermac/pci.c
index ec49099..472f44b 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -778,7 +778,7 @@ static void __init setup_u4_pcie(struct pci_controller* 
hose)
 
 static void __init setup_u3_ht(struct pci_controller* hose)
 {
-   struct device_node *np = (struct device_node *)hose->arch_data;
+   struct device_node *np

[PATCH 18/19] [POWERPC] Don't special case pci_domain_nr() for iSeries

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/pci-common.c |9 ++---
 arch/powerpc/platforms/iseries/pci.c |2 ++
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 252dd1e..e0d4a2a 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -118,15 +118,10 @@ int pcibios_vaddr_is_ioport(void __iomem *address)
  */
 int pci_domain_nr(struct pci_bus *bus)
 {
-   if (firmware_has_feature(FW_FEATURE_ISERIES))
-   return 0;
-   else {
-   struct pci_controller *hose = pci_bus_to_host(bus);
+   struct pci_controller *hose = pci_bus_to_host(bus);
 
-   return hose->global_number;
-   }
+   return hose->global_number;
 }
-
 EXPORT_SYMBOL(pci_domain_nr);
 
 #ifdef CONFIG_PPC_OF
diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index db0a17e..3071a30 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -673,6 +673,8 @@ void __init iSeries_pcibios_init(void)
phb = pcibios_alloc_controller(node);
if (phb == NULL)
continue;
+   /* All legacy iSeries PHBs are in domain zero */
+   phb->global_number = 0;
 
phb->pci_mem_offset = bus;
phb->first_busno = bus;
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 17/19] [POWERPC] remove some iSeries platform checks from the PCI code

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/pci_64.c |   23 ---
 arch/powerpc/platforms/iseries/pci.c |2 ++
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 42ff9c9..acf1219 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -31,7 +31,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #ifdef DEBUG
 #include 
@@ -197,9 +196,6 @@ static void __init pcibios_claim_of_setup(void)
 {
struct pci_bus *b;
 
-   if (firmware_has_feature(FW_FEATURE_ISERIES))
-   return;
-
list_for_each_entry(b, &pci_root_buses, node)
pcibios_claim_one_bus(b);
 }
@@ -477,8 +473,7 @@ void __devinit scan_phb(struct pci_controller *hose)
bus->secondary = hose->first_busno;
hose->bus = bus;
 
-   if (!firmware_has_feature(FW_FEATURE_ISERIES))
-   pcibios_map_io_space(bus);
+   pcibios_map_io_space(bus);
 
bus->resource[0] = res = &hose->io_resource;
if (res->flags && request_resource(&ioport_resource, res)) {
@@ -527,15 +522,13 @@ static int __init pcibios_init(void)
pci_bus_add_devices(hose->bus);
}
 
-   if (!firmware_has_feature(FW_FEATURE_ISERIES)) {
-   if (pci_probe_only)
-   pcibios_claim_of_setup();
-   else
-   /* FIXME: `else' will be removed when
-  pci_assign_unassigned_resources() is able to work
-  correctly with [partially] allocated PCI tree. */
-   pci_assign_unassigned_resources();
-   }
+   if (pci_probe_only)
+   pcibios_claim_of_setup();
+   else
+   /* FIXME: `else' will be removed when
+  pci_assign_unassigned_resources() is able to work
+  correctly with [partially] allocated PCI tree. */
+   pci_assign_unassigned_resources();
 
/* Call machine dependent final fixup */
if (ppc_md.pcibios_fixup)
diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index 4bcf446..db0a17e 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -646,6 +646,8 @@ void __init iSeries_pcibios_init(void)
/* Install IO hooks */
ppc_pci_io = iseries_pci_io;
 
+   pci_probe_only = 1;
+
/* iSeries has no IO space in the common sense, it needs to set
 * the IO base to 0
 */
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 16/19] [POWERPC] iSeries: hose->buid is always zero for iSeries

2007-12-06 Thread Stephen Rothwell
so remove a firmware feature test.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/pci_64.c |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index b58f091..42ff9c9 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -581,12 +581,8 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
 /* Decide whether to display the domain number in /proc */
 int pci_proc_domain(struct pci_bus *bus)
 {
-   if (firmware_has_feature(FW_FEATURE_ISERIES))
-   return 0;
-   else {
-   struct pci_controller *hose = pci_bus_to_host(bus);
-   return hose->buid != 0;
-   }
+   struct pci_controller *hose = pci_bus_to_host(bus);
+   return hose->buid != 0;
 }
 
 
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 15/19] [POWERPC] iSeries: call iSeries_pcibios_init from setup_arch

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/pci_64.c   |3 ---
 arch/powerpc/platforms/iseries/pci.h   |4 +++-
 arch/powerpc/platforms/iseries/setup.c |2 ++
 include/asm-powerpc/ppc-pci.h  |3 ---
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 13a3615..b58f091 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -519,9 +519,6 @@ static int __init pcibios_init(void)
 */
ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
 
-   if (firmware_has_feature(FW_FEATURE_ISERIES))
-   iSeries_pcibios_init();
-
printk(KERN_DEBUG "PCI: Probing PCI hardware\n");
 
/* Scan all of the recorded PCI controllers.  */
diff --git a/arch/powerpc/platforms/iseries/pci.h 
b/arch/powerpc/platforms/iseries/pci.h
index 3af9cf1..b142873 100644
--- a/arch/powerpc/platforms/iseries/pci.h
+++ b/arch/powerpc/platforms/iseries/pci.h
@@ -50,9 +50,11 @@ struct pci_dev;  /* For Forward 
Reference */
 extern voidiSeries_Device_Information(struct pci_dev *PciDev, int count,
u16 bus, HvSubBusNumber subbus);
 #ifdef CONFIG_PCI
+extern voidiSeries_pcibios_init(void);
 extern voidiSeries_pci_final_fixup(void);
 #else
-static voidiSeries_pci_final_fixup(void) { }
+static inline void iSeries_pcibios_init(void) { }
+static inline void iSeries_pci_final_fixup(void) { }
 #endif
 
 #endif /* _PLATFORMS_ISERIES_PCI_H */
diff --git a/arch/powerpc/platforms/iseries/setup.c 
b/arch/powerpc/platforms/iseries/setup.c
index 2175a71..5616219 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -495,6 +495,8 @@ static void __init iSeries_setup_arch(void)
itVpdAreas.xSlicMaxLogicalProcs);
printk("Max physical processors = %d\n",
itVpdAreas.xSlicMaxPhysicalProcs);
+
+   iSeries_pcibios_init();
 }
 
 static void iSeries_show_cpuinfo(struct seq_file *m)
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index fda5e3d..854ab71 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -46,9 +46,6 @@ extern void init_pci_config_tokens (void);
 extern unsigned long get_phb_buid (struct device_node *);
 extern int rtas_setup_phb(struct pci_controller *phb);
 
-/* From iSeries PCI */
-extern void iSeries_pcibios_init(void);
-
 extern unsigned long pci_probe_only;
 
 /*  EEH internal-use-only related routines  */
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 14/19] [POWERPC] Inline pci_setup_pci_controller as it has become trivial

2007-12-06 Thread Stephen Rothwell
and it becomes clear that we should use zalloc_maybe_bootmem.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/pci-common.c |   22 ++
 1 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 0bf969e..252dd1e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -54,27 +54,17 @@ static int global_phb_number;   /* Global phb 
counter */
 resource_size_t isa_mem_base= 0;
 
 
-/*
- * pci_controller(phb) initialized common variables.
- */
-static void __devinit pci_setup_pci_controller(struct pci_controller *hose)
-{
-   memset(hose, 0, sizeof(struct pci_controller));
-
-   spin_lock(&hose_spinlock);
-   hose->global_number = global_phb_number++;
-   list_add_tail(&hose->list_node, &hose_list);
-   spin_unlock(&hose_spinlock);
-}
-
-struct pci_controller * pcibios_alloc_controller(struct device_node *dev)
+struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
 {
struct pci_controller *phb;
 
-   phb = alloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL);
+   phb = zalloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL);
if (phb == NULL)
return NULL;
-   pci_setup_pci_controller(phb);
+   spin_lock(&hose_spinlock);
+   phb->global_number = global_phb_number++;
+   list_add_tail(&phb->list_node, &hose_list);
+   spin_unlock(&hose_spinlock);
phb->arch_data = dev;
phb->is_dynamic = mem_init_done;
 #ifdef CONFIG_PPC64
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 13/19] [POWERPC] iSeries: make pcibios_final_fixup not depend on pci_dn

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |   27 ---
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index 7e00e35..4bcf446 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -188,39 +188,36 @@ void __init iSeries_pci_final_fixup(void)
 
printk("pcibios_final_fixup\n");
for_each_pci_dev(pdev) {
-   struct pci_dn *pdn;
const u32 *agent;
const u32 *sub_bus;
+   unsigned char bus = pdev->bus->number;
 
-   node = find_device_node(pdev->bus->number, pdev->devfn);
-   printk("pci dev %p (%x.%x), node %p\n", pdev,
-  pdev->bus->number, pdev->devfn, node);
+   node = find_device_node(bus, pdev->devfn);
+   printk("pci dev %p (%x.%x), node %p\n", pdev, bus,
+   pdev->devfn, node);
if (!node) {
printk("PCI: Device Tree not found for 0x%016lX\n",
(unsigned long)pdev);
continue;
}
 
-   pdn = PCI_DN(node);
agent = of_get_property(node, "linux,agent-id", NULL);
sub_bus = of_get_property(node, "linux,subbus", NULL);
-   if (pdn && agent && sub_bus) {
-   u8 irq = iSeries_allocate_IRQ(pdn->busno, 0, *sub_bus);
+   if (agent && sub_bus) {
+   u8 irq = iSeries_allocate_IRQ(bus, 0, *sub_bus);
int err;
 
-   err = HvCallXm_connectBusUnit(pdn->busno, *sub_bus,
+   err = HvCallXm_connectBusUnit(bus, *sub_bus,
*agent, irq);
if (err)
pci_log_error("Connect Bus Unit",
-   pdn->busno, *sub_bus, *agent, err);
+   bus, *sub_bus, *agent, err);
else {
-   err = HvCallPci_configStore8(pdn->busno,
-   *sub_bus, *agent,
-   PCI_INTERRUPT_LINE, irq);
+   err = HvCallPci_configStore8(bus, *sub_bus,
+   *agent, PCI_INTERRUPT_LINE, irq);
if (err)
pci_log_error("PciCfgStore Irq Failed!",
-   pdn->busno, *sub_bus,
-   *agent, err);
+   bus, *sub_bus, *agent, err);
else
pdev->irq = irq;
}
@@ -230,7 +227,7 @@ void __init iSeries_pci_final_fixup(void)
pdev->sysdata = node;
PCI_DN(node)->pcidev = pdev;
allocate_device_bars(pdev);
-   iSeries_Device_Information(pdev, num_dev, pdn->busno, *sub_bus);
+   iSeries_Device_Information(pdev, num_dev, bus, *sub_bus);
iommu_devnode_init_iSeries(pdev, node);
}
iSeries_activate_IRQs();
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 12/19] [POWERPC] iSeries: reduce dependence on pci_dn bussubno

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index b46d8c5..7e00e35 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -190,6 +190,7 @@ void __init iSeries_pci_final_fixup(void)
for_each_pci_dev(pdev) {
struct pci_dn *pdn;
const u32 *agent;
+   const u32 *sub_bus;
 
node = find_device_node(pdev->bus->number, pdev->devfn);
printk("pci dev %p (%x.%x), node %p\n", pdev,
@@ -202,23 +203,23 @@ void __init iSeries_pci_final_fixup(void)
 
pdn = PCI_DN(node);
agent = of_get_property(node, "linux,agent-id", NULL);
-   if (pdn && agent) {
-   u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
-   pdn->bussubno);
+   sub_bus = of_get_property(node, "linux,subbus", NULL);
+   if (pdn && agent && sub_bus) {
+   u8 irq = iSeries_allocate_IRQ(pdn->busno, 0, *sub_bus);
int err;
 
-   err = HvCallXm_connectBusUnit(pdn->busno, pdn->bussubno,
+   err = HvCallXm_connectBusUnit(pdn->busno, *sub_bus,
*agent, irq);
if (err)
pci_log_error("Connect Bus Unit",
-   pdn->busno, pdn->bussubno, *agent, err);
+   pdn->busno, *sub_bus, *agent, err);
else {
err = HvCallPci_configStore8(pdn->busno,
-   pdn->bussubno, *agent,
+   *sub_bus, *agent,
PCI_INTERRUPT_LINE, irq);
if (err)
pci_log_error("PciCfgStore Irq Failed!",
-   pdn->busno, pdn->bussubno,
+   pdn->busno, *sub_bus,
*agent, err);
else
pdev->irq = irq;
@@ -229,8 +230,7 @@ void __init iSeries_pci_final_fixup(void)
pdev->sysdata = node;
PCI_DN(node)->pcidev = pdev;
allocate_device_bars(pdev);
-   iSeries_Device_Information(pdev, num_dev, pdn->busno,
-   pdn->bussubno);
+   iSeries_Device_Information(pdev, num_dev, pdn->busno, *sub_bus);
iommu_devnode_init_iSeries(pdev, node);
}
iSeries_activate_IRQs();
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 11/19] [POWERPC] iSeries: iseries_ds_addr is only used in pci.c

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |   11 +++
 arch/powerpc/platforms/iseries/pci.h |   13 +
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index 3cf51c6..b46d8c5 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -69,6 +69,17 @@ static const char pci_io_text[] = "iSeries PCI I/O";
 static DEFINE_SPINLOCK(iomm_table_lock);
 
 /*
+ * Generate a Direct Select Address for the Hypervisor
+ */
+static inline u64 iseries_ds_addr(struct device_node *node)
+{
+   struct pci_dn *pdn = PCI_DN(node);
+
+   return ((u64)pdn->busno << 48) + ((u64)pdn->bussubno << 40)
+   + ((u64)0x10 << 32);
+}
+
+/*
  * iomm_table_allocate_entry
  *
  * Adds pci_dev entry in address translation table
diff --git a/arch/powerpc/platforms/iseries/pci.h 
b/arch/powerpc/platforms/iseries/pci.h
index 3cb18fa..3af9cf1 100644
--- a/arch/powerpc/platforms/iseries/pci.h
+++ b/arch/powerpc/platforms/iseries/pci.h
@@ -30,7 +30,7 @@
  * End Change Activity
  */
 
-#include 
+#include 
 
 struct pci_dev;/* For Forward Reference */
 
@@ -47,17 +47,6 @@ struct pci_dev;  /* For Forward 
Reference */
 #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7)
 #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)   ((subbus >> 2) & 0x7)
 
-/*
- * Generate a Direct Select Address for the Hypervisor
- */
-static inline u64 iseries_ds_addr(struct device_node *node)
-{
-   struct pci_dn *pdn = PCI_DN(node);
-
-   return ((u64)pdn->busno << 48) + ((u64)pdn->bussubno << 40)
-   + ((u64)0x10 << 32);
-}
-
 extern voidiSeries_Device_Information(struct pci_dev *PciDev, int count,
u16 bus, HvSubBusNumber subbus);
 #ifdef CONFIG_PCI
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 10/19] [POWERPC] iSeries: remove pci_dn dependency from iSeries_Device_Information

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |3 ++-
 arch/powerpc/platforms/iseries/pci.h |3 ++-
 arch/powerpc/platforms/iseries/vpdinfo.c |   17 ++---
 3 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index 8844d3e..3cf51c6 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -218,7 +218,8 @@ void __init iSeries_pci_final_fixup(void)
pdev->sysdata = node;
PCI_DN(node)->pcidev = pdev;
allocate_device_bars(pdev);
-   iSeries_Device_Information(pdev, num_dev);
+   iSeries_Device_Information(pdev, num_dev, pdn->busno,
+   pdn->bussubno);
iommu_devnode_init_iSeries(pdev, node);
}
iSeries_activate_IRQs();
diff --git a/arch/powerpc/platforms/iseries/pci.h 
b/arch/powerpc/platforms/iseries/pci.h
index 730986b..3cb18fa 100644
--- a/arch/powerpc/platforms/iseries/pci.h
+++ b/arch/powerpc/platforms/iseries/pci.h
@@ -58,7 +58,8 @@ static inline u64 iseries_ds_addr(struct device_node *node)
+ ((u64)0x10 << 32);
 }
 
-extern voidiSeries_Device_Information(struct pci_dev*, int);
+extern voidiSeries_Device_Information(struct pci_dev *PciDev, int count,
+   u16 bus, HvSubBusNumber subbus);
 #ifdef CONFIG_PCI
 extern voidiSeries_pci_final_fixup(void);
 #else
diff --git a/arch/powerpc/platforms/iseries/vpdinfo.c 
b/arch/powerpc/platforms/iseries/vpdinfo.c
index 9f83878..25dc0bb 100644
--- a/arch/powerpc/platforms/iseries/vpdinfo.c
+++ b/arch/powerpc/platforms/iseries/vpdinfo.c
@@ -31,7 +31,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "pci.h"
@@ -244,25 +243,13 @@ out_free:
  * PCI: Bus  0, Device 26, Vendor 0x12AE  Frame  1, Card  C10  Ethernet
  * controller
  */
-void __init iSeries_Device_Information(struct pci_dev *PciDev, int count)
+void __init iSeries_Device_Information(struct pci_dev *PciDev, int count,
+   u16 bus, HvSubBusNumber subbus)
 {
-   struct device_node *DevNode = PciDev->sysdata;
-   struct pci_dn *pdn;
-   u16 bus;
u8 frame = 0;
char card[4];
-   HvSubBusNumber subbus;
HvAgentId agent;
 
-   if (DevNode == NULL) {
-   printk("%d. PCI: iSeries_Device_Information DevNode is NULL\n",
-   count);
-   return;
-   }
-
-   pdn = PCI_DN(DevNode);
-   bus = pdn->busno;
-   subbus = pdn->bussubno;
agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus),
ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
 
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 09/19] [POWERPC] iSeries: remove one layer of IO routines

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |   68 +
 1 files changed, 19 insertions(+), 49 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index 105b23d..8844d3e 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -382,7 +382,7 @@ static inline struct device_node *xlate_iomm_address(
  * On MM I/O error, all ones are returned and iSeries_pci_IoError is cal
  * else, data is returned in Big Endian format.
  */
-static u8 iSeries_read_byte(const volatile void __iomem *addr)
+static u8 iseries_readb(const volatile void __iomem *addr)
 {
u64 bar_offset;
u64 dsa;
@@ -400,7 +400,7 @@ static u8 iSeries_read_byte(const volatile void __iomem 
*addr)
return ret.value;
 }
 
-static u16 iSeries_read_word(const volatile void __iomem *addr)
+static u16 iseries_readw_be(const volatile void __iomem *addr)
 {
u64 bar_offset;
u64 dsa;
@@ -419,7 +419,7 @@ static u16 iSeries_read_word(const volatile void __iomem 
*addr)
return ret.value;
 }
 
-static u32 iSeries_read_long(const volatile void __iomem *addr)
+static u32 iseries_readl_be(const volatile void __iomem *addr)
 {
u64 bar_offset;
u64 dsa;
@@ -442,7 +442,7 @@ static u32 iSeries_read_long(const volatile void __iomem 
*addr)
  * Write MM I/O Instructions for the iSeries
  *
  */
-static void iSeries_write_byte(u8 data, volatile void __iomem *addr)
+static void iseries_writeb(u8 data, volatile void __iomem *addr)
 {
u64 bar_offset;
u64 dsa;
@@ -458,7 +458,7 @@ static void iSeries_write_byte(u8 data, volatile void 
__iomem *addr)
} while (check_return_code("WWB", dn, &retry, rc) != 0);
 }
 
-static void iSeries_write_word(u16 data, volatile void __iomem *addr)
+static void iseries_writew_be(u16 data, volatile void __iomem *addr)
 {
u64 bar_offset;
u64 dsa;
@@ -474,7 +474,7 @@ static void iSeries_write_word(u16 data, volatile void 
__iomem *addr)
} while (check_return_code("WWW", dn, &retry, rc) != 0);
 }
 
-static void iSeries_write_long(u32 data, volatile void __iomem *addr)
+static void iseries_writel_be(u32 data, volatile void __iomem *addr)
 {
u64 bar_offset;
u64 dsa;
@@ -490,54 +490,24 @@ static void iSeries_write_long(u32 data, volatile void 
__iomem *addr)
} while (check_return_code("WWL", dn, &retry, rc) != 0);
 }
 
-static u8 iseries_readb(const volatile void __iomem *addr)
-{
-   return iSeries_read_byte(addr);
-}
-
 static u16 iseries_readw(const volatile void __iomem *addr)
 {
-   return le16_to_cpu(iSeries_read_word(addr));
+   return le16_to_cpu(iseries_readw_be(addr));
 }
 
 static u32 iseries_readl(const volatile void __iomem *addr)
 {
-   return le32_to_cpu(iSeries_read_long(addr));
-}
-
-static u16 iseries_readw_be(const volatile void __iomem *addr)
-{
-   return iSeries_read_word(addr);
-}
-
-static u32 iseries_readl_be(const volatile void __iomem *addr)
-{
-   return iSeries_read_long(addr);
-}
-
-static void iseries_writeb(u8 data, volatile void __iomem *addr)
-{
-   iSeries_write_byte(data, addr);
+   return le32_to_cpu(iseries_readl_be(addr));
 }
 
 static void iseries_writew(u16 data, volatile void __iomem *addr)
 {
-   iSeries_write_word(cpu_to_le16(data), addr);
+   iseries_writew_be(cpu_to_le16(data), addr);
 }
 
 static void iseries_writel(u32 data, volatile void __iomem *addr)
 {
-   iSeries_write_long(cpu_to_le32(data), addr);
-}
-
-static void iseries_writew_be(u16 data, volatile void __iomem *addr)
-{
-   iSeries_write_word(data, addr);
-}
-
-static void iseries_writel_be(u32 data, volatile void __iomem *addr)
-{
-   iSeries_write_long(data, addr);
+   iseries_writel(cpu_to_le32(data), addr);
 }
 
 static void iseries_readsb(const volatile void __iomem *addr, void *buf,
@@ -545,7 +515,7 @@ static void iseries_readsb(const volatile void __iomem 
*addr, void *buf,
 {
u8 *dst = buf;
while(count-- > 0)
-   *(dst++) = iSeries_read_byte(addr);
+   *(dst++) = iseries_readb(addr);
 }
 
 static void iseries_readsw(const volatile void __iomem *addr, void *buf,
@@ -553,7 +523,7 @@ static void iseries_readsw(const volatile void __iomem 
*addr, void *buf,
 {
u16 *dst = buf;
while(count-- > 0)
-   *(dst++) = iSeries_read_word(addr);
+   *(dst++) = iseries_readw_be(addr);
 }
 
 static void iseries_readsl(const volatile void __iomem *addr, void *buf,
@@ -561,7 +531,7 @@ static void iseries_readsl(const volatile void __iomem 
*addr, void *buf,
 {
u32 *dst = buf;
while(count-- > 0)
-   *(dst++) = iSeries_read_long(addr);
+   *(dst++) = iseries_readl_be(addr);
 }
 
 static void iseries_writesb(volatile void __iomem *addr, const void *buf,
@@ -569,7 +539,7 @@ static void ise

[PATCH 08/19] [POWERPC] iSeries: consoldiate PCI IO error check

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |  105 -
 1 files changed, 26 insertions(+), 79 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index 8e2ac3d..105b23d 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -342,7 +342,7 @@ static int check_return_code(char *type, struct device_node 
*dn,
  */
 static inline struct device_node *xlate_iomm_address(
const volatile void __iomem *addr,
-   u64 *dsaptr, u64 *bar_offset)
+   u64 *dsaptr, u64 *bar_offset, const char *func)
 {
unsigned long orig_addr;
unsigned long base_addr;
@@ -350,8 +350,20 @@ static inline struct device_node *xlate_iomm_address(
struct device_node *dn;
 
orig_addr = (unsigned long __force)addr;
-   if ((orig_addr < BASE_IO_MEMORY) || (orig_addr >= max_io_memory))
+   if ((orig_addr < BASE_IO_MEMORY) || (orig_addr >= max_io_memory)) {
+   static unsigned long last_jiffies;
+   static int num_printed;
+
+   if ((jiffies - last_jiffies) > 60 * HZ) {
+   last_jiffies = jiffies;
+   num_printed = 0;
+   }
+   if (num_printed++ < 10)
+   printk(KERN_ERR
+   "iSeries_%s: invalid access at IO address %p\n",
+   func, addr);
return NULL;
+   }
base_addr = orig_addr - BASE_IO_MEMORY;
ind = base_addr / IOMM_TABLE_ENTRY_SIZE;
dn = iomm_table[ind];
@@ -377,21 +389,10 @@ static u8 iSeries_read_byte(const volatile void __iomem 
*addr)
int retry = 0;
struct HvCallPci_LoadReturn ret;
struct device_node *dn =
-   xlate_iomm_address(addr, &dsa, &bar_offset);
-
-   if (dn == NULL) {
-   static unsigned long last_jiffies;
-   static int num_printed;
+   xlate_iomm_address(addr, &dsa, &bar_offset, "read_byte");
 
-   if ((jiffies - last_jiffies) > 60 * HZ) {
-   last_jiffies = jiffies;
-   num_printed = 0;
-   }
-   if (num_printed++ < 10)
-   printk(KERN_ERR "iSeries_read_byte: invalid access at 
IO address %p\n",
-  addr);
+   if (dn == NULL)
return 0xff;
-   }
do {
HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, bar_offset, 0);
} while (check_return_code("RDB", dn, &retry, ret.rc) != 0);
@@ -406,21 +407,10 @@ static u16 iSeries_read_word(const volatile void __iomem 
*addr)
int retry = 0;
struct HvCallPci_LoadReturn ret;
struct device_node *dn =
-   xlate_iomm_address(addr, &dsa, &bar_offset);
-
-   if (dn == NULL) {
-   static unsigned long last_jiffies;
-   static int num_printed;
+   xlate_iomm_address(addr, &dsa, &bar_offset, "read_word");
 
-   if ((jiffies - last_jiffies) > 60 * HZ) {
-   last_jiffies = jiffies;
-   num_printed = 0;
-   }
-   if (num_printed++ < 10)
-   printk(KERN_ERR "iSeries_read_word: invalid access at 
IO address %p\n",
-  addr);
+   if (dn == NULL)
return 0x;
-   }
do {
HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa,
bar_offset, 0);
@@ -436,21 +426,10 @@ static u32 iSeries_read_long(const volatile void __iomem 
*addr)
int retry = 0;
struct HvCallPci_LoadReturn ret;
struct device_node *dn =
-   xlate_iomm_address(addr, &dsa, &bar_offset);
-
-   if (dn == NULL) {
-   static unsigned long last_jiffies;
-   static int num_printed;
+   xlate_iomm_address(addr, &dsa, &bar_offset, "read_long");
 
-   if ((jiffies - last_jiffies) > 60 * HZ) {
-   last_jiffies = jiffies;
-   num_printed = 0;
-   }
-   if (num_printed++ < 10)
-   printk(KERN_ERR "iSeries_read_long: invalid access at 
IO address %p\n",
-  addr);
+   if (dn == NULL)
return 0x;
-   }
do {
HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa,
bar_offset, 0);
@@ -470,20 +449,10 @@ static void iSeries_write_byte(u8 data, volatile void 
__iomem *addr)
int retry = 0;
u64 rc;
struct device_node *dn =
-   xlate_iomm_address(addr, &dsa, &bar_offset);
+   xlate_iomm_address(addr, &dsa, &bar_offset, "write_byte");
 
-   if (dn == NULL) {
-   static unsi

[PATCH 07/19] [POWERPC] iSeries: unindent and clean iSeries_pci_final_fixup

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |   68 +
 1 files changed, 35 insertions(+), 33 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index cff832a..8e2ac3d 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -177,47 +177,49 @@ void __init iSeries_pci_final_fixup(void)
 
printk("pcibios_final_fixup\n");
for_each_pci_dev(pdev) {
+   struct pci_dn *pdn;
+   const u32 *agent;
+
node = find_device_node(pdev->bus->number, pdev->devfn);
printk("pci dev %p (%x.%x), node %p\n", pdev,
   pdev->bus->number, pdev->devfn, node);
+   if (!node) {
+   printk("PCI: Device Tree not found for 0x%016lX\n",
+   (unsigned long)pdev);
+   continue;
+   }
 
-   if (node != NULL) {
-   struct pci_dn *pdn = PCI_DN(node);
-   const u32 *agent;
-
-   agent = of_get_property(node, "linux,agent-id", NULL);
-   if ((pdn != NULL) && (agent != NULL)) {
-   u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
-   pdn->bussubno);
-   int err;
-
-   err = HvCallXm_connectBusUnit(pdn->busno, 
pdn->bussubno,
-   *agent, irq);
+   pdn = PCI_DN(node);
+   agent = of_get_property(node, "linux,agent-id", NULL);
+   if (pdn && agent) {
+   u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
+   pdn->bussubno);
+   int err;
+
+   err = HvCallXm_connectBusUnit(pdn->busno, pdn->bussubno,
+   *agent, irq);
+   if (err)
+   pci_log_error("Connect Bus Unit",
+   pdn->busno, pdn->bussubno, *agent, err);
+   else {
+   err = HvCallPci_configStore8(pdn->busno,
+   pdn->bussubno, *agent,
+   PCI_INTERRUPT_LINE, irq);
if (err)
-   pci_log_error("Connect Bus Unit",
-   pdn->busno, pdn->bussubno, 
*agent, err);
-   else {
-   err = 
HvCallPci_configStore8(pdn->busno, pdn->bussubno,
-   *agent,
-   PCI_INTERRUPT_LINE,
-   irq);
-   if (err)
-   pci_log_error("PciCfgStore Irq 
Failed!",
-   pdn->busno, 
pdn->bussubno, *agent, err);
-   }
-   if (!err)
+   pci_log_error("PciCfgStore Irq Failed!",
+   pdn->busno, pdn->bussubno,
+   *agent, err);
+   else
pdev->irq = irq;
}
+   }
 
-   ++num_dev;
-   pdev->sysdata = node;
-   PCI_DN(node)->pcidev = pdev;
-   allocate_device_bars(pdev);
-   iSeries_Device_Information(pdev, num_dev);
-   iommu_devnode_init_iSeries(pdev, node);
-   } else
-   printk("PCI: Device Tree not found for 0x%016lX\n",
-   (unsigned long)pdev);
+   num_dev++;
+   pdev->sysdata = node;
+   PCI_DN(node)->pcidev = pdev;
+   allocate_device_bars(pdev);
+   iSeries_Device_Information(pdev, num_dev);
+   iommu_devnode_init_iSeries(pdev, node);
}
iSeries_activate_IRQs();
mf_display_src(0xC9000200);
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 06/19] [POWERPC] iSeries: remove some dead code from pci.c

2007-12-06 Thread Stephen Rothwell
and an unnecessary cast.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |   19 +--
 1 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index 705f52c..cff832a 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -210,7 +210,7 @@ void __init iSeries_pci_final_fixup(void)
}
 
++num_dev;
-   pdev->sysdata = (void *)node;
+   pdev->sysdata = node;
PCI_DN(node)->pcidev = pdev;
allocate_device_bars(pdev);
iSeries_Device_Information(pdev, num_dev);
@@ -223,23 +223,6 @@ void __init iSeries_pci_final_fixup(void)
mf_display_src(0xC9000200);
 }
 
-#if 0
-/*
- * Returns the device node for the passed pci_dev
- * Sanity Check Node PciDev to passed pci_dev
- * If none is found, returns a NULL which the client must handle.
- */
-static struct device_node *get_device_node(struct pci_dev *pdev)
-{
-   struct device_node *node;
-
-   node = pdev->sysdata;
-   if (node == NULL || PCI_DN(node)->pcidev != pdev)
-   node = find_device_node(pdev->bus->number, pdev->devfn);
-   return node;
-}
-#endif
-
 /*
  * Config space read and write functions.
  * For now at least, we look for the device node for the bus and devfn
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 05/19] [POWERPC] iSeries: deCamelCase pci.c

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |  216 +-
 1 files changed, 108 insertions(+), 108 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index 8ef3226..705f52c 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -138,19 +138,19 @@ static void __init allocate_device_bars(struct pci_dev 
*dev)
  * PCI: Read Vendor Failed 0x18.58.10 Rc: 0x00xx
  * PCI: Connect Bus Unit Failed 0x18.58.10 Rc: 0x00xx
  */
-static void pci_Log_Error(char *Error_Text, int Bus, int SubBus,
-   int AgentId, int HvRc)
+static void pci_log_error(char *error, int bus, int subbus,
+   int agent, int hv_res)
 {
-   if (HvRc == 0x0302)
+   if (hv_res == 0x0302)
return;
printk(KERN_ERR "PCI: %s Failed: 0x%02X.%02X.%02X Rc: 0x%04X",
-  Error_Text, Bus, SubBus, AgentId, HvRc);
+  error, bus, subbus, agent, hv_res);
 }
 
 /*
  * Look down the chain to find the matching Device Device
  */
-static struct device_node *find_Device_Node(int bus, int devfn)
+static struct device_node *find_device_node(int bus, int devfn)
 {
struct device_node *node;
 
@@ -170,14 +170,14 @@ void __init iSeries_pci_final_fixup(void)
 {
struct pci_dev *pdev = NULL;
struct device_node *node;
-   int DeviceCount = 0;
+   int num_dev = 0;
 
/* Fix up at the device node and pci_dev relationship */
mf_display_src(0xC9000100);
 
printk("pcibios_final_fixup\n");
for_each_pci_dev(pdev) {
-   node = find_Device_Node(pdev->bus->number, pdev->devfn);
+   node = find_device_node(pdev->bus->number, pdev->devfn);
printk("pci dev %p (%x.%x), node %p\n", pdev,
   pdev->bus->number, pdev->devfn, node);
 
@@ -194,7 +194,7 @@ void __init iSeries_pci_final_fixup(void)
err = HvCallXm_connectBusUnit(pdn->busno, 
pdn->bussubno,
*agent, irq);
if (err)
-   pci_Log_Error("Connect Bus Unit",
+   pci_log_error("Connect Bus Unit",
pdn->busno, pdn->bussubno, 
*agent, err);
else {
err = 
HvCallPci_configStore8(pdn->busno, pdn->bussubno,
@@ -202,18 +202,18 @@ void __init iSeries_pci_final_fixup(void)
PCI_INTERRUPT_LINE,
irq);
if (err)
-   pci_Log_Error("PciCfgStore Irq 
Failed!",
+   pci_log_error("PciCfgStore Irq 
Failed!",
pdn->busno, 
pdn->bussubno, *agent, err);
}
if (!err)
pdev->irq = irq;
}
 
-   ++DeviceCount;
+   ++num_dev;
pdev->sysdata = (void *)node;
PCI_DN(node)->pcidev = pdev;
allocate_device_bars(pdev);
-   iSeries_Device_Information(pdev, DeviceCount);
+   iSeries_Device_Information(pdev, num_dev);
iommu_devnode_init_iSeries(pdev, node);
} else
printk("PCI: Device Tree not found for 0x%016lX\n",
@@ -229,13 +229,13 @@ void __init iSeries_pci_final_fixup(void)
  * Sanity Check Node PciDev to passed pci_dev
  * If none is found, returns a NULL which the client must handle.
  */
-static struct device_node *get_Device_Node(struct pci_dev *pdev)
+static struct device_node *get_device_node(struct pci_dev *pdev)
 {
struct device_node *node;
 
node = pdev->sysdata;
if (node == NULL || PCI_DN(node)->pcidev != pdev)
-   node = find_Device_Node(pdev->bus->number, pdev->devfn);
+   node = find_device_node(pdev->bus->number, pdev->devfn);
return node;
 }
 #endif
@@ -262,7 +262,7 @@ static u64 hv_cfg_write_func[4] = {
 static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
int offset, int size, u32 *val)
 {
-   struct device_node *node = find_Device_Node(bus->number, devfn);
+   struct device_node *node = find_device_node(bus->number, devfn);
u64 fn;
struct HvCallPci_LoadReturn ret;
 
@@ -292,7 +292,7 @@ static int iSeries_pci_read_config(struct pci_bus *bus, 
unsigned int devfn,
 static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn,
i

[PATCH 04/19] [POWERPC] iSeries: cleanup PCI retry code a little

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index e4e6ae0..8ef3226 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -45,8 +45,8 @@
 #include "pci.h"
 #include "call_pci.h"
 
-static int Pci_Retry_Max = 3;  /* Only retry 3 times  */
-static int Pci_Error_Flag = 1; /* Set Retry Error on. */
+#define PCI_RETRY_MAX  3
+static int limit_pci_retries = 1;  /* Set Retry Error on. */
 
 /*
  * Table defines
@@ -338,8 +338,8 @@ static int CheckReturnCode(char *TextHdr, struct 
device_node *DevNode,
 * Bump the retry and check for retry count exceeded.
 * If, Exceeded, panic the system.
 */
-   if (((*retry) > Pci_Retry_Max) &&
-   (Pci_Error_Flag > 0)) {
+   if (((*retry) > PCI_RETRY_MAX) &&
+   (limit_pci_retries > 0)) {
mf_display_src(0xB6000103);
panic_timeout = 0;
panic("PCI: Hardware I/O Error, SRC B6000103, "
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 03/19] [POWERPC] iSeries: move find_Device_Node to avoid a forward declaration

2007-12-06 Thread Stephen Rothwell
Also remove another unnecessary forward declaration.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/iseries/pci.c |   39 ++
 1 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index a74d1e1..e4e6ae0 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -45,16 +45,9 @@
 #include "pci.h"
 #include "call_pci.h"
 
-/*
- * Forward declares of prototypes.
- */
-static struct device_node *find_Device_Node(int bus, int devfn);
-
 static int Pci_Retry_Max = 3;  /* Only retry 3 times  */
 static int Pci_Error_Flag = 1; /* Set Retry Error on. */
 
-static struct pci_ops iSeries_pci_ops;
-
 /*
  * Table defines
  * Each Entry size is 4 MB * 1024 Entries = 4GB I/O address space.
@@ -155,6 +148,22 @@ static void pci_Log_Error(char *Error_Text, int Bus, int 
SubBus,
 }
 
 /*
+ * Look down the chain to find the matching Device Device
+ */
+static struct device_node *find_Device_Node(int bus, int devfn)
+{
+   struct device_node *node;
+
+   for (node = NULL; (node = of_find_all_nodes(node)); ) {
+   struct pci_dn *pdn = PCI_DN(node);
+
+   if (pdn && (bus == pdn->busno) && (devfn == pdn->devfn))
+   return node;
+   }
+   return NULL;
+}
+
+/*
  * iSeries_pci_final_fixup(void)
  */
 void __init iSeries_pci_final_fixup(void)
@@ -214,22 +223,6 @@ void __init iSeries_pci_final_fixup(void)
mf_display_src(0xC9000200);
 }
 
-/*
- * Look down the chain to find the matching Device Device
- */
-static struct device_node *find_Device_Node(int bus, int devfn)
-{
-   struct device_node *node;
-
-   for (node = NULL; (node = of_find_all_nodes(node)); ) {
-   struct pci_dn *pdn = PCI_DN(node);
-
-   if (pdn && (bus == pdn->busno) && (devfn == pdn->devfn))
-   return node;
-   }
-   return NULL;
-}
-
 #if 0
 /*
  * Returns the device node for the passed pci_dev
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 02/19] [POWERPC] consolidate pci_controller

2007-12-06 Thread Stephen Rothwell

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 include/asm-powerpc/pci-bridge.h |   62 +++--
 1 files changed, 19 insertions(+), 43 deletions(-)

diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index f4afdc6..beb09b5 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -11,22 +11,29 @@
 #include 
 #include 
 
-#ifndef CONFIG_PPC64
 /*
  * Structure of a PCI controller (host bridge)
  */
 struct pci_controller {
struct pci_bus *bus;
char is_dynamic;
+#ifdef CONFIG_PPC64
+   int node;
+#endif
void *arch_data;
struct list_head list_node;
struct device *parent;
 
int first_busno;
int last_busno;
+#ifndef CONFIG_PPC64
int self_busno;
+#endif
 
void __iomem *io_base_virt;
+#ifdef CONFIG_PPC64
+   void *io_base_alloc;
+#endif
resource_size_t io_base_phys;
 
/* Some machines (PReP) have a non 1:1 mapping of
@@ -39,6 +46,7 @@ struct pci_controller {
volatile unsigned int __iomem *cfg_addr;
volatile void __iomem *cfg_data;
 
+#ifndef CONFIG_PPC64
/*
 * Used for variants of PCI indirect handling and possible quirks:
 *  SET_CFG_TYPE - used on 4xx or any PHB that does explicit type0/1
@@ -59,15 +67,24 @@ struct pci_controller {
 #define PPC_INDIRECT_TYPE_NO_PCIE_LINK 0x0008
 #define PPC_INDIRECT_TYPE_BIG_ENDIAN   0x0010
u32 indirect_type;
-
+#endif /* !CONFIG_PPC64 */
/* Currently, we limit ourselves to 1 IO range and 3 mem
 * ranges since the common pci_bus structure can't handle more
 */
struct resource io_resource;
struct resource mem_resources[3];
int global_number;  /* PCI domain number */
+#ifdef CONFIG_PPC64
+   unsigned long buid;
+   unsigned long dma_window_base_cur;
+   unsigned long dma_window_size;
+
+   void *private_data;
+#endif /* CONFIG_PPC64 */
 };
 
+#ifndef CONFIG_PPC64
+
 static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
 {
return bus->sysdata;
@@ -109,47 +126,6 @@ extern void __init update_bridge_resource(struct pci_dev 
*dev,
 #else  /* CONFIG_PPC64 */
 
 /*
- * Structure of a PCI controller (host bridge)
- */
-struct pci_controller {
-   struct pci_bus *bus;
-   char is_dynamic;
-   int node;
-   void *arch_data;
-   struct list_head list_node;
-   struct device *parent;
-
-   int first_busno;
-   int last_busno;
-
-   void __iomem *io_base_virt;
-   void *io_base_alloc;
-   resource_size_t io_base_phys;
-
-   /* Some machines have a non 1:1 mapping of
-* the PCI memory space in the CPU bus space
-*/
-   resource_size_t pci_mem_offset;
-   unsigned long pci_io_size;
-
-   struct pci_ops *ops;
-   volatile unsigned int __iomem *cfg_addr;
-   volatile void __iomem *cfg_data;
-
-   /* Currently, we limit ourselves to 1 IO range and 3 mem
-* ranges since the common pci_bus structure can't handle more
-*/
-   struct resource io_resource;
-   struct resource mem_resources[3];
-   int global_number;
-   unsigned long buid;
-   unsigned long dma_window_base_cur;
-   unsigned long dma_window_size;
-
-   void *private_data;
-};
-
-/*
  * PCI stuff, for nodes representing PCI devices, pointed to
  * by device_node->data.
  */
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 01/19] [POWERPC] clean up pci-bridge.h

2007-12-06 Thread Stephen Rothwell
No semantic changes.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 include/asm-powerpc/pci-bridge.h |   95 +-
 1 files changed, 42 insertions(+), 53 deletions(-)

diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index bf217e1..f4afdc6 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -1,16 +1,17 @@
 #ifndef _ASM_POWERPC_PCI_BRIDGE_H
 #define _ASM_POWERPC_PCI_BRIDGE_H
 #ifdef __KERNEL__
-
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
 #include 
 #include 
 #include 
 
 #ifndef CONFIG_PPC64
-
-struct device_node;
-struct pci_controller;
-
 /*
  * Structure of a PCI controller (host bridge)
  */
@@ -52,11 +53,11 @@ struct pci_controller {
 *   set.
 *  BIG_ENDIAN - cfg_addr is a big endian register
 */
-#define PPC_INDIRECT_TYPE_SET_CFG_TYPE (0x0001)
-#define PPC_INDIRECT_TYPE_EXT_REG  (0x0002)
-#define PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS (0x0004)
-#define PPC_INDIRECT_TYPE_NO_PCIE_LINK (0x0008)
-#define PPC_INDIRECT_TYPE_BIG_ENDIAN   (0x0010)
+#define PPC_INDIRECT_TYPE_SET_CFG_TYPE 0x0001
+#define PPC_INDIRECT_TYPE_EXT_REG  0x0002
+#define PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS 0x0004
+#define PPC_INDIRECT_TYPE_NO_PCIE_LINK 0x0008
+#define PPC_INDIRECT_TYPE_BIG_ENDIAN   0x0010
u32 indirect_type;
 
/* Currently, we limit ourselves to 1 IO range and 3 mem
@@ -82,18 +83,18 @@ static inline int isa_vaddr_is_ioport(void __iomem *address)
 
 /* These are used for config access before all the PCI probing
has been done. */
-int early_read_config_byte(struct pci_controller *hose, int bus, int dev_fn,
-  int where, u8 *val);
-int early_read_config_word(struct pci_controller *hose, int bus, int dev_fn,
-  int where, u16 *val);
-int early_read_config_dword(struct pci_controller *hose, int bus, int dev_fn,
-   int where, u32 *val);
-int early_write_config_byte(struct pci_controller *hose, int bus, int dev_fn,
-   int where, u8 val);
-int early_write_config_word(struct pci_controller *hose, int bus, int dev_fn,
-   int where, u16 val);
-int early_write_config_dword(struct pci_controller *hose, int bus, int dev_fn,
-int where, u32 val);
+extern int early_read_config_byte(struct pci_controller *hose, int bus,
+   int dev_fn, int where, u8 *val);
+extern int early_read_config_word(struct pci_controller *hose, int bus,
+   int dev_fn, int where, u16 *val);
+extern int early_read_config_dword(struct pci_controller *hose, int bus,
+   int dev_fn, int where, u32 *val);
+extern int early_write_config_byte(struct pci_controller *hose, int bus,
+   int dev_fn, int where, u8 val);
+extern int early_write_config_word(struct pci_controller *hose, int bus,
+   int dev_fn, int where, u16 val);
+extern int early_write_config_dword(struct pci_controller *hose, int bus,
+   int dev_fn, int where, u32 val);
 
 extern int early_find_capability(struct pci_controller *hose, int bus,
 int dev_fn, int cap);
@@ -105,15 +106,7 @@ extern void setup_grackle(struct pci_controller *hose);
 extern void __init update_bridge_resource(struct pci_dev *dev,
  struct resource *res);
 
-#else
-
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
+#else  /* CONFIG_PPC64 */
 
 /*
  * Structure of a PCI controller (host bridge)
@@ -160,8 +153,8 @@ struct pci_controller {
  * PCI stuff, for nodes representing PCI devices, pointed to
  * by device_node->data.
  */
-struct pci_controller;
 struct iommu_table;
+struct device_node;
 
 struct pci_dn {
int busno;  /* pci bus number */
@@ -180,9 +173,9 @@ struct pci_dn {
int eeh_mode;   /* See eeh.h for possible EEH_MODEs */
int eeh_config_addr;
int eeh_pe_config_addr; /* new-style partition endpoint address */
-   int eeh_check_count;/* # times driver ignored error */
-   int eeh_freeze_count;   /* # times this device froze up. */
-   int eeh_false_positives;/* # times this device reported #ff's */
+   int eeh_check_count;/* # times driver ignored error */
+ 

Powerpc PCI cleanups (mainly iSeries)

2007-12-06 Thread Stephen Rothwell
Hi all,

I started out looking for ways to remove our dependencies on pci_dn and
got sidetracked into clening up the iSeries PCI code.  The intention of
the following set of patches is that there be no semantic changes
(mostly).

Overall diffstat looks like this:
 arch/powerpc/kernel/pci-common.c   |   31 +--
 arch/powerpc/kernel/pci_32.c   |6 +-
 arch/powerpc/kernel/pci_64.c   |   40 +--
 arch/powerpc/kernel/pci_dn.c   |2 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |2 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |2 +-
 arch/powerpc/platforms/iseries/pci.c   |  426 +++-
 arch/powerpc/platforms/iseries/pci.h   |   20 +-
 arch/powerpc/platforms/iseries/setup.c |2 +
 arch/powerpc/platforms/iseries/vpdinfo.c   |   17 +-
 arch/powerpc/platforms/powermac/pci.c  |2 +-
 arch/powerpc/platforms/pseries/iommu.c |2 +-
 include/asm-powerpc/pci-bridge.h   |  156 --
 include/asm-powerpc/ppc-pci.h  |3 -
 14 files changed, 266 insertions(+), 445 deletions(-)

This entire set sits on top of benh's "Make isa_mem_base common to 32 and
64 bits" and "Merge pci_process_bridge_OF_ranges" patches and my
"iommu_free_table doesn't need the device_node" and "pSeries: remove
dependency on pci_dn bussubno" patches posted earlier.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Are the MPC85xx DMA drivers already in a tree?

2007-12-06 Thread Clemens Koller
Hi!

I want to update a driver to test my mileage with the
Freescale DMA drivers for MPC85xx from Zhang Wei from 2007-09-07.

Are those already available in some git tree to pull from?
What are the most current trees for powerpc development?
(galak, paulus, ?)

Also, any Documentation to the current/planned DMA
implementation or demo drivers are welcome.
I want to pull big chunks of bulk data from an FPGA connected to
the local bus to main memory.

Regards,
-- 
Clemens Koller
__
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Straße 45/1
Linhof Werksgelände
D-81379 München
Tel.089-741518-50
Fax 089-741518-19
http://www.anagramm-technology.com
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] qe: add ability to upload QE firmware

2007-12-06 Thread Timur Tabi
Arnd Bergmann wrote:
> On Thursday 06 December 2007, Timur Tabi wrote:
>>> In that case, I think it
>>> would really be better to just put the blob into the tree and only
>>> have the fw loading code in the kernel instead of duplicating it in the boot
>>> loader.
>> That would require the firmware to present in RAM for all time, since the 
>> device 
>> tree cannot be unloaded.
> 
> Yes, that's a backdraw of my approach, but in the case of spidernet, it was 
> only
> an insignificant amount of RAM. Don't know what sizes of RAM and QE firmware
> to expect typically on the machines you care about.

I'm only familiar with the UART microcode, which is relatively small.  I'll add 
this feature to my to-do list.

> Right, so you can't really get around having it in some boot loaders at least.
> IIRC you said that the firmware is only needed for serial output on some chips
> but not on others. What about the case where you don't need it for serial but
> still want to provide it by the firmware, and perhaps use something other than
> U-boot? Is that relevant?

In this particular case, the UART firmware is needed on some chips only because 
those chips are broken in silicon.  AFAIK, only 8323 and 8360 are affected. 
None of the 85xx chips with QE have the broken UART silicon, so they don't need 
this firmware.

The whole point behind having binary firmware blobs is so that *any* OS, 
boot-loader, or even an application can upload firmware without worrying about 
licensing issues.  The code to parse and process the blobs is open source.

There are other firmwares, such as firmware for TCP/IP interworking. 
Unfortunately, I don't have any direct experience with those firmwares, but in 
discussions with QE engineers who have, my approach works.  My hope is that 
every OS that runs on our QE-enabled parts will contain a version of 
qe_upload_firmware().

> I'm not trying to convince you of this if it's completely pointless for
> all your systems, just want to make sure you're aware of this option,
> because spending a few extra code lines on it now may save you some trouble
> if you need this later.

Um, I think I'm a little confused as to what your point is.  My code is just a 
generic QE firmware uploader.

>> Technically, the firmware could be considered a device on the QE, because 
>> it's 
>> loaded into I-RAM and it can significantly alter the behavior of the device. 
> 
> Well, it doesn't have any of the standard properties like registers or 
> interrupts
> though.

Well, there are registers for accessing I-RAM.  It's not memory mapped - you 
have to write the I-RAM internal address to one register, and then write the 
data to another register, in order to actually write to I-RAM.

-- 
Timur Tabi
Linux kernel developer at Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] PowerPC 4xx: rework UIC cascade irq handling

2007-12-06 Thread Valentine Barshak
This is a UIC cascade handler rework to use set_irq_chained_handler() for 
cascade,
just like othe ppc platforms do. With current implementation we have additional
redirection for irq handler and we call generic_handle_irq twice 
(once for the primary uic and the other time for handling cascade interrupt).
This causes Ingo's realtime support patch to stop working on 4xx.
Not sure of any other possible problems though, but with 
set_irq_chained_handler()
we can abolish "struct irqaction cascade" from the chip descriptor and call
generic_handle_irq() once, directly for cascade irq.

Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/uic.c |   36 +++-
 1 files changed, 19 insertions(+), 17 deletions(-)

diff -pruN linux-2.6.orig/arch/powerpc/sysdev/uic.c 
linux-2.6/arch/powerpc/sysdev/uic.c
--- linux-2.6.orig/arch/powerpc/sysdev/uic.c2007-12-05 20:07:22.0 
+0300
+++ linux-2.6/arch/powerpc/sysdev/uic.c 2007-12-05 21:34:56.0 +0300
@@ -53,9 +53,6 @@ struct uic {
 
/* The remapper for this UIC */
struct irq_host *irqhost;
-
-   /* For secondary UICs, the cascade interrupt's irqaction */
-   struct irqaction cascade;
 };
 
 static void uic_unmask_irq(unsigned int virq)
@@ -264,23 +261,36 @@ static struct irq_host_ops uic_host_ops 
.xlate  = uic_host_xlate,
 };
 
-irqreturn_t uic_cascade(int virq, void *data)
+void uic_irq_cascade(unsigned int virq, struct irq_desc *desc)
 {
-   struct uic *uic = data;
+   struct uic *uic = get_irq_data(virq);
u32 msr;
int src;
int subvirq;
 
+   spin_lock(&desc->lock);
+   if (desc->status & IRQ_LEVEL)
+   desc->chip->mask(virq);
+   else
+   desc->chip->mask_ack(virq);
+   spin_unlock(&desc->lock);
+
msr = mfdcr(uic->dcrbase + UIC_MSR);
if (!msr) /* spurious interrupt */
-   return IRQ_HANDLED;
+   goto uic_irq_ret;
 
src = 32 - ffs(msr);
 
subvirq = irq_linear_revmap(uic->irqhost, src);
generic_handle_irq(subvirq);
 
-   return IRQ_HANDLED;
+uic_irq_ret:
+   spin_lock(&desc->lock);
+   if (desc->status & IRQ_LEVEL)
+   desc->chip->ack(virq);
+   if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
+   desc->chip->unmask(virq);
+   spin_unlock(&desc->lock);
 }
 
 static struct uic * __init uic_init_one(struct device_node *node)
@@ -368,7 +378,6 @@ void __init uic_init_tree(void)
if (interrupts) {
/* Secondary UIC */
int cascade_virq;
-   int ret;
 
uic = uic_init_one(np);
if (! uic)
@@ -377,15 +386,8 @@ void __init uic_init_tree(void)
 
cascade_virq = irq_of_parse_and_map(np, 0);
 
-   uic->cascade.handler = uic_cascade;
-   uic->cascade.name = "UIC cascade";
-   uic->cascade.dev_id = uic;
-
-   ret = setup_irq(cascade_virq, &uic->cascade);
-   if (ret)
-   printk(KERN_ERR "Failed to setup_irq(%d) for "
-  "UIC%d cascade\n", cascade_virq,
-  uic->index);
+   set_irq_data(cascade_virq, uic);
+   set_irq_chained_handler(cascade_virq, uic_irq_cascade);
 
/* FIXME: setup critical cascade?? */
}
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources

2007-12-06 Thread Andreas Schwab
Kumar Gala <[EMAIL PROTECTED]> writes:

> How does gcc deal with glibc extension to allow people to add their  
> own specifiers?

It doesn't, gcc only knows about the standard specifiers.  But it also
defines attributes that check other formats, like its own asm_fprintf
format specs.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 0/25] powerpc: 4xx PCI, PCI-X and PCI-Express support among others

2007-12-06 Thread Josh Boyer
On Thu, 06 Dec 2007 18:59:59 +1100
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:

> 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.

You should update your tree at some point.  Your patches apply with
fuzz because Paul's tree has changes apparently yours doesn't.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources

2007-12-06 Thread Kumar Gala

On Dec 6, 2007, at 2:16 AM, Matthew Wilcox wrote:

> On Thu, Dec 06, 2007 at 06:58:54PM +1100, Benjamin Herrenschmidt  
> wrote:
>> 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 :-)
>
> It's been discussed before.  Some of the solutions discussed:
>
> - Add something like PRI_RES which can be concatenated into a printk.
>   Ugly.
> - Patch gcc to allow user-definable types.  I think OpenBSD has a  
> patch
>   for this.  Then we have to get that patch propagated to all the
>   people who compile the kernel.  Unappetising.
> - Disable gcc's printk checking, teach sparse to typecheck printk.
>   Most people don't run sparse yet.

How does gcc deal with glibc extension to allow people to add their  
own specifiers?

http://www.gnu.org/software/libc/manual/html_node/Customizing-Printf.html

- k

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Please pull powerpc.git merge branch

2007-12-06 Thread Paul Mackerras
Linus,

Please do

git pull \
git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git merge

There is one commit there that fixes a bug where some machines were
incorrectly reporting over 50% hard irq time even when idle, and three
commits that update defconfigs.

Thanks,
Paul.

 arch/powerpc/configs/bamboo_defconfig|   22 +--
 arch/powerpc/configs/cell_defconfig  |  176 -
 arch/powerpc/configs/celleb_defconfig|  170 +++-
 arch/powerpc/configs/chrp32_defconfig|  163 +++-
 arch/powerpc/configs/ebony_defconfig |   25 +--
 arch/powerpc/configs/ep88xc_defconfig|   92 +--
 arch/powerpc/configs/g5_defconfig|  150 ++
 arch/powerpc/configs/holly_defconfig |  136 +---
 arch/powerpc/configs/iseries_defconfig   |  123 ---
 arch/powerpc/configs/kilauea_defconfig   |   79 -
 arch/powerpc/configs/linkstation_defconfig   |  152 ++
 arch/powerpc/configs/lite5200_defconfig  |  119 +++---
 arch/powerpc/configs/maple_defconfig |  126 ---
 arch/powerpc/configs/mpc7448_hpc2_defconfig  |  137 +---
 arch/powerpc/configs/mpc8272_ads_defconfig   |  106 +++--
 arch/powerpc/configs/mpc8313_rdb_defconfig   |  173 ++---
 arch/powerpc/configs/mpc832x_mds_defconfig   |  155 +--
 arch/powerpc/configs/mpc832x_rdb_defconfig   |  167 ++--
 arch/powerpc/configs/mpc834x_itx_defconfig   |  156 +--
 arch/powerpc/configs/mpc834x_itxgp_defconfig |  161 ++-
 arch/powerpc/configs/mpc834x_mds_defconfig   |  149 +-
 arch/powerpc/configs/mpc836x_mds_defconfig   |  155 +--
 arch/powerpc/configs/mpc8540_ads_defconfig   |  101 ++--
 arch/powerpc/configs/mpc8544_ds_defconfig|  130 
 arch/powerpc/configs/mpc8560_ads_defconfig   |  104 ++--
 arch/powerpc/configs/mpc8568mds_defconfig|  161 ++-
 arch/powerpc/configs/mpc8572_ds_defconfig|  130 
 arch/powerpc/configs/mpc85xx_cds_defconfig   |  126 ---
 arch/powerpc/configs/mpc8610_hpcd_defconfig  |  114 ++
 arch/powerpc/configs/mpc8641_hpcn_defconfig  |  131 
 arch/powerpc/configs/mpc866_ads_defconfig|  107 ++---
 arch/powerpc/configs/mpc885_ads_defconfig|   98 ++--
 arch/powerpc/configs/pasemi_defconfig|8 +
 arch/powerpc/configs/pmac32_defconfig|  217 --
 arch/powerpc/configs/ppc64_defconfig |9 +
 arch/powerpc/configs/pq2fads_defconfig   |  148 +++---
 arch/powerpc/configs/prpmc2800_defconfig |  150 +-
 arch/powerpc/configs/ps3_defconfig   |  177 +++--
 arch/powerpc/configs/pseries_defconfig   |  156 ++-
 arch/powerpc/configs/sequoia_defconfig   |  111 +++--
 arch/powerpc/configs/walnut_defconfig|   22 +--
 arch/powerpc/kernel/process.c|2 
 include/asm-powerpc/time.h   |8 -
 43 files changed, 2650 insertions(+), 2452 deletions(-)

Geoff Levand (1):
  [POWERPC] PS3: Update ps3_defconfig

Paul Mackerras (1):
  [POWERPC] Update defconfigs

Stephen Rothwell (1):
  [POWERPC] Update iseries_defconfig

Tony Breeds (1):
  [POWERPC] Fix hardware IRQ time accounting problem.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC/PATCH 8/10] powerpc: Merge PCI resource fixups

2007-12-06 Thread Stephen Rothwell
On Thu, 06 Dec 2007 19:11:36 +1100 Benjamin Herrenschmidt <[EMAIL PROTECTED]> 
wrote:
>
> @@ -316,19 +313,26 @@ void __devinit of_scan_bus(struct device
>   dev = of_create_pci_dev(child, bus, devfn);
>   if (!dev)
>   continue;
> - DBG("dev header type: %x\n", dev->hdr_type);
> + DBG("dev header type: %x\n", dev->hdr_type);
> + }
> +
> + /* Ally all fixups */
> + pcibios_fixup_of_probed_bus(bus);
>  
> + /* Now scan child busses */
> + list_for_each_entry(dev, &bus->devices, bus_list) {
>   if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
> - dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
> - of_scan_pci_bridge(child, dev);
> + dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
> + struct device_node *child = pci_device_to_OF_node(dev);
> + if (dev)
^^^
child?

> + of_scan_pci_bridge(child, dev);
> + }
>   }
-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpkI16roPjYn.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 2/3] celleb: add supporting for native CBE

2007-12-06 Thread Arnd Bergmann
On Thursday 06 December 2007, Ishizaki Kou wrote:
> > 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.

Ok, fine with me then. Thanks,

Arnd <><
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


  1   2   >