Re: [patch 1/3] ps3: Disk Storage Driver

2007-07-19 Thread Geert Uytterhoeven
On Thu, 19 Jul 2007, Jens Axboe wrote:
> On Wed, Jul 18 2007, Andrew Morton wrote:
> > On Mon, 16 Jul 2007 18:15:40 +0200
> > Geert Uytterhoeven <[EMAIL PROTECTED]> wrote:
> > 
> > > From: Geert Uytterhoeven <[EMAIL PROTECTED]>
> > > 
> > > Add a Disk Storage Driver for the PS3:
> > 
> > Your patchset significantly hits powerpc, scsi and block.  So who gets to
> > merge this?  Jens?  James?  Paul?
> > 
> > Me, I guess ;)
> 
> I think Paul was going to take it, or at least Geert hinted as such.

Yep, but as I heard Paul is on holidays, I was just going to send it to Andrew
anyway.

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [patch 0/3] PS3 Storage Drivers for 2.6.23, take 5

2007-07-19 Thread Alessandro Rubini

Hello.

> I didn't hear anything from the misc device maintainer (for the FLASH ROM
> Storage Driver).

Actually, I am not acting as a maintainer. I'm not active enough nor
up to date with all the structure of kernel maintainance. So please
don't wait for me.

Actually, I tried a pair of times to have my name removed from the
MAINTAINERS file over the years without success. Actually, I didn't
care a lot because nobody relly used that entry. I think it's time for
me to learn how to do it in the proper way.

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


Re: [patch 1/3] ps3: Disk Storage Driver

2007-07-19 Thread Geert Uytterhoeven
Hi Andrew,

On Wed, 18 Jul 2007, Andrew Morton wrote:
> On Mon, 16 Jul 2007 18:15:40 +0200
> Geert Uytterhoeven <[EMAIL PROTECTED]> wrote:
> 
> > From: Geert Uytterhoeven <[EMAIL PROTECTED]>
> > 
> > Add a Disk Storage Driver for the PS3:
> 
> Your patchset significantly hits powerpc, scsi and block.  So who gets to
> merge this?  Jens?  James?  Paul?
> 
> Me, I guess ;)

As Paul is on holidays, please take it. The PS3 storage driver core support is
already in mainline, but the actual drivers aren't, as Paul was waiting for
acks from the maintainers.

BTW, do you prefer incremental patches for the comments below, or an update of
the full patchset?

> > +#define KERNEL_SECTOR_SIZE 512
> 
> Sigh.  We have at least ten separate definitions of SECTOR_SIZE< none of
> them in the right place.  Cleanup opportunity for someone.

Will replace by 512 resp. >> 9, as per Jens' suggestion.

> > +struct ps3disk_private {
> > +   spinlock_t lock;/* Request queue spinlock */
> > +   struct request_queue *queue;
> > +   struct gendisk *gendisk;
> > +   unsigned int blocking_factor;
> > +   struct request *req;
> > +   u64 raw_capacity;
> > +   unsigned char model[ATA_ID_PROD_LEN+1];
> > +};
> > +#define ps3disk_priv(dev)  ((dev)->sbd.core.driver_data)
> 
> hm, this code has "ata" all over it and actually uses a libata #define (at
> least) but there is no Kconfig dependency on ATA.  Fair enough, I guess,
> but a bit funny-looking.

I needed the definitions just for drive identification.

> > +static void ps3disk_scatter_gather(struct ps3_storage_device *dev,
> > +  struct request *req, int gather)
> > +{
> > +   unsigned int sectors = 0, offset = 0;

> Local variable `sectors' doesn't do anything.

Good catch!

> > +static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
> > +struct request *req)
> > +{
> > +   struct ps3disk_private *priv = ps3disk_priv(dev);
> > +   int write = rq_data_dir(req), res;
> > +   const char *op = write ? "write" : "read";
> > +   u64 start_sector, sectors;
> > +   unsigned int region_id = dev->regions[dev->region_idx].id;
> 
> So we're ignoring the sector_t stuff.  I guess it's 64-bit only.  Still, it
> might be nice to use sector_t for consistency, readability and possible
> future 32-bitness?

I used u64 as they're directly passed to hypervisor calls and that's what the
hypervisor calls take.

BTW, Cell will never support a 32-bit kernel, as lots of on-chip stuff lies
outside the 32-bit address space.

> > +#ifdef DEBUG
> > +   unsigned int n = 0;
> > +   struct bio *bio;
> > +   rq_for_each_bio(bio, req)
> > +   n++;
> 
> I'm surprised that the block core doesn't have a helper to count the number
> of bios in a request.
> 
> Please prefer to put a blank line between end-of-locals and start-of-code.

Done.

> > +   dev_dbg(&dev->sbd.core,
> > +   "%s:%u: %s req has %u bios for %lu sectors %lu hard sectors\n",
> > +   __func__, __LINE__, op, n, req->nr_sectors,
> > +   req->hard_nr_sectors);
> > +#endif
> > +
> > +   start_sector = req->sector*priv->blocking_factor;
> > +   sectors = req->nr_sectors*priv->blocking_factor;
> 
> s/*/ * /.  checkpatch missed this.

Will change (yes, checkpatch missed it).

> I suspect you didn't run cehckpatch anyway.

I did ;-)

> Please run checkpatch.

All it complains about is (bogus)  and a single too long line I
don't want to break.

> > +/* ATA helpers copied from drivers/ata/libata-core.c */
> 
> ooh, bad person.

I didn't have much choice, as most of it was static and I don't need the full
libata core anyway.

If I would factor it out, any good suggestion where to put the factored out
code?

> > +   ps3disk_identify(dev);
> 
> ps3disk_identify() can return an error?

Sending storage commands may fail, but being unable to identify the disk isn't
fatal, as it's just for informational purposes.

> > +static int ps3disk_remove(struct ps3_system_bus_device *_dev)
> > +{
> > +   struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
> > +   struct ps3disk_private *priv = ps3disk_priv(dev);
> > +
> > +   __clear_bit(priv->gendisk->first_minor / PS3DISK_MINORS,
> > +   &ps3disk_mask);
> 
> I see no locking here which makes this __clear_bit and the above __set_bit
> non-racy?

Were .probe()/.remove() made concurrent again? I thought that idea was dropped
because it caused too many problems?

> > +   kfree(priv);
> > +   ps3disk_priv(dev) = NULL;
> 
> I suspect this nulling here will just hide any bugs?  If we're going to
> write anything there, probably 0xdeadbeef would be better?

Hmm, earlier reviewers explicitly asked for putting it there...

Thanks for your comments!

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 862

Re: [patch 2/3] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-19 Thread Geert Uytterhoeven
On Wed, 18 Jul 2007, Andrew Morton wrote:
> > +struct ps3rom_private {
> > +   struct ps3_storage_device *dev;
> > +   struct scsi_cmnd *curr_cmd;
> > +};
> > +#define ps3rom_priv(dev)   ((dev)->sbd.core.driver_data)
> > +
> 
> Someone should invent a keyboard which delivers an electric shock when the
> operator types "#define".   In the meanwhile, I get to do the honours.
> 
> Please don't implement in a macro anything which can be implemented in C.

All I needed was a shorthand to access driver_data, for both read and write
access (you cannot do the latter with C, unless you decouple read and write).

> > +   kaddr = kmap_atomic(sgpnt->page, KM_IRQ0);
> > +   if (!kaddr)
> > +   return -1;
> 
> kmap_atomic() cannot fail.  On i386, at least.  If it can fail on any other
> arch then we have a big problem.  (Multiple instances of this)

Thanks, fixed!

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [patch 1/3] ps3: Disk Storage Driver

2007-07-19 Thread Andrew Morton
On Thu, 19 Jul 2007 10:57:53 +0200 (CEST) Geert Uytterhoeven <[EMAIL 
PROTECTED]> wrote:

>   Hi Andrew,
> 
> On Wed, 18 Jul 2007, Andrew Morton wrote:
> > On Mon, 16 Jul 2007 18:15:40 +0200
> > Geert Uytterhoeven <[EMAIL PROTECTED]> wrote:
> > 
> > > From: Geert Uytterhoeven <[EMAIL PROTECTED]>
> > > 
> > > Add a Disk Storage Driver for the PS3:
> > 
> > Your patchset significantly hits powerpc, scsi and block.  So who gets to
> > merge this?  Jens?  James?  Paul?
> > 
> > Me, I guess ;)
> 
> As Paul is on holidays, please take it.

OK.

> The PS3 storage driver core support is
> already in mainline, but the actual drivers aren't, as Paul was waiting for
> acks from the maintainers.
> 
> BTW, do you prefer incremental patches for the comments below, or an update of
> the full patchset?

Incremental is preferred, but I convert replacement patches into
incremental patches at about 10Hz nowadays.  Whatever's easier.

(Actually, if it's a replacement patch then only I get to see the
incremental patch, and the incremental patch is more reviewer-friendly).

> I didn't have much choice, as most of it was static and I don't need the full
> libata core anyway.
> 
> If I would factor it out, any good suggestion where to put the factored out
> code?

Take it up with Jeff, please.  If you're keen.  It isn't a lot of code.

> 
> > > +static int ps3disk_remove(struct ps3_system_bus_device *_dev)
> > > +{
> > > + struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
> > > + struct ps3disk_private *priv = ps3disk_priv(dev);
> > > +
> > > + __clear_bit(priv->gendisk->first_minor / PS3DISK_MINORS,
> > > + &ps3disk_mask);
> > 
> > I see no locking here which makes this __clear_bit and the above __set_bit
> > non-racy?
> 
> Were .probe()/.remove() made concurrent again? I thought that idea was dropped
> because it caused too many problems?

I don't _think_ there's any global exclusion on ->probe calls.  For a
particular driver instance it's hard to see how these thigns can run
concurrently, dunno.  I guess two hotunplugs coud happen concurrently.


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


Re: [patch 2/3] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-19 Thread Andrew Morton
On Thu, 19 Jul 2007 11:02:07 +0200 (CEST) Geert Uytterhoeven <[EMAIL 
PROTECTED]> wrote:

> On Wed, 18 Jul 2007, Andrew Morton wrote:
> > > +struct ps3rom_private {
> > > + struct ps3_storage_device *dev;
> > > + struct scsi_cmnd *curr_cmd;
> > > +};
> > > +#define ps3rom_priv(dev) ((dev)->sbd.core.driver_data)
> > > +
> > 
> > Someone should invent a keyboard which delivers an electric shock when the
> > operator types "#define".   In the meanwhile, I get to do the honours.
> > 
> > Please don't implement in a macro anything which can be implemented in C.
> 
> All I needed was a shorthand to access driver_data, for both read and write
> access (you cannot do the latter with C, unless you decouple read and write).

Oh dear.

ps3rom_priv(dev) = host;

that's 'orrid.  We have an identifier pretending to be a function, only we
go and treat it as an lvalue.

I mean, C code should look like C code, and the above just doesn't.

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


Re: [patch 1/3] ps3: Disk Storage Driver

2007-07-19 Thread Cornelia Huck
On Thu, 19 Jul 2007 10:57:53 +0200 (CEST),
Geert Uytterhoeven <[EMAIL PROTECTED]> wrote:

> Were .probe()/.remove() made concurrent again? I thought that idea was dropped
> because it caused too many problems?

Well, for a given device, ->probe()/->remove() are locked by dev->sem,
so that there cannot be two probes/removes for the same device at the
same time. However, if you have multiple hotplug events pending at the
same time, it depends on your bus whether it does some serialization or
whether it allows multiple probes/removes running for different devices.
(Initial probing of a bus and probing of all devices with a new driver
is done serialized again, I think that's what you're referring to.)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [patch 1/3] ps3: Disk Storage Driver

2007-07-19 Thread Geert Uytterhoeven
On Thu, 19 Jul 2007, Cornelia Huck wrote:
> On Thu, 19 Jul 2007 10:57:53 +0200 (CEST),
> Geert Uytterhoeven <[EMAIL PROTECTED]> wrote:
> 
> > Were .probe()/.remove() made concurrent again? I thought that idea was 
> > dropped
> > because it caused too many problems?
> 
> Well, for a given device, ->probe()/->remove() are locked by dev->sem,
> so that there cannot be two probes/removes for the same device at the
> same time. However, if you have multiple hotplug events pending at the

OK.

> same time, it depends on your bus whether it does some serialization or
> whether it allows multiple probes/removes running for different devices.
> (Initial probing of a bus and probing of all devices with a new driver
> is done serialized again, I think that's what you're referring to.)

We have a probe thread that checks for new storage devices and adds them to the
bus with ps3_system_bus_device_register(), which calls device_register().

I guess the actual bus probe() routine gets called through the notifier call
chain? That's where I got lost...

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [patch 2/3] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-19 Thread Geert Uytterhoeven
On Thu, 19 Jul 2007, Andrew Morton wrote:
> On Thu, 19 Jul 2007 11:02:07 +0200 (CEST) Geert Uytterhoeven <[EMAIL 
> PROTECTED]> wrote:
> 
> > On Wed, 18 Jul 2007, Andrew Morton wrote:
> > > > +struct ps3rom_private {
> > > > +   struct ps3_storage_device *dev;
> > > > +   struct scsi_cmnd *curr_cmd;
> > > > +};
> > > > +#define ps3rom_priv(dev)   ((dev)->sbd.core.driver_data)
> > > > +
> > > 
> > > Someone should invent a keyboard which delivers an electric shock when the
> > > operator types "#define".   In the meanwhile, I get to do the honours.
> > > 
> > > Please don't implement in a macro anything which can be implemented in C.
> > 
> > All I needed was a shorthand to access driver_data, for both read and write
> > access (you cannot do the latter with C, unless you decouple read and 
> > write).
> 
> Oh dear.
> 
>   ps3rom_priv(dev) = host;
> 
> that's 'orrid.  We have an identifier pretending to be a function, only we
> go and treat it as an lvalue.
> 
> I mean, C code should look like C code, and the above just doesn't.
> 
> Sigh.

Do you prefer

static inline struct ps3rom_private *ps3rom_priv_get(struct ps3_storage_device
*dev)
{
return dev->sbd.core.driver_data;
}

static inline void ps3rom_priv_set(struct ps3_storage_device *dev,
   struct ps3rom_private *priv)
{
dev->sbd.core.driver_data = priv;
}

instead?

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [patch 2/3] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-19 Thread Jens Axboe
On Thu, Jul 19 2007, Geert Uytterhoeven wrote:
> On Thu, 19 Jul 2007, Andrew Morton wrote:
> > On Thu, 19 Jul 2007 11:02:07 +0200 (CEST) Geert Uytterhoeven <[EMAIL 
> > PROTECTED]> wrote:
> > 
> > > On Wed, 18 Jul 2007, Andrew Morton wrote:
> > > > > +struct ps3rom_private {
> > > > > + struct ps3_storage_device *dev;
> > > > > + struct scsi_cmnd *curr_cmd;
> > > > > +};
> > > > > +#define ps3rom_priv(dev) ((dev)->sbd.core.driver_data)
> > > > > +
> > > > 
> > > > Someone should invent a keyboard which delivers an electric shock when 
> > > > the
> > > > operator types "#define".   In the meanwhile, I get to do the honours.
> > > > 
> > > > Please don't implement in a macro anything which can be implemented in 
> > > > C.
> > > 
> > > All I needed was a shorthand to access driver_data, for both read and 
> > > write
> > > access (you cannot do the latter with C, unless you decouple read and 
> > > write).
> > 
> > Oh dear.
> > 
> > ps3rom_priv(dev) = host;
> > 
> > that's 'orrid.  We have an identifier pretending to be a function, only we
> > go and treat it as an lvalue.
> > 
> > I mean, C code should look like C code, and the above just doesn't.
> > 
> > Sigh.
> 
> Do you prefer
> 
> static inline struct ps3rom_private *ps3rom_priv_get(struct ps3_storage_device
> *dev)
> {
>   return dev->sbd.core.driver_data;
> }
> 
> static inline void ps3rom_priv_set(struct ps3_storage_device *dev,
>  struct ps3rom_private *priv)
> {
>   dev->sbd.core.driver_data = priv;
> }

how about just killing them? it makes the code harder to read, what is
the point of abstracting something like that out?

-- 
Jens Axboe

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


Re: [patch 2/3] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-19 Thread Andrew Morton
On Thu, 19 Jul 2007 11:39:32 +0200 (CEST) Geert Uytterhoeven <[EMAIL 
PROTECTED]> wrote:

> > Oh dear.
> > 
> > ps3rom_priv(dev) = host;
> > 
> > that's 'orrid.  We have an identifier pretending to be a function, only we
> > go and treat it as an lvalue.
> > 
> > I mean, C code should look like C code, and the above just doesn't.
> > 
> > Sigh.
> 
> Do you prefer
> 
> static inline struct ps3rom_private *ps3rom_priv_get(struct ps3_storage_device
> *dev)
> {
>   return dev->sbd.core.driver_data;
> }
> 
> static inline void ps3rom_priv_set(struct ps3_storage_device *dev,
>  struct ps3rom_private *priv)
> {
>   dev->sbd.core.driver_data = priv;
> }
> 
> instead?

Yes.  Not that it's a terribly important issue, particularly down in the
dark and dusty corners where this code lurks.  The "function" as an lvalue
thing would be more obnoxious in some top-level interface.  We probably
already have some :(

If it were mine I'd open-code the "set" and do the "get" as a static
inline.  Or you could leave it as-is and go off and do something more
important ;)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [patch 3/3] ps3: FLASH ROM Storage Driver

2007-07-19 Thread Geert Uytterhoeven
Hi Andrew,

On Wed, 18 Jul 2007, Andrew Morton wrote:
> > +struct ps3flash_private {
> > +   struct mutex mutex; /* Bounce buffer mutex */
> > +};
> > +#define ps3flash_priv(dev) ((dev)->sbd.core.driver_data)
> 
> bzzzt!

Same defense as ps3rom ;-)

> > +static loff_t ps3flash_llseek(struct file *file, loff_t offset, int origin)
> > +{
> > +   struct ps3_storage_device *dev = ps3flash_dev;
> > +   u64 size = dev->regions[dev->region_idx].size*dev->blk_size;
> > +
> > +   switch (origin) {
> > +   case 1:
> > +   offset += file->f_pos;
> > +   break;
> > +   case 2:
> > +   offset += size;
> > +   break;
> > +   }
> > +   if (offset < 0)
> > +   return -EINVAL;
> > +
> > +   file->f_pos = offset;
> > +   return file->f_pos;
> > +}
> 
> lseek implementations usually need locking.  file->f_mapping->host->i_mutex
> would be typical.
> 
> That locking mostly protects 64-bit f_pos on 32-bit architectures so you
> can perahps kinda get away with it here.  However the code is a bit racy
> even on 64-bit, for silly userspace.
> 
> That being said, I'd have thought that you could use one of our many
> generic lseek library fucntions here, or even an newly-exported
> block_llseek().  That assumes that i_size is correct, which I trust is the
> case.

You mean generic_file_llseek()?

Who is responsible for setting i_size in that case? This is not a file, but a
character device, so currently i_size is always zero.

So I'll just add the missing locks.

> > +static ssize_t ps3flash_read(struct file *file, char __user *buf, size_t 
> > count,
> > +loff_t *pos)
> > +{
> > +   struct ps3_storage_device *dev = ps3flash_dev;
> > +   struct ps3flash_private *priv = ps3flash_priv(dev);
> > +   u64 size, start_sector, end_sector, offset;
> > +   ssize_t sectors_read;
> > +   size_t remaining, n;
> > +
> > +   dev_dbg(&dev->sbd.core,
> > +   "%s:%u: Reading %zu bytes at position %lld to user 0x%p\n",
> > +   __func__, __LINE__, count, *pos, buf);
> > +
> > +   size = dev->regions[dev->region_idx].size*dev->blk_size;
> > +   if (*pos >= size || !count)
> > +   return 0;
> > +
> > +   if (*pos+count > size) {
> > +   dev_dbg(&dev->sbd.core,
> > +   "%s:%u Truncating count from %zu to %llu\n", __func__,
> > +   __LINE__, count, size - *pos);
> > +   count = size - *pos;
> > +   }
> > +
> > +   start_sector = do_div_llr(*pos, dev->blk_size, &offset);
> > +   end_sector = DIV_ROUND_UP(*pos+count, dev->blk_size);
> > +
> > +   remaining = count;
> > +   do {
> > +   mutex_lock(&priv->mutex);
> > +
> > +   sectors_read = ps3flash_read_sectors(dev, start_sector,
> > +end_sector-start_sector,
> > +0);
> > +   if (sectors_read < 0) {
> > +   mutex_unlock(&priv->mutex);
> > +   return sectors_read;
> > +   }
> > +
> > +   n = min(remaining, sectors_read*dev->blk_size-offset);
> > +   dev_dbg(&dev->sbd.core,
> > +   "%s:%u: copy %lu bytes from 0x%p to user 0x%p\n",
> > +   __func__, __LINE__, n, dev->bounce_buf+offset, buf);
> > +   if (copy_to_user(buf, dev->bounce_buf+offset, n)) {
> > +   mutex_unlock(&priv->mutex);
> > +   return -EFAULT;
> > +   }
> > +
> > +   mutex_unlock(&priv->mutex);
> > +
> > +   *pos += n;
> > +   buf += n;
> > +   remaining -= n;
> > +   start_sector += sectors_read;
> > +   offset = 0;
> > +   } while (remaining > 0);
> > +
> > +   return count;
> > +}
> 
> There are several nasty deeply-embedded return points in this function.

Will change to `goto fail' and common error return.

> > +   if (*pos+count > size) {
> 
> checkpatch missed stuff here.

Checkpatch is silent...

> > +   dev_dbg(&dev->sbd.core,
> > +   "%s:%u Truncating count from %zu to %llu\n", __func__,
> > +   __LINE__, count, size - *pos);
> > +   count = size - *pos;
> > +   }
> > +
> > +   chunk_sectors = dev->bounce_size / dev->blk_size;
> > +
> > +   start_write_sector = do_div_llr(*pos, dev->bounce_size, &offset) *
> > +chunk_sectors;
> 
> It's strange to see a do_div_llr() in the middle of all this 64-bit-only
> code.  Could use / and %?

Sure.

Note that in theory do_div_llr() could do the division and modulo in one
instruction on architectures that support that (hmm, that's div_long_long_rem).

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Net

Re: [patch 1/3] ps3: Disk Storage Driver

2007-07-19 Thread Cornelia Huck
On Thu, 19 Jul 2007 11:36:31 +0200 (CEST),
Geert Uytterhoeven <[EMAIL PROTECTED]> wrote:

> We have a probe thread that checks for new storage devices and adds them to 
> the
> bus with ps3_system_bus_device_register(), which calls device_register().
> 
> I guess the actual bus probe() routine gets called through the notifier call
> chain? That's where I got lost...

No, ->probe() is called from device_register() directly. If you just
have one probe thread, you should have enough serialization.

(Unless you're doing something interesting from the bus_notifier, which
is called via the notifier chain before ->probe()...)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [patch 1/3] ps3: Disk Storage Driver

2007-07-19 Thread Geert Uytterhoeven
On Thu, 19 Jul 2007, Cornelia Huck wrote:
> On Thu, 19 Jul 2007 11:36:31 +0200 (CEST),
> Geert Uytterhoeven <[EMAIL PROTECTED]> wrote:
> 
> > We have a probe thread that checks for new storage devices and adds them to 
> > the
> > bus with ps3_system_bus_device_register(), which calls device_register().
> > 
> > I guess the actual bus probe() routine gets called through the notifier call
> > chain? That's where I got lost...
> 
> No, ->probe() is called from device_register() directly. If you just
> have one probe thread, you should have enough serialization.

IC, through bus_attach_device() in device_add().

Any chance this will change? I already added a mutex to ps3disk to protect
against this.

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [patch 1/3] ps3: Disk Storage Driver

2007-07-19 Thread Cornelia Huck
On Thu, 19 Jul 2007 14:13:33 +0200 (CEST),
Geert Uytterhoeven <[EMAIL PROTECTED]> wrote:

> Any chance this will change? I already added a mutex to ps3disk to protect
> against this.

Probably not in the near future. A mutex looks like a good idea though,
since one never knows (and the driver core generally doesn't make many
guarantees regarding serialization).
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/4] ibmveth: Enable TCP checksum offload

2007-07-19 Thread Brian King
Jeff Garzik wrote:
> Brian King wrote:
>> This patchset enables TCP checksum offload support for IPV4
>> on ibmveth. This completely eliminates the generation and checking of
>> the checksum for packets that are completely virtual and never
>> touch a physical network. A simple TCP_STREAM netperf run on
>> a virtual network with maximum mtu set yielded a ~30% increase
>> in throughput. This feature is enabled by default on systems that
>> support it, but can be disabled with a module option.
>>
>> Signed-off-by: Brian King <[EMAIL PROTECTED]>
> 
> this should be controllable purely via ethtool...

I'll remove the module parameter and resend.

>>  struct ibmveth_rx_q_entry {
>>  u16 toggle : 1;
>>  u16 valid : 1;
>> -u16 reserved : 14;
>> +u16 reserved : 4;
>> +u16 no_csum : 1;
>> +u16 csum_good : 1;
>> +u16 reserved2 : 8;
>>  u16 offset;
> 
> As a general rule, it would be nice to start moving away from bitfields 
> in this driver

I'll take a look at that for a future cleanup patch.

Thanks,

Brian

-- 
Brian King
Linux on Power Virtualization
IBM Linux Technology Center
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 0/4] PS3 storage driver updates (was: Re: [patch 1/3] ps3: Disk Storage Driver)

2007-07-19 Thread Geert Uytterhoeven
Hi Andrew,

On Thu, 19 Jul 2007, Andrew Morton wrote:
> On Thu, 19 Jul 2007 10:57:53 +0200 (CEST) Geert Uytterhoeven <[EMAIL 
> PROTECTED]> wrote:
> > On Wed, 18 Jul 2007, Andrew Morton wrote:
> > > Your patchset significantly hits powerpc, scsi and block.  So who gets to
> > > merge this?  Jens?  James?  Paul?
> > > 
> > > Me, I guess ;)
> > 
> > As Paul is on holidays, please take it.
> 
> OK.
> 
> > The PS3 storage driver core support is
> > already in mainline, but the actual drivers aren't, as Paul was waiting for
> > acks from the maintainers.
> > 
> > BTW, do you prefer incremental patches for the comments below, or an update 
> > of
> > the full patchset?
> 
> Incremental is preferred, but I convert replacement patches into
> incremental patches at about 10Hz nowadays.  Whatever's easier.
> 
> (Actually, if it's a replacement patch then only I get to see the
> incremental patch, and the incremental patch is more reviewer-friendly).

Here are the updates:
  [1] ps3disk: use correct bio vector size
  [2] ps3disk: updates after final review
  [3] ps3rom: updates after final review
  [4] ps3flash: updates after final review

The first one is the bugfix for O_DIRECT, the other 3 patches are the updates
in response to your review.

Thanks for integrating (and forwarding to Linus)!

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[patch 1/4] ps3disk: use correct bio vector size

2007-07-19 Thread Geert Uytterhoeven
ps3disk: use correct bio vector size

This fixes the O_DIRECT corruptions, as reported by Olaf Hering (triggered by
e.g. parted >= 1.8.0).

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
---
 drivers/block/ps3disk.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -108,7 +108,7 @@ static void ps3disk_scatter_gather(struc
__func__, __LINE__, i, bio_segments(bio),
bio_sectors(bio), sector);
bio_for_each_segment(bvec, bio, j) {
-   size = bio_cur_sectors(bio)*KERNEL_SECTOR_SIZE;
+   size = bvec->bv_len;
buf = __bio_kmap_atomic(bio, j, KM_IRQ0);
if (gather)
memcpy(dev->bounce_buf+offset, buf, size);

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[patch 2/4] ps3disk: updates after final review

2007-07-19 Thread Geert Uytterhoeven
ps3disk: updates after final review:
  o Kill KERNEL_SECTOR_SIZE, just hardcode `512' or `>> 9'
  o Kill confusing ps3disk_priv() macro, open code it instead
  o ps3disk_scatter_gather(): Kill unused variable  `sectors'
  o Introduce ps3disk_mask_mutex to protect ps3disk_mask
  o Minor coding style fixes not reported by checkpatch

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
---
 drivers/block/ps3disk.c |   44 +---
 1 files changed, 25 insertions(+), 19 deletions(-)

--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -33,8 +33,6 @@
 #define PS3DISK_MAX_DISKS  16
 #define PS3DISK_MINORS 16
 
-#define KERNEL_SECTOR_SIZE 512
-
 
 #define PS3DISK_NAME   "ps3d%c"
 
@@ -48,7 +46,6 @@ struct ps3disk_private {
u64 raw_capacity;
unsigned char model[ATA_ID_PROD_LEN+1];
 };
-#define ps3disk_priv(dev)  ((dev)->sbd.core.driver_data)
 
 
 #define LV1_STORAGE_SEND_ATA_COMMAND   (2)
@@ -93,7 +90,7 @@ static struct block_device_operations ps
 static void ps3disk_scatter_gather(struct ps3_storage_device *dev,
   struct request *req, int gather)
 {
-   unsigned int sectors = 0, offset = 0;
+   unsigned int offset = 0;
struct bio *bio;
sector_t sector;
struct bio_vec *bvec;
@@ -118,7 +115,6 @@ static void ps3disk_scatter_gather(struc
flush_kernel_dcache_page(bio_iovec_idx(bio, 
j)->bv_page);
__bio_kunmap_atomic(bio, KM_IRQ0);
}
-   sectors += bio_sectors(bio);
i++;
}
 }
@@ -126,7 +122,7 @@ static void ps3disk_scatter_gather(struc
 static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
 struct request *req)
 {
-   struct ps3disk_private *priv = ps3disk_priv(dev);
+   struct ps3disk_private *priv = dev->sbd.core.driver_data;
int write = rq_data_dir(req), res;
const char *op = write ? "write" : "read";
u64 start_sector, sectors;
@@ -135,6 +131,7 @@ static int ps3disk_submit_request_sg(str
 #ifdef DEBUG
unsigned int n = 0;
struct bio *bio;
+
rq_for_each_bio(bio, req)
n++;
dev_dbg(&dev->sbd.core,
@@ -143,8 +140,8 @@ static int ps3disk_submit_request_sg(str
req->hard_nr_sectors);
 #endif
 
-   start_sector = req->sector*priv->blocking_factor;
-   sectors = req->nr_sectors*priv->blocking_factor;
+   start_sector = req->sector * priv->blocking_factor;
+   sectors = req->nr_sectors * priv->blocking_factor;
dev_dbg(&dev->sbd.core, "%s:%u: %s %lu sectors starting at %lu\n",
__func__, __LINE__, op, sectors, start_sector);
 
@@ -173,7 +170,7 @@ static int ps3disk_submit_request_sg(str
 static int ps3disk_submit_flush_request(struct ps3_storage_device *dev,
struct request *req)
 {
-   struct ps3disk_private *priv = ps3disk_priv(dev);
+   struct ps3disk_private *priv = dev->sbd.core.driver_data;
u64 res;
 
dev_dbg(&dev->sbd.core, "%s:%u: flush request\n", __func__, __LINE__);
@@ -217,7 +214,7 @@ static void ps3disk_do_request(struct ps
 static void ps3disk_request(request_queue_t *q)
 {
struct ps3_storage_device *dev = q->queuedata;
-   struct ps3disk_private *priv = ps3disk_priv(dev);
+   struct ps3disk_private *priv = dev->sbd.core.driver_data;
 
if (priv->req) {
dev_dbg(&dev->sbd.core, "%s:%u busy\n", __func__, __LINE__);
@@ -250,7 +247,7 @@ static irqreturn_t ps3disk_interrupt(int
return IRQ_HANDLED;
}
 
-   priv = ps3disk_priv(dev);
+   priv = dev->sbd.core.driver_data;
req = priv->req;
if (!req) {
dev_dbg(&dev->sbd.core,
@@ -374,7 +371,7 @@ static void ata_id_c_string(const u16 *i
 
 static int ps3disk_identify(struct ps3_storage_device *dev)
 {
-   struct ps3disk_private *priv = ps3disk_priv(dev);
+   struct ps3disk_private *priv = dev->sbd.core.driver_data;
struct lv1_ata_cmnd_block ata_cmnd;
u16 *id = dev->bounce_buf;
u64 res;
@@ -439,6 +436,8 @@ static int ps3disk_issue_flush(request_q
 
 static unsigned long ps3disk_mask;
 
+static DEFINE_MUTEX(ps3disk_mask_mutex);
+
 static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev)
 {
struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
@@ -448,7 +447,7 @@ static int __devinit ps3disk_probe(struc
struct request_queue *queue;
struct gendisk *gendisk;
 
-   if (dev->blk_size < KERNEL_SECTOR_SIZE) {
+   if (dev->blk_size < 512) {
dev_err(&dev->sbd.core,
"%s:%u: cannot handle block size %lu\n", __func__,
__LINE__, dev->blk_size);
@@ -456,13 +455,16 @@ static int __devinit ps3disk_probe(struc
}
 
BUILD_BUG_ON(

[patch 3/4] ps3rom: updates after final review

2007-07-19 Thread Geert Uytterhoeven
ps3rom: updates after final review:
  o Kill confusing ps3rom_priv() macro, open code it instead
  o kmap_atomic() cannot fail

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
---
 drivers/scsi/ps3rom.c |   15 +--
 1 files changed, 5 insertions(+), 10 deletions(-)

--- a/drivers/scsi/ps3rom.c
+++ b/drivers/scsi/ps3rom.c
@@ -42,7 +42,6 @@ struct ps3rom_private {
struct ps3_storage_device *dev;
struct scsi_cmnd *curr_cmd;
 };
-#define ps3rom_priv(dev)   ((dev)->sbd.core.driver_data)
 
 
 #define LV1_STORAGE_SEND_ATAPI_COMMAND (1)
@@ -113,8 +112,6 @@ static int fill_from_dev_buffer(struct s
for (k = 0, req_len = 0, act_len = 0; k < cmd->use_sg; ++k, ++sgpnt) {
if (active) {
kaddr = kmap_atomic(sgpnt->page, KM_IRQ0);
-   if (!kaddr)
-   return -1;
len = sgpnt->length;
if ((req_len + len) > buflen) {
active = 0;
@@ -151,8 +148,6 @@ static int fetch_to_dev_buffer(struct sc
sgpnt = cmd->request_buffer;
for (k = 0, req_len = 0, fin = 0; k < cmd->use_sg; ++k, ++sgpnt) {
kaddr = kmap_atomic(sgpnt->page, KM_IRQ0);
-   if (!kaddr)
-   return -1;
len = sgpnt->length;
if ((req_len + len) > buflen) {
len = buflen - req_len;
@@ -379,7 +374,7 @@ static irqreturn_t ps3rom_interrupt(int 
return IRQ_HANDLED;
}
 
-   host = ps3rom_priv(dev);
+   host = dev->sbd.core.driver_data;
priv = shost_priv(host);
cmd = priv->curr_cmd;
 
@@ -469,7 +464,7 @@ static int __devinit ps3rom_probe(struct
}
 
priv = shost_priv(host);
-   ps3rom_priv(dev) = host;
+   dev->sbd.core.driver_data = host;
priv->dev = dev;
 
/* One device/LUN per SCSI bus */
@@ -489,7 +484,7 @@ static int __devinit ps3rom_probe(struct
 
 fail_host_put:
scsi_host_put(host);
-   ps3rom_priv(dev) = NULL;
+   dev->sbd.core.driver_data = NULL;
 fail_teardown:
ps3stor_teardown(dev);
 fail_free_bounce:
@@ -500,12 +495,12 @@ fail_free_bounce:
 static int ps3rom_remove(struct ps3_system_bus_device *_dev)
 {
struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
-   struct Scsi_Host *host = ps3rom_priv(dev);
+   struct Scsi_Host *host = dev->sbd.core.driver_data;
 
scsi_remove_host(host);
ps3stor_teardown(dev);
scsi_host_put(host);
-   ps3rom_priv(dev) = NULL;
+   dev->sbd.core.driver_data = NULL;
kfree(dev->bounce_buf);
return 0;
 }

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[patch 4/4] ps3flash: updates after final review

2007-07-19 Thread Geert Uytterhoeven
ps3flash: updates after final review:
  o Kill confusing ps3flash_priv() macro, open code it instead
  o ps3flash_llseek(): Add missing locking (using i_mutex)
  o Replace do_div_llr() by `/' and `%'
  o ps3flash_read(): Use a common return for the error path
  o Minor coding style fixes not reported by checkpatch

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
---
 drivers/char/ps3flash.c |   59 
 1 files changed, 35 insertions(+), 24 deletions(-)

--- a/drivers/char/ps3flash.c
+++ b/drivers/char/ps3flash.c
@@ -34,7 +34,6 @@
 struct ps3flash_private {
struct mutex mutex; /* Bounce buffer mutex */
 };
-#define ps3flash_priv(dev) ((dev)->sbd.core.driver_data)
 
 static struct ps3_storage_device *ps3flash_dev;
 
@@ -81,28 +80,35 @@ static ssize_t ps3flash_write_chunk(stru
 static loff_t ps3flash_llseek(struct file *file, loff_t offset, int origin)
 {
struct ps3_storage_device *dev = ps3flash_dev;
-   u64 size = dev->regions[dev->region_idx].size*dev->blk_size;
+   loff_t res;
 
+   mutex_lock(&file->f_mapping->host->i_mutex);
switch (origin) {
case 1:
offset += file->f_pos;
break;
case 2:
-   offset += size;
+   offset += dev->regions[dev->region_idx].size*dev->blk_size;
break;
}
-   if (offset < 0)
-   return -EINVAL;
+   if (offset < 0) {
+   res = -EINVAL;
+   goto out;
+   }
 
file->f_pos = offset;
-   return file->f_pos;
+   res = file->f_pos;
+
+out:
+   mutex_unlock(&file->f_mapping->host->i_mutex);
+   return res;
 }
 
 static ssize_t ps3flash_read(struct file *file, char __user *buf, size_t count,
 loff_t *pos)
 {
struct ps3_storage_device *dev = ps3flash_dev;
-   struct ps3flash_private *priv = ps3flash_priv(dev);
+   struct ps3flash_private *priv = dev->sbd.core.driver_data;
u64 size, start_sector, end_sector, offset;
ssize_t sectors_read;
size_t remaining, n;
@@ -115,15 +121,16 @@ static ssize_t ps3flash_read(struct file
if (*pos >= size || !count)
return 0;
 
-   if (*pos+count > size) {
+   if (*pos + count > size) {
dev_dbg(&dev->sbd.core,
"%s:%u Truncating count from %zu to %llu\n", __func__,
__LINE__, count, size - *pos);
count = size - *pos;
}
 
-   start_sector = do_div_llr(*pos, dev->blk_size, &offset);
-   end_sector = DIV_ROUND_UP(*pos+count, dev->blk_size);
+   start_sector = *pos / dev->blk_size;
+   offset = *pos % dev->blk_size;
+   end_sector = DIV_ROUND_UP(*pos + count, dev->blk_size);
 
remaining = count;
do {
@@ -134,7 +141,7 @@ static ssize_t ps3flash_read(struct file
 0);
if (sectors_read < 0) {
mutex_unlock(&priv->mutex);
-   return sectors_read;
+   goto fail;
}
 
n = min(remaining, sectors_read*dev->blk_size-offset);
@@ -143,7 +150,8 @@ static ssize_t ps3flash_read(struct file
__func__, __LINE__, n, dev->bounce_buf+offset, buf);
if (copy_to_user(buf, dev->bounce_buf+offset, n)) {
mutex_unlock(&priv->mutex);
-   return -EFAULT;
+   sectors_read = -EFAULT;
+   goto fail;
}
 
mutex_unlock(&priv->mutex);
@@ -156,13 +164,16 @@ static ssize_t ps3flash_read(struct file
} while (remaining > 0);
 
return count;
+
+fail:
+   return sectors_read;
 }
 
 static ssize_t ps3flash_write(struct file *file, const char __user *buf,
  size_t count, loff_t *pos)
 {
struct ps3_storage_device *dev = ps3flash_dev;
-   struct ps3flash_private *priv = ps3flash_priv(dev);
+   struct ps3flash_private *priv = dev->sbd.core.driver_data;
u64 size, chunk_sectors, start_write_sector, end_write_sector,
end_read_sector, start_read_sector, head, tail, offset;
ssize_t res;
@@ -177,7 +188,7 @@ static ssize_t ps3flash_write(struct fil
if (*pos >= size || !count)
return 0;
 
-   if (*pos+count > size) {
+   if (*pos + count > size) {
dev_dbg(&dev->sbd.core,
"%s:%u Truncating count from %zu to %llu\n", __func__,
__LINE__, count, size - *pos);
@@ -186,13 +197,13 @@ static ssize_t ps3flash_write(struct fil
 
chunk_sectors = dev->bounce_size / dev->blk_size;
 
-   start_write_sector = do_div_llr(*pos, dev->bounce_size, &offset) *
-chunk_sectors;
-   end_write_sector = DIV_ROUND_UP(*pos+count, d

Re: [PATCH 49/61] 8xx: Update device trees.

2007-07-19 Thread Segher Boessenkool
> - d-cache-line-size = <20>;   // 32 bytes
> - i-cache-line-size = <20>;   // 32 bytes
> - d-cache-size = <2000>;  // L1, 8K
> - i-cache-size = <4000>;  // L1, 16K
> + d-cache-line-size = ;
> + i-cache-line-size = ;
> + d-cache-size = ;
> + i-cache-size = ;

IMHO this isn't an improvement, but it's your tree :-)
You removed the comment that those caches are L1; is
there an L2 cache on this CPU?

> - mpc8xx_pic: [EMAIL PROTECTED] {
> + PIC: [EMAIL PROTECTED] {

[EMAIL PROTECTED]

> - cpm_pic: [EMAIL PROTECTED] {
> + CPM_PIC: [EMAIL PROTECTED] {

similar

> + compatible = "fsl,mpc866-smc-uart",
> +  "fsl,cpm1-smc-uart",
> +  "fsl,cpm1-uart",
> +  "fsl,cpm-smc-uart",
> +  "fsl,cpm-uart";

Do you need _all_ of these?  :-)

> + fsl,cpm-brg = <1>;
> + fsl,cpm-command = <0090>;

Are these two documented?  Your patch queue is too
long for me to check for myself.

> - [EMAIL PROTECTED] {
> + [EMAIL PROTECTED] {

Maybe use a more generic name, I have no idea what a
"BCSR" is.

Good improvements over all, thank you!


Segher

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


Re: [PATCH 53/61] 82xx: Set NOT_COHERENT_CACHE on 8272 with PCI.

2007-07-19 Thread Segher Boessenkool
> I've seen significant network corruption on a PCI network
> card (e1000) with the mpc8272ads; the corruption went away
> when I set CONFIG_NOT_COHERENT_CACHE.

That doesn't mean it's the correct fix.  Any idea what the
root cause is?

If you want this patch as a workaround, please document it
in the source code.


Segher

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


Re: [PATCH 30/61] fsl_soc: Update the way get_brgfreq() finds things in the device tree.

2007-07-19 Thread Kumar Gala

On Jul 18, 2007, at 11:32 AM, Scott Wood wrote:

> Kumar Gala wrote:
>>> diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/  
>>> boot/dts/mpc8272ads.dts
>>> index 4d09dca..16a77f4 100644
>>> --- a/arch/powerpc/boot/dts/mpc8272ads.dts
>>> +++ b/arch/powerpc/boot/dts/mpc8272ads.dts
>>> @@ -119,12 +119,11 @@
>>>  #address-cells = <1>;
>>>  #size-cells = <1>;
>>>  #interrupt-cells = <2>;
>>> -device_type = "cpm";
>>> -model = "CPM2";
>>> +compatible = "fsl,mpc8272-cpm", "fsl,cpm2", "fsl,cpm";
>> Does 'fsl,cpm' really mean anything useful?
>
> Yes.  It's can't be used on its own to show the complete  
> programming model, but there are lots of common things that it does  
> indicate.
>
> get_brgfreq() uses it to locate nodes which have an fsl,brg- 
> frequency property.

I think we should introduce 'fsl,cpm' in a second pass once its clear  
what all the common points are.  We can than also see if QE fits into  
it at that point.

>
>>>  ranges = <  2>;
>>>  reg = <0 2>;
>>>  command-proc = <119c0>;
>>> -brg-frequency = <17D7840>;
>>> +fsl,brg-frequency = ;
>> Leave brg-frequency, and make a note about it being deprecated.
>
> The CPM binding is changed in so many other ways that are much  
> harder to make backward compatible that I don't really see much  
> point in doing so here.

Can you enumerate some of the other changes.

>> Also, take a look at QE it has a similar concept.
>
> It'd be nice to extend this binding to include QE (and at some  
> point down the road, merge the code)...  I just didn't have time  
> this time around.

Understand.

As I stated above, I think we should drop 'fsl,cpm' for now until we  
can come up with a good defn. of what it means rather than a  
convenience to mean (fsl-cpm2 and fsl-cpm1).

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


Re: [PATCH 53/61] 82xx: Set NOT_COHERENT_CACHE on 8272 with PCI.

2007-07-19 Thread Kumar Gala

On Jul 18, 2007, at 3:08 PM, Scott Wood wrote:

> Kumar Gala wrote:
>> On Jul 17, 2007, at 10:28 PM, David Gibson wrote:
>>> Hrm... I for one would be a lot more comfortable with this patch if
>>> you had a theoretical explanation for why it's necessary, in  
>>> addition
>>> to the "seems to fix things".
>
> Sure, so would I; I just wanted to point out the issue, and make  
> available a quick fix for anyone else that might be having problems.
>
> My theoretical explanation is that the hardware is broken. :-P
>
>> I agree w/David.  Have you tried turning on the   
>> CPU_FTR_NEED_COHERENT?  Take a look at include/asm-powerpc/ 
>> cputable.h  and search for the reference to CONFIG_PPC_83xx.
>
> OK, that appears to work as well.

Can you dump the POCMRx registers and report their values and what / 
proc/iomem looks like.

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


Re: [PATCH 56/61] 82xx: Add pq2fads board support.

2007-07-19 Thread Scott Wood
Arnd Bergmann wrote:
> On Wednesday 18 July 2007, Scott Wood wrote:
> 
>>+static void __init pq2fads_setup_arch(void)
>>+{
>>+ struct device_node *np;
>>+ struct resource r;
>>+ u32 *bcsr;
> 
> 
> bcsr should be __iomem, right?

Oops, yes.

> Did you run your code through sparse?

No, installing sparse is still on my to-do list.  I guess I should raise 
its priority. :-)

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


Re: [PATCH 04/61] 8xx: Work around CPU15 erratum.

2007-07-19 Thread Segher Boessenkool
> The CPU15 erratum on MPC8xx chips can cause incorrect code execution
> under certain circumstances, where there is a conditional or indirect
> branch in the last word of a page, with a target in the last cache  
> line
> of the next page.  This patch implements one of the suggested
> workarounds, by forcing a TLB miss whenever execution crosses a page
> boundary.  This is done by invalidating the pages before and after the
> one being loaded into the TLB in the ITLB miss handler.

So you never found a bug workaround without the terrible
overhead of this one?  A shame :-(


Segher

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


Re: [PATCH 37/61] cpm2: Rework 8272ads initialization, and eliminate init_fcc_ioports().

2007-07-19 Thread Scott Wood
Arnd Bergmann wrote:
> On Wednesday 18 July 2007, Scott Wood wrote:
> 
>>+static struct cpm_pin mpc8272ads_pins[] = {
>>+   /* SCC1 */
>>+   {3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
>>+   {3, 31, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
>>+
>>+   /* SCC4 */
>>+   {3, 21, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
>>+   {3, 22, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
>>+
>>+   /* FCC1 */
>>+   {0, 14, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
>>+   {0, 15, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
>>+   {0, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
>>+   {0, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
> 
> 
> I guess you considered moving such tables into the device tree at some point,
> which doesn't seem that difficult at all to an ignorant reviewer like me.
> 
> What's the reasoning for putting it into the platform code after all?

Ideally, this would be done by u-boot, and neither the kernel nor the 
device tree would need to care.  However, u-boot's setting up of the 
pins was lacking on all of the boards I tested on, so I had to fix it up 
in the platform code.

I considered putting it in the device tree as the qe code does; if there 
are many boards like these that need the kernel to set up the pins, it 
may be worthwhile.  We just need to come up with a good binding (e.g. no 
using arbitrary enums defined in the kernel).

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


Re: [PATCH 01/10] IB/ehca: Support for multiple event queues

2007-07-19 Thread Hoang-Nam Nguyen
Roland Dreier <[EMAIL PROTECTED]> wrote on 17.07.2007 19:52:55:
> At a higher level, I'm left wondering why nobody talked about multiple
> EQs during the last months of the 2.6.22 process and now all of a
> sudden it becomes urgent in the last few days of the 2.6.23 merge
> window.  That's not really how I like to merge features
OK, let keep multiple eqs for next release with a more stable
verbs def.
For the other patch to support MR with large pages we'll resend
it (without deps on multiple eqs patch) to you soon.
Regards
Nam

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


Re: [PATCH 17/61] bootwrapper: Add 8xx support.

2007-07-19 Thread Scott Wood
David Gibson wrote:
> On Wed, Jul 18, 2007 at 11:13:05AM -0500, Scott Wood wrote:
>>Well, no.  Even on a given board, it depends on the version of u-boot.
>>
>>There's nothing after enet1addr that the bootwrapper cares about, 
>>though, so the only harm is if the device tree has a second network 
>>interface but u-boot doesn't know about it, and the bootwrapper ends up 
>>pulling in junk rather than leaving zeroes.
> 
> 
> That sounds like a terribly fragile way of handling things.

Yes, but that's inherent in the way the bd_t is defined.  The robust way 
is to get device tree support into u-boot.

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


Re: [PATCH 38/61] cpm2: Update device trees.

2007-07-19 Thread Segher Boessenkool
>> + "fsl,cpm-uart";
>>  reg = <11a00 20 8000 100>;
>> -current-speed = <1c200>;
> Hmm, how is it supposed to work without speed? I was testing my u- 
> boot OF bindings for 82xx and spotted into it.

"current-speed" cannot be a required property for serial
devices (it is only valid if the device is active at boot
time).


Segher

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


Re: [PATCH 30/61] fsl_soc: Update the way get_brgfreq() finds things in the device tree.

2007-07-19 Thread Segher Boessenkool
>>> -device_type = "cpm";
>>> -model = "CPM2";
>>> +compatible = "fsl,mpc8272-cpm", "fsl,cpm2", "fsl,cpm";
>>
>> Does 'fsl,cpm' really mean anything useful?
>
> Yes.  It's can't be used on its own to show the complete programming
> model,

So please remove it.

> but there are lots of common things that it does indicate.

These common things can be detected differently; if all else
fails, just look for a few different "compatible" entries.

> The CPM binding is changed in so many other ways that are much  
> harder to
> make backward compatible that I don't really see much point in  
> doing so
> here.
>
>> Also, take a look at QE it has a similar concept.
>
> It'd be nice to extend this binding to include QE (and at some point
> down the road, merge the code)...  I just didn't have time this  
> time around.

If you think you'll have to seriously revise the binding again,
please mark that clearly in the documentation (there _is_
documentation, right?), so no one can complain if you break
compatibility later.


Segher

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


Do we need to reset the master branch?

2007-07-19 Thread Mark A. Greer
Hi Paul,

I did a git-pull this morning but it had a conflict.  Should I have
reset it to something?

Thanks,

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


[PATCH 01/12] Split out common parts of prom.h

2007-07-19 Thread Stephen Rothwell
This creates linux/of.h and includes asm/prom.h from it.

We also include linux/of.h from asm/prom.h while we transition.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 include/asm-powerpc/prom.h |   43 --
 include/asm-sparc/prom.h   |   46 
 include/asm-sparc64/prom.h |   46 
 include/linux/of.h |   61 
 4 files changed, 79 insertions(+), 117 deletions(-)
 create mode 100644 include/linux/of.h

I intend to ask Linus to pull this series in the next day or so as David
appears quite anxious that they get merged, so this is "Last call,
gentlemen".  :-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 1632baa..1134aea 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -97,10 +97,6 @@ struct device_node {
 
 extern struct device_node *of_chosen;
 
-/* flag descriptions */
-#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
-#define OF_DETACHED2 /* node has been detached from the device tree */
-
 static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
 {
return test_bit(flag, &n->_flags);
@@ -120,31 +116,7 @@ static inline void set_node_proc_entry(struct device_node 
*dn, struct proc_dir_e
 }
 
 
-/* New style node lookup */
-extern struct device_node *of_find_node_by_name(struct device_node *from,
-   const char *name);
-#define for_each_node_by_name(dn, name) \
-   for (dn = of_find_node_by_name(NULL, name); dn; \
-dn = of_find_node_by_name(dn, name))
-extern struct device_node *of_find_node_by_type(struct device_node *from,
-   const char *type);
-#define for_each_node_by_type(dn, type) \
-   for (dn = of_find_node_by_type(NULL, type); dn; \
-dn = of_find_node_by_type(dn, type))
-extern struct device_node *of_find_compatible_node(struct device_node *from,
-   const char *type, const char *compat);
-#define for_each_compatible_node(dn, type, compatible) \
-   for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
-dn = of_find_compatible_node(dn, type, compatible))
-extern struct device_node *of_find_node_by_path(const char *path);
-extern struct device_node *of_find_node_by_phandle(phandle handle);
 extern struct device_node *of_find_all_nodes(struct device_node *prev);
-extern struct device_node *of_get_parent(const struct device_node *node);
-extern struct device_node *of_get_next_child(const struct device_node *node,
-struct device_node *prev);
-extern struct property *of_find_property(const struct device_node *np,
-const char *name,
-int *lenp);
 extern struct device_node *of_node_get(struct device_node *node);
 extern void of_node_put(struct device_node *node);
 
@@ -166,17 +138,9 @@ extern void of_detach_node(const struct device_node *);
 extern void finish_device_tree(void);
 extern void unflatten_device_tree(void);
 extern void early_init_devtree(void *);
-extern int of_device_is_compatible(const struct device_node *device,
-   const char *);
 #define device_is_compatible(d, c) of_device_is_compatible((d), (c))
 extern int machine_is_compatible(const char *compat);
-extern const void *of_get_property(const struct device_node *node,
-   const char *name,
-   int *lenp);
-#define get_property(a, b, c)  of_get_property((a), (b), (c))
 extern void print_properties(struct device_node *node);
-extern int of_n_addr_cells(struct device_node* np);
-extern int of_n_size_cells(struct device_node* np);
 extern int prom_n_intr_cells(struct device_node* np);
 extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
 extern int prom_add_property(struct device_node* np, struct property* prop);
@@ -230,7 +194,6 @@ static inline unsigned long of_read_ulong(const u32 *cell, 
int size)
 
 /* Translate an OF address block into a CPU physical address
  */
-#define OF_BAD_ADDR((u64)-1)
 extern u64 of_translate_address(struct device_node *np, const u32 *addr);
 
 /* Extract an address from a device, returns the region size and
@@ -357,5 +320,11 @@ extern int of_irq_to_resource(struct device_node *dev, int 
index,
  */
 extern void __iomem *of_iomap(struct device_node *device, int index);
 
+/*
+ * NB:  This is here while we transition from using asm/prom.h
+ * to linux/of.h
+ */
+#include 
+
 #endif /* __KERNEL__ */
 #endif /* _POWERPC_PROM_H */
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index 9ea105e..d67af08 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -2,7 +2,6 @@
 #define _SPARC_PROM_H
 #ifdef __KERNEL__
 
-
 /*
  * Definitions for talking to t

[PATCH 02/12] Start split out of common open firmware code

2007-07-19 Thread Stephen Rothwell
This creates drivers/of/base.c (depending on CONFIG_OF) and puts
the first trivially common bits from the prom.c files into it.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/Kconfig   |3 ++
 arch/powerpc/kernel/prom.c |   41 ---
 arch/sparc/Kconfig |3 ++
 arch/sparc/kernel/prom.c   |   42 
 arch/sparc64/Kconfig   |3 ++
 arch/sparc64/kernel/prom.c |   42 
 drivers/Makefile   |1 +
 drivers/of/Makefile|1 +
 drivers/of/base.c  |   65 
 include/asm-powerpc/prom.h |3 ++
 include/asm-sparc/prom.h   |3 ++
 include/asm-sparc64/prom.h |3 ++
 12 files changed, 85 insertions(+), 125 deletions(-)
 create mode 100644 drivers/of/Makefile
 create mode 100644 drivers/of/base.c

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index d860b64..853c282 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -92,6 +92,9 @@ config ARCH_MAY_HAVE_PC_FDC
 config PPC_OF
def_bool y
 
+config OF
+   def_bool y
+
 config PPC_UDBG_16550
bool
default n
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 37ff99b..6c9419a 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1056,35 +1056,6 @@ void __init early_init_devtree(void *params)
DBG(" <- early_init_devtree()\n");
 }
 
-int of_n_addr_cells(struct device_node* np)
-{
-   const int *ip;
-   do {
-   if (np->parent)
-   np = np->parent;
-   ip = of_get_property(np, "#address-cells", NULL);
-   if (ip != NULL)
-   return *ip;
-   } while (np->parent);
-   /* No #address-cells property for the root node, default to 1 */
-   return 1;
-}
-EXPORT_SYMBOL(of_n_addr_cells);
-
-int of_n_size_cells(struct device_node* np)
-{
-   const int* ip;
-   do {
-   if (np->parent)
-   np = np->parent;
-   ip = of_get_property(np, "#size-cells", NULL);
-   if (ip != NULL)
-   return *ip;
-   } while (np->parent);
-   /* No #size-cells property for the root node, default to 1 */
-   return 1;
-}
-EXPORT_SYMBOL(of_n_size_cells);
 
 /** Checks if the given "compat" string matches one of the strings in
  * the device's "compatible" property
@@ -1563,18 +1534,6 @@ struct property *of_find_property(const struct 
device_node *np,
 EXPORT_SYMBOL(of_find_property);
 
 /*
- * Find a property with a given name for a given node
- * and return the value.
- */
-const void *of_get_property(const struct device_node *np, const char *name,
-int *lenp)
-{
-   struct property *pp = of_find_property(np,name,lenp);
-   return pp ? pp->value : NULL;
-}
-EXPORT_SYMBOL(of_get_property);
-
-/*
  * Add a property to a node
  */
 int prom_add_property(struct device_node* np, struct property* prop)
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 73df711..de98411 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -21,6 +21,9 @@ config GENERIC_ISA_DMA
bool
default y
 
+config OF
+   def_bool y
+
 source "init/Kconfig"
 
 menu "General machine setup"
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index eed140b..ac3f3c2 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -168,18 +168,6 @@ struct property *of_find_property(const struct device_node 
*np,
 }
 EXPORT_SYMBOL(of_find_property);
 
-/*
- * Find a property with a given name for a given node
- * and return the value.
- */
-const void *of_get_property(const struct device_node *np, const char *name,
-   int *lenp)
-{
-   struct property *pp = of_find_property(np,name,lenp);
-   return pp ? pp->value : NULL;
-}
-EXPORT_SYMBOL(of_get_property);
-
 int of_getintprop_default(struct device_node *np, const char *name, int def)
 {
struct property *prop;
@@ -193,36 +181,6 @@ int of_getintprop_default(struct device_node *np, const 
char *name, int def)
 }
 EXPORT_SYMBOL(of_getintprop_default);
 
-int of_n_addr_cells(struct device_node *np)
-{
-   const int* ip;
-   do {
-   if (np->parent)
-   np = np->parent;
-   ip = of_get_property(np, "#address-cells", NULL);
-   if (ip != NULL)
-   return *ip;
-   } while (np->parent);
-   /* No #address-cells property for the root node, default to 2 */
-   return 2;
-}
-EXPORT_SYMBOL(of_n_addr_cells);
-
-int of_n_size_cells(struct device_node *np)
-{
-   const int* ip;
-   do {
-   if (np->parent)
-   np = np->parent;
-   ip = of_get_property(np, "#size-cells", NULL);
-   if (ip 

[PATCH 03/12] Consolidate of_device_is_compatible

2007-07-19 Thread Stephen Rothwell
The only difference here is that Sparc uses strncmp to match compatibility
names while PowerPC uses strncasecmp.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/prom.c |   25 -
 arch/sparc/kernel/prom.c   |   21 -
 arch/sparc64/kernel/prom.c |   21 -
 drivers/of/base.c  |   24 
 include/asm-powerpc/prom.h |2 ++
 include/asm-sparc/prom.h   |2 ++
 include/asm-sparc64/prom.h |2 ++
 7 files changed, 30 insertions(+), 67 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 6c9419a..c009d21 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1057,31 +1057,6 @@ void __init early_init_devtree(void *params)
 }
 
 
-/** Checks if the given "compat" string matches one of the strings in
- * the device's "compatible" property
- */
-int of_device_is_compatible(const struct device_node *device,
-   const char *compat)
-{
-   const char* cp;
-   int cplen, l;
-
-   cp = of_get_property(device, "compatible", &cplen);
-   if (cp == NULL)
-   return 0;
-   while (cplen > 0) {
-   if (strncasecmp(cp, compat, strlen(compat)) == 0)
-   return 1;
-   l = strlen(cp) + 1;
-   cp += l;
-   cplen -= l;
-   }
-
-   return 0;
-}
-EXPORT_SYMBOL(of_device_is_compatible);
-
-
 /**
  * Indicates whether the root node has a given value in its
  * compatible property.
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index ac3f3c2..f2ce0d4 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -32,27 +32,6 @@ static struct device_node *allnodes;
  */
 static DEFINE_RWLOCK(devtree_lock);
 
-int of_device_is_compatible(const struct device_node *device,
-   const char *compat)
-{
-   const char* cp;
-   int cplen, l;
-
-   cp = of_get_property(device, "compatible", &cplen);
-   if (cp == NULL)
-   return 0;
-   while (cplen > 0) {
-   if (strncmp(cp, compat, strlen(compat)) == 0)
-   return 1;
-   l = strlen(cp) + 1;
-   cp += l;
-   cplen -= l;
-   }
-
-   return 0;
-}
-EXPORT_SYMBOL(of_device_is_compatible);
-
 struct device_node *of_get_parent(const struct device_node *node)
 {
struct device_node *np;
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index 8f926d4..4d6fb07 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -37,27 +37,6 @@ static struct device_node *allnodes;
  */
 static DEFINE_RWLOCK(devtree_lock);
 
-int of_device_is_compatible(const struct device_node *device,
-   const char *compat)
-{
-   const char* cp;
-   int cplen, l;
-
-   cp = of_get_property(device, "compatible", &cplen);
-   if (cp == NULL)
-   return 0;
-   while (cplen > 0) {
-   if (strncmp(cp, compat, strlen(compat)) == 0)
-   return 1;
-   l = strlen(cp) + 1;
-   cp += l;
-   cplen -= l;
-   }
-
-   return 0;
-}
-EXPORT_SYMBOL(of_device_is_compatible);
-
 struct device_node *of_get_parent(const struct device_node *node)
 {
struct device_node *np;
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 723d80d..d6dc5e7 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -63,3 +63,27 @@ const void *of_get_property(const struct device_node *np, 
const char *name,
return pp ? pp->value : NULL;
 }
 EXPORT_SYMBOL(of_get_property);
+
+/** Checks if the given "compat" string matches one of the strings in
+ * the device's "compatible" property
+ */
+int of_device_is_compatible(const struct device_node *device,
+   const char *compat)
+{
+   const char* cp;
+   int cplen, l;
+
+   cp = of_get_property(device, "compatible", &cplen);
+   if (cp == NULL)
+   return 0;
+   while (cplen > 0) {
+   if (of_compat_cmp(cp, compat, strlen(compat)) == 0)
+   return 1;
+   l = strlen(cp) + 1;
+   cp += l;
+   cplen -= l;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(of_device_is_compatible);
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 9fe0152..b05f8f2 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -24,6 +24,8 @@
 #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT1
 #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT1
 
+#define of_compat_cmp(s1, s2, l)   strncasecmp((s1), (s2), (l))
+
 /* Definitions used by the flattened device tree */
 #define OF_DT_HEADER   0xd00dfeed  /* marker */
 #define OF_DT_BEGIN_NODE   0x1 /* Start of node, full n

[PATCH 04/12] Consolidate of_find_property

2007-07-19 Thread Stephen Rothwell
The only change here is that a readlock is taken while the property list
is being traversed on Sparc where it was not taken previously.

Also, Sparc uses strcasecmp to compare property names while PowerPC
uses strcmp.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/prom.c |   24 +---
 arch/sparc/kernel/prom.c   |   22 +-
 arch/sparc64/kernel/prom.c |   22 +-
 drivers/of/base.c  |   26 ++
 include/asm-powerpc/prom.h |1 +
 include/asm-sparc/prom.h   |1 +
 include/asm-sparc64/prom.h |1 +
 7 files changed, 32 insertions(+), 65 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index c009d21..3f6238d 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -80,10 +80,7 @@ struct boot_param_header *initial_boot_params;
 
 static struct device_node *allnodes = NULL;
 
-/* use when traversing tree through the allnext, child, sibling,
- * or parent members of struct device_node.
- */
-static DEFINE_RWLOCK(devtree_lock);
+extern rwlock_t devtree_lock;  /* temporary while merging */
 
 /* export that to outside world */
 struct device_node *of_chosen;
@@ -1489,25 +1486,6 @@ static int __init prom_reconfig_setup(void)
 __initcall(prom_reconfig_setup);
 #endif
 
-struct property *of_find_property(const struct device_node *np,
- const char *name,
- int *lenp)
-{
-   struct property *pp;
-
-   read_lock(&devtree_lock);
-   for (pp = np->properties; pp != 0; pp = pp->next)
-   if (strcmp(pp->name, name) == 0) {
-   if (lenp != 0)
-   *lenp = pp->length;
-   break;
-   }
-   read_unlock(&devtree_lock);
-
-   return pp;
-}
-EXPORT_SYMBOL(of_find_property);
-
 /*
  * Add a property to a node
  */
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index f2ce0d4..0f5aab4 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -27,10 +27,7 @@
 
 static struct device_node *allnodes;
 
-/* use when traversing tree through the allnext, child, sibling,
- * or parent members of struct device_node.
- */
-static DEFINE_RWLOCK(devtree_lock);
+extern rwlock_t devtree_lock;  /* temporary while merging */
 
 struct device_node *of_get_parent(const struct device_node *node)
 {
@@ -130,23 +127,6 @@ struct device_node *of_find_compatible_node(struct 
device_node *from,
 }
 EXPORT_SYMBOL(of_find_compatible_node);
 
-struct property *of_find_property(const struct device_node *np,
- const char *name,
- int *lenp)
-{
-   struct property *pp;
-
-   for (pp = np->properties; pp != 0; pp = pp->next) {
-   if (strcasecmp(pp->name, name) == 0) {
-   if (lenp != 0)
-   *lenp = pp->length;
-   break;
-   }
-   }
-   return pp;
-}
-EXPORT_SYMBOL(of_find_property);
-
 int of_getintprop_default(struct device_node *np, const char *name, int def)
 {
struct property *prop;
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index 4d6fb07..a1ccc00 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -32,10 +32,7 @@
 
 static struct device_node *allnodes;
 
-/* use when traversing tree through the allnext, child, sibling,
- * or parent members of struct device_node.
- */
-static DEFINE_RWLOCK(devtree_lock);
+extern rwlock_t devtree_lock;  /* temporary while merging */
 
 struct device_node *of_get_parent(const struct device_node *node)
 {
@@ -135,23 +132,6 @@ struct device_node *of_find_compatible_node(struct 
device_node *from,
 }
 EXPORT_SYMBOL(of_find_compatible_node);
 
-struct property *of_find_property(const struct device_node *np,
- const char *name,
- int *lenp)
-{
-   struct property *pp;
-
-   for (pp = np->properties; pp != 0; pp = pp->next) {
-   if (strcasecmp(pp->name, name) == 0) {
-   if (lenp != 0)
-   *lenp = pp->length;
-   break;
-   }
-   }
-   return pp;
-}
-EXPORT_SYMBOL(of_find_property);
-
 int of_getintprop_default(struct device_node *np, const char *name, int def)
 {
struct property *prop;
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d6dc5e7..70b6084 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -18,6 +18,12 @@
  */
 #include 
 #include 
+#include 
+
+/* use when traversing tree through the allnext, child, sibling,
+ * or parent members of struct device_node.
+ */
+DEFINE_RWLOCK(devtree_lock);
 
 int of_n_addr_cells(struct device_node *np)
 {
@@ -51,6 +57,26 @@ int of_

[PATCH 05/12] Consolidate of_get_parent

2007-07-19 Thread Stephen Rothwell
This requires creating dummy of_node_{get,put} routines for sparc and
sparc64.  It also adds a read_lock around the parent accesses.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/prom.c |   21 -
 arch/sparc/kernel/prom.c   |   13 -
 arch/sparc64/kernel/prom.c |   13 -
 drivers/of/base.c  |   21 +
 include/asm-sparc/prom.h   |9 +
 include/asm-sparc64/prom.h |9 +
 6 files changed, 39 insertions(+), 47 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 3f6238d..1ad56d3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1241,27 +1241,6 @@ struct device_node *of_find_all_nodes(struct device_node 
*prev)
 EXPORT_SYMBOL(of_find_all_nodes);
 
 /**
- * of_get_parent - Get a node's parent if any
- * @node:  Node to get parent
- *
- * Returns a node pointer with refcount incremented, use
- * of_node_put() on it when done.
- */
-struct device_node *of_get_parent(const struct device_node *node)
-{
-   struct device_node *np;
-
-   if (!node)
-   return NULL;
-
-   read_lock(&devtree_lock);
-   np = of_node_get(node->parent);
-   read_unlock(&devtree_lock);
-   return np;
-}
-EXPORT_SYMBOL(of_get_parent);
-
-/**
  * of_get_next_child - Iterate a node childs
  * @node:  parent node
  * @prev:  previous child of the parent node, or NULL to get first
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index 0f5aab4..b378715 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -29,19 +29,6 @@ static struct device_node *allnodes;
 
 extern rwlock_t devtree_lock;  /* temporary while merging */
 
-struct device_node *of_get_parent(const struct device_node *node)
-{
-   struct device_node *np;
-
-   if (!node)
-   return NULL;
-
-   np = node->parent;
-
-   return np;
-}
-EXPORT_SYMBOL(of_get_parent);
-
 struct device_node *of_get_next_child(const struct device_node *node,
struct device_node *prev)
 {
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index a1ccc00..2462731 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -34,19 +34,6 @@ static struct device_node *allnodes;
 
 extern rwlock_t devtree_lock;  /* temporary while merging */
 
-struct device_node *of_get_parent(const struct device_node *node)
-{
-   struct device_node *np;
-
-   if (!node)
-   return NULL;
-
-   np = node->parent;
-
-   return np;
-}
-EXPORT_SYMBOL(of_get_parent);
-
 struct device_node *of_get_next_child(const struct device_node *node,
struct device_node *prev)
 {
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 70b6084..82bb786 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -113,3 +113,24 @@ int of_device_is_compatible(const struct device_node 
*device,
return 0;
 }
 EXPORT_SYMBOL(of_device_is_compatible);
+
+/**
+ * of_get_parent - Get a node's parent if any
+ * @node:  Node to get parent
+ *
+ * Returns a node pointer with refcount incremented, use
+ * of_node_put() on it when done.
+ */
+struct device_node *of_get_parent(const struct device_node *node)
+{
+   struct device_node *np;
+
+   if (!node)
+   return NULL;
+
+   read_lock(&devtree_lock);
+   np = of_node_get(node->parent);
+   read_unlock(&devtree_lock);
+   return np;
+}
+EXPORT_SYMBOL(of_get_parent);
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index 57f86c8..c7d5495 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -69,6 +69,15 @@ extern int of_getintprop_default(struct device_node *np,
 
 extern void prom_build_devicetree(void);
 
+/* Dummy ref counting routines - to be implemented later */
+static inline struct device_node *of_node_get(struct device_node *node)
+{
+   return node;
+}
+static inline void of_node_put(struct device_node *node)
+{
+}
+
 /*
  * NB:  This is here while we transition from using asm/prom.h
  * to linux/of.h
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
index 6a5e240..e83896f 100644
--- a/include/asm-sparc64/prom.h
+++ b/include/asm-sparc64/prom.h
@@ -78,6 +78,15 @@ extern int of_getintprop_default(struct device_node *np,
 
 extern void prom_build_devicetree(void);
 
+/* Dummy ref counting routines - to be implemented later */
+static inline struct device_node *of_node_get(struct device_node *node)
+{
+   return node;
+}
+static inline void of_node_put(struct device_node *node)
+{
+}
+
 /*
  * NB:  This is here while we transition from using asm/prom.h
  * to linux/of.h
-- 
1.5.2.3

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


[PATCH 06/12] Consolidate of_get_next_child

2007-07-19 Thread Stephen Rothwell
This adds a read_lock around the child/next accesses on Sparc.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/prom.c |   24 
 arch/sparc/kernel/prom.c   |   14 --
 arch/sparc64/kernel/prom.c |   14 --
 drivers/of/base.c  |   24 
 4 files changed, 24 insertions(+), 52 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 1ad56d3..5fa221c 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1241,30 +1241,6 @@ struct device_node *of_find_all_nodes(struct device_node 
*prev)
 EXPORT_SYMBOL(of_find_all_nodes);
 
 /**
- * of_get_next_child - Iterate a node childs
- * @node:  parent node
- * @prev:  previous child of the parent node, or NULL to get first
- *
- * Returns a node pointer with refcount incremented, use
- * of_node_put() on it when done.
- */
-struct device_node *of_get_next_child(const struct device_node *node,
-   struct device_node *prev)
-{
-   struct device_node *next;
-
-   read_lock(&devtree_lock);
-   next = prev ? prev->sibling : node->child;
-   for (; next != 0; next = next->sibling)
-   if (of_node_get(next))
-   break;
-   of_node_put(prev);
-   read_unlock(&devtree_lock);
-   return next;
-}
-EXPORT_SYMBOL(of_get_next_child);
-
-/**
  * of_node_get - Increment refcount of a node
  * @node:  Node to inc refcount, NULL is supported to
  * simplify writing of callers
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index b378715..3f8ccfa 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -29,20 +29,6 @@ static struct device_node *allnodes;
 
 extern rwlock_t devtree_lock;  /* temporary while merging */
 
-struct device_node *of_get_next_child(const struct device_node *node,
-   struct device_node *prev)
-{
-   struct device_node *next;
-
-   next = prev ? prev->sibling : node->child;
-   for (; next != 0; next = next->sibling) {
-   break;
-   }
-
-   return next;
-}
-EXPORT_SYMBOL(of_get_next_child);
-
 struct device_node *of_find_node_by_path(const char *path)
 {
struct device_node *np = allnodes;
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index 2462731..ee96ef6 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -34,20 +34,6 @@ static struct device_node *allnodes;
 
 extern rwlock_t devtree_lock;  /* temporary while merging */
 
-struct device_node *of_get_next_child(const struct device_node *node,
-   struct device_node *prev)
-{
-   struct device_node *next;
-
-   next = prev ? prev->sibling : node->child;
-   for (; next != 0; next = next->sibling) {
-   break;
-   }
-
-   return next;
-}
-EXPORT_SYMBOL(of_get_next_child);
-
 struct device_node *of_find_node_by_path(const char *path)
 {
struct device_node *np = allnodes;
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 82bb786..6b6dfcc 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -134,3 +134,27 @@ struct device_node *of_get_parent(const struct device_node 
*node)
return np;
 }
 EXPORT_SYMBOL(of_get_parent);
+
+/**
+ * of_get_next_child - Iterate a node childs
+ * @node:  parent node
+ * @prev:  previous child of the parent node, or NULL to get first
+ *
+ * Returns a node pointer with refcount incremented, use
+ * of_node_put() on it when done.
+ */
+struct device_node *of_get_next_child(const struct device_node *node,
+   struct device_node *prev)
+{
+   struct device_node *next;
+
+   read_lock(&devtree_lock);
+   next = prev ? prev->sibling : node->child;
+   for (; next; next = next->sibling)
+   if (of_node_get(next))
+   break;
+   of_node_put(prev);
+   read_unlock(&devtree_lock);
+   return next;
+}
+EXPORT_SYMBOL(of_get_next_child);
-- 
1.5.2.3

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


[PATCH 07/12] Consolidate of_find_node_by routines

2007-07-19 Thread Stephen Rothwell
This consolidates the routines of_find_node_by_path, of_find_node_by_name,
of_find_node_by_type and of_find_compatible_device.  Again, the comparison
of strings are done differently by Sparc and PowerPC and also these add
read_locks around the iterations.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/prom.c |  115 +---
 arch/sparc/kernel/prom.c   |   61 +---
 arch/sparc64/kernel/prom.c |   61 +---
 drivers/of/base.c  |  115 
 include/asm-powerpc/prom.h |1 +
 include/asm-sparc/prom.h   |1 +
 include/asm-sparc64/prom.h |1 +
 7 files changed, 121 insertions(+), 234 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 5fa221c..bdcd23d 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -78,7 +78,7 @@ static struct boot_param_header *initial_boot_params 
__initdata;
 struct boot_param_header *initial_boot_params;
 #endif
 
-static struct device_node *allnodes = NULL;
+extern struct device_node *allnodes;   /* temporary while merging */
 
 extern rwlock_t devtree_lock;  /* temporary while merging */
 
@@ -1084,119 +1084,6 @@ EXPORT_SYMBOL(machine_is_compatible);
  ***/
 
 /**
- * of_find_node_by_name - Find a node by its "name" property
- * @from:  The node to start searching from or NULL, the node
- * you pass will not be searched, only the next one
- * will; typically, you pass what the previous call
- * returned. of_node_put() will be called on it
- * @name:  The name string to match against
- *
- * Returns a node pointer with refcount incremented, use
- * of_node_put() on it when done.
- */
-struct device_node *of_find_node_by_name(struct device_node *from,
-   const char *name)
-{
-   struct device_node *np;
-
-   read_lock(&devtree_lock);
-   np = from ? from->allnext : allnodes;
-   for (; np != NULL; np = np->allnext)
-   if (np->name != NULL && strcasecmp(np->name, name) == 0
-   && of_node_get(np))
-   break;
-   of_node_put(from);
-   read_unlock(&devtree_lock);
-   return np;
-}
-EXPORT_SYMBOL(of_find_node_by_name);
-
-/**
- * of_find_node_by_type - Find a node by its "device_type" property
- * @from:  The node to start searching from, or NULL to start searching
- * the entire device tree. The node you pass will not be
- * searched, only the next one will; typically, you pass
- * what the previous call returned. of_node_put() will be
- * called on from for you.
- * @type:  The type string to match against
- *
- * Returns a node pointer with refcount incremented, use
- * of_node_put() on it when done.
- */
-struct device_node *of_find_node_by_type(struct device_node *from,
-   const char *type)
-{
-   struct device_node *np;
-
-   read_lock(&devtree_lock);
-   np = from ? from->allnext : allnodes;
-   for (; np != 0; np = np->allnext)
-   if (np->type != 0 && strcasecmp(np->type, type) == 0
-   && of_node_get(np))
-   break;
-   of_node_put(from);
-   read_unlock(&devtree_lock);
-   return np;
-}
-EXPORT_SYMBOL(of_find_node_by_type);
-
-/**
- * of_find_compatible_node - Find a node based on type and one of the
- *tokens in its "compatible" property
- * @from:  The node to start searching from or NULL, the node
- * you pass will not be searched, only the next one
- * will; typically, you pass what the previous call
- * returned. of_node_put() will be called on it
- * @type:  The type string to match "device_type" or NULL to ignore
- * @compatible:The string to match to one of the tokens in the device
- * "compatible" list.
- *
- * Returns a node pointer with refcount incremented, use
- * of_node_put() on it when done.
- */
-struct device_node *of_find_compatible_node(struct device_node *from,
-   const char *type, const char *compatible)
-{
-   struct device_node *np;
-
-   read_lock(&devtree_lock);
-   np = from ? from->allnext : allnodes;
-   for (; np != 0; np = np->allnext) {
-   if (type != NULL
-   && !(np->type != 0 && strcasecmp(np->type, type) == 0))
-   continue;
-   if (of_device_is_compatible(np, compatible) && of_node_get(np))
-   break;
-   }
-   of_node_put(from);
-   read_unlock(&devtree_lock);
-   return np;
-}
-EXPORT_SYMBOL(of_find_compatible_node);
-
-/**
- * of_find_node_by_path - Find a node matching a full OF path
- * @path: 

[PATCH 08/12] Begin to consolidate of_device.c

2007-07-19 Thread Stephen Rothwell
This moves all the common parts for the Sparc, Sparc64 and PowerPC
of_device.c files into drivers/of/device.c.

Apart from the simple move, Sparc gains of_match_node() and a call to
of_node_put in of_release_dev().  PowerPC gains better recovery if
device_create_file() fails in of_device_register().

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/of_device.c |  122 +
 arch/sparc/kernel/of_device.c   |  109 +
 arch/sparc64/kernel/of_device.c |  114 +-
 drivers/Kconfig |2 +
 drivers/of/Kconfig  |3 +
 drivers/of/Makefile |1 +
 drivers/of/device.c |  131 +++
 7 files changed, 142 insertions(+), 340 deletions(-)
 create mode 100644 drivers/of/Kconfig
 create mode 100644 drivers/of/device.c

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index a464d67..89b911e 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -1,5 +1,6 @@
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -8,118 +9,6 @@
 #include 
 #include 
 
-/**
- * of_match_node - Tell if an device_node has a matching of_match structure
- * @ids: array of of device match structures to search in
- * @node: the of device structure to match against
- *
- * Low level utility function used by device matching.
- */
-const struct of_device_id *of_match_node(const struct of_device_id *matches,
-const struct device_node *node)
-{
-   while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
-   int match = 1;
-   if (matches->name[0])
-   match &= node->name
-   && !strcmp(matches->name, node->name);
-   if (matches->type[0])
-   match &= node->type
-   && !strcmp(matches->type, node->type);
-   if (matches->compatible[0])
-   match &= of_device_is_compatible(node,
- matches->compatible);
-   if (match)
-   return matches;
-   matches++;
-   }
-   return NULL;
-}
-
-/**
- * of_match_device - Tell if an of_device structure has a matching
- * of_match structure
- * @ids: array of of device match structures to search in
- * @dev: the of device structure to match against
- *
- * Used by a driver to check whether an of_device present in the
- * system is in its list of supported devices.
- */
-const struct of_device_id *of_match_device(const struct of_device_id *matches,
-   const struct of_device *dev)
-{
-   if (!dev->node)
-   return NULL;
-   return of_match_node(matches, dev->node);
-}
-
-struct of_device *of_dev_get(struct of_device *dev)
-{
-   struct device *tmp;
-
-   if (!dev)
-   return NULL;
-   tmp = get_device(&dev->dev);
-   if (tmp)
-   return to_of_device(tmp);
-   else
-   return NULL;
-}
-
-void of_dev_put(struct of_device *dev)
-{
-   if (dev)
-   put_device(&dev->dev);
-}
-
-static ssize_t dev_show_devspec(struct device *dev,
-   struct device_attribute *attr, char *buf)
-{
-   struct of_device *ofdev;
-
-   ofdev = to_of_device(dev);
-   return sprintf(buf, "%s", ofdev->node->full_name);
-}
-
-static DEVICE_ATTR(devspec, S_IRUGO, dev_show_devspec, NULL);
-
-/**
- * of_release_dev - free an of device structure when all users of it are 
finished.
- * @dev: device that's been disconnected
- *
- * Will be called only by the device core when all users of this of device are
- * done.
- */
-void of_release_dev(struct device *dev)
-{
-   struct of_device *ofdev;
-
-ofdev = to_of_device(dev);
-   of_node_put(ofdev->node);
-   kfree(ofdev);
-}
-
-int of_device_register(struct of_device *ofdev)
-{
-   int rc;
-
-   BUG_ON(ofdev->node == NULL);
-
-   rc = device_register(&ofdev->dev);
-   if (rc)
-   return rc;
-
-   return device_create_file(&ofdev->dev, &dev_attr_devspec);
-}
-
-void of_device_unregister(struct of_device *ofdev)
-{
-   device_remove_file(&ofdev->dev, &dev_attr_devspec);
-
-   device_unregister(&ofdev->dev);
-}
-
-
 ssize_t of_device_get_modalias(struct of_device *ofdev,
char *str, ssize_t len)
 {
@@ -229,14 +118,5 @@ int of_device_uevent(struct device *dev,
 
return 0;
 }
-
-
-EXPORT_SYMBOL(of_match_node);
-EXPORT_SYMBOL(of_match_device);
-EXPORT_SYMBOL(of_device_register);
-EXPORT_SYMBOL(of_device_unregister);
-EXPORT_SYMBOL(of_dev_get);
-EXPORT_SYMBOL(of_dev_put);
-EXPORT_SYMBOL(of_

[PATCH 09/12] Begin consolidation of of_device.h

2007-07-19 Thread Stephen Rothwell
This just moves the common stuff from the arch of_device.h files to
linux/of_device.h.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 drivers/of/device.c |2 +-
 include/asm-powerpc/of_device.h |   22 +-
 include/asm-sparc/of_device.h   |   15 ---
 include/asm-sparc64/of_device.h |   15 ---
 include/linux/of_device.h   |   26 ++
 5 files changed, 40 insertions(+), 40 deletions(-)
 create mode 100644 include/linux/of_device.h

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/drivers/of/device.c b/drivers/of/device.c
index 7f233d7..6245f06 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -1,13 +1,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
-#include 
 
 /**
  * of_match_node - Tell if an device_node has a matching of_match structure
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index e9af49e..ec2a8a2 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -3,14 +3,12 @@
 #ifdef __KERNEL__
 
 #include 
-#include 
-#include 
-
+#include 
 
 /*
  * The of_device is a kind of "base class" that is a superset of
  * struct device for use by devices attached to an OF node and
- * probed using OF properties
+ * probed using OF properties.
  */
 struct of_device
 {
@@ -18,24 +16,14 @@ struct of_device
u64 dma_mask;   /* DMA mask */
struct device   dev;/* Generic device interface */
 };
-#defineto_of_device(d) container_of(d, struct of_device, dev)
-
-extern const struct of_device_id *of_match_node(
-   const struct of_device_id *matches, const struct device_node *node);
-extern const struct of_device_id *of_match_device(
-   const struct of_device_id *matches, const struct of_device *dev);
-
-extern struct of_device *of_dev_get(struct of_device *dev);
-extern void of_dev_put(struct of_device *dev);
-
-extern int of_device_register(struct of_device *ofdev);
-extern void of_device_unregister(struct of_device *ofdev);
-extern void of_release_dev(struct device *dev);
 
 extern ssize_t of_device_get_modalias(struct of_device *ofdev,
char *str, ssize_t len);
 extern int of_device_uevent(struct device *dev,
char **envp, int num_envp, char *buffer, int buffer_size);
 
+/* This is just here during the transition */
+#include 
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_OF_DEVICE_H */
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h
index 7cb00c1..b625261 100644
--- a/include/asm-sparc/of_device.h
+++ b/include/asm-sparc/of_device.h
@@ -3,9 +3,9 @@
 #ifdef __KERNEL__
 
 #include 
+#include 
 #include 
 #include 
-#include 
 
 extern struct bus_type ebus_bus_type;
 extern struct bus_type sbus_bus_type;
@@ -30,19 +30,12 @@ struct of_device
int portid;
int clock_freq;
 };
-#defineto_of_device(d) container_of(d, struct of_device, dev)
 
 extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, 
unsigned long size, char *name);
 extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long 
size);
 
 extern struct of_device *of_find_device_by_node(struct device_node *);
 
-extern const struct of_device_id *of_match_device(
-   const struct of_device_id *matches, const struct of_device *dev);
-
-extern struct of_device *of_dev_get(struct of_device *dev);
-extern void of_dev_put(struct of_device *dev);
-
 /*
  * An of_platform_driver driver is attached to a basic of_device on
  * the ISA, EBUS, and SBUS busses on sparc64.
@@ -67,13 +60,13 @@ struct of_platform_driver
 extern int of_register_driver(struct of_platform_driver *drv,
  struct bus_type *bus);
 extern void of_unregister_driver(struct of_platform_driver *drv);
-extern int of_device_register(struct of_device *ofdev);
-extern void of_device_unregister(struct of_device *ofdev);
 extern struct of_device *of_platform_device_create(struct device_node *np,
   const char *bus_id,
   struct device *parent,
   struct bus_type *bus);
-extern void of_release_dev(struct device *dev);
+
+/* This is just here during the transition */
+#include 
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_SPARC_OF_DEVICE_H */
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h
index 60e9173..68048cb 100644
--- a/include/asm-sparc64/of_device.h
+++ b/include/asm-sparc64/of_device.h
@@ -3,9 +3,9 @@
 #ifdef __KERNEL__
 
 #include 
+#include 
 #include 
 #include 
-#include 
 
 extern struct bus_type isa_bus_type;
 extern struct bus_type ebus_bus_type;
@@ -31,19 +31,12 @@ struct of_

[PATCH 10/12] [SPARC/64] Rename some functions like PowerPC

2007-07-19 Thread Stephen Rothwell
This is to make the of merge easier.  Also rename of_bus_type.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/sparc/kernel/of_device.c   |   42 
 arch/sparc/kernel/time.c|2 +-
 arch/sparc64/kernel/auxio.c |2 +-
 arch/sparc64/kernel/of_device.c |   50 +++---
 arch/sparc64/kernel/power.c |2 +-
 arch/sparc64/kernel/time.c  |2 +-
 include/asm-sparc/of_device.h   |3 +-
 include/asm-sparc64/of_device.h |3 +-
 8 files changed, 54 insertions(+), 52 deletions(-)

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index 0760b81..cb21983 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -21,7 +21,7 @@ static int of_platform_bus_match(struct device *dev, struct 
device_driver *drv)
return of_match_device(matches, of_dev) != NULL;
 }
 
-static int of_device_probe(struct device *dev)
+static int of_platform_device_probe(struct device *dev)
 {
int error = -ENODEV;
struct of_platform_driver *drv;
@@ -45,7 +45,7 @@ static int of_device_probe(struct device *dev)
return error;
 }
 
-static int of_device_remove(struct device *dev)
+static int of_platform_device_remove(struct device *dev)
 {
struct of_device * of_dev = to_of_device(dev);
struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
@@ -55,7 +55,7 @@ static int of_device_remove(struct device *dev)
return 0;
 }
 
-static int of_device_suspend(struct device *dev, pm_message_t state)
+static int of_platform_device_suspend(struct device *dev, pm_message_t state)
 {
struct of_device * of_dev = to_of_device(dev);
struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
@@ -66,7 +66,7 @@ static int of_device_suspend(struct device *dev, pm_message_t 
state)
return error;
 }
 
-static int of_device_resume(struct device * dev)
+static int of_platform_device_resume(struct device * dev)
 {
struct of_device * of_dev = to_of_device(dev);
struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
@@ -87,7 +87,7 @@ static int node_match(struct device *dev, void *data)
 
 struct of_device *of_find_device_by_node(struct device_node *dp)
 {
-   struct device *dev = bus_find_device(&of_bus_type, NULL,
+   struct device *dev = bus_find_device(&of_platform_bus_type, NULL,
 dp, node_match);
 
if (dev)
@@ -101,10 +101,10 @@ EXPORT_SYMBOL(of_find_device_by_node);
 struct bus_type ebus_bus_type = {
.name   = "ebus",
.match  = of_platform_bus_match,
-   .probe  = of_device_probe,
-   .remove = of_device_remove,
-   .suspend= of_device_suspend,
-   .resume = of_device_resume,
+   .probe  = of_platform_device_probe,
+   .remove = of_platform_device_remove,
+   .suspend= of_platform_device_suspend,
+   .resume = of_platform_device_resume,
 };
 EXPORT_SYMBOL(ebus_bus_type);
 #endif
@@ -113,23 +113,23 @@ EXPORT_SYMBOL(ebus_bus_type);
 struct bus_type sbus_bus_type = {
.name   = "sbus",
.match  = of_platform_bus_match,
-   .probe  = of_device_probe,
-   .remove = of_device_remove,
-   .suspend= of_device_suspend,
-   .resume = of_device_resume,
+   .probe  = of_platform_device_probe,
+   .remove = of_platform_device_remove,
+   .suspend= of_platform_device_suspend,
+   .resume = of_platform_device_resume,
 };
 EXPORT_SYMBOL(sbus_bus_type);
 #endif
 
-struct bus_type of_bus_type = {
+struct bus_type of_platform_bus_type = {
.name   = "of",
.match  = of_platform_bus_match,
-   .probe  = of_device_probe,
-   .remove = of_device_remove,
-   .suspend= of_device_suspend,
-   .resume = of_device_resume,
+   .probe  = of_platform_device_probe,
+   .remove = of_platform_device_remove,
+   .suspend= of_platform_device_suspend,
+   .resume = of_platform_device_resume,
 };
-EXPORT_SYMBOL(of_bus_type);
+EXPORT_SYMBOL(of_platform_bus_type);
 
 static inline u64 of_read_addr(const u32 *cell, int size)
 {
@@ -595,7 +595,7 @@ build_resources:
build_device_resources(op, parent);
 
op->dev.parent = parent;
-   op->dev.bus = &of_bus_type;
+   op->dev.bus = &of_platform_bus_type;
if (!parent)
strcpy(op->dev.bus_id, "root");
else
@@ -639,7 +639,7 @@ static int __init of_bus_driver_init(void)
 {
int err;
 
-   err = bus_register(&of_bus_type);
+   err = bus_register(&of_platform_bus_type);
 #ifdef CONFIG_PCI
if (!err)
err = bus_register(&ebus_bus_type);
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 7b4612d..f2fdbb3 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c

[PATCH 11/12] Create linux/of_platorm.h

2007-07-19 Thread Stephen Rothwell
Move common stuff from asm-powerpc/of_platform.h to here and
move the common bits from asm-sparc*/of_device.h here as well.

Create asm-sparc*/of_platform.h and move appropriate parts of
of_device.h to them.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 include/asm-powerpc/of_platform.h |   38 -
 include/asm-sparc/of_device.h |   39 +-
 include/asm-sparc/of_platform.h   |   32 +
 include/asm-sparc64/of_device.h   |   40 +-
 include/asm-sparc64/of_platform.h |   33 ++
 include/linux/of_platform.h   |   55 +
 6 files changed, 130 insertions(+), 107 deletions(-)
 create mode 100644 include/asm-sparc/of_platform.h
 create mode 100644 include/asm-sparc64/of_platform.h
 create mode 100644 include/linux/of_platform.h

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/include/asm-powerpc/of_platform.h 
b/include/asm-powerpc/of_platform.h
index 217eafb..80e6fad 100644
--- a/include/asm-powerpc/of_platform.h
+++ b/include/asm-powerpc/of_platform.h
@@ -1,3 +1,5 @@
+#ifndef _ASM_POWERPC_OF_PLATFORM_H
+#define _ASM_POWERPC_OF_PLATFORM_H
 /*
  *Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
  *  <[EMAIL PROTECTED]>
@@ -9,37 +11,8 @@
  *
  */
 
-#include 
-
-/*
- * The of_platform_bus_type is a bus type used by drivers that do not
- * attach to a macio or similar bus but still use OF probing
- * mechanism
- */
-extern struct bus_type of_platform_bus_type;
-
-/*
- * An of_platform_driver driver is attached to a basic of_device on
- * the "platform bus" (of_platform_bus_type)
- */
-struct of_platform_driver
-{
-   char*name;
-   struct of_device_id *match_table;
-   struct module   *owner;
-
-   int (*probe)(struct of_device* dev,
-const struct of_device_id *match);
-   int (*remove)(struct of_device* dev);
-
-   int (*suspend)(struct of_device* dev, pm_message_t state);
-   int (*resume)(struct of_device* dev);
-   int (*shutdown)(struct of_device* dev);
-
-   struct device_driverdriver;
-};
-#defineto_of_platform_driver(drv) \
-   container_of(drv,struct of_platform_driver, driver)
+/* This is just here during the transition */
+#include 
 
 /* Platform drivers register/unregister */
 extern int of_register_platform_driver(struct of_platform_driver *drv);
@@ -56,5 +29,6 @@ extern int of_platform_bus_probe(struct device_node *root,
 struct of_device_id *matches,
 struct device *parent);
 
-extern struct of_device *of_find_device_by_node(struct device_node *np);
 extern struct of_device *of_find_device_by_phandle(phandle ph);
+
+#endif /* _ASM_POWERPC_OF_PLATFORM_H */
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h
index fd8e957..e5f5aed 100644
--- a/include/asm-sparc/of_device.h
+++ b/include/asm-sparc/of_device.h
@@ -7,11 +7,6 @@
 #include 
 #include 
 
-extern struct bus_type ebus_bus_type;
-extern struct bus_type sbus_bus_type;
-extern struct bus_type of_platform_bus_type;
-#define of_bus_typeof_platform_bus_type/* for compatibility */
-
 /*
  * The of_device is a kind of "base class" that is a superset of
  * struct device for use by devices attached to an OF node and
@@ -35,39 +30,9 @@ struct of_device
 extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, 
unsigned long size, char *name);
 extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long 
size);
 
-extern struct of_device *of_find_device_by_node(struct device_node *);
-
-/*
- * An of_platform_driver driver is attached to a basic of_device on
- * the ISA, EBUS, and SBUS busses on sparc64.
- */
-struct of_platform_driver
-{
-   char*name;
-   struct of_device_id *match_table;
-   struct module   *owner;
-
-   int (*probe)(struct of_device* dev, const struct of_device_id 
*match);
-   int (*remove)(struct of_device* dev);
-
-   int (*suspend)(struct of_device* dev, pm_message_t state);
-   int (*resume)(struct of_device* dev);
-   int (*shutdown)(struct of_device* dev);
-
-   struct device_driverdriver;
-};
-#defineto_of_platform_driver(drv) container_of(drv,struct 
of_platform_driver, driver)
-
-extern int of_register_driver(struct of_platform_driver *drv,
- struct bus_type *bus);
-extern void of_unregister_driver(struct of_platform_driver *drv);
-extern struct of_device *of_platform_device_create(struct device_node *np,
-  const char *bus_id,
-  struct device *parent,
-  struct bus_type *bus);
-
-/* Thi

[PATCH 12/12] Create drivers/of/platform.c

2007-07-19 Thread Stephen Rothwell
and populate it with the common parts from PowerPC and Sparc[64].

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/of_platform.c |   82 +-
 arch/sparc/kernel/of_device.c |  107 +++--
 arch/sparc64/kernel/of_device.c   |  118 -
 drivers/of/Makefile   |2 +-
 drivers/of/platform.c |   96 ++
 include/linux/of_platform.h   |2 +
 6 files changed, 120 insertions(+), 287 deletions(-)
 create mode 100644 drivers/of/platform.c

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]

diff --git a/arch/powerpc/kernel/of_platform.c 
b/arch/powerpc/kernel/of_platform.c
index 9536ed7..93e6367 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -55,94 +55,14 @@ static struct of_device_id of_default_bus_ids[] = {
 
 static atomic_t bus_no_reg_magic;
 
-/*
- *
- * OF platform device type definition & base infrastructure
- *
- */
-
-static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
-{
-   struct of_device * of_dev = to_of_device(dev);
-   struct of_platform_driver * of_drv = to_of_platform_driver(drv);
-   const struct of_device_id * matches = of_drv->match_table;
-
-   if (!matches)
-   return 0;
-
-   return of_match_device(matches, of_dev) != NULL;
-}
-
-static int of_platform_device_probe(struct device *dev)
-{
-   int error = -ENODEV;
-   struct of_platform_driver *drv;
-   struct of_device *of_dev;
-   const struct of_device_id *match;
-
-   drv = to_of_platform_driver(dev->driver);
-   of_dev = to_of_device(dev);
-
-   if (!drv->probe)
-   return error;
-
-   of_dev_get(of_dev);
-
-   match = of_match_device(drv->match_table, of_dev);
-   if (match)
-   error = drv->probe(of_dev, match);
-   if (error)
-   of_dev_put(of_dev);
-
-   return error;
-}
-
-static int of_platform_device_remove(struct device *dev)
-{
-   struct of_device * of_dev = to_of_device(dev);
-   struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
-
-   if (dev->driver && drv->remove)
-   drv->remove(of_dev);
-   return 0;
-}
-
-static int of_platform_device_suspend(struct device *dev, pm_message_t state)
-{
-   struct of_device * of_dev = to_of_device(dev);
-   struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
-   int error = 0;
-
-   if (dev->driver && drv->suspend)
-   error = drv->suspend(of_dev, state);
-   return error;
-}
-
-static int of_platform_device_resume(struct device * dev)
-{
-   struct of_device * of_dev = to_of_device(dev);
-   struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
-   int error = 0;
-
-   if (dev->driver && drv->resume)
-   error = drv->resume(of_dev);
-   return error;
-}
-
 struct bus_type of_platform_bus_type = {
-   .name   = "of_platform",
-   .match  = of_platform_bus_match,
.uevent = of_device_uevent,
-   .probe  = of_platform_device_probe,
-   .remove = of_platform_device_remove,
-   .suspend= of_platform_device_suspend,
-   .resume = of_platform_device_resume,
 };
 EXPORT_SYMBOL(of_platform_bus_type);
 
 static int __init of_bus_driver_init(void)
 {
-   return bus_register(&of_platform_bus_type);
+   return of_bus_type_init(&of_platform_bus_type, "of_platform");
 }
 
 postcore_initcall(of_bus_driver_init);
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index cb21983..7176040 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -5,77 +5,9 @@
 #include 
 #include 
 #include 
-
-#include 
-#include 
-
-static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
-{
-   struct of_device * of_dev = to_of_device(dev);
-   struct of_platform_driver * of_drv = to_of_platform_driver(drv);
-   const struct of_device_id * matches = of_drv->match_table;
-
-   if (!matches)
-   return 0;
-
-   return of_match_device(matches, of_dev) != NULL;
-}
-
-static int of_platform_device_probe(struct device *dev)
-{
-   int error = -ENODEV;
-   struct of_platform_driver *drv;
-   struct of_device *of_dev;
-   const struct of_device_id *match;
-
-   drv = to_of_platform_driver(dev->driver);
-   of_dev = to_of_device(dev);
-
-   if (!drv->probe)
-   return error;
-
-   of_dev_get(of_dev);
-
-   match = of_match_device(drv->match_table, of_dev);
-   if (match)
-   error = drv->probe(of_dev, match);
-   if (error)
-   of_dev_put(of_dev);
-
-   return error;
-}
-
-static int of_platform_device_remove(struct device *dev)
-{
-   struct of_device * of_dev = to_of_device(dev);
-  

Re: Do we need to reset the master branch?

2007-07-19 Thread Stephen Rothwell
Hi Mark,

On Thu, 19 Jul 2007 08:17:46 -0700 "Mark A. Greer" <[EMAIL PROTECTED]> wrote:
>
> I did a git-pull this morning but it had a conflict.  Should I have
> reset it to something?

What did you pull it into?  There were conflicts with Linus' tree in the
last merge, so there may be conflicts with master as well.  I am sure
Paul will pull Linus's tree back into his master branch when he returns
which should resolve the conflicts.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Do we need to reset the master branch?

2007-07-19 Thread Mark A. Greer
On Fri, Jul 20, 2007 at 01:27:08AM +1000, Stephen Rothwell wrote:
> Hi Mark,
> 
> On Thu, 19 Jul 2007 08:17:46 -0700 "Mark A. Greer" <[EMAIL PROTECTED]> wrote:
> >
> > I did a git-pull this morning but it had a conflict.  Should I have
> > reset it to something?
> 
> What did you pull it into?  There were conflicts with Linus' tree in the
> last merge, so there may be conflicts with master as well.  I am sure
> Paul will pull Linus's tree back into his master branch when he returns
> which should resolve the conflicts.

I was in the master branch of powerpc.git and did a 'git-pull'

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


Re: [PATCH] powerpc: Add of_register_i2c_devices()

2007-07-19 Thread Segher Boessenkool
>> Your device is an rs5c372b.  So, that's what you put in
>> your device tree.  Simple so far, right?
>>
>> Now some OF I2C code goes looking for IIC devices in the
>> device tree.  It finds this thing, and from a table or
>> something it derives that it has to tell the kernel I2C
>> layer this is an "rtc-rs5c372".  [It would be nicer if it
>> could just instantiate the correct driver directly, but
>> if that's how the Linux I2C layer works, so be it].
>>
>> No change in the I2C "core" needed, just an OF "compatible"
>> matching thing like is needed *everywhere else* too.
>
> How about the patch below?

Looks good.  It should later be moved to a more generic
I2C OF matching layer, but fine for now.  Thanks!

You might want to put vendor names in the "compatible"
entries, dunno though, maybe these are "cross-vendor"
ICs?


Segher

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


Re: [PATCH 04/61] 8xx: Work around CPU15 erratum.

2007-07-19 Thread Scott Wood
Segher Boessenkool wrote:
>> The CPU15 erratum on MPC8xx chips can cause incorrect code execution
>> under certain circumstances, where there is a conditional or indirect
>> branch in the last word of a page, with a target in the last cache  line
>> of the next page.  This patch implements one of the suggested
>> workarounds, by forcing a TLB miss whenever execution crosses a page
>> boundary.  This is done by invalidating the pages before and after the
>> one being loaded into the TLB in the ITLB miss handler.
> 
> 
> So you never found a bug workaround without the terrible
> overhead of this one?  A shame :-(

The only lower-overhead workaround I know of requires compiler 
modifications (and I made it configurable to allow for that possibility).

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


Re: Do we need to reset the master branch?

2007-07-19 Thread Stephen Rothwell
On Thu, 19 Jul 2007 08:32:17 -0700 "Mark A. Greer" <[EMAIL PROTECTED]> wrote:
>
> I was in the master branch of powerpc.git and did a 'git-pull'

Sorry, I hadn't updated since this afternoon.  Looks like Paul has reset
his master tree to be the same as Linus', so you do need to do a reset.
Or checkout a separate branch and use

git fetch -f  master:

Using recent git (after 1.5.something), you can track the whole powerpc
tree like this:

git remote add powerpc 
git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git
git fetch powerpc

This will track the tree in branches called powerpc/ and do
resets as necessary.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


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

Re: Do we need to reset the master branch?

2007-07-19 Thread Stephen Rothwell
On Fri, 20 Jul 2007 01:44:32 +1000 Stephen Rothwell <[EMAIL PROTECTED]> wrote:
>
> git remote add powerpc 
> git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git
> git fetch powerpc
> 
> This will track the tree in branches called powerpc/ and do
> resets as necessary.

You should not make any local commits to the powerpc/* branches, of course.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


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

[PATCH 1/4] ibmveth: Enable TCP checksum offload

2007-07-19 Thread Brian King

This patchset enables TCP checksum offload support for IPV4
on ibmveth. This completely eliminates the generation and checking of
the checksum for packets that are completely virtual and never
touch a physical network. A simple TCP_STREAM netperf run on
a virtual network with maximum mtu set yielded a ~30% increase
in throughput. This feature is enabled by default on systems that
support it, but can be disabled with a module option.

Signed-off-by: Brian King <[EMAIL PROTECTED]>
---

 linux-2.6-bjking1/drivers/net/ibmveth.c |   53 
 linux-2.6-bjking1/drivers/net/ibmveth.h |   41 +++-
 2 files changed, 92 insertions(+), 2 deletions(-)

diff -puN drivers/net/ibmveth.c~ibmveth_csum_offload drivers/net/ibmveth.c
--- linux-2.6/drivers/net/ibmveth.c~ibmveth_csum_offload2007-07-18 
16:55:06.0 -0500
+++ linux-2.6-bjking1/drivers/net/ibmveth.c 2007-07-19 08:36:05.0 
-0500
@@ -47,6 +47,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -131,6 +133,11 @@ static inline int ibmveth_rxq_frame_leng
return (adapter->rx_queue.queue_addr[adapter->rx_queue.index].length);
 }
 
+static inline int ibmveth_rxq_csum_good(struct ibmveth_adapter *adapter)
+{
+   return 
(adapter->rx_queue.queue_addr[adapter->rx_queue.index].csum_good);
+}
+
 /* setup the initial settings for a buffer pool */
 static void ibmveth_init_buffer_pool(struct ibmveth_buff_pool *pool, u32 
pool_index, u32 pool_size, u32 buff_size, u32 pool_active)
 {
@@ -684,6 +691,24 @@ static int ibmveth_start_xmit(struct sk_
desc[0].fields.length, DMA_TO_DEVICE);
desc[0].fields.valid   = 1;
 
+   if (skb->ip_summed == CHECKSUM_PARTIAL &&
+   ip_hdr(skb)->protocol != IPPROTO_TCP && skb_checksum_help(skb)) {
+   ibmveth_error_printk("tx: failed to checksum packet\n");
+   tx_dropped++;
+   goto out;
+   }
+
+   if (skb->ip_summed == CHECKSUM_PARTIAL) {
+   unsigned char *buf = skb_transport_header(skb) + 
skb->csum_offset;
+
+   desc[0].fields.no_csum = 1;
+   desc[0].fields.csum_good = 1;
+
+   /* Need to zero out the checksum */
+   buf[0] = 0;
+   buf[1] = 0;
+   }
+
if(dma_mapping_error(desc[0].fields.address)) {
ibmveth_error_printk("tx: unable to map initial fragment\n");
tx_map_failed++;
@@ -702,6 +727,10 @@ static int ibmveth_start_xmit(struct sk_
frag->size, DMA_TO_DEVICE);
desc[curfrag+1].fields.length = frag->size;
desc[curfrag+1].fields.valid  = 1;
+   if (skb->ip_summed == CHECKSUM_PARTIAL) {
+   desc[curfrag+1].fields.no_csum = 1;
+   desc[curfrag+1].fields.csum_good = 1;
+   }
 
if(dma_mapping_error(desc[curfrag+1].fields.address)) {
ibmveth_error_printk("tx: unable to map fragment %d\n", 
curfrag);
@@ -792,7 +821,11 @@ static int ibmveth_poll(struct net_devic
} else {
int length = ibmveth_rxq_frame_length(adapter);
int offset = ibmveth_rxq_frame_offset(adapter);
+   int csum_good = ibmveth_rxq_csum_good(adapter);
+
skb = ibmveth_rxq_get_buffer(adapter);
+   if (csum_good)
+   skb->ip_summed = CHECKSUM_UNNECESSARY;
 
ibmveth_rxq_harvest_buffer(adapter);
 
@@ -962,8 +995,10 @@ static void ibmveth_poll_controller(stru
 static int __devinit ibmveth_probe(struct vio_dev *dev, const struct 
vio_device_id *id)
 {
int rc, i;
+   long ret;
struct net_device *netdev;
struct ibmveth_adapter *adapter = NULL;
+   union ibmveth_illan_attributes set_attr, ret_attr;
 
unsigned char *mac_addr_p;
unsigned int *mcastFilterSize_p;
@@ -1058,6 +1093,24 @@ static int __devinit ibmveth_probe(struc
 
ibmveth_debug_printk("registering netdev...\n");
 
+   ret = h_illan_attributes(dev->unit_address, 0, 0, &ret_attr.desc);
+
+   if (ret == H_SUCCESS && !ret_attr.fields.active_trunk &&
+   !ret_attr.fields.trunk_priority &&
+   ret_attr.fields.csum_offload_padded_pkt_support) {
+   set_attr.desc = 0;
+   set_attr.fields.tcp_csum_offload_ipv4 = 1;
+
+   ret = h_illan_attributes(dev->unit_address, 0, set_attr.desc,
+&ret_attr.desc);
+
+   if (ret == H_SUCCESS)
+   netdev->features |= NETIF_F_IP_CSUM;
+   else
+   ret = h_illan_attributes(dev->unit_address, 
set_attr.desc,
+  

[PATCH 2/4] ibmveth: Implement ethtool hooks to enable/disable checksum offload

2007-07-19 Thread Brian King

This patch adds the appropriate ethtool hooks to allow for enabling/disabling
of hypervisor assisted checksum offload for TCP.

Signed-off-by: Brian King <[EMAIL PROTECTED]>
---

 linux-2.6-bjking1/drivers/net/ibmveth.c |  120 +++-
 linux-2.6-bjking1/drivers/net/ibmveth.h |1 
 2 files changed, 119 insertions(+), 2 deletions(-)

diff -puN drivers/net/ibmveth.c~ibmveth_csum_offload_ethtool 
drivers/net/ibmveth.c
--- linux-2.6/drivers/net/ibmveth.c~ibmveth_csum_offload_ethtool
2007-07-19 08:38:27.0 -0500
+++ linux-2.6-bjking1/drivers/net/ibmveth.c 2007-07-19 08:39:08.0 
-0500
@@ -641,12 +641,127 @@ static u32 netdev_get_link(struct net_de
return 1;
 }
 
+static void ibmveth_set_rx_csum_flags(struct net_device *dev, u32 data)
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+
+   if (data)
+   adapter->rx_csum = 1;
+   else {
+   adapter->rx_csum = 0;
+   dev->features &= ~NETIF_F_IP_CSUM;
+   }
+}
+
+static void ibmveth_set_tx_csum_flags(struct net_device *dev, u32 data)
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+
+   if (data) {
+   dev->features |= NETIF_F_IP_CSUM;
+   adapter->rx_csum = 1;
+   } else
+   dev->features &= ~NETIF_F_IP_CSUM;
+}
+
+static int ibmveth_set_csum_offload(struct net_device *dev, u32 data,
+   void (*done) (struct net_device *, u32))
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+   union ibmveth_illan_attributes set_attr, clr_attr, ret_attr;
+   long ret;
+   int rc1 = 0, rc2 = 0;
+   int restart = 0;
+
+   if (netif_running(dev)) {
+   restart = 1;
+   adapter->pool_config = 1;
+   ibmveth_close(dev);
+   adapter->pool_config = 0;
+   }
+
+   set_attr.desc = 0;
+   clr_attr.desc = 0;
+
+   if (data)
+   set_attr.fields.tcp_csum_offload_ipv4 = 1;
+   else
+   clr_attr.fields.tcp_csum_offload_ipv4 = 1;
+
+   ret = h_illan_attributes(adapter->vdev->unit_address, 0, 0, 
&ret_attr.desc);
+
+   if (ret == H_SUCCESS && !ret_attr.fields.active_trunk &&
+   !ret_attr.fields.trunk_priority &&
+   ret_attr.fields.csum_offload_padded_pkt_support) {
+   ret = h_illan_attributes(adapter->vdev->unit_address, 
clr_attr.desc,
+set_attr.desc, &ret_attr.desc);
+
+   if (ret != H_SUCCESS) {
+   rc1 = -EIO;
+   ibmveth_error_printk("unable to change checksum offload 
settings."
+" %d rc=%ld\n", data, ret);
+
+   ret = h_illan_attributes(adapter->vdev->unit_address,
+set_attr.desc, clr_attr.desc, 
&ret_attr.desc);
+   } else
+   done(dev, data);
+   } else {
+   rc1 = -EIO;
+   ibmveth_error_printk("unable to change checksum offload 
settings."
+" %d rc=%ld ret_attr=%lx\n", data, ret, 
ret_attr.desc);
+   }
+
+   if (restart)
+   rc2 = ibmveth_open(dev);
+
+   return rc1 ? rc1 : rc2;
+}
+
+static int ibmveth_set_rx_csum(struct net_device *dev, u32 data)
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+
+   if (data && adapter->rx_csum)
+   return 0;
+   if (!data && !adapter->rx_csum)
+   return 0;
+
+   return ibmveth_set_csum_offload(dev, data, ibmveth_set_rx_csum_flags);
+}
+
+static int ibmveth_set_tx_csum(struct net_device *dev, u32 data)
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+   int rc = 0;
+
+   if (data && (dev->features & NETIF_F_IP_CSUM))
+   return 0;
+   if (!data && !(dev->features & NETIF_F_IP_CSUM))
+   return 0;
+
+   if (data && !adapter->rx_csum)
+   rc = ibmveth_set_csum_offload(dev, data, 
ibmveth_set_tx_csum_flags);
+   else
+   ibmveth_set_tx_csum_flags(dev, data);
+
+   return rc;
+}
+
+static u32 ibmveth_get_rx_csum(struct net_device *dev)
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+   return adapter->rx_csum;
+}
+
 static const struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo= netdev_get_drvinfo,
.get_settings   = netdev_get_settings,
.get_link   = netdev_get_link,
.get_sg = ethtool_op_get_sg,
.get_tx_csum= ethtool_op_get_tx_csum,
+   .set_tx_csum= ibmveth_set_tx_csum,
+   .get_rx_csum= ibmveth_get_rx_csum,
+   .set_rx_csum= ibmveth_set_rx_csum
 };
 
 static int ibmveth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
@@ -1104,9 +1219,10 @@ static int __devinit ibmveth_probe(struc
  

[PATCH 4/4] ibmveth: Add ethtool driver stats hooks

2007-07-19 Thread Brian King

Add ethtool hooks to ibmveth to retrieve driver statistics.

Signed-off-by: Brian King <[EMAIL PROTECTED]>
---

 linux-2.6-bjking1/drivers/net/ibmveth.c |   53 +++-
 1 file changed, 52 insertions(+), 1 deletion(-)

diff -puN drivers/net/ibmveth.c~ibmveth_ethtool_driver_stats 
drivers/net/ibmveth.c
--- linux-2.6/drivers/net/ibmveth.c~ibmveth_ethtool_driver_stats
2007-07-19 08:39:35.0 -0500
+++ linux-2.6-bjking1/drivers/net/ibmveth.c 2007-07-19 08:39:35.0 
-0500
@@ -112,6 +112,28 @@ MODULE_DESCRIPTION("IBM i/pSeries Virtua
 MODULE_LICENSE("GPL");
 MODULE_VERSION(ibmveth_driver_version);
 
+struct ibmveth_stat {
+   char name[ETH_GSTRING_LEN];
+   int offset;
+};
+
+#define IBMVETH_STAT_OFF(stat) offsetof(struct ibmveth_adapter, stat)
+#define IBMVETH_GET_STAT(a, off) *((u64 *)(((unsigned long)(a)) + off))
+
+struct ibmveth_stat ibmveth_stats[] = {
+   { "replenish_task_cycles", IBMVETH_STAT_OFF(replenish_task_cycles) },
+   { "replenish_no_mem", IBMVETH_STAT_OFF(replenish_no_mem) },
+   { "replenish_add_buff_failure", 
IBMVETH_STAT_OFF(replenish_add_buff_failure) },
+   { "replenish_add_buff_success", 
IBMVETH_STAT_OFF(replenish_add_buff_success) },
+   { "rx_invalid_buffer", IBMVETH_STAT_OFF(rx_invalid_buffer) },
+   { "rx_no_buffer", IBMVETH_STAT_OFF(rx_no_buffer) },
+   { "tx_multidesc_send", IBMVETH_STAT_OFF(tx_multidesc_send) },
+   { "tx_linearized", IBMVETH_STAT_OFF(tx_linearized) },
+   { "tx_linearize_failed", IBMVETH_STAT_OFF(tx_linearize_failed) },
+   { "tx_map_failed", IBMVETH_STAT_OFF(tx_map_failed) },
+   { "tx_send_failed", IBMVETH_STAT_OFF(tx_send_failed) }
+};
+
 /* simple methods of getting data from the current rxq entry */
 static inline int ibmveth_rxq_pending_buffer(struct ibmveth_adapter *adapter)
 {
@@ -753,6 +775,32 @@ static u32 ibmveth_get_rx_csum(struct ne
return adapter->rx_csum;
 }
 
+static void ibmveth_get_strings(struct net_device *dev, u32 stringset, u8 
*data)
+{
+   int i;
+
+   if (stringset != ETH_SS_STATS)
+   return;
+
+   for (i = 0; i < ARRAY_SIZE(ibmveth_stats); i++, data += ETH_GSTRING_LEN)
+   memcpy(data, ibmveth_stats[i].name, ETH_GSTRING_LEN);
+}
+
+static int ibmveth_get_stats_count(struct net_device *dev)
+{
+   return ARRAY_SIZE(ibmveth_stats);
+}
+
+static void ibmveth_get_ethtool_stats(struct net_device *dev,
+ struct ethtool_stats *stats, u64 *data)
+{
+   int i;
+   struct ibmveth_adapter *adapter = dev->priv;
+
+   for (i = 0; i < ARRAY_SIZE(ibmveth_stats); i++)
+   data[i] = IBMVETH_GET_STAT(adapter, ibmveth_stats[i].offset);
+}
+
 static const struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo= netdev_get_drvinfo,
.get_settings   = netdev_get_settings,
@@ -763,7 +811,10 @@ static const struct ethtool_ops netdev_e
.get_rx_csum= ibmveth_get_rx_csum,
.set_rx_csum= ibmveth_set_rx_csum,
.get_tso= ethtool_op_get_tso,
-   .get_ufo= ethtool_op_get_ufo
+   .get_ufo= ethtool_op_get_ufo,
+   .get_strings= ibmveth_get_strings,
+   .get_stats_count= ibmveth_get_stats_count,
+   .get_ethtool_stats  = ibmveth_get_ethtool_stats
 };
 
 static int ibmveth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
diff -puN drivers/net/ibmveth.h~ibmveth_ethtool_driver_stats 
drivers/net/ibmveth.h
_
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 3/4] ibmveth: Add ethtool TSO handlers

2007-07-19 Thread Brian King

Add handlers for get_tso and get_ufo to prevent errors being printed
by ethtool.

Signed-off-by: Brian King <[EMAIL PROTECTED]>
---

 linux-2.6-bjking1/drivers/net/ibmveth.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -puN drivers/net/ibmveth.c~ibmveth_ethtool_get_tso drivers/net/ibmveth.c
--- linux-2.6/drivers/net/ibmveth.c~ibmveth_ethtool_get_tso 2007-07-19 
08:39:31.0 -0500
+++ linux-2.6-bjking1/drivers/net/ibmveth.c 2007-07-19 08:39:31.0 
-0500
@@ -761,7 +761,9 @@ static const struct ethtool_ops netdev_e
.get_tx_csum= ethtool_op_get_tx_csum,
.set_tx_csum= ibmveth_set_tx_csum,
.get_rx_csum= ibmveth_get_rx_csum,
-   .set_rx_csum= ibmveth_set_rx_csum
+   .set_rx_csum= ibmveth_set_rx_csum,
+   .get_tso= ethtool_op_get_tso,
+   .get_ufo= ethtool_op_get_ufo
 };
 
 static int ibmveth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
_
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Add 8548CDS with Arcadia 3.0 support

2007-07-19 Thread Segher Boessenkool
> + compatible = "MPC8548CDS", "MPC85xxCDS";

No new "xx" please.

> + memory {
> + device_type = "memory";
> + reg = < 0800>;  // 128M at 0x0

[EMAIL PROTECTED]  Simplified rule: whenever there is a "reg",
there is an "@".

> + [EMAIL PROTECTED] {

[EMAIL PROTECTED]

> + #address-cells = <1>;
> + #size-cells = <1>;
> + device_type = "soc";

No "device_type".  Missing "compatible".

> + ranges = <0 e000 0010>;
> + reg = ;  // CCSRBAR 1M

"reg" and "ranges" overlap, that can't be right.

> + [EMAIL PROTECTED] {
> + device_type = "i2c";
> + compatible = "fsl-i2c";

Please put a more exact "compatible" entry in there.  If
you need to keep "fsl-i2c" as well, for backwards compatibility
reasons, that's fine; but do put a better name in.

> + dfsrr;

This wins the prize for worst-name property ever!  :-)

> + [EMAIL PROTECTED] {
> + device_type = "serial";
> + compatible = "ns16550";
> + reg = <4500 100>;   // reg base, size

I wonder how it can be NS16550-compatible if its register
bank is a completely different size.


> + pci1: [EMAIL PROTECTED] {
> + interrupt-map-mask = ;
> + interrupt-map = <
> +
> + /* IDSEL 0x2 (PCIX Tsi310 bridge) */
> + 1000 0 0 1 &mpic 0 1
> + 1000 0 0 2 &mpic 1 1
> + 1000 0 0 3 &mpic 2 1
> + 1000 0 0 4 &mpic 3 1

You map all dev#s' interrupts identically, you could just do

interrupt-map-mask = <0 0 0 7>

and do one set of four mappings in the interrupt-map, with the
device number field set to 0.

The mask exists to not have to write out lots of huge tables :-)

> + [EMAIL PROTECTED] {
> + interrupt-map-mask = ;
> + interrupt-map = <
> +
> + /* IDSEL 0x15 */
> + a800 0 0 1 &mpic b 1
> + a800 0 0 2 &mpic b 1
> + a800 0 0 3 &mpic b 1
> + a800 0 0 4 &mpic b 1>;

You can do a similar mask trick here.

> + mpic: [EMAIL PROTECTED] {

[EMAIL PROTECTED]


Segher

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


Re: [PATCH 03/12] Consolidate of_device_is_compatible

2007-07-19 Thread Scott Wood
On Fri, Jul 20, 2007 at 01:10:12AM +1000, Stephen Rothwell wrote:
> The only difference here is that Sparc uses strncmp to match compatibility
> names while PowerPC uses strncasecmp.

Could we put a comment in saying that both should really just use
strcmp(), and that this mechanism should go away once any compatibility
issues are found and addressed?

The PowerPC one will need to drop the 'n' soon, as well, but that should
be a separate patch.

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


Re: Do we need to reset the master branch?

2007-07-19 Thread Mark A. Greer
On Fri, Jul 20, 2007 at 01:44:32AM +1000, Stephen Rothwell wrote:
> On Thu, 19 Jul 2007 08:32:17 -0700 "Mark A. Greer" <[EMAIL PROTECTED]> wrote:
> >
> > I was in the master branch of powerpc.git and did a 'git-pull'
> 
> Sorry, I hadn't updated since this afternoon.  Looks like Paul has reset
> his master tree to be the same as Linus', so you do need to do a reset.
> Or checkout a separate branch and use
> 
> git fetch -f  master:
> 
> Using recent git (after 1.5.something), you can track the whole powerpc
> tree like this:
> 
> git remote add powerpc 
> git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git
> git fetch powerpc
> 
> This will track the tree in branches called powerpc/ and do
> resets as necessary.

Oh, that's cool  Thanks Stephen.

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


Re: Do we need to reset the master branch?

2007-07-19 Thread Mark A. Greer
On Fri, Jul 20, 2007 at 01:46:18AM +1000, Stephen Rothwell wrote:
> On Fri, 20 Jul 2007 01:44:32 +1000 Stephen Rothwell <[EMAIL PROTECTED]> wrote:
> >
> > git remote add powerpc 
> > git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git
> > git fetch powerpc
> > 
> > This will track the tree in branches called powerpc/ and do
> > resets as necessary.
> 
> You should not make any local commits to the powerpc/* branches, of course.

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


Re: [PATCH 03/12] Consolidate of_device_is_compatible

2007-07-19 Thread Stephen Rothwell
Hi Scott,

On Thu, 19 Jul 2007 10:52:07 -0500 Scott Wood <[EMAIL PROTECTED]> wrote:
>
> On Fri, Jul 20, 2007 at 01:10:12AM +1000, Stephen Rothwell wrote:
> > The only difference here is that Sparc uses strncmp to match compatibility
> > names while PowerPC uses strncasecmp.
> 
> Could we put a comment in saying that both should really just use
> strcmp(), and that this mechanism should go away once any compatibility
> issues are found and addressed?

That issue was discussed earlier and is high on the list of things to do
after this lot goes in.  The priority here is to get the consolidation
started along with no (or few) visible changes.

> The PowerPC one will need to drop the 'n' soon, as well, but that should
> be a separate patch.

Yes, certainly.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


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

[PATCH] powerpc: Allow smp_call_function_single() to current cpu

2007-07-19 Thread Avi Kivity
This removes the requirement for callers to get_cpu() to check in simple
cases.  i386 and x86_64 already received a similar treatment.

Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/smp.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index d577b71..087c92f 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -284,7 +284,7 @@ int smp_call_function_single(int cpu, void (*func) (void 
*info), void *info, int
int wait)
 {
cpumask_t map = CPU_MASK_NONE;
-   int ret = -EBUSY;
+   int ret = 0;
 
if (!cpu_online(cpu))
return -EINVAL;
@@ -292,6 +292,11 @@ int smp_call_function_single(int cpu, void (*func) (void 
*info), void *info, int
cpu_set(cpu, map);
if (cpu != get_cpu())
ret = smp_call_function_map(func,info,nonatomic,wait,map);
+   else {
+   local_irq_disable();
+   func(info);
+   local_irq_enable();
+   }
put_cpu();
return ret;
 }
-- 
1.5.2.4

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


Re: [PATCH] Add StorCenter DTS first draft.

2007-07-19 Thread Jon Loeliger
On Wed, 2007-07-18 at 16:54, Benjamin Herrenschmidt wrote:

> Cache line size is used by the kernel on ppc64 for things like clearing
> memory (to get the stride between subsequent dcbz) or flushing the
> cache :-) It's also passed on to userland.
> 
> If it's absent from the device-tree, we default to the values in the
> cputable, but if you're going to put the properties in the tree, don't
> put a 0 in there. As it is, the day I make the 64 bits code common, your
> DT will break unless I special case "0".
> 
> Ben.

So, just to put this issue to rest some, I have
modified my DTS to have correct values here.
It was _easy_. ;-)

But, a followup patch should clean up _other_, existing
DTS files that have 0 there still.

jdl


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


Re: [2/2] 2.6.22-git: known regressions

2007-07-19 Thread Michal Piotrowski
Hi all,

Here is a list of some known regressions in 2.6.22-git.

Feel free to add new regressions/remove fixed etc.
http://kernelnewbies.org/known_regressions

List of Aces

NameRegressions fixed since 21-Jun-2007
Adrian Bunk3
Andi Kleen 2
Andrew Morton  2
David Woodhouse2
Hugh Dickins   2
Jens Axboe 2



FS

Subject : ia64 build failure from recent diskquota patch
References  : http://lkml.org/lkml/2007/7/18/407
Last known good : ?
Submitter   : Doug Chapman <[EMAIL PROTECTED]>
Caused-By   : Vasily Tarasov <[EMAIL PROTECTED]>
  commit b716395e2b8e450e294537de0c91476ded2f0395
Handled-By  : ?
Status  : unknown

Subject : ext4 build warnings
References  : http://lkml.org/lkml/2007/7/18/420
Last known good : ?
Submitter   : Jeff Garzik <[EMAIL PROTECTED]>
Caused-By   : ?
Handled-By  : Mingming Cao <[EMAIL PROTECTED]>
Status  : unknown



IDE

Subject : compile error if CONFIG_BLOCK not enabled related to 
linux/ide.h include
References  : http://lkml.org/lkml/2007/7/18/11
Last known good : ?
Submitter   : Kumar Gala <[EMAIL PROTECTED]>
Caused-By   : ?
Handled-By  : Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
Status  : unknown



Memory management

Subject : kmalloc zero size changes break i386
References  : http://lkml.org/lkml/2007/7/19/172
Last known good : ?
Submitter   : Andi Kleen <[EMAIL PROTECTED]>
Caused-By   : Christoph Lameter <[EMAIL PROTECTED]>
  commit 6cb8f91320d3e720351c21741da795fed580b21b
Handled-By  : ?
Status  : unknown



SYSFS

Subject : sysfs root link count broken in 2.6.22-git5
References  : http://lkml.org/lkml/2007/7/15/62
Last known good : ?
Submitter   : Jean Delvare <[EMAIL PROTECTED]>
Caused-By   : ?
Handled-By  : Tejun Heo <[EMAIL PROTECTED]>
Status  : unknown



Regards,
Michal

--
LOG
http://www.stardust.webpages.pl/log/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 53/61] 82xx: Set NOT_COHERENT_CACHE on 8272 with PCI.

2007-07-19 Thread Scott Wood
Kumar Gala wrote:
> Can you dump the POCMRx registers and report their values and what / 
> proc/iomem looks like.

POTAR0: 0x0008
POTAR1: 0x000a
POTAR2: 0x

POBAR0: 0x0008
POBAR1: 0x000a
POBAR2: 0x000f6000

POCMR0: 0xa00e
POCMR1: 0x800e
POCMR2: 0xc00fe000

PITAR0: 0x
PIBAR0: 0x
PICMR0: 0xa00fc000

-sh-2.05b# cat /proc/iomem
8000-9fff : /[EMAIL PROTECTED]/[EMAIL PROTECTED]
a000-bfff : /[EMAIL PROTECTED]/[EMAIL PROTECTED]
   a000-a001 : :00:17.0
 a000-a001 : e1000
   a002-a003 : :00:17.0
 a002-a003 : e1000

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


Re: [2/2] 2.6.22-git: known regressions

2007-07-19 Thread Greg KH
On Thu, Jul 19, 2007 at 06:34:55PM +0200, Michal Piotrowski wrote:
> SYSFS
> 
> Subject : sysfs root link count broken in 2.6.22-git5
> References  : http://lkml.org/lkml/2007/7/15/62
> Last known good : ?
> Submitter   : Jean Delvare <[EMAIL PROTECTED]>
> Caused-By   : ?
> Handled-By  : Tejun Heo <[EMAIL PROTECTED]>
> Status  : unknown

This is now fixed in Linus's tree with a patch from Tejun.

thanks,

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


Re: [PATCH] Treat ISI faults as read faults on classic 32-bit PowerPC

2007-07-19 Thread Jon Loeliger
On Wed, 2007-07-18 at 19:00, Paul Mackerras wrote:

> Hmmm.  The dangling else clauses are pretty gross, and in fact we have
> the same problem on POWER3 and RS64 processors (to be fair, we had
> the problem before and didn't notice, but we should still fix it).
> 
> How about this instead?  Could people test it please?  (Note that
> CPU_FTR_NOEXECUTE is 0 in 32-bit kernels.)
> 
> Paul.
> 
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index 0ece513..99c3093 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c

Acked-by: Jon Loeliger <[EMAIL PROTECTED]>

Tested on 8641HPCN.

Thanks,
jdl


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


Re: [PATCH 1/2] Fix error checking in Vitesse IRQ config

2007-07-19 Thread Jon Loeliger
On Wed, 2007-07-18 at 01:35, Andy Fleming wrote:
> phy_read() returns a negative number if there's an error, but the
> error-checking code in the Vitesse driver's config_intr function
> triggers if phy_read() returns non-zero.  Correct that.
> 
> Signed-off-by: Andy Fleming <[EMAIL PROTECTED]>
> ---
> I made a really stupid mistake in the 4 patches I sent out, earlier.  I
> thought those patches had been tested, but they hadn't been.  This one
> corrects a tiny error in the patch, and they have now been tested.  As before
> this change can be pulled from:
> 
> http://opensource.freescale.com/pub/scm/linux-2.6-85xx.git netdev
> 
> Really, REALLY sorry about that.  I have been given a paper bag of appropriate
> size and shape to fit over my head.
> 
>  drivers/net/phy/vitesse.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
> index 6a53856..8874497 100644


Acked-by: Jon Loeliger <[EMAIL PROTECTED]>

Tested on the 8641HPCN.

Thanks,
jdl


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


Re: [RFC][PATCH 6/8] Walnut DTS

2007-07-19 Thread Segher Boessenkool
>> Yes indeed.  The problem with your suggested "obvious way"
>
> I said it was obvious, not obviously correct. :-)

I know :-)

>> is that you wouldn't get a unit address included if your
>> interrupt-map points (for some entry) at your device tree
>> parent, either.  Not all that hypothetical.
>
> Ah, good point.  My inclination would be to, rather than check how  
> we got to the node, check whether it's the device's parent.  If  
> not, then the presence of #address-cells (other than zero for  
> compatibility) is an error.  Otherwise, #address-cells is used, and  
> defaults are handled the same as with reg/ranges translation.

This might work; it is less flexible than the actual interrupt
mapping definition though (and such flexibility is good, as long
as you don't abuse it ;-) ).  Anyway, we're stuck with the actual
current imap recommended practice.  It might not be perfect but
it does work, is proven in the field, and is the standard.


Segher

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


Re: [PATCH 49/61] 8xx: Update device trees.

2007-07-19 Thread Vitaly Bordug
just my 2 cents.
[snip]
> 
> > +   fsl,cpm-brg = <1>;
> > +   fsl,cpm-command = <0090>;
> 
> Are these two documented?  Your patch queue is too
> long for me to check for myself.
> 
In fact, there were different approaches to describe CPM, and I am sure this is 
not the end.
These aren't documented, and I think we do not need that so far: I am pretty 
sure this will change
to something more comfortable as new similar ports will follow-up. Meanwhile, 
values are self-description
for anybody familiar with this SoC.

> > -   [EMAIL PROTECTED] {
> > +   [EMAIL PROTECTED] {
> 
> Maybe use a more generic name, I have no idea what a
> "BCSR" is.
> 
IIRC, QE stuff, when first introduced, had bcsr bindings, that were discussed 
and agreed here.



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


Re: [PATCH 03/12] Consolidate of_device_is_compatible

2007-07-19 Thread Segher Boessenkool
>> The only difference here is that Sparc uses strncmp to match  
>> compatibility
>> names while PowerPC uses strncasecmp.
>
> Could we put a comment in saying that both should really just use
> strcmp(), and that this mechanism should go away once any  
> compatibility
> issues are found and addressed?
>
> The PowerPC one will need to drop the 'n' soon, as well, but that  
> should
> be a separate patch.

I think both of these are on enough to-do lists that adding
a comment isn't necessary ;-)


Segher

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


Re: [PATCH] Add StorCenter DTS first draft.

2007-07-19 Thread Segher Boessenkool
>>> compatible = "fsl,mpc8241-i2c", "fsl-i2c";
>>
>> That looks good yes.  Or if the kernel side code for
>> recognising fsl,mpc8241-i2c gets merged in time, you
>> can leave out fsl-i2c from your device tree completely.
>
> Hmm, there are really only two fsl,i2c controllers.  The one we  
> call fsl-i2c, and the cpm-i2c controller.
>
> So I'd prefer we don't use fsl,mpc8241-i2c.  I'd suggest fsl,ppc- 
> i2c or something like that.

The actual name doesn't matter much, as long as it is "unique
enough"; a name that matches a name already in use in real life
is preferred; normally the name is just the name of the first
device that had this specific programming interface.

But choose whatever you want.  It is a good idea to always
put the exact name of the specific device in there, too, btw,
so you'd end up with "fsl,mpc8241-i2c", "fsl,ppc-i2c" if your
suggestion is accepted.


Segher

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


Re: [2/2] 2.6.22-git: known regressions

2007-07-19 Thread Satyam Sharma
> Subject : ext4 build warnings
> References  : http://lkml.org/lkml/2007/7/18/420
> Last known good : ?
> Submitter   : Jeff Garzik <[EMAIL PROTECTED]>
> Caused-By   : ?
> Handled-By  : Mingming Cao <[EMAIL PROTECTED]>
> Status  : unknown

Mingming Cao fixed this:

http://lkml.org/lkml/2007/7/18/564

Dunno if it's in latest git
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Add StorCenter DTS first draft.

2007-07-19 Thread Segher Boessenkool
 +  /* Following required by dtc but not used */
 +  i-cache-line-size = <0>;
 +  d-cache-line-size = <0>;
 +  i-cache-size = <4000>;
 +  d-cache-size = <4000>;
 +  };
>>>
>>> The 32 bits kernel may not be using those yet, but it will. 64 bits
>>> does
>>> already and I plan to merge those bits at one point.
>>
>> Hrm, what does it use it for?  Are you going to require
>> all other defined CPU properties as well (like the PowerPC
>> binding does)?
>
> Cache line size is used by the kernel on ppc64 for things like  
> clearing
> memory (to get the stride between subsequent dcbz) or flushing the
> cache :-) It's also passed on to userland.
>
> If it's absent from the device-tree, we default to the values in the
> cputable, but if you're going to put the properties in the tree, don't
> put a 0 in there. As it is, the day I make the 64 bits code common,  
> your
> DT will break unless I special case "0".

So your plan is to prefer the device tree over the cputable, and
maybe even deprecate the cputable?  I was under the impression
that we were going the exact opposite way (we don't have many of
required properties in CPU nodes in most DTS files).  Either way
is fine with me, just choose one; but picking a little from the
device tree and the rest from the cputable doesn't sound useful to
me, and it would be a lovely maintenance problem.


Segher

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


Re: [PATCH 49/61] 8xx: Update device trees.

2007-07-19 Thread Segher Boessenkool
>>> +   fsl,cpm-brg = <1>;
>>> +   fsl,cpm-command = <0090>;
>>
>> Are these two documented?  Your patch queue is too
>> long for me to check for myself.
>>
> In fact, there were different approaches to describe CPM, and I am  
> sure this is not the end.
> These aren't documented, and I think we do not need that so far: I  
> am pretty sure this will change
> to something more comfortable as new similar ports will follow-up.  
> Meanwhile, values are self-description
> for anybody familiar with this SoC.

Even when it is a work in progress still, it would be a good
idea to start documenting the device binding.

>>> -   [EMAIL PROTECTED] {
>>> +   [EMAIL PROTECTED] {
>>
>> Maybe use a more generic name, I have no idea what a
>> "BCSR" is.
>>
> IIRC, QE stuff, when first introduced, had bcsr bindings, that were  
> discussed and agreed here.

Sure, that's not the point.

Since you are using generic names, the only use for the "name"
of a node is for a human reader to understand your tree.  Maybe
everyone using this specific SoC knows what a BCSR is; or maybe
there is a more friendly name you could use.


Segher

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


Re: [PATCH] Treat ISI faults as read faults on classic 32-bit PowerPC

2007-07-19 Thread Segher Boessenkool
>> Hmmm.  The dangling else clauses are pretty gross, and in fact we  
>> have
>> the same problem on POWER3 and RS64 processors (to be fair, we had
>> the problem before and didn't notice, but we should still fix it).
>>
>> How about this instead?  Could people test it please?  (Note that
>> CPU_FTR_NOEXECUTE is 0 in 32-bit kernels.)
>>
>> Paul.
>>
>> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
>> index 0ece513..99c3093 100644
>> --- a/arch/powerpc/mm/fault.c
>> +++ b/arch/powerpc/mm/fault.c
>
> Acked-by: Jon Loeliger <[EMAIL PROTECTED]>
>
> Tested on 8641HPCN.

Which glibc versions?  glibc-2.4 and newer are fine without the
patch already, glibc-2.3 seems to get away by accident; but 2.2
(and before) are the problematic ones.

No other userland program has been identified as needing this
fix, btw -- thankfully, or the testing matrix would be _huge_.


Segher

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


Re: [2/2] 2.6.22-git: known regressions

2007-07-19 Thread Mingming Caoc
Satyam Sharma wrote:
>> Subject : ext4 build warnings
>> References  : http://lkml.org/lkml/2007/7/18/420
>> Last known good : ?
>> Submitter   : Jeff Garzik <[EMAIL PROTECTED]>
>> Caused-By   : ?
>> Handled-By  : Mingming Cao <[EMAIL PROTECTED]>
>> Status  : unknown
> 
> Mingming Cao fixed this:
> 
> http://lkml.org/lkml/2007/7/18/564
> 
> Dunno if it's in latest git

Andrew pushed the patch to Linus last night.

Thanks,

Mingming
> -
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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


Re: [PATCH 2/4] ibmveth: Implement ethtool hooks to enable/disable checksum offload

2007-07-19 Thread Ragner Magalhaes
ext Brian King wrote:

> +
> +static int ibmveth_set_rx_csum(struct net_device *dev, u32 data)
> +{
> + struct ibmveth_adapter *adapter = dev->priv;
> +

Why do not to do

if ((data && adapter->rx_csum) || (!data && !adapter->rx_csum))
return 0;
less two lines.

> + if (data && adapter->rx_csum)
> + return 0;
> + if (!data && !adapter->rx_csum)
> + return 0;
> +
> + return ibmveth_set_csum_offload(dev, data, ibmveth_set_rx_csum_flags);
> +}
> +
> +static int ibmveth_set_tx_csum(struct net_device *dev, u32 data)
> +{
> + struct ibmveth_adapter *adapter = dev->priv;
> + int rc = 0;
> +

here also, as above ...
> + if (data && (dev->features & NETIF_F_IP_CSUM))
> + return 0;
> + if (!data && !(dev->features & NETIF_F_IP_CSUM))
> + return 0;
> +
> + if (data && !adapter->rx_csum)
> + rc = ibmveth_set_csum_offload(dev, data, 
> ibmveth_set_tx_csum_flags);
> + else
> + ibmveth_set_tx_csum_flags(dev, data);
> +
> + return rc;
> +}
> +
Best regards,
Ragner
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/4] ibmveth: Implement ethtool hooks to enable/disable checksum offload

2007-07-19 Thread Brian King
Ragner Magalhaes wrote:
> ext Brian King wrote:
> 
>> +
>> +static int ibmveth_set_rx_csum(struct net_device *dev, u32 data)
>> +{
>> +struct ibmveth_adapter *adapter = dev->priv;
>> +
> 
> Why do not to do
> 
>   if ((data && adapter->rx_csum) || (!data && !adapter->rx_csum))
>   return 0;
> less two lines.

Ok.

> 
> here also, as above ...
>> +if (data && (dev->features & NETIF_F_IP_CSUM))
>> +return 0;
>> +if (!data && !(dev->features & NETIF_F_IP_CSUM))
>> +return 0;

This change would make the line > 80 columns, which I prefer to avoid.
Updated patch attached which addresses the first comment.

Thanks,

Brian

---


This patch adds the appropriate ethtool hooks to allow for enabling/disabling
of hypervisor assisted checksum offload for TCP.

Signed-off-by: Brian King <[EMAIL PROTECTED]>
---

 drivers/net/ibmveth.c |  118 +-
 drivers/net/ibmveth.h |1 
 2 files changed, 117 insertions(+), 2 deletions(-)

diff -puN drivers/net/ibmveth.c~ibmveth_csum_offload_ethtool 
drivers/net/ibmveth.c
--- linux-2.6/drivers/net/ibmveth.c~ibmveth_csum_offload_ethtool
2007-07-19 11:15:01.0 -0500
+++ linux-2.6-bjking1/drivers/net/ibmveth.c 2007-07-19 11:17:16.0 
-0500
@@ -641,12 +641,125 @@ static u32 netdev_get_link(struct net_de
return 1;
 }
 
+static void ibmveth_set_rx_csum_flags(struct net_device *dev, u32 data)
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+
+   if (data)
+   adapter->rx_csum = 1;
+   else {
+   adapter->rx_csum = 0;
+   dev->features &= ~NETIF_F_IP_CSUM;
+   }
+}
+
+static void ibmveth_set_tx_csum_flags(struct net_device *dev, u32 data)
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+
+   if (data) {
+   dev->features |= NETIF_F_IP_CSUM;
+   adapter->rx_csum = 1;
+   } else
+   dev->features &= ~NETIF_F_IP_CSUM;
+}
+
+static int ibmveth_set_csum_offload(struct net_device *dev, u32 data,
+   void (*done) (struct net_device *, u32))
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+   union ibmveth_illan_attributes set_attr, clr_attr, ret_attr;
+   long ret;
+   int rc1 = 0, rc2 = 0;
+   int restart = 0;
+
+   if (netif_running(dev)) {
+   restart = 1;
+   adapter->pool_config = 1;
+   ibmveth_close(dev);
+   adapter->pool_config = 0;
+   }
+
+   set_attr.desc = 0;
+   clr_attr.desc = 0;
+
+   if (data)
+   set_attr.fields.tcp_csum_offload_ipv4 = 1;
+   else
+   clr_attr.fields.tcp_csum_offload_ipv4 = 1;
+
+   ret = h_illan_attributes(adapter->vdev->unit_address, 0, 0, 
&ret_attr.desc);
+
+   if (ret == H_SUCCESS && !ret_attr.fields.active_trunk &&
+   !ret_attr.fields.trunk_priority &&
+   ret_attr.fields.csum_offload_padded_pkt_support) {
+   ret = h_illan_attributes(adapter->vdev->unit_address, 
clr_attr.desc,
+set_attr.desc, &ret_attr.desc);
+
+   if (ret != H_SUCCESS) {
+   rc1 = -EIO;
+   ibmveth_error_printk("unable to change checksum offload 
settings."
+" %d rc=%ld\n", data, ret);
+
+   ret = h_illan_attributes(adapter->vdev->unit_address,
+set_attr.desc, clr_attr.desc, 
&ret_attr.desc);
+   } else
+   done(dev, data);
+   } else {
+   rc1 = -EIO;
+   ibmveth_error_printk("unable to change checksum offload 
settings."
+" %d rc=%ld ret_attr=%lx\n", data, ret, 
ret_attr.desc);
+   }
+
+   if (restart)
+   rc2 = ibmveth_open(dev);
+
+   return rc1 ? rc1 : rc2;
+}
+
+static int ibmveth_set_rx_csum(struct net_device *dev, u32 data)
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+
+   if ((data && adapter->rx_csum) || (!data && !adapter->rx_csum))
+   return 0;
+
+   return ibmveth_set_csum_offload(dev, data, ibmveth_set_rx_csum_flags);
+}
+
+static int ibmveth_set_tx_csum(struct net_device *dev, u32 data)
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+   int rc = 0;
+
+   if (data && (dev->features & NETIF_F_IP_CSUM))
+   return 0;
+   if (!data && !(dev->features & NETIF_F_IP_CSUM))
+   return 0;
+
+   if (data && !adapter->rx_csum)
+   rc = ibmveth_set_csum_offload(dev, data, 
ibmveth_set_tx_csum_flags);
+   else
+   ibmveth_set_tx_csum_flags(dev, data);
+
+   return rc;
+}
+
+static u32 ibmveth_get_rx_csum(struct net_device *dev)
+{
+   struct ibmveth_adapter *adapter = dev->priv;
+   return adapter->rx_csum;
+}
+
 static const 

Re: [PATCH 2/4] ibmveth: Implement ethtool hooks to enable/disable checksum offload

2007-07-19 Thread Ragner Magalhaes
ext Brian King wrote:
> Ragner Magalhaes wrote:
>> ext Brian King wrote:
>>
>>> +
>>> +static int ibmveth_set_rx_csum(struct net_device *dev, u32 data)
>>> +{
>>> +   struct ibmveth_adapter *adapter = dev->priv;
>>> +
>> Why do not to do
>>
>>  if ((data && adapter->rx_csum) || (!data && !adapter->rx_csum))
>>  return 0;
>> less two lines.
> 
> Ok.
> 
>> here also, as above ...
>>> +   if (data && (dev->features & NETIF_F_IP_CSUM))
>>> +   return 0;
>>> +   if (!data && !(dev->features & NETIF_F_IP_CSUM))
>>> +   return 0;
> 
> This change would make the line > 80 columns, which I prefer to avoid.
> Updated patch attached which addresses the first comment.
I think would not be ugly to make.

if ((data && (dev->features & NETIF_F_IP_CSUM)) ||
(!data && !(dev->features & NETIF_F_IP_CSUM)))
return 0;

> 
> Thanks,
> 
> Brian
> 
> ---

Thanks,

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


Re: [PATCH 2/4] ibmveth: Implement ethtool hooks to enable/disable checksum offload

2007-07-19 Thread Brian King
Ragner Magalhaes wrote:
> ext Brian King wrote:
>> Ragner Magalhaes wrote:
>>> here also, as above ...
 +  if (data && (dev->features & NETIF_F_IP_CSUM))
 +  return 0;
 +  if (!data && !(dev->features & NETIF_F_IP_CSUM))
 +  return 0;
>> This change would make the line > 80 columns, which I prefer to avoid.
>> Updated patch attached which addresses the first comment.
> I think would not be ugly to make.
> 
>   if ((data && (dev->features & NETIF_F_IP_CSUM)) ||
>   (!data && !(dev->features & NETIF_F_IP_CSUM)))
>   return 0;

I find that less readable than what I currently have.

-Brian

-- 
Brian King
Linux on Power Virtualization
IBM Linux Technology Center
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [2/2] 2.6.22-git: known regressions

2007-07-19 Thread Michal Piotrowski
On 19/07/07, Satyam Sharma <[EMAIL PROTECTED]> wrote:
> > Subject : ext4 build warnings
> > References  : http://lkml.org/lkml/2007/7/18/420
> > Last known good : ?
> > Submitter   : Jeff Garzik <[EMAIL PROTECTED]>
> > Caused-By   : ?
> > Handled-By  : Mingming Cao <[EMAIL PROTECTED]>
> > Status  : unknown
>
> Mingming Cao fixed this:
>
> http://lkml.org/lkml/2007/7/18/564
>
> Dunno if it's in latest git
>

Informations updated. Thanks!

Regards,
Michal

-- 
LOG
http://www.stardust.webpages.pl/log/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [patch 2/3] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-19 Thread Rene Herman
On 07/19/2007 11:47 AM, Andrew Morton wrote:

> On Thu, 19 Jul 2007 11:39:32 +0200 (CEST) Geert Uytterhoeven <[EMAIL 
> PROTECTED]> wrote:
> 
>>> Oh dear.
>>>
>>> ps3rom_priv(dev) = host;
>>>
>>> that's 'orrid.  We have an identifier pretending to be a function, only we
>>> go and treat it as an lvalue.
>>>
>>> I mean, C code should look like C code, and the above just doesn't.
>>>
>>> Sigh.

You could insist that it be PS3ROM_PRIV() because then it at least also 
_looks_ like cpp...

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


Re: [PATCH] Treat ISI faults as read faults on classic 32-bit PowerPC

2007-07-19 Thread Segher Boessenkool
> Hmmm.  The dangling else clauses are pretty gross,

I hoped you wouldn't notice.  I guess I shouldn't have
commented them :-)

"It was the cleanest thing I could come up with".  Every
other thing I tried ended up as a maze of #ifdefs or some
incomprehensible cross-jumping mess; and I was aiming for
a minimal fix, too.

Or, perhaps, it was just a ploy to trick you into writing
a patch yourself.

> and in fact we have
> the same problem on POWER3 and RS64 processors

Right.  Too bad there is no public documentation for either :-/

> (to be fair, we had
> the problem before and didn't notice, but we should still fix it).

Yeah.

> How about this instead?

It's the better way forward, consider my patch withdrawn :-)

> - if (!(vma->vm_flags & VM_EXEC))
> + /*
> +  * Allow execution from readable areas if the MMU does not
> +  * provide separate controls over reading and executing.
> +  */
> + if (!(vma->vm_flags & VM_EXEC) &&
> + (cpu_has_feature(CPU_FTR_NOEXECUTE) ||
> +  !(vma->vm_flags & (VM_READ | VM_WRITE
>   goto bad_area;

Should you really be testing VM_READ|VM_WRITE, or should it just
be VM_READ?

Oh, and that conditional might benefit from being split into
two separate "if" statements, it's a bit hard to read this way.


Segher

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


Re: [PATCH 49/61] 8xx: Update device trees.

2007-07-19 Thread Scott Wood
Segher Boessenkool wrote:
> Since you are using generic names, the only use for the "name"
> of a node is for a human reader to understand your tree.  Maybe
> everyone using this specific SoC knows what a BCSR is; or maybe
> there is a more friendly name you could use.

It's the standard term used in Freescale board documentation.  I could 
change it to board-control, though.

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


Re: [PATCH] Treat ISI faults as read faults on classic 32-bit PowerPC

2007-07-19 Thread Jon Loeliger
On Thu, 2007-07-19 at 12:16, Segher Boessenkool wrote:

> > Tested on 8641HPCN.
> 
> Which glibc versions?  glibc-2.4 and newer are fine without the
> patch already, glibc-2.3 seems to get away by accident; but 2.2
> (and before) are the problematic ones.
> 
> No other userland program has been identified as needing this
> fix, btw -- thankfully, or the testing matrix would be _huge_.
> 
> 
> Segher

Segher,

Needless to say, one that showed the problem beforehand. :-)
But to be precise:

[root:~] ls -lsa /usr/lib/libglib*
   0 lrwxrwxrwx1 18005314 24012  21 Aug 15  2005 
/usr/lib/libglib-1.2.so.0 -> libglib-1.2.so.0.0.10*
 536 -rwxrwxr-x1 18005314 24012  540931 Apr  8  2003 
/usr/lib/libglib-1.2.so.0.0.10*
1064 -rw-rw-r--1 18005314 24012 1084256 Apr  8  2003 /usr/lib/libglib.a
   4 -rwxrwxr-x1 18005314 24012 662 Apr  8  2003 
/usr/lib/libglib.la*
   0 lrwxrwxrwx1 18005314 24012  21 Aug 15  2005 
/usr/lib/libglib.so -> libglib-1.2.so.0.0.10*


Thanks,
jdl


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


Re: [PATCH 3/4] mpc8349emitx: Add chosen node for default stdout path

2007-07-19 Thread Scott Wood
Grant Likely wrote:
> From: Grant Likely <[EMAIL PROTECTED]>
> 
> To boot from a cuImage requires the device tree to have a
> linux,stdout-path property in the chosen node.  This patch adds it
> to the .dts files.

This will break many current u-boots, as they blindly add a /chosen node 
regardless of whether one already exists.

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


Re: [PATCH] Treat ISI faults as read faults on classic 32-bit PowerPC

2007-07-19 Thread Scott Wood
On Thu, Jul 19, 2007 at 01:57:00PM -0500, Jon Loeliger wrote:
> Needless to say, one that showed the problem beforehand. :-)
> But to be precise:
> 
> [root:~] ls -lsa /usr/lib/libglib*
>0 lrwxrwxrwx1 18005314 24012  21 Aug 15  2005 
> /usr/lib/libglib-1.2.so.0 -> libglib-1.2.so.0.0.10*
>  536 -rwxrwxr-x1 18005314 24012  540931 Apr  8  2003 
> /usr/lib/libglib-1.2.so.0.0.10*
> 1064 -rw-rw-r--1 18005314 24012 1084256 Apr  8  2003 
> /usr/lib/libglib.a
>4 -rwxrwxr-x1 18005314 24012 662 Apr  8  2003 
> /usr/lib/libglib.la*
>0 lrwxrwxrwx1 18005314 24012  21 Aug 15  2005 
> /usr/lib/libglib.so -> libglib-1.2.so.0.0.10*

glib != glibc.

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


Re: [PATCH 49/61] 8xx: Update device trees.

2007-07-19 Thread Segher Boessenkool
>> Since you are using generic names, the only use for the "name"
>> of a node is for a human reader to understand your tree.  Maybe
>> everyone using this specific SoC knows what a BCSR is; or maybe
>> there is a more friendly name you could use.
>
> It's the standard term used in Freescale board documentation.  I  
> could change it to board-control, though.

That sounds nice and generic, I like it.


Segher

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


Re: [PATCH] Treat ISI faults as read faults on classic 32-bit PowerPC

2007-07-19 Thread Jon Loeliger
On Thu, 2007-07-19 at 14:02, Scott Wood wrote:

> glib != glibc.
> 
> -Scott

D'oh.

So, It doesn't say what version it is.
But it is also dated 8-Apr-2003.

jdl


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


Re: [2/2] 2.6.22-git: known regressions

2007-07-19 Thread Bartlomiej Zolnierkiewicz
On Thursday 19 July 2007, Michal Piotrowski wrote:

> IDE
> 
> Subject : compile error if CONFIG_BLOCK not enabled related to 
> linux/ide.h include
> References  : http://lkml.org/lkml/2007/7/18/11
> Last known good : ?
> Submitter   : Kumar Gala <[EMAIL PROTECTED]>
> Caused-By   : ?
> Handled-By  : Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
> Status  : unknown

Not a 2.6.22-git regression (CONFIG_BLOCK was added on September 2006) and
Kumar should have a fix really soon - could be removed from the list IMO.

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


Re: [2/2] 2.6.22-git: known regressions

2007-07-19 Thread Michal Piotrowski
On 19/07/07, Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]> wrote:
> On Thursday 19 July 2007, Michal Piotrowski wrote:
>
> > IDE
> >
> > Subject : compile error if CONFIG_BLOCK not enabled related to 
> > linux/ide.h include
> > References  : http://lkml.org/lkml/2007/7/18/11
> > Last known good : ?
> > Submitter   : Kumar Gala <[EMAIL PROTECTED]>
> > Caused-By   : ?
> > Handled-By  : Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
> > Status  : unknown
>
> Not a 2.6.22-git regression (CONFIG_BLOCK was added on September 2006) and
> Kumar should have a fix really soon - could be removed from the list IMO.

Ok, I removed it.

>
> Thanks,
> Bart
>

Regards,
Michal

-- 
LOG
http://www.stardust.webpages.pl/log/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/4] bootwrapper: In cuImage, print message for ENET devices not found in tree

2007-07-19 Thread Grant Likely
From: Grant Likely <[EMAIL PROTECTED]>

Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
CC: Scott Wood <[EMAIL PROTECTED]>
CC: Kumar Gala <[EMAIL PROTECTED]>
---

 arch/powerpc/boot/devtree.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c
index c995155..8000399 100644
--- a/arch/powerpc/boot/devtree.c
+++ b/arch/powerpc/boot/devtree.c
@@ -97,14 +97,14 @@ void __dt_fixup_mac_addresses(u32 startindex, ...)
while ((addr = va_arg(ap, const u8 *))) {
devp = find_node_by_prop_value(NULL, "linux,network-index",
   (void*)&index, sizeof(index));
-
-   printf("ENET%d: local-mac-address <-"
-  " %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
-  addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
-
-   if (devp)
+   if (devp) {
+   printf("ENET%d: local-mac-address <-"
+  " %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
+  addr[0], addr[1], addr[2], addr[3], addr[4], 
addr[5]);
setprop(devp, "local-mac-address", addr, 6);
-
+   } else {
+   printf("ENET%d: no device in tree\n\r", index);
+   }
index++;
}
va_end(ap);
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/4] mpc8349: Add linux,network-index to ethernet nodes in device tree

2007-07-19 Thread Grant Likely
From: Grant Likely <[EMAIL PROTECTED]>

cuImage need to know the logical index of the ethernet devices in order
to assign mac addresses.  This patch adds the needed properties

Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
CC: Scott Wood <[EMAIL PROTECTED]>
CC: Kumar Gala <[EMAIL PROTECTED]>
---

 arch/powerpc/boot/dts/mpc8349emitx.dts   |2 ++
 arch/powerpc/boot/dts/mpc8349emitxgp.dts |1 +
 arch/powerpc/boot/dts/mpc834x_mds.dts|2 ++
 3 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts 
b/arch/powerpc/boot/dts/mpc8349emitx.dts
index ae9bca5..7c13b38 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -141,6 +141,7 @@
interrupts = <20 8 21 8 22 8>;
interrupt-parent = < &ipic >;
phy-handle = < &phy1c >;
+   linux,network-index = <0>;
};
 
[EMAIL PROTECTED] {
@@ -160,6 +161,7 @@
interrupts = <23 8 24 8 25 8>;
interrupt-parent = < &ipic >;
phy-handle = < &phy1f >;
+   linux,network-index = <1>;
};
 
[EMAIL PROTECTED] {
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts 
b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index f636528..3c42902 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -116,6 +116,7 @@
interrupts = <20 8 21 8 22 8>;
interrupt-parent = < &ipic >;
phy-handle = < &phy1c >;
+   linux,network-index = <0>;
};
 
[EMAIL PROTECTED] {
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts 
b/arch/powerpc/boot/dts/mpc834x_mds.dts
index 310e877..13779cd 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -146,6 +146,7 @@
interrupts = <20 8 21 8 22 8>;
interrupt-parent = < &ipic >;
phy-handle = < &phy0 >;
+   linux,network-index = <0>;
};
 
[EMAIL PROTECTED] {
@@ -165,6 +166,7 @@
interrupts = <23 8 24 8 25 8>;
interrupt-parent = < &ipic >;
phy-handle = < &phy1 >;
+   linux,network-index = <1>;
};
 
[EMAIL PROTECTED] {
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 0/4] Series short description

2007-07-19 Thread grant . likely
The following series makes the mpc8349emitx* cuImage work 'out of the box'
Major changes are adding the linux,network-index property to the Ethernet
nodes and adding a default linux,stdout-path to the .dts files.  With
these changes, a cuImage created by 'make mpc834x_itx_defconfig; make zImage'
should boot without changes.

Cheers,
g.

--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 3/4] mpc8349emitx: Add chosen node for default stdout path

2007-07-19 Thread Grant Likely
From: Grant Likely <[EMAIL PROTECTED]>

To boot from a cuImage requires the device tree to have a
linux,stdout-path property in the chosen node.  This patch adds it
to the .dts files.

Signed-of-by: Grant Likely <[EMAIL PROTECTED]>
CC: Scott Wood <[EMAIL PROTECTED]>
CC: Kumar Gala <[EMAIL PROTECTED]>
---

 arch/powerpc/boot/dts/mpc8349emitx.dts   |4 
 arch/powerpc/boot/dts/mpc8349emitxgp.dts |5 +
 arch/powerpc/boot/dts/mpc834x_mds.dts|4 
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts 
b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 7c13b38..7651589 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -250,4 +250,8 @@
device_type = "ipic";
};
};
+
+   chosen {
+   linux,stdout-path = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]";
+   };
 };
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts 
b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index 3c42902..c80fc94 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -181,4 +181,9 @@
device_type = "ipic";
};
};
+
+   chosen {
+   linux,stdout-path = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]";
+   };
 };
+
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts 
b/arch/powerpc/boot/dts/mpc834x_mds.dts
index 13779cd..671dde5 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -338,4 +338,8 @@
device_type = "ipic";
};
};
+
+   chosen {
+   linux,stdout-path = "/[EMAIL PROTECTED]/[EMAIL PROTECTED]";
+   };
 };
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 4/4] mpc8349emitx(gp): update defconfigs for 2.6.23

2007-07-19 Thread Grant Likely
From: Grant Likely <[EMAIL PROTECTED]>

Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
CC: Scott Wood <[EMAIL PROTECTED]>
CC: Kumar Gala <[EMAIL PROTECTED]>
---

 arch/powerpc/configs/mpc834x_itx_defconfig   |  251 +--
 arch/powerpc/configs/mpc834x_itxgp_defconfig |  349 --
 2 files changed, 340 insertions(+), 260 deletions(-)

diff --git a/arch/powerpc/configs/mpc834x_itx_defconfig 
b/arch/powerpc/configs/mpc834x_itx_defconfig
index 85470b8..072c66c 100644
--- a/arch/powerpc/configs/mpc834x_itx_defconfig
+++ b/arch/powerpc/configs/mpc834x_itx_defconfig
@@ -1,9 +1,25 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.22-rc7
-# Sun Jul  1 23:56:56 2007
+# Linux kernel version: 2.6.22
+# Thu Jul 19 12:02:19 2007
 #
 # CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+CONFIG_6xx=y
+# CONFIG_PPC_85xx is not set
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_E200 is not set
+CONFIG_83xx=y
+CONFIG_PPC_FPU=y
+CONFIG_PPC_STD_MMU=y
+CONFIG_PPC_STD_MMU_32=y
+# CONFIG_PPC_MM_SLICES is not set
+# CONFIG_SMP is not set
 CONFIG_PPC32=y
 CONFIG_PPC_MERGE=y
 CONFIG_MMU=y
@@ -14,6 +30,7 @@ CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
 CONFIG_PPC=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_GENERIC_NVRAM=y
@@ -25,28 +42,8 @@ CONFIG_PPC_UDBG_16550=y
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 CONFIG_DEFAULT_UIMAGE=y
-
-#
-# Processor support
-#
-# CONFIG_CLASSIC32 is not set
-# CONFIG_PPC_82xx is not set
-CONFIG_PPC_83xx=y
-# CONFIG_PPC_85xx is not set
-# CONFIG_PPC_86xx is not set
-# CONFIG_PPC_8xx is not set
-# CONFIG_40x is not set
-# CONFIG_44x is not set
-# CONFIG_E200 is not set
-CONFIG_6xx=y
-CONFIG_83xx=y
-CONFIG_PPC_FPU=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
-CONFIG_PPC_STD_MMU=y
-CONFIG_PPC_STD_MMU_32=y
-# CONFIG_PPC_MM_SLICES is not set
-# CONFIG_SMP is not set
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
@@ -63,12 +60,11 @@ CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=y
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
 CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
+# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
@@ -94,30 +90,24 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_SLAB=y
-# CONFIG_SLUB is not set
+# CONFIG_SLUB_DEBUG is not set
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
-
-#
-# Loadable module support
-#
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 # CONFIG_KMOD is not set
-
-#
-# Block layer
-#
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
 
 #
 # IO Schedulers
@@ -135,6 +125,11 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 #
 # Platform support
 #
+# CONFIG_PPC_MULTIPLATFORM is not set
+# CONFIG_EMBEDDED6xx is not set
+# CONFIG_PPC_82xx is not set
+CONFIG_PPC_83xx=y
+# CONFIG_PPC_86xx is not set
 # CONFIG_PPC_MPC52xx is not set
 # CONFIG_PPC_MPC5200 is not set
 # CONFIG_PPC_CELL is not set
@@ -186,12 +181,14 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
 CONFIG_SECCOMP=y
 CONFIG_WANT_DEVICE_TREE=y
-CONFIG_DEVICE_TREE=""
+CONFIG_DEVICE_TREE="mpc8349emitx.dts"
 CONFIG_ISA_DMA_API=y
 
 #
@@ -204,9 +201,11 @@ CONFIG_PPC_INDIRECT_PCI=y
 CONFIG_FSL_SOC=y
 CONFIG_PCI=y
 CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_SYSCALL=y
 # CONFIG_PCIEPORTBUS is not set
 CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_MSI is not set
+# CONFIG_PCI_DEBUG is not set
 
 #
 # PCCARD (PCMCIA/CardBus) support
@@ -313,6 +312,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
 # CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -324,11 +324,9 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
 # CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
@@ -408,20 +406,8 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
 # UBI - Unsorted block images
 #
 # CONFIG_MTD_UBI is not set
-
-#
-# Parallel port support
-#
 # CONFIG_PARPORT is not set
-
-#
-# Plug a

Re: [PATCH 3/4] mpc8349emitx: Add chosen node for default stdout path

2007-07-19 Thread Grant Likely
On 7/19/07, Scott Wood <[EMAIL PROTECTED]> wrote:
> Grant Likely wrote:
> > From: Grant Likely <[EMAIL PROTECTED]>
> >
> > To boot from a cuImage requires the device tree to have a
> > linux,stdout-path property in the chosen node.  This patch adds it
> > to the .dts files.
>
> This will break many current u-boots, as they blindly add a /chosen node
> regardless of whether one already exists.

That really should be fixed then.  In the meantime; I'll resubmit the
patch to add the chosen node; but with it commented out.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


BUG: compile failure on ps3-head.S

2007-07-19 Thread Grant Likely
commit id bafdb645779c63300763acb383f7b9dd2d427228 (on Linus' tree)
causes breakage on my mpc8349 build (see below).  I've worked around
it by removing ps3* from arch/powerpc/boot/Makefile, but I have not
dug into what the 'proper' solution should be.

Cheers,
g.

Toolchain: gcc version 4.0.0 (DENX ELDK 4.0 4.0.0)
Build command: make mpc834x_itxgp_defconfig; make zImage

make ARCH=ppc64 -f scripts/Makefile.build obj=arch/powerpc/boot
arch/powerpc/boot/zImage
  ppc_6xx-gcc -m32 -Wp,-MD,arch/powerpc/boot/.ps3-head.o.d
-D__ASSEMBLY__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -Os -msoft-float -pipe -fomit-frame-pointer
-fno-builtin -fPIC -nostdinc -isystem
/home/opt/eldk-4.0/usr/bin/../lib/gcc/powerpc-linux/4.0.0/include
-traditional -nostdinc -c -o arch/powerpc/boot/ps3-head.o
arch/powerpc/boot/ps3-head.S
arch/powerpc/boot/ps3-head.S: Assembler messages:
arch/powerpc/boot/ps3-head.S:40: Error: Unrecognized opcode: `clrldi'
arch/powerpc/boot/ps3-head.S:41: Error: Unrecognized opcode: `mtmsrd'
make[1]: *** [arch/powerpc/boot/ps3-head.o] Error 1
make: *** [zImage] Error 2


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Powerpc - Include pagemap.h in asm/powerpc/tlb.h

2007-07-19 Thread Kumar Gala

On Jul 19, 2007, at 12:30 AM, Andrew Morton wrote:

> On Fri, 13 Jul 2007 21:20:33 -0400 Mathieu Desnoyers  
> <[EMAIL PROTECTED]> wrote:
>
>> Powerpc - Include pagemap.h in asm/powerpc/tlb.h
>>
>> Fixes this powerpc build error in 2.6.22-rc6-mm1 for powerpc 64 :
>>
>> In file included from include2/asm/tlb.h:60,
>>  from /home/compudj/git/linux-2.6-lttng/arch/ 
>> powerpc/mm/init_64.
>> c:56:
>> /home/compudj/git/linux-2.6-lttng/include/asm-generic/tlb.h: In  
>> function 'tlb_fl
>> ush_mmu':
>> /home/compudj/git/linux-2.6-lttng/include/asm-generic/tlb.h:76:  
>> error: implicit
>> declaration of function 'release_pages'
>> /home/compudj/git/linux-2.6-lttng/include/asm-generic/tlb.h: In  
>> function 'tlb_re
>> move_page':
>> /home/compudj/git/linux-2.6-lttng/include/asm-generic/tlb.h:105:  
>> error: implicit
>>  declaration of function 'page_cache_release'
>
> You have some wordwrapping going on there.
>
>> make[2]: *** [arch/powerpc/mm/init_64.o] Error 1
>>
>> release_pages is declared in linux/pagemap.h, but cannot be  
>> included in
>> linux/swap.h because of a sparc related comment:
>>
>> /* only sparc can not include linux/pagemap.h in this file
>>  * so leave page_cache_release and release_pages undeclared... */
>> #define free_page_and_swap_cache(page) \
>> page_cache_release(page)
>> #define free_pages_and_swap_cache(pages, nr) \
>> release_pages((pages), (nr), 0);
>
> It's always a worry when this happens.  What change made us need this
> inclusion?  How come you're hitting it but I (and test.kernel.org,  
> at least)
> did not?  How come so few other architectures include pagemap.h from
> asm/tlb.h?  Why do header files get into such a mess?
>
>
>> Signed-off-by: Mathieu Desnoyers <[EMAIL PROTECTED]>
>> CC: linuxppc-dev@ozlabs.org
>> CC: Paul Mackerras <[EMAIL PROTECTED]>
>> ---
>>  include/asm-powerpc/tlb.h |2 ++
>>  1 file changed, 2 insertions(+)
>>
>> Index: linux-2.6-lttng/include/asm-powerpc/tlb.h
>> ===
>> --- linux-2.6-lttng.orig/include/asm-powerpc/tlb.h   2007-07-13  
>> 11:30:54.0 -0400
>> +++ linux-2.6-lttng/include/asm-powerpc/tlb.h2007-07-13  
>> 11:31:22.0 -0400
>> @@ -23,6 +23,8 @@
>>  #include 
>>  #endif
>>
>> +#include 
>> +
>>  struct mmu_gather;
>>
>
> Oh well.  I queued it up for someone else to worry over ;)

Andrew,

Are you sending this to linus directly or should this go via paul and  
me?

- k


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


Re: [PATCH 1/2] Fix error checking in Vitesse IRQ config

2007-07-19 Thread Kumar Gala

On Jul 18, 2007, at 1:35 AM, Andy Fleming wrote:

> phy_read() returns a negative number if there's an error, but the
> error-checking code in the Vitesse driver's config_intr function
> triggers if phy_read() returns non-zero.  Correct that.
>
> Signed-off-by: Andy Fleming <[EMAIL PROTECTED]>

Jeff,

Can you make sure to send this to linus since its need to properly  
fix the Vitesse phy's used on the 8641HPCN and 8544 DS boards.

thanks

- k

> ---
> I made a really stupid mistake in the 4 patches I sent out,  
> earlier.  I
> thought those patches had been tested, but they hadn't been.  This one
> corrects a tiny error in the patch, and they have now been tested.   
> As before
> this change can be pulled from:
>
> http://opensource.freescale.com/pub/scm/linux-2.6-85xx.git netdev
>
> Really, REALLY sorry about that.  I have been given a paper bag of  
> appropriate
> size and shape to fit over my head.
>
>  drivers/net/phy/vitesse.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
> index 6a53856..8874497 100644
> --- a/drivers/net/phy/vitesse.c
> +++ b/drivers/net/phy/vitesse.c
> @@ -109,7 +109,7 @@ static int vsc824x_config_intr(struct  
> phy_device *phydev)
>*/
>   err = phy_read(phydev, MII_VSC8244_ISTAT);
>
> - if (err)
> + if (err < 0)
>   return err;
>
>   err = phy_write(phydev, MII_VSC8244_IMASK, 0);
> -- 
> 1.5.0.2.230.gfbe3d-dirty
>
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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


  1   2   >