linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* small cleanup
@ 2001-10-31  1:44 Roman Zippel
  2001-10-31  2:08 ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Roman Zippel @ 2001-10-31  1:44 UTC (permalink / raw)
  To: linuxppc-dev


Hi,

Below is a patch from the APUS tree (more to follow :) ). It does some
small cleanups and one important change to get APUS working:
- introducing PPC_MEMSTART/PPC_MEMOFFSET, for non-APUS machines these are
constants otherwise variables. I added with this support for memory
starting != 0.
- ram_phys_base became ppc_memstart
- removed end_of_DRAM, it's equivalent to high_memory
- pcibios_make_OF_bus_map depends on CONFIG_ALL_PPC
- removed duplicate definition of isa_io_base/isa_mem_base/pci_dram_offset
(note: these variables are protected with CONFIG_PCI in ppc_ksyms.c, but
not in the include files, so there are unconditional now)
- removed nested __KERNEL__ ifdefs in io.h, one even outside of the
recursive protection (bad style).

The last two changes don't apply cleanly to 2_4_devel, but it needs a
similiar change.

bye, Roman


--- arch/ppc/kernel/apus_setup.c	2001/10/25 19:30:42	1.1.1.14
+++ arch/ppc/kernel/apus_setup.c	2001/10/29 23:09:38	1.26
@@ -991,6 +960,8 @@
 		memory[0].size = ((size+0x001fffff) & 0xffe00000);
 	}

+	ppc_memstart = memory[0].addr;
+	ppc_memoffset = PAGE_OFFSET - PPC_MEMSTART;
 	total = memory[0].size;

 	/* Remove the memory chunks that are controlled by special
@@ -1011,7 +982,6 @@
 	   the PowerUP board. Other system memory is horrible slow in
 	   comparison. The user can use other memory for swapping
 	   using the z2ram device. */
-	ram_phys_base = memory[0].addr;
 	return total;
 }

--- arch/ppc/kernel/pci.c	2001/08/21 00:40:02	1.1.1.19
+++ arch/ppc/kernel/pci.c	2001/08/21 17:43:48	1.14
@@ -715,12 +715,14 @@
 	}
 	pci_bus_count = next_busno;

+#ifdef CONFIG_ALL_PPC
 	/* OpenFirmware based machines need a map of OF bus
 	 * numbers vs. kernel bus numbers since we may have to
 	 * remap them.
 	 */
 	if (pci_assign_all_busses && have_of)
 		pcibios_make_OF_bus_map();
+#endif /* CONFIG_ALL_PPC */

 	/* Call machine dependant fixup */
 	if (ppc_md.pcibios_fixup)
--- arch/ppc/mm/init.c	2001/10/16 15:54:16	1.1.1.19
+++ arch/ppc/mm/init.c	2001/10/29 23:09:38	1.23
@@ -53,10 +53,12 @@

 mmu_gather_t mmu_gathers[NR_CPUS];

-void *end_of_DRAM;
 unsigned long total_memory;
 unsigned long total_lowmem;

+unsigned long ppc_memstart;
+unsigned long ppc_memoffset = PAGE_OFFSET;
+
 int mem_init_done;
 int init_bootmem_done;
 int boot_mapsize;
@@ -319,7 +321,6 @@
 		total_memory = total_lowmem;
 #endif /* CONFIG_HIGHMEM */
 	}
-	end_of_DRAM = __va(total_lowmem);
 	set_phys_avail(total_lowmem);

 	/* Initialize the MMU hardware */
@@ -401,8 +402,12 @@
 	}
 	start = PAGE_ALIGN(start);

-	boot_mapsize = init_bootmem(start >> PAGE_SHIFT,
-				    total_lowmem >> PAGE_SHIFT);
+	high_memory = __va(PPC_MEMSTART + total_lowmem);
+	min_low_pfn = start >> PAGE_SHIFT;
+	max_low_pfn = (PPC_MEMSTART + total_lowmem) >> PAGE_SHIFT;
+	boot_mapsize = init_bootmem_node(&contig_page_data, min_low_pfn,
+					 PPC_MEMSTART >> PAGE_SHIFT,
+					 max_low_pfn);

 	/* remove the bootmem bitmap from the available memory */
 	mem_pieces_remove(&phys_avail, start, boot_mapsize, 1);
@@ -457,10 +462,9 @@
 	highmem_start_page = mem_map + highmem_mapnr;
 	max_mapnr = total_memory >> PAGE_SHIFT;
 #else
-	max_mapnr = max_low_pfn;
+	max_mapnr = total_lowmem >> PAGE_SHIFT;
 #endif /* CONFIG_HIGHMEM */

-	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
 	num_physpages = max_mapnr;	/* RAM is assumed contiguous */

 	totalram_pages += free_all_bootmem();
@@ -488,7 +492,7 @@
 		     addr += PAGE_SIZE)
 			SetPageReserved(virt_to_page(addr));

-	for (addr = PAGE_OFFSET; addr < (unsigned long)end_of_DRAM;
+	for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory;
 	     addr += PAGE_SIZE) {
 		if (!PageReserved(virt_to_page(addr)))
 			continue;
@@ -543,7 +547,7 @@
 	 * physical memory.
 	 */

-	phys_avail.regions[0].address = 0;
+	phys_avail.regions[0].address = PPC_MEMSTART;
 	phys_avail.regions[0].size = total_memory;
 	phys_avail.n_regions = 1;

--- arch/ppc/mm/mmu_decl.h	2001/10/25 19:31:14	1.1.1.2
+++ arch/ppc/mm/mmu_decl.h	2001/10/29 23:09:38	1.2
@@ -31,14 +31,12 @@
 extern void reserve_phys_mem(unsigned long start, unsigned long size);

 extern int __map_without_bats;
-extern void *end_of_DRAM;
 extern unsigned long ioremap_base;
 extern unsigned long ioremap_bot;
 extern unsigned int rtas_data, rtas_size;

 extern unsigned long total_memory;
 extern unsigned long total_lowmem;
-extern unsigned long ram_phys_base;
 extern int mem_init_done;

 extern PTE *Hash, *Hash_end;
--- arch/ppc/mm/pgtable.c	2001/10/16 15:54:18	1.1.1.2
+++ arch/ppc/mm/pgtable.c	2001/10/29 23:09:38	1.4
@@ -35,8 +35,6 @@

 #include "mmu_decl.h"

-unsigned long ram_phys_base;
-
 unsigned long ioremap_base;
 unsigned long ioremap_bot;
 int io_bat_index;
@@ -199,7 +215,7 @@
 #endif /* HAVE_BATS */

 	v = KERNELBASE;
-	p = ram_phys_base;
+	p = PPC_MEMSTART;
 	for (s = 0; s < total_lowmem; s += PAGE_SIZE) {
 		/* On the MPC8xx, we want the page shared so we
 		 * don't get ASID compares on kernel space.
--- arch/ppc/mm/ppc_mmu.c	2001/08/21 00:39:44	1.1.1.1
+++ arch/ppc/mm/ppc_mmu.c	2001/10/29 23:09:38	1.2
@@ -96,8 +96,8 @@

 	/* Make sure we don't map a block larger than the
 	   smallest alignment of the physical address. */
-	/* alignment of ram_phys_base */
-	align = ~(ram_phys_base-1) & ram_phys_base;
+	/* alignment of PPC_MEMSTART */
+	align = ~(PPC_MEMSTART-1) & PPC_MEMSTART;
 	/* set BAT block size to MIN(max_size, align) */
 	if (align && align < max_size)
 		max_size = align;
@@ -108,7 +108,7 @@
 			break;
 	}

-	setbat(2, KERNELBASE, ram_phys_base, bl, _PAGE_KERNEL);
+	setbat(2, KERNELBASE, PPC_MEMSTART, bl, _PAGE_KERNEL);
 	done = (unsigned long)bat_addrs[2].limit - KERNELBASE + 1;
 	if ((done < tot) && !bat_addrs[3].limit) {
 		/* use BAT3 to cover a bit more */
@@ -116,7 +116,7 @@
 		for (bl = 128<<10; bl < max_size; bl <<= 1)
 			if (bl * 2 > tot)
 				break;
-		setbat(3, KERNELBASE+done, ram_phys_base+done, bl,
+		setbat(3, KERNELBASE+done, PPC_MEMSTART+done, bl,
 		       _PAGE_KERNEL);
 	}
 }
--- include/asm-ppc/io.h	2001/10/25 19:46:42	1.1.1.13
+++ include/asm-ppc/io.h	2001/10/25 22:02:40	1.12
@@ -1,12 +1,12 @@
 /*
  * BK Id: SCCS/s.io.h 1.14 10/16/01 15:58:42 trini
  */
-#ifdef __KERNEL__
 #ifndef _PPC_IO_H
 #define _PPC_IO_H

+#ifdef __KERNEL__
+
 #include <linux/config.h>
-#include <linux/types.h>
 #include <asm/page.h>
 #include <asm/byteorder.h>

@@ -31,18 +31,19 @@
 #elif defined(CONFIG_8260)
 #include <asm/mpc8260.h>
 #elif defined(CONFIG_APUS)
-#define _IO_BASE 0
-#define _ISA_MEM_BASE 0
+#define _IO_BASE	0
+#define _ISA_MEM_BASE	0
 #define PCI_DRAM_OFFSET 0
 #else /* Everyone else */
-extern unsigned long isa_io_base;
-extern unsigned long isa_mem_base;
-extern unsigned long pci_dram_offset;
 #define _IO_BASE	isa_io_base
 #define _ISA_MEM_BASE	isa_mem_base
 #define PCI_DRAM_OFFSET	pci_dram_offset
 #endif /* Platform-dependant I/O */

+extern unsigned long isa_io_base;
+extern unsigned long isa_mem_base;
+extern unsigned long pci_dram_offset;
+
 #define readb(addr) in_8((volatile u8 *)(addr))
 #define writeb(b,addr) out_8((volatile u8 *)(addr), (b))
 #if defined(CONFIG_APUS)
@@ -181,7 +182,6 @@
 #define memcpy_fromio(a,b,c)   memcpy((a),(void *)(b),(c))
 #define memcpy_toio(a,b,c)	memcpy((void *)(a),(b),(c))

-#ifdef __KERNEL__
 /*
  * Map in an area of physical address space, for accessing
  * I/O devices etc.
@@ -250,11 +257,9 @@
 /*
  * Change "struct page" to physical address.
  */
-#define page_to_phys(page)	((page - mem_map) << PAGE_SHIFT)
+#define page_to_phys(page)	(((page - mem_map) << PAGE_SHIFT) + PPC_MEMSTART)
 #define page_to_bus(page)	(page_to_phys(page) + PCI_DRAM_OFFSET)

-#endif /* __KERNEL__ */
-
 /*
  * Enforce In-order Execution of I/O:
  * Acts as a barrier to ensure all previous I/O accesses have
@@ -373,5 +378,5 @@
 #define dma_cache_wback(_start,_size)		do { } while (0)
 #define dma_cache_wback_inv(_start,_size)	do { } while (0)

-#endif
 #endif /* __KERNEL__ */
+#endif
--- include/asm-ppc/mpc8xx.h	2001/10/25 19:46:38	1.1.1.9
+++ include/asm-ppc/mpc8xx.h	2001/10/25 22:02:40	1.5
@@ -74,10 +74,6 @@
 #endif

 #ifndef __ASSEMBLY__
-extern unsigned long isa_io_base;
-extern unsigned long isa_mem_base;
-extern unsigned long pci_dram_offset;
-
 /* The "residual" data board information structure the boot loader
  * hands to us.
  */
--- include/asm-ppc/ppc4xx.h	2001/06/09 18:19:23	1.1.1.3
+++ include/asm-ppc/ppc4xx.h	2001/06/10 00:17:28	1.3
@@ -37,8 +37,6 @@
 #define _ISA_MEM_BASE	0
 #define PCI_DRAM_OFFSET	0

-extern unsigned long isa_io_base;
-
 /*
  * The "residual" board information structure the boot loader passes
  * into the kernel.
--- include/asm-ppc/page.h	2001/10/16 18:59:52	1.1.1.9
+++ include/asm-ppc/page.h	2001/10/29 23:09:38	1.6
@@ -86,6 +86,17 @@
 #define clear_user_page(page, vaddr)	clear_page(page)
 #define copy_user_page(to, from, vaddr)	copy_page(to, from)

+extern unsigned long ppc_memstart;
+extern unsigned long ppc_memoffset;
+#ifndef CONFIG_APUS
+#define PPC_MEMSTART	0
+#define PPC_MEMOFFSET	PAGE_OFFSET
+#else
+#define PPC_MEMSTART	ppc_memstart
+#define PPC_MEMOFFSET	ppc_memoffset
+#endif
+
+#if defined(CONFIG_APUS) && !defined(MODULE)
 /* map phys->virtual and virtual->phys for RAM pages */
 static inline unsigned long ___pa(unsigned long v)
 {
@@ -113,6 +124,11 @@

 	return (void*) v;
 }
+#else
+#define ___pa(vaddr) ((vaddr)-PPC_MEMOFFSET)
+#define ___va(paddr) ((paddr)+PPC_MEMOFFSET)
+#endif
+
 #define __pa(x) ___pa ((unsigned long)(x))
 #define __va(x) ___va ((unsigned long)(x))

--- include/asm-ppc/pgtable.h	2001/10/16 18:59:48	1.1.1.11
+++ include/asm-ppc/pgtable.h	2001/10/29 23:09:38	1.12
@@ -345,7 +345,7 @@
  * Permanent address of a page.
  */
 #define page_address(page)	((page)->virtual)
-#define pte_page(x)		(mem_map+(unsigned long)((pte_val(x) >> PAGE_SHIFT)))
+#define pte_page(x)		(mem_map+(unsigned long)((pte_val(x)-PPC_MEMSTART) >> PAGE_SHIFT))

 #ifndef __ASSEMBLY__
 /*
@@ -411,7 +411,7 @@
 #define mk_pte(page,pgprot) \
 ({									\
 	pte_t pte;							\
-	pte_val(pte) = ((page - mem_map) << PAGE_SHIFT) | pgprot_val(pgprot); \
+	pte_val(pte) = (((page - mem_map) << PAGE_SHIFT) + PPC_MEMSTART) | pgprot_val(pgprot); \
 	pte;							\
 })


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: small cleanup
  2001-10-31  1:44 small cleanup Roman Zippel
@ 2001-10-31  2:08 ` Tom Rini
  2001-10-31 10:22   ` Roman Zippel
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Rini @ 2001-10-31  2:08 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linuxppc-dev


On Wed, Oct 31, 2001 at 02:44:47AM +0100, Roman Zippel wrote:

> Below is a patch from the APUS tree (more to follow :) ). It does some
> small cleanups and one important change to get APUS working:

Yay!

> - introducing PPC_MEMSTART/PPC_MEMOFFSET, for non-APUS machines these are
> constants otherwise variables. I added with this support for memory
> starting != 0.
> - ram_phys_base became ppc_memstart
> - removed end_of_DRAM, it's equivalent to high_memory

Sounds OK.

> - pcibios_make_OF_bus_map depends on CONFIG_ALL_PPC

This should just be a warning, since gcc will optmize it out (it'll
always be false on !CONFIG_ALL_PPC.  It'd almost be preferable to do
something like:
#define pcibios_make_OF_bus_map do { } while(0)

Someplace...

> - removed duplicate definition of isa_io_base/isa_mem_base/pci_dram_offset
> (note: these variables are protected with CONFIG_PCI in ppc_ksyms.c, but
> not in the include files, so there are unconditional now)

This will break 4xx I think...  Can you try doing a
walnut+CONFIG_405_DMA=y compile (in _devel..)

> - removed nested __KERNEL__ ifdefs in io.h, one even outside of the
> recursive protection (bad style).

Correct, but it's usually
#ifdef __KERNEL__
#ifndef __FILE_H__
#define __FILE_H__
...
#endif
#endif

Or so.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: small cleanup
  2001-10-31  2:08 ` Tom Rini
@ 2001-10-31 10:22   ` Roman Zippel
  2001-10-31 15:42     ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Roman Zippel @ 2001-10-31 10:22 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-dev


Hi,

On Tue, 30 Oct 2001, Tom Rini wrote:

> > - pcibios_make_OF_bus_map depends on CONFIG_ALL_PPC
>
> This should just be a warning, since gcc will optmize it out (it'll
> always be false on !CONFIG_ALL_PPC.  It'd almost be preferable to do
> something like:
> #define pcibios_make_OF_bus_map do { } while(0)
>
> Someplace...

That function is in the same file...

> > - removed duplicate definition of isa_io_base/isa_mem_base/pci_dram_offset
> > (note: these variables are protected with CONFIG_PCI in ppc_ksyms.c, but
> > not in the include files, so there are unconditional now)
>
> This will break 4xx I think...  Can you try doing a
> walnut+CONFIG_405_DMA=y compile (in _devel..)

I can try it (when I get home).

> > - removed nested __KERNEL__ ifdefs in io.h, one even outside of the
> > recursive protection (bad style).
>
> Correct, but it's usually
> #ifdef __KERNEL__
> #ifndef __FILE_H__
> #define __FILE_H__
> ...
> #endif
> #endif
>
> Or so.

I would do it the other way around. gcc looks for a ifndef/define/endif
sequence to decide whether it needs to rescan that file next time, but I'm
not sure if gcc finds it in this case.

bye, Roman


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: small cleanup
  2001-10-31 10:22   ` Roman Zippel
@ 2001-10-31 15:42     ` Tom Rini
  2001-10-31 19:49       ` Roman Zippel
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Rini @ 2001-10-31 15:42 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linuxppc-dev


On Wed, Oct 31, 2001 at 11:22:20AM +0100, Roman Zippel wrote:
> Hi,
>
> On Tue, 30 Oct 2001, Tom Rini wrote:
>
> > > - pcibios_make_OF_bus_map depends on CONFIG_ALL_PPC
> >
> > This should just be a warning, since gcc will optmize it out (it'll
> > always be false on !CONFIG_ALL_PPC.  It'd almost be preferable to do
> > something like:
> > #define pcibios_make_OF_bus_map do { } while(0)
> >
> > Someplace...
>
> That function is in the same file...

Yes, and compiled only on CONFIG_ALL_PPC.  But the if statement will
always be false on !CONFIG_ALL_PPC, so while the compiler will warn
about an implicit declaration, it won't cause a link error.  Eg:
--- 1.34/arch/ppc/kernel/pci.c  Sat Oct  6 11:16:41 2001
+++ edited/pci.c        Wed Oct 31 08:40:26 2001
@@ -743,6 +743,9 @@
                ranges += np;
        }
 }
+#else
+/* Kill a warning */
+#define pcibios_make_OF_bus_map do { } while(0)
 #endif /* CONFIG_ALL_PPC */

 void __init

> > > - removed duplicate definition of isa_io_base/isa_mem_base/pci_dram_offset
> > > (note: these variables are protected with CONFIG_PCI in ppc_ksyms.c, but
> > > not in the include files, so there are unconditional now)
> >
> > This will break 4xx I think...  Can you try doing a
> > walnut+CONFIG_405_DMA=y compile (in _devel..)
>
> I can try it (when I get home).

Thanks.

> > > - removed nested __KERNEL__ ifdefs in io.h, one even outside of the
> > > recursive protection (bad style).
> >
> > Correct, but it's usually
> > #ifdef __KERNEL__
> > #ifndef __FILE_H__
> > #define __FILE_H__
> > ...
> > #endif
> > #endif
> >
> > Or so.
>
> I would do it the other way around. gcc looks for a ifndef/define/endif
> sequence to decide whether it needs to rescan that file next time, but I'm
> not sure if gcc finds it in this case.

By and large we do it the way I said anyhow.  Is this in current gcc or
when we get the precompiled headers bits?

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: small cleanup
  2001-10-31 15:42     ` Tom Rini
@ 2001-10-31 19:49       ` Roman Zippel
  2001-10-31 22:53         ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Roman Zippel @ 2001-10-31 19:49 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-dev


Hi,

On Wed, 31 Oct 2001, Tom Rini wrote:

> Yes, and compiled only on CONFIG_ALL_PPC.  But the if statement will
> always be false on !CONFIG_ALL_PPC, so while the compiler will warn
> about an implicit declaration, it won't cause a link error.  Eg:
> --- 1.34/arch/ppc/kernel/pci.c  Sat Oct  6 11:16:41 2001
> +++ edited/pci.c        Wed Oct 31 08:40:26 2001
> @@ -743,6 +743,9 @@
>                 ranges += np;
>         }
>  }
> +#else
> +/* Kill a warning */
> +#define pcibios_make_OF_bus_map do { } while(0)
>  #endif /* CONFIG_ALL_PPC */
>
>  void __init

Hmm, I don't see how that is any better, but it's ok for me.

> > > This will break 4xx I think...  Can you try doing a
> > > walnut+CONFIG_405_DMA=y compile (in _devel..)
> >
> > I can try it (when I get home).
>
> Thanks.

Works fine, below is the relevant part of the patch for 2_4_devel.

> By and large we do it the way I said anyhow.  Is this in current gcc or
> when we get the precompiled headers bits?

That has nothing to do with precompiled headers, check the cpp info file
("Header Files" -> "Once-Only") for more info.

bye, Roman

--- include/asm-ppc/ibm4xx.h	Wed Oct 31 17:58:28 2001
+++ include/asm-ppc/ibm4xx.h	Wed Oct 31 20:09:35 2001
@@ -57,10 +57,6 @@
 #define PCI_DRAM_OFFSET	0
 #endif

-extern unsigned long isa_io_base;
-extern unsigned long isa_mem_base;
-extern unsigned long pci_dram_offset;
-
 /*
  * The "residual" board information structure the boot loader passes
  * into the kernel.
--- include/asm-ppc/io.h	Wed Oct 31 17:58:06 2001
+++ include/asm-ppc/io.h	Wed Oct 31 20:09:35 2001
@@ -1,12 +1,12 @@
 /*
  * BK Id: SCCS/s.io.h 1.21 10/16/01 16:44:09 %#%
  */
-#ifdef __KERNEL__
 #ifndef _PPC_IO_H
 #define _PPC_IO_H

+#ifdef __KERNEL__
+
 #include <linux/config.h>
-#include <linux/types.h>
 #include <asm/page.h>
 #include <asm/byteorder.h>

@@ -31,18 +31,19 @@
 #elif defined(CONFIG_8260)
 #include <asm/mpc8260.h>
 #elif defined(CONFIG_APUS)
-#define _IO_BASE 0
-#define _ISA_MEM_BASE 0
+#define _IO_BASE	0
+#define _ISA_MEM_BASE	0
 #define PCI_DRAM_OFFSET 0
 #else /* Everyone else */
-extern unsigned long isa_io_base;
-extern unsigned long isa_mem_base;
-extern unsigned long pci_dram_offset;
 #define _IO_BASE	isa_io_base
 #define _ISA_MEM_BASE	isa_mem_base
 #define PCI_DRAM_OFFSET	pci_dram_offset
 #endif /* Platform-dependant I/O */

+extern unsigned long isa_io_base;
+extern unsigned long isa_mem_base;
+extern unsigned long pci_dram_offset;
+
 #if defined(CONFIG_PPC_ISERIES)
 #include <asm/iSeries.h>
 #if defined(CONFIG_PCI)
@@ -223,7 +224,6 @@
 #define memcpy_toio(a,b,c)	memcpy((void *)(a),(b),(c))
 #endif

-#ifdef __KERNEL__
 /*
  * Map in an area of physical address space, for accessing
  * I/O devices etc.
@@ -295,11 +295,9 @@
 /*
  * Change "struct page" to physical address.
  */
-#define page_to_phys(page)	((page - mem_map) << PAGE_SHIFT)
+#define page_to_phys(page)	(((page - mem_map) << PAGE_SHIFT) + PPC_MEMSTART)
 #define page_to_bus(page)	(page_to_phys(page) + PCI_DRAM_OFFSET)

-#endif /* __KERNEL__ */
-
 /*
  * Enforce In-order Execution of I/O:
  * Acts as a barrier to ensure all previous I/O accesses have
@@ -450,5 +448,5 @@
 #define consistent_sync_page(pg, off, sz, rw)	do { } while (0)

 #endif /* CONFIG_NOT_COHERENT_CACHE */
-#endif /* _PPC_IO_H */
 #endif /* __KERNEL__ */
+#endif /* _PPC_IO_H */


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: small cleanup
  2001-10-31 19:49       ` Roman Zippel
@ 2001-10-31 22:53         ` Tom Rini
  2001-10-31 23:23           ` Roman Zippel
  2001-11-01 11:19           ` Geert Uytterhoeven
  0 siblings, 2 replies; 8+ messages in thread
From: Tom Rini @ 2001-10-31 22:53 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linuxppc-dev


On Wed, Oct 31, 2001 at 08:49:27PM +0100, Roman Zippel wrote:
> Hi,
>
> On Wed, 31 Oct 2001, Tom Rini wrote:
>
> > Yes, and compiled only on CONFIG_ALL_PPC.  But the if statement will
> > always be false on !CONFIG_ALL_PPC, so while the compiler will warn
> > about an implicit declaration, it won't cause a link error.  Eg:
> > --- 1.34/arch/ppc/kernel/pci.c  Sat Oct  6 11:16:41 2001
> > +++ edited/pci.c        Wed Oct 31 08:40:26 2001
> > @@ -743,6 +743,9 @@
> >                 ranges += np;
> >         }
> >  }
> > +#else
> > +/* Kill a warning */
> > +#define pcibios_make_OF_bus_map do { } while(0)
> >  #endif /* CONFIG_ALL_PPC */
> >
> >  void __init
>
> Hmm, I don't see how that is any better, but it's ok for me.

I'd still rather just ignore the warning. :)

> > > > This will break 4xx I think...  Can you try doing a
> > > > walnut+CONFIG_405_DMA=y compile (in _devel..)
> > >
> > > I can try it (when I get home).
> >
> > Thanks.
>
> Works fine, below is the relevant part of the patch for 2_4_devel.

Okay, thanks.  Remove my objection to that part then..

> > By and large we do it the way I said anyhow.  Is this in current gcc or
> > when we get the precompiled headers bits?
>
> That has nothing to do with precompiled headers, check the cpp info file
> ("Header Files" -> "Once-Only") for more info.

I will when I get a moment.. :)  But #ifndef __FOO__ #define __FOO__
#ifdef __BAR__ ... #endif /* __BAR__ */ #endif /* __FOO__ */ works
better than checking for __BAR__ first?

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: small cleanup
  2001-10-31 22:53         ` Tom Rini
@ 2001-10-31 23:23           ` Roman Zippel
  2001-11-01 11:19           ` Geert Uytterhoeven
  1 sibling, 0 replies; 8+ messages in thread
From: Roman Zippel @ 2001-10-31 23:23 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-dev


Hi,

Tom Rini wrote:

> I will when I get a moment.. :)  But #ifndef __FOO__ #define __FOO__
> #ifdef __BAR__ ... #endif /* __BAR__ */ #endif /* __FOO__ */ works
> better than checking for __BAR__ first?

IMO yes: "If a subsequent `#include' specifies the same file, and the
macro in the `#ifndef' is already defined, then the file is entirely
skipped, without even reading it."

bye, Roman

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: small cleanup
  2001-10-31 22:53         ` Tom Rini
  2001-10-31 23:23           ` Roman Zippel
@ 2001-11-01 11:19           ` Geert Uytterhoeven
  1 sibling, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2001-11-01 11:19 UTC (permalink / raw)
  To: Tom Rini; +Cc: Roman Zippel, Linux/PPC Development


On Wed, 31 Oct 2001, Tom Rini wrote:
> On Wed, Oct 31, 2001 at 08:49:27PM +0100, Roman Zippel wrote:
> > On Wed, 31 Oct 2001, Tom Rini wrote:
> > > Yes, and compiled only on CONFIG_ALL_PPC.  But the if statement will
> > > always be false on !CONFIG_ALL_PPC, so while the compiler will warn
> > > about an implicit declaration, it won't cause a link error.  Eg:
> > > --- 1.34/arch/ppc/kernel/pci.c  Sat Oct  6 11:16:41 2001
> > > +++ edited/pci.c        Wed Oct 31 08:40:26 2001
> > > @@ -743,6 +743,9 @@
> > >                 ranges += np;
> > >         }
> > >  }
> > > +#else
> > > +/* Kill a warning */
> > > +#define pcibios_make_OF_bus_map do { } while(0)
> > >  #endif /* CONFIG_ALL_PPC */
> > >
> > >  void __init
> >
> > Hmm, I don't see how that is any better, but it's ok for me.
>
> I'd still rather just ignore the warning. :)

Nope, such warnings distract you from the real warnings. Better to have no
warnings at all.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-11-01 11:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-31  1:44 small cleanup Roman Zippel
2001-10-31  2:08 ` Tom Rini
2001-10-31 10:22   ` Roman Zippel
2001-10-31 15:42     ` Tom Rini
2001-10-31 19:49       ` Roman Zippel
2001-10-31 22:53         ` Tom Rini
2001-10-31 23:23           ` Roman Zippel
2001-11-01 11:19           ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).