Booting the linux-ppc64 kernel flattened device tree v0.4
On Wed, 2005-06-01 at 11:58 -0500, Jon Loeliger wrote: On Wed, 2005-06-01 at 03:26, Benjamin Herrenschmidt wrote: Here's the fourth version of my document along with new kernel patches for the new improved flattened format, and the first release of the device-tree compiler tool. The patches will be posted as a reply to this email. The compiler, dtc, can be downloaded, the URL is in the document. Ben, Does it make sense to do this as well? You mean include lsprop ? Well, I have another version of lsprop hacked here that can generate a source, but dtc can do it too now ... I think we may just make dtc able to output in lsprop format too :) But I'll talk to david (CC'd, he's the author of dtc). Ben.
Booting the linux-ppc64 kernel flattened device tree v0.4
On Wed, 2005-06-01 at 14:54 -0500, Jon Loeliger wrote: On Wed, 2005-06-01 at 03:26, Benjamin Herrenschmidt wrote: DO NOT REPLY TO ALL LISTS PLEASE ! (and CC me on replies). Here's the fourth version of my document along with new kernel patches for the new improved flattened format, and the first release of the device-tree compiler tool. The patches will be posted as a reply to this email. The compiler, dtc, can be downloaded, the URL is in the document. --- dtc source code can be found at http://ozlabs.org/~dgibson/dtc/dtc.tar.gz Ben, Here are diffs to: - Fix multi-line C-style comments. - Adjust the output of write_tree_source() such that it separates properties and nodes a bit better. Excellent, thanks. Please CC david next time. Ben.
[RFC] handle access to non-present IO ports on 8xx
On Wed, 2005-06-01 at 13:50 -0300, Marcelo Tosatti wrote: Hrm... removing a PCMCIA card triggers mchecks ? that is bad... With proper PCMCIA controllers, those are swallowed properly when the card is removed. The eating of the machine check is a bit too hackish to my taste... Better is to not do that by making sure the legacy crap isn't trying to tap unexisting ports, but then, if PCMCIA is also a problem... 1) why does the current PowerMac version covers only inb() and not outb() ? I had to add outb() exception table entries for 8xx. Not sure, maybe historical loss ? :) You should CC paulus 2) Is the same wanted for other embedded PPC's? It's up to you. It slows down those IOs, but on the other hand, inX/outX aren't supposed to be very common anymore, at least not with fast devices, and the IO itself is usually an order of magnitude slower than doing those syncs... 3) How to make the misc.S exception entries and additional instructions selectable only on the platform who need it? #ifdef does not sound a good idea. Nevermind the #ifdef CONFIG_ALL_PPC crap - that needs to be done properly. Index: arch/ppc/kernel/misc.S === RCS file: /mnt/test1/tslinux_mv21/linux-216/arch/ppc/kernel/misc.S,v retrieving revision 1.2 diff -u -r1.2 misc.S --- arch/ppc/kernel/misc.S22 Oct 2003 19:34:30 - 1.2 +++ arch/ppc/kernel/misc.S1 Jun 2005 17:59:30 - @@ -736,8 +736,23 @@ subir4,r4,1 blelr- 00: lbz r5,0(r3) - eieio - stbur5,1(r4) +01: eieio +02: stbur5,1(r4) +03: twi 0, r5, 0 +04: isync +05: nop Hrm... the twi/isync stuff is not valid for a store. The reason for doing twi here is to trigger a data dependency on the result of the load (to make sure the load actually happens) and the isync to make sure that twi has actually completed. For stores, you are stuffed... either your HW don't do machine checks on stores, or you put a sync here and hope you don't have write posting along the IO chain that would cause your machine check to arrive too late... Ben.
Booting the linux-ppc64 kernel flattened device tree v0.4
On Wed, Jun 01, 2005 at 06:26:30PM +1000, Benjamin Herrenschmidt wrote: DO NOT REPLY TO ALL LISTS PLEASE ! (and CC me on replies). Here's the fourth version of my document along with new kernel patches for the new improved flattened format, and the first release of the device-tree compiler tool. The patches will be posted as a reply to this email. The compiler, dtc, can be downloaded, the URL is in the document. [snip] IV - dtc, the device tree compiler dtc source code can be found at http://ozlabs.org/~dgibson/dtc/dtc.tar.gz I've just updated the dtc tarball with a new version. Notable changes: - Corrected comment parsing - Corrected handling of #address-cells, #size-cells properties - Input from device tree blobs should actually work now - Corrected autogeneration of name properties in blob/asm output version 0x10 - Added a TODO list -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/people/dgibson
[RFC] handle access to non-present IO ports on 8xx
Benjamin Herrenschmidt wrote: On Wed, 2005-06-01 at 13:50 -0300, Marcelo Tosatti wrote: Hrm... removing a PCMCIA card triggers mchecks ? that is bad... With proper PCMCIA controllers, those are swallowed properly when the card is removed. The eating of the machine check is a bit too hackish to my taste... Better is to not do that by making sure the legacy crap isn't trying to tap unexisting ports, but then, if PCMCIA is also a problem... 8xx is not proper in any way whatsoever :) There's no way to fix this thing with simple software hacks. For example take a PCMCIA driver that's minding it's own businees, when someone yanks the card out. cli() ... inb(xxx) ... - card is yanked here ... inb(yyy) ... - MCE here sti() 1) why does the current PowerMac version covers only inb() and not outb() ? I had to add outb() exception table entries for 8xx. Not sure, maybe historical loss ? :) You should CC paulus 2) Is the same wanted for other embedded PPC's? It's up to you. It slows down those IOs, but on the other hand, inX/outX aren't supposed to be very common anymore, at least not with fast devices, and the IO itself is usually an order of magnitude slower than doing those syncs... Fast ISA I/O. :) 3) How to make the misc.S exception entries and additional instructions selectable only on the platform who need it? #ifdef does not sound a good idea. I wouldn't mind... Nevermind the #ifdef CONFIG_ALL_PPC crap - that needs to be done properly. Regards Pantelis P.S. Good job marcello :)
Newbie question on Linux-PPC
Hi all, Thanks everyone for the time. It's done and I have it working. I have another question regarding MAC address in Linux. I had ported U-boot onto our customized board (MPC8280 based). It is working fine. I am also able to boot a Linux Kernel. The Kernel version is Linux-2.4.20 . We set the MAC address for the board in U-boot as 00:FD:11:01:01:01. But when the Linux Kernel boots it takes the MAC as 00:FD:81:01:01:01. I have confirmed that the U-boot passes the MAC address properly to the Linux Kernel properly. Can anyone guide me to where to look out for the issue stated above in the Linux code? Thanks everyone for the time. With Regards, C.R.Srivatsan -- next part -- An HTML attachment was scrubbed... URL: http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20050602/4d735733/attachment.htm
Missing m8260_cpm_dpfree()
Hi, A while ago I posted a patch which added the m8260_cpm_dpfree() function. I've just noticed a bug in this which is fixed in the attached patch. Alex On Wed, 18 May 2005 10:28:14 +0100 Alex Zeffertt ajz at cambridgebroadband.com wrote: Hi, I'm replying to my own message. I've got around to porting the 8xx version of ...cpm_dpfree() to the 8260 now. I've attached the patch on the off chance anyone else might want it. The patch is against the 2005-03-06 version of denx's linuxppc_2_4_devel, which is a 2.4.25 kernel. Alex On Mon, 16 May 2005 16:15:03 +0100 Alex Zeffertt ajz at cambridgebroadband.com wrote: Hi all, I have a question about the MPC8260 dual port RAM allocation routines. In arch/ppc/8260_io/commproc.c this is a m8260_cpm_dpalloc() routine, but the m8260_cpm_dpfree() routine is missing. Does anybody know where I can find this? I am using denx's linuxppc_2_4_devel tree from 2005-03-06. TIA, Alex -- next part -- A non-text attachment was scrubbed... Name: linux-m8260_cpm_dpfree.patch-2 Type: application/octet-stream Size: 7423 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20050602/3e21fb9a/attachment.obj
newbie question: module-init-tools for PPC embedded linux
Hi, Trying to ./insmod a hello_world.ko module on my EP8248 card from embeddedplanet.com. The board already supports and comes with 2.6 kernel. I get a message ./insmod QM_MODULES: function not implemented I cross compiled my kernel with MODULE support in make xconfig After little googling found that i need Rusty Russell's module-init-tools. Can anyone guide me how to configure make install these module-init-tools for my cross compilation. -vikas aggarwal This e-mail, including any attachments, may be confidential, privileged or otherwise legally protected. It is intended only for the addressee. If you received this e-mail in error or from someone who was not authorized to send it to you, do not disseminate, copy or otherwise use this e-mail or its attachments. Please notify the sender immediately by reply e-mail and delete the e-mail from your system.
[PATCH][1/5] RapidIO support: core
Adds a RapidIO subsystem to the kernel. RIO is a switched fabric interconnect used in higher-end embedded applications. The curious can look at the specs over at http://www.rapidio.org The core code implements enumeration/discovery, management of devices/resources, and interfaces for RIO drivers. There's a lot more to do to take advantages of all the hardware features. However, this should provide a good base for folks with RIO hardware to start contributing. Signed-off-by: Matt Porter mporter at kernel.crashing.org Index: Documentation/DocBook/Makefile === --- 3c5e9440c6a37c3355b50608836a23c8fa4eec99/Documentation/DocBook/Makefile (mode:100644) +++ ca27a5320b5c022df402fce5cab0f3d9ea94/Documentation/DocBook/Makefile (mode:100644) @@ -10,7 +10,7 @@ kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ procfs-guide.xml writing_usb_driver.xml scsidrivers.xml \ sis900.xml kernel-api.xml journal-api.xml lsm.xml usb.xml \ - gadget.xml libata.xml mtdnand.xml librs.xml + gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml ### # The build process is as follows (targets): Index: Documentation/DocBook/rapidio.tmpl === --- /dev/null (tree:3c5e9440c6a37c3355b50608836a23c8fa4eec99) +++ ca27a5320b5c022df402fce5cab0f3d9ea94/Documentation/DocBook/rapidio.tmpl (mode:100644) @@ -0,0 +1,160 @@ +?xml version=1.0 encoding=UTF-8? +!DOCTYPE book PUBLIC -//OASIS//DTD DocBook XML V4.1.2//EN +http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd; [ + !ENTITY rapidio SYSTEM rapidio.xml + ] + +book id=RapidIO-Guide + bookinfo + titleRapidIO Subsystem Guide/title + + authorgroup + author +firstnameMatt/firstname +surnamePorter/surname +affiliation + address + emailmporter at kernel.crashing.org/email + emailmporter at mvista.com/email + /address +/affiliation + /author + /authorgroup + + copyright + year2005/year + holderMontaVista Software, Inc./holder + /copyright + + legalnotice + para + This documentation is free software; you can redistribute + it and/or modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + /para + + para + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + /para + + para + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307 USA + /para + + para + For more details see the file COPYING in the source + distribution of Linux. + /para + /legalnotice + /bookinfo + +toc/toc + + chapter id=intro + titleIntroduction/title + para + RapidIO is a high speed switched fabric interconnect with + features aimed at the embedded market. RapidIO provides + support for memory-mapped I/O as well as message-based + transactions over the switched fabric network. RapidIO has + a standardized discovery mechanism not unlike the PCI bus + standard that allows simple detection of devices in a + network. + /para + para + This documentation is provided for developers intending + to support RapidIO on new architectures, write new drivers, + or to understand the subsystem internals. + /para + /chapter + + chapter id=bugs + titleKnown Bugs and Limitations/title + + sect1 + titleBugs/title + paraNone. ;)/para + /sect1 + sect1 + titleLimitations/title + para + orderedlist + listitemparaAccess/management of RapidIO memory regions is not supported/para/listitem + listitemparaMultiple host enumeration is not supported/para/listitem + /orderedlist +/para + /sect1 + /chapter + + chapter id=drivers + titleRapidIO driver interface/title + para + Drivers are provided a set of calls in order + to interface with the subsystem to gather info + on devices, request/map memory region resources, + and manage mailboxes/doorbells. + /para + sect1 + titleFunctions/title +!Iinclude/linux/rio_drv.h +!Edrivers/rio/rio-driver.c +!Edrivers/rio/rio.c + /sect1 + /chapter + + chapter id=internals + titleInternals/title + + para + This chapter contains the autogenerated documentation of the RapidIO + subsystem. + /para + + sect1titleStructures/title +!Iinclude/linux/rio.h + /sect1 +
[PATCH][2/5] RapidIO support: core includes
Add RapidIO core include files. The core code implements enumeration/discovery, management of devices/resources, and interfaces for RIO drivers. Signed-off-by: Matt Porter mporter at kernel.crashing.org Index: include/linux/rio.h === --- /dev/null (tree:ca27a5320b5c022df402fce5cab0f3d9ea94) +++ 8d5a02e2174e1dad478b22653de9f2a346e1c996/include/linux/rio.h (mode:100644) @@ -0,0 +1,321 @@ +/* + * RapidIO interconnect services + * (RapidIO Interconnect Specification, http://www.rapidio.org) + * + * Copyright 2005 MontaVista Software, Inc. + * Matt Porter mporter at kernel.crashing.org + * + * 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. + */ + +#ifndef LINUX_RIO_H +#define LINUX_RIO_H + +#ifdef __KERNEL__ + +#include linux/types.h +#include linux/config.h +#include linux/ioport.h +#include linux/list.h +#include linux/errno.h +#include linux/device.h +#include linux/rio_regs.h + +#define RIO_ANY_DESTID 0xff +#define RIO_NO_HOPCOUNT-1 + +#define RIO_MAX_MPORT_RESOURCES16 +#define RIO_MAX_DEV_RESOURCES 16 + +#define RIO_GLOBAL_TABLE 0xff/* Indicates access of a switch's + global routing table if it + has multiple (or per port) + tables */ + +#define RIO_INVALID_ROUTE 0xff/* Indicates that a route table + entry is invalid (no route + exists for the device ID) */ + +#ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT +#define RIO_MAX_ROUTE_ENTRIES (1 8) +#else +#define RIO_MAX_ROUTE_ENTRIES (1 16) +#endif + +#define RIO_MAX_MBOX 4 +#define RIO_MAX_MSG_SIZE 0x1000 + +/* + * Error values that may be returned by RIO functions. + */ +#define RIO_SUCCESSFUL 0x00 +#define RIO_BAD_SIZE 0x81 + +/* + * For RIO devices, the region numbers are assigned this way: + * + * 0 RapidIO outbound doorbells + * 1-15 RapidIO memory regions + * + * For RIO master ports, the region number are assigned this way: + * + * 0 RapidIO inbound doorbells + * 1 RapidIO inbound mailboxes + * 1 RapidIO outbound mailboxes + */ +#define RIO_DOORBELL_RESOURCE 0 +#define RIO_INB_MBOX_RESOURCE 1 +#define RIO_OUTB_MBOX_RESOURCE 2 + +extern struct bus_type rio_bus_type; +extern struct list_head rio_devices; /* list of all devices */ + +struct rio_mport; + +/** + * struct rio_dev - RIO device info + * @global_list: Node in list of all RIO devices + * @net_list: Node in list of RIO devices in a network + * @net: Network this device is a part of + * @did: Device ID + * @vid: Vendor ID + * @device_rev: Device revision + * @asm_did: Assembly device ID + * @asm_vid: Assembly vendor ID + * @asm_rev: Assembly revision + * @efptr: Extended feature pointer + * @pef: Processing element features + * @swpinfo: Switch port info + * @src_ops: Source operation capabilities + * @dst_ops: Destination operation capabilities + * @rswitch: Pointer to struct rio_switch if valid for this device + * @driver: Driver claiming this device + * @dev: Device model device + * @riores: RIO resources this device owns + * @destid: Network destination ID + */ +struct rio_dev { + struct list_head global_list; /* node in list of all RIO devices */ + struct list_head net_list; /* node in per net list */ + struct rio_net *net;/* RIO net this device resides in */ + u16 did; + u16 vid; + u32 device_rev; + u16 asm_did; + u16 asm_vid; + u16 asm_rev; + u16 efptr; + u32 pef; + u32 swpinfo;/* Only used for switches */ + u32 src_ops; + u32 dst_ops; + struct rio_switch *rswitch; /* RIO switch info */ + struct rio_driver *driver; /* RIO driver claiming this device */ + struct device dev; /* LDM device structure */ + struct resource riores[RIO_MAX_DEV_RESOURCES]; + u16 destid; +}; + +#define rio_dev_g(n) list_entry(n, struct rio_dev, global_list) +#define rio_dev_f(n) list_entry(n, struct rio_dev, net_list) +#defineto_rio_dev(n) container_of(n, struct rio_dev, dev) + +/** + * struct rio_msg - RIO message event + * @res: Mailbox resource + * @mcback: Message event callback + */ +struct rio_msg { + struct resource *res; + void (*mcback) (struct rio_mport * mport, int mbox, int slot); +}; + +/** + * struct rio_dbell - RIO doorbell event + * @node: Node in list of doorbell events + * @res: Doorbell resource + * @dinb: Doorbell event callback + */ +struct rio_dbell { + struct list_head node; + struct
[PATCH][3/5] RapidIO support: enumeration
Adds RapidIO enumeration/discovery. The core code implements enumeration/discovery, management of devices/resources, and interfaces for RIO drivers. Signed-off-by: Matt Porter mporter at kernel.crashing.org Index: drivers/rio/rio-scan.c === --- /dev/null (tree:8d5a02e2174e1dad478b22653de9f2a346e1c996) +++ b4a27e4c90f11413fa6828321141c43cb9ad6c12/drivers/rio/rio-scan.c (mode:100644) @@ -0,0 +1,960 @@ +/* + * RapidIO enumeration and discovery support + * + * Copyright 2005 MontaVista Software, Inc. + * Matt Porter mporter at kernel.crashing.org + * + * 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/config.h +#include linux/types.h +#include linux/kernel.h + +#include linux/delay.h +#include linux/init.h +#include linux/rio.h +#include linux/rio_drv.h +#include linux/rio_ids.h +#include linux/rio_regs.h +#include linux/module.h +#include linux/spinlock.h +#include linux/timer.h + +#include rio.h + +LIST_HEAD(rio_devices); +static LIST_HEAD(rio_switches); + +#define RIO_ENUM_CMPL_MAGIC0xdeadbeef + +static void rio_enum_timeout(unsigned long); + +spinlock_t rio_global_list_lock = SPIN_LOCK_UNLOCKED; +static int next_destid = 0; +static int next_switchid = 0; +static int next_net = 0; + +static struct timer_list rio_enum_timer = +TIMER_INITIALIZER(rio_enum_timeout, 0, 0); + +static int rio_mport_phys_table[] = { + RIO_EFB_PAR_EP_ID, + RIO_EFB_PAR_EP_REC_ID, + RIO_EFB_SER_EP_ID, + RIO_EFB_SER_EP_REC_ID, + -1, +}; + +static int rio_sport_phys_table[] = { + RIO_EFB_PAR_EP_FREE_ID, + RIO_EFB_SER_EP_FREE_ID, + -1, +}; + +extern struct rio_route_ops __start_rio_route_ops[]; +extern struct rio_route_ops __end_rio_route_ops[]; + +/** + * rio_get_device_id - Get the base/extended device id for a device + * @port: RIO master port + * @destid: Destination ID of device + * @hopcount: Hopcount to device + * + * Reads the base/extended device id from a device. Returns the + * 8/16-bit device ID. + */ +static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcount) +{ + u32 result; + + rio_mport_read_config_32(port, destid, hopcount, RIO_DID_CSR, result); + + return RIO_GET_DID(result); +} + +/** + * rio_set_device_id - Set the base/extended device id for a device + * @port: RIO master port + * @destid: Destination ID of device + * @hopcount: Hopcount to device + * @did: Device ID value to be written + * + * Writes the base/extended device id from a device. + */ +static void +rio_set_device_id(struct rio_mport *port, u16 destid, u8 hopcount, u16 did) +{ + rio_mport_write_config_32(port, destid, hopcount, RIO_DID_CSR, + RIO_SET_DID(did)); +} + +/** + * rio_local_set_device_id - Set the base/extended device id for a port + * @port: RIO master port + * @did: Device ID value to be written + * + * Writes the base/extended device id from a device. + */ +static void rio_local_set_device_id(struct rio_mport *port, u16 did) +{ + rio_local_write_config_32(port, RIO_DID_CSR, RIO_SET_DID(did)); +} + +/** + * rio_clear_locks- Release all host locks and signal enumeration complete + * @port: Master port to issue transaction + * + * Marks the component tag CSR on each device with the enumeration + * complete flag. When complete, it then release the host locks on + * each device. Returns 0 on success or %-EINVAL on failure. + */ +static int rio_clear_locks(struct rio_mport *port) +{ + struct rio_dev *rdev; + u32 result; + int ret = 0; + + /* Write component tag CSR magic complete value */ + rio_local_write_config_32(port, RIO_COMPONENT_TAG_CSR, + RIO_ENUM_CMPL_MAGIC); + list_for_each_entry(rdev, rio_devices, global_list) + rio_write_config_32(rdev, RIO_COMPONENT_TAG_CSR, + RIO_ENUM_CMPL_MAGIC); + + /* Release host device id locks */ + rio_local_write_config_32(port, RIO_HOST_DID_LOCK_CSR, + port-host_deviceid); + rio_local_read_config_32(port, RIO_HOST_DID_LOCK_CSR, result); + if ((result 0x) != 0x) { + printk(KERN_INFO + RIO: badness when releasing host lock on master port, result %8.8x\n, + result); + ret = -EINVAL; + } + list_for_each_entry(rdev, rio_devices, global_list) { + rio_write_config_32(rdev, RIO_HOST_DID_LOCK_CSR, + port-host_deviceid); + rio_read_config_32(rdev, RIO_HOST_DID_LOCK_CSR, result); + if ((result 0x) != 0x) { + printk(KERN_INFO +
[PATCH][4/5] RapidIO support: ppc32
Adds PPC32 RIO support. Init code for the MPC85xx RIO ports and glue for the STx GP3 board to use it. Signed-off-by: Matt Porter mporter at kernel.crashing.org Index: arch/ppc/Kconfig === --- b4a27e4c90f11413fa6828321141c43cb9ad6c12/arch/ppc/Kconfig (mode:100644) +++ 711ec47634f5d5ded866eaa965a0f7dadcbc65f4/arch/ppc/Kconfig (mode:100644) @@ -1177,6 +1177,14 @@ source drivers/pcmcia/Kconfig +config RAPIDIO + bool RapidIO support if MPC8540 || MPC8560 + help + If you say Y here, the kernel will include drivers and + infrastructure code to support RapidIO interconnect devices. + +source drivers/rio/Kconfig + endmenu menu Advanced setup Index: arch/ppc/configs/stx_gp3_defconfig === --- b4a27e4c90f11413fa6828321141c43cb9ad6c12/arch/ppc/configs/stx_gp3_defconfig (mode:100644) +++ 711ec47634f5d5ded866eaa965a0f7dadcbc65f4/arch/ppc/configs/stx_gp3_defconfig (mode:100644) @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.11-rc2 -# Wed Jan 26 14:32:58 2005 +# Linux kernel version: 2.6.12-rc4 +# Tue May 24 18:11:04 2005 # CONFIG_MMU=y CONFIG_GENERIC_HARDIRQS=y @@ -11,6 +11,7 @@ CONFIG_PPC=y CONFIG_PPC32=y CONFIG_GENERIC_NVRAM=y +CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y # # Code maturity level options @@ -18,6 +19,7 @@ CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 # # General setup @@ -29,7 +31,6 @@ # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y # CONFIG_AUDIT is not set -CONFIG_LOG_BUF_SHIFT=14 CONFIG_HOTPLUG=y CONFIG_KOBJECT_UEVENT=y # CONFIG_IKCONFIG is not set @@ -37,6 +38,9 @@ CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set # CONFIG_KALLSYMS_EXTRA_PASS is not set +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_BASE_FULL=y CONFIG_FUTEX=y CONFIG_EPOLL=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set @@ -46,6 +50,7 @@ CONFIG_CC_ALIGN_LOOPS=0 CONFIG_CC_ALIGN_JUMPS=0 # CONFIG_TINY_SHMEM is not set +CONFIG_BASE_SMALL=0 # # Loadable module support @@ -69,9 +74,11 @@ CONFIG_E500=y CONFIG_BOOKE=y CONFIG_FSL_BOOKE=y +# CONFIG_PHYS_64BIT is not set # CONFIG_SPE is not set CONFIG_MATH_EMULATION=y # CONFIG_CPU_FREQ is not set +# CONFIG_PM is not set CONFIG_85xx=y CONFIG_PPC_INDIRECT_PCI_BE=y @@ -96,6 +103,7 @@ CONFIG_BINFMT_ELF=y CONFIG_BINFMT_MISC=m # CONFIG_CMDLINE_BOOL is not set +CONFIG_ISA_DMA_API=y # # Bus options @@ -104,15 +112,15 @@ CONFIG_PCI_DOMAINS=y # CONFIG_PCI_LEGACY_PROC is not set # CONFIG_PCI_NAMES is not set +# CONFIG_PCI_DEBUG is not set # # PCCARD (PCMCIA/CardBus) support # # CONFIG_PCCARD is not set - -# -# PC-card bridges -# +CONFIG_RAPIDIO=y +CONFIG_RAPIDIO_8_BIT_TRANSPORT=y +CONFIG_RAPIDIO_DISC_TIMEOUT=30 # # Advanced setup @@ -152,7 +160,7 @@ CONFIG_PARPORT_PC=m # CONFIG_PARPORT_PC_FIFO is not set # CONFIG_PARPORT_PC_SUPERIO is not set -# CONFIG_PARPORT_OTHER is not set +# CONFIG_PARPORT_GSC is not set # CONFIG_PARPORT_1284 is not set # @@ -264,7 +272,6 @@ # CONFIG_SCSI_BUSLOGIC is not set # CONFIG_SCSI_DMX3191D is not set # CONFIG_SCSI_EATA is not set -# CONFIG_SCSI_EATA_PIO is not set # CONFIG_SCSI_FUTURE_DOMAIN is not set # CONFIG_SCSI_GDTH is not set # CONFIG_SCSI_IPS is not set @@ -274,7 +281,6 @@ # CONFIG_SCSI_IMM is not set # CONFIG_SCSI_SYM53C8XX_2 is not set # CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_QLOGIC_ISP is not set # CONFIG_SCSI_QLOGIC_FC is not set # CONFIG_SCSI_QLOGIC_1280 is not set CONFIG_SCSI_QLA2XXX=m @@ -283,6 +289,7 @@ # CONFIG_SCSI_QLA2300 is not set # CONFIG_SCSI_QLA2322 is not set # CONFIG_SCSI_QLA6312 is not set +# CONFIG_SCSI_LPFC is not set # CONFIG_SCSI_DC395x is not set # CONFIG_SCSI_DC390T is not set # CONFIG_SCSI_NSP32 is not set @@ -322,7 +329,6 @@ # CONFIG_PACKET=y # CONFIG_PACKET_MMAP is not set -# CONFIG_NETLINK_DEV is not set CONFIG_UNIX=y # CONFIG_NET_KEY is not set CONFIG_INET=y @@ -431,7 +437,7 @@ # # Network testing # -# CONFIG_NET_PKTGEN is not set +CONFIG_NET_PKTGEN=y # CONFIG_NETPOLL is not set # CONFIG_NET_POLL_CONTROLLER is not set # CONFIG_HAMRADIO is not set @@ -499,6 +505,7 @@ # Wan interfaces # # CONFIG_WAN is not set +CONFIG_RIONET=y # CONFIG_FDDI is not set # CONFIG_HIPPI is not set # CONFIG_PLIP is not set @@ -536,20 +543,6 @@ # CONFIG_INPUT_EVBUG is not set # -# Input I/O drivers -# -# CONFIG_GAMEPORT is not set -CONFIG_SOUND_GAMEPORT=y -CONFIG_SERIO=y -CONFIG_SERIO_I8042=y -CONFIG_SERIO_SERPORT=y -# CONFIG_SERIO_CT82C710 is not set -# CONFIG_SERIO_PARKBD is not set -# CONFIG_SERIO_PCIPS2 is not set -CONFIG_SERIO_LIBPS2=y -# CONFIG_SERIO_RAW is not set - -# # Input Device Drivers # CONFIG_INPUT_KEYBOARD=y @@ -567,6 +560,19 @@ # CONFIG_INPUT_MISC is not set # +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_I8042=y +CONFIG_SERIO_SERPORT=y +#
[PATCH][5/5] RapidIO support: net driver over messaging
Adds an Ethernet driver which sends Ethernet packets over the standard RapidIO messaging. This depends on the core RIO patch for mailbox/doorbell access. Signed-off-by: Matt Porter mporter at kernel.crashing.org Index: drivers/net/Kconfig === --- 711ec47634f5d5ded866eaa965a0f7dadcbc65f4/drivers/net/Kconfig (mode:100644) +++ 8bdd37ff79724c95795ed39c28588a94e1f13e60/drivers/net/Kconfig (mode:100644) @@ -2185,6 +2185,20 @@ tristate iSeries Virtual Ethernet driver support depends on NETDEVICES PPC_ISERIES +config RIONET + tristate RapidIO Ethernet over messaging driver support + depends on NETDEVICES RAPIDIO + +config RIONET_TX_SIZE + int Number of outbound queue entries + depends on RIONET + default 128 + +config RIONET_RX_SIZE + int Number of inbound queue entries + depends on RIONET + default 128 + config FDDI bool FDDI driver support depends on NETDEVICES (PCI || EISA) Index: drivers/net/Makefile === --- 711ec47634f5d5ded866eaa965a0f7dadcbc65f4/drivers/net/Makefile (mode:100644) +++ 8bdd37ff79724c95795ed39c28588a94e1f13e60/drivers/net/Makefile (mode:100644) @@ -58,6 +58,7 @@ obj-$(CONFIG_VIA_RHINE) += via-rhine.o obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o +obj-$(CONFIG_RIONET) += rionet.o # # end link order section Index: drivers/net/rionet.c === --- /dev/null (tree:711ec47634f5d5ded866eaa965a0f7dadcbc65f4) +++ 8bdd37ff79724c95795ed39c28588a94e1f13e60/drivers/net/rionet.c (mode:100644) @@ -0,0 +1,622 @@ +/* + * rionet - Ethernet driver over RapidIO messaging services + * + * Copyright 2005 MontaVista Software, Inc. + * Matt Porter mporter at kernel.crashing.org + * + * 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/module.h +#include linux/kernel.h +#include linux/dma-mapping.h +#include linux/delay.h +#include linux/rio.h +#include linux/rio_drv.h +#include linux/rio_ids.h + +#include linux/netdevice.h +#include linux/etherdevice.h +#include linux/skbuff.h +#include linux/crc32.h +#include linux/ethtool.h + +#define DRV_NAMErionet +#define DRV_VERSION 0.1 +#define DRV_AUTHOR Matt Porter mporter at kernel.crashing.org +#define DRV_DESCEthernet over RapidIO + +MODULE_AUTHOR(DRV_AUTHOR); +MODULE_DESCRIPTION(DRV_DESC); +MODULE_LICENSE(GPL); + +#define RIONET_DEFAULT_MSGLEVEL0 +#define RIONET_DOORBELL_JOIN 0x1000 +#define RIONET_DOORBELL_LEAVE 0x1001 + +#define RIONET_MAILBOX 0 + +#define RIONET_TX_RING_SIZECONFIG_RIONET_TX_SIZE +#define RIONET_RX_RING_SIZECONFIG_RIONET_RX_SIZE + +LIST_HEAD(rionet_peers); + +struct rionet_private { + struct rio_mport *mport; + struct sk_buff *rx_skb[RIONET_RX_RING_SIZE]; + struct sk_buff *tx_skb[RIONET_TX_RING_SIZE]; + struct net_device_stats stats; + int rx_slot; + int tx_slot; + int tx_cnt; + int ack_slot; + spinlock_t lock; + u32 msg_enable; +}; + +struct rionet_peer { + struct list_head node; + struct rio_dev *rdev; + struct resource *res; +}; + +static int rionet_check = 0; +static int rionet_capable = 1; +static struct net_device *sndev = NULL; + +/* + * This is a fast lookup table for for translating TX + * Ethernet packets into a destination RIO device. It + * could be made into a hash table to save memory depending + * on system trade-offs. + */ +static struct rio_dev *rionet_active[RIO_MAX_ROUTE_ENTRIES]; + +#define is_rionet_capable(pef, src_ops, dst_ops) \ + ((pef RIO_PEF_INB_MBOX) \ +(pef RIO_PEF_INB_DOORBELL) \ +(src_ops RIO_SRC_OPS_DOORBELL) \ +(dst_ops RIO_DST_OPS_DOORBELL)) +#define dev_rionet_capable(dev) \ + is_rionet_capable(dev-pef, dev-src_ops, dev-dst_ops) + +#define RIONET_MAC_MATCH(x)(*(u32 *)x == 0x00010001) +#define RIONET_GET_DESTID(x) (*(u16 *)(x + 4)) + +static struct net_device_stats *rionet_stats(struct net_device *ndev) +{ + struct rionet_private *rnet = ndev-priv; + return rnet-stats; +} + +static int rionet_rx_clean(struct net_device *ndev) +{ + int i; + int error = 0; + struct rionet_private *rnet = ndev-priv; + void *data; + + i = rnet-rx_slot; + + do { + if (!rnet-rx_skb[i]) { + rnet-stats.rx_dropped++; + continue; + } + + if (!(data = rio_get_inb_message(rnet-mport,
[RFC] handle access to non-present IO ports on 8xx
Hi Ben, On Thu, Jun 02, 2005 at 12:46:32PM +1000, Benjamin Herrenschmidt wrote: On Wed, 2005-06-01 at 13:50 -0300, Marcelo Tosatti wrote: Hrm... removing a PCMCIA card triggers mchecks ? that is bad... With proper PCMCIA controllers, those are swallowed properly when the card is removed. The eating of the machine check is a bit too hackish to my taste... Better is to not do that by making sure the legacy crap isn't trying to tap unexisting ports, but then, if PCMCIA is also a problem... Well, cardmgr calls the driver's shutdown/close routine as soon as the card is removed. Some of those methods write to IO registers in the process (eg net/pcmcia/pcnet_cs.c). I dont see any elegant change that could be done in PCMCIA. One possibility that comes to mind would be to enforce the rule that drivers should not writeout in case of a removal event, but that does not sound feasible to me: It just looks too messy, however I have no good argument against it. Well, its restricted to 8xx (maybe 32-bit PPC) with PCMCIA, so its just not worth the trouble? 1) why does the current PowerMac version covers only inb() and not outb() ? I had to add outb() exception table entries for 8xx. Not sure, maybe historical loss ? :) You should CC paulus 2) Is the same wanted for other embedded PPC's? It's up to you. It slows down those IOs, but on the other hand, inX/outX aren't supposed to be very common anymore, at least not with fast devices, and the IO itself is usually an order of magnitude slower than doing those syncs... 3) How to make the misc.S exception entries and additional instructions selectable only on the platform who need it? #ifdef does not sound a good idea. Nevermind the #ifdef CONFIG_ALL_PPC crap - that needs to be done properly. Index: arch/ppc/kernel/misc.S === RCS file: /mnt/test1/tslinux_mv21/linux-216/arch/ppc/kernel/misc.S,v retrieving revision 1.2 diff -u -r1.2 misc.S --- arch/ppc/kernel/misc.S 22 Oct 2003 19:34:30 - 1.2 +++ arch/ppc/kernel/misc.S 1 Jun 2005 17:59:30 - @@ -736,8 +736,23 @@ subir4,r4,1 blelr- 00:lbz r5,0(r3) - eieio - stbur5,1(r4) +01:eieio +02:stbur5,1(r4) +03:twi 0, r5, 0 +04:isync +05:nop Hrm... the twi/isync stuff is not valid for a store. The reason for doing twi here is to trigger a data dependency on the result of the load (to make sure the load actually happens) and the isync to make sure that twi has actually completed. For stores, you are stuffed... either your HW don't do machine checks on stores, Does not sound a like a good idea :) or you put a sync here and hope you don't have write posting along the IO chain that would cause your machine check to arrive too late... Hmmm... I'll look that up. My limited testing on HW in question does not exhibit longer MCE delays than twi/isync/nop sequence - actually, it is always triggered during the IO access instruction itself. Where can I find information about write posting on 8xx? Is there a term for it used in PPC documentation? I can't find anything... Thanks!
[PATCH][5/5] RapidIO support: net driver over messaging
How much is this like ethernet? does it still do ARP? Can it do promiscious receive? +LIST_HEAD(rionet_peers); Does this have to be global? Not sure about the locking of this stuff, are you relying on the RTNL? + +static int rionet_change_mtu(struct net_device *ndev, int new_mtu) +{ + struct rionet_private *rnet = ndev-priv; + + if (netif_msg_drv(rnet)) + printk(KERN_WARNING +%s: rionet_change_mtu(): not implemented\n, DRV_NAME); + + return 0; +} If you can allow any mtu then don't need this at all. Or if you are limited then better return an error for bad values. +static void rionet_set_multicast_list(struct net_device *ndev) +{ + struct rionet_private *rnet = ndev-priv; + + if (netif_msg_drv(rnet)) + printk(KERN_WARNING +%s: rionet_set_multicast_list(): not implemented\n, +DRV_NAME); +} If you can't handle it then just leave dev-set_multicast_list as NULL and all attempts to add or delete will get -EINVAL + +static int rionet_open(struct net_device *ndev) +{ + /* Initialize inbound message ring */ + for (i = 0; i RIONET_RX_RING_SIZE; i++) + rnet-rx_skb[i] = NULL; + rnet-rx_slot = 0; + rionet_rx_fill(ndev, 0); + + rnet-tx_slot = 0; + rnet-tx_cnt = 0; + rnet-ack_slot = 0; + + spin_lock_init(rnet-lock); + + rnet-msg_enable = RIONET_DEFAULT_MSGLEVEL; Better to do all initialization of the per device data in the place it is allocated (rio_setup_netdev) + +static int rionet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) +{ + return -EOPNOTSUPP; +} Unneeded, if dev-do_ioctl is NULL, then all private ioctl's will return -EINVAL that is what you want. + +static u32 rionet_get_link(struct net_device *ndev) +{ + return netif_carrier_ok(ndev); +} Use ethtool_op_get_link + +static int rionet_setup_netdev(struct rio_mport *mport) +{ + int rc = 0; + struct net_device *ndev = NULL; + struct rionet_private *rnet; + u16 device_id; + + /* Allocate our net_device structure */ + ndev = alloc_etherdev(sizeof(struct rionet_private)); + if (ndev == NULL) { + printk(KERN_INFO %s: could not allocate ethernet device.\n, +DRV_NAME); + rc = -ENOMEM; + goto out; + } + + /* + * XXX hack, store point a static at ndev so we can get it... + * Perhaps need an array of these that the handler can + * index via the mbox number. + */ + sndev = ndev; + + /* Set up private area */ + rnet = (struct rionet_private *)ndev-priv; + rnet-mport = mport; + + /* Set the default MAC address */ + device_id = rio_local_get_device_id(mport); + ndev-dev_addr[0] = 0x00; + ndev-dev_addr[1] = 0x01; + ndev-dev_addr[2] = 0x00; + ndev-dev_addr[3] = 0x01; + ndev-dev_addr[4] = device_id 8; + ndev-dev_addr[5] = device_id 0xff; + + /* Fill in the driver function table */ + ndev-open = rionet_open; + ndev-hard_start_xmit = rionet_start_xmit; + ndev-stop = rionet_close; + ndev-get_stats = rionet_stats; + ndev-change_mtu = rionet_change_mtu; + ndev-set_mac_address = rionet_set_mac_address; + ndev-set_multicast_list = rionet_set_multicast_list; + ndev-do_ioctl = rionet_ioctl; + SET_ETHTOOL_OPS(ndev, rionet_ethtool_ops); + + ndev-mtu = RIO_MAX_MSG_SIZE - 14; + + SET_MODULE_OWNER(ndev); Can you set any ndev-features to get better performance. Can you take 32bit data addresses? then set HIGHDMA You are doing your on locking, can you use LLTX? Does the hardware support scatter gather?
[PATCH] cpm_uart: Route SCC2 pins for the STx GP3 board
Matt Porter mporter at kernel.crashing.org wrote: +++ uncommitted/drivers/serial/cpm_uart/cpm_uart_cpm2.c (mode:100644) @@ -134,12 +134,21 @@ void scc2_lineif(struct uart_cpm_port *pinfo) { + /* + * STx GP3 uses the SCC2 secondary option pin assignment + * which this driver doesn't account for in the static + * pin assignments. This kind of board specific info + * really has to get out of the driver so boards can + * be supported in a sane fashion. + */ +#ifndef CONFIG_STX_GP3 volatile iop_cpm2_t *io = cpm2_immr-im_ioport; io-iop_pparb |= 0x008b; Silly question: why is this driver using a volatile pointer to memory-mapped I/O rather than readl and writel?
Getting ownership for various boards/platforms configs
One issue that comes up from time to time is knowing who to contact about some of the various boards that are supported for PPC. I've suggested in the past that we create a MAINTAINERS file in arch/ppc/platforms. I've started with a list of all the _defconfigs that we have and would like to see if we can get contacts for the boards. All this list is meant to be is a contact point. The following is the list, I'll keep a live copy at http://gate.crashing.org/~galak/platform-owners. Once it gets flushed out I'll turn it into file that looks more like the toplevel MAINTAINERS file. If we dont have any owners for a board we can discuss if support for it should be removed. Please email me if you feel you are the owner of any board/config. thanks - kumar adir ads8272 apus ash beech bseip bubinga cedar chestnut common cpci405 cpci690 ebony ep405 est8260 ev64260 FADS gemini hdpu ibmchrp IVMS8 k2 katana lite5200 lopec luan mbx mcpn765 menf1 Dead (Matt Porter) mpc834x_sys Kumar Gala mpc8540_ads Kumar Gala mpc8548_cds Kumar Gala mpc8555_cds Kumar Gala mpc8560_ads Kumar Gala mvme5100 oak ocotea pcore pmac power3 pplus prpmc750 prpmc800 radstone_ppc7d rainier redwood5 redwood6 redwood rpx8260 rpxcllf rpxlite sandpoint SM850 SPD823TS spruce stx_gp3 sycamore TQM823L TQM8260 TQM850L TQM860L walnut
Getting ownership for various boards/platforms configs
Two things: 1) What is common in your list? 2) On a slightly different note...if no one volunteers to look after the following ones, I vote to remove them: k2 lopec mcpn765 menf1Dead (Matt Porter) pmac :) Are there others? Mark
Getting ownership for various boards/platforms configs
On Jun 2, 2005, at 7:00 PM, Mark A. Greer wrote: Two things: 1) What is common in your list? Good question, hopefully Paul knows. I just did an ls in arch/ppc/configs/ to create the list. - kumar
Newbie question on Linux-PPC
Hi Srivatsan, On Thursday 02 June 2005 04:41, Srivatsan CR wrote: Hi all, Thanks everyone for the time. It's done and I have it working. I have another question regarding MAC address in Linux. I had ported U-boot onto our customized board (MPC8280 based). It is working fine. I am also able to boot a Linux Kernel. The Kernel version is Linux-2.4.20 . We set the MAC address for the board in U-boot as 00:FD:11:01:01:01. But when the Linux Kernel boots it takes the MAC as 00:FD:81:01:01:01. I have confirmed that the U-boot passes the MAC address properly to the Linux Kernel properly. Can anyone guide me to where to look out for the issue stated above in the Linux code? Check if there're some hack in fcc_enet.c driver code, regarding the MAC address setup. HTH, -- Ricardo Scop. \|/ ___ -*- (@ @)/|\ / V \| R SCOP Consult. /( )\ Linux-based communications --^^---^^+-- rscop at matrix.com.br +55 51 999-36-777 Porto Alegre, RS - BRazil -- P. S.: If you don't have time to do it right, when will you have time to do it over? -- Penny Hines
Getting ownership for various boards/platforms configs
On Thu, Jun 02, 2005 at 06:19:11PM -0500, Kumar Gala wrote: One issue that comes up from time to time is knowing who to contact about some of the various boards that are supported for PPC. I've suggested in the past that we create a MAINTAINERS file in arch/ppc/platforms. I've started with a list of all the _defconfigs that we have and would like to see if we can get contacts for the boards. All this list is meant to be is a contact point. The following is the list, I'll keep a live copy at http://gate.crashing.org/~galak/platform-owners. Once it gets flushed out I'll turn it into file that looks more like the toplevel MAINTAINERS file. If we dont have any owners for a board we can discuss if support for it should be removed. Please email me if you feel you are the owner of any board/config. thanks - kumar ash beech These are't in 2.6, remove the defconfig bubinga me/ebs cedar This isn't in 2.6, remove the defconfig ebony me/ebs k2 I did the original port, now unmaintained/obsolete..die die die. lopec trini is probably the maintainer here...he likes this board. luan me menf1 Dead (Matt Porter) Remove it, yes. oak I think it's time to remove it...unmaintained. ocotea me/ebs rainier Not in 2.6...remove defconfig redwood5 redwood6 um...dfarnsworth, want them formally? redwood Not in 2.6...remove defconfig stx_gp3 me sycamore me walnut me
Getting ownership for various boards/platforms configs
On Fri, Jun 03, 2005 at 12:18:22AM +, Matt Porter wrote: redwood5 redwood6 um...dfarnsworth, want them formally? Sure, put me down for redwood5 and redwood6 -Dale
[PATCH] cpm_uart: Route SCC2 pins for the STx GP3 board
On Thu, Jun 02, 2005 at 03:35:40PM -0700, Andrew Morton wrote: Matt Porter mporter at kernel.crashing.org wrote: +++ uncommitted/drivers/serial/cpm_uart/cpm_uart_cpm2.c (mode:100644) @@ -134,12 +134,21 @@ void scc2_lineif(struct uart_cpm_port *pinfo) { + /* +* STx GP3 uses the SCC2 secondary option pin assignment +* which this driver doesn't account for in the static +* pin assignments. This kind of board specific info +* really has to get out of the driver so boards can +* be supported in a sane fashion. +*/ +#ifndef CONFIG_STX_GP3 volatile iop_cpm2_t *io = cpm2_immr-im_ioport; io-iop_pparb |= 0x008b; Silly question: why is this driver using a volatile pointer to memory-mapped I/O rather than readl and writel? readl/writel just won't work. They are byte swapped on PPC since they are specifically for PCI access. In other on-chip drivers for PPC32, we typically ioremap() to a non-volatile type and then use out_be32()/in_be32() since everything except PCI on PPC is in right-endian (big endian) form. out_be*()/in_be*() contain an eieio instruction to guarantee proper ordering. I know this driver was recently rewritten but the authors may have missed the past threads about why volatile use is discouraged. We do something similar with register overlay structures in drivers/net/ibm_emac. However, we don't use a volatile type and do use PPC32-specific (these are PPC-specific drivers anyway) out_be32()/in_be32() for correctness. -Matt
[PATCH] Fix PPC440 pagetable attributes
This patch fixes a bug in the PPC440 pagetable attributes that breaks swap support. It also adds some notes on the PPC440 attribute fields. Signed-off-by: Geoff Levand geoffrey.levand at am.sony.com for CELF -- Index: linux-2.6.12-bhpm/include/asm-ppc/pgtable.h === --- linux-2.6.12-bhpm.orig/include/asm-ppc/pgtable.h2005-06-02 15:09:24.0 -0700 +++ linux-2.6.12-bhpm/include/asm-ppc/pgtable.h 2005-06-02 15:47:53.0 -0700 @@ -202,18 +202,64 @@ * * Note that these bits preclude future use of a page size * less than 4KB. + * + * + * PPC 440 core has following TLB attribute fields; + * + * TLB1: + * 0 1 2 3 4 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 + * RPN. - - - - - - ERPN... + * + * TLB2: + * 0 1 2 3 4 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 + * - - - - -- U0 U1 U2 U3 W I M G E - UX UW UR SX SW SR + * + * There are some constrains and options, to decide mapping software bits + * into TLB entry. + * + * - PRESENT *must* be in the bottom three bits because swap cache + * entries use the top 29 bits for TLB2. + * + * - FILE *must* be in the bottom three bits because swap cache + * entries use the top 29 bits for TLB2. + * + * - CACHE COHERENT bit (M) has no effect on PPC440 core, because it + * doesn't support SMP. So we can use this as software bit, like + * DIRTY. + * + * PPC Book-E Linux implementation uses PPC HW PTE bit field definition, + * even it doesn't have HW PTE. 0-11th LSB of PTE stand for memory + * protection-related function. (See PTE structure in include/asm-ppc/mmu.h) + * Definition of _PAGE_XXX in include/asm-ppc/pagetable.h stands for + * above bits. Note that those bits values are CPU dependent, not + * architecture. + * + * Kernel PTE entry holds arch-dependent swp_entry structure under certain + * situation. In other words, in such situation, some portion of PTE bits + * are used as swp_entry. In PPC implementation, 3-24th LSB are shared with + * swp_entry, however 0-2nd three LSB still hold protection values. + * That means three protection bits are reserved for both PTE and SWAP + * entry at the most three LSBs. + * + * There are three protection bits available for SWAP entry; + * _PAGE_PRESENT + * _PAGE_FILE + * _PAGE_HASHPTE (if HW has) + * + * So those three bits have to be inside of 0-2nd LSB of PTE. + * */ + #define _PAGE_PRESENT 0x0001 /* S: PTE valid */ #define_PAGE_RW0x0002 /* S: Write permission */ -#define_PAGE_DIRTY 0x0004 /* S: Page dirty */ +#define _PAGE_FILE 0x0004 /* S: nonlinear file mapping */ #define _PAGE_ACCESSED 0x0008 /* S: Page referenced */ #define _PAGE_HWWRITE 0x0010 /* H: Dirty RW */ #define _PAGE_HWEXEC 0x0020 /* H: Execute permission */ #define_PAGE_USER 0x0040 /* S: User page */ #define_PAGE_ENDIAN0x0080 /* H: E bit */ #define_PAGE_GUARDED 0x0100 /* H: G bit */ -#define_PAGE_COHERENT 0x0200 /* H: M bit */ -#define _PAGE_FILE 0x0400 /* S: nonlinear file mapping */ +#define_PAGE_DIRTY 0x0200 /* S: Page dirty */ #define_PAGE_NO_CACHE 0x0400 /* H: I bit */ #define_PAGE_WRITETHRU 0x0800 /* H: W bit */ -EOF