* PCI Host Controller Structure Init Linux kernel 2.6
From: Deepak Gaur @ 2007-06-20 11:31 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <20070620092822.M62113@cdotd.ernet.in>
Hello all,
I have certain doubts regarding initialization of PCI host controller in a MPC8560 based
custom board. The board has three 32bit PCI devices attached to MPC8560 PCI/X interface
and all of them are on same PCI bus. Moreover all the three devices do not understand
PCI I/O transactions(as per device datasheets). Each device has its own PCI memory range
and and are non-contigous in MPC8560 local memory address map . PCI memory is 1:1 mapped
to Local memory address range of MPC8560.
Consider the linux kernel 2.6 source code . The board specific function
mpc8560custom_setup_arch() defined in "arch/ppc/platforms/85xx/mpc8560_custom.c" is
called during initialization as described below
static void __init
mpc8560custom_setup_arch(void)
{
...
...
...
#ifdef CONFIG_PCI
/* setup PCI host bridges */
mpc85xx_setup_hose();
#endif
...
...
...
...
}
The mpc8560custom_setup_arch(void) then calls mpc85xx_setup_hose() for setting up a PCI
Host Controller for MPC8560 PCI/X interface as described in file
"arch/ppc/syslib/ppc85xx_setup.c"
void __init
mpc85xx_setup_hose(void)
{
struct pci_controller *hose_a;
...
...
bd_t *binfo = (bd_t *) __res;
hose_a = pcibios_alloc_controller();
if (!hose_a)
return;
ppc_md.pci_swizzle = common_swizzle;
ppc_md.pci_map_irq = mpc85xx_map_irq;
hose_a->first_busno = 0;
hose_a->bus_offset = 0;
hose_a->last_busno = 0xff;
setup_indirect_pci(hose_a, binfo->bi_immr_base + PCI1_CFG_ADDR_OFFSET,
binfo->bi_immr_base + PCI1_CFG_DATA_OFFSET);
hose_a->set_cfg_type = 1;
mpc85xx_setup_pci1(hose_a);
hose_a->pci_mem_offset = MPC85XX_PCI1_MEM_OFFSET;
hose_a->mem_space.start = MPC85XX_PCI1_LOWER_MEM;
hose_a->mem_space.end = MPC85XX_PCI1_UPPER_MEM;
hose_a->io_space.start = MPC85XX_PCI1_LOWER_IO;
hose_a->io_space.end = MPC85XX_PCI1_UPPER_IO;
hose_a->io_base_phys = MPC85XX_PCI1_IO_BASE;
#ifdef CONFIG_85xx_PCI2
isa_io_base =
(unsigned long) ioremap(MPC85XX_PCI1_IO_BASE,
MPC85XX_PCI1_IO_SIZE +
MPC85XX_PCI2_IO_SIZE);
#else
isa_io_base =
(unsigned long) ioremap(MPC85XX_PCI1_IO_BASE,
MPC85XX_PCI1_IO_SIZE);
#endif
hose_a->io_base_virt = (void *) isa_io_base;
/* setup resources */
pci_init_resource(&hose_a->mem_resources[0],
MPC85XX_PCI1_LOWER_MEM,
MPC85XX_PCI1_UPPER_MEM,
IORESOURCE_MEM, "PCI1 host bridge");
pci_init_resource(&hose_a->io_resource,
MPC85XX_PCI1_LOWER_IO,
MPC85XX_PCI1_UPPER_IO,
IORESOURCE_IO, "PCI1 host bridge");
ppc_md.pci_exclude_device = mpc85xx_exclude_device;
...
...
...
...
}
The mpc85xx_setup_pci1(hose_a) function set up the outbound and inbound transaltion
windows as described below . I customized the function for supporting 3 PCI devices each
having one outbound and inbound window.
mpc85xx_setup_pci1(hose_a)
{
...
...
...
/* Setup Phys:PCI 1:1 outbound mem window @ MPC85XX_PCI1_DEV1_LOWER_MEM */
pci->potar1 = (MPC85XX_PCI1_DEVICE1_LOWER_MEM >> 12) & 0x000fffff;
pci->potear1 = 0x00000000;
pci->powbar1 = (MPC85XX_PCI1_56900_DEVICE1_MEM >> 12) & 0x000fffff;
/* Enable, Mem R/W */
pci->powar1 = 0x80044000 |
(__ilog2(MPC85XX_PCI1_56900_DEVICE1_MEM - MPC85XX_PCI1_DEVICE1_LOWER_MEM + 1)
- 1);
and
/* Setup Phys:PCI 1:1 inbound mem window @ MPC85XX_PCI1_DEVICE1_LOWER_MEM */
pci->pitar1 = (MPC85XX_PCI1_DEVICE1_LOWER_MEM >> 12) & 0x000fffff;
pci->pitear1 = 0x00000000;
pci->piwbar1 = (MPC85XX_PCI1_DEVICE1_LOWER_MEM >> 12) & 0x000fffff;
pci->piwar1 = 0xa0f5501e; /* Enable, Prefetch, Local
Mem, Snoop R/W, 2G */
...
...
...
}
I have following doubts for customizing this code for my custom board requirements
(1) As none of the devices understand PCI I/O transactions (as per device datasheets)
what need to be filled in hose_a->io_space.start, hose_a->io_space.end
,hose_a->io_base_phys variables in function mpc85xx_setup_hose(void)
(2) As the board has 3 devices with following MPC8560 local memory map locations
DEVICE1 80000000 to 800FFFFF
DEVICE2 90000000 to 900FFFFF
Other non PCI devices
DEVICE3 B0000000 to BFFFFFFF
These memory locations are to be 1:1 memory mapped in PCI address space as
MPC85XX_PCI1_MEM_OFFSET is 00000000. Now my doublt is how to give this information in
following section of code
hose_a->pci_mem_offset = MPC85XX_PCI1_MEM_OFFSET;
hose_a->mem_space.start = MPC85XX_PCI1_LOWER_MEM;
hose_a->mem_space.end = MPC85XX_PCI1_UPPER_MEM;
As hose_a->mem_space.start and hose_a->mem_space.end are single variables how the all
devices info can be given (we need three elements)? Or we need to give this info as
following
/* setup resources */
pci_init_resource(&hose_a->mem_resources[0],
MPC85XX_PCI1_DEV1_LOWER_MEM,
MPC85XX_PCI1_DEV1 UPPER_MEM,
IORESOURCE_MEM, "PCI1 host bridge Device 1");
pci_init_resource(&hose_a->mem_resources[0],
MPC85XX_PCI1_DEV2_LOWER_MEM,
MPC85XX_PCI1_DEV2 UPPER_MEM,
IORESOURCE_MEM, "PCI1 host bridge Device 2");
pci_init_resource(&hose_a->mem_resources[0],
MPC85XX_PCI1_DEV3_LOWER_MEM,
MPC85XX_PCI1_DEV3 UPPER_MEM,
IORESOURCE_MEM, "PCI1 host bridge Device 3");
(3) As no PCI I/O transaction are required with PCI device what needs to be filled in
pci_init_resource(&hose_a->io_resource,
MPC85XX_PCI1_LOWER_IO,
MPC85XX_PCI1_UPPER_IO,
IORESOURCE_IO, "PCI1 host bridge");
hose_a->io_resource?
(4) In case I had 4 or 5 PCI or more devices where and what initialization I would have
done. Am I doing the customization at the right place?
I shall be gratful if anyone can tell be PCI setup required for above board
configuration and help me in understanding PCI init in Linux Kernel 2.6
Thanks in advance,
with warm regards,
Deepak Gaur
------- End of Forwarded Message -------
Deepak Gaur
^ permalink raw reply
* PCI Host Controller Structure Init Linux kernel 2.6
From: Deepak Gaur @ 2007-06-20 11:29 UTC (permalink / raw)
To: linuxppc-embedded
Hi all,
I have certain doubts regarding initialization of PCI host controller in a MPC8560 based
custom board. The board has three 32bit PCI devices attached to MPC8560 PCI/X interface
and all of them are on same PCI bus. Moreover all the three devices do not understand
PCI I/O transactions(as per device datasheets). Each device has its own PCI memory range
and and are non-contigous in MPC8560 local memory address map . PCI memory is 1:1 mapped
to Local memory address range of MPC8560.
Consider the linux kernel 2.6 source code . The board specific function
mpc8560custom_setup_arch() defined in "arch/ppc/platforms/85xx/mpc8560_custom.c" is
called during initialization as described below
static void __init
mpc8560custom_setup_arch(void)
{
...
...
...
#ifdef CONFIG_PCI
/* setup PCI host bridges */
mpc85xx_setup_hose();
#endif
...
...
...
...
}
The mpc8560custom_setup_arch(void) then calls mpc85xx_setup_hose() for setting up a PCI
Host Controller for MPC8560 PCI/X interface as described in file
"arch/ppc/syslib/ppc85xx_setup.c"
void __init
mpc85xx_setup_hose(void)
{
struct pci_controller *hose_a;
...
...
bd_t *binfo = (bd_t *) __res;
hose_a = pcibios_alloc_controller();
if (!hose_a)
return;
ppc_md.pci_swizzle = common_swizzle;
ppc_md.pci_map_irq = mpc85xx_map_irq;
hose_a->first_busno = 0;
hose_a->bus_offset = 0;
hose_a->last_busno = 0xff;
setup_indirect_pci(hose_a, binfo->bi_immr_base + PCI1_CFG_ADDR_OFFSET,
binfo->bi_immr_base + PCI1_CFG_DATA_OFFSET);
hose_a->set_cfg_type = 1;
mpc85xx_setup_pci1(hose_a);
hose_a->pci_mem_offset = MPC85XX_PCI1_MEM_OFFSET;
hose_a->mem_space.start = MPC85XX_PCI1_LOWER_MEM;
hose_a->mem_space.end = MPC85XX_PCI1_UPPER_MEM;
hose_a->io_space.start = MPC85XX_PCI1_LOWER_IO;
hose_a->io_space.end = MPC85XX_PCI1_UPPER_IO;
hose_a->io_base_phys = MPC85XX_PCI1_IO_BASE;
#ifdef CONFIG_85xx_PCI2
isa_io_base =
(unsigned long) ioremap(MPC85XX_PCI1_IO_BASE,
MPC85XX_PCI1_IO_SIZE +
MPC85XX_PCI2_IO_SIZE);
#else
isa_io_base =
(unsigned long) ioremap(MPC85XX_PCI1_IO_BASE,
MPC85XX_PCI1_IO_SIZE);
#endif
hose_a->io_base_virt = (void *) isa_io_base;
/* setup resources */
pci_init_resource(&hose_a->mem_resources[0],
MPC85XX_PCI1_LOWER_MEM,
MPC85XX_PCI1_UPPER_MEM,
IORESOURCE_MEM, "PCI1 host bridge");
pci_init_resource(&hose_a->io_resource,
MPC85XX_PCI1_LOWER_IO,
MPC85XX_PCI1_UPPER_IO,
IORESOURCE_IO, "PCI1 host bridge");
ppc_md.pci_exclude_device = mpc85xx_exclude_device;
...
...
...
...
}
The mpc85xx_setup_pci1(hose_a) function set up the outbound and inbound transaltion
windows as described below . I customized the function for supporting 3 PCI devices each
having one outbound and inbound window.
mpc85xx_setup_pci1(hose_a)
{
...
...
...
/* Setup Phys:PCI 1:1 outbound mem window @ MPC85XX_PCI1_DEV1_LOWER_MEM */
pci->potar1 = (MPC85XX_PCI1_DEVICE1_LOWER_MEM >> 12) & 0x000fffff;
pci->potear1 = 0x00000000;
pci->powbar1 = (MPC85XX_PCI1_56900_DEVICE1_MEM >> 12) & 0x000fffff;
/* Enable, Mem R/W */
pci->powar1 = 0x80044000 |
(__ilog2(MPC85XX_PCI1_56900_DEVICE1_MEM - MPC85XX_PCI1_DEVICE1_LOWER_MEM + 1)
- 1);
and
/* Setup Phys:PCI 1:1 inbound mem window @ MPC85XX_PCI1_DEVICE1_LOWER_MEM */
pci->pitar1 = (MPC85XX_PCI1_DEVICE1_LOWER_MEM >> 12) & 0x000fffff;
pci->pitear1 = 0x00000000;
pci->piwbar1 = (MPC85XX_PCI1_DEVICE1_LOWER_MEM >> 12) & 0x000fffff;
pci->piwar1 = 0xa0f5501e; /* Enable, Prefetch, Local
Mem, Snoop R/W, 2G */
...
...
...
}
I have following doubts for customizing this code for my custom board requirements
(1) As none of the devices understand PCI I/O transactions (as per device datasheets)
what need to be filled in hose_a->io_space.start, hose_a->io_space.end
,hose_a->io_base_phys variables in function mpc85xx_setup_hose(void)
(2) As the board has 3 devices with following MPC8560 local memory map locations
DEVICE1 80000000 to 800FFFFF
DEVICE2 90000000 to 900FFFFF
Other non PCI devices
DEVICE3 B0000000 to BFFFFFFF
These memory locations are to be 1:1 memory mapped in PCI address space as
MPC85XX_PCI1_MEM_OFFSET is 00000000. Now my doublt is how to give this information in
following section of code
hose_a->pci_mem_offset = MPC85XX_PCI1_MEM_OFFSET;
hose_a->mem_space.start = MPC85XX_PCI1_LOWER_MEM;
hose_a->mem_space.end = MPC85XX_PCI1_UPPER_MEM;
As hose_a->mem_space.start and hose_a->mem_space.end are single variables how the all
devices info can be given (we need three elements)? Or we need to give this info as
following
/* setup resources */
pci_init_resource(&hose_a->mem_resources[0],
MPC85XX_PCI1_DEV1_LOWER_MEM,
MPC85XX_PCI1_DEV1 UPPER_MEM,
IORESOURCE_MEM, "PCI1 host bridge Device 1");
pci_init_resource(&hose_a->mem_resources[0],
MPC85XX_PCI1_DEV2_LOWER_MEM,
MPC85XX_PCI1_DEV2 UPPER_MEM,
IORESOURCE_MEM, "PCI1 host bridge Device 2");
pci_init_resource(&hose_a->mem_resources[0],
MPC85XX_PCI1_DEV3_LOWER_MEM,
MPC85XX_PCI1_DEV3 UPPER_MEM,
IORESOURCE_MEM, "PCI1 host bridge Device 3");
(3) As no PCI I/O transaction are required with PCI device what needs to be filled in
pci_init_resource(&hose_a->io_resource,
MPC85XX_PCI1_LOWER_IO,
MPC85XX_PCI1_UPPER_IO,
IORESOURCE_IO, "PCI1 host bridge");
hose_a->io_resource?
(4) In case I had 4 or 5 PCI or more devices where and what initialization I would have
done. Am I doing the customization at the right place?
I shall be gratful if anyone can tell be PCI setup required for above board
configuration and help me in understanding PCI init in Linux Kernel 2.6
Thanks in advance,
with warm regards,
Deepak Gaur
^ permalink raw reply
* Re: random code execution - kernel oops
From: Johannes Berg @ 2007-06-19 16:06 UTC (permalink / raw)
To: linuxppc-dev list
In-Reply-To: <1182171859.21013.3.camel@johannes.berg>
On Mon, 2007-06-18 at 15:04 +0200, Johannes Berg wrote:
> unsigned long hx = 0x4bfcc50c;
> int main()
> {
> asm("bl hx");
> }
The net result of which is trying to execute code in a region without
access permissions.
Segher dug into the problem and suggested the patch below which does
indeed fix the problem:
---
arch/powerpc/mm/fault.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- wireless-dev.orig/arch/powerpc/mm/fault.c 2007-06-19 16:12:16.080612233 +0200
+++ wireless-dev/arch/powerpc/mm/fault.c 2007-06-19 16:12:27.480612233 +0200
@@ -279,14 +279,13 @@ good_area:
#endif /* CONFIG_8xx */
if (is_exec) {
-#ifdef CONFIG_PPC64
+#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
/* protection fault */
if (error_code & DSISR_PROTFAULT)
goto bad_area;
if (!(vma->vm_flags & VM_EXEC))
goto bad_area;
-#endif
-#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
+#else
pte_t *ptep;
pmd_t *pmdp;
^ permalink raw reply
* Re: [PATCH v2] Create add_rtc() function to enable the RTC CMOS driver
From: Segher Boessenkool @ 2007-06-20 10:06 UTC (permalink / raw)
To: Wade Farnsworth; +Cc: linuxppc-dev, paulus
In-Reply-To: <1182298510.5674.358.camel@rhino>
> This creates a function to register the platform device based on the
> RTC
> device node and verifies that the RTC port against the hard-coded value
> in asm/mc146818rtc.h. It also sets the RTC to 24-hr mode as 12-hr mode
> is not currently supported by the driver.
The 24h thing should be set in the driver itself. Does the
driver handle binary vs. decimal mode btw? If not, you'll
want to do the analogue thing for that.
Segher
^ permalink raw reply
* Re: [PATCH] Fix I8042 IRQs on MPC8641 HPCN
From: Segher Boessenkool @ 2007-06-20 10:03 UTC (permalink / raw)
To: Wade Farnsworth; +Cc: linuxppc-dev, paulus
In-Reply-To: <1182298509.5674.356.camel@rhino>
> * IRQ 9: Level
> * IRQ 10: Level
> * IRQ 11: Level
> - * IRQ 12: Level
> + * IRQ 12: Edge
> * IRQ 14: Edge
> * IRQ 15: Edge
> */
> - outb(0xfa, 0x4d0);
> - outb(0x1e, 0x4d1);
> + outb(0xf8, 0x4d0);
> + outb(0x0e, 0x4d1);
The comment doesn't mention IRQ13. You're changing IRQ9
to edge as well; is this an accident? If not, you need
to change the comment too.
Segher
^ permalink raw reply
* Re: [PATCH] Add a check for keyboard/mouse device nodes in check_legacy_ioport()
From: Segher Boessenkool @ 2007-06-20 9:57 UTC (permalink / raw)
To: Wade Farnsworth; +Cc: linuxppc-dev, paulus
In-Reply-To: <1182298510.5674.357.camel@rhino>
> The device tree for the MPC8641 HPCN does not implement the device type
> property for I8042 nodes.
>
> In addition to checking the I8042 node's device type, also match the
> keyboard and/or mouse nodes' compatible property.
>
> Signed-off-by: Wade Farnsworth <wfarnsworth@mvista.com>
Looks good.
Segher
^ permalink raw reply
* Re: [Cbe-oss-dev] [patch 2/5] Add support to OProfile for profiling Cell/B.E. SPUs
From: Arnd Bergmann @ 2007-06-20 9:35 UTC (permalink / raw)
To: mita
Cc: Bob Nelson, linuxppc-dev, paulus, Maynard Johnson, cbe-oss-dev,
Carl Love
In-Reply-To: <36420.202.32.178.37.1182306728.squirrel@webmail.fixstars.com>
On Wednesday 20 June 2007, mita@fixstars.com wrote:
> > +
> > +=A0=A0=A0=A0=A0/* Allocate arrays for collecting SPU PC samples */
> > +=A0=A0=A0=A0=A0samples =3D (u32 *) kzalloc(SPUS_PER_NODE *
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0 =A0TRACE_ARRAY_SIZE * sizeof(u32), GFP_KERNEL);
> > +
>=20
> =A0- Unnecessary cast for kzalloc().
>=20
> =A0- Allocation failure is ignored here. But there is no error handling
> =A0 =A0in timer fuction (profile_spus), too.
Right. Bob, can you make a patch to remove the case and make sure that
we never access the sample array when the allocation has failed?
Arnd <><
^ permalink raw reply
* AVNET/Memec Virtex4FX12LC Linux Kernel Tree
From: Thomas Glanzmann @ 2007-06-20 7:41 UTC (permalink / raw)
To: linuxppc-embedded
Hello,
I would like to be able to boot a self compiled Linux 2.6(.20?!) Kernel on a
Virtex 4 FX 12 LC Board. I have the cross compile suite ready, compiled
a zImage an I am able to load it up. But nothing appears on the serial
device. I have a Montavista Demo based on a 2.4 and a so called Linux
Starter Kit also based on the 2.4 Kernel from Montavista / AVNET both
work. At least the kernel boots and I am able to reproduce the hardware
they used. However I would like to know if for example a 2.6.20
upstream kernel works out of the box after I parameterized it the right
way or if there is a separate tree to begin with?
Thomas
^ permalink raw reply
* Re: [PATCH/RFC] Make certain timekeeping variables __read_mostly
From: Geert Uytterhoeven @ 2007-06-20 7:41 UTC (permalink / raw)
To: Tony Breeds; +Cc: LinuxPPC-dev
In-Reply-To: <20070620031333.GP9768@bakeyournoodle.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 970 bytes --]
On Wed, 20 Jun 2007, Tony Breeds wrote:
> On Wed, Jun 20, 2007 at 12:02:11PM +1000, Tony Breeds wrote:
> > Also this patch makes tb_to_ns_scale and tb_to_ns_shift static for good
> > measure.
>
> While we're ate it these 3 variables can be marked __read_mostly.
There's no __read_mostly support for powerpc yet (is there?), so __read_mostly
just expands to nothing?
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/
Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
^ permalink raw reply
* Re: [PATCH/RFC] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane.
From: Geert Uytterhoeven @ 2007-06-20 7:37 UTC (permalink / raw)
To: Tony Breeds; +Cc: Olof Johansson, LinuxPPC-dev
In-Reply-To: <20070620020211.GO9768@bakeyournoodle.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2189 bytes --]
On Wed, 20 Jun 2007, Tony Breeds wrote:
> On Tue, Jun 19, 2007 at 09:53:56AM -0500, Olof Johansson wrote:
> > It only seems to be used in this file, so it can be static, right?
>
> True, I was following suit with tb_to_ns_scale, tb_to_ns_shift which
> could also be static.
>
> Here's an updated patch that makes them all static and updates the
> commit message as well.
>
> From: Tony Breeds <tony@bakeyournoodle.com>
>
> Modify sched_clock() to make CONFIG_PRINTK_TIME more sane.
>
> When booting a current kernel with CONFIG_PRINTK_TIME enabled you'll
> see messages like:
>
> [ 0.000000] time_init: decrementer frequency = 188.044000 MHz
> [ 0.000000] time_init: processor frequency = 1504.352000 MHz
> [3712914.436297] Console: colour dummy device 80x25
>
> This cause by the initialisation of tb_to_ns_scale in time_init(), suddenly the
> multiplication in sched_clock() now does something :). This patch modifies
> sched_clock() to report the offset since the machine booted so the same
> printk's now look like:
>
> [ 0.000000] time_init: decrementer frequency = 188.044000 MHz
> [ 0.000000] time_init: processor frequency = 1504.352000 MHz
> [ 0.000135] Console: colour dummy device 80x25
>
> Effectively including the uptime in printk()s.
Just wondering, does the INITIAL_JIFFIES mechanism to catch wrap bugs still
work after this patch?
include/linux/jiffies.h:
| /*
| * Have the 32 bit jiffies value wrap 5 minutes after boot
| * so jiffies wrap bugs show up earlier.
| */
| #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/
Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
^ permalink raw reply
* Re: CAN YOU HELLP ME
From: David Jander @ 2007-06-20 7:23 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <loom.20070620T040706-80@post.gmane.org>
On Wednesday 20 June 2007 04:20:09 volcano wrote:
> hello my dear friend:
> I have read the u-boot last week ,and thank you for all your kind
> help.My linux code is based on MPC8260,so I want to continue the read of
> the linux2.6.18 based on mpc8260.can you give me some kind suggestions
> about how to read all these codes clearly.,and if some reference is given
> would be welcome.
I suppose you want to have something as a guide to the linux-kernel
source-code, right?
Well, I haven't found anything like that exactly, but luckily the source-code
is mostly quite easy to understand, and after fiddling for a while you'll get
the hang of it.
Here you might find some useful information on books and on-line material over
the linux kernel:
http://www.linux.org/dist/kernel.html
It is also helful to check the lkml (linux-kernel-mailing list) every now and
then, to see what's "hot".
The kernel itself is in constant changes that happen so quickly, that after
finishing a guide like this, you would probably already need to change it.
Therefore it is the intention to make the linux-kernel sources as readable as
possible, so that the code is self-explanatory. The code itself is the
manual.
Greetings,
--
David Jander
^ permalink raw reply
* [RFC] clocksouce implementation for powerpc
From: Tony Breeds @ 2007-06-20 6:57 UTC (permalink / raw)
To: Daniel Walker
Cc: Andrew Morton, john stultz, LKML, LinuxPPC-dev, Thomas Gleixner,
Ingo Molnar
In-Reply-To: <1182009083.11539.369.camel@imap.mvista.com>
On Sat, Jun 16, 2007 at 08:51:23AM -0700, Daniel Walker wrote:
> On Sat, 2007-06-16 at 10:36 +0000, Thomas Gleixner wrote:
> > plain text document attachment
> > (clocksource-add-settimeofday-hook.patch)
> > From: Tony Breeds <tony@bakeyournoodle.com >
> >
> > I'm working on a clocksource implementation for all powerpc platforms.
> > some of these platforms needs to do a little work as part of the
> > settimeofday() syscall and I can't see a way to do that without adding
> > this hook to clocksource.
> >
>
>
> I'd like to see how this is used? If the code that uses this API change
> isn't ready yet, then this patch should really wait..
This is my current patch to rework arch/powerpc/kernel/time.c to create
a clocksource. It's not ready for inclusion.
powerpc needs to keep the vdso in sync whenener settimeodfay() is
called. Adding the hook the to the clocksource structure was my way of
allowing this to happen. There are other approaches, but this seemed to
best allow for runtime. Initially I considered using update_vsyscall()
but this is called from do_timer(), and I don't need this code run then
:(
This has been booted on pSeries and iSeries (I'm using glibc 2.5, which
uses the vdso gettimeoday())
All comments appreiated.
Index: working/arch/powerpc/Kconfig
===================================================================
--- working.orig/arch/powerpc/Kconfig
+++ working/arch/powerpc/Kconfig
@@ -31,6 +31,12 @@ config MMU
bool
default y
+config GENERIC_TIME
+ def_bool y
+
+config GENERIC_TIME_VSYSCALL
+ def_bool y
+
config GENERIC_HARDIRQS
bool
default y
Index: working/arch/powerpc/kernel/time.c
===================================================================
--- working.orig/arch/powerpc/kernel/time.c
+++ working/arch/powerpc/kernel/time.c
@@ -74,6 +74,30 @@
#endif
#include <asm/smp.h>
+/* powerpc clocksource/clockevent code */
+
+/* TODO:
+ * o Code style
+ * * Variable names ... be consistent.
+ *
+ * TODO: Clocksource
+ * o Need a _USE_RTC() clocksource impelementation
+ * o xtime: Either time.c manages it, or clocksource does, not both
+ */
+
+#include <linux/clocksource.h>
+
+static struct clocksource clocksource_timebase = {
+ .name = "timebase",
+ .rating = 200,
+ .flags = CLOCK_SOURCE_IS_CONTINUOUS,
+ .mask = CLOCKSOURCE_MASK(64),
+ .shift = 22,
+ .mult = 0, /* To be filled in */
+ .read = NULL, /* To be filled in */
+ .settimeofday = NULL, /* To be filled in */
+};
+
/* keep track of when we need to update the rtc */
time_t last_rtc_update;
#ifdef CONFIG_PPC_ISERIES
@@ -376,65 +400,6 @@ static __inline__ void timer_check_rtc(v
}
}
-/*
- * This version of gettimeofday has microsecond resolution.
- */
-static inline void __do_gettimeofday(struct timeval *tv)
-{
- unsigned long sec, usec;
- u64 tb_ticks, xsec;
- struct gettimeofday_vars *temp_varp;
- u64 temp_tb_to_xs, temp_stamp_xsec;
-
- /*
- * These calculations are faster (gets rid of divides)
- * if done in units of 1/2^20 rather than microseconds.
- * The conversion to microseconds at the end is done
- * without a divide (and in fact, without a multiply)
- */
- temp_varp = do_gtod.varp;
-
- /* Sampling the time base must be done after loading
- * do_gtod.varp in order to avoid racing with update_gtod.
- */
- data_barrier(temp_varp);
- tb_ticks = get_tb() - temp_varp->tb_orig_stamp;
- temp_tb_to_xs = temp_varp->tb_to_xs;
- temp_stamp_xsec = temp_varp->stamp_xsec;
- xsec = temp_stamp_xsec + mulhdu(tb_ticks, temp_tb_to_xs);
- sec = xsec / XSEC_PER_SEC;
- usec = (unsigned long)xsec & (XSEC_PER_SEC - 1);
- usec = SCALE_XSEC(usec, 1000000);
-
- tv->tv_sec = sec;
- tv->tv_usec = usec;
-}
-
-void do_gettimeofday(struct timeval *tv)
-{
- if (__USE_RTC()) {
- /* do this the old way */
- unsigned long flags, seq;
- unsigned int sec, nsec, usec;
-
- do {
- seq = read_seqbegin_irqsave(&xtime_lock, flags);
- sec = xtime.tv_sec;
- nsec = xtime.tv_nsec + tb_ticks_since(tb_last_jiffy);
- } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
- usec = nsec / 1000;
- while (usec >= 1000000) {
- usec -= 1000000;
- ++sec;
- }
- tv->tv_sec = sec;
- tv->tv_usec = usec;
- return;
- }
- __do_gettimeofday(tv);
-}
-
-EXPORT_SYMBOL(do_gettimeofday);
/*
* There are two copies of tb_to_xs and stamp_xsec so that no
@@ -666,8 +631,8 @@ void timer_interrupt(struct pt_regs * re
if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) {
tb_last_jiffy = tb_next_jiffy;
do_timer(1);
- timer_recalc_offset(tb_last_jiffy);
- timer_check_rtc();
+ /* timer_recalc_offset() && timer_check_rtc()
+ * are now called from update_vsyscall() */
}
write_sequnlock(&xtime_lock);
}
@@ -739,77 +704,6 @@ unsigned long long sched_clock(void)
return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift;
}
-int do_settimeofday(struct timespec *tv)
-{
- time_t wtm_sec, new_sec = tv->tv_sec;
- long wtm_nsec, new_nsec = tv->tv_nsec;
- unsigned long flags;
- u64 new_xsec;
- unsigned long tb_delta;
-
- if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
- return -EINVAL;
-
- write_seqlock_irqsave(&xtime_lock, flags);
-
- /*
- * Updating the RTC is not the job of this code. If the time is
- * stepped under NTP, the RTC will be updated after STA_UNSYNC
- * is cleared. Tools like clock/hwclock either copy the RTC
- * to the system time, in which case there is no point in writing
- * to the RTC again, or write to the RTC but then they don't call
- * settimeofday to perform this operation.
- */
-#ifdef CONFIG_PPC_ISERIES
- if (firmware_has_feature(FW_FEATURE_ISERIES) && first_settimeofday) {
- iSeries_tb_recal();
- first_settimeofday = 0;
- }
-#endif
-
- /* Make userspace gettimeofday spin until we're done. */
- ++vdso_data->tb_update_count;
- smp_mb();
-
- /*
- * Subtract off the number of nanoseconds since the
- * beginning of the last tick.
- */
- tb_delta = tb_ticks_since(tb_last_jiffy);
- tb_delta = mulhdu(tb_delta, do_gtod.varp->tb_to_xs); /* in xsec */
- new_nsec -= SCALE_XSEC(tb_delta, 1000000000);
-
- wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - new_sec);
- wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - new_nsec);
-
- set_normalized_timespec(&xtime, new_sec, new_nsec);
- set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
-
- /* In case of a large backwards jump in time with NTP, we want the
- * clock to be updated as soon as the PLL is again in lock.
- */
- last_rtc_update = new_sec - 658;
-
- ntp_clear();
-
- new_xsec = xtime.tv_nsec;
- if (new_xsec != 0) {
- new_xsec *= XSEC_PER_SEC;
- do_div(new_xsec, NSEC_PER_SEC);
- }
- new_xsec += (u64)xtime.tv_sec * XSEC_PER_SEC;
- update_gtod(tb_last_jiffy, new_xsec, do_gtod.varp->tb_to_xs);
-
- vdso_data->tz_minuteswest = sys_tz.tz_minuteswest;
- vdso_data->tz_dsttime = sys_tz.tz_dsttime;
-
- write_sequnlock_irqrestore(&xtime_lock, flags);
- clock_was_set();
- return 0;
-}
-
-EXPORT_SYMBOL(do_settimeofday);
-
static int __init get_freq(char *name, int cells, unsigned long *val)
{
struct device_node *cpu;
@@ -878,6 +772,78 @@ unsigned long get_boot_time(void)
tm.tm_hour, tm.tm_min, tm.tm_sec);
}
+/* clocksource code */
+static cycle_t timebase_read(void)
+{
+ return (cycle_t)get_tb();
+}
+
+static void clocksource_settimeofday(struct clocksource *cs,
+ struct timespec *ts)
+{
+ u64 new_xsec;
+
+#ifdef CONFIG_PPC_ISERIES
+ if (firmware_has_feature(FW_FEATURE_ISERIES) && first_settimeofday) {
+ iSeries_tb_recal();
+ first_settimeofday = 0;
+ }
+#endif
+
+ /* Make userspace gettimeofday spin until we're done. */
+ ++vdso_data->tb_update_count;
+ smp_mb();
+
+ /* In case of a large backwards jump in time with NTP, we want the
+ * clock to be updated as soon as the PLL is again in lock.
+ */
+ last_rtc_update = xtime.tv_sec - 658;
+
+ new_xsec = xtime.tv_nsec;
+ if (new_xsec != 0) {
+ new_xsec *= XSEC_PER_SEC;
+ do_div(new_xsec, NSEC_PER_SEC);
+ }
+
+ new_xsec += (u64)xtime.tv_sec * XSEC_PER_SEC;
+
+ vdso_data->tz_minuteswest = sys_tz.tz_minuteswest;
+ vdso_data->tz_dsttime = sys_tz.tz_dsttime;
+
+ update_gtod(tb_last_jiffy, new_xsec, do_gtod.varp->tb_to_xs);
+}
+
+void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
+{
+ timer_recalc_offset(tb_last_jiffy);
+ timer_check_rtc();
+}
+
+void __init clocksource_init(void)
+{
+ int mult;
+
+ if (__USE_RTC())
+ return;
+
+ mult = clocksource_hz2mult(tb_ticks_per_sec,
+ clocksource_timebase.shift);
+ clocksource_timebase.mult = mult;
+
+ clocksource_timebase.read = timebase_read;
+ clocksource_timebase.settimeofday = clocksource_settimeofday;
+
+ if (clocksource_register(&clocksource_timebase)) {
+ printk(KERN_ERR "clocksource: %s is already registered\n",
+ clocksource_timebase.name);
+ return;
+ }
+
+ printk(KERN_INFO "clocksource: %s mult[%x] shift[%d] registered\n",
+ clocksource_timebase.name,
+ clocksource_timebase.mult, clocksource_timebase.shift);
+}
+
/* This function is only called on the boot processor */
void __init time_init(void)
{
@@ -999,6 +965,9 @@ void __init time_init(void)
-xtime.tv_sec, -xtime.tv_nsec);
write_sequnlock_irqrestore(&xtime_lock, flags);
+ /* Register the clocksource */
+ clocksource_init();
+
/* Not exact, but the timer interrupt takes care of this */
set_dec(tb_ticks_per_jiffy);
}
Yours Tony
linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!
^ permalink raw reply
* [PATCH 2.6.22] Fix powermac late initcall to only run when required.
From: Tony Breeds @ 2007-06-20 5:17 UTC (permalink / raw)
To: LinuxPPC-dev; +Cc: sfr, Olaf Hering
From: Tony Breeds <tony@bakeyournoodle.com>
Fix powermac late initcall to only run when required.
Current ppc64_defconfig kernel fail to boo on iSeries dieing with:
---
NET: Registered protocol family 17
Unable to handle kernel paging request for data at address 0x00000000
Faulting instruction address: 0xc00000000071b258
Oops: Kernel access of bad area, sig: 11 [#1]
SMP NR_CPUS=32 iSeries
<snip>
NIP [c00000000071b258] .iSeries_src_init+0x34/0x64
LR [c000000000701bb4] .kernel_init+0x1fc/0x3bc
Call Trace:
[c000000007d0be30] [0000000000008000] 0x8000 (unreliable)
[c000000007d0bea0] [c000000000701bb4] .kernel_init+0x1fc/0x3bc
[c000000007d0bf90] [c0000000000262d4] .kernel_thread+0x4c/0x68
Instruction dump:
e922cba8 3880ffff 78840420 f8010010 f821ff91 60000000 e8090000 78095fe3
4182002c e922cb58 e862cbb0 e9290140 <e8090000> f8410028 7c0903a6 e9690010
Kernel panic - not syncing: Attempted to kill init!
---
This is because powermac is unconditionally sets ppc_md.progress to NULL.
This patch makes sure the powermac late initcall is only run on powermac
machines.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
arch/powerpc/platforms/powermac/setup.c | 3 +++
1 file changed, 3 insertions(+)
Index: working/arch/powerpc/platforms/powermac/setup.c
===================================================================
--- working.orig/arch/powerpc/platforms/powermac/setup.c 2007-06-20 14:55:27.000000000 +1000
+++ working/arch/powerpc/platforms/powermac/setup.c 2007-06-20 14:59:48.000000000 +1000
@@ -454,6 +454,9 @@ static int initializing = 1;
static int pmac_late_init(void)
{
+ if (!machine_is(powermac))
+ return -ENODEV;
+
initializing = 0;
/* this is udbg (which is __init) and we can later use it during
* cpu hotplug (in smp_core99_kick_cpu) */
^ permalink raw reply
* Please pull from 'for_linus' branch
From: Kumar Gala @ 2007-06-20 3:55 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linuxppc-dev, Paul Mackerras, linux-kernel
Linus,
Please pull from 'for_linus' branch at
master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git for_linus
To get a fix for 2.6.22 to the rheap allocator that was causing multiple
instances of the UCC ethernet driver to fail because it was running out of
memory due to wasting space for aligned requests.
Thanks,
Kumar.
arch/powerpc/lib/rheap.c | 48 ++++++++++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 19 deletions(-)
commit 7c8545e98468c53809fc06788a3b9a34dff05240
Author: Li Yang <leoli@freescale.com>
Date: Mon Jun 18 19:29:21 2007 +0800
[POWERPC] rheap - eliminates internal fragments caused by alignment
The patch adds fragments caused by rh_alloc_align() back to free list, instead
of allocating the whole chunk of memory. This will greatly improve memory
utilization managed by rheap.
It solves MURAM not enough problem with 3 UCCs enabled on MPC8323.
Signed-off-by: Li Yang <leoli@freescale.com>
Acked-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
^ permalink raw reply
* [PATCH/RFC] Make certain timekeeping variables __read_mostly
From: Tony Breeds @ 2007-06-20 3:13 UTC (permalink / raw)
To: LinuxPPC-dev
In-Reply-To: <20070620020211.GO9768@bakeyournoodle.com>
On Wed, Jun 20, 2007 at 12:02:11PM +1000, Tony Breeds wrote:
> Also this patch makes tb_to_ns_scale and tb_to_ns_shift static for good
> measure.
While we're ate it these 3 variables can be marked __read_mostly.
Depends on previous patch.
From: Tony Breeds <tony@bakeyournoodle.com>
These really are read mostly as they're only written to in time_init()
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
There looks to be other variables that can be made read_mostly, I think
that's a job for another day though (perhaps while doing the static cleanup).
arch/powerpc/kernel/time.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: working/arch/powerpc/kernel/time.c
===================================================================
--- working.orig/arch/powerpc/kernel/time.c 2007-06-20 12:08:27.000000000 +1000
+++ working/arch/powerpc/kernel/time.c 2007-06-20 12:08:32.000000000 +1000
@@ -113,9 +113,9 @@ u64 ticklen_to_xs; /* 0.64 fraction */
DEFINE_SPINLOCK(rtc_lock);
EXPORT_SYMBOL_GPL(rtc_lock);
-static u64 tb_to_ns_scale;
-static unsigned tb_to_ns_shift;
-static unsigned long boot_tb;
+static u64 tb_to_ns_scale __read_mostly;
+static unsigned tb_to_ns_shift __read_mostly;
+static unsigned long boot_tb __read_mostly;
struct gettimeofday_struct do_gtod;
Yours Tony
linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!
^ permalink raw reply
* Re: [Cbe-oss-dev] [patch 2/5] Add support to OProfile for profiling Cell/B.E. SPUs
From: mita @ 2007-06-20 2:32 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, linuxppc-dev, paulus, Maynard Johnson, cbe-oss-dev,
Carl Love
In-Reply-To: <20070618224923.221791941@arndb.de>
> +static enum hrtimer_restart profile_spus(struct hrtimer * timer)
> +{
> + ktime_t kt;
> + int cpu, node, k, num_samples, spu_num;
> +
> + if (!spu_prof_running)
> + goto stop;
> +
> + for_each_online_cpu(cpu) {
> + if (cbe_get_hw_thread_id(cpu))
> + continue;
> +
> + node = cbe_cpu_to_node(cpu);
> +
> + /* There should only be on kernel thread at a time processing
> + * the samples. In the very unlikely case that the processing
> + * is taking a very long time and multiple kernel threads are
> + * started to process the samples. Make sure only one kernel
> + * thread is working on the samples array at a time. The
> + * sample array must be loaded and then processed for a given
> + * cpu. The sample array is not per cpu.
> + */
> + spin_lock_irqsave(&sample_array_lock,
> + sample_array_lock_flags);
> + num_samples = cell_spu_pc_collection(cpu);
> +
> + if (num_samples == 0) {
> + spin_unlock_irqrestore(&sample_array_lock,
> + sample_array_lock_flags);
> + continue;
> + }
> +
> + for (k = 0; k < SPUS_PER_NODE; k++) {
> + spu_num = k + (node * SPUS_PER_NODE);
> + spu_sync_buffer(spu_num,
> + samples + (k * TRACE_ARRAY_SIZE),
> + num_samples);
> + }
> +
> + spin_unlock_irqrestore(&sample_array_lock,
> + sample_array_lock_flags);
> +
> + }
> + smp_wmb();
> +
> + kt = ktime_set(0, profiling_interval);
> + if (!spu_prof_running)
> + goto stop;
> + hrtimer_forward(timer, timer->base->get_time(), kt);
> + return HRTIMER_RESTART;
> +
> + stop:
> + printk(KERN_INFO "SPU_PROF: spu-prof timer ending\n");
> + return HRTIMER_NORESTART;
> +}
> +
> +static struct hrtimer timer;
> +/*
> + * Entry point for SPU profiling.
> + * NOTE: SPU profiling is done system-wide, not per-CPU.
> + *
> + * cycles_reset is the count value specified by the user when
> + * setting up OProfile to count SPU_CYCLES.
> + */
> +void start_spu_profiling(unsigned int cycles_reset) {
> +
> + ktime_t kt;
> +
> + pr_debug("timer resolution: %lu\n",
> + TICK_NSEC);
> + kt = ktime_set(0, profiling_interval);
> + hrtimer_init(&timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> + timer.expires = kt;
> + timer.function = profile_spus;
> +
> + /* Allocate arrays for collecting SPU PC samples */
> + samples = (u32 *) kzalloc(SPUS_PER_NODE *
> + TRACE_ARRAY_SIZE * sizeof(u32), GFP_KERNEL);
> +
- Unnecessary cast for kzalloc().
- Allocation failure is ignored here. But there is no error handling
in timer fuction (profile_spus), too.
> + spu_prof_running = 1;
> + hrtimer_start(&timer, kt, HRTIMER_MODE_REL);
> +}
> +
^ permalink raw reply
* CAN YOU HELLP ME
From: volcano @ 2007-06-20 2:20 UTC (permalink / raw)
To: linuxppc-embedded
hello my dear friend:
I have read the u-boot last week ,and thank you for all your kind help.My
linux code is based on MPC8260,so I want to continue the read of the
linux2.6.18 based on mpc8260.can you give me some kind suggestions about how
to read all these codes clearly.,and if some reference is given would be
welcome.
yours volcano
^ permalink raw reply
* Re: [PATCH/RFC] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane.
From: Olof Johansson @ 2007-06-20 2:27 UTC (permalink / raw)
To: Tony Breeds; +Cc: LinuxPPC-dev
In-Reply-To: <20070620020211.GO9768@bakeyournoodle.com>
On Wed, Jun 20, 2007 at 12:02:11PM +1000, Tony Breeds wrote:
> On Tue, Jun 19, 2007 at 09:53:56AM -0500, Olof Johansson wrote:
>
> > It only seems to be used in this file, so it can be static, right?
>
> True, I was following suit with tb_to_ns_scale, tb_to_ns_shift which
> could also be static.
I wasn't sure of those since I was only looking at the patch in question,
not the full source file. But yes, that's the right thing to do.
> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Acked-by: Olof Johansson <olof@lixom.net>
-Olof
^ permalink raw reply
* Re: [PATCH/RFC] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane.
From: Tony Breeds @ 2007-06-20 2:02 UTC (permalink / raw)
To: Olof Johansson; +Cc: LinuxPPC-dev
In-Reply-To: <20070619145356.GA20382@lixom.net>
On Tue, Jun 19, 2007 at 09:53:56AM -0500, Olof Johansson wrote:
> It only seems to be used in this file, so it can be static, right?
True, I was following suit with tb_to_ns_scale, tb_to_ns_shift which
could also be static.
Here's an updated patch that makes them all static and updates the
commit message as well.
From: Tony Breeds <tony@bakeyournoodle.com>
Modify sched_clock() to make CONFIG_PRINTK_TIME more sane.
When booting a current kernel with CONFIG_PRINTK_TIME enabled you'll
see messages like:
[ 0.000000] time_init: decrementer frequency = 188.044000 MHz
[ 0.000000] time_init: processor frequency = 1504.352000 MHz
[3712914.436297] Console: colour dummy device 80x25
This cause by the initialisation of tb_to_ns_scale in time_init(), suddenly the
multiplication in sched_clock() now does something :). This patch modifies
sched_clock() to report the offset since the machine booted so the same
printk's now look like:
[ 0.000000] time_init: decrementer frequency = 188.044000 MHz
[ 0.000000] time_init: processor frequency = 1504.352000 MHz
[ 0.000135] Console: colour dummy device 80x25
Effectively including the uptime in printk()s.
Also this patch makes tb_to_ns_scale and tb_to_ns_shift static for good
measure.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
There looks to be other variables that could be made static, I think
that's a job for another day though.
arch/powerpc/kernel/time.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
Index: working/arch/powerpc/kernel/time.c
===================================================================
--- working.orig/arch/powerpc/kernel/time.c
+++ working/arch/powerpc/kernel/time.c
@@ -113,8 +113,9 @@ u64 ticklen_to_xs; /* 0.64 fraction */
DEFINE_SPINLOCK(rtc_lock);
EXPORT_SYMBOL_GPL(rtc_lock);
-u64 tb_to_ns_scale;
-unsigned tb_to_ns_shift;
+static u64 tb_to_ns_scale;
+static unsigned tb_to_ns_shift;
+static unsigned long boot_tb;
struct gettimeofday_struct do_gtod;
@@ -735,7 +736,7 @@ unsigned long long sched_clock(void)
{
if (__USE_RTC())
return get_rtc();
- return mulhdu(get_tb(), tb_to_ns_scale) << tb_to_ns_shift;
+ return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift;
}
int do_settimeofday(struct timespec *tv)
@@ -960,6 +961,8 @@ void __init time_init(void)
}
tb_to_ns_scale = scale;
tb_to_ns_shift = shift;
+ /* Save the current timebase to pretty up CONFIG_PRINTK_TIME */
+ boot_tb = get_tb();
tm = get_boot_time();
Yours Tony
linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!
^ permalink raw reply
* [PATCH 1/1] Make the debugfs "powerpc" dir globally accessible
From: Michael Ellerman @ 2007-06-20 0:54 UTC (permalink / raw)
To: linuxppc-dev
The prom.c debugging code creates a "powerpc" directory in debugfs,
which is nice, but doesn't allow any other debugging code to stick things
under "powerpc" in debugfs. So make it global.
While we're there we should make the prom.c debugging code depend on
CONFIG_DEBUG_FS, because it doesn't work otherwise.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
I should probably mention, if the root creation fails we'll end up with
the "flat-device-tree" file sitting in the root of debugfs, which is not
quite what we wanted - but good enough.
arch/powerpc/kernel/prom.c | 9 +++------
arch/powerpc/kernel/setup-common.c | 13 +++++++++++++
include/asm-powerpc/system.h | 2 ++
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index af42dda..e36b21c 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -52,6 +52,7 @@
#include <asm/pSeries_reconfig.h>
#include <asm/pci-bridge.h>
#include <asm/kexec.h>
+#include <asm/system.h>
#ifdef DEBUG
#define DBG(fmt...) printk(KERN_ERR fmt)
@@ -1716,22 +1717,18 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
}
EXPORT_SYMBOL(of_get_cpu_node);
-#ifdef DEBUG
+#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
static struct debugfs_blob_wrapper flat_dt_blob;
static int __init export_flat_device_tree(void)
{
struct dentry *d;
- d = debugfs_create_dir("powerpc", NULL);
- if (!d)
- return 1;
-
flat_dt_blob.data = initial_boot_params;
flat_dt_blob.size = initial_boot_params->totalsize;
d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
- d, &flat_dt_blob);
+ powerpc_debugfs_root, &flat_dt_blob);
if (!d)
return 1;
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index ed07a19..3a08f4e 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -32,6 +32,7 @@
#include <linux/unistd.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
+#include <linux/debugfs.h>
#include <asm/io.h>
#include <asm/prom.h>
#include <asm/processor.h>
@@ -571,3 +572,15 @@ static int __init check_cache_coherency(void)
late_initcall(check_cache_coherency);
#endif /* CONFIG_CHECK_CACHE_COHERENCY */
+
+#ifdef CONFIG_DEBUG_FS
+struct dentry *powerpc_debugfs_root;
+
+static int powerpc_debugfs_init(void)
+{
+ powerpc_debugfs_root = debugfs_create_dir("powerpc", NULL);
+
+ return powerpc_debugfs_root == NULL;
+}
+arch_initcall(powerpc_debugfs_init);
+#endif
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 09621f6..464b9c5 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -559,5 +559,7 @@ static inline void create_function_call(unsigned long addr, void * func)
extern void account_system_vtime(struct task_struct *);
#endif
+extern struct dentry *powerpc_debugfs_root;
+
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_SYSTEM_H */
--
1.5.1.3.g7a33b
^ permalink raw reply related
* [PATCH v2] Create add_rtc() function to enable the RTC CMOS driver
From: Wade Farnsworth @ 2007-06-20 0:15 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In order to use the RTC CMOS driver, each architecture must register a
platform device for the RTC.
This creates a function to register the platform device based on the RTC
device node and verifies that the RTC port against the hard-coded value
in asm/mc146818rtc.h. It also sets the RTC to 24-hr mode as 12-hr mode
is not currently supported by the driver.
Signed-off-by: Wade Farnsworth <wfarnsworth@mvista.com>
---
arch/powerpc/sysdev/Makefile | 1
arch/powerpc/sysdev/rtc_cmos_setup.c | 54 +++++++++++++++++++++++++
2 files changed, 55 insertions(+)
Index: linux-2.6-powerpc-8641/arch/powerpc/sysdev/Makefile
===================================================================
--- linux-2.6-powerpc-8641.orig/arch/powerpc/sysdev/Makefile
+++ linux-2.6-powerpc-8641/arch/powerpc/sysdev/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pc
obj-$(CONFIG_QUICC_ENGINE) += qe_lib/
mv64x60-$(CONFIG_PCI) += mv64x60_pci.o
obj-$(CONFIG_MV64X60) += $(mv64x60-y) mv64x60_pic.o mv64x60_dev.o
+obj-$(CONFIG_RTC_DRV_CMOS) += rtc_cmos_setup.o
# contains only the suspend handler for time
obj-$(CONFIG_PM) += timer.o
Index: linux-2.6-powerpc-8641/arch/powerpc/sysdev/rtc_cmos_setup.c
===================================================================
--- /dev/null
+++ linux-2.6-powerpc-8641/arch/powerpc/sysdev/rtc_cmos_setup.c
@@ -0,0 +1,54 @@
+/*
+ * Setup code for PC-style Real-Time Clock.
+ *
+ * Author: Wade Farnsworth <wfarnsworth@mvista.com>
+ *
+ * 2007 (c) MontaVista Software, Inc. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/mc146818rtc.h>
+
+#include <asm/prom.h>
+
+static int __init add_rtc(void)
+{
+ struct device_node *np;
+ struct platform_device *pd;
+ struct resource res;
+
+ np = of_find_compatible_node(NULL, NULL, "pnpPNP,b00");
+ if (!np)
+ return -ENODEV;
+
+ if (of_address_to_resource(np, 0, &res)) {
+ of_node_put(np);
+ return -ENODEV;
+ }
+
+ /*
+ * RTC_PORT(x) is hardcoded in asm/mc146818rtc.h. Verify that the
+ * address provided by the device node matches.
+ */
+ if (res.start != RTC_PORT(0)) {
+ of_node_put(np);
+ return -ENODEV;
+ }
+
+ pd = platform_device_register_simple("rtc_cmos", -1,
+ &res, 1);
+ of_node_put(np);
+ if (IS_ERR(pd))
+ return PTR_ERR(pd);
+
+ /* rtc-cmos only supports 24-hr mode */
+ CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_24H, RTC_CONTROL);
+
+ return 0;
+}
+fs_initcall(add_rtc);
^ permalink raw reply
* [PATCH] Fix I8042 IRQs on MPC8641 HPCN
From: Wade Farnsworth @ 2007-06-20 0:15 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
The I8042 mouse on the MPC8641 HPCN needs to use IRQ 12, which is
currently in use by some PCI devices. This moves those devices to IRQ
11 and reserves IRQ 12 for the mouse.
Also, set IRQ 1 and IRQ 12 as legacy IRQs in the ULI 1575 legacy bridge
in order to make the I8042 devices functional.
Signed-off-by: Wade Farnsworth <wfarnsworth@mvista.com>
---
Note that the previous version of this patch also set up the Super I/O
registers. I have removed that setup code, as there was some
reservations about doing such low-level setup in the kernel.
arch/powerpc/boot/dts/mpc8641_hpcn.dts | 4 ++--
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 14 +++++++-------
Index: linux-2.6-powerpc-8641/arch/powerpc/boot/dts/mpc8641_hpcn.dts
===================================================================
--- linux-2.6-powerpc-8641.orig/arch/powerpc/boot/dts/mpc8641_hpcn.dts
+++ linux-2.6-powerpc-8641/arch/powerpc/boot/dts/mpc8641_hpcn.dts
@@ -268,7 +268,7 @@
/* IDSEL 0x1c */
e000 0 0 1 &i8259 9 2
e000 0 0 2 &i8259 a 2
- e000 0 0 3 &i8259 c 2
+ e000 0 0 3 &i8259 b 2
e000 0 0 4 &i8259 7 2
/* IDSEL 0x1d */
@@ -278,7 +278,7 @@
e800 0 0 4 &i8259 0 0
/* IDSEL 0x1e */
- f000 0 0 1 &i8259 c 2
+ f000 0 0 1 &i8259 b 2
f000 0 0 2 &i8259 0 0
f000 0 0 3 &i8259 0 0
f000 0 0 4 &i8259 0 0
Index: linux-2.6-powerpc-8641/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
===================================================================
--- linux-2.6-powerpc-8641.orig/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ linux-2.6-powerpc-8641/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -141,7 +141,7 @@ const unsigned char uli1575_irq_route_ta
0x1, /* 9: 0b0001 */
0x3, /* 10: 0b0011 */
0x9, /* 11: 0b1001 */
- 0xb, /* 12: 0b1011 */
+ 0, /* 12: Reserved */
0, /* 13: Reserved */
0xd, /* 14, 0b1101 */
0xf, /* 15, 0b1111 */
@@ -211,7 +211,7 @@ static void __devinit quirk_uli1575(stru
pirq_map_word |= (uli1575_irq_route_table[i] & 0xf)
<< ((irq2pin[i] - PIRQA) * 4);
- /* ULI1575 IRQ mapping conf register default value is 0xb9317542 */
+ /* ULI1575 IRQ mapping conf register default value is 0x09317542 */
DBG("Setup ULI1575 IRQ mapping configuration register value = 0x%x\n",
pirq_map_word);
pci_write_config_dword(dev, 0x48, pirq_map_word);
@@ -266,9 +266,9 @@ static void __devinit quirk_uli1575(stru
pci_write_config_byte(dev, 0x44, 0x30 | uli1575_irq_route_table[14]);
pci_write_config_byte(dev, 0x75, uli1575_irq_route_table[15]);
- /* Set IRQ14 and IRQ15 to legacy IRQs */
+ /* Set IRQ1, IRQ12, IRQ14 and IRQ15 to legacy IRQs */
pci_read_config_word(dev, 0x46, &temp);
- temp |= 0xc000;
+ temp |= 0xd002;
pci_write_config_word(dev, 0x46, temp);
/* Set i8259 interrupt trigger
@@ -280,12 +280,12 @@ static void __devinit quirk_uli1575(stru
* IRQ 9: Level
* IRQ 10: Level
* IRQ 11: Level
- * IRQ 12: Level
+ * IRQ 12: Edge
* IRQ 14: Edge
* IRQ 15: Edge
*/
- outb(0xfa, 0x4d0);
- outb(0x1e, 0x4d1);
+ outb(0xf8, 0x4d0);
+ outb(0x0e, 0x4d1);
#undef ULI1575_SET_DEV_IRQ
^ permalink raw reply
* [PATCH] Add a check for keyboard/mouse device nodes in check_legacy_ioport()
From: Wade Farnsworth @ 2007-06-20 0:15 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
The device tree for the MPC8641 HPCN does not implement the device type
property for I8042 nodes.
In addition to checking the I8042 node's device type, also match the
keyboard and/or mouse nodes' compatible property.
Signed-off-by: Wade Farnsworth <wfarnsworth@mvista.com>
---
The previous version of this patch also removed the device type test.
This version keeps the test, per Segher's comments.
arch/powerpc/kernel/setup-common.c | 8 ++++++++
1 file changed, 8 insertions(+)
Index: linux-2.6-powerpc-8641/arch/powerpc/kernel/setup-common.c
===================================================================
--- linux-2.6-powerpc-8641.orig/arch/powerpc/kernel/setup-common.c
+++ linux-2.6-powerpc-8641/arch/powerpc/kernel/setup-common.c
@@ -486,6 +486,14 @@ int check_legacy_ioport(unsigned long ba
switch(base_port) {
case I8042_DATA_REG:
+ if (!(np = of_find_compatible_node(NULL, NULL, "pnpPNP,303")))
+ np = of_find_compatible_node(NULL, NULL, "pnpPNP,f03");
+ if (np) {
+ parent = of_get_parent(np);
+ of_node_put(np);
+ np = parent;
+ break;
+ }
np = of_find_node_by_type(NULL, "8042");
break;
case FDC_BASE: /* FDC1 */
^ permalink raw reply
* Re: [PATCH] rheap: eliminates internal fragments caused by alignment
From: Kumar Gala @ 2007-06-19 23:04 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: linuxppc-dev Development, Li Yang, Paul, Vitaly Bordug
In-Reply-To: <1182269845.2969.117.camel@gentoo-jocke.transmode.se>
On Tue, 19 Jun 2007, Joakim Tjernlund wrote:
> On Mon, 2007-06-18 at 13:48 +0200, Joakim Tjernlund wrote:
> > On Mon, 2007-06-18 at 19:29 +0800, Li Yang wrote:
> > > The patch adds fragments caused by rh_alloc_align() back to free list, instead
> > > of allocating the whole chunk of memory. This will greatly improve memory
> > > utilization managed by rheap.
> > >
> > > It solves MURAM not enough problem with 3 UCCs enabled on MPC8323.
> > >
> > > Signed-off-by: Li Yang <leoli@freescale.com>
> > > ---
> >
> > For what it is worth:
> > I have tested this patch and it solves the problem with 3 UCCs
> > as ethernet for me. This fixes a regression introduced after 2.6.20
> > Please consider for 2.6.22
> > Acked-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
>
> I noticed Paulus pull request to Linus and this patch wasn't
> included. I really want to see it included.
>
I'll push (or request pull) from Linus tonight for this to go into 2.6.22
- k
^ permalink raw reply
* Re: [Cbe-oss-dev] [patch 3/5] cell: updated driver for DDR2 memory on AXON
From: Arnd Bergmann @ 2007-06-19 23:03 UTC (permalink / raw)
To: cbe-oss-dev; +Cc: Akinobu Mita, linuxppc-dev
In-Reply-To: <20070619154812.GA20347@ps3linux.grid.fixstars.com>
On Tuesday 19 June 2007, Akinobu Mita wrote:
> > + if (of_address_to_resource(device->node, 0, &resource) != 0) {
> > + dev_err(&device->dev, "Cannot access device tree\n");
> > + rc = -EFAULT;
> > + goto failed;
> > + }
>
> of_address_to_resource() returns error code on failure:
>
> rc = of_address_to_resource(device->node, 0, &resource);
> if (rc) {
> dev_err(&device->dev, "Cannot access device tree\n");
> goto failed;
> }
>
> is better.
Right.
> > + bank->ph_addr = resource.start;
> > + bank->io_addr = (unsigned long) ioremap_flags(
> > + bank->ph_addr, bank->size, _PAGE_NO_CACHE);
> > + if (bank->io_addr == 0) {
> > + dev_err(&device->dev, "ioremap() failed\n");
> > + rc = -EFAULT;
> > + goto failed;
> > + }
> > +
> > + bank->disk = alloc_disk(AXON_RAM_MINORS_PER_DISK);
> > + if (bank->disk == NULL) {
> > + dev_err(&device->dev, "Cannot register disk\n");
> > + rc = -EFAULT;
> > + goto failed;
> > + }
>
> -ENOMEM is better than -EFAULT. Because alloc_disk() failure happens
> only when it runs out of memory.
yes. EFAULT should only be used when an access to user memory has failed,
so it's wrong practically everywhere in here, your other comments are
obviously correct as well.
Arnd <><
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox