[GIT]: Make LMB code sharable with sparc64.

2008-02-13 Thread David Miller

As I mentioned to a few ppc folks at LCA08 I plan to use
the LMB code from powerpc as a basis for NUMA support on
sparc64.

There are two changes.

1) Move arch/powerpc/mm/lmb.c to lib/lmb.c, put the main
   interface bits in include/linux/lmb.h, put arch-specific
   bits in asm/lmb.h and add Kconfig machinery to build this
   stuff on sparc64.

2) Fix a bug in lmb_alloc() wherein the size was not aligned
   so we could easily run out of reserve blocks because
   every aligned allocation would create a tiny hole, and
   secondly the lmb_reserve() call there did not have it's
   return value checked.

Powerpc folks, if there are no objections please pull, thanks!

The following changes since commit 96b5a46e2a72dc1829370c87053e0cd558d58bc0:
  Linus Torvalds (1):
WMI: initialize wmi_blocks.list even if ACPI is disabled

are available in the git repository at:

  master.kernel.org:/pub/scm/linux/kernel/git/davem/lmb-2.6.git master

David S. Miller (2):
  [LIB]: Make PowerPC LMB code generic so sparc64 can use it too.
  [LMB]: Fix bug in __lmb_alloc_base().

 arch/powerpc/Kconfig|3 +
 arch/powerpc/kernel/btext.c |2 +-
 arch/powerpc/kernel/crash.c |2 +-
 arch/powerpc/kernel/crash_dump.c|2 +-
 arch/powerpc/kernel/machine_kexec.c |2 +-
 arch/powerpc/kernel/prom.c  |2 +-
 arch/powerpc/kernel/rtas.c  |2 +-
 arch/powerpc/kernel/setup-common.c  |2 +-
 arch/powerpc/kernel/setup_64.c  |2 +-
 arch/powerpc/kernel/vdso.c  |2 +-
 arch/powerpc/mm/Makefile|2 +-
 arch/powerpc/mm/hash_utils_64.c |2 +-
 arch/powerpc/mm/init_32.c   |2 +-
 arch/powerpc/mm/init_64.c   |2 +-
 arch/powerpc/mm/mem.c   |2 +-
 arch/powerpc/mm/numa.c  |2 +-
 arch/powerpc/mm/ppc_mmu_32.c|2 +-
 arch/powerpc/mm/stab.c  |2 +-
 arch/powerpc/platforms/cell/iommu.c |2 +-
 arch/powerpc/platforms/maple/setup.c|2 +-
 arch/powerpc/platforms/powermac/setup.c |2 +-
 arch/powerpc/platforms/ps3/htab.c   |2 +-
 arch/powerpc/platforms/ps3/mm.c |2 +-
 arch/powerpc/platforms/ps3/os-area.c|2 +-
 arch/powerpc/sysdev/dart_iommu.c|2 +-
 arch/sparc64/Kconfig|3 +
 include/asm-powerpc/abs_addr.h  |2 +-
 include/asm-powerpc/lmb.h   |   82 +++---
 include/asm-sparc64/lmb.h   |   10 
 include/linux/lmb.h |   83 +++
 lib/Makefile|2 +
 {arch/powerpc/mm = lib}/lmb.c  |   39 ---
 32 files changed, 155 insertions(+), 117 deletions(-)
 create mode 100644 include/asm-sparc64/lmb.h
 create mode 100644 include/linux/lmb.h
 rename {arch/powerpc/mm = lib}/lmb.c (92%)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [GIT]: Make LMB code sharable with sparc64.

2008-02-13 Thread Sam Ravnborg
On Wed, Feb 13, 2008 at 12:41:20AM -0800, David Miller wrote:
 
 As I mentioned to a few ppc folks at LCA08 I plan to use
 the LMB code from powerpc as a basis for NUMA support on
 sparc64.
 
 There are two changes.
 
 1) Move arch/powerpc/mm/lmb.c to lib/lmb.c, put the main
interface bits in include/linux/lmb.h, put arch-specific
bits in asm/lmb.h and add Kconfig machinery to build this
stuff on sparc64.
 
 2) Fix a bug in lmb_alloc() wherein the size was not aligned
so we could easily run out of reserve blocks because
every aligned allocation would create a tiny hole, and
secondly the lmb_reserve() call there did not have it's
return value checked.
 
 Powerpc folks, if there are no objections please pull, thanks!
 
 The following changes since commit 96b5a46e2a72dc1829370c87053e0cd558d58bc0:
   Linus Torvalds (1):
 WMI: initialize wmi_blocks.list even if ACPI is disabled
 
 are available in the git repository at:
 
   master.kernel.org:/pub/scm/linux/kernel/git/davem/lmb-2.6.git master

Review had been easier if the patch was inlined.
Took a quick look at the small Kconfig bits.

From arch/sparc64/Kconfig:
+config LMB
+   def_bool y
+

Can we plase have this changed to use:

 config SPARC64
+   select HAVE_LMB

And then in lib/Kconfig have
+config HAVE_LMB
+   bool

So we avoid creating a new variable each time we introdce LMB support.
You would need to update powerpc Kconfig too of course.

This way of doing it is documented in:
Documenation/kbuild/kconfig.language.txt

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


Re: [GIT]: Make LMB code sharable with sparc64.

2008-02-13 Thread David Miller
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Wed, 13 Feb 2008 09:57:35 +0100

 Review had been easier if the patch was inlined.

Sorry :)

 Can we plase have this changed to use:
 
  config SPARC64
 + select HAVE_LMB
 
 And then in lib/Kconfig have
 +config HAVE_LMB
 + bool
 
 So we avoid creating a new variable each time we introdce LMB support.
 You would need to update powerpc Kconfig too of course.

Sure, I'll rework this in the next day or so to do things
that way.

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


Re: [PATCH 00/18] ide: warm-plug support for IDE devices and other goodies

2008-02-13 Thread Gabriel Paubert
On Tue, Feb 12, 2008 at 01:30:03PM +0100, Gabriel Paubert wrote:
 On Tue, Feb 12, 2008 at 12:49:05PM +0100, Gabriel Paubert wrote:
  On Fri, Feb 08, 2008 at 07:40:43PM +1100, Benjamin Herrenschmidt wrote:
   
   On Fri, 2008-02-08 at 01:44 +0100, Bartlomiej Zolnierkiewicz wrote:
- couple of fixes and preparatory patches

- rework of PowerMac media-bay support ([un]register IDE devices 
instead of
  [un]registering IDE interface) [ it is the main reason for spamming 
PPC ML ]
   
   Interesting... I was thinking about doing a full remove of the device at
   a higher level instead but I suppose what you propose is easier.
  
  Well, I have serious problem on a Pegasos which appeared some time
  between 2.6.24 and 2.6.25-rc1: at boot I get an infinite string of 
  
  hdb: empty DMA table?
  
  I'm trying to bisect it right now.
 
 Argh, the first bisect point ended up with timeouts on hdb...
 
 Flagged as bad, to try to see when the problems started, but 
 I suspect that there are several.

Well, it's worse than this. After 7 or 8 bisections (all flagged
bad) the symptoms changed: the system boots up to the point where
it does not recognize LVM volumes. So there are at least 3 bugs:
1) the timeout on interrupts (only seen on hdb)
2) the empty DMA table messages (seen on hda and hdb)
3) the inability to see logical volumes (pvs does not find them,
  they are back when rebooting into 2.6.24). This is the apparently
  the earliest introduced bug (no problems with the disks with that
  version).

I am away from that machine until next Tuesday. IIRC the last git
bisect was something like 160 revisions left.

Gabriel

 
   Gabriel
 ___
 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: [GIT]: Make LMB code sharable with sparc64.

2008-02-13 Thread Michael Ellerman
On Wed, 2008-02-13 at 00:41 -0800, David Miller wrote:
 As I mentioned to a few ppc folks at LCA08 I plan to use
 the LMB code from powerpc as a basis for NUMA support on
 sparc64.
 
 There are two changes.
 
 1) Move arch/powerpc/mm/lmb.c to lib/lmb.c, put the main
interface bits in include/linux/lmb.h, put arch-specific
bits in asm/lmb.h and add Kconfig machinery to build this
stuff on sparc64.
 
 2) Fix a bug in lmb_alloc() wherein the size was not aligned
so we could easily run out of reserve blocks because
every aligned allocation would create a tiny hole, and
secondly the lmb_reserve() call there did not have it's
return value checked.
 
 Powerpc folks, if there are no objections please pull, thanks!

Looks like there are a few places (in arch/powerpc) that were getting
asm/prom.h via asm/lmb.h, I'll send a patch in the morning.

cheers

arch/powerpc/mm/numa.c:124: error: implicit declaration of function 
'of_find_node_by_type'

arch/powerpc/platforms/ps3/os-area.c:215: error: variable 'property_rtc_diff' 
has initializer but incomplete type

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 09/18] ide: rework PowerMac media-bay support

2008-02-13 Thread Bartlomiej Zolnierkiewicz

Hi,

On Wednesday 13 February 2008, Michael Ellerman wrote:
 On Fri, 2008-02-08 at 01:45 +0100, Bartlomiej Zolnierkiewicz wrote:
  Rework PowerMac media-bay support in such way that instead of
  un/registering the IDE interface we un/register IDE devices:
  
  * Add ide_port_scan() helper for probing+registerering devices on a port.
  
  * Rename ide_port_unregister_devices() to __ide_port_unregister_devices().
  
  * Add ide_port_unregister_devices() helper for unregistering devices on a 
  port.
  
  * Add 'ide_hwif_t *cd_port' to 'struct media_bay_info', pass 'hwif' instead
of hwif-index to media_bay_set_ide_infos() and use it to setup 'cd_port'.
  
  * Use ide_port_unregister_devices() instead of ide_unregister()
and ide_port_scan() instead of ide_register_hw() in media_bay_step().
  
  * Unexport ide_register_hw() and make it static.
  
  Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
  ---
   drivers/ide/ide-probe.c|   18 ++
   drivers/ide/ide.c  |   22 --
   drivers/ide/ppc/pmac.c |3 ++-
   drivers/macintosh/mediabay.c   |   17 +++--
   include/asm-powerpc/mediabay.h |4 +++-
   include/linux/ide.h|6 ++
   6 files changed, 48 insertions(+), 22 deletions(-)
 
  Index: b/include/asm-powerpc/mediabay.h
  ===
  --- a/include/asm-powerpc/mediabay.h
  +++ b/include/asm-powerpc/mediabay.h
  @@ -22,10 +22,12 @@ int check_media_bay(struct device_node *
   /* Number of bays in the machine or 0 */
   extern int media_bay_count;
   
  +#ifdef CONFIG_BLK_DEV_IDE_PMAC

Does adding:

#include linux/ide.h

after ifdef help?

   int check_media_bay_by_base(unsigned long base, int what);
   /* called by IDE PMAC host driver to register IDE controller for media bay 
  */
   int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long 
  base,
  -   int irq, int index);
  +   int irq, ide_hwif_t *hwif);
  +#endif
   
   #endif /* __KERNEL__ */
   #endif /* _PPC_MEDIABAY_H */
 
 This hunk breaks pmac32_defconfig for me.
 
 include2/asm/mediabay.h:29: error: syntax error before 'ide_hwif_t'
 make[3]: *** [arch/powerpc/platforms/powermac/setup.o] Error 1
 make[2]: *** [arch/powerpc/platforms/powermac] Error 2
 make[1]: *** [arch/powerpc/platforms] Error 2
 make: *** [sub-make] Error 2
 
 cheers
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [GIT]: Make LMB code sharable with sparc64.

2008-02-13 Thread Kumar Gala

On Feb 13, 2008, at 2:41 AM, David Miller wrote:


 As I mentioned to a few ppc folks at LCA08 I plan to use
 the LMB code from powerpc as a basis for NUMA support on
 sparc64.

 There are two changes.

 1) Move arch/powerpc/mm/lmb.c to lib/lmb.c, put the main
   interface bits in include/linux/lmb.h, put arch-specific
   bits in asm/lmb.h and add Kconfig machinery to build this
   stuff on sparc64.

 2) Fix a bug in lmb_alloc() wherein the size was not aligned
   so we could easily run out of reserve blocks because
   every aligned allocation would create a tiny hole, and
   secondly the lmb_reserve() call there did not have it's
   return value checked.

 Powerpc folks, if there are no objections please pull, thanks!

 The following changes since commit  
 96b5a46e2a72dc1829370c87053e0cd558d58bc0:
  Linus Torvalds (1):
WMI: initialize wmi_blocks.list even if ACPI is disabled

 are available in the git repository at:

  master.kernel.org:/pub/scm/linux/kernel/git/davem/lmb-2.6.git master

 David S. Miller (2):
  [LIB]: Make PowerPC LMB code generic so sparc64 can use it too.
  [LMB]: Fix bug in __lmb_alloc_base().

Does sparc have the concept of a phys_addr_t?  We are in the process  
of expanding the lmb support to deal with 36-bit physical addresses on  
32-bit machines.

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


[PATCH] [POWERPC] Fix initial lmb add region with a non-zero base

2008-02-13 Thread Kumar Gala
If we add to an empty lmb region with a non-zero base we will not coalesce
the number of regions done to one.  This causes problems on ppc32 for the
memory region as its assumed to only have one region.

We can fix this be easily specially casing the initial add to just replace
the dummy region.

---

Posting this since Dave's looking a pulling the lmb code out into lib/ and
sharing it between powerpc and sparc.

(this is my git tree git.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git)

- k

 arch/powerpc/mm/lmb.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 4ce23bc..1ea8df0 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -141,6 +141,12 @@ static long __init lmb_add_region(struct lmb_region *rgn, 
unsigned long base,
unsigned long coalesced = 0;
long adjacent, i;

+   if ((rgn-cnt == 1)  (rgn-region[0].size == 0)) {
+   rgn-region[0].base = base;
+   rgn-region[0].size = size;
+   return 0;
+   }
+
/* First try and coalesce this LMB with another. */
for (i=0; i  rgn-cnt; i++) {
unsigned long rgnbase = rgn-region[i].base;
-- 
1.5.3.8

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


Re: [PATCH] [POWERPC] Fix initial lmb add region with a non-zero base

2008-02-13 Thread Jon Loeliger
So, like, the other day Kumar Gala mumbled:
 If we add to an empty lmb region with a non-zero base we will not coalesce
 the number of regions done to one.  This causes problems on ppc32 for the

s/done/down

 memory region as its assumed to only have one region.
 
 We can fix this be easily specially casing the initial add to just replace
 the dummy region.
 
 ---

 Posting this since Dave's looking a pulling the lmb code out into lib/ and
 sharing it between powerpc and sparc.

Did you want to S-o-b: this patch?  Or was this just informational?

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


[PATCH] ehea: add kdump support

2008-02-13 Thread Thomas Klein
This patch adds kdump support to the ehea driver. As the firmware doesn't free
resource handles automatically, the driver has to run an as simple as possible
free resource function in case of a crash shutdown. The function iterates over
two arrays freeing all resource handles which are stored there. The arrays are
kept up-to-date during normal runtime. The crash handler fn is triggered by the
recently introduced PPC crash shutdown reg/unreg functions.


Signed-off-by: Thomas Klein [EMAIL PROTECTED]

---
 drivers/net/ehea/ehea.h  |   34 +-
 drivers/net/ehea/ehea_main.c |  281 ++
 2 files changed, 290 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 88fb53e..7c4ead3 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
 #include asm/io.h

 #define DRV_NAME   ehea
-#define DRV_VERSIONEHEA_0083
+#define DRV_VERSIONEHEA_0087

 /* eHEA capability flags */
 #define DLPAR_PORT_ADD_REM 1
@@ -386,6 +386,13 @@ struct ehea_port_res {


 #define EHEA_MAX_PORTS 16
+
+#define EHEA_NUM_PORTRES_FW_HANDLES6  /* QP handle, SendCQ handle,
+RecvCQ handle, EQ handle,
+SendMR handle, RecvMR handle */
+#define EHEA_NUM_PORT_FW_HANDLES   1  /* EQ handle */
+#define EHEA_NUM_ADAPTER_FW_HANDLES2  /* MR handle, NEQ handle */
+
 struct ehea_adapter {
u64 handle;
struct of_device *ofdev;
@@ -405,6 +412,31 @@ struct ehea_mc_list {
u64 macaddr;
 };

+/* kdump support */
+struct ehea_fw_handle_entry {
+   u64 adh;   /* Adapter Handle */
+   u64 fwh;   /* Firmware Handle */
+};
+
+struct ehea_fw_handle_array {
+   struct ehea_fw_handle_entry *arr;
+   int num_entries;
+   struct semaphore lock;
+};
+
+struct ehea_bcmc_reg_entry {
+   u64 adh;   /* Adapter Handle */
+   u32 port_id;   /* Logical Port Id */
+   u8 reg_type;   /* Registration Type */
+   u64 macaddr;
+};
+
+struct ehea_bcmc_reg_array {
+   struct ehea_bcmc_reg_entry *arr;
+   int num_entries;
+   struct semaphore lock;
+};
+
 #define EHEA_PORT_UP 1
 #define EHEA_PORT_DOWN 0
 #define EHEA_PHY_LINK_UP 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index c051c7e..21af674 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -35,6 +35,7 @@
 #include linux/if_ether.h
 #include linux/notifier.h
 #include linux/reboot.h
+#include asm/kexec.h

 #include net/ip.h

@@ -98,8 +99,10 @@ static int port_name_cnt;
 static LIST_HEAD(adapter_list);
 u64 ehea_driver_flags;
 struct work_struct ehea_rereg_mr_task;
-
 struct semaphore dlpar_mem_lock;
+struct ehea_fw_handle_array ehea_fw_handles;
+struct ehea_bcmc_reg_array ehea_bcmc_regs;
+

 static int __devinit ehea_probe_adapter(struct of_device *dev,
const struct of_device_id *id);
@@ -132,6 +135,160 @@ void ehea_dump(void *adr, int len, char *msg)
}
 }

+static void ehea_update_firmware_handles(void)
+{
+   struct ehea_fw_handle_entry *arr = NULL;
+   struct ehea_adapter *adapter;
+   int num_adapters = 0;
+   int num_ports = 0;
+   int num_portres = 0;
+   int i = 0;
+   int num_fw_handles, k, l;
+
+   /* Determine number of handles */
+   list_for_each_entry(adapter, adapter_list, list) {
+   num_adapters++;
+
+   for (k = 0; k  EHEA_MAX_PORTS; k++) {
+   struct ehea_port *port = adapter-port[k];
+
+   if (!port || (port-state != EHEA_PORT_UP))
+   continue;
+
+   num_ports++;
+   num_portres += port-num_def_qps + port-num_add_tx_qps;
+   }
+   }
+
+   num_fw_handles = num_adapters * EHEA_NUM_ADAPTER_FW_HANDLES +
+num_ports * EHEA_NUM_PORT_FW_HANDLES +
+num_portres * EHEA_NUM_PORTRES_FW_HANDLES;
+
+   if (num_fw_handles) {
+   arr = kzalloc(num_fw_handles * sizeof(*arr), GFP_KERNEL);
+   if (!arr)
+   return;  /* Keep the existing array */
+   } else
+   goto out_update;
+
+   list_for_each_entry(adapter, adapter_list, list) {
+   for (k = 0; k  EHEA_MAX_PORTS; k++) {
+   struct ehea_port *port = adapter-port[k];
+
+   if (!port || (port-state != EHEA_PORT_UP))
+   continue;
+
+   for (l = 0;
+l  port-num_def_qps + port-num_add_tx_qps;
+l++) {
+   struct ehea_port_res *pr = port-port_res[l];
+
+   arr[i].adh = adapter-handle;
+   arr[i++].fwh = 

Re: [PATCH] [POWERPC] Fix initial lmb add region with a non-zero base

2008-02-13 Thread Kumar Gala

On Feb 13, 2008, at 8:20 AM, Jon Loeliger wrote:

 So, like, the other day Kumar Gala mumbled:
 If we add to an empty lmb region with a non-zero base we will not  
 coalesce
 the number of regions done to one.  This causes problems on ppc32  
 for the

 s/done/down

will fix.

 memory region as its assumed to only have one region.

 We can fix this be easily specially casing the initial add to just  
 replace
 the dummy region.

 ---

 Posting this since Dave's looking a pulling the lmb code out into  
 lib/ and
 sharing it between powerpc and sparc.

 Did you want to S-o-b: this patch?  Or was this just informational?

this was info/for review, the git tree has a s-o-b.

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


Re: [PATCH] drivers/base: export gpl (un)register_memory_notifier

2008-02-13 Thread Jan-Bernd Themann
Hi Dave,

On Monday 11 February 2008 17:47, Dave Hansen wrote:
 Also, just ripping down and completely re-doing the entire mass of cards
 every time a 16MB area of memory is added or removed seems like an
 awfully big sledgehammer to me.  I would *HATE* to see anybody else
 using this driver as an example to work off of?  Can't you just keep
 track of which areas the driver is actually *USING* and only worry about
 changing mappings if that intersects with an area having hotplug done on
 it?


to form a base for the eHEA memory add / remove concept discussion:

Explanation of the current eHEA memory add / remove concept:

Constraints imposed by HW / FW:
- eHEA has own MMU
- eHEA  Memory Regions (MRs) are used by the eHEA MMU  to translate virtual
  addresses to absolute addresses (like DMA mapped memory on a PCI bus)
- The number of MRs is limited (not enough to have one MR per packet)
- Registration of MRs is comparativley slow as done via slow firmware call
(H_CALL)
- MRs can have a maximum size of the memory available under linux
- MRs cover a contiguous virtual memory block (no holes)

Because of this there is just one big MR that covers entire kernel memory.
We also need a mapping table from kernel addresses to this
contiguous virtual memory IO space (here called ehea_bmap).

- When memory is added / removed to LPAR (and linux), the MR has to be updated.
  This can only be done by destroying and recreating the MR. There is no H_CALL
  to modify MR size. To find holes in the linux kernel memory layout we have to
  iterate over the memory sections for recreating a ehea_bmap
  (otherwise MR would be bigger then available memory causing the
  registration to fail)

- DLPAR userspace tools, kernel, driver, firmware and HMC are involved in that
  process on System p

Memory add: version without a external memory notifier call
- new memory used in a transfer_xmit will result in a ehea_bmap
  translation miss, which triggers a rebuild and reregistration
  of the ehea_bmap based on the current kernel memory setup.
- advantage: the number of MR rebuilds is reduced significantly compared to
  a rebuild for each 16MB chunk of memory added.

Memory add: version with external notifier call:
- We still need a ehea_bmap (whatever structure it has)

Memory remove with notifier:
- We have to rebuild the ehea_bmap instantly to remove the pages that are
  no longer available. Without doing that, the firmware (pHYP) cannot remove
  that memory from the LPAR. As we don't know if or how many additional 
  sections are to be removed before the DLPAR user space tool tells the 
  firmware to remove the memory, we can't wait with the rebuild.


Our current understanding about the current Memory Hotplug System are
(please correct me
if I'm wrong):

- depends on sparse mem
- only whole memory sections are added / removed
- for each section a memory resource is registered


From the driver side we need:
- some kind of memory notification mechanism.
  For memory add we can live without any external memory notification
  event. For memory remove we do need an external trigger (see explanation
  above).
- a way to iterate over all kernel pages and a way to detect holes in the
  kernel memory layout in order to build up our own ehea_bmap.


Memory notification trigger:
- These triggers exist, an exported register_memory_notifier /
  unregister_memory_notifier would work in this scheme

Functions to use while building ehea_bmap + MRs:
- Use either the functions that are used by the memory hotplug system as
  well, that means using the section defines + functions (section_nr_to_pfn,
  pfn_valid)
- Use currently other not exported functions in kernel/resource.c, like
  walk_memory_resource (where we would still need the maximum possible number
  of pages NR_MEM_SECTIONS)
- Maybe some kind of new interface?

What would you suggest?

Regards,
Jan-Bernd  Christoph
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[Patch 0/2] add check_legacy_ioport calls to prevent oops

2008-02-13 Thread Christian Krafft
Hi,

the following two patches prevent kernel from crashing on powerpc.
The surrounding ifdefs will be obsolete, if check_legacy_ioport becomes
generic code.


-- 
Mit freundlichen Gruessen,
kind regards,

Christian Krafft
IBM Systems  Technology Group,
Linux Kernel Development
IT Specialist


Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft:  Boeblingen
Registriergericht:  Amtsgericht Stuttgart, HRB 243294


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

Re: [PATCH] drivers/base: export gpl (un)register_memory_notifier

2008-02-13 Thread Dave Hansen
On Wed, 2008-02-13 at 16:17 +0100, Jan-Bernd Themann wrote:
 Constraints imposed by HW / FW:
 - eHEA has own MMU
 - eHEA  Memory Regions (MRs) are used by the eHEA MMU  to translate virtual
   addresses to absolute addresses (like DMA mapped memory on a PCI bus)
 - The number of MRs is limited (not enough to have one MR per packet)

Are there enough to have one per 16MB section?

 Our current understanding about the current Memory Hotplug System are
 (please correct me if I'm wrong):
 
 - depends on sparse mem

You're wrong ;).  In mainline, this is true.  There was a version of the
SUSE kernel that did otherwise.  But you can not and should not depend
on this never changing.  But, someone is perfectly free to go out an
implement something better than sparsemem for memory hotplug.  If they
go and do this, your driver may get left behind. 

 - only whole memory sections are added / removed
 - for each section a memory resource is registered

True, and true. (There might be exceptions to the whole sections one,
but that's blatant abuse and should be fixed. :)

 From the driver side we need:
 - some kind of memory notification mechanism.
   For memory add we can live without any external memory notification
   event. For memory remove we do need an external trigger (see explanation
   above).

You can export and use (un)register_memory_notifier.  You just need to
do it in a reasonable way that compiles for randconfig on your
architecture.  Believe me, we don't want to start teaching drivers about
sparsemem.  

 - a way to iterate over all kernel pages and a way to detect holes in the
   kernel memory layout in order to build up our own ehea_bmap.

Look at kernel/resource.c

But, I'm really not convinced that you can actually keep this map
yourselves.  It's not as simple as you think.  What happens if you get
on an LPAR with two sections, one [EMAIL PROTECTED] and another
[EMAIL PROTECTED]  That's quite possible.  I think your vmalloc'd
array will eat all of memory.  

That's why we have SPARSEMEM_EXTREME and SPARSEMEM_VMEMMAP implemented
in the core, so that we can deal with these kinds of problems, once and
*NOT* in every single little driver out there.  

 Functions to use while building ehea_bmap + MRs:
 - Use either the functions that are used by the memory hotplug system as
   well, that means using the section defines + functions (section_nr_to_pfn,
   pfn_valid)

Basically, you can't use anything related to sections outside of the
core code.  You can use things like pfn_valid(), or you can create new
interfaces that are properly abstracted.  

 - Use currently other not exported functions in kernel/resource.c, like
   walk_memory_resource (where we would still need the maximum possible number
   of pages NR_MEM_SECTIONS)

It isn't the act of exporting that's the problem.  It's making sure that
the exports won't be prone to abuse and that people are using them
properly.  You should assume that you can export and use
walk_memory_resource().

Do you know what other operating systems do with this hardware?

In the future, please make an effort to get review from knowledgeable
people about these kinds of things before using them in your driver.
Your company has many, many resources available, and all you need to do
is ask.  All that you have to do is look to the tops of the files of the
functions you are calling.

-- Dave

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


Re: [Patch 0/2] powerpc: avoid userspace poking to legacy ioports

2008-02-13 Thread Christian Krafft
sensors_detect crashes kernel on PowerPC, as it pokes directly to memory.
This patch adds a check_legacy_ioports to read_port and write_port.
It will now return ENXIO, instead of oopsing.

Signed-off-by: Christian Krafft [EMAIL PROTECTED]

Index: linux.git/drivers/char/mem.c
===
--- linux.git.orig/drivers/char/mem.c
+++ linux.git/drivers/char/mem.c
@@ -566,8 +566,13 @@ static ssize_t read_port(struct file * f
char __user *tmp = buf;
 
if (!access_ok(VERIFY_WRITE, buf, count))
-   return -EFAULT; 
+   return -EFAULT;
+
while (count--  0  i  65536) {
+#ifdef CONFIG_PPC_MERGE
+   if (check_legacy_ioport(i))
+   return -ENXIO;
+#endif
if (__put_user(inb(i),tmp)  0) 
return -EFAULT;  
i++;
@@ -585,6 +590,7 @@ static ssize_t write_port(struct file * 
 
if (!access_ok(VERIFY_READ,buf,count))
return -EFAULT;
+
while (count--  0  i  65536) {
char c;
if (__get_user(c, tmp)) {
@@ -592,6 +598,10 @@ static ssize_t write_port(struct file * 
break;
return -EFAULT; 
}
+#ifdef CONFIG_PPC_MERGE
+   if (check_legacy_ioport(i))
+   return -ENXIO;
+#endif
outb(c,i);
i++;
tmp++;


-- 
Mit freundlichen Gruessen,
kind regards,

Christian Krafft
IBM Systems  Technology Group,
Linux Kernel Development
IT Specialist


Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft:  Boeblingen
Registriergericht:  Amtsgericht Stuttgart, HRB 243294


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

Re: [Patch 2/2] powerpc: i2c-isa: add access check to legacy ioports

2008-02-13 Thread Christian Krafft
when probing i2c-pca-isa writes to legacy ioports, which crashes the kernel
if there is no device at that port.
This patch adds a check_legacy_ioport call, so probe failes gracefully
and thus prevents the oops.

Signed-off-by: Christian Krafft [EMAIL PROTECTED]

Index: linux.git/drivers/i2c/busses/i2c-pca-isa.c
===
--- linux.git.orig/drivers/i2c/busses/i2c-pca-isa.c
+++ linux.git/drivers/i2c/busses/i2c-pca-isa.c
@@ -125,6 +125,13 @@ static int __devinit pca_isa_probe(struc
 
dev_info(dev, i/o base %#08lx. irq %d\n, base, irq);
 
+#ifdef CONFIG_PPC_MERGE
+   if (check_legacy_ioport(base)) {
+   dev_err(dev, I/O address %#08lx is not available\n, base);
+   goto out;
+   }
+#endif
+
if (!request_region(base, IO_SIZE, i2c-pca-isa)) {
dev_err(dev, I/O address %#08lx is in use\n, base);
goto out;


-- 
Mit freundlichen Gruessen,
kind regards,

Christian Krafft
IBM Systems  Technology Group,
Linux Kernel Development
IT Specialist


Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft:  Boeblingen
Registriergericht:  Amtsgericht Stuttgart, HRB 243294


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

Re: [Patch 0/2] powerpc: avoid userspace poking to legacy ioports

2008-02-13 Thread Benjamin Herrenschmidt

On Wed, 2008-02-13 at 18:35 +0100, Christian Krafft wrote:
 sensors_detect crashes kernel on PowerPC, as it pokes directly to memory.
 This patch adds a check_legacy_ioports to read_port and write_port.
 It will now return ENXIO, instead of oopsing.
 
 Signed-off-by: Christian Krafft [EMAIL PROTECTED]

The problem is that this prevents using /proc/ioports to access PCI
IO space, which might be useful.

I hate that sensors_detect.. or for that matter any other userland code
that pokes random ports like that. It should die.

Ben.

 Index: linux.git/drivers/char/mem.c
 ===
 --- linux.git.orig/drivers/char/mem.c
 +++ linux.git/drivers/char/mem.c
 @@ -566,8 +566,13 @@ static ssize_t read_port(struct file * f
   char __user *tmp = buf;
  
   if (!access_ok(VERIFY_WRITE, buf, count))
 - return -EFAULT; 
 + return -EFAULT;
 +
   while (count--  0  i  65536) {
 +#ifdef CONFIG_PPC_MERGE
 + if (check_legacy_ioport(i))
 + return -ENXIO;
 +#endif
   if (__put_user(inb(i),tmp)  0) 
   return -EFAULT;  
   i++;
 @@ -585,6 +590,7 @@ static ssize_t write_port(struct file * 
  
   if (!access_ok(VERIFY_READ,buf,count))
   return -EFAULT;
 +
   while (count--  0  i  65536) {
   char c;
   if (__get_user(c, tmp)) {
 @@ -592,6 +598,10 @@ static ssize_t write_port(struct file * 
   break;
   return -EFAULT; 
   }
 +#ifdef CONFIG_PPC_MERGE
 + if (check_legacy_ioport(i))
 + return -ENXIO;
 +#endif
   outb(c,i);
   i++;
   tmp++;
 
 
 ___
 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


[PATCH 1/2 rev2] powerpc: publish 85xx cds soc dts entries as of_device

2008-02-13 Thread Dave Jiang
Publish the devices listed in dts under SOC as of_device for mpc85xx_cds
platforms.

The memory controller, L2 cache-controller, and the PCI controller(s) are
published as of_device so the mpc85xx EDAC driver can claim them for usage.

Signed-off-by: Dave Jiang [EMAIL PROTECTED]

---
commit 4be72413410c560fe7ad5ef9156d43159003dad3
tree 8890093ee1cff0ec0cc9ce0b9367e134f528eed2
parent 19af35546de68c872dcb687613e0902a602cb20e
author Dave Jiang [EMAIL PROTECTED] Wed, 13 Feb 2008 14:03:33 -0700
committer Dave Jiang [EMAIL PROTECTED](none) Wed, 13 Feb 2008 14:03:33 -0700

 arch/powerpc/platforms/85xx/mpc85xx_cds.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c 
b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 8b1de78..374c9d5 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -26,6 +26,7 @@
 #include linux/module.h
 #include linux/interrupt.h
 #include linux/fsl_devices.h
+#include linux/of_platform.h
 
 #include asm/system.h
 #include asm/pgtable.h
@@ -324,6 +325,19 @@ static void mpc85xx_cds_show_cpuinfo(struct seq_file *m)
seq_printf(m, Memory\t\t: %d MB\n, memsize / (1024 * 1024));
 }
 
+static struct of_device_id __initdata of_bus_ids[] = {
+   { .name = soc, },
+   { .type = soc, },
+   {},
+};
+
+static int __init declare_of_platform_devices(void)
+{
+   of_platform_bus_probe(NULL, of_bus_ids, NULL);
+
+   return 0;
+}
+machine_device_initcall(mpc85xx_cds, declare_of_platform_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[2.6 patch] hvc_rtas_init() must be __init

2008-02-13 Thread Adrian Bunk
This patch fixes the following section mismatch:

--  snip  --

...
WARNING: vmlinux.o(.text+0x2fbca8): Section mismatch in reference from the 
function .hvc_rtas_init() to the function .devinit.text:.hvc_alloc()
...

--  snip  --

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

This patch has been sent on:
- 30 Jan 2008

1cc00c4ad5c881db2fc256ced43f3b5ce5c76e1c 
diff --git a/drivers/char/hvc_rtas.c b/drivers/char/hvc_rtas.c
index bb09413..88590d0 100644
--- a/drivers/char/hvc_rtas.c
+++ b/drivers/char/hvc_rtas.c
@@ -76,7 +76,7 @@ static struct hv_ops hvc_rtas_get_put_ops = {
.put_chars = hvc_rtas_write_console,
 };
 
-static int hvc_rtas_init(void)
+static int __init hvc_rtas_init(void)
 {
struct hvc_struct *hp;
 

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


[2.6 patch] powerpc: free_property() mustn't be __init

2008-02-13 Thread Adrian Bunk
This patch fixes the following section mismatch:

--  snip  --

...
WARNING: vmlinux.o(.text+0x55648): Section mismatch in reference from the 
function .free_node() to the function .init.text:.free_property()
...

--  snip  --

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Acked-by: Stephen Rothwell [EMAIL PROTECTED]

---

This patch has been sent on:
- 30 Jan 2008

99e9b48d8f5aba059916540fc69815db2b60b08d 
diff --git a/arch/powerpc/platforms/iseries/vio.c 
b/arch/powerpc/platforms/iseries/vio.c
index be06cfd..657b72f 100644
--- a/arch/powerpc/platforms/iseries/vio.c
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -75,7 +75,7 @@ static struct property *new_property(const char *name, int 
length,
return np;
 }
 
-static void __init free_property(struct property *np)
+static void free_property(struct property *np)
 {
kfree(np);
 }

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


[2.6 patch] powerpc: vdso_do_func_patch{32,64}() must be __init

2008-02-13 Thread Adrian Bunk
This patch fixes the following section mismatches:

--  snip  --

...
WARNING: vmlinux.o(.text+0xe49c): Section mismatch in reference from the 
function .vdso_do_func_patch64() to the function .init.text:.find_symbol64()
WARNING: vmlinux.o(.text+0xe4d0): Section mismatch in reference from the 
function .vdso_do_func_patch64() to the function .init.text:.find_symbol64()
WARNING: vmlinux.o(.text+0xe56c): Section mismatch in reference from the 
function .vdso_do_func_patch32() to the function .init.text:.find_symbol32()
WARNING: vmlinux.o(.text+0xe5a0): Section mismatch in reference from the 
function .vdso_do_func_patch32() to the function .init.text:.find_symbol32()
...

--  snip  --

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

This patch has been sent on:
- 30 Jan 2008

 arch/powerpc/kernel/vdso.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

1c52ed2049b82e8458d03e50633b01ac5e1dfa40 
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 3702df7..d3437c4 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -336,9 +336,9 @@ static unsigned long __init find_function32(struct 
lib32_elfinfo *lib,
return sym-st_value - VDSO32_LBASE;
 }
 
-static int vdso_do_func_patch32(struct lib32_elfinfo *v32,
-   struct lib64_elfinfo *v64,
-   const char *orig, const char *fix)
+static int __init vdso_do_func_patch32(struct lib32_elfinfo *v32,
+  struct lib64_elfinfo *v64,
+  const char *orig, const char *fix)
 {
Elf32_Sym *sym32_gen, *sym32_fix;
 
@@ -433,9 +433,9 @@ static unsigned long __init find_function64(struct 
lib64_elfinfo *lib,
 #endif
 }
 
-static int vdso_do_func_patch64(struct lib32_elfinfo *v32,
-   struct lib64_elfinfo *v64,
-   const char *orig, const char *fix)
+static int __init vdso_do_func_patch64(struct lib32_elfinfo *v32,
+  struct lib64_elfinfo *v64,
+  const char *orig, const char *fix)
 {
Elf64_Sym *sym64_gen, *sym64_fix;
 

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


Re: [PATCH 2/2] powerpc: create mpc85xx pci err platform device for EDAC

2008-02-13 Thread Dave Jiang
Kumar Gala wrote:
 On Feb 11, 2008, at 2:34 PM, Dave Jiang wrote:
 
 Creating a platform device for the PCI error registers in order for  
 the
 mpc85xx EDAC driver to pick up proper resources. This is to prevent  
 the
 EDAC driver from monopolizing the of_device and thus preventing  
 future PCI
 code from using the PCI of_device(s).

 Signed-off-by: Dave Jiang [EMAIL PROTECTED]
 
 I'd rather we didn't add new platform devices, but do this via  
 of_platform in the driver itself.

Kumar,
  Here's the thread of discussion between Arnd Bergmann and I why platform
device is used. The original patch was of_device based

http://ozlabs.org/pipermail/linuxppc-dev/2007-July/thread.html

Does it still make sense or do I need to go back to of_device?

 
 Also, we need to 'rename' the compatible field for some of these  
 devices.
 
 - k
 


-- 

--
Dave Jiang
Software Engineer
MontaVista Software, Inc.
http://www.mvista.com
--

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


[PATCH 6/8] pseries: phyp dump: Invalidate and print dump areas.

2008-02-13 Thread Manish Ahuja

Changed asm to asm-powerpc.
Hopefully this was the last of them.

-Manish


Routines to 
a. invalidate dump 
b. Calculate region that is reserved and needs to be freed. This is 
   exported through sysfs interface.

Unregister has been removed for now as it wasn't being used.

Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
-

---
 arch/powerpc/platforms/pseries/phyp_dump.c |   85 +
 include/asm-powerpc/phyp_dump.h|3 +
 2 files changed, 77 insertions(+), 11 deletions(-)

Index: 2.6.24-rc5/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- 2.6.24-rc5.orig/arch/powerpc/platforms/pseries/phyp_dump.c  2008-02-13 
21:21:00.0 -0600
+++ 2.6.24-rc5/arch/powerpc/platforms/pseries/phyp_dump.c   2008-02-13 
21:21:48.0 -0600
@@ -69,6 +69,10 @@ static struct phyp_dump_header phdr;
 #define DUMP_SOURCE_CPU 0x0001
 #define DUMP_SOURCE_HPTE 0x0002
 #define DUMP_SOURCE_RMO  0x0011
+#define DUMP_ERROR_FLAG 0x2000
+#define DUMP_TRIGGERED 0x4000
+#define DUMP_PERFORMED 0x8000
+
 
 /**
  * init_dump_header() - initialize the header declaring a dump
@@ -180,9 +184,15 @@ static void print_dump_header(const stru
 static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr)
 {
int rc;
-   ph-cpu_data.destination_address += addr;
-   ph-hpte_data.destination_address += addr;
-   ph-kernel_data.destination_address += addr;
+
+   /* Add addr value if not initialized before */
+   if (ph-cpu_data.destination_address == 0) {
+   ph-cpu_data.destination_address += addr;
+   ph-hpte_data.destination_address += addr;
+   ph-kernel_data.destination_address += addr;
+   }
+
+   /* ToDo Invalidate kdump and free memory range. */
 
do {
rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL,
@@ -195,6 +205,30 @@ static void register_dump_area(struct ph
}
 }
 
+static
+void invalidate_last_dump(struct phyp_dump_header *ph, unsigned long addr)
+{
+   int rc;
+
+   /* Add addr value if not initialized before */
+   if (ph-cpu_data.destination_address == 0) {
+   ph-cpu_data.destination_address += addr;
+   ph-hpte_data.destination_address += addr;
+   ph-kernel_data.destination_address += addr;
+   }
+
+   do {
+   rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL,
+  2, ph, sizeof(struct phyp_dump_header));
+   } while (rtas_busy_delay(rc));
+
+   if (rc) {
+   printk (KERN_ERR phyp-dump: unexpected error (%d) 
+   on invalidate\n, rc);
+   print_dump_header(ph);
+   }
+}
+
 /* - */
 /**
  * release_memory_range -- release memory previously lmb_reserved
@@ -205,8 +239,8 @@ static void register_dump_area(struct ph
  * lmb_reserved in early boot. The released memory becomes
  * available for genreal use.
  */
-static void
-release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
+static
+void release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
 {
struct page *rpage;
unsigned long end_pfn;
@@ -237,8 +271,8 @@ release_memory_range(unsigned long start
  *
  * will release 256MB starting at 1GB.
  */
-static ssize_t
-store_release_region(struct kset *kset, const char *buf, size_t count)
+static
+ssize_t store_release_region(struct kset *kset, const char *buf, size_t count)
 {
unsigned long start_addr, length, end_addr;
unsigned long start_pfn, nr_pages;
@@ -266,10 +300,23 @@ store_release_region(struct kset *kset, 
return count;
 }
 
-static ssize_t
-show_release_region(struct kset * kset, char *buf)
+static ssize_t show_release_region(struct kset * kset, char *buf)
 {
-   return sprintf(buf, ola\n);
+   u64 second_addr_range;
+
+   /* total reserved size - start of scratch area */
+   second_addr_range = phyp_dump_info-init_reserve_size -
+   phyp_dump_info-reserved_scratch_size;
+   return sprintf(buf, CPU:0x%lx-0x%lx: HPTE:0x%lx-0x%lx:
+DUMP:0x%lx-0x%lx, 0x%lx-0x%lx:\n,
+   phdr.cpu_data.destination_address,
+   phdr.cpu_data.length_copied,
+   phdr.hpte_data.destination_address,
+   phdr.hpte_data.length_copied,
+   phdr.kernel_data.destination_address,
+   phdr.kernel_data.length_copied,
+   phyp_dump_info-init_reserve_start,
+   second_addr_range);
 }
 
 static struct subsys_attribute rr = __ATTR(release_region, 0600,
@@ -293,7 +340,6 @@ static int __init phyp_dump_setup(void)
if (!phyp_dump_info-phyp_dump_configured) {
return -ENOSYS;
}
-   

Re: [GIT]: Make LMB code sharable with sparc64.

2008-02-13 Thread David Miller
From: Kumar Gala [EMAIL PROTECTED]
Date: Wed, 13 Feb 2008 07:12:26 -0600

 Does sparc have the concept of a phys_addr_t?  We are in the process  
 of expanding the lmb support to deal with 36-bit physical addresses on  
 32-bit machines.

On sparc64, where I intend to use this, unsigned long's are 64-bit.
If you use some phys_addr_t type instead to help ppc32 along, that
would be perfectly fine with me.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [POWERPC] Fix initial lmb add region with a non-zero base

2008-02-13 Thread David Miller
From: Kumar Gala [EMAIL PROTECTED]
Date: Wed, 13 Feb 2008 07:37:27 -0600 (CST)

 If we add to an empty lmb region with a non-zero base we will not coalesce
 the number of regions done to one.  This causes problems on ppc32 for the
 memory region as its assumed to only have one region.
 
 We can fix this be easily specially casing the initial add to just replace
 the dummy region.
 
 ---
 
 Posting this since Dave's looking a pulling the lmb code out into lib/ and
 sharing it between powerpc and sparc.
 
 (this is my git tree 
 git.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git)

I noticed this issue when I use lmb on sparc64 and I intended to bring
it up eventually.  Thanks for fixing it!
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[RFC/PATCH] Make lmb support large physical addressing

2008-02-13 Thread Becky Bruce

Convert the lmb code to use phys_addr_t instead of unsigned long for
physical addresses and sizes.  This is needed to support large amounts
of RAM on 32-bit systems that support 36-bit physical addressing.

Built/booted on mpc8641; build tested on pasemi and 44x.

Signed-off-by: Becky Bruce [EMAIL PROTECTED]
---
Folks,

This has been sitting in my tree for a few days, and now it looks like
someone has submitted a patch that changes the lmb code to be shared
between sparc and powerpc.  Sparc has no notion of a phys_addr_t.
Should we just use u64 everywhere in this code instead?

Cheers,
Becky

 arch/powerpc/mm/lmb.c |   92 +++--
 include/asm-powerpc/lmb.h |   38 +-
 2 files changed, 66 insertions(+), 64 deletions(-)

diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 4ce23bc..31d86ff 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -41,33 +41,34 @@ void lmb_dump_all(void)
 
DBG(lmb_dump_all:\n);
DBG(memory.cnt   = 0x%lx\n, lmb.memory.cnt);
-   DBG(memory.size  = 0x%lx\n, lmb.memory.size);
+   DBG(memory.size  = 0x%llx\n,
+   (unsigned long long)lmb.memory.size);
for (i=0; i  lmb.memory.cnt ;i++) {
-   DBG(memory.region[0x%x].base   = 0x%lx\n,
-   i, lmb.memory.region[i].base);
-   DBG( .size = 0x%lx\n,
-   lmb.memory.region[i].size);
+   DBG(memory.region[0x%x].base   = 0x%llx\n,
+   i, (unsigned long long)lmb.memory.region[i].base);
+   DBG( .size = 0x%llx\n,
+   (unsigned long long)lmb.memory.region[i].size);
}
 
DBG(\nreserved.cnt   = 0x%lx\n, lmb.reserved.cnt);
DBG(reserved.size= 0x%lx\n, lmb.reserved.size);
for (i=0; i  lmb.reserved.cnt ;i++) {
-   DBG(reserved.region[0x%x].base   = 0x%lx\n,
-   i, lmb.reserved.region[i].base);
-   DBG( .size = 0x%lx\n,
-   lmb.reserved.region[i].size);
+   DBG(reserved.region[0x%x].base   = 0x%llx\n,
+   i, (unsigned long long)lmb.reserved.region[i].base);
+   DBG( .size = 0x%llx\n,
+   (unsigned long long)lmb.reserved.region[i].size);
}
 #endif /* DEBUG */
 }
 
-static unsigned long __init lmb_addrs_overlap(unsigned long base1,
-   unsigned long size1, unsigned long base2, unsigned long size2)
+static unsigned long __init lmb_addrs_overlap(phys_addr_t base1,
+   phys_addr_t size1, phys_addr_t base2, phys_addr_t size2)
 {
return ((base1  (base2+size2))  (base2  (base1+size1)));
 }
 
-static long __init lmb_addrs_adjacent(unsigned long base1, unsigned long size1,
-   unsigned long base2, unsigned long size2)
+static long __init lmb_addrs_adjacent(phys_addr_t base1, phys_addr_t size1,
+   phys_addr_t base2, phys_addr_t size2)
 {
if (base2 == base1 + size1)
return 1;
@@ -80,10 +81,10 @@ static long __init lmb_addrs_adjacent(unsigned long base1, 
unsigned long size1,
 static long __init lmb_regions_adjacent(struct lmb_region *rgn,
unsigned long r1, unsigned long r2)
 {
-   unsigned long base1 = rgn-region[r1].base;
-   unsigned long size1 = rgn-region[r1].size;
-   unsigned long base2 = rgn-region[r2].base;
-   unsigned long size2 = rgn-region[r2].size;
+   phys_addr_t base1 = rgn-region[r1].base;
+   phys_addr_t size1 = rgn-region[r1].size;
+   phys_addr_t base2 = rgn-region[r2].base;
+   phys_addr_t size2 = rgn-region[r2].size;
 
return lmb_addrs_adjacent(base1, size1, base2, size2);
 }
@@ -135,16 +136,16 @@ void __init lmb_analyze(void)
 }
 
 /* This routine called with relocation disabled. */
-static long __init lmb_add_region(struct lmb_region *rgn, unsigned long base,
- unsigned long size)
+static long __init lmb_add_region(struct lmb_region *rgn, phys_addr_t base,
+ phys_addr_t size)
 {
unsigned long coalesced = 0;
long adjacent, i;
 
/* First try and coalesce this LMB with another. */
for (i=0; i  rgn-cnt; i++) {
-   unsigned long rgnbase = rgn-region[i].base;
-   unsigned long rgnsize = rgn-region[i].size;
+   phys_addr_t rgnbase = rgn-region[i].base;
+   phys_addr_t rgnsize = rgn-region[i].size;
 
if ((rgnbase == base)  (rgnsize == size))
/* Already have this region, so we're done */
@@ -191,7 +192,7 @@ static long __init lmb_add_region(struct lmb_region *rgn, 
unsigned long base,
 }
 
 /* This routine may be called with relocation disabled. */
-long __init 

[RFC/PATCH] [POWERPC] Make lmb support large physical addressing

2008-02-13 Thread Becky Bruce
Convert the lmb code to use phys_addr_t instead of unsigned long for
physical addresses and sizes.  This is needed to support large amounts
of RAM on 32-bit systems that support 36-bit physical addressing.

Built/booted on mpc8641; build tested on pasemi and 44x.

Signed-off-by: Becky Bruce [EMAIL PROTECTED]
---
Folks,

This has been sitting in my tree for a few days, and now it looks like
David M. has submitted a patch that changes the lmb code to be shared
between sparc and powerpc.  Sparc has no notion of a phys_addr_t.
Should we just use u64 everywhere in this code instead?  Thoughts?

Cheers,
Becky

 arch/powerpc/mm/lmb.c |   92 +++--
 include/asm-powerpc/lmb.h |   38 +-
 2 files changed, 66 insertions(+), 64 deletions(-)

diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 4ce23bc..31d86ff 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -41,33 +41,34 @@ void lmb_dump_all(void)
 
DBG(lmb_dump_all:\n);
DBG(memory.cnt   = 0x%lx\n, lmb.memory.cnt);
-   DBG(memory.size  = 0x%lx\n, lmb.memory.size);
+   DBG(memory.size  = 0x%llx\n,
+   (unsigned long long)lmb.memory.size);
for (i=0; i  lmb.memory.cnt ;i++) {
-   DBG(memory.region[0x%x].base   = 0x%lx\n,
-   i, lmb.memory.region[i].base);
-   DBG( .size = 0x%lx\n,
-   lmb.memory.region[i].size);
+   DBG(memory.region[0x%x].base   = 0x%llx\n,
+   i, (unsigned long long)lmb.memory.region[i].base);
+   DBG( .size = 0x%llx\n,
+   (unsigned long long)lmb.memory.region[i].size);
}
 
DBG(\nreserved.cnt   = 0x%lx\n, lmb.reserved.cnt);
DBG(reserved.size= 0x%lx\n, lmb.reserved.size);
for (i=0; i  lmb.reserved.cnt ;i++) {
-   DBG(reserved.region[0x%x].base   = 0x%lx\n,
-   i, lmb.reserved.region[i].base);
-   DBG( .size = 0x%lx\n,
-   lmb.reserved.region[i].size);
+   DBG(reserved.region[0x%x].base   = 0x%llx\n,
+   i, (unsigned long long)lmb.reserved.region[i].base);
+   DBG( .size = 0x%llx\n,
+   (unsigned long long)lmb.reserved.region[i].size);
}
 #endif /* DEBUG */
 }
 
-static unsigned long __init lmb_addrs_overlap(unsigned long base1,
-   unsigned long size1, unsigned long base2, unsigned long size2)
+static unsigned long __init lmb_addrs_overlap(phys_addr_t base1,
+   phys_addr_t size1, phys_addr_t base2, phys_addr_t size2)
 {
return ((base1  (base2+size2))  (base2  (base1+size1)));
 }
 
-static long __init lmb_addrs_adjacent(unsigned long base1, unsigned long size1,
-   unsigned long base2, unsigned long size2)
+static long __init lmb_addrs_adjacent(phys_addr_t base1, phys_addr_t size1,
+   phys_addr_t base2, phys_addr_t size2)
 {
if (base2 == base1 + size1)
return 1;
@@ -80,10 +81,10 @@ static long __init lmb_addrs_adjacent(unsigned long base1, 
unsigned long size1,
 static long __init lmb_regions_adjacent(struct lmb_region *rgn,
unsigned long r1, unsigned long r2)
 {
-   unsigned long base1 = rgn-region[r1].base;
-   unsigned long size1 = rgn-region[r1].size;
-   unsigned long base2 = rgn-region[r2].base;
-   unsigned long size2 = rgn-region[r2].size;
+   phys_addr_t base1 = rgn-region[r1].base;
+   phys_addr_t size1 = rgn-region[r1].size;
+   phys_addr_t base2 = rgn-region[r2].base;
+   phys_addr_t size2 = rgn-region[r2].size;
 
return lmb_addrs_adjacent(base1, size1, base2, size2);
 }
@@ -135,16 +136,16 @@ void __init lmb_analyze(void)
 }
 
 /* This routine called with relocation disabled. */
-static long __init lmb_add_region(struct lmb_region *rgn, unsigned long base,
- unsigned long size)
+static long __init lmb_add_region(struct lmb_region *rgn, phys_addr_t base,
+ phys_addr_t size)
 {
unsigned long coalesced = 0;
long adjacent, i;
 
/* First try and coalesce this LMB with another. */
for (i=0; i  rgn-cnt; i++) {
-   unsigned long rgnbase = rgn-region[i].base;
-   unsigned long rgnsize = rgn-region[i].size;
+   phys_addr_t rgnbase = rgn-region[i].base;
+   phys_addr_t rgnsize = rgn-region[i].size;
 
if ((rgnbase == base)  (rgnsize == size))
/* Already have this region, so we're done */
@@ -191,7 +192,7 @@ static long __init lmb_add_region(struct lmb_region *rgn, 
unsigned long base,
 }
 
 /* This routine may be called with relocation disabled. */

Re: [RFC/PATCH] [POWERPC] Make lmb support large physical addressing

2008-02-13 Thread Benjamin Herrenschmidt

On Wed, 2008-02-13 at 16:43 -0600, Becky Bruce wrote:
 Convert the lmb code to use phys_addr_t instead of unsigned long for
 physical addresses and sizes.  This is needed to support large amounts
 of RAM on 32-bit systems that support 36-bit physical addressing.
 
 Built/booted on mpc8641; build tested on pasemi and 44x.
 
 Signed-off-by: Becky Bruce [EMAIL PROTECTED]
 ---
 Folks,
 
 This has been sitting in my tree for a few days, and now it looks like
 David M. has submitted a patch that changes the lmb code to be shared
 between sparc and powerpc.  Sparc has no notion of a phys_addr_t.
 Should we just use u64 everywhere in this code instead?  Thoughts?

An option would be to use resource_size_t, though it's a bit yucky...

Dave, what do you prefer ?

Ben.


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


Re: [RFC/PATCH] [POWERPC] Make lmb support large physical addressing

2008-02-13 Thread David Miller
From: Benjamin Herrenschmidt [EMAIL PROTECTED]
Date: Thu, 14 Feb 2008 09:50:42 +1100

 
 On Wed, 2008-02-13 at 16:43 -0600, Becky Bruce wrote:
  Convert the lmb code to use phys_addr_t instead of unsigned long for
  physical addresses and sizes.  This is needed to support large amounts
  of RAM on 32-bit systems that support 36-bit physical addressing.
  
  Built/booted on mpc8641; build tested on pasemi and 44x.
  
  Signed-off-by: Becky Bruce [EMAIL PROTECTED]
  ---
  Folks,
  
  This has been sitting in my tree for a few days, and now it looks like
  David M. has submitted a patch that changes the lmb code to be shared
  between sparc and powerpc.  Sparc has no notion of a phys_addr_t.
  Should we just use u64 everywhere in this code instead?  Thoughts?
 
 An option would be to use resource_size_t, though it's a bit yucky...
 
 Dave, what do you prefer ?

u64 is fine with me, either way we'll be casting the printk()
arguments all over the place so the choice really isn't
so important one way or the other as far as I can tell.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [Patch 0/2] powerpc: avoid userspace poking to legacy ioports

2008-02-13 Thread Arnd Bergmann
On Wednesday 13 February 2008, Benjamin Herrenschmidt wrote:
 On Wed, 2008-02-13 at 18:35 +0100, Christian Krafft wrote:
  sensors_detect crashes kernel on PowerPC, as it pokes directly to memory.
  This patch adds a check_legacy_ioports to read_port and write_port.
  It will now return ENXIO, instead of oopsing.
  
  Signed-off-by: Christian Krafft [EMAIL PROTECTED]
 
 The problem is that this prevents using /proc/ioports to access PCI
 IO space, which might be useful.
 
 I hate that sensors_detect.. or for that matter any other userland code
 that pokes random ports like that. It should die.

What kind of Oops do you get? Is it because the ioport area is not
ioremapped at all or do you get a machine check? If there is no
mapping, we could possibly change inb and outb do deal with that.

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


[PATCH 01/11] ide-pmac: remove dead code

2008-02-13 Thread Bartlomiej Zolnierkiewicz
Remove unused pmac_ide_{check_base,get_irq}() and pmac_find_ide_boot(),
then remove no longer needed ide_majors[] and pmac_ide_count.

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ppc/pmac.c |   47 ---
 1 file changed, 47 deletions(-)

Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -80,7 +80,6 @@ typedef struct pmac_ide_hwif {
 } pmac_ide_hwif_t;
 
 static pmac_ide_hwif_t pmac_ide[MAX_HWIFS];
-static int pmac_ide_count;
 
 enum {
controller_ohare,   /* OHare based */
@@ -893,52 +892,6 @@ pmac_ide_get_base(int index)
return pmac_ide[index].regbase;
 }
 
-int
-pmac_ide_check_base(unsigned long base)
-{
-   int ix;
-   
-   for (ix = 0; ix  MAX_HWIFS; ++ix)
-   if (base == pmac_ide[ix].regbase)
-   return ix;
-   return -1;
-}
-
-int
-pmac_ide_get_irq(unsigned long base)
-{
-   int ix;
-
-   for (ix = 0; ix  MAX_HWIFS; ++ix)
-   if (base == pmac_ide[ix].regbase)
-   return pmac_ide[ix].irq;
-   return 0;
-}
-
-static int ide_majors[] = { 3, 22, 33, 34, 56, 57 };
-
-dev_t __init
-pmac_find_ide_boot(char *bootdevice, int n)
-{
-   int i;
-   
-   /*
-* Look through the list of IDE interfaces for this one.
-*/
-   for (i = 0; i  pmac_ide_count; ++i) {
-   char *name;
-   if (!pmac_ide[i].node || !pmac_ide[i].node-full_name)
-   continue;
-   name = pmac_ide[i].node-full_name;
-   if (memcmp(name, bootdevice, n) == 0  name[n] == 0) {
-   /* XXX should cope with the 2nd drive as well... */
-   return MKDEV(ide_majors[i], 0);
-   }
-   }
-
-   return 0;
-}
-
 /* Suspend call back, should be called after the child devices
  * have actually been suspended
  */
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 03/11] ppc/ppc4xx: remove ppc_ide_md hooks

2008-02-13 Thread Bartlomiej Zolnierkiewicz
There are no default IDE ports on PPC4xx so ppc4xx_ide_init_hwif_ports() is
unnecessary, remove it.  Also remove no longer needed linux/ide.h include.

There should be no functional changes caused by this patch.

Cc: Josh Boyer [EMAIL PROTECTED]
Cc: Matt Porter [EMAIL PROTECTED]
Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 arch/ppc/syslib/ppc4xx_setup.c |   23 ---
 1 file changed, 23 deletions(-)

Index: b/arch/ppc/syslib/ppc4xx_setup.c
===
--- a/arch/ppc/syslib/ppc4xx_setup.c
+++ b/arch/ppc/syslib/ppc4xx_setup.c
@@ -24,7 +24,6 @@
 #include linux/pci.h
 #include linux/rtc.h
 #include linux/console.h
-#include linux/ide.h
 #include linux/serial_reg.h
 #include linux/seq_file.h
 
@@ -189,24 +188,6 @@ ppc4xx_calibrate_decr(void)
mtspr(SPRN_PIT, tb_ticks_per_jiffy);
 }
 
-/*
- * IDE stuff.
- * should be generic for every IDE PCI chipset
- */
-#if defined(CONFIG_PCI)  defined(CONFIG_IDE)
-static void
-ppc4xx_ide_init_hwif_ports(hw_regs_t * hw, unsigned long data_port,
-  unsigned long ctrl_port, int *irq)
-{
-   int i;
-
-   for (i = IDE_DATA_OFFSET; i = IDE_STATUS_OFFSET; ++i)
-   hw-io_ports[i] = data_port + i - IDE_DATA_OFFSET;
-
-   hw-io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-}
-#endif /* defined(CONFIG_PCI)  defined(CONFIG_IDE) */
-
 TODC_ALLOC();
 
 /*
@@ -271,10 +252,6 @@ ppc4xx_init(unsigned long r3, unsigned l
 #ifdef CONFIG_SERIAL_TEXT_DEBUG
ppc_md.progress = gen550_progress;
 #endif
-
-#if defined(CONFIG_PCI)  defined(CONFIG_IDE)
-   ppc_ide_md.ide_init_hwif = ppc4xx_ide_init_hwif_ports;
-#endif /* defined(CONFIG_PCI)  defined(CONFIG_IDE) */
 }
 
 /* Called from machine_check_exception */
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 04/11] ppc/pmac: remove ppc_ide_md hooks

2008-02-13 Thread Bartlomiej Zolnierkiewicz
* Add pmac_ide_init_ports() helper and use it instead of
  pmac_ide_init_hwif_ports().

* Remove ppc_ide_md hooks - no need for them
  (IDE pmac host driver takes care of all this setup).

* Then remove no longer needed linux/ide.h include
  from arch/powerpc/platforms/powermac/pmac.h.

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 arch/powerpc/platforms/powermac/pmac.h  |5 ---
 arch/powerpc/platforms/powermac/setup.c |8 -
 drivers/ide/ppc/pmac.c  |   50 +++-
 3 files changed, 11 insertions(+), 52 deletions(-)

Index: b/arch/powerpc/platforms/powermac/pmac.h
===
--- a/arch/powerpc/platforms/powermac/pmac.h
+++ b/arch/powerpc/platforms/powermac/pmac.h
@@ -2,7 +2,6 @@
 #define __PMAC_H__
 
 #include linux/pci.h
-#include linux/ide.h
 #include linux/irq.h
 
 /*
@@ -35,10 +34,6 @@ extern void pmac_check_ht_link(void);
 
 extern void pmac_setup_smp(void);
 
-extern unsigned long pmac_ide_get_base(int index);
-extern void pmac_ide_init_hwif_ports(hw_regs_t *hw,
-   unsigned long data_port, unsigned long ctrl_port, int *irq);
-
 extern int pmac_nvram_init(void);
 extern void pmac_pic_init(void);
 
Index: b/arch/powerpc/platforms/powermac/setup.c
===
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -574,14 +574,6 @@ static int __init pmac_probe(void)
ISA_DMA_THRESHOLD = ~0L;
DMA_MODE_READ = 1;
DMA_MODE_WRITE = 2;
-
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-#ifdef CONFIG_BLK_DEV_IDE_PMAC
-ppc_ide_md.ide_init_hwif   = pmac_ide_init_hwif_ports;
-ppc_ide_md.default_io_base = pmac_ide_get_base;
-#endif /* CONFIG_BLK_DEV_IDE_PMAC */
-#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
-
 #endif /* CONFIG_PPC32 */
 
 #ifdef CONFIG_PMAC_SMU
Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -418,37 +418,6 @@ static void pmac_ide_kauai_selectproc(id
 
 #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
 
-/*
- * N.B. this can't be an initfunc, because the media-bay task can
- * call ide_[un]register at any time.
- */
-void
-pmac_ide_init_hwif_ports(hw_regs_t *hw,
- unsigned long data_port, unsigned long ctrl_port,
- int *irq)
-{
-   int i, ix;
-
-   if (data_port == 0)
-   return;
-
-   for (ix = 0; ix  MAX_HWIFS; ++ix)
-   if (data_port == pmac_ide[ix].regbase)
-   break;
-
-   if (ix = MAX_HWIFS)
-   return; /* not an IDE PMAC interface */
-
-   for (i = 0; i  8; ++i)
-   hw-io_ports[i] = data_port + i * 0x10;
-   hw-io_ports[8] = data_port + 0x160;
-
-   if (irq != NULL)
-   *irq = pmac_ide[ix].irq;
-
-   hw-dev = pmac_ide[ix].mdev-ofdev.dev;
-}
-
 #define PMAC_IDE_REG(x) \
((void __iomem *)((drive)-hwif-io_ports[IDE_DATA_OFFSET] + (x)))
 
@@ -886,12 +855,6 @@ sanitize_timings(pmac_ide_hwif_t *pmif)
pmif-timings[2] = pmif-timings[3] = value2;
 }
 
-unsigned long
-pmac_ide_get_base(int index)
-{
-   return pmac_ide[index].regbase;
-}
-
 /* Suspend call back, should be called after the child devices
  * have actually been suspended
  */
@@ -1108,6 +1071,15 @@ pmac_ide_setup_device(pmac_ide_hwif_t *p
return 0;
 }
 
+static void __devinit pmac_ide_init_ports(hw_regs_t *hw, unsigned long base)
+{
+   int i;
+
+   for (i = 0; i  8; ++i)
+   hw-io_ports[i] = base + i * 0x10;
+   hw-io_ports[8] = base + 0x160;
+}
+
 /*
  * Attach to a macio probed interface
  */
@@ -1181,7 +1153,7 @@ pmac_ide_macio_attach(struct macio_dev *
dev_set_drvdata(mdev-ofdev.dev, hwif);
 
memset(hw, 0, sizeof(hw));
-   pmac_ide_init_hwif_ports(hw, pmif-regbase, 0, NULL);
+   pmac_ide_init_ports(hw, pmif-regbase);
hw.irq = irq;
hw.dev = mdev-ofdev.dev;
 
@@ -1295,7 +1267,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev
pci_set_drvdata(pdev, hwif);
 
memset(hw, 0, sizeof(hw));
-   pmac_ide_init_hwif_ports(hw, pmif-regbase, 0, NULL);
+   pmac_ide_init_ports(hw, pmif-regbase);
hw.irq = pdev-irq;
hw.dev = pdev-dev;
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 05/11] ppc/mpc8xx: remove ppc_ide_md hooks

2008-02-13 Thread Bartlomiej Zolnierkiewicz
* Initialize IDE ports in mpc8xx_ide_probe().

* Remove m8xx_ide_init() and ppc_ide_md hooks - no need for them
  (IDE mpc8xx host driver takes care of all this setup).

* Remove needless 'if (irq)' and 'if (data_port = MAX_HWIFS)' checks
  from m8xx_ide_init_hwif_ports().

* Remove 'ctrl_port' and 'irq' arguments from m8xx_ide_init_hwif_ports().

* Rename m8xx_ide_init_hwif_ports() to m8xx_ide_init_ports().

* Add __init tag to m8xx_ide_init_ports().

This patch fixes hwif-irq always being overriden to 0 (== auto-probe, is
this even working on PPC?) because of ide_init_default_irq() call in ide.c.

There should be no other functional changes.

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 arch/ppc/syslib/m8xx_setup.c |6 ---
 drivers/ide/ppc/mpc8xx.c |   86 +++
 2 files changed, 22 insertions(+), 70 deletions(-)

Index: b/arch/ppc/syslib/m8xx_setup.c
===
--- a/arch/ppc/syslib/m8xx_setup.c
+++ b/arch/ppc/syslib/m8xx_setup.c
@@ -87,8 +87,6 @@ void m8xx_calibrate_decr(void);
 
 unsigned char __res[sizeof(bd_t)];
 
-extern void m8xx_ide_init(void);
-
 extern unsigned long find_available_memory(void);
 extern void m8xx_cpm_reset(void);
 extern void m8xx_wdt_handler_install(bd_t *bp);
@@ -474,8 +472,4 @@ platform_init(unsigned long r3, unsigned
 
ppc_md.find_end_of_memory   = m8xx_find_end_of_memory;
ppc_md.setup_io_mappings= m8xx_map_io;
-
-#if defined(CONFIG_BLK_DEV_MPC8xx_IDE)
-   m8xx_ide_init();
-#endif
 }
Index: b/drivers/ide/ppc/mpc8xx.c
===
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -99,32 +99,6 @@ static int _slot_ = -1;  /* will be rea
 /* Make clock cycles and always round up */
 #define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/100) + 999U ) / 1000U )
 
-
-
-/*
- * IDE stuff.
- */
-static int
-m8xx_ide_default_irq(unsigned long base)
-{
-#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
-   if (base = MAX_HWIFS)
-   return 0;
-
-   printk([%d] m8xx_ide_default_irq %d\n,__LINE__,ioport_dsc[base].irq);
-   
-   return (ioport_dsc[base].irq);
-#else
-return 9;
-#endif
-}
-
-static unsigned long
-m8xx_ide_default_io_base(int index)
-{
-return index;
-}
-
 #define M8XX_PCMCIA_CD2(slot)  (0x1000  (slot  4))
 #define M8XX_PCMCIA_CD1(slot)  (0x0800  (slot  4))
 
@@ -149,12 +123,11 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL
  */
 
 /*
- * m8xx_ide_init_hwif_ports for a direct IDE interface _using_
+ * m8xx_ide_init_ports() for a direct IDE interface _using_
+ * MPC8xx's internal PCMCIA interface
  */
 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
-static void
-m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, 
-   unsigned long ctrl_port, int *irq)
+static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
 {
unsigned long *p = hw-io_ports;
int i;
@@ -173,8 +146,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
unsigned long base;
 
*p = 0;
-   if (irq)
-   *irq = 0;
 
pcmp = (pcmconf8xx_t *)immap_t *)IMAP_ADDR)-im_pcmcia));
 
@@ -248,9 +219,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
}
}
 
-   if (data_port = MAX_HWIFS)
-   return;
-
if (_slot_ == -1) {
printk (PCMCIA slot has not been defined! Using A as 
default\n);
_slot_ = 0;
@@ -292,11 +260,13 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
*p++ = base + ioport_dsc[data_port].reg_off[i];
}
 
-   if (irq) {
+   hw-irq = ioport_dsc[data_port].irq;
+   hw-ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
+
 #ifdef CONFIG_IDE_8xx_PCCARD
+   {
unsigned int reg;
 
-   *irq = ioport_dsc[data_port].irq;
if (_slot_)
pgcrx = ((immap_t *) IMAP_ADDR)-im_pcmcia.pcmc_pgcrb;
else
@@ -306,14 +276,11 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
reg |= mk_int_int_mask (pcmcia_schlvl)  24;
reg |= mk_int_int_mask (pcmcia_schlvl)  16;
*pgcrx = reg;
-#else  /* direct connected IDE drive, i.e. external IRQ, not the PCMCIA irq */
-   *irq = ioport_dsc[data_port].irq;
-#endif /* CONFIG_IDE_8xx_PCCARD */
}
+#endif /* CONFIG_IDE_8xx_PCCARD */
 
ide_hwifs[data_port].pio_mask = ATA_PIO4;
ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
-   ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
 
/* Enable Harddisk Interrupt,
 * and make it edge sensitive
@@ -329,16 +296,15 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, 
/* Enable falling edge irq */
pcmp-pcmc_per = 0x10  

[PATCH 09/11] ppc: remove ppc_ide_md

2008-02-13 Thread Bartlomiej Zolnierkiewicz
* Add special cases for pplus and prep to ide_default_{irq,io_base}()
  (+ FIXMEs about the need to use IDE platform host driver instead).

* Remove no longer needed ppc_ide_md and struct ide_machdep_calls.

* Then remove linux/ide.h include from:
  - arch/powerpc/kernel/setup_32.c
  - arch/ppc/kernel/ppc_ksyms.c
  - arch/ppc/kernel/setup.c
  - arch/ppc/platforms/pplus.c
  - arch/ppc/platforms/prep_setup.c

There should be no functional changes caused by this patch.

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 arch/powerpc/kernel/setup_32.c  |8 --
 arch/ppc/kernel/ppc_ksyms.c |5 
 arch/ppc/kernel/setup.c |2 -
 arch/ppc/platforms/pplus.c  |   35 -
 arch/ppc/platforms/prep_setup.c |   38 
 drivers/ide/ide.c   |4 ---
 include/asm-powerpc/ide.h   |   47 +++-
 7 files changed, 32 insertions(+), 107 deletions(-)

Index: b/arch/powerpc/kernel/setup_32.c
===
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -10,9 +10,6 @@
 #include linux/reboot.h
 #include linux/delay.h
 #include linux/initrd.h
-#if defined(CONFIG_IDE) || defined(CONFIG_IDE_MODULE)
-#include linux/ide.h
-#endif
 #include linux/tty.h
 #include linux/bootmem.h
 #include linux/seq_file.h
@@ -51,11 +48,6 @@
 
 extern void bootx_init(unsigned long r4, unsigned long phys);
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-struct ide_machdep_calls ppc_ide_md;
-EXPORT_SYMBOL(ppc_ide_md);
-#endif
-
 int boot_cpuid;
 EXPORT_SYMBOL_GPL(boot_cpuid);
 int boot_cpuid_phys;
Index: b/arch/ppc/kernel/ppc_ksyms.c
===
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -12,7 +12,6 @@
 #include linux/irq.h
 #include linux/pci.h
 #include linux/delay.h
-#include linux/ide.h
 #include linux/pm.h
 #include linux/bitops.h
 
@@ -124,10 +123,6 @@ EXPORT_SYMBOL(__ioremap);
 EXPORT_SYMBOL(iounmap);
 EXPORT_SYMBOL(ioremap_bot);/* aka VMALLOC_END */
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-EXPORT_SYMBOL(ppc_ide_md);
-#endif
-
 #ifdef CONFIG_PCI
 EXPORT_SYMBOL(isa_io_base);
 EXPORT_SYMBOL(isa_mem_base);
Index: b/arch/ppc/kernel/setup.c
===
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -10,7 +10,6 @@
 #include linux/reboot.h
 #include linux/delay.h
 #include linux/initrd.h
-#include linux/ide.h
 #include linux/screen_info.h
 #include linux/bootmem.h
 #include linux/seq_file.h
@@ -57,7 +56,6 @@ extern void ppc6xx_idle(void);
 extern void power4_idle(void);
 
 extern boot_infos_t *boot_infos;
-struct ide_machdep_calls ppc_ide_md;
 
 /* Used with the BI_MEMSIZE bootinfo parameter to store the memory
size value reported by the boot loader. */
Index: b/arch/ppc/platforms/pplus.c
===
--- a/arch/ppc/platforms/pplus.c
+++ b/arch/ppc/platforms/pplus.c
@@ -19,7 +19,6 @@
 #include linux/ioport.h
 #include linux/console.h
 #include linux/pci.h
-#include linux/ide.h
 #include linux/seq_file.h
 #include linux/root_dev.h
 
@@ -668,35 +667,6 @@ static void __init pplus_init_IRQ(void)
ppc_md.progress(init_irq: exit, 0);
 }
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-/*
- * IDE stuff.
- */
-static int pplus_ide_default_irq(unsigned long base)
-{
-   switch (base) {
-   case 0x1f0:
-   return 14;
-   case 0x170:
-   return 15;
-   default:
-   return 0;
-   }
-}
-
-static unsigned long pplus_ide_default_io_base(int index)
-{
-   switch (index) {
-   case 0:
-   return 0x1f0;
-   case 1:
-   return 0x170;
-   default:
-   return 0;
-   }
-}
-#endif
-
 #ifdef CONFIG_SMP
 /* PowerPlus (MTX) support */
 static int __init smp_pplus_probe(void)
@@ -862,11 +832,6 @@ platform_init(unsigned long r3, unsigned
ppc_md.find_end_of_memory = pplus_find_end_of_memory;
ppc_md.setup_io_mappings = pplus_map_io;
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-   ppc_ide_md.default_irq = pplus_ide_default_irq;
-   ppc_ide_md.default_io_base = pplus_ide_default_io_base;
-#endif
-
 #ifdef CONFIG_SERIAL_TEXT_DEBUG
ppc_md.progress = gen550_progress;
 #endif /* CONFIG_SERIAL_TEXT_DEBUG */
Index: b/arch/ppc/platforms/prep_setup.c
===
--- a/arch/ppc/platforms/prep_setup.c
+++ b/arch/ppc/platforms/prep_setup.c
@@ -33,7 +33,6 @@
 #include linux/console.h
 #include linux/timex.h
 #include linux/pci.h
-#include linux/ide.h
 #include 

[PATCH 10/11] ppc: don't include linux/ide.h

2008-02-13 Thread Bartlomiej Zolnierkiewicz
Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 arch/ppc/platforms/4xx/bamboo.c |1 -
 arch/ppc/platforms/4xx/ebony.c  |1 -
 arch/ppc/platforms/4xx/luan.c   |1 -
 arch/ppc/platforms/4xx/ocotea.c |1 -
 arch/ppc/platforms/4xx/taishan.c|1 -
 arch/ppc/platforms/4xx/yucca.c  |1 -
 arch/ppc/platforms/chestnut.c   |1 -
 arch/ppc/platforms/cpci690.c|1 -
 arch/ppc/platforms/ev64260.c|1 -
 arch/ppc/platforms/mvme5100.c   |1 -
 arch/ppc/platforms/powerpmc250.c|1 -
 arch/ppc/platforms/prpmc750.c   |1 -
 arch/ppc/platforms/prpmc800.c   |1 -
 arch/ppc/platforms/radstone_ppc7d.c |1 -
 arch/ppc/platforms/residual.c   |1 -
 arch/ppc/platforms/spruce.c |1 -
 16 files changed, 16 deletions(-)

Index: b/arch/ppc/platforms/4xx/bamboo.c
===
--- a/arch/ppc/platforms/4xx/bamboo.c
+++ b/arch/ppc/platforms/4xx/bamboo.c
@@ -22,7 +22,6 @@
 #include linux/blkdev.h
 #include linux/console.h
 #include linux/delay.h
-#include linux/ide.h
 #include linux/initrd.h
 #include linux/seq_file.h
 #include linux/root_dev.h
Index: b/arch/ppc/platforms/4xx/ebony.c
===
--- a/arch/ppc/platforms/4xx/ebony.c
+++ b/arch/ppc/platforms/4xx/ebony.c
@@ -25,7 +25,6 @@
 #include linux/blkdev.h
 #include linux/console.h
 #include linux/delay.h
-#include linux/ide.h
 #include linux/initrd.h
 #include linux/seq_file.h
 #include linux/root_dev.h
Index: b/arch/ppc/platforms/4xx/luan.c
===
--- a/arch/ppc/platforms/4xx/luan.c
+++ b/arch/ppc/platforms/4xx/luan.c
@@ -23,7 +23,6 @@
 #include linux/blkdev.h
 #include linux/console.h
 #include linux/delay.h
-#include linux/ide.h
 #include linux/initrd.h
 #include linux/seq_file.h
 #include linux/root_dev.h
Index: b/arch/ppc/platforms/4xx/ocotea.c
===
--- a/arch/ppc/platforms/4xx/ocotea.c
+++ b/arch/ppc/platforms/4xx/ocotea.c
@@ -23,7 +23,6 @@
 #include linux/blkdev.h
 #include linux/console.h
 #include linux/delay.h
-#include linux/ide.h
 #include linux/initrd.h
 #include linux/seq_file.h
 #include linux/root_dev.h
Index: b/arch/ppc/platforms/4xx/taishan.c
===
--- a/arch/ppc/platforms/4xx/taishan.c
+++ b/arch/ppc/platforms/4xx/taishan.c
@@ -23,7 +23,6 @@
 #include linux/blkdev.h
 #include linux/console.h
 #include linux/delay.h
-#include linux/ide.h
 #include linux/initrd.h
 #include linux/seq_file.h
 #include linux/root_dev.h
Index: b/arch/ppc/platforms/4xx/yucca.c
===
--- a/arch/ppc/platforms/4xx/yucca.c
+++ b/arch/ppc/platforms/4xx/yucca.c
@@ -24,7 +24,6 @@
 #include linux/blkdev.h
 #include linux/console.h
 #include linux/delay.h
-#include linux/ide.h
 #include linux/initrd.h
 #include linux/seq_file.h
 #include linux/root_dev.h
Index: b/arch/ppc/platforms/chestnut.c
===
--- a/arch/ppc/platforms/chestnut.c
+++ b/arch/ppc/platforms/chestnut.c
@@ -22,7 +22,6 @@
 #include linux/initrd.h
 #include linux/delay.h
 #include linux/seq_file.h
-#include linux/ide.h
 #include linux/serial.h
 #include linux/serial_core.h
 #include linux/serial_8250.h
Index: b/arch/ppc/platforms/cpci690.c
===
--- a/arch/ppc/platforms/cpci690.c
+++ b/arch/ppc/platforms/cpci690.c
@@ -10,7 +10,6 @@
  */
 #include linux/delay.h
 #include linux/pci.h
-#include linux/ide.h
 #include linux/irq.h
 #include linux/fs.h
 #include linux/seq_file.h
Index: b/arch/ppc/platforms/ev64260.c
===
--- a/arch/ppc/platforms/ev64260.c
+++ b/arch/ppc/platforms/ev64260.c
@@ -23,7 +23,6 @@
 
 #include linux/delay.h
 #include linux/pci.h
-#include linux/ide.h
 #include linux/irq.h
 #include linux/fs.h
 #include linux/seq_file.h
Index: b/arch/ppc/platforms/mvme5100.c
===
--- a/arch/ppc/platforms/mvme5100.c
+++ b/arch/ppc/platforms/mvme5100.c
@@ -17,7 +17,6 @@
 #include linux/initrd.h
 #include linux/console.h
 #include linux/delay.h
-#include linux/ide.h
 #include linux/seq_file.h
 #include linux/kdev_t.h
 #include linux/root_dev.h
Index: b/arch/ppc/platforms/powerpmc250.c
===
--- a/arch/ppc/platforms/powerpmc250.c
+++ b/arch/ppc/platforms/powerpmc250.c
@@ -25,7 +25,6 @@
 #include linux/delay.h
 #include linux/slab.h
 #include linux/seq_file.h
-#include linux/ide.h
 #include linux/root_dev.h
 
 #include asm/byteorder.h
Index: b/arch/ppc/platforms/prpmc750.c

[PATCH 11/11] ppc/pmac: remove no longer needed IDE quirk

2008-02-13 Thread Bartlomiej Zolnierkiewicz
IDE PMAC host driver and all IDE PCI host drivers use pci_enable_device()
nowadays so the following quirk in pmac_pcibios_after_init() can be removed.

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 arch/powerpc/platforms/powermac/pci.c |   22 --
 1 file changed, 22 deletions(-)

Index: b/arch/powerpc/platforms/powermac/pci.c
===
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1144,28 +1144,6 @@ void __init pmac_pcibios_after_init(void
 {
struct device_node* nd;
 
-#ifdef CONFIG_BLK_DEV_IDE
-   struct pci_dev *dev = NULL;
-
-   /* OF fails to initialize IDE controllers on macs
-* (and maybe other machines)
-*
-* Ideally, this should be moved to the IDE layer, but we need
-* to check specifically with Andre Hedrick how to do it cleanly
-* since the common IDE code seem to care about the fact that the
-* BIOS may have disabled a controller.
-*
-* -- BenH
-*/
-   for_each_pci_dev(dev) {
-   if ((dev-class  16) != PCI_BASE_CLASS_STORAGE)
-   continue;
-   if (pci_enable_device(dev))
-   printk(KERN_WARNING
-  pci: Failed to enable %s\n, pci_name(dev));
-   }
-#endif /* CONFIG_BLK_DEV_IDE */
-
for_each_node_by_name(nd, firewire) {
if (nd-parent  (of_device_is_compatible(nd, pci106b,18) ||
   of_device_is_compatible(nd, pci106b,30) ||
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/2] Add include of linux/of.h to numa.c

2008-02-13 Thread Michael Ellerman
numa.c requires routines in linux/of.h, so should include it.

Signed-off-by: Michael Ellerman [EMAIL PROTECTED]
---
 arch/powerpc/mm/numa.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index a300d25..67f6948 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -17,6 +17,7 @@
 #include linux/nodemask.h
 #include linux/cpu.h
 #include linux/notifier.h
+#include linux/of.h
 #include asm/sparsemem.h
 #include asm/lmb.h
 #include asm/system.h
-- 
1.5.2.rc1.1884.g59b20

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


[PATCH 2/2] Add include of linux/of.h to os-area.c

2008-02-13 Thread Michael Ellerman
os-area.c requires routines in linux/of.h, so should include it.

Signed-off-by: Michael Ellerman [EMAIL PROTECTED]
---
 arch/powerpc/platforms/ps3/os-area.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/ps3/os-area.c 
b/arch/powerpc/platforms/ps3/os-area.c
index b9ea09d..70d8052 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -24,6 +24,7 @@
 #include linux/fs.h
 #include linux/syscalls.h
 #include linux/ctype.h
+#include linux/of.h
 
 #include asm/lmb.h
 
-- 
1.5.2.rc1.1884.g59b20

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


Re: [PATCH 1/2] Add include of linux/of.h to numa.c

2008-02-13 Thread David Miller
From: Michael Ellerman [EMAIL PROTECTED]
Date: Thu, 14 Feb 2008 11:37:49 +1100 (EST)

 numa.c requires routines in linux/of.h, so should include it.
 
 Signed-off-by: Michael Ellerman [EMAIL PROTECTED]

Thanks for looking into these build failures Michael.

I actually just finished respinning the LMB tree, which
I'll post about next, and I dealt with this asm/prom.h
issue in what I believe should be a more fail-safe way
from the get-go.

Have a look when I post that, and let me know if the build is OK.

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


[PATCH 08/11] ppc/pplus: remove ppc_ide_md.ide_init_hwif hook

2008-02-13 Thread Bartlomiej Zolnierkiewicz
* Call ide_init_default_irq() for pplus in init_ide_data().

* Remove no longer needed pplus_ide_init_hwif_ports().

There should be no functional changes caused by this patch.

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 arch/ppc/platforms/pplus.c |   23 ---
 drivers/ide/ide.c  |2 +-
 2 files changed, 1 insertion(+), 24 deletions(-)

Index: b/arch/ppc/platforms/pplus.c
===
--- a/arch/ppc/platforms/pplus.c
+++ b/arch/ppc/platforms/pplus.c
@@ -695,28 +695,6 @@ static unsigned long pplus_ide_default_i
return 0;
}
 }
-
-static void __init
-pplus_ide_init_hwif_ports(hw_regs_t * hw, unsigned long data_port,
- unsigned long ctrl_port, int *irq)
-{
-   unsigned long reg = data_port;
-   int i;
-
-   for (i = IDE_DATA_OFFSET; i = IDE_STATUS_OFFSET; i++) {
-   hw-io_ports[i] = reg;
-   reg += 1;
-   }
-
-   if (ctrl_port)
-   hw-io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-   else
-   hw-io_ports[IDE_CONTROL_OFFSET] =
-   hw-io_ports[IDE_DATA_OFFSET] + 0x206;
-
-   if (irq != NULL)
-   *irq = pplus_ide_default_irq(data_port);
-}
 #endif
 
 #ifdef CONFIG_SMP
@@ -887,7 +865,6 @@ platform_init(unsigned long r3, unsigned
 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
ppc_ide_md.default_irq = pplus_ide_default_irq;
ppc_ide_md.default_io_base = pplus_ide_default_io_base;
-   ppc_ide_md.ide_init_hwif = pplus_ide_init_hwif_ports;
 #endif
 
 #ifdef CONFIG_SERIAL_TEXT_DEBUG
Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -214,7 +214,7 @@ static void __init init_ide_data (void)
memcpy(hwif-io_ports, hw.io_ports, sizeof(hw.io_ports));
 #endif
hwif-noprobe = !hwif-io_ports[IDE_DATA_OFFSET];
-#if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI)
+#if !defined(CONFIG_PPC32) || defined(CONFIG_PPLUS) || !defined(CONFIG_PCI)
hwif-irq =
ide_init_default_irq(hwif-io_ports[IDE_DATA_OFFSET]);
 #endif
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [POWERPC] Enable correct operation of serial ports with nonzero regshift.

2008-02-13 Thread Pavel Kiryukhin
Add regshift reading to serial drivers.
This enables correct operation of serial ports with nonzero regshift.

Signed-off-by: Pavel Kiryukhin [EMAIL PROTECTED]
---
 arch/powerpc/kernel/legacy_serial.c |6 +-
 drivers/serial/of_serial.c  |6 --
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/legacy_serial.c 
b/arch/powerpc/kernel/legacy_serial.c
index 61dd174..74bd1f3 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -50,7 +50,7 @@ static int __init add_legacy_port(struct device_node *np, int 
want_index,
  phys_addr_t taddr, unsigned long irq,
  upf_t flags, int irq_check_parent)
 {
-   const u32 *clk, *spd;
+   const u32 *clk, *spd, *regshift;
u32 clock = BASE_BAUD * 16;
int index;
 
@@ -62,6 +62,9 @@ static int __init add_legacy_port(struct device_node *np, int 
want_index,
/* get default speed if present */
spd = of_get_property(np, current-speed, NULL);
 
+   /* get regshift if present*/
+   regshift = get_property(np, reg-shift, NULL);
+
/* If we have a location index, then try to use it */
if (want_index = 0  want_index  MAX_LEGACY_SERIAL_PORTS)
index = want_index;
@@ -104,6 +107,7 @@ static int __init add_legacy_port(struct device_node *np, 
int want_index,
legacy_serial_ports[index].uartclk = clock;
legacy_serial_ports[index].irq = irq;
legacy_serial_ports[index].flags = flags;
+   legacy_serial_ports[index].regshift = regshift ? (u8)*regshift : 0;
legacy_serial_infos[index].taddr = taddr;
legacy_serial_infos[index].np = of_node_get(np);
legacy_serial_infos[index].clock = clock;
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index a64d858..ea9f1e4 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -30,7 +30,7 @@ static int __devinit of_platform_serial_setup(struct 
of_device *ofdev,
 {
struct resource resource;
struct device_node *np = ofdev-node;
-   const unsigned int *clk, *spd;
+   const unsigned int *clk, *spd, *regshift;
int ret;
 
memset(port, 0, sizeof *port);
@@ -40,7 +40,7 @@ static int __devinit of_platform_serial_setup(struct 
of_device *ofdev,
dev_warn(ofdev-dev, no clock-frequency property set\n);
return -ENODEV;
}
-
+   regshift = get_property(np, reg-shift, NULL);
ret = of_address_to_resource(np, 0, resource);
if (ret) {
dev_warn(ofdev-dev, invalid address\n);
@@ -57,6 +57,8 @@ static int __devinit of_platform_serial_setup(struct 
of_device *ofdev,
| UPF_FIXED_PORT;
port-dev = ofdev-dev;
port-custom_divisor = *clk / (16 * (*spd));
+   if (regshift)
+   port-regshift = *regshift;
 
return 0;
 }
-- 
1.5.4.1

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


[PATCH 1/4]: [LIB]: Make PowerPC LMB code generic so sparc64 can use it too.

2008-02-13 Thread David Miller

[LIB]: Make PowerPC LMB code generic so sparc64 can use it too.

Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 arch/powerpc/Kconfig|1 +
 arch/powerpc/kernel/btext.c |3 +-
 arch/powerpc/kernel/crash.c |3 +-
 arch/powerpc/kernel/crash_dump.c|3 +-
 arch/powerpc/kernel/machine_kexec.c |3 +-
 arch/powerpc/kernel/prom.c  |2 +-
 arch/powerpc/kernel/rtas.c  |2 +-
 arch/powerpc/kernel/setup-common.c  |2 +-
 arch/powerpc/kernel/setup_64.c  |2 +-
 arch/powerpc/kernel/vdso.c  |3 +-
 arch/powerpc/mm/Makefile|2 +-
 arch/powerpc/mm/hash_utils_64.c |3 +-
 arch/powerpc/mm/init_32.c   |2 +-
 arch/powerpc/mm/init_64.c   |2 +-
 arch/powerpc/mm/lmb.c   |  357 ---
 arch/powerpc/mm/mem.c   |2 +-
 arch/powerpc/mm/numa.c  |3 +-
 arch/powerpc/mm/ppc_mmu_32.c|2 +-
 arch/powerpc/mm/stab.c  |4 +-
 arch/powerpc/platforms/cell/iommu.c |2 +-
 arch/powerpc/platforms/maple/setup.c|2 +-
 arch/powerpc/platforms/powermac/setup.c |2 +-
 arch/powerpc/platforms/ps3/htab.c   |3 +-
 arch/powerpc/platforms/ps3/mm.c |3 +-
 arch/powerpc/platforms/ps3/os-area.c|3 +-
 arch/powerpc/sysdev/dart_iommu.c|2 +-
 arch/sparc64/Kconfig|1 +
 include/asm-powerpc/abs_addr.h  |3 +-
 include/asm-powerpc/lmb.h   |   82 +---
 include/asm-sparc64/lmb.h   |   10 +
 include/linux/lmb.h |   83 +++
 lib/Kconfig |3 +
 lib/Makefile|2 +
 lib/lmb.c   |  354 ++
 34 files changed, 500 insertions(+), 456 deletions(-)
 delete mode 100644 arch/powerpc/mm/lmb.c
 create mode 100644 include/asm-sparc64/lmb.h
 create mode 100644 include/linux/lmb.h
 create mode 100644 lib/lmb.c

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 485513c..bd645f0 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -90,6 +90,7 @@ config PPC
select HAVE_IDE
select HAVE_OPROFILE
select HAVE_KPROBES
+   select HAVE_LMB
 
 config EARLY_PRINTK
bool
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 80e2eef..9f93777 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -7,6 +7,7 @@
 #include linux/string.h
 #include linux/init.h
 #include linux/module.h
+#include linux/lmb.h
 
 #include asm/sections.h
 #include asm/prom.h
@@ -15,7 +16,7 @@
 #include asm/mmu.h
 #include asm/pgtable.h
 #include asm/io.h
-#include asm/lmb.h
+#include asm/prom.h
 #include asm/processor.h
 #include asm/udbg.h
 
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 571132e..eae401d 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -24,12 +24,13 @@
 #include linux/init.h
 #include linux/irq.h
 #include linux/types.h
+#include linux/lmb.h
 
 #include asm/processor.h
 #include asm/machdep.h
 #include asm/kexec.h
 #include asm/kdump.h
-#include asm/lmb.h
+#include asm/prom.h
 #include asm/firmware.h
 #include asm/smp.h
 #include asm/system.h
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 29ff77c..9ee3c52 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -13,8 +13,9 @@
 
 #include linux/crash_dump.h
 #include linux/bootmem.h
+#include linux/lmb.h
 #include asm/kdump.h
-#include asm/lmb.h
+#include asm/prom.h
 #include asm/firmware.h
 #include asm/uaccess.h
 
diff --git a/arch/powerpc/kernel/machine_kexec.c 
b/arch/powerpc/kernel/machine_kexec.c
index c0c8e8c..2d202f2 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -12,8 +12,9 @@
 #include linux/kexec.h
 #include linux/reboot.h
 #include linux/threads.h
+#include linux/lmb.h
 #include asm/machdep.h
-#include asm/lmb.h
+#include asm/prom.h
 
 void machine_crash_shutdown(struct pt_regs *regs)
 {
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 8b5efbc..c17a585 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -31,10 +31,10 @@
 #include linux/kexec.h
 #include linux/debugfs.h
 #include linux/irq.h
+#include linux/lmb.h
 
 #include asm/prom.h
 #include asm/rtas.h
-#include asm/lmb.h
 #include asm/page.h
 #include asm/processor.h
 #include asm/irq.h
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 52e95c2..e2e78d9 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -22,6 +22,7 @@
 #include linux/smp.h
 #include linux/completion.h
 #include linux/cpumask.h
+#include linux/lmb.h
 
 #include asm/prom.h
 #include asm/rtas.h

[PATCH 2/4]: [LMB]: Fix bug in __lmb_alloc_base().

2008-02-13 Thread David Miller

[LMB]: Fix bug in __lmb_alloc_base().

We need to check lmb_add_region() for errors, it can run out
of regions etc.

Also, the size needs to be padded to the given alignment
or else the lmb.reserved regions don't get expanded and
instead we get tons of holes and eventually run out of
regions prematurely.

Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 lib/lmb.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/lib/lmb.c b/lib/lmb.c
index 98078b4..6390d63 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -245,6 +245,11 @@ static unsigned long lmb_align_down(unsigned long addr, 
unsigned long size)
return addr  ~(size - 1);
 }
 
+static unsigned long lmb_align_up(unsigned long addr, unsigned long size)
+{
+   return (addr + (size - 1))  ~(size - 1);
+}
+
 unsigned long __init __lmb_alloc_base(unsigned long size, unsigned long align,
unsigned long max_addr)
 {
@@ -281,7 +286,8 @@ unsigned long __init __lmb_alloc_base(unsigned long size, 
unsigned long align,
if (i  0)
return 0;
 
-   lmb_add_region(lmb.reserved, base, size);
+   if (lmb_add_region(lmb.reserved, base, lmb_align_up(size, align))  0)
+   return 0;
 
return base;
 }
-- 
1.5.4.29.gb828fe

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


[PATCH 3/4]: [LMB]: Fix initial lmb add region with a non-zero base

2008-02-13 Thread David Miller

[LMB]: Fix initial lmb add region with a non-zero base

If we add to an empty lmb region with a non-zero base we will not
coalesce the number of regions down to one.  This causes problems on
ppc32 for the memory region as its assumed to only have one region.

We can fix this be easily specially casing the initial add to just
replace the dummy region.

Signed-off-by: Kumar Gala [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 lib/lmb.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/lmb.c b/lib/lmb.c
index 6390d63..e34a9e5 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -134,6 +134,12 @@ static long __init lmb_add_region(struct lmb_region *rgn, 
unsigned long base,
unsigned long coalesced = 0;
long adjacent, i;
 
+   if ((rgn-cnt == 1)  (rgn-region[0].size == 0)) {
+   rgn-region[0].base = base;
+   rgn-region[0].size = size;
+   return 0;
+   }
+
/* First try and coalesce this LMB with another. */
for (i=0; i  rgn-cnt; i++) {
unsigned long rgnbase = rgn-region[i].base;
-- 
1.5.4.29.gb828fe

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


[PATCH 4/4]: [LMB]: Make lmb support large physical addressing

2008-02-13 Thread David Miller

[LMB]: Make lmb support large physical addressing

Convert the lmb code to use u64 instead of unsigned long for physical
addresses and sizes.  This is needed to support large amounts of RAM
on 32-bit systems that support 36-bit physical addressing.

Signed-off-by: Becky Bruce [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/lmb.h |   38 ++--
 lib/lmb.c   |   93 +--
 2 files changed, 65 insertions(+), 66 deletions(-)

diff --git a/include/linux/lmb.h b/include/linux/lmb.h
index 8b93f63..632717c 100644
--- a/include/linux/lmb.h
+++ b/include/linux/lmb.h
@@ -19,19 +19,19 @@
 #define MAX_LMB_REGIONS 128
 
 struct lmb_property {
-   unsigned long base;
-   unsigned long size;
+   u64 base;
+   u64 size;
 };
 
 struct lmb_region {
unsigned long cnt;
-   unsigned long size;
+   u64 size;
struct lmb_property region[MAX_LMB_REGIONS+1];
 };
 
 struct lmb {
unsigned long debug;
-   unsigned long rmo_size;
+   u64 rmo_size;
struct lmb_region memory;
struct lmb_region reserved;
 };
@@ -40,36 +40,36 @@ extern struct lmb lmb;
 
 extern void __init lmb_init(void);
 extern void __init lmb_analyze(void);
-extern long __init lmb_add(unsigned long base, unsigned long size);
-extern long __init lmb_reserve(unsigned long base, unsigned long size);
-extern unsigned long __init lmb_alloc(unsigned long size, unsigned long align);
-extern unsigned long __init lmb_alloc_base(unsigned long size,
-   unsigned long align, unsigned long max_addr);
-extern unsigned long __init __lmb_alloc_base(unsigned long size,
-   unsigned long align, unsigned long max_addr);
-extern unsigned long __init lmb_phys_mem_size(void);
-extern unsigned long __init lmb_end_of_DRAM(void);
-extern void __init lmb_enforce_memory_limit(unsigned long memory_limit);
-extern int __init lmb_is_reserved(unsigned long addr);
+extern long __init lmb_add(u64 base, u64 size);
+extern long __init lmb_reserve(u64 base, u64 size);
+extern u64 __init lmb_alloc(u64 size, u64 align);
+extern u64 __init lmb_alloc_base(u64 size,
+   u64, u64 max_addr);
+extern u64 __init __lmb_alloc_base(u64 size,
+   u64 align, u64 max_addr);
+extern u64 __init lmb_phys_mem_size(void);
+extern u64 __init lmb_end_of_DRAM(void);
+extern void __init lmb_enforce_memory_limit(u64 memory_limit);
+extern int __init lmb_is_reserved(u64 addr);
 
 extern void lmb_dump_all(void);
 
-static inline unsigned long
+static inline u64
 lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
 {
return type-region[region_nr].size;
 }
-static inline unsigned long
+static inline u64
 lmb_size_pages(struct lmb_region *type, unsigned long region_nr)
 {
return lmb_size_bytes(type, region_nr)  PAGE_SHIFT;
 }
-static inline unsigned long
+static inline u64
 lmb_start_pfn(struct lmb_region *type, unsigned long region_nr)
 {
return type-region[region_nr].base  PAGE_SHIFT;
 }
-static inline unsigned long
+static inline u64
 lmb_end_pfn(struct lmb_region *type, unsigned long region_nr)
 {
return lmb_start_pfn(type, region_nr) +
diff --git a/lib/lmb.c b/lib/lmb.c
index e34a9e5..e3c8dcb 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -34,33 +34,34 @@ void lmb_dump_all(void)
 
DBG(lmb_dump_all:\n);
DBG(memory.cnt   = 0x%lx\n, lmb.memory.cnt);
-   DBG(memory.size  = 0x%lx\n, lmb.memory.size);
+   DBG(memory.size  = 0x%llx\n,
+   (unsigned long long)lmb.memory.size);
for (i=0; i  lmb.memory.cnt ;i++) {
-   DBG(memory.region[0x%x].base   = 0x%lx\n,
-   i, lmb.memory.region[i].base);
-   DBG( .size = 0x%lx\n,
-   lmb.memory.region[i].size);
+   DBG(memory.region[0x%x].base   = 0x%llx\n,
+   i, (unsigned long long)lmb.memory.region[i].base);
+   DBG( .size = 0x%llx\n,
+   (unsigned long long)lmb.memory.region[i].size);
}
 
DBG(\nreserved.cnt   = 0x%lx\n, lmb.reserved.cnt);
DBG(reserved.size= 0x%lx\n, lmb.reserved.size);
for (i=0; i  lmb.reserved.cnt ;i++) {
-   DBG(reserved.region[0x%x].base   = 0x%lx\n,
-   i, lmb.reserved.region[i].base);
-   DBG( .size = 0x%lx\n,
-   lmb.reserved.region[i].size);
+   DBG(reserved.region[0x%x].base   = 0x%llx\n,
+   i, (unsigned long long)lmb.reserved.region[i].base);
+   DBG( .size = 0x%llx\n,
+   (unsigned long long)lmb.reserved.region[i].size);
}
 #endif /* DEBUG */
 }
 
-static unsigned long __init lmb_addrs_overlap(unsigned long 

[PATCH 0/4]: Respun LMB patches.

2008-02-13 Thread David Miller

I've taken into consideration the various feedback, and
ported the bug fix and other LMB patches posted recently
in an effort to keep the patch churn by others down wrt.
my moving of these files.

1) Use HAVE_LMB as suggested by Sam.

2) Fix potential build errors wrt. asm/prom.h dependencies.

   My algorithm was:

   a) If the file only included asm/lmb.h I added an include
  of both linux/lmb.c and asm/prom.h

   b) If the file already includes asm/prom.h, I merely
  changed the asm/lmb.h to linux/lmb.h

   Header include mimimizations can be done as followon patches.

3) Integrate Kumar Gala's initial region fix.

4) Integrate Becky Bruce's large physical addressing change,
   but using u64 instead of phys_addr_t.

It's all at:

master.kernel.org:/pub/scm/linux/kernel/git/davem/lmb-2.6.git

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


[PATCH 1/1] Cell RAS: Remove DEBUG, and add license and copyright

2008-02-13 Thread Michael Ellerman
arch/powerpc/platforms/cell/ras.c still has DEBUG #defined, which is no
longer neccessary. Disable it, this disables to pr_debugs().

While we're there this file should have a copyright notice and license,
so add both.

Signed-off-by: Michael Ellerman [EMAIL PROTECTED]
---
 arch/powerpc/platforms/cell/ras.c |   11 ++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/cell/ras.c 
b/arch/powerpc/platforms/cell/ras.c
index b2494eb..e43024c 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -1,4 +1,13 @@
-#define DEBUG
+/*
+ * Copyright 2006-2008, 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.
+ */
+
+#undef DEBUG
 
 #include linux/types.h
 #include linux/kernel.h
-- 
1.5.2.rc1.1884.g59b20

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


Re: /proc/bus/pci and domains

2008-02-13 Thread Greg KH
On Wed, Feb 13, 2008 at 04:53:55PM +0100, Martin Mares wrote:
 Hi Greg et al.,
 
 I have noticed that lspci with the proc back-end does not work properly
 on ppc64. The problem turned out to be a strange hack in drivers/pci/proc.c
 causing the following behavior on machines with multiple PCI domains:
 The directory names under /proc/bus/pci/ have a domain number added (which
 is not backward compatible, but at least consistent), but on the other hand
 /proc/bus/pci/devices contains bus numbers without the domains, happily
 making multiple entries with the same bus and device number.
 
 Is there any serious reason for this behavior?

I have no idea, it sounds like a PPC specific thing, not anything the
PCI core does, right?  So I'll add the ppc list to the cc: and ask if
anyone there has any ideas?

Rest of the original email follows...

 
 The original /proc/bus/pci/ (as I have designed it years ago) does not
 have any means of carrying the domain numbers, so it cannot be solved
 in a backward-compatible way, but the inconsistency between the list of
 devices and the actual directories leaves me puzzled.
 
 Wouldn't it be better to make the same backward-incompatible change
 in /proc/bus/pci/devices, so that at least new programs can use the
 thing?
 
 Of course, all this is of minor importance as all new programs know
 how to use the sysfs anyway (I have found the problem only because
 I forgot to mount sysfs to a chroot), but if we want to keep /proc/bus/pci/,
 we should fix it.
 
   Have a nice fortnight
 -- 
 Martin `MJ' Mares  [EMAIL PROTECTED]   
 http://mj.ucw.cz/
 Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
 Entropy isn't what it used to be.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


libfdt: Fix NOP handling bug in fdt_add_subnode_namelen()

2008-02-13 Thread David Gibson
fdt_add_subnode_namelen() has a bug if asked to add a subnode to a
node which has NOP tags interspersed with its properties.  In this
case fdt_add_subnode_namelen() will put the new subnode before the
first NOP tag, even if there are properties after it, which will
result in an invalid blob.

This patch fixes the bug, and adds a testcase for it.

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

Index: dtc/tests/Makefile.tests
===
--- dtc.orig/tests/Makefile.tests   2008-02-14 15:10:35.0 +1100
+++ dtc/tests/Makefile.tests2008-02-14 15:10:43.0 +1100
@@ -10,7 +10,8 @@
move_and_save mangle-layout \
open_pack rw_tree1 set_name setprop del_property del_node \
string_escapes references path-references \
-   dtbs_equal_ordered
+   dtbs_equal_ordered \
+   add_subnode_with_nops
 LIB_TESTS = $(LIB_TESTS_L:%=$(TESTS_PREFIX)%)
 
 LIBTREE_TESTS_L = truncated_property
Index: dtc/tests/add_subnode_with_nops.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ dtc/tests/add_subnode_with_nops.c   2008-02-14 15:12:45.0 +1100
@@ -0,0 +1,85 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Testcase for fdt_nop_node()
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include stdlib.h
+#include stdio.h
+#include string.h
+#include ctype.h
+#include stdint.h
+
+#include fdt.h
+#include libfdt.h
+
+#include tests.h
+#include testdata.h
+
+#define SPACE  65536
+
+#define CHECK(code) \
+   { \
+   err = (code); \
+   if (err) \
+   FAIL(#code : %s, fdt_strerror(err)); \
+   }
+
+#define OFF_CHECK(off, code) \
+   { \
+   (off) = (code); \
+   if (off  0) \
+   FAIL(#code : %s, fdt_strerror(off)); \
+   }
+
+int main(int argc, char *argv[])
+{
+   void *fdt;
+   int err;
+   int offset;
+
+   test_init(argc, argv);
+
+   fdt = xmalloc(SPACE);
+
+   CHECK(fdt_create(fdt, SPACE));
+
+   CHECK(fdt_finish_reservemap(fdt));
+   CHECK(fdt_begin_node(fdt, ));
+   CHECK(fdt_property_cell(fdt, prop1, TEST_VALUE_1));
+   CHECK(fdt_property_cell(fdt, prop2, TEST_VALUE_2));
+   CHECK(fdt_end_node(fdt));
+   CHECK(fdt_finish(fdt));
+
+   verbose_printf(Built empty tree, totalsize = %d\n,
+  fdt_totalsize(fdt));
+
+   CHECK(fdt_open_into(fdt, fdt, SPACE));
+
+   check_getprop_cell(fdt, 0, prop1, TEST_VALUE_1);
+   check_getprop_cell(fdt, 0, prop2, TEST_VALUE_2);
+
+   CHECK(fdt_nop_property(fdt, 0, prop1));
+
+   check_getprop_cell(fdt, 0, prop2, TEST_VALUE_2);
+
+   OFF_CHECK(offset, fdt_add_subnode(fdt, 0, subnode));
+
+   check_getprop_cell(fdt, 0, prop2, TEST_VALUE_2);
+
+   PASS();
+}
Index: dtc/tests/run_tests.sh
===
--- dtc.orig/tests/run_tests.sh 2008-02-14 15:11:10.0 +1100
+++ dtc/tests/run_tests.sh  2008-02-14 15:11:25.0 +1100
@@ -128,6 +128,9 @@
 
 # Tests for behaviour on various sorts of corrupted trees
 run_test truncated_property
+
+# Specific bug tests
+run_test add_subnode_with_nops
 }
 
 dtc_tests () {
Index: dtc/libfdt/fdt_rw.c
===
--- dtc.orig/libfdt/fdt_rw.c2008-02-14 15:15:29.0 +1100
+++ dtc/libfdt/fdt_rw.c 2008-02-14 15:15:40.0 +1100
@@ -333,7 +333,7 @@
do {
offset = nextoffset;
tag = fdt_next_tag(fdt, offset, nextoffset);
-   } while (tag == FDT_PROP);
+   } while ((tag == FDT_PROP) || (tag == FDT_NOP));
 
nh = _fdt_offset_ptr_w(fdt, offset);
nodelen = sizeof(*nh) + ALIGN(namelen+1, FDT_TAGSIZE) + FDT_TAGSIZE;

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

Re: [PATCH] [POWERPC] Enable correct operation of serial ports with nonzero regshift.

2008-02-13 Thread Kumar Gala

On Feb 13, 2008, at 3:19 PM, Pavel Kiryukhin wrote:

 Add regshift reading to serial drivers.
 This enables correct operation of serial ports with nonzero regshift.

what device needs this?

- k

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


Re: [PATCH 2/8] pseries: phyp dump: reserve-release proof-of-concept

2008-02-13 Thread Tony Breeds
On Tue, Feb 12, 2008 at 01:08:25AM -0600, Manish Ahuja wrote:
 
 Initial patch for reserving memory in early boot, and freeing it later.
 If the previous boot had ended with a crash, the reserved memory would contain
 a copy of the crashed kernel data.
 
 Signed-off-by: Manish Ahuja [EMAIL PROTECTED]
 Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
 
 
  arch/powerpc/kernel/prom.c |   50 
  arch/powerpc/kernel/rtas.c |   32 +
  arch/powerpc/platforms/pseries/Makefile|1 
  arch/powerpc/platforms/pseries/phyp_dump.c |   71 
 +
  include/asm-powerpc/phyp_dump.h|   38 +++
  include/asm/rtas.h |3 +
  6 files changed, 195 insertions(+)
 
 Index: 2.6.24-rc5/include/asm-powerpc/phyp_dump.h
 ===
 --- /dev/null 1970-01-01 00:00:00.0 +
 +++ 2.6.24-rc5/include/asm-powerpc/phyp_dump.h2008-02-12 
 06:12:37.0 -0600
 @@ -0,0 +1,38 @@
 +/*
 + * Hypervisor-assisted dump
 + *
 + * Linas Vepstas, Manish Ahuja 2007
 + * Copyright (c) 2007 IBM Corp.

Hi Manish,
Sorry for the minor nits but this should be:

---
 * Linas Vepstas, Manish Ahuja 2008
 * Copyright 2008 IBM Corp.
---

You can optionally use the '©' symbol after word 'Copyright' but you
shouldn't use '(c)' anymore.

Also in at least one place you've misspelt Copyright

Yours Tony

  linux.conf.auhttp://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!

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

[PATCH] remove unused CONFIG_WANT_DEVICE_TREE

2008-02-13 Thread Grant Likely
From: Grant Likely [EMAIL PROTECTED]

CONFIG_DEVICE_TREE was the only user of CONFIG_WANT_DEVICE_TREE but
it was removed in commit id 25431333813686654907ab987fb5de10c10a16db
(bootwrapper: Build multiple cuImages).

This patch removes CONFIG_WANT_DEVICE_TREE from Kconfig and the defconfigs

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

Paul, this patch cleans up after a commit the multiple cuImage patch that
went in during the merge window.  It should probably be merged for .25

Thanks,
g.

 arch/powerpc/Kconfig   |4 
 arch/powerpc/platforms/512x/Kconfig|1 -
 arch/powerpc/platforms/52xx/Kconfig|2 --
 arch/powerpc/platforms/Kconfig |2 --
 arch/powerpc/platforms/Kconfig.cputype |4 
 arch/powerpc/platforms/embedded6xx/Kconfig |4 
 6 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 8dcac0b..53b0940 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -435,10 +435,6 @@ config SECCOMP
 
  If unsure, say Y. Only embedded should say N here.
 
-config WANT_DEVICE_TREE
-   bool
-   default n
-
 endmenu
 
 config ISA_DMA_API
diff --git a/arch/powerpc/platforms/512x/Kconfig 
b/arch/powerpc/platforms/512x/Kconfig
index c6fa49e..4c0da0c 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -13,7 +13,6 @@ config MPC5121_ADS
bool Freescale MPC5121E ADS
depends on PPC_MULTIPLATFORM  PPC32
select DEFAULT_UIMAGE
-   select WANT_DEVICE_TREE
select PPC_MPC5121
help
  This option enables support for the MPC5121E ADS board.
diff --git a/arch/powerpc/platforms/52xx/Kconfig 
b/arch/powerpc/platforms/52xx/Kconfig
index 515f244..cf945d5 100644
--- a/arch/powerpc/platforms/52xx/Kconfig
+++ b/arch/powerpc/platforms/52xx/Kconfig
@@ -8,7 +8,6 @@ config PPC_MPC5200_SIMPLE
bool Generic support for simple MPC5200 based boards
depends on PPC_MPC52xx
select DEFAULT_UIMAGE
-   select WANT_DEVICE_TREE
help
  This option enables support for a simple MPC52xx based boards which
  do not need a custom platform specific setup. Such boards are
@@ -35,7 +34,6 @@ config PPC_LITE5200
bool Freescale Lite5200 Eval Board
depends on PPC_MPC52xx
select DEFAULT_UIMAGE
-   select WANT_DEVICE_TREE
 
 config PPC_MPC5200_BUGFIX
bool MPC5200 (L25R) bugfix support
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index fcedbec..0afd225 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -15,7 +15,6 @@ config PPC_MULTIPLATFORM
 config PPC_82xx
bool Freescale 82xx
depends on 6xx
-   select WANT_DEVICE_TREE
 
 config PPC_83xx
bool Freescale 83xx
@@ -23,7 +22,6 @@ config PPC_83xx
select FSL_SOC
select MPC83xx
select IPIC
-   select WANT_DEVICE_TREE
select FSL_EMB_PERFMON
 
 config PPC_86xx
diff --git a/arch/powerpc/platforms/Kconfig.cputype 
b/arch/powerpc/platforms/Kconfig.cputype
index 69941ba..73d81ce 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -29,26 +29,22 @@ config PPC_85xx
bool Freescale 85xx
select E500
select FSL_SOC
-   select WANT_DEVICE_TREE
select MPC85xx
 
 config PPC_8xx
bool Freescale 8xx
select FSL_SOC
select 8xx
-   select WANT_DEVICE_TREE
select PPC_LIB_RHEAP
 
 config 40x
bool AMCC 40x
select PPC_DCR_NATIVE
-   select WANT_DEVICE_TREE
select PPC_UDBG_16550
 
 config 44x
bool AMCC 44x
select PPC_DCR_NATIVE
-   select WANT_DEVICE_TREE
select PPC_UDBG_16550
 
 config E200
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig 
b/arch/powerpc/platforms/embedded6xx/Kconfig
index 6c80837..4290889 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -24,7 +24,6 @@ config STORCENTER
select MPIC
select FSL_SOC
select PPC_UDBG_16550 if SERIAL_8250
-   select WANT_DEVICE_TREE
select MPC10X_OPENPIC
select MPC10X_BRIDGE
help
@@ -37,7 +36,6 @@ config MPC7448HPC2
select TSI108_BRIDGE
select DEFAULT_UIMAGE
select PPC_UDBG_16550
-   select WANT_DEVICE_TREE
select TSI108_BRIDGE
help
  Select MPC7448HPC2 if configuring for Freescale MPC7448HPC2 (Taiga)
@@ -48,7 +46,6 @@ config PPC_HOLLY
depends on EMBEDDED6xx
select TSI108_BRIDGE
select PPC_UDBG_16550
-   select WANT_DEVICE_TREE
select TSI108_BRIDGE
help
  Select PPC_HOLLY if configuring for an IBM 750GX/CL Eval
@@ -59,7 +56,6 @@ config PPC_PRPMC2800
depends on EMBEDDED6xx
select MV64X60
select NOT_COHERENT_CACHE
-   select