Commit 26d5aa5a authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.6-rmk

into ppc970.osdl.org:/home/torvalds/v2.5/linux
parents a8a6ec60 585abe04
......@@ -57,6 +57,17 @@ struct image_info_struct {
u32 checksum; /* Image checksum (inc. this struct) */
};
static u32 word_sum(void *words, int num)
{
u32 *p = words;
u32 sum = 0;
while (num--)
sum += *p++;
return sum;
}
static int
afs_read_footer(struct mtd_info *mtd, u_int *img_start, u_int *iis_start,
u_int off, u_int mask)
......@@ -84,6 +95,12 @@ afs_read_footer(struct mtd_info *mtd, u_int *img_start, u_int *iis_start,
if (fs.signature != 0xa0ffff9f)
ret = 0;
/*
* Check the checksum.
*/
if (word_sum(&fs, sizeof(fs) / sizeof(u32)) != 0xffffffff)
ret = 0;
/*
* Don't touch the SIB.
*/
......@@ -114,16 +131,35 @@ static int
afs_read_iis(struct mtd_info *mtd, struct image_info_struct *iis, u_int ptr)
{
size_t sz;
int ret;
int ret, i;
memset(iis, 0, sizeof(*iis));
ret = mtd->read(mtd, ptr, sizeof(*iis), &sz, (u_char *) iis);
if (ret >= 0 && sz != sizeof(*iis))
ret = -EINVAL;
if (ret < 0)
printk(KERN_ERR "AFS: mtd read failed at 0x%x: %d\n",
ptr, ret);
goto failed;
if (sz != sizeof(*iis)) {
ret = -EINVAL;
goto failed;
}
ret = 0;
/*
* Validate the name - it must be NUL terminated.
*/
for (i = 0; i < sizeof(iis->name); i++)
if (iis->name[i] == '\0')
break;
if (i < sizeof(iis->name))
ret = 1;
return ret;
failed:
printk(KERN_ERR "AFS: mtd read failed at 0x%x: %d\n",
ptr, ret);
return ret;
}
......@@ -160,6 +196,8 @@ static int parse_afs_partitions(struct mtd_info *mtd,
ret = afs_read_iis(mtd, &iis, iis_ptr);
if (ret < 0)
break;
if (ret == 0)
continue;
sz += sizeof(struct mtd_partition);
sz += strlen(iis.name) + 1;
......@@ -194,6 +232,8 @@ static int parse_afs_partitions(struct mtd_info *mtd,
ret = afs_read_iis(mtd, &iis, iis_ptr);
if (ret < 0)
break;
if (ret == 0)
continue;
strcpy(str, iis.name);
size = mtd->erasesize + off - img_ptr;
......
/*======================================================================
drivers/mtd/maps/armflash.c: ARM Flash Layout/Partitioning
drivers/mtd/maps/integrator-flash.c: ARM Integrator flash map driver
Copyright (C) 2000 ARM Limited
Copyright (C) 2003 Deep Blue Solutions Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -21,7 +22,7 @@
This is access code for flashes using ARM's flash partitioning
standards.
$Id: integrator-flash.c,v 1.12 2003/05/20 20:59:30 dwmw2 Exp $
$Id: integrator-flash.c,v 1.15 2004/02/27 22:37:39 rmk Exp $
======================================================================*/
......@@ -64,7 +65,7 @@ static void armflash_set_vpp(struct map_info *map, int on)
info->plat->set_vpp(on);
}
static const char *probes[] = { "RedBoot", "afs", NULL };
static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL };
static int armflash_probe(struct device *_dev)
{
......
......@@ -74,7 +74,7 @@ static int __init init_lubbock(void)
lubbock_maps[flashboot].name = "Lubbock Boot ROM";
for (i = 0; i < 2; i++) {
lubbock_maps[i].virt = (unsigned long)__ioremap(lubbock_maps[i].phys, WINDOW_SIZE, 0);
lubbock_maps[i].virt = (unsigned long)ioremap(lubbock_maps[i].phys, WINDOW_SIZE);
if (!lubbock_maps[i].virt) {
printk(KERN_WARNING "Failed to ioremap %s\n", lubbock_maps[i].name);
if (!ret)
......@@ -97,8 +97,8 @@ static int __init init_lubbock(void)
}
mymtds[i]->owner = THIS_MODULE;
int ret = parse_mtd_partitions(mymtds[i], probes,
&parsed_parts[i], 0);
ret = parse_mtd_partitions(mymtds[i], probes,
&parsed_parts[i], 0);
if (ret > 0)
nr_parsed_parts[i] = ret;
......
......@@ -105,7 +105,7 @@ static void dump_hci_status(struct usb_hcd *hcd, const char *label)
}
#endif
static void usb_hcd_sa1111_hcim_irq (int irq, void *__hcd, struct pt_regs * r)
static irqreturn_t usb_hcd_sa1111_hcim_irq (int irq, void *__hcd, struct pt_regs * r)
{
struct usb_hcd *hcd = __hcd;
// unsigned long status = sa1111_readl(hcd->regs + SA1111_USB_STATUS);
......@@ -120,7 +120,7 @@ static void usb_hcd_sa1111_hcim_irq (int irq, void *__hcd, struct pt_regs * r)
}
#endif
usb_hcd_irq(irq, hcd, r);
return usb_hcd_irq(irq, hcd, r);
}
/*-------------------------------------------------------------------------*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment