* [kernel-2.6.15] Fix PCI irq mapping for lite5200
From: Andrey Volkov @ 2006-01-12 8:34 UTC (permalink / raw)
To: Sylvain Munaut; +Cc: LKML, ML linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 151 bytes --]
Hi Sylvain,
This patch fix problem of PCI boards irq mapping on lite5200
(raised after your changes of MPC52xx_IRQ0 number)
--
Regards
Andrey Volkov
[-- Attachment #2: 01-lite5200_map_irq-fix.diff --]
[-- Type: text/plain, Size: 678 bytes --]
lite5200_map_irq: Fix irq mapping for external PCI boards
Signed-off-by: Andrey Volkov <avolkov@varma-el.com>
---
arch/ppc/platforms/lite5200.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/ppc/platforms/lite5200.c b/arch/ppc/platforms/lite5200.c
index 7ed52dc..cd4acb3 100644
--- a/arch/ppc/platforms/lite5200.c
+++ b/arch/ppc/platforms/lite5200.c
@@ -73,7 +73,8 @@ lite5200_show_cpuinfo(struct seq_file *m
static int
lite5200_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
{
- return (pin == 1) && (idsel==24) ? MPC52xx_IRQ0 : -1;
+ /* Only INTA supported */
+ return (pin == 1) ? MPC52xx_IRQ0 : -1;
}
#endif
^ permalink raw reply related
* Re: AGPGART driver for ArticiaS - ioremap() problem
From: Gerhard Pircher @ 2006-01-12 8:15 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, debian-powerpc
In-Reply-To: <1137041067.7774.25.camel@localhost.localdomain>
Hi,
> --- Ursprüngliche Nachricht ---
> Von: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> An: Gerhard Pircher <gerhard_stamer@gmx.net>
> Kopie: linuxppc-dev@ozlabs.org, debian-powerpc@lists.debian.org
> Betreff: Re: AGPGART driver for ArticiaS - ioremap() problem
> Datum: Thu, 12 Jan 2006 15:44:27 +1100
>
> On Wed, 2006-01-11 at 22:00 +0100, Gerhard Pircher wrote:
> > Hi,
> >
> > David Bentam and I are trying to get a AGPGART driver working for the
> > AmigaOne and the Pegasos1. The driver detects the aperture size of the
> > ArticiaS AGP bridge, but fails at the ioremap() function in the generic
> > GATT table create function. Does the PowerPC platform behaves
> > differently for the mapping of address location for AGP operation than
> > the x86 platform? Is it possible to use a mask to relocate the AGP
> > address space to a specific location?
>
> Well, what value are you passing to ioremap ?
>
> Ben.
>
Please take a look at the end of my previous mail, where I included the
debug messages of the driver and the driver code itself. The log shows that
the physical address is mapped (IMHO) to the PCI memory range (>
0x0c0000000). Is this correct? Shouldn't it be mapped to the system memory
address range?
The aperture size is 4MB, page_order should be 1 and num_entries = 1024.
Hope this helps!? :-)
Thanks!
Regards,
Gerhard
--
DSL-Aktion wegen großer Nachfrage bis 28.2.2006 verlängert:
GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl
^ permalink raw reply
* Re: Ethernet not initialized: Help req
From: Wolfgang Denk @ 2006-01-12 7:39 UTC (permalink / raw)
To: batsayan.das; +Cc: Linuxppc-embedded
In-Reply-To: <OF08F91C71.313412E8-ON652570F4.001BB5F4-652570F4.001CF070@tcs.com>
In message <OF08F91C71.313412E8-ON652570F4.001BB5F4-652570F4.001CF070@tcs.com> you wrote:
>
> BTW, is there any tool/test case available to test the ethernet driver for
> a long period of time?
Mount the root file system over NFS, and compile the Linux kernel on
the target. Repeat for as long as you like.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Wait! You have not been prepared!
-- Mr. Atoz, "Tomorrow is Yesterday", stardate 3113.2
^ permalink raw reply
* Re: Question about SPI based CAN controller for MPC8260
From: Wolfgang Denk @ 2006-01-12 7:37 UTC (permalink / raw)
To: David Tao; +Cc: Linuxppc-embedded
In-Reply-To: <20060112043050.18822.qmail@web32102.mail.mud.yahoo.com>
In message <20060112043050.18822.qmail@web32102.mail.mud.yahoo.com> you wrote:
>
> 1. Is it possible to add CAN to MPC8270 with SPI interface using the MCP2515? Is there any better solution for the job?
It may be technically possible, but it is IMHO not a good idea. SPI
on the MPC8xx / MPC82xx is implemented in software (microcode)
running on the CPM, and runs with the lowest priority there. This can
cause (and has caused) serious problems for example in situations
where ther CPM is working under high load, etc.
It's much easier to interface one of the common CAN controllers (for
which drivers are available, too).
> 2. If yes, is there any such linux driver?
Never heard of it.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Unix is supported by IBM, like a hanging man is supported by rope.
- Don Libes & Sandy Ressler: _Life With Unix_
^ permalink raw reply
* About MMU setting in MPC8245
From: happa @ 2006-01-12 6:45 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]
Hi, Mark,
Thanks for your information.
>Are you in PCI host mode? If so, the first sentence of chapter 3--
>Address Maps of the 8245 manual states:
> "The MPC8245 in PCI host mode supports an address mapping
> configuration that is designated as address map B."
>Map B == CHRP mapping.
Yes, my CPU is in PCI host mode, and my address is use Map B.
I'm figure out my problem.
My kernel seems work fine until it calling run_init_process("/sbin/init").
run_init_process("/sbin/init")
|
v
..wait until the file got from NFS .....
|
v
load_elf_binary()
|
v
flush_old_exec()
|
v
exec_mmap()
|
v
activate_mm() ---> After this function is called any virtual memory operations
(access address out of my physical dram range), will let kernel jump into exception mode.
"Oops: kernel access of bad area, sig: 11 [#2]"
So I guess the problem is relative to mmu setting.
Would you give me any idea which part I need to check?
Thanks.
/Wen
^ permalink raw reply
* Re: Re: Can ELDK 3.1.1 compile Linux 2.6 Kernel?
From: Lo Chun Chung @ 2006-01-12 6:10 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: linuxppc-embedded
In-Reply-To: <20060111203725.28A82352B1E@atlas.denx.de>
[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]
Thanks.
I am looking forward to this.
Wolfgang Denk <wd@denx.de> 說:
In message <20060111083657.77699.qmail@web53707.mail.yahoo.com> you wrote:
>
> I just downloaded ELDK 3.1.1 (from denx) and LINUX kernel 2.6 (from kernel.org), and I compile the kernel for powerpc arch.
>
> but during I compile to the file under the directory vdso32, the following compile errors occur:
>
> arch/powerpc/kernel/vdso32/gettimeofday.S: Assembler messages:
> arch/powerpc/kernel/vdso32/gettimeofday.S:28: Error: unknown pseudo-op: `.cfi_startproc'
...
Yes, they changed the Linux kernel such that it cannot be compiled
any more using binutils version 2.14 which is used in ELDK 3.x
> What's wrong with my compiler? Or ELDK cannot compile 2.6 kernel? What I can do now?
Please wait until the end of the week, then download ELDK 4.0, then
be happy ;-)
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
"To IBM, 'open' means there is a modicum of interoperability among
some of their equipment." - Harv Masterson
Best regards,
Chung
_______________________________________
YM - 離線訊息
就算你沒有上網,你的朋友仍可以留下訊息給你,當你上網時就能立即看到,任何說話都冇走失。
http://messenger.yahoo.com.hk
[-- Attachment #2: Type: text/html, Size: 1651 bytes --]
^ permalink raw reply
* Linux 2.4.21 Embedded PPC 405 on Xilinx Virtex II pro is glaciarly slow
From: andrew.l.bomber @ 2006-01-12 0:51 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mullenp
[-- Attachment #1.1: Type: text/plain, Size: 485 bytes --]
Hello,
I am running 2.4.21 on an embedded PPC 405 system, 125 MHz clock, 32 MB
SDRAM. It currently only has a UART and ttys00 is its console. It is
running the busy box monolithic binaries. It is so slow that I have to
be cautious not to overrun the 16 byte UART 16550 input buffer. Has
anyone run into this problem before? Any ideas what might cause this or
how to troubleshoot it. I am kind of new to Linux and PPC.
<<hypertermCaptureBBprompt.txt>>
Thanks,
Andrew
[-- Attachment #1.2: Type: text/html, Size: 1290 bytes --]
[-- Attachment #2: hypertermCaptureBBprompt.txt --]
[-- Type: text/plain, Size: 3746 bytes --]
loaded at: 00400000 005EA1E4
board data at: 005E713C 005E7154
relocated to: 00405624 0040563C
zimage at: 00405B44 00456755
initrd at: 00457000 005E68E3
avail ram: 005EB000 02000000
Linux/PPC load: console=ttyS0,115200 root=/dev/ram0
Uncompressing Linux...done.
Now booting the kernel
id mach(): done
MMU:enter
MMU:hw init
MMU:mapin
MMU:mapin_ram done
MMU:setio
MMU:exit
Linux version 2.4.26 (pm@mars) (gcc version 3.3.3 (DENX ELDK 3.1.1 3.3.3-9)) #9
Sun Jan 8 16:42:35 PST 2006
setup_arch: enter
setup_arch: bootmem
Xilinx Virtex-II Pro port (C) 2002 MontaVista Software, Inc. (source@mvista.com)
arch: exit
On node 0 totalpages: 8192
zone(0): 8192 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: console=ttyS0,115200 root=/dev/ram0
Xilinx INTC #0 at 0x81010000 mapped to 0xFDFFE000
Calibrating delay loop... 399.76 BogoMIPS
Memory: 29948k available (596k kernel code, 196k data, 36k init, 0k highmem)
Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 8192 (order: 3,
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Starting kswapd
Serial driver version 5.05c (2001-07-08) with no serial options enabled
ttyS00 at 0xfdfff003 (irq = 31) is a 16550A
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
RAMDISK: Compressed image found at block 0
Freeing initrd memory: 1598k freed
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused kernel memory: 36k init
BusyBox v0.60.5 (2005.03.07-10:03+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.
# killall xinetd
# ls
bin dev etc ftp home lib proc sbin tmp usr var
# ttyS: 1 input overrun(s)
wch
# echo "hello worrld"
hello worrld
#ps
PID TTY Uid Size State Command
1 root 1832 S init
2 root 0 S [keventd]
3 root 0 S [ksoftirqd_CPU0]
4 root 0 S [kswapd]
5 root 0 S [bdflush]
6 root 0 S [kupdated]
15 ttyS0 root 1880 S -sh
19 ttyS0 root 1940 R ps
# top -b -n 1
top: not found
^ permalink raw reply
* Re: Ethernet not initialized: Help req
From: batsayan.das @ 2006-01-12 5:16 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: Linuxppc-embedded
In-Reply-To: <20060111203434.1D928352B1E@atlas.denx.de>
[-- Attachment #1: Type: text/plain, Size: 2850 bytes --]
Hi,
We got the correct value of CLK9 and CLK10. We found out a bug in the
function fcc_enet_open(). Our setting was CONFIG_USE_MDIO. In this mode,
the board is able to get packets from out side, but was unable to send
packets.
Now we changed the code like this.
fep->link = 1;
netif_start_queue(dev);
mii_do_cmd(dev, phy_cmd_config); /* display configuration
*/
return 0;
Originally the code was ( Line no 2174)
netif_start_queue(dev);
return 0; /* Success */
Now the ethernet works perfectly.
BTW, is there any tool/test case available to test the ethernet driver for
a long period of time?
Thanks
Batsayan Das
Wolfgang Denk <wd@denx.de>
Sent by: wd@denx.de
01/12/2006 02:04 AM
To
batsayan.das@tcs.com
cc
Linuxppc-embedded@ozlabs.org
Subject
Re: Ethernet not initialized: Help req
In message
<OFDC66830E.1EDE14C4-ON652570F3.00265CDF-652570F3.00297A66@tcs.com> you
wrote:
>
> In our MPC8260 based customs board the CLK9 is for transmit and CLK10 is
> for receive. The ELDK tree uses CLK12 is receive, CLK11 is transmit and
This is not correct. The ELDK does not do this. The ELDK is not a
Linux source tree.
Also, this setting is hardware dependent and differs from board to
board.
> We got CLK9 and CLK10 from U-Boot tree and set those varables, but
> ethernet does not work.
Then probably other changes / initializations (port pin
configurations) are needed as well.
> My question is what value shall I use for CLK9 and CLK10?
This idepends on your hardware. Study the schematics.
> What else setting we need to change to make Ethernet work?
Compare U-Boot code and other board definitions.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
A secure program has to be robust: it must be able to deal with
conditions that "can't happen", whether user input, program error or
library/etc. This is basic damage control. Buffer overflow errors
have nothing to do with security, but everything with stupidity.
-- Wietse Venema in <5cnqm3$8r9@spike.porcupine.org>
ForwardSourceID:NT00008EB6
Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
[-- Attachment #2: Type: text/html, Size: 4942 bytes --]
^ permalink raw reply
* Re: Linux 2.4.21 Embedded PPC 405 on Xilinx Virtex II pro is glacially slow
From: Frank @ 2006-01-12 4:53 UTC (permalink / raw)
To: andrew.l.bomber, linuxppc-dev; +Cc: mullenp
In-Reply-To: <7E11C792A1D81242B9BFFC8355D4979387F6F9@us-bv-m23.global.tektronix.net>
--- andrew.l.bomber@maxtek.com wrote:
> Hello,
>
> I am running 2.4.21 on an embedded PPC 405 system, 125 MHz
> clock, 32 MB
> SDRAM. It currently only has a UART and ttys00 is its console.
> It is
> running the busy box monolithic binaries. It is so slow that
> I have to
> be cautious not to overrun the 16 byte UART 16550 input
> buffer. Has
> anyone run into this problem before? Any ideas what might
> cause this or
> how to troubleshoot it. I am kind of new to Linux and PPC.
> <<hypertermCaptureBBprompt.txt>>
> Thanks,
>
> Andrew
>
> >
> loaded at: 00400000 005EA1E4
>
> board data at: 005E713C 005E7154
>
> relocated to: 00405624 0040563C
>
> zimage at: 00405B44 00456755
>
> initrd at: 00457000 005E68E3
>
> avail ram: 005EB000 02000000
>
>
> Linux/PPC load: console=ttyS0,115200 root=/dev/ram0
>
> Uncompressing Linux...done.
> Now booting the kernel
> id mach(): done
> MMU:enter
> MMU:hw init
> MMU:mapin
> MMU:mapin_ram done
> MMU:setio
> MMU:exit
> Linux version 2.4.26 (pm@mars) (gcc version 3.3.3 (DENX ELDK
> 3.1.1 3.3.3-9)) #9
>
> Sun Jan 8 16:42:35 PST 2006
> setup_arch: enter
> setup_arch: bootmem
> Xilinx Virtex-II Pro port (C) 2002 MontaVista Software, Inc.
> (source@mvista.com)
>
>
> arch: exit
> On node 0 totalpages: 8192
> zone(0): 8192 pages.
> zone(1): 0 pages.
> zone(2): 0 pages.
> Kernel command line: console=ttyS0,115200 root=/dev/ram0
>
> Xilinx INTC #0 at 0x81010000 mapped to 0xFDFFE000
>
> Calibrating delay loop... 399.76 BogoMIPS
>
> Memory: 29948k available (596k kernel code, 196k data, 36k
> init, 0k highmem)
>
> Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
>
> Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
>
> Mount cache hash table entries: 512 (order: 0, 4096 bytes)
>
> Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
>
> Page-cache hash table entries: 8192 (order: 3,
>
> POSIX conformance testing by UNIFIX
>
>
> Linux NET4.0 for Linux 2.4
> Based upon Swansea University Computer Society NET3.039
> Starting kswapd
> Serial driver version 5.05c (2001-07-08) with no serial
> options enabled
> ttyS00 at 0xfdfff003 (irq = 31) is a 16550A
> RAMDISK driver initialized: 16 RAM disks of 4096K size 1024
> blocksize
> loop: loaded (max 8 devices)
> RAMDISK: Compressed image found at block 0
> Freeing initrd memory: 1598k freed
> VFS: Mounted root (ext2 filesystem) readonly.
> Freeing unused kernel memory: 36k init
>
>
> BusyBox v0.60.5 (2005.03.07-10:03+0000) Built-in shell (msh)
> Enter 'help' for a list of built-in commands.
>
> # killall xinetd
> # ls
> bin dev etc ftp home lib proc sbin tmp usr
> var
> # ttyS: 1 input overrun(s)
> wch
> # echo "hello worrld"
> hello worrld
> #ps
> PID TTY Uid Size State Command
> 1 root 1832 S init
> 2 root 0 S [keventd]
> 3 root 0 S [ksoftirqd_CPU0]
> 4 root 0 S [kswapd]
> 5 root 0 S [bdflush]
> 6 root 0 S [kupdated]
> 15 ttyS0 root 1880 S -sh
> 19 ttyS0 root 1940 R ps
> # top -b -n 1
> top: not found>
_______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
You might try cat'ing /proc/interrupts and see if something else
is sharing your uart interrupt...
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
^ permalink raw reply
* Re: AGPGART driver for ArticiaS - ioremap() problem
From: Benjamin Herrenschmidt @ 2006-01-12 4:44 UTC (permalink / raw)
To: Gerhard Pircher; +Cc: linuxppc-dev, debian-powerpc
In-Reply-To: <6063.1137013232@www88.gmx.net>
On Wed, 2006-01-11 at 22:00 +0100, Gerhard Pircher wrote:
> Hi,
>
> David Bentam and I are trying to get a AGPGART driver working for the
> AmigaOne and the Pegasos1. The driver detects the aperture size of the
> ArticiaS AGP bridge, but fails at the ioremap() function in the generic GATT
> table create function. Does the PowerPC platform behaves differently for the
> mapping of address location for AGP operation than the x86 platform? Is it
> possible to use a mask to relocate the AGP address space to a specific
> location?
Well, what value are you passing to ioremap ?
Ben.
^ permalink raw reply
* Question about SPI based CAN controller for MPC8260
From: David Tao @ 2006-01-12 4:30 UTC (permalink / raw)
To: Linuxppc-embedded
In-Reply-To: <OFDC66830E.1EDE14C4-ON652570F3.00265CDF-652570F3.00297A66@tcs.com>
[-- Attachment #1: Type: text/plain, Size: 724 bytes --]
Hello there,
I am working on a MPC8270 based project which needs dual CAN bus support. Based on current situation I think SPI based standalone CAN controller MCP2515 may be a proper choice. But looking around I didn't find any Linux driver for MCP2510/MCP2515. Before going into creating the driver, I hope to get some help:
1. Is it possible to add CAN to MPC8270 with SPI interface using the MCP2515? Is there any better solution for the job?
2. If yes, is there any such linux driver?
Any suggestions and helps are appreciated.
Regards,
David
---------------------------------
Yahoo! Photos Showcase holiday pictures in hardcover
Photo Books. You design it and well bind it!
[-- Attachment #2: Type: text/html, Size: 1134 bytes --]
^ permalink raw reply
* Re: kernel hang on 'now booting the kernel'
From: Grant Likely @ 2006-01-12 2:13 UTC (permalink / raw)
To: andrew.l.bomber; +Cc: linuxppc-dev
In-Reply-To: <7E11C792A1D81242B9BFFC8355D4979387F6F7@us-bv-m23.global.tektronix.net>
andrew.l.bomber@maxtek.com wrote:
> Ali,
>
> What is likely happening is that Linux's logical address space is not
> configured appropriately. The MMU configuration is the first or Second
> thing to happen after zImage boots into the Kernel.
>
> I had the same problem for a custom board with a Xilinx Virtex 2 Pro.
> The problem was that I edited the .config file without running
> menuconfig and that I changed KERNELBASE. Don't change KERNELBASE
> because if you do it will screw up Linux's logical address space. Second
> always run make menuconfig before make dep and make zImage because
or you can run 'make oldconfig' after editing .config. oldconfig will
sanitize your changes.
> menuconfig alters a number of lower level files according to your
> configuration. Also make sure that you copy the BSP into the kernel
> source tree otherwise Linux will be writing to the wrong address when
> trying to output to stdout.
>
> Regards,
>
> Andrew
--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
(403) 663-0761
^ permalink raw reply
* Linux 2.4.21 Embedded PPC 405 on Xilinx Virtex II pro is glacially slow
From: andrew.l.bomber @ 2006-01-12 2:17 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mullenp
[-- Attachment #1.1: Type: text/plain, Size: 485 bytes --]
Hello,
I am running 2.4.21 on an embedded PPC 405 system, 125 MHz clock, 32 MB
SDRAM. It currently only has a UART and ttys00 is its console. It is
running the busy box monolithic binaries. It is so slow that I have to
be cautious not to overrun the 16 byte UART 16550 input buffer. Has
anyone run into this problem before? Any ideas what might cause this or
how to troubleshoot it. I am kind of new to Linux and PPC.
<<hypertermCaptureBBprompt.txt>>
Thanks,
Andrew
[-- Attachment #1.2: Type: text/html, Size: 1290 bytes --]
[-- Attachment #2: hypertermCaptureBBprompt.txt --]
[-- Type: text/plain, Size: 3746 bytes --]
loaded at: 00400000 005EA1E4
board data at: 005E713C 005E7154
relocated to: 00405624 0040563C
zimage at: 00405B44 00456755
initrd at: 00457000 005E68E3
avail ram: 005EB000 02000000
Linux/PPC load: console=ttyS0,115200 root=/dev/ram0
Uncompressing Linux...done.
Now booting the kernel
id mach(): done
MMU:enter
MMU:hw init
MMU:mapin
MMU:mapin_ram done
MMU:setio
MMU:exit
Linux version 2.4.26 (pm@mars) (gcc version 3.3.3 (DENX ELDK 3.1.1 3.3.3-9)) #9
Sun Jan 8 16:42:35 PST 2006
setup_arch: enter
setup_arch: bootmem
Xilinx Virtex-II Pro port (C) 2002 MontaVista Software, Inc. (source@mvista.com)
arch: exit
On node 0 totalpages: 8192
zone(0): 8192 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: console=ttyS0,115200 root=/dev/ram0
Xilinx INTC #0 at 0x81010000 mapped to 0xFDFFE000
Calibrating delay loop... 399.76 BogoMIPS
Memory: 29948k available (596k kernel code, 196k data, 36k init, 0k highmem)
Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 8192 (order: 3,
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Starting kswapd
Serial driver version 5.05c (2001-07-08) with no serial options enabled
ttyS00 at 0xfdfff003 (irq = 31) is a 16550A
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
RAMDISK: Compressed image found at block 0
Freeing initrd memory: 1598k freed
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused kernel memory: 36k init
BusyBox v0.60.5 (2005.03.07-10:03+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.
# killall xinetd
# ls
bin dev etc ftp home lib proc sbin tmp usr var
# ttyS: 1 input overrun(s)
wch
# echo "hello worrld"
hello worrld
#ps
PID TTY Uid Size State Command
1 root 1832 S init
2 root 0 S [keventd]
3 root 0 S [ksoftirqd_CPU0]
4 root 0 S [kswapd]
5 root 0 S [bdflush]
6 root 0 S [kupdated]
15 ttyS0 root 1880 S -sh
19 ttyS0 root 1940 R ps
# top -b -n 1
top: not found
^ permalink raw reply
* Recall: Linux 2.4.21 Embedded PPC 405 on Xilinx Virtex II pro is glaciarly slow
From: andrew.l.bomber @ 2006-01-12 2:12 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mullenp
The sender would like to recall the message, "Linux 2.4.21 Embedded PPC =
405 on Xilinx Virtex II pro is glaciarly slow".
^ permalink raw reply
* RE: kernel hang on 'now booting the kernel'
From: andrew.l.bomber @ 2006-01-12 2:03 UTC (permalink / raw)
To: ali, linuxppc-dev
Ali,
What is likely happening is that Linux's logical address space is not
configured appropriately. The MMU configuration is the first or Second
thing to happen after zImage boots into the Kernel.
I had the same problem for a custom board with a Xilinx Virtex 2 Pro.
The problem was that I edited the .config file without running
menuconfig and that I changed KERNELBASE. Don't change KERNELBASE
because if you do it will screw up Linux's logical address space. Second
always run make menuconfig before make dep and make zImage because
menuconfig alters a number of lower level files according to your
configuration. Also make sure that you copy the BSP into the kernel
source tree otherwise Linux will be writing to the wrong address when
trying to output to stdout.
Regards,
Andrew
-----Original Message-----
From: linuxppc-dev-bounces@ozlabs.org
[mailto:linuxppc-dev-bounces@ozlabs.org] On Behalf Of Ali Paikan
Sent: Sunday, December 25, 2005 2:19 AM
To: linuxppc-dev@ozlabs.org
Subject: kernel hang on 'now booting the kernel'
Dear Sir,
I am a student and I tried to install Linux on ML300 board. I need that
for
doing my final project but I have many problems.=20
I compiled the open source PowerPC kernel (linuxppc_2_4_devel) with a
cross=20
compiler which I built it by Dan Kegel cross tools. Before compiling, I=20
updated xparameters_ml300.h according to my base system design from
Xilinx EDK. =20
Next, I tried to download kernel ELF file to board and every thing seen
well.
But My kernel hanged up when it was going to load main kernel image with
show=20
this message on serial console:
loaded at: 00400000 004B01E4 =20
board data at: 004AD13C 004AD154 =20
relocated to: 00405648 00405660 =20
zimage at: 00405C13 004AC65E =20
avail ram: 004B1000 08000000 =20
Linux/PPC load: console=3DttyS0,9600 ip=3Doff =
root=3D/dev/xsysace/disc0/part3
rw
Uncompressing Linux...done.
Now booting the kernel
I debugged the kernel and results showed memory initialized and
load_kernel=20
function decompressed image into address 0x0 as well. (I can see tree
NOP=20
instructions from address 0x0).
But, I am not sure about next step in jumping to address 0x000C and
running=20
the main part of kernel.
I wondered more when I tried to make a Xilinx System ACE file with
Impact.=20
It failed too with showing this fatal error:
FATAL_ERROR:GuiUtilities:WinApp.c:710:$Revision - This application has=20
discovered an exceptional condition from which it cannot recover.
Process
will terminate. To resolve this error, please consult the Answers
Database
and other online resources at http://support.xilinx.com. If you need
further=20
assistance, please open a Webcase by clicking on the "WebCase" link at
http://support.xilinx.com.
I don't have any problem for making system ace from other ELF files.
Might it be for my bad compilation?
Is my base system building for FPGA not correct?
Where is my wrong?
=20
For more information I attached my all configuration and log files at
end of=20
this mail.
I am too great if you help me in this case and I look forward to hearing
from you.=20
Sorry my pure English!
Sincerely,
Ali Paikan
Cross compiler option:
CONFIG_TARGET=3D"powerpc-405-linux-gnu"
CONFIG_TARGET_CFLAGS=3D"-O -mcpu=3D405"
CONFIG_GCC_EXTRA_CONFIG=3D"--with-cpu=3D405 =
--enable-cxx-flags=3D-mcpu=3D405"
CONFIG_GLIBC_EXTRA_CONFIG=3D"-without-fp"
powerpc-405-linux-gnu-objdump -h:
zImage.: file format elf32-powerpc
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00004798 00400000 00400000 00010000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00095000 00405000 00405000 00015000 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 000031e0 0049a000 _u48 ?49a000 000aa000 2**2
ALLOC
3 .note.GNU-stack 00000000 00000000 00000000 000aa000 2**0
CONTENTS, READONLY
Xparameters_ml300.h :
/*********************************************************_u42 ?********
*
* CAUTION: This file is automatically generated by libgen.
* Version: Xilinx EDK 7.1 EDK_H.10.4
* DO NOT EDIT.
*
* Copyright (c) 2005 Xilinx, Inc. All rights reserved.=20
*=20
* Description: Driver parameters
*
*******************************************************************/
#define XPAR_XUARTLITE_NUM_INSTANCES 1
#define XPAR_RS232_UART_1_BASEADDR 0x40600000
#define XPAR_RS232_UART_1_HIGHADDR 0x4060FFFF
#define XPAR_RS232_UART_1_DEVICE_ID 0
#define XPAR_RS232_UART_1_BAUDRATE 9600
#define XPAR_RS232_UART_1_USE_PARITY 0
#define XPAR_RS232_UART_1_ODD_PARITY 0
#define XPAR_RS232_UART_1_DATA_BITS 8
/******************************************************************/
#define XPAR_XSYSACE_MEM_WIDTH 8
#define XPAR_XSYSACE_NUM_INSTANCES 1
#define XPAR_SYSACE_COMPACTFLASH_BASEADDR 0x41800000
#define XPAR_SYSACE_COMPACTFLASH_HIGHADDR 0x4180FFFF
#define XPAR_SYSACE_COMPACTFLASH_DEVICE_ID 0
#define XPAR_SYSACE_COMPACTFLASH_MEM_WIDTH 8
/******************************************************************/
#define XPAR_INTC_MAX_NUM_INTR_INPUTS 3
#define XPAR_XINTC_HAS_IPR 1
#define XPAR_XINTC_USE_DCR 0
#define XPAR_XINTC_NUM_INSTANCES 1
#define XPAR_OPB_INTC_0_BASEADDR 0x41200000
#define XPAR_OPB_INTC_0_HIGHADDR 0x4120FFFF
#define XPAR_OPB_INTC_0_DEVICE_ID 0
#define XPAR_OPB_INTC_0_KIND_OF_INTR 0x00000006
/******************************************************************/
#define XPAR_INTC_SINGLE_BASEADDR 0x41200000
#define XPAR_INTC_SINGLE_HIGHADDR 0x4120FFFF
#define XPAR_INTC_SINGLE_DEVICE_ID XPAR_OPB_INTC_0_DEVICE_ID
#define XPAR_SYSACE_COMPACTFLASH_SYSACE_IRQ_MASK 0X000001
#define XPAR_OPB_INTC_0_SYSACE_COMPACTFLASH_SYSACE_IRQ_INTR 0
#define XPAR_RS232_UART_1_INTERRUPT_MASK 0X000002
#define XPAR_OPB_INTC_0_RS232_UART_1_INTERRUPT_INTR 1
#define XPAR_DDR_SDRAM_32MX32_IP2INTC_IRPT_MASK 0X000004
#define XPAR_OPB_INTC_0_DDR_SDRAM_32MX32_IP2INTC_IRPT_INTR 2
/******************************************************************/
#define XPAR_XDDR_NUM_INSTANCES 1
#define XPAR_DDR_SDRAM_32MX32_ECC_BASEADDR 0xFFFFFFFF
#define XPAR_DDR_SDRAM_32MX32_ECC_HIGHADDR 0x00000000
#define XPAR_DDR_SDRAM_32MX32_DEVICE_ID 0
#define XPAR_DDR_SDRAM_32MX32_INCLUDE_ECC_INTR 0
/******************************************************************/
#define XPAR_DDR_SDRAM_32MX32_MEM0_BASEADDR 0x00000000
#define XPAR_DDR_SDRAM_32MX32_MEM0_HIGHADDR 0x07FFFFFF
/******************************************************************/
#define XPAR_PLB_BRAM_IF_CNTLR_1_BASEADDR 0xffffc000
#define XPAR_PLB_BRAM_IF_CNTLR_1_HIGHADDR 0xffffffff
/******************************************************************/
#define XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ 300000000
/******************************************************************/
/******************************************************************/
/* Linux Redefines */
/******************************************************************/
#define XPAR_UARTLITE_0_BASEADDR XPAR_RS232_UART_1_BASEADDR
#define XPAR_UARTLITE_0_HIGHADDR XPAR_RS232_UART_1_HIGHADDR
#define XPAR_UARTLITE_0_DEVICE_ID XPAR_RS232_UART_1_DEVICE_ID
/******************************************************************/
#define XPAR_SYSACE_0_BASEADDR XPAR_SYSACE_COMPACTFLASH_BASEADDR
#define XPAR_SYSACE_0_HIGHADDR XPAR_SYSACE_COMPACTFLASH_HIGHADDR
#define XPAR_SYSACE_0_DEVICE_ID XPAR_SYSACE_COMP8CTFLASH_DEVICE_ID
/******************************************************************/
#define XPAR_INTC_0_BASEADDR XPAR_OPB_INTC_0_BASEADDR
#define XPAR_INTC_0_HIGHADDR XPAR_OPB_INTC_0_HIGHADDR
#define XPAR_INTC_0_KIND_OF_INTR XPAR_OPB_INTC_0_KIND_OF_INTR
#define XPAR_INTC_0_DEVICE_ID XPAR_OPB_INTC_0_DEVICE_ID
/******************************************************************/
#define XPAR_INTC_0_SYSACE_0_VEC_ID
XPAR_OPB_INTC_0_SYSACE_COMPACTFLASH_SYSACE_IRQ_INTR
#define XPAR_INTC_0_UARTLITE_0_VEC_ID
XPAR_OPB_INTC_0_RS232_UART_1_INTERRUPT_INTR
#define XPAR_INTC_0_DDR_0_VEC_ID
XPAR_OPB_INTC_0_DDR_SDRAM_32MX32_IP2INTC_IRPT_INTR
/******************************************************************/
#define XPAR_PLB_CLOCK_FREQ_HZ 100000000
#define XPAR_CORE_CLOCK_FREQ_HZ XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ
#define XPAR_DDR_0_SIZE 8000000
/******************************************************************/
#define XPAR_PERSISTENT_0_IIC_0_BASEADDR 0x00000400
#define XPAR_PERSISTENT_0_IIC_0_HIGHADDR 0x000007FF
#define XPAR_PERSISTENT_0_IIC_0_EEPROMADDR 0xA0
/******************************************************************/
#define XPAR_PCI_0_CLOCK_FREQ_HZ 0
/******************************************************************/
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ permalink raw reply
* Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks
From: Michael Hanselmann @ 2006-01-12 0:08 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linux-kernel, dtor_core, linux-kernel, linuxppc-dev,
Vojtech Pavlik, linux-input
In-Reply-To: <1137022900.5138.66.camel@localhost.localdomain>
On Thu, Jan 12, 2006 at 10:41:40AM +1100, Benjamin Herrenschmidt wrote:
> I don't understand the comment above ? You are adding this to all struct
> hid_device ? There can be only one of those keyboards plugged at one
> point in time, I don't think there is any problem having the above
> static in the driver rather than in the hid_device structure.
While I don't agree on that, I still modified the patch.
This patch implements support for the fn key on Apple PowerBooks using
USB based keyboards.
Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch>
Acked-by: Rene Nussbaumer <linux-kernel@killerfox.forkbomb.ch>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
diff -upr linux-2.6.15.orig/drivers/usb/input/hid-core.c linux-2.6.15/drivers/usb/input/hid-core.c
--- linux-2.6.15.orig/drivers/usb/input/hid-core.c 2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid-core.c 2006-01-08 11:53:36.000000000 +0100
@@ -1580,6 +1580,14 @@ static struct hid_blacklist {
{ USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD },
{ USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD },
+ { USB_VENDOR_ID_APPLE, 0x020E, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x020F, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x0214, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x0215, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x0216, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN },
+
{ 0, 0 }
};
diff -upr linux-2.6.15.orig/drivers/usb/input/hid.h linux-2.6.15/drivers/usb/input/hid.h
--- linux-2.6.15.orig/drivers/usb/input/hid.h 2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid.h 2006-01-12 00:56:22.000000000 +0100
@@ -246,6 +246,8 @@ struct hid_item {
#define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x100
#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x200
#define HID_QUIRK_2WHEEL_POWERMOUSE 0x400
+#define HID_QUIRK_POWERBOOK_HAS_FN 0x00000800
+#define HID_QUIRK_POWERBOOK_FN_ON 0x00001000
/*
* This is the global environment of the parser. This information is
diff -upr linux-2.6.15.orig/drivers/usb/input/hid-input.c linux-2.6.15/drivers/usb/input/hid-input.c
--- linux-2.6.15.orig/drivers/usb/input/hid-input.c 2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid-input.c 2006-01-12 01:06:46.000000000 +0100
@@ -63,6 +63,68 @@ static struct {
__s32 y;
} hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
+struct hidinput_key_translation {
+ u16 from;
+ u16 to;
+ u8 flags;
+};
+
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+
+#define POWERBOOK_FLAG_FKEY 0x01
+
+static struct hidinput_key_translation powerbook_fn_keys[] = {
+ { KEY_BACKSPACE, KEY_DELETE },
+ { KEY_F1, KEY_BRIGHTNESSDOWN, POWERBOOK_FLAG_FKEY },
+ { KEY_F2, KEY_BRIGHTNESSUP, POWERBOOK_FLAG_FKEY },
+ { KEY_F3, KEY_MUTE, POWERBOOK_FLAG_FKEY },
+ { KEY_F4, KEY_VOLUMEDOWN, POWERBOOK_FLAG_FKEY },
+ { KEY_F5, KEY_VOLUMEUP, POWERBOOK_FLAG_FKEY },
+ { KEY_F6, KEY_NUMLOCK, POWERBOOK_FLAG_FKEY },
+ { KEY_F7, KEY_SWITCHVIDEOMODE, POWERBOOK_FLAG_FKEY },
+ { KEY_F8, KEY_KBDILLUMTOGGLE, POWERBOOK_FLAG_FKEY },
+ { KEY_F9, KEY_KBDILLUMDOWN, POWERBOOK_FLAG_FKEY },
+ { KEY_F10, KEY_KBDILLUMUP, POWERBOOK_FLAG_FKEY },
+ { KEY_UP, KEY_PAGEUP },
+ { KEY_DOWN, KEY_PAGEDOWN },
+ { KEY_LEFT, KEY_HOME },
+ { KEY_RIGHT, KEY_END },
+ { }
+};
+
+static struct hidinput_key_translation powerbook_numlock_keys[] = {
+ { KEY_J, KEY_KP1 },
+ { KEY_K, KEY_KP2 },
+ { KEY_L, KEY_KP3 },
+ { KEY_U, KEY_KP4 },
+ { KEY_I, KEY_KP5 },
+ { KEY_O, KEY_KP6 },
+ { KEY_7, KEY_KP7 },
+ { KEY_8, KEY_KP8 },
+ { KEY_9, KEY_KP9 },
+ { KEY_M, KEY_KP0 },
+ { KEY_DOT, KEY_KPDOT },
+ { KEY_SLASH, KEY_KPPLUS },
+ { KEY_SEMICOLON, KEY_KPMINUS },
+ { KEY_P, KEY_KPASTERISK },
+ { KEY_MINUS, KEY_KPEQUAL },
+ { KEY_0, KEY_KPSLASH },
+ { KEY_F6, KEY_NUMLOCK },
+ { KEY_KPENTER, KEY_KPENTER },
+ { KEY_BACKSPACE, KEY_BACKSPACE },
+ { }
+};
+
+static unsigned long usbhid_pb_fn[NBITS(KEY_MAX)];
+static unsigned long usbhid_pb_numlock[NBITS(KEY_MAX)];
+
+static int usbhid_pb_fnmode = 1;
+module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644);
+MODULE_PARM_DESC(usbhid_pb_fnmode,
+ "Mode of fn key on PowerBooks (0 = disabled, "
+ "1 = fkeyslast, 2 = fkeysfirst)");
+#endif
+
#define map_abs(c) do { usage->code = c; usage->type = EV_ABS; bit = input->absbit; max = ABS_MAX; } while (0)
#define map_rel(c) do { usage->code = c; usage->type = EV_REL; bit = input->relbit; max = REL_MAX; } while (0)
#define map_key(c) do { usage->code = c; usage->type = EV_KEY; bit = input->keybit; max = KEY_MAX; } while (0)
@@ -73,6 +135,80 @@ static struct {
#define map_key_clear(c) do { map_key(c); clear_bit(c, bit); } while (0)
#define map_ff_effect(c) do { set_bit(c, input->ffbit); } while (0)
+static inline struct hidinput_key_translation *find_translation(
+ struct hidinput_key_translation *table, u16 from)
+{
+ struct hidinput_key_translation *trans;
+
+ /* Look for the translation */
+ for(trans = table; trans->from && (trans->from != from); trans++);
+
+ return (trans->from?trans:NULL);
+}
+
+static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
+ struct hid_usage *usage, __s32 value)
+{
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+ struct hidinput_key_translation *trans;
+
+ if (usage->code == KEY_FN) {
+ if (value) hid->quirks |= HID_QUIRK_POWERBOOK_FN_ON;
+ else hid->quirks &= ~HID_QUIRK_POWERBOOK_FN_ON;
+
+ input_event(input, usage->type, usage->code, value);
+
+ return 1;
+ }
+
+ if (usbhid_pb_fnmode) {
+ int try_translate, do_translate;
+
+ trans = find_translation(powerbook_fn_keys, usage->code);
+ if (trans) {
+ if (test_bit(usage->code, usbhid_pb_fn))
+ do_translate = 1;
+ else if (trans->flags & POWERBOOK_FLAG_FKEY)
+ do_translate =
+ (usbhid_pb_fnmode == 2 && (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) ||
+ (usbhid_pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON));
+ else
+ do_translate = (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON);
+
+ if (do_translate) {
+ if (value)
+ set_bit(usage->code, usbhid_pb_fn);
+ else
+ clear_bit(usage->code, usbhid_pb_fn);
+
+ input_event(input, usage->type, trans->to, value);
+
+ return 1;
+ }
+ }
+
+ try_translate = test_bit(usage->code, usbhid_pb_numlock)?1:
+ test_bit(LED_NUML, input->led);
+ if (try_translate) {
+ trans = find_translation(powerbook_numlock_keys, usage->code);
+
+ if (trans) {
+ if (value)
+ set_bit(usage->code, usbhid_pb_numlock);
+ else
+ clear_bit(usage->code, usbhid_pb_numlock);
+
+ input_event(input, usage->type, trans->to, value);
+ }
+
+ return 1;
+ }
+ }
+#endif
+
+ return 0;
+}
+
static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field,
struct hid_usage *usage)
{
@@ -325,7 +461,27 @@ static void hidinput_configure_usage(str
set_bit(EV_REP, input->evbit);
switch(usage->hid & HID_USAGE) {
- case 0x003: map_key_clear(KEY_FN); break;
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+ /* The fn key on Apple PowerBooks */
+ case 0x0003: {
+ struct hidinput_key_translation *trans;
+
+ map_key_clear(KEY_FN);
+
+ set_bit(KEY_FN, input->keybit);
+ set_bit(KEY_NUMLOCK, input->keybit);
+
+ /* Enable all needed keys */
+ for(trans = powerbook_fn_keys; trans->from; trans++)
+ set_bit(trans->to, input->keybit);
+
+ for(trans = powerbook_numlock_keys; trans->from; trans++)
+ set_bit(trans->to, input->keybit);
+
+ goto ignore;
+ }
+#endif
+
default: goto ignore;
}
break;
@@ -482,6 +638,10 @@ void hidinput_hid_event(struct hid_devic
return;
}
+ if ((hid->quirks & HID_QUIRK_POWERBOOK_HAS_FN) &&
+ hidinput_pb_event(hid, input, usage, value))
+ return;
+
if (usage->hat_min < usage->hat_max || usage->hat_dir) {
int hat_dir = usage->hat_dir;
if (!hat_dir)
diff -upr linux-2.6.15.orig/drivers/usb/input/Kconfig linux-2.6.15/drivers/usb/input/Kconfig
--- linux-2.6.15.orig/drivers/usb/input/Kconfig 2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/Kconfig 2006-01-08 11:53:35.000000000 +0100
@@ -37,6 +37,16 @@ config USB_HIDINPUT
If unsure, say Y.
+config USB_HIDINPUT_POWERBOOK
+ bool "Enable support for iBook/PowerBook special keys"
+ default n
+ depends on USB_HIDINPUT
+ help
+ Say Y here if you want support for the special keys (Fn, Numlock) on
+ Apple iBooks and PowerBooks.
+
+ If unsure, say N.
+
config HID_FF
bool "Force feedback support (EXPERIMENTAL)"
depends on USB_HIDINPUT && EXPERIMENTAL
^ permalink raw reply
* [PATCH] powerpc: Fixed memory reserve map layout
From: Kumar Gala @ 2006-01-11 23:57 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, linuxppc64-dev
powerpc: Fixed memory reserve map layout
The memory reserve map is suppose to be a pair of 64-bit integers
to represent each region. On ppc32 the code was treating the
pair as two 32-bit integers. Additional the prom_init code was
producing the wrong layout on ppc32.
Added a simple check to try to provide backwards compatibility.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
commit dc15eeb7325279bf9e5b49f79567fa0886cd8c31
tree e724bd9d855d5f2a71720742c7ec279609c1aaaa
parent aa30a75885b935a7f09a1312e792f96cc338e505
author Kumar Gala <galak@kernel.crashing.org> Wed, 11 Jan 2006 18:02:36 -0600
committer Kumar Gala <galak@kernel.crashing.org> Wed, 11 Jan 2006 18:02:36 -0600
arch/powerpc/kernel/prom.c | 28 ++++++++++++++++++++++++----
arch/powerpc/kernel/prom_init.c | 8 ++++----
2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 34ab0da..02e2115 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1100,17 +1100,37 @@ static int __init early_init_dt_scan_mem
static void __init early_reserve_mem(void)
{
- unsigned long base, size;
- unsigned long *reserve_map;
+ u64 base, size;
+ u64 *reserve_map;
- reserve_map = (unsigned long *)(((unsigned long)initial_boot_params) +
+ reserve_map = (u64 *)(((unsigned long)initial_boot_params) +
initial_boot_params->off_mem_rsvmap);
+#ifdef CONFIG_PPC32
+ /*
+ * Handle the case where we might be booting from an old kexec
+ * image that setup the mem_rsvmap as pairs of 32-bit values
+ */
+ if (*reserve_map > 0xffffffffull) {
+ u32 base_32, size_32;
+ u32 *reserve_map_32 = (u32 *)reserve_map;
+
+ while (1) {
+ base_32 = *(reserve_map_32++);
+ size_32 = *(reserve_map_32++);
+ if (size_32 == 0)
+ break;
+ DBG("reserving: %lx -> %lx\n", base_32, size_32);
+ lmb_reserve(base_32, size_32);
+ }
+ return;
+ }
+#endif
while (1) {
base = *(reserve_map++);
size = *(reserve_map++);
if (size == 0)
break;
- DBG("reserving: %lx -> %lx\n", base, size);
+ DBG("reserving: %llx -> %llx\n", base, size);
lmb_reserve(base, size);
}
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index e381f2f..d963a12 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -137,8 +137,8 @@ struct prom_t {
};
struct mem_map_entry {
- unsigned long base;
- unsigned long size;
+ u64 base;
+ u64 size;
};
typedef u32 cell_t;
@@ -897,9 +897,9 @@ static unsigned long __init prom_next_ce
* If problems seem to show up, it would be a good start to track
* them down.
*/
-static void reserve_mem(unsigned long base, unsigned long size)
+static void reserve_mem(u64 base, u64 size)
{
- unsigned long top = base + size;
+ u64 top = base + size;
unsigned long cnt = RELOC(mem_reserve_cnt);
if (size == 0)
^ permalink raw reply related
* Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks
From: Benjamin Herrenschmidt @ 2006-01-11 23:41 UTC (permalink / raw)
To: Michael Hanselmann
Cc: linux-kernel, dtor_core, linux-kernel, linuxppc-dev,
Vojtech Pavlik, linux-input
In-Reply-To: <20060111232651.GI6617@hansmi.ch>
On Thu, 2006-01-12 at 00:26 +0100, Michael Hanselmann wrote:
> * This is the global environment of the parser. This information is
> @@ -431,6 +433,14 @@ struct hid_device { /* device repo
> void (*ff_exit)(struct hid_device*); /* Called by hid_exit_ff(hid) */
> int (*ff_event)(struct hid_device *hid, struct input_dev *input,
> unsigned int type, unsigned int code, int value);
> +
> +#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
> + /* We do this here because it's only relevant for the
> + * USB devices, not for all input_dev's.
> + */
> + unsigned long pb_fn[NBITS(KEY_MAX)];
> + unsigned long pb_numlock[NBITS(KEY_MAX)];
> +#endif
> };
I don't understand the comment above ? You are adding this to all struct
hid_device ? There can be only one of those keyboards plugged at one
point in time, I don't think there is any problem having the above
static in the driver rather than in the hid_device structure.
.../...
>
> + if ((hid->quirks & HID_QUIRK_POWERBOOK_HAS_FN) &&
> + hidinput_pb_event(hid, input, usage, value)) {
> + return;
> + }
> +
Dimitry might disagree but it's generally considered bad taste to have
{ and } for a single statement :)
> if (usage->hat_min < usage->hat_max || usage->hat_dir) {
> int hat_dir = usage->hat_dir;
> if (!hat_dir)
> diff -upr linux-2.6.15.orig/drivers/usb/input/Kconfig linux-2.6.15/drivers/usb/input/Kconfig
> --- linux-2.6.15.orig/drivers/usb/input/Kconfig 2006-01-11 23:59:40.000000000 +0100
> +++ linux-2.6.15/drivers/usb/input/Kconfig 2006-01-08 11:53:35.000000000 +0100
> @@ -37,6 +37,16 @@ config USB_HIDINPUT
>
> If unsure, say Y.
>
> +config USB_HIDINPUT_POWERBOOK
> + bool "Enable support for iBook/PowerBook special keys"
> + default n
> + depends on USB_HIDINPUT
> + help
> + Say Y here if you want support for the special keys (Fn, Numlock) on
> + Apple iBooks and PowerBooks.
> +
> + If unsure, say N.
> +
> config HID_FF
> bool "Force feedback support (EXPERIMENTAL)"
> depends on USB_HIDINPUT && EXPERIMENTAL
^ permalink raw reply
* Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks
From: Michael Hanselmann @ 2006-01-11 23:26 UTC (permalink / raw)
To: dtor_core
Cc: linux-kernel, linux-kernel, linuxppc-dev, Vojtech Pavlik,
linux-input
In-Reply-To: <d120d5000601111307x451db79aqf88725e7ecec79d2@mail.gmail.com>
On Wed, Jan 11, 2006 at 04:07:37PM -0500, Dmitry Torokhov wrote:
> Ok, I am looking at the patch again, and I have a question - do we
> really need these 3 module parameters? If the goal is to be compatible
> with older keyboards then shouldn't we stick to one behavior?
After clearing the other points with Benjamin Herrenschmidt, I created
another patch which you find below.
This patch implements support for the fn key on PowerBooks using USB
based keyboards.
Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch>
Acked-by: Rene Nussbaumer <linux-kernel@killerfox.forkbomb.ch>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
diff -upr linux-2.6.15.orig/drivers/usb/input/hid-core.c linux-2.6.15/drivers/usb/input/hid-core.c
--- linux-2.6.15.orig/drivers/usb/input/hid-core.c 2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid-core.c 2006-01-08 11:53:36.000000000 +0100
@@ -1580,6 +1580,14 @@ static struct hid_blacklist {
{ USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD },
{ USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD },
+ { USB_VENDOR_ID_APPLE, 0x020E, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x020F, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x0214, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x0215, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x0216, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN },
+
{ 0, 0 }
};
diff -upr linux-2.6.15.orig/drivers/usb/input/hid.h linux-2.6.15/drivers/usb/input/hid.h
--- linux-2.6.15.orig/drivers/usb/input/hid.h 2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid.h 2006-01-08 11:53:36.000000000 +0100
@@ -246,6 +246,8 @@ struct hid_item {
#define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x100
#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x200
#define HID_QUIRK_2WHEEL_POWERMOUSE 0x400
+#define HID_QUIRK_POWERBOOK_HAS_FN 0x00000800
+#define HID_QUIRK_POWERBOOK_FN_ON 0x00001000
/*
* This is the global environment of the parser. This information is
@@ -431,6 +433,14 @@ struct hid_device { /* device repo
void (*ff_exit)(struct hid_device*); /* Called by hid_exit_ff(hid) */
int (*ff_event)(struct hid_device *hid, struct input_dev *input,
unsigned int type, unsigned int code, int value);
+
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+ /* We do this here because it's only relevant for the
+ * USB devices, not for all input_dev's.
+ */
+ unsigned long pb_fn[NBITS(KEY_MAX)];
+ unsigned long pb_numlock[NBITS(KEY_MAX)];
+#endif
};
#define HID_GLOBAL_STACK_SIZE 4
diff -upr linux-2.6.15.orig/drivers/usb/input/hid-input.c linux-2.6.15/drivers/usb/input/hid-input.c
--- linux-2.6.15.orig/drivers/usb/input/hid-input.c 2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/hid-input.c 2006-01-11 23:41:14.000000000 +0100
@@ -63,6 +63,65 @@ static struct {
__s32 y;
} hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
+struct hidinput_key_translation {
+ u16 from;
+ u16 to;
+ u8 flags;
+};
+
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+
+#define POWERBOOK_FLAG_FKEY 0x01
+
+static struct hidinput_key_translation powerbook_fn_keys[] = {
+ { KEY_BACKSPACE, KEY_DELETE },
+ { KEY_F1, KEY_BRIGHTNESSDOWN, POWERBOOK_FLAG_FKEY },
+ { KEY_F2, KEY_BRIGHTNESSUP, POWERBOOK_FLAG_FKEY },
+ { KEY_F3, KEY_MUTE, POWERBOOK_FLAG_FKEY },
+ { KEY_F4, KEY_VOLUMEDOWN, POWERBOOK_FLAG_FKEY },
+ { KEY_F5, KEY_VOLUMEUP, POWERBOOK_FLAG_FKEY },
+ { KEY_F6, KEY_NUMLOCK, POWERBOOK_FLAG_FKEY },
+ { KEY_F7, KEY_SWITCHVIDEOMODE, POWERBOOK_FLAG_FKEY },
+ { KEY_F8, KEY_KBDILLUMTOGGLE, POWERBOOK_FLAG_FKEY },
+ { KEY_F9, KEY_KBDILLUMDOWN, POWERBOOK_FLAG_FKEY },
+ { KEY_F10, KEY_KBDILLUMUP, POWERBOOK_FLAG_FKEY },
+ { KEY_UP, KEY_PAGEUP },
+ { KEY_DOWN, KEY_PAGEDOWN },
+ { KEY_LEFT, KEY_HOME },
+ { KEY_RIGHT, KEY_END },
+ { }
+};
+
+static struct hidinput_key_translation powerbook_numlock_keys[] = {
+ { KEY_J, KEY_KP1 },
+ { KEY_K, KEY_KP2 },
+ { KEY_L, KEY_KP3 },
+ { KEY_U, KEY_KP4 },
+ { KEY_I, KEY_KP5 },
+ { KEY_O, KEY_KP6 },
+ { KEY_7, KEY_KP7 },
+ { KEY_8, KEY_KP8 },
+ { KEY_9, KEY_KP9 },
+ { KEY_M, KEY_KP0 },
+ { KEY_DOT, KEY_KPDOT },
+ { KEY_SLASH, KEY_KPPLUS },
+ { KEY_SEMICOLON, KEY_KPMINUS },
+ { KEY_P, KEY_KPASTERISK },
+ { KEY_MINUS, KEY_KPEQUAL },
+ { KEY_0, KEY_KPSLASH },
+ { KEY_F6, KEY_NUMLOCK },
+ { KEY_KPENTER, KEY_KPENTER },
+ { KEY_BACKSPACE, KEY_BACKSPACE },
+ { }
+};
+
+static int usbhid_pb_fnmode = 1;
+module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644);
+MODULE_PARM_DESC(usbhid_pb_fnmode,
+ "Mode of fn key on PowerBooks (0 = disabled, "
+ "1 = fkeyslast, 2 = fkeysfirst)");
+#endif
+
#define map_abs(c) do { usage->code = c; usage->type = EV_ABS; bit = input->absbit; max = ABS_MAX; } while (0)
#define map_rel(c) do { usage->code = c; usage->type = EV_REL; bit = input->relbit; max = REL_MAX; } while (0)
#define map_key(c) do { usage->code = c; usage->type = EV_KEY; bit = input->keybit; max = KEY_MAX; } while (0)
@@ -73,6 +132,80 @@ static struct {
#define map_key_clear(c) do { map_key(c); clear_bit(c, bit); } while (0)
#define map_ff_effect(c) do { set_bit(c, input->ffbit); } while (0)
+static inline struct hidinput_key_translation *find_translation(
+ struct hidinput_key_translation *table, u16 from)
+{
+ struct hidinput_key_translation *trans;
+
+ /* Look for the translation */
+ for(trans = table; trans->from && (trans->from != from); trans++);
+
+ return (trans->from?trans:NULL);
+}
+
+static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
+ struct hid_usage *usage, __s32 value)
+{
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+ struct hidinput_key_translation *trans;
+
+ if (usage->code == KEY_FN) {
+ if (value) hid->quirks |= HID_QUIRK_POWERBOOK_FN_ON;
+ else hid->quirks &= ~HID_QUIRK_POWERBOOK_FN_ON;
+
+ input_event(input, usage->type, usage->code, value);
+
+ return 1;
+ }
+
+ if (usbhid_pb_fnmode) {
+ int try_translate, do_translate;
+
+ trans = find_translation(powerbook_fn_keys, usage->code);
+ if (trans) {
+ if (test_bit(usage->code, hid->pb_fn))
+ do_translate = 1;
+ else if (trans->flags & POWERBOOK_FLAG_FKEY)
+ do_translate =
+ (usbhid_pb_fnmode == 2 && (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) ||
+ (usbhid_pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON));
+ else
+ do_translate = (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON);
+
+ if (do_translate) {
+ if (value)
+ set_bit(usage->code, hid->pb_fn);
+ else
+ clear_bit(usage->code, hid->pb_fn);
+
+ input_event(input, usage->type, trans->to, value);
+
+ return 1;
+ }
+ }
+
+ try_translate = test_bit(usage->code, hid->pb_numlock)?1:
+ test_bit(LED_NUML, input->led);
+ if (try_translate) {
+ trans = find_translation(powerbook_numlock_keys, usage->code);
+
+ if (trans) {
+ if (value)
+ set_bit(usage->code, hid->pb_numlock);
+ else
+ clear_bit(usage->code, hid->pb_numlock);
+
+ input_event(input, usage->type, trans->to, value);
+ }
+
+ return 1;
+ }
+ }
+#endif
+
+ return 0;
+}
+
static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field,
struct hid_usage *usage)
{
@@ -325,7 +458,27 @@ static void hidinput_configure_usage(str
set_bit(EV_REP, input->evbit);
switch(usage->hid & HID_USAGE) {
- case 0x003: map_key_clear(KEY_FN); break;
+#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
+ /* The fn key on Apple PowerBooks */
+ case 0x0003: {
+ struct hidinput_key_translation *trans;
+
+ map_key_clear(KEY_FN);
+
+ set_bit(KEY_FN, input->keybit);
+ set_bit(KEY_NUMLOCK, input->keybit);
+
+ /* Enable all needed keys */
+ for(trans = powerbook_fn_keys; trans->from; trans++)
+ set_bit(trans->to, input->keybit);
+
+ for(trans = powerbook_numlock_keys; trans->from; trans++)
+ set_bit(trans->to, input->keybit);
+
+ goto ignore;
+ }
+#endif
+
default: goto ignore;
}
break;
@@ -482,6 +635,11 @@ void hidinput_hid_event(struct hid_devic
return;
}
+ if ((hid->quirks & HID_QUIRK_POWERBOOK_HAS_FN) &&
+ hidinput_pb_event(hid, input, usage, value)) {
+ return;
+ }
+
if (usage->hat_min < usage->hat_max || usage->hat_dir) {
int hat_dir = usage->hat_dir;
if (!hat_dir)
diff -upr linux-2.6.15.orig/drivers/usb/input/Kconfig linux-2.6.15/drivers/usb/input/Kconfig
--- linux-2.6.15.orig/drivers/usb/input/Kconfig 2006-01-11 23:59:40.000000000 +0100
+++ linux-2.6.15/drivers/usb/input/Kconfig 2006-01-08 11:53:35.000000000 +0100
@@ -37,6 +37,16 @@ config USB_HIDINPUT
If unsure, say Y.
+config USB_HIDINPUT_POWERBOOK
+ bool "Enable support for iBook/PowerBook special keys"
+ default n
+ depends on USB_HIDINPUT
+ help
+ Say Y here if you want support for the special keys (Fn, Numlock) on
+ Apple iBooks and PowerBooks.
+
+ If unsure, say N.
+
config HID_FF
bool "Force feedback support (EXPERIMENTAL)"
depends on USB_HIDINPUT && EXPERIMENTAL
^ permalink raw reply
* [PATCH] Fix e500 oprofile support
From: Andy Fleming @ 2006-01-11 22:56 UTC (permalink / raw)
To: linuxppc-embedded
Let's make this the patch, then:
This patch needs to go in quickly to fix e500 oprofile support. I didn't
realize the 7450 oprofile support patch had gone in, yet!
Signed-off-by: Andy Fleming <afleming@freescale.com>
* Fixed oprofile support on e500 so it doesn't included 7450 support
* Modified the SMP call of cpu_setup so that it passes in information
the e500 needs to program the counters
* Moved all functions in perfmon_fsl_booke.c to op_model_fsl_booke.c
* e500 oprofile code should now be SMP capable
* Fixed a typo in rs64
---
commit 5ba626800295fdd0402db4535c9b8989365103b7
tree 383a8f67ae5c31b991e09ebd549ffe84c1f200d7
parent 44e22e7c3358c79517685e7b66ffae17da6f8399
author Andrew Fleming <afleming@freescale.com> Wed, 11 Jan 2006 15:35:47 -0600
committer Andrew Fleming <afleming@ld0175-tx32.(none)> Wed, 11 Jan 2006 15:35:47 -0600
arch/powerpc/oprofile/Makefile | 2
arch/powerpc/oprofile/common.c | 2
arch/powerpc/oprofile/op_model_fsl_booke.c | 177 +++++++++++++++++++---
arch/powerpc/oprofile/op_model_rs64.c | 2
arch/ppc/kernel/Makefile | 3
arch/ppc/kernel/perfmon_fsl_booke.c | 222 ----------------------------
include/asm-powerpc/oprofile_impl.h | 7 -
include/asm-powerpc/pmc.h | 13 --
8 files changed, 160 insertions(+), 268 deletions(-)
diff --git a/arch/powerpc/oprofile/Makefile b/arch/powerpc/oprofile/Makefile
index 554cd7c..74db517 100644
--- a/arch/powerpc/oprofile/Makefile
+++ b/arch/powerpc/oprofile/Makefile
@@ -9,4 +9,4 @@ DRIVER_OBJS := $(addprefix ../../../driv
oprofile-y := $(DRIVER_OBJS) common.o
oprofile-$(CONFIG_PPC64) += op_model_rs64.o op_model_power4.o
oprofile-$(CONFIG_FSL_BOOKE) += op_model_fsl_booke.o
-oprofile-$(CONFIG_PPC32) += op_model_7450.o
+oprofile-$(CONFIG_CLASSIC32) += op_model_7450.o
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index a370778..d7a5afe 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -46,7 +46,7 @@ static int op_powerpc_setup(void)
model->reg_setup(ctr, &sys, model->num_counters);
/* Configure the registers on all cpus. */
- on_each_cpu(model->cpu_setup, NULL, 0, 1);
+ on_each_cpu(model->cpu_setup, (void *)ctr, 0, 1);
return 0;
}
diff --git a/arch/powerpc/oprofile/op_model_fsl_booke.c b/arch/powerpc/oprofile/op_model_fsl_booke.c
index 26539cd..993147a 100644
--- a/arch/powerpc/oprofile/op_model_fsl_booke.c
+++ b/arch/powerpc/oprofile/op_model_fsl_booke.c
@@ -1,5 +1,5 @@
/*
- * oprofile/op_model_e500.c
+ * oprofile/op_model_fsl_booke.c
*
* Freescale Book-E oprofile support, based on ppc64 oprofile support
* Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
@@ -32,6 +32,70 @@ static unsigned long reset_value[OP_MAX_
static int num_counters;
static int oprofile_running;
+static inline u32 get_pmlca(int ctr)
+{
+ u32 pmlca;
+
+ switch (ctr) {
+ case 0:
+ pmlca = mfpmr(PMRN_PMLCA0);
+ break;
+ case 1:
+ pmlca = mfpmr(PMRN_PMLCA1);
+ break;
+ case 2:
+ pmlca = mfpmr(PMRN_PMLCA2);
+ break;
+ case 3:
+ pmlca = mfpmr(PMRN_PMLCA3);
+ break;
+ default:
+ panic("Bad ctr number\n");
+ }
+
+ return pmlca;
+}
+
+static inline void set_pmlca(int ctr, u32 pmlca)
+{
+ switch (ctr) {
+ case 0:
+ mtpmr(PMRN_PMLCA0, pmlca);
+ break;
+ case 1:
+ mtpmr(PMRN_PMLCA1, pmlca);
+ break;
+ case 2:
+ mtpmr(PMRN_PMLCA2, pmlca);
+ break;
+ case 3:
+ mtpmr(PMRN_PMLCA3, pmlca);
+ break;
+ default:
+ panic("Bad ctr number\n");
+ }
+}
+
+static inline void set_pmlcb(int ctr, u32 pmlcb)
+{
+ switch (ctr) {
+ case 0:
+ mtpmr(PMRN_PMLCB0, pmlcb);
+ break;
+ case 1:
+ mtpmr(PMRN_PMLCB1, pmlcb);
+ break;
+ case 2:
+ mtpmr(PMRN_PMLCB2, pmlcb);
+ break;
+ case 3:
+ mtpmr(PMRN_PMLCB3, pmlcb);
+ break;
+ default:
+ panic("Bad ctr number\n");
+ }
+}
+
static inline unsigned int ctr_read(unsigned int i)
{
switch(i) {
@@ -68,6 +132,88 @@ static inline void ctr_write(unsigned in
}
}
+#define PMLCA_INIT (PMLCA_FC | PMLCA_FCS | PMLCA_FCU | PMLCA_FCM1 | PMLCA_FCM0)
+void configure_pmc(int ctr, int event, int user, int kernel)
+{
+ u32 pmlca;
+
+ /* Configure the config registers */
+ pmlca = (PMLCA_INIT & ~PMLCA_EVENT_MASK) |
+ ((event << PMLCA_EVENT_SHIFT) &
+ PMLCA_EVENT_MASK);
+
+ if(user)
+ pmlca &= ~PMLCA_FCU;
+ else
+ pmlca |= PMLCA_FCU;
+
+ if(kernel)
+ pmlca &= ~PMLCA_FCS;
+ else
+ pmlca |= PMLCA_FCS;
+
+ set_pmlca(ctr, pmlca);
+ set_pmlcb(ctr, 0);
+}
+
+void pmc_enable_ctr(int ctr)
+{
+ u32 pmlca = get_pmlca(ctr);
+
+ pmlca &= ~(PMLCA_FC | PMLCA_FCM0);
+
+ pmlca |= PMLCA_CE;
+
+ set_pmlca(ctr, pmlca);
+}
+
+void pmc_start_ctrs(void)
+{
+ u32 pmgc0 = mfpmr(PMRN_PMGC0);
+
+ pmgc0 &= ~PMGC0_FAC;
+ pmgc0 |= (PMGC0_FCECE | PMGC0_PMIE);
+
+ mtpmr(PMRN_PMGC0, pmgc0);
+}
+
+void pmc_stop_ctrs(void)
+{
+ u32 pmgc0 = mfpmr(PMRN_PMGC0);
+
+ pmgc0 |= PMGC0_FAC;
+
+ pmgc0 &= ~(PMGC0_PMIE | PMGC0_FCECE);
+
+ mtpmr(PMRN_PMGC0, pmgc0);
+}
+
+void dump_pmcs(void)
+{
+ printk("pmgc0: %x\n", mfpmr(PMRN_PMGC0));
+ printk("pmc\t\tpmlca\t\tpmlcb\n");
+ printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC0),
+ mfpmr(PMRN_PMLCA0), mfpmr(PMRN_PMLCB0));
+ printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC1),
+ mfpmr(PMRN_PMLCA1), mfpmr(PMRN_PMLCB1));
+ printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC2),
+ mfpmr(PMRN_PMLCA2), mfpmr(PMRN_PMLCB2));
+ printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC3),
+ mfpmr(PMRN_PMLCA3), mfpmr(PMRN_PMLCB3));
+}
+
+static void fsl_booke_cpu_setup(void *info)
+{
+ int i;
+ struct op_counter_config *ctr = (struct op_counter_config *)info;
+
+ /* freeze all counters */
+ pmc_stop_ctrs();
+
+ for (i=0;i < num_counters; i++)
+ configure_pmc(i, ctr[i].event, ctr[i].user, ctr[i].kernel);
+}
+
static void fsl_booke_reg_setup(struct op_counter_config *ctr,
struct op_system_config *sys,
@@ -77,23 +223,13 @@ static void fsl_booke_reg_setup(struct o
num_counters = num_ctrs;
- /* freeze all counters */
- pmc_stop_ctrs();
-
/* Our counters count up, and "count" refers to
* how much before the next interrupt, and we interrupt
* on overflow. So we calculate the starting value
* which will give us "count" until overflow.
* Then we set the events on the enabled counters */
- for (i = 0; i < num_counters; ++i) {
+ for (i = 0; i < num_counters; ++i)
reset_value[i] = 0x80000000UL - ctr[i].count;
-
- init_pmc_stop(i);
-
- set_pmc_event(i, ctr[i].event);
-
- set_pmc_user_kernel(i, ctr[i].user, ctr[i].kernel);
- }
}
static void fsl_booke_start(struct op_counter_config *ctr)
@@ -105,22 +241,16 @@ static void fsl_booke_start(struct op_co
for (i = 0; i < num_counters; ++i) {
if (ctr[i].enabled) {
ctr_write(i, reset_value[i]);
- /* Set Each enabled counterd to only
- * count when the Mark bit is not set */
- set_pmc_marked(i, 1, 0);
- pmc_start_ctr(i, 1);
- } else {
- ctr_write(i, 0);
- /* Set the ctr to be stopped */
- pmc_start_ctr(i, 0);
- }
+ pmc_enable_ctr(i);
+ } else
+ ctr_write(i, 0);
}
/* Clear the freeze bit, and enable the interrupt.
* The counters won't actually start until the rfi clears
* the PMM bit */
- pmc_start_ctrs(1);
+ pmc_start_ctrs();
oprofile_running = 1;
@@ -172,11 +302,12 @@ static void fsl_booke_handle_interrupt(s
/* Clear the freeze bit, and reenable the interrupt.
* The counters won't actually start until the rfi clears
* the PMM bit */
- pmc_start_ctrs(1);
+ pmc_start_ctrs();
}
struct op_powerpc_model op_model_fsl_booke = {
.reg_setup = fsl_booke_reg_setup,
+ .cpu_setup = fsl_booke_cpu_setup,
.start = fsl_booke_start,
.stop = fsl_booke_stop,
.handle_interrupt = fsl_booke_handle_interrupt,
diff --git a/arch/powerpc/oprofile/op_model_rs64.c b/arch/powerpc/oprofile/op_model_rs64.c
index e010b85..4aeb077 100644
--- a/arch/powerpc/oprofile/op_model_rs64.c
+++ b/arch/powerpc/oprofile/op_model_rs64.c
@@ -148,7 +148,7 @@ static void rs64_start(struct op_counter
/*
* now clear the freeze bit, counting will not start until we
- * rfid from this excetion, because only at that point will
+ * rfid from this exception, because only at that point will
* the PMM bit be cleared
*/
mmcr0 &= ~MMCR0_FC;
diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
index 0bb23fc..4d1bdce 100644
--- a/arch/ppc/kernel/Makefile
+++ b/arch/ppc/kernel/Makefile
@@ -26,9 +26,6 @@ obj-$(CONFIG_RAPIDIO) += rio.o
obj-$(CONFIG_KGDB) += ppc-stub.o
obj-$(CONFIG_SMP) += smp.o smp-tbsync.o
obj-$(CONFIG_TAU) += temp.o
-ifndef CONFIG_E200
-obj-$(CONFIG_FSL_BOOKE) += perfmon_fsl_booke.o
-endif
obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
ifndef CONFIG_MATH_EMULATION
diff --git a/arch/ppc/kernel/perfmon_fsl_booke.c b/arch/ppc/kernel/perfmon_fsl_booke.c
deleted file mode 100644
index 32455df..0000000
--- a/arch/ppc/kernel/perfmon_fsl_booke.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/* kernel/perfmon_fsl_booke.c
- * Freescale Book-E Performance Monitor code
- *
- * Author: Andy Fleming
- * Copyright (c) 2004 Freescale Semiconductor, Inc
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/stddef.h>
-#include <linux/unistd.h>
-#include <linux/ptrace.h>
-#include <linux/slab.h>
-#include <linux/user.h>
-#include <linux/a.out.h>
-#include <linux/interrupt.h>
-#include <linux/config.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/prctl.h>
-
-#include <asm/pgtable.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/reg.h>
-#include <asm/xmon.h>
-#include <asm/pmc.h>
-
-static inline u32 get_pmlca(int ctr);
-static inline void set_pmlca(int ctr, u32 pmlca);
-
-static inline u32 get_pmlca(int ctr)
-{
- u32 pmlca;
-
- switch (ctr) {
- case 0:
- pmlca = mfpmr(PMRN_PMLCA0);
- break;
- case 1:
- pmlca = mfpmr(PMRN_PMLCA1);
- break;
- case 2:
- pmlca = mfpmr(PMRN_PMLCA2);
- break;
- case 3:
- pmlca = mfpmr(PMRN_PMLCA3);
- break;
- default:
- panic("Bad ctr number\n");
- }
-
- return pmlca;
-}
-
-static inline void set_pmlca(int ctr, u32 pmlca)
-{
- switch (ctr) {
- case 0:
- mtpmr(PMRN_PMLCA0, pmlca);
- break;
- case 1:
- mtpmr(PMRN_PMLCA1, pmlca);
- break;
- case 2:
- mtpmr(PMRN_PMLCA2, pmlca);
- break;
- case 3:
- mtpmr(PMRN_PMLCA3, pmlca);
- break;
- default:
- panic("Bad ctr number\n");
- }
-}
-
-void init_pmc_stop(int ctr)
-{
- u32 pmlca = (PMLCA_FC | PMLCA_FCS | PMLCA_FCU |
- PMLCA_FCM1 | PMLCA_FCM0);
- u32 pmlcb = 0;
-
- switch (ctr) {
- case 0:
- mtpmr(PMRN_PMLCA0, pmlca);
- mtpmr(PMRN_PMLCB0, pmlcb);
- break;
- case 1:
- mtpmr(PMRN_PMLCA1, pmlca);
- mtpmr(PMRN_PMLCB1, pmlcb);
- break;
- case 2:
- mtpmr(PMRN_PMLCA2, pmlca);
- mtpmr(PMRN_PMLCB2, pmlcb);
- break;
- case 3:
- mtpmr(PMRN_PMLCA3, pmlca);
- mtpmr(PMRN_PMLCB3, pmlcb);
- break;
- default:
- panic("Bad ctr number!\n");
- }
-}
-
-void set_pmc_event(int ctr, int event)
-{
- u32 pmlca;
-
- pmlca = get_pmlca(ctr);
-
- pmlca = (pmlca & ~PMLCA_EVENT_MASK) |
- ((event << PMLCA_EVENT_SHIFT) &
- PMLCA_EVENT_MASK);
-
- set_pmlca(ctr, pmlca);
-}
-
-void set_pmc_user_kernel(int ctr, int user, int kernel)
-{
- u32 pmlca;
-
- pmlca = get_pmlca(ctr);
-
- if(user)
- pmlca &= ~PMLCA_FCU;
- else
- pmlca |= PMLCA_FCU;
-
- if(kernel)
- pmlca &= ~PMLCA_FCS;
- else
- pmlca |= PMLCA_FCS;
-
- set_pmlca(ctr, pmlca);
-}
-
-void set_pmc_marked(int ctr, int mark0, int mark1)
-{
- u32 pmlca = get_pmlca(ctr);
-
- if(mark0)
- pmlca &= ~PMLCA_FCM0;
- else
- pmlca |= PMLCA_FCM0;
-
- if(mark1)
- pmlca &= ~PMLCA_FCM1;
- else
- pmlca |= PMLCA_FCM1;
-
- set_pmlca(ctr, pmlca);
-}
-
-void pmc_start_ctr(int ctr, int enable)
-{
- u32 pmlca = get_pmlca(ctr);
-
- pmlca &= ~PMLCA_FC;
-
- if (enable)
- pmlca |= PMLCA_CE;
- else
- pmlca &= ~PMLCA_CE;
-
- set_pmlca(ctr, pmlca);
-}
-
-void pmc_start_ctrs(int enable)
-{
- u32 pmgc0 = mfpmr(PMRN_PMGC0);
-
- pmgc0 &= ~PMGC0_FAC;
- pmgc0 |= PMGC0_FCECE;
-
- if (enable)
- pmgc0 |= PMGC0_PMIE;
- else
- pmgc0 &= ~PMGC0_PMIE;
-
- mtpmr(PMRN_PMGC0, pmgc0);
-}
-
-void pmc_stop_ctrs(void)
-{
- u32 pmgc0 = mfpmr(PMRN_PMGC0);
-
- pmgc0 |= PMGC0_FAC;
-
- pmgc0 &= ~(PMGC0_PMIE | PMGC0_FCECE);
-
- mtpmr(PMRN_PMGC0, pmgc0);
-}
-
-void dump_pmcs(void)
-{
- printk("pmgc0: %x\n", mfpmr(PMRN_PMGC0));
- printk("pmc\t\tpmlca\t\tpmlcb\n");
- printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC0),
- mfpmr(PMRN_PMLCA0), mfpmr(PMRN_PMLCB0));
- printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC1),
- mfpmr(PMRN_PMLCA1), mfpmr(PMRN_PMLCB1));
- printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC2),
- mfpmr(PMRN_PMLCA2), mfpmr(PMRN_PMLCB2));
- printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC3),
- mfpmr(PMRN_PMLCA3), mfpmr(PMRN_PMLCB3));
-}
-
-EXPORT_SYMBOL(init_pmc_stop);
-EXPORT_SYMBOL(set_pmc_event);
-EXPORT_SYMBOL(set_pmc_user_kernel);
-EXPORT_SYMBOL(set_pmc_marked);
-EXPORT_SYMBOL(pmc_start_ctr);
-EXPORT_SYMBOL(pmc_start_ctrs);
-EXPORT_SYMBOL(pmc_stop_ctrs);
-EXPORT_SYMBOL(dump_pmcs);
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index b48d35e..6cc7f16 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -22,7 +22,8 @@ struct op_counter_config {
unsigned long enabled;
unsigned long event;
unsigned long count;
- /* Classic doesn't support per-counter user/kernel selection */
+ /* Classic PPC parts (both 64 and 32 bit) don't support
+ * per-counter user/kernel selection */
unsigned long kernel;
unsigned long user;
unsigned long unit_mask;
@@ -34,12 +35,10 @@ struct op_system_config {
unsigned long mmcr0;
unsigned long mmcr1;
unsigned long mmcra;
+ unsigned long backtrace_spinlocks;
#endif
unsigned long enable_kernel;
unsigned long enable_user;
-#ifdef CONFIG_PPC64
- unsigned long backtrace_spinlocks;
-#endif
};
/* Per-arch configuration */
diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h
index 5f41f3a..1f6643d 100644
--- a/include/asm-powerpc/pmc.h
+++ b/include/asm-powerpc/pmc.h
@@ -31,17 +31,4 @@ void release_pmc_hardware(void);
void power4_enable_pmcs(void);
#endif
-#ifdef CONFIG_FSL_BOOKE
-void init_pmc_stop(int ctr);
-void set_pmc_event(int ctr, int event);
-void set_pmc_user_kernel(int ctr, int user, int kernel);
-void set_pmc_marked(int ctr, int mark0, int mark1);
-void pmc_start_ctr(int ctr, int enable);
-void pmc_start_ctrs(int enable);
-void pmc_stop_ctrs(void);
-void dump_pmcs(void);
-
-extern struct op_powerpc_model op_model_fsl_booke;
-#endif
-
#endif /* _POWERPC_PMC_H */
^ permalink raw reply related
* Re: [PATCH] Fix e500 oprofile support
From: Kumar Gala @ 2006-01-11 22:31 UTC (permalink / raw)
To: Andy Fleming; +Cc: linuxppc-embedded
In-Reply-To: <Pine.LNX.4.61.0601111538240.30214@ld0175-tx32.am.freescale.net>
On Wed, 11 Jan 2006, Andy Fleming wrote:
> This patch needs to go in quickly to fix e500 oprofile support. I didn't
> realize the 7450 oprofile support patch had gone in, yet!
>
> Signed-off-by: Andy Fleming <afleming@freescale.com>
>
> * Fixed oprofile support on e500 so it doesn't included 7450 support
> * Modified the SMP call of cpu_setup so that it passes in information
> the e500 needs to program the counters
> * Moved all functions in perfmon_fsl_booke.c to op_model_fsl_booke.c
> * e500 oprofile code should now be SMP capable
> * Fixed a typo in rs64
>
> ---
> commit 5ba626800295fdd0402db4535c9b8989365103b7
> tree 383a8f67ae5c31b991e09ebd549ffe84c1f200d7
> parent 44e22e7c3358c79517685e7b66ffae17da6f8399
> author Andrew Fleming <afleming@freescale.com> Wed, 11 Jan 2006 15:35:47 -0600
> committer Andrew Fleming <afleming@ld0175-tx32.(none)> Wed, 11 Jan 2006 15:35:47 -0600
>
> arch/powerpc/oprofile/Makefile | 2
> arch/powerpc/oprofile/common.c | 2
> arch/powerpc/oprofile/op_model_fsl_booke.c | 177 +++++++++++++++++++---
> arch/powerpc/oprofile/op_model_rs64.c | 2
> arch/ppc/kernel/Makefile | 3
> arch/ppc/kernel/perfmon_fsl_booke.c | 222 ----------------------------
> include/asm-powerpc/oprofile_impl.h | 7 -
> include/asm-powerpc/pmc.h | 13 --
> 8 files changed, 160 insertions(+), 268 deletions(-)
>
> diff --git a/arch/powerpc/oprofile/Makefile b/arch/powerpc/oprofile/Makefile
> index 554cd7c..74db517 100644
> --- a/arch/powerpc/oprofile/Makefile
> +++ b/arch/powerpc/oprofile/Makefile
> @@ -9,4 +9,4 @@ DRIVER_OBJS := $(addprefix ../../../driv
> oprofile-y := $(DRIVER_OBJS) common.o
> oprofile-$(CONFIG_PPC64) += op_model_rs64.o op_model_power4.o
> oprofile-$(CONFIG_FSL_BOOKE) += op_model_fsl_booke.o
Make this depend on CONFIG_CLASSIC32 instead of CONFIG_6xx.
> -oprofile-$(CONFIG_PPC32) += op_model_7450.o
> +oprofile-$(CONFIG_6xx) += op_model_7450.o
> diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
> index a370778..d7a5afe 100644
> --- a/arch/powerpc/oprofile/common.c
> +++ b/arch/powerpc/oprofile/common.c
> @@ -46,7 +46,7 @@ static int op_powerpc_setup(void)
> model->reg_setup(ctr, &sys, model->num_counters);
>
> /* Configure the registers on all cpus. */
> - on_each_cpu(model->cpu_setup, NULL, 0, 1);
> + on_each_cpu(model->cpu_setup, (void *)ctr, 0, 1);
>
> return 0;
> }
> diff --git a/arch/powerpc/oprofile/op_model_fsl_booke.c b/arch/powerpc/oprofile/op_model_fsl_booke.c
> index 26539cd..993147a 100644
> --- a/arch/powerpc/oprofile/op_model_fsl_booke.c
> +++ b/arch/powerpc/oprofile/op_model_fsl_booke.c
> @@ -1,5 +1,5 @@
> /*
> - * oprofile/op_model_e500.c
> + * oprofile/op_model_fsl_booke.c
> *
> * Freescale Book-E oprofile support, based on ppc64 oprofile support
> * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
> @@ -32,6 +32,70 @@ static unsigned long reset_value[OP_MAX_
> static int num_counters;
> static int oprofile_running;
>
> +static inline u32 get_pmlca(int ctr)
> +{
> + u32 pmlca;
> +
> + switch (ctr) {
> + case 0:
> + pmlca = mfpmr(PMRN_PMLCA0);
> + break;
> + case 1:
> + pmlca = mfpmr(PMRN_PMLCA1);
> + break;
> + case 2:
> + pmlca = mfpmr(PMRN_PMLCA2);
> + break;
> + case 3:
> + pmlca = mfpmr(PMRN_PMLCA3);
> + break;
> + default:
> + panic("Bad ctr number\n");
> + }
> +
> + return pmlca;
> +}
> +
> +static inline void set_pmlca(int ctr, u32 pmlca)
> +{
> + switch (ctr) {
> + case 0:
> + mtpmr(PMRN_PMLCA0, pmlca);
> + break;
> + case 1:
> + mtpmr(PMRN_PMLCA1, pmlca);
> + break;
> + case 2:
> + mtpmr(PMRN_PMLCA2, pmlca);
> + break;
> + case 3:
> + mtpmr(PMRN_PMLCA3, pmlca);
> + break;
> + default:
> + panic("Bad ctr number\n");
> + }
> +}
> +
> +static inline void set_pmlcb(int ctr, u32 pmlcb)
> +{
> + switch (ctr) {
> + case 0:
> + mtpmr(PMRN_PMLCB0, pmlcb);
> + break;
> + case 1:
> + mtpmr(PMRN_PMLCB1, pmlcb);
> + break;
> + case 2:
> + mtpmr(PMRN_PMLCB2, pmlcb);
> + break;
> + case 3:
> + mtpmr(PMRN_PMLCB3, pmlcb);
> + break;
> + default:
> + panic("Bad ctr number\n");
> + }
> +}
> +
> static inline unsigned int ctr_read(unsigned int i)
> {
> switch(i) {
> @@ -68,6 +132,88 @@ static inline void ctr_write(unsigned in
> }
> }
>
> +#define PMLCA_INIT (PMLCA_FC | PMLCA_FCS | PMLCA_FCU | PMLCA_FCM1 | PMLCA_FCM0)
> +void configure_pmc(int ctr, int event, int user, int kernel)
> +{
> + u32 pmlca;
> +
> + /* Configure the config registers */
> + pmlca = (PMLCA_INIT & ~PMLCA_EVENT_MASK) |
> + ((event << PMLCA_EVENT_SHIFT) &
> + PMLCA_EVENT_MASK);
> +
> + if(user)
> + pmlca &= ~PMLCA_FCU;
> + else
> + pmlca |= PMLCA_FCU;
> +
> + if(kernel)
> + pmlca &= ~PMLCA_FCS;
> + else
> + pmlca |= PMLCA_FCS;
> +
> + set_pmlca(ctr, pmlca);
> + set_pmlcb(ctr, 0);
> +}
> +
> +void pmc_enable_ctr(int ctr)
> +{
> + u32 pmlca = get_pmlca(ctr);
> +
> + pmlca &= ~(PMLCA_FC | PMLCA_FCM0);
> +
> + pmlca |= PMLCA_CE;
> +
> + set_pmlca(ctr, pmlca);
> +}
> +
> +void pmc_start_ctrs(void)
> +{
> + u32 pmgc0 = mfpmr(PMRN_PMGC0);
> +
> + pmgc0 &= ~PMGC0_FAC;
> + pmgc0 |= (PMGC0_FCECE | PMGC0_PMIE);
> +
> + mtpmr(PMRN_PMGC0, pmgc0);
> +}
> +
> +void pmc_stop_ctrs(void)
> +{
> + u32 pmgc0 = mfpmr(PMRN_PMGC0);
> +
> + pmgc0 |= PMGC0_FAC;
> +
> + pmgc0 &= ~(PMGC0_PMIE | PMGC0_FCECE);
> +
> + mtpmr(PMRN_PMGC0, pmgc0);
> +}
> +
> +void dump_pmcs(void)
> +{
> + printk("pmgc0: %x\n", mfpmr(PMRN_PMGC0));
> + printk("pmc\t\tpmlca\t\tpmlcb\n");
> + printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC0),
> + mfpmr(PMRN_PMLCA0), mfpmr(PMRN_PMLCB0));
> + printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC1),
> + mfpmr(PMRN_PMLCA1), mfpmr(PMRN_PMLCB1));
> + printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC2),
> + mfpmr(PMRN_PMLCA2), mfpmr(PMRN_PMLCB2));
> + printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC3),
> + mfpmr(PMRN_PMLCA3), mfpmr(PMRN_PMLCB3));
> +}
> +
> +static void fsl_booke_cpu_setup(void *info)
> +{
> + int i;
> + struct op_counter_config *ctr = (struct op_counter_config *)info;
> +
> + /* freeze all counters */
> + pmc_stop_ctrs();
> +
> + for (i=0;i < num_counters; i++)
> + configure_pmc(i, ctr[i].event, ctr[i].user, ctr[i].kernel);
> +}
> +
>
> static void fsl_booke_reg_setup(struct op_counter_config *ctr,
> struct op_system_config *sys,
> @@ -77,23 +223,13 @@ static void fsl_booke_reg_setup(struct o
>
> num_counters = num_ctrs;
>
> - /* freeze all counters */
> - pmc_stop_ctrs();
> -
> /* Our counters count up, and "count" refers to
> * how much before the next interrupt, and we interrupt
> * on overflow. So we calculate the starting value
> * which will give us "count" until overflow.
> * Then we set the events on the enabled counters */
> - for (i = 0; i < num_counters; ++i) {
> + for (i = 0; i < num_counters; ++i)
> reset_value[i] = 0x80000000UL - ctr[i].count;
> -
> - init_pmc_stop(i);
> -
> - set_pmc_event(i, ctr[i].event);
> -
> - set_pmc_user_kernel(i, ctr[i].user, ctr[i].kernel);
> - }
> }
>
> static void fsl_booke_start(struct op_counter_config *ctr)
> @@ -105,22 +241,16 @@ static void fsl_booke_start(struct op_co
> for (i = 0; i < num_counters; ++i) {
> if (ctr[i].enabled) {
> ctr_write(i, reset_value[i]);
> - /* Set Each enabled counterd to only
> - * count when the Mark bit is not set */
> - set_pmc_marked(i, 1, 0);
> - pmc_start_ctr(i, 1);
> - } else {
> - ctr_write(i, 0);
>
> - /* Set the ctr to be stopped */
> - pmc_start_ctr(i, 0);
> - }
> + pmc_enable_ctr(i);
> + } else
> + ctr_write(i, 0);
> }
>
> /* Clear the freeze bit, and enable the interrupt.
> * The counters won't actually start until the rfi clears
> * the PMM bit */
> - pmc_start_ctrs(1);
> + pmc_start_ctrs();
>
> oprofile_running = 1;
>
> @@ -172,11 +302,12 @@ static void fsl_booke_handle_interrupt(s
> /* Clear the freeze bit, and reenable the interrupt.
> * The counters won't actually start until the rfi clears
> * the PMM bit */
> - pmc_start_ctrs(1);
> + pmc_start_ctrs();
> }
>
> struct op_powerpc_model op_model_fsl_booke = {
> .reg_setup = fsl_booke_reg_setup,
> + .cpu_setup = fsl_booke_cpu_setup,
> .start = fsl_booke_start,
> .stop = fsl_booke_stop,
> .handle_interrupt = fsl_booke_handle_interrupt,
> diff --git a/arch/powerpc/oprofile/op_model_rs64.c b/arch/powerpc/oprofile/op_model_rs64.c
> index e010b85..4aeb077 100644
> --- a/arch/powerpc/oprofile/op_model_rs64.c
> +++ b/arch/powerpc/oprofile/op_model_rs64.c
> @@ -148,7 +148,7 @@ static void rs64_start(struct op_counter
>
> /*
> * now clear the freeze bit, counting will not start until we
> - * rfid from this excetion, because only at that point will
> + * rfid from this exception, because only at that point will
> * the PMM bit be cleared
> */
> mmcr0 &= ~MMCR0_FC;
> diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
> index 0bb23fc..4d1bdce 100644
> --- a/arch/ppc/kernel/Makefile
> +++ b/arch/ppc/kernel/Makefile
> @@ -26,9 +26,6 @@ obj-$(CONFIG_RAPIDIO) += rio.o
> obj-$(CONFIG_KGDB) += ppc-stub.o
> obj-$(CONFIG_SMP) += smp.o smp-tbsync.o
> obj-$(CONFIG_TAU) += temp.o
> -ifndef CONFIG_E200
> -obj-$(CONFIG_FSL_BOOKE) += perfmon_fsl_booke.o
> -endif
> obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
>
> ifndef CONFIG_MATH_EMULATION
> diff --git a/arch/ppc/kernel/perfmon_fsl_booke.c b/arch/ppc/kernel/perfmon_fsl_booke.c
> deleted file mode 100644
> index 32455df..0000000
> --- a/arch/ppc/kernel/perfmon_fsl_booke.c
> +++ /dev/null
> @@ -1,222 +0,0 @@
> -/* kernel/perfmon_fsl_booke.c
> - * Freescale Book-E Performance Monitor code
> - *
> - * Author: Andy Fleming
> - * Copyright (c) 2004 Freescale Semiconductor, Inc
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version
> - * 2 of the License, or (at your option) any later version.
> - */
> -
> -#include <linux/errno.h>
> -#include <linux/sched.h>
> -#include <linux/kernel.h>
> -#include <linux/mm.h>
> -#include <linux/stddef.h>
> -#include <linux/unistd.h>
> -#include <linux/ptrace.h>
> -#include <linux/slab.h>
> -#include <linux/user.h>
> -#include <linux/a.out.h>
> -#include <linux/interrupt.h>
> -#include <linux/config.h>
> -#include <linux/init.h>
> -#include <linux/module.h>
> -#include <linux/prctl.h>
> -
> -#include <asm/pgtable.h>
> -#include <asm/uaccess.h>
> -#include <asm/system.h>
> -#include <asm/io.h>
> -#include <asm/reg.h>
> -#include <asm/xmon.h>
> -#include <asm/pmc.h>
> -
> -static inline u32 get_pmlca(int ctr);
> -static inline void set_pmlca(int ctr, u32 pmlca);
> -
> -static inline u32 get_pmlca(int ctr)
> -{
> - u32 pmlca;
> -
> - switch (ctr) {
> - case 0:
> - pmlca = mfpmr(PMRN_PMLCA0);
> - break;
> - case 1:
> - pmlca = mfpmr(PMRN_PMLCA1);
> - break;
> - case 2:
> - pmlca = mfpmr(PMRN_PMLCA2);
> - break;
> - case 3:
> - pmlca = mfpmr(PMRN_PMLCA3);
> - break;
> - default:
> - panic("Bad ctr number\n");
> - }
> -
> - return pmlca;
> -}
> -
> -static inline void set_pmlca(int ctr, u32 pmlca)
> -{
> - switch (ctr) {
> - case 0:
> - mtpmr(PMRN_PMLCA0, pmlca);
> - break;
> - case 1:
> - mtpmr(PMRN_PMLCA1, pmlca);
> - break;
> - case 2:
> - mtpmr(PMRN_PMLCA2, pmlca);
> - break;
> - case 3:
> - mtpmr(PMRN_PMLCA3, pmlca);
> - break;
> - default:
> - panic("Bad ctr number\n");
> - }
> -}
> -
> -void init_pmc_stop(int ctr)
> -{
> - u32 pmlca = (PMLCA_FC | PMLCA_FCS | PMLCA_FCU |
> - PMLCA_FCM1 | PMLCA_FCM0);
> - u32 pmlcb = 0;
> -
> - switch (ctr) {
> - case 0:
> - mtpmr(PMRN_PMLCA0, pmlca);
> - mtpmr(PMRN_PMLCB0, pmlcb);
> - break;
> - case 1:
> - mtpmr(PMRN_PMLCA1, pmlca);
> - mtpmr(PMRN_PMLCB1, pmlcb);
> - break;
> - case 2:
> - mtpmr(PMRN_PMLCA2, pmlca);
> - mtpmr(PMRN_PMLCB2, pmlcb);
> - break;
> - case 3:
> - mtpmr(PMRN_PMLCA3, pmlca);
> - mtpmr(PMRN_PMLCB3, pmlcb);
> - break;
> - default:
> - panic("Bad ctr number!\n");
> - }
> -}
> -
> -void set_pmc_event(int ctr, int event)
> -{
> - u32 pmlca;
> -
> - pmlca = get_pmlca(ctr);
> -
> - pmlca = (pmlca & ~PMLCA_EVENT_MASK) |
> - ((event << PMLCA_EVENT_SHIFT) &
> - PMLCA_EVENT_MASK);
> -
> - set_pmlca(ctr, pmlca);
> -}
> -
> -void set_pmc_user_kernel(int ctr, int user, int kernel)
> -{
> - u32 pmlca;
> -
> - pmlca = get_pmlca(ctr);
> -
> - if(user)
> - pmlca &= ~PMLCA_FCU;
> - else
> - pmlca |= PMLCA_FCU;
> -
> - if(kernel)
> - pmlca &= ~PMLCA_FCS;
> - else
> - pmlca |= PMLCA_FCS;
> -
> - set_pmlca(ctr, pmlca);
> -}
> -
> -void set_pmc_marked(int ctr, int mark0, int mark1)
> -{
> - u32 pmlca = get_pmlca(ctr);
> -
> - if(mark0)
> - pmlca &= ~PMLCA_FCM0;
> - else
> - pmlca |= PMLCA_FCM0;
> -
> - if(mark1)
> - pmlca &= ~PMLCA_FCM1;
> - else
> - pmlca |= PMLCA_FCM1;
> -
> - set_pmlca(ctr, pmlca);
> -}
> -
> -void pmc_start_ctr(int ctr, int enable)
> -{
> - u32 pmlca = get_pmlca(ctr);
> -
> - pmlca &= ~PMLCA_FC;
> -
> - if (enable)
> - pmlca |= PMLCA_CE;
> - else
> - pmlca &= ~PMLCA_CE;
> -
> - set_pmlca(ctr, pmlca);
> -}
> -
> -void pmc_start_ctrs(int enable)
> -{
> - u32 pmgc0 = mfpmr(PMRN_PMGC0);
> -
> - pmgc0 &= ~PMGC0_FAC;
> - pmgc0 |= PMGC0_FCECE;
> -
> - if (enable)
> - pmgc0 |= PMGC0_PMIE;
> - else
> - pmgc0 &= ~PMGC0_PMIE;
> -
> - mtpmr(PMRN_PMGC0, pmgc0);
> -}
> -
> -void pmc_stop_ctrs(void)
> -{
> - u32 pmgc0 = mfpmr(PMRN_PMGC0);
> -
> - pmgc0 |= PMGC0_FAC;
> -
> - pmgc0 &= ~(PMGC0_PMIE | PMGC0_FCECE);
> -
> - mtpmr(PMRN_PMGC0, pmgc0);
> -}
> -
> -void dump_pmcs(void)
> -{
> - printk("pmgc0: %x\n", mfpmr(PMRN_PMGC0));
> - printk("pmc\t\tpmlca\t\tpmlcb\n");
> - printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC0),
> - mfpmr(PMRN_PMLCA0), mfpmr(PMRN_PMLCB0));
> - printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC1),
> - mfpmr(PMRN_PMLCA1), mfpmr(PMRN_PMLCB1));
> - printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC2),
> - mfpmr(PMRN_PMLCA2), mfpmr(PMRN_PMLCB2));
> - printk("%8x\t%8x\t%8x\n", mfpmr(PMRN_PMC3),
> - mfpmr(PMRN_PMLCA3), mfpmr(PMRN_PMLCB3));
> -}
> -
> -EXPORT_SYMBOL(init_pmc_stop);
> -EXPORT_SYMBOL(set_pmc_event);
> -EXPORT_SYMBOL(set_pmc_user_kernel);
> -EXPORT_SYMBOL(set_pmc_marked);
> -EXPORT_SYMBOL(pmc_start_ctr);
> -EXPORT_SYMBOL(pmc_start_ctrs);
> -EXPORT_SYMBOL(pmc_stop_ctrs);
> -EXPORT_SYMBOL(dump_pmcs);
> diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
> index b48d35e..6cc7f16 100644
> --- a/include/asm-powerpc/oprofile_impl.h
> +++ b/include/asm-powerpc/oprofile_impl.h
> @@ -22,7 +22,8 @@ struct op_counter_config {
> unsigned long enabled;
> unsigned long event;
> unsigned long count;
> - /* Classic doesn't support per-counter user/kernel selection */
> + /* Classic PPC parts (both 64 and 32 bit) don't support
> + * per-counter user/kernel selection */
> unsigned long kernel;
> unsigned long user;
> unsigned long unit_mask;
> @@ -34,12 +35,10 @@ struct op_system_config {
> unsigned long mmcr0;
> unsigned long mmcr1;
> unsigned long mmcra;
> + unsigned long backtrace_spinlocks;
> #endif
> unsigned long enable_kernel;
> unsigned long enable_user;
> -#ifdef CONFIG_PPC64
> - unsigned long backtrace_spinlocks;
> -#endif
> };
>
> /* Per-arch configuration */
> diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h
> index 5f41f3a..1f6643d 100644
> --- a/include/asm-powerpc/pmc.h
> +++ b/include/asm-powerpc/pmc.h
> @@ -31,17 +31,4 @@ void release_pmc_hardware(void);
> void power4_enable_pmcs(void);
> #endif
>
> -#ifdef CONFIG_FSL_BOOKE
> -void init_pmc_stop(int ctr);
> -void set_pmc_event(int ctr, int event);
> -void set_pmc_user_kernel(int ctr, int user, int kernel);
> -void set_pmc_marked(int ctr, int mark0, int mark1);
> -void pmc_start_ctr(int ctr, int enable);
> -void pmc_start_ctrs(int enable);
> -void pmc_stop_ctrs(void);
> -void dump_pmcs(void);
> -
> -extern struct op_powerpc_model op_model_fsl_booke;
> -#endif
> -
> #endif /* _POWERPC_PMC_H */
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
^ permalink raw reply
* Re: AGPGART driver for ArticiaS - ioremap() problem
From: Gerhard Pircher @ 2006-01-11 22:18 UTC (permalink / raw)
To: John W. Linville; +Cc: linuxppc-dev, debian-powerpc
In-Reply-To: <20060111215218.GF27985@tuxdriver.com>
Hi,
> --- Ursprüngliche Nachricht ---
> Von: "John W. Linville" <linville@tuxdriver.com>
> An: Gerhard Pircher <gerhard_stamer@gmx.net>
> Kopie: linuxppc-dev@ozlabs.org, debian-powerpc@lists.debian.org
> Betreff: Re: AGPGART driver for ArticiaS - ioremap() problem
> Datum: Wed, 11 Jan 2006 16:52:21 -0500
>
> It probably wouldn't hurt to include the source (or a url pointing
> to it)... :-)
Probably not, so here is it: ;-)
####### START ########
/*
* ArticiaS AGPGART routines.
*/
#include <linux/types.h>
#include <linux/module.h>
#include <linux/pagemap.h>
#include <linux/pci.h>
#include <asm/pci-bridge.h>
#include <linux/init.h>
#include <linux/agp_backend.h>
#include "agp.h"
static struct pci_device_id agp_articias_pci_table[];
#define ARTICIAS_DEBUG
//#define ARTICIAS_FROMUNINORTH
#define ARTICIAS_AGP_EN 0x49 /* bit 0 -> AGP enable */
#define ARTICIAS_GART_EN 0x58 /* bit 6 -> GART enable */
#define ARTICIAS_APSIZE 0x59 /* bits 2:0 set size */
#define ARTICIAS_APBASE 0x59 /* TLB address Base [31:12]*/
#define ARTICIAS_GATTBASE 0x10 /* GART base address register */
#define ARTICIAS_TLB_BASE 0x5A /* bits 16:31 of TLB base address #define
ARTICIAS_GATT_MASK 0xF0000000
#define ARTICIAS_SIZE_MASK 0x07 /* Mask aperture size bits. */
static int articias_fetch_size(void)
{
int i;
u8 temp;
struct aper_size_info_8 *values;
values = A_SIZE_8(agp_bridge->driver->aperture_sizes);
pci_read_config_byte(agp_bridge->dev, ARTICIAS_APSIZE, &temp);
#ifdef ARTICIAS_DEBUG
printk(KERN_INFO PFX "[ARTICIAS] articias_fetch_size()\n");
printk(KERN_INFO PFX "[ARTICIAS] * non masked temp = 0x%x\n", temp);
#endif
/* Mask the GART/Aperture size selection bits. */
temp = temp & ARTICIAS_SIZE_MASK;
for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
#ifdef ARTICIAS_DEBUG
void *temp2;
printk(KERN_INFO PFX "[ARTICIAS] * aperature size loop index #%d\n", i);
printk(KERN_INFO PFX "[ARTICIAS] * values[%d].size_value = %x\n", i, (u32)
values[i].size_value);
#endif
if (temp == values[i].size_value) {
agp_bridge->previous_size =
agp_bridge->current_size = (void *) (values + i);
agp_bridge->aperture_size_idx = i;
#ifdef ARTICIAS_DEBUG
temp2 = agp_bridge->current_size;
printk(KERN_INFO PFX "[ARTICIAS] * masked temp = 0x%x\n", temp);
printk(KERN_INFO PFX "[ARTICIAS] * values[%d].size = %d\n", i,
values[i].size);
printk(KERN_INFO PFX "[ARTICIAS] * current_size->size = %d\n",
A_SIZE_8(temp2)->size);
printk(KERN_INFO PFX "[ARTICIAS] * current_size->page_order = %d\n",
A_SIZE_8(temp2)->page_order);
printk(KERN_INFO PFX "[ARTICIAS] * current_size->num_entries = %d\n",
A_SIZE_8(temp2)->num_entries);
printk(KERN_INFO PFX "[ARTICIAS] * current_size->size_value = %d\n",
A_SIZE_8(temp2)->size_value);
#endif
return values[i].size;
}
}
#ifdef ARTICIAS_FROMUNINORTH
agp_bridge->previous_size =
agp_bridge->current_size = (void *) (values + 1);
agp_bridge->aperture_size_idx = 1;
return values[1].size;
#endif
printk(KERN_ERR PFX "Unknown aperture size from AGP bridge (0x%x)\n",
temp);
return 0;
}
static int articias_configure(void)
{
u32 temp = 0;
u16 shift16 = 0;
u8 shift8 = 0;
struct aper_size_info_8 *current_size;
#ifdef ARTICIAS_DEBUG
printk(KERN_INFO PFX "[ARTICIAS] articias_configure()\n");
#endif
/* Get current aperture size */
current_size = A_SIZE_8(agp_bridge->current_size);
printk(KERN_INFO PFX "configuring for size idx: %d\n",
current_size->size_value);
temp = (u32) agp_bridge->gatt_table_real;
/* Get upper word from dword. */
shift16 = (u16) (temp>>16);
#ifdef ARTICIAS_DEBUG
printk(KERN_INFO PFX "[ARTICIAS] * temp = 0x%x, shift16 = 0x%x\n", temp,
shift16);
#endif
pci_write_config_word(agp_bridge->dev, ARTICIAS_TLB_BASE, shift16);
/* Get the byte 1 from dword and mask it out with the aperture size. */
shift8 = (u8) (temp>>8);
shift8 &= ~(ARTICIAS_SIZE_MASK);
shift8 |= current_size->size_value;
pci_write_config_byte(agp_bridge->dev, ARTICIAS_APBASE, shift8);
#ifdef ARTICIAS_DEBUG
printk(KERN_INFO PFX "[ARTICIAS] * temp = 0x%x, shift8 = 0x%x\n", temp,
shift8);
#endif
/* Get address to map too */
pci_read_config_dword(agp_bridge->dev, ARTICIAS_GATTBASE, (void *)&temp);
temp = temp & ARTICIAS_GATT_MASK;
agp_bridge->gart_bus_addr = temp;
/* GART control register */
/* Enable GART and bus concurrency */
pci_write_config_byte(agp_bridge->dev, ARTICIAS_GART_EN, 0x41);
/* Enable AGP operation */
pci_write_config_byte(agp_bridge->dev, ARTICIAS_AGP_EN, 0x01);
return 0;
}
#ifdef ARTICIAS_FROMUNINORTH
/* Taken from the Uninorth driver (START). */
static int articias_insert_memory(struct agp_memory *mem, off_t pg_start,
int type)
{
int i, j, num_entries;
void *temp;
temp = agp_bridge->current_size;
num_entries = A_SIZE_8(temp)->num_entries;
if (type != 0 || mem->type != 0)
/* We know nothing of memory types */
return -EINVAL;
if ((pg_start + mem->page_count) > num_entries)
return -EINVAL;
j = pg_start;
while (j < (pg_start + mem->page_count)) {
if (!PGE_EMPTY(agp_bridge, agp_bridge->gatt_table[j]))
return -EBUSY;
j++;
}
for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
agp_bridge->gatt_table[j] = cpu_to_le32((mem->memory[i] & 0xfe000000) |
0x00000001UL);
flush_dcache_range((unsigned long)__va(mem->memory[i]),
(unsigned long)__va(mem->memory[i])+0x1000);
}
(void)in_le32((volatile u32*)&agp_bridge->gatt_table[pg_start]);
mb();
flush_dcache_range((unsigned long)&agp_bridge->gatt_table[pg_start],
(unsigned long)&agp_bridge->gatt_table[pg_start + mem->page_count]);
/* Geri: We should perform a TLB flush too!. */
//articias_tlbflush(mem);
return 0;
}
/* Taken from the Uninorth driver */
static int articias_create_gatt_table(void)
{
char *table;
char *table_end;
int size;
int page_order;
int num_entries;
int i;
void *temp;
struct page *page;
/* We can't handle 2 level gatt's */
if (agp_bridge->driver->size_type == LVL2_APER_SIZE)
return -EINVAL;
table = NULL;
i = agp_bridge->aperture_size_idx;
temp = agp_bridge->current_size;
size = page_order = num_entries = 0;
do {
size = A_SIZE_8(temp)->size;
page_order = A_SIZE_8(temp)->page_order;
num_entries = A_SIZE_8(temp)->num_entries;
table = (char *) __get_free_pages(GFP_KERNEL, page_order);
if (table == NULL) {
i++;
agp_bridge->current_size = A_IDX8(agp_bridge);
} else {
agp_bridge->aperture_size_idx = i;
}
} while (!table && (i < agp_bridge->driver->num_aperture_sizes));
if (table == NULL)
return -ENOMEM;
table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
SetPageReserved(page);
agp_bridge->gatt_table_real = (u32 *) table;
agp_bridge->gatt_table = (u32 *)table;
agp_bridge->gatt_bus_addr = virt_to_phys(table);
for (i = 0; i < num_entries; i++) {
agp_bridge->gatt_table[i] =
(unsigned long) agp_bridge->scratch_page;
}
flush_dcache_range((unsigned long)table, (unsigned long)table_end);
return 0;
}
/* Taken from the Uninorth driver */
static int articias_free_gatt_table(void)
{
int page_order;
char *table, *table_end;
void *temp;
struct page *page;
temp = agp_bridge->current_size;
page_order = A_SIZE_8(temp)->page_order;
/* Do not worry about freeing memory, because if this is
* called, then all agp memory is deallocated and removed
* from the table.
*/
table = (char *) agp_bridge->gatt_table_real;
table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
ClearPageReserved(page);
free_pages((unsigned long) agp_bridge->gatt_table_real, page_order);
return 0;
}
/* Taken from the Uninorth driver (END). */
#endif /* ARTICIAS_FROMUNINORTH */
static void articias_cleanup(void)
{
struct aper_size_info_8 *previous_size;
#ifdef ARTICIAS_DEBUG
printk(KERN_INFO PFX "[ARTICIAS] articias_cleanup()\n");
#endif
previous_size = A_SIZE_8(agp_bridge->previous_size);
pci_write_config_byte(agp_bridge->dev, ARTICIAS_APSIZE,
previous_size->size_value);
}
static void articias_tlbflush(struct agp_memory *mem)
{
#ifdef ARTICIAS_DEBUG
printk(KERN_INFO PFX "[ARTICIAS] agp_tlbflush()\n");
#endif
return;
}
static struct aper_size_info_8 articias_generic_sizes[7] =
{
/* size, num_entries, page_order, size_value */
{4, 1024, 1, 1},
{8, 2048, 1, 2},
{16, 4096, 2, 3},
{32, 8192, 3, 4},
{64, 16384, 4, 5},
{128, 32768, 5, 6},
{256, 65536, 6, 7},
/* Original code from MAI. */
/*
{4, 1024, 1, 1},
{8, 2048, 1, 2},
{16, 4096, 2, 3},
{32, 8192, 3, 4},
{64, 16384, 4, 5},
{128, 32768, 5, 6}
*/
};
static struct agp_bridge_driver articias_driver = {
.owner = THIS_MODULE,
.aperture_sizes = articias_generic_sizes,
.size_type = U8_APER_SIZE,
/* Geri: Was 6 before. Added 256k entry for aperture size. */
.num_aperture_sizes = 7,
.configure = articias_configure,
.fetch_size = articias_fetch_size,
.cleanup = articias_cleanup,
.tlb_flush = articias_tlbflush,
.mask_memory = agp_generic_mask_memory,
.masks = NULL,
.agp_enable = agp_generic_enable,
.cache_flush = global_cache_flush,
#ifdef ARTICIAS_FROMUNINORTH
/* David: new code borrowed from Uninorth driver. */
.create_gatt_table = articias_create_gatt_table,
.free_gatt_table = articias_free_gatt_table,
.insert_memory = articias_insert_memory,
#else
/* Original code form MAI. */
.create_gatt_table = agp_generic_create_gatt_table,
.free_gatt_table = agp_generic_free_gatt_table,
.insert_memory = agp_generic_insert_memory,
#endif
.remove_memory = agp_generic_remove_memory,
.alloc_by_type = agp_generic_alloc_by_type,
.free_by_type = agp_generic_free_by_type,
.agp_alloc_page = agp_generic_alloc_page,
.agp_destroy_page = agp_generic_destroy_page,
// .cant_use_aperture = 1,
// .needs_scratch_page = 1,
};
static struct agp_device_ids articias_agp_device_ids[] __devinitdata =
{
{
.device_id = PCI_DEVICE_ID_MAI_ARTICIAS,
.chipset_name = "ArticiaS",
},
{ }, /* dummy final entry, always present */
};
static int __devinit agp_articias_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
struct agp_device_ids *devs = articias_agp_device_ids;
struct agp_bridge_data *bridge;
int j = 0;
u8 cap_ptr;
cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
if (!cap_ptr)
return -ENODEV;
j = ent - agp_articias_pci_table;
printk (KERN_INFO PFX "Detected MAI %s chipset\n", devs[j].chipset_name);
bridge = agp_alloc_bridge();
if (!bridge)
return -ENOMEM;
bridge->dev = pdev;
bridge->capndx = cap_ptr;
bridge->driver = &articias_driver;
return agp_add_bridge(bridge);
}
static void __devexit agp_articias_remove(struct pci_dev *pdev)
{
struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
agp_remove_bridge(bridge);
agp_put_bridge(bridge);
}
#ifdef CONFIG_PM
static int agp_articias_suspend(struct pci_dev *pdev, pm_message_t state)
{
pci_save_state (pdev);
pci_set_power_state (pdev, PCI_D3hot);
return 0;
}
static int agp_articias_resume(struct pci_dev *pdev)
{
struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
pci_set_power_state (pdev, PCI_D0);
pci_restore_state(pdev);
if (bridge->driver == &articias_driver)
return articias_configure();
return 0;
}
#endif /* CONFIG_PM */
/* must be the same order as name table above */
static struct pci_device_id agp_articias_pci_table[] = {
#define ID(x) \
{ \
.class = (PCI_CLASS_BRIDGE_HOST << 8), \
.class_mask = ~0, \
.vendor = PCI_VENDOR_ID_MAI, \
.device = x, \
.subvendor = PCI_ANY_ID, \
.subdevice = PCI_ANY_ID, \
}
ID(PCI_DEVICE_ID_MAI_ARTICIAS),
{ }
};
MODULE_DEVICE_TABLE(pci, agp_articias_pci_table);
static struct pci_driver agp_articias_pci_driver = {
.name = "agpgart-articias",
.id_table = agp_articias_pci_table,
.probe = agp_articias_probe,
.remove = agp_articias_remove,
#ifdef CONFIG_PM
.suspend = agp_articias_suspend,
.resume = agp_articias_resume,
#endif
};
static int __init agp_articias_init(void)
{
if (agp_off)
{
#ifdef ARTICIAS_DEBUG
printk(KERN_INFO PFX "[ARTICIAS] agp_articias_init return EINVAL.\n");
#endif
return -EINVAL;
}
#ifdef ARTICIAS_DEBUG
printk(KERN_INFO PFX "[ARTICIAS] agp_articias_init return pci driver
struct.\n");
#endif
return pci_register_driver(&agp_articias_pci_driver);
}
static void __exit agp_articias_cleanup(void)
{
pci_unregister_driver(&agp_articias_pci_driver);
}
module_init(agp_articias_init);
module_exit(agp_articias_cleanup);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>");
####### END ######
The code contains a lot of debug code. The driver was based on the VIA
AGPGART driver, but we also tried to get it working with parts of the
Uninorth AGPGART driver.
This is the debug output, if the Uninorth code is not compiled in, but the
generic AGP GATT table create function is used:
Jan 11 22:42:49 localhost kernel: Linux agpgart interface v0.101 (c) Dave
Jones
Jan 11 22:42:49 localhost kernel: agpgart: [ARTICIAS] agp_articias_init
return pci driver struct.
Jan 11 22:42:49 localhost kernel: agpgart: Detected MAI ArticiaS chipset
Jan 11 22:42:49 localhost kernel: agpgart: [ARTICIAS] articias_fetch_size()
Jan 11 22:42:49 localhost kernel: agpgart: [ARTICIAS] * non masked temp =
0x41
Jan 11 22:42:49 localhost kernel: agpgart: [ARTICIAS] * aperature size loop
index #0
Jan 11 22:42:49 localhost kernel: agpgart: [ARTICIAS] * values[0].size_value
= 1
Jan 11 22:42:49 localhost kernel: agpgart: [ARTICIAS] * masked temp = 0x1
Jan 11 22:42:49 localhost kernel: agpgart: [ARTICIAS] * values[0].size = 4
Jan 11 22:42:49 localhost kernel: agpgart: [ARTICIAS] * current_size->size =
4
Jan 11 22:42:49 localhost kernel: agpgart: [ARTICIAS] *
current_size->page_order = 1
Jan 11 22:42:49 localhost kernel: agpgart: [ARTICIAS] *
current_size->num_entries = 1024
Jan 11 22:42:49 localhost kernel: agpgart: [ARTICIAS] *
current_size->size_value = 1
Jan 11 22:42:49 localhost kernel: __ioremap(): phys addr 1fb56000 is RAM lr
c000ec60
Jan 11 22:42:49 localhost kernel: agpgart: unable to get memory for graphics
translation table.
Jan 11 22:42:49 localhost kernel: agpgart: agp_backend_initialize() failed.
Jan 11 22:42:49 localhost kernel: agpgart-articias: probe of 0000:00:00.0
failed with error -12
If the Uninorth code is used, then the driver detects the aperture size as
4MB@0x0:
Jan 11 20:34:12 localhost kernel: agpgart: [ARTICIAS] articias_fetch_size()
Jan 11 20:34:12 localhost kernel: agpgart: [ARTICIAS] * non masked temp =
0x41
Jan 11 20:34:12 localhost kernel: agpgart: [ARTICIAS] * aperature size loop
index #0
Jan 11 20:34:12 localhost kernel: agpgart: [ARTICIAS] * values[0].size_value
= 1
Jan 11 20:34:12 localhost kernel: agpgart: [ARTICIAS] * masked temp = 0x1
Jan 11 20:34:12 localhost kernel: agpgart: [ARTICIAS] * values[0].size = 4
Jan 11 20:34:12 localhost kernel: agpgart: [ARTICIAS] * current_size->size =
4
Jan 11 20:34:12 localhost kernel: agpgart: [ARTICIAS] *
current_size->page_order = 1
Jan 11 20:34:12 localhost kernel: agpgart: [ARTICIAS] *
current_size->num_entries = 1024
Jan 11 20:34:12 localhost kernel: agpgart: [ARTICIAS] *
current_size->size_value = 1
Jan 11 20:34:12 localhost kernel: agpgart: AGP aperture is 4M @ 0x0
Regards,
Gerhard
--
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++
^ permalink raw reply
* Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks
From: Vojtech Pavlik @ 2006-01-11 21:45 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: dtor_core, linux-kernel, linux-kernel, linuxppc-dev, linux-input
In-Reply-To: <1137015006.5138.18.camel@localhost.localdomain>
On Thu, Jan 12, 2006 at 08:30:06AM +1100, Benjamin Herrenschmidt wrote:
> > Ok, I am looking at the patch again, and I have a question - do we
> > really need these 3 module parameters? If the goal is to be compatible
> > with older keyboards then shouldn't we stick to one behavior?
>
> I personally think one parameter is plenty enough (on/off) . Michael,
> can you send Dimitri the latest version of that patch please ?
I agree. If you need the compatible behavior.
--
Vojtech Pavlik
SuSE Labs, SuSE CR
^ permalink raw reply
* Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks
From: Vojtech Pavlik @ 2006-01-11 21:47 UTC (permalink / raw)
To: Michael Hanselmann
Cc: linux-kernel, dtor_core, linux-kernel, linuxppc-dev, linux-input
In-Reply-To: <20060111214351.GF6617@hansmi.ch>
On Wed, Jan 11, 2006 at 10:43:51PM +0100, Michael Hanselmann wrote:
> On Thu, Jan 12, 2006 at 08:41:08AM +1100, Benjamin Herrenschmidt wrote:
> > > Johannes Berg told me he wants to use the fn key alone to switch the
> > > keyboard layout or something. For such uses, the pb_enablefn is there.
>
> Sorry, actually it's called pb_disablefn now.
>
> > What does it do ? Just send a keycode ? That should be unconditionnal.
> > The Fn key should change a keycode always. I don't see why you would
> > that to be off.
>
> No, if that parameter is disabled, it translates key combinations like
> Fn+F1 to KEY_BRIGHTNESSUP. If it's enabled, it only sends KEY_FN.
I believe a better behavior would be to send KEY_FN and then
KEY_BRIGHTNESSUP when enabled and KEY_FN and KEY_F1 when disabled.
--
Vojtech Pavlik
SuSE Labs, SuSE CR
^ permalink raw reply
* Re: AGPGART driver for ArticiaS - ioremap() problem
From: John W. Linville @ 2006-01-11 21:52 UTC (permalink / raw)
To: Gerhard Pircher; +Cc: linuxppc-dev, debian-powerpc
In-Reply-To: <6063.1137013232@www88.gmx.net>
On Wed, Jan 11, 2006 at 10:00:32PM +0100, Gerhard Pircher wrote:
> David Bentam and I are trying to get a AGPGART driver working for the
> AmigaOne and the Pegasos1. The driver detects the aperture size of the
> ArticiaS AGP bridge, but fails at the ioremap() function in the generic GATT
> table create function. Does the PowerPC platform behaves differently for the
> mapping of address location for AGP operation than the x86 platform? Is it
> possible to use a mask to relocate the AGP address space to a specific
> location?
It probably wouldn't hurt to include the source (or a url pointing
to it)... :-)
John
--
John W. Linville
linville@tuxdriver.com
^ 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