Skip to contentSkip to conversation

Amiga Zorro updates

PATCH New Geert Uytterhoeven 1 participant 17 messages Oct 16, 2013

Subsystems (8)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

cover Amiga Zorro updates

Here is a set of miscellaneous updates for the Amiga Zorro bus code:
- [1/8] Documentation/zorro.txt: Update path to arch-specific
- [2/8] zorro: Do not allocate zorro_autocon[] statically This reduces memory usage, especially for multi-platform kernels
- [3/8] zorro: Don't fill in dummy names in zorro_name_device()
- [4/8] zorro: Refactor conditional handling of Zorro device
- [5/8] zorro: Let the driver core handle device enumeration
- [6/8] zorro: ZTWO_VADDR() should return "void __iomem *"
- [7/8] zorro/UAPI: Disintegrate include/linux/zorro*.h
This exports the Zorro definitions (again) to bootstraps.
- [8/8] zorro/UAPI: Use proper types (endianness/size) in

All comments are welcome!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#1 lore raw

PATCH 1/8 Documentation/zorro.txt: Update path to arch-specific header files

- Arch-specific headers were moved to arch/<arch/>/include/asm,
- APUS support was dropped a long time ago

---
 Documentation/zorro.txt |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/zorro.txt +1 -1
index d5829d14774a..d17670400564 100644
@@ -95,7 +95,7 @@ The treatment of these regions depends on the type of Zorro space:
 -------------
 
 linux/include/linux/zorro.h
-linux/include/asm-{m68k,ppc}/zorro.h
+linux/arch/m68k/include/asm/zorro.h
 linux/include/linux/zorro_ids.h
 linux/drivers/zorro
 /proc/bus/zorro
Signature · 1 line
1.7.9.5
author maintainer
#2 lore raw

PATCH 1/8 Documentation/zorro.txt: Update path to arch-specific header files

In reply to Geert Uytterhoeven

- Arch-specific headers were moved to arch/<arch/>/include/asm,
- APUS support was dropped a long time ago

---
 Documentation/zorro.txt |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/zorro.txt +1 -1
index d5829d14774a..d17670400564 100644
@@ -95,7 +95,7 @@ The treatment of these regions depends on the type of Zorro space:
 -------------
 
 linux/include/linux/zorro.h
-linux/include/asm-{m68k,ppc}/zorro.h
+linux/arch/m68k/include/asm/zorro.h
 linux/include/linux/zorro_ids.h
 linux/drivers/zorro
 /proc/bus/zorro
Signature · 1 line
1.7.9.5
author maintainer
#3 lore raw

PATCH 2/8 zorro: Do not allocate zorro_autocon[] statically

In reply to Geert Uytterhoeven

Currently the array of Zorro devices is allocated statically, wasting up to 4.5 KiB when running an Amiga or multi-platform kernel on a machine with no or a handful of Zorro expansion cards. Convert it to conditional dynamic memory allocation to fix this.

amiga_parse_bootinfo() still needs to store some information about the detected Zorro devices, at a time even the bootmem allocator is not yet available. This is now handled using a much smaller array (typically less than 0.5 KiB), which is __initdata and thus freed later.

---
 arch/m68k/amiga/config.c   |    6 +++---
 arch/m68k/amiga/platform.c |    4 ++--
 drivers/zorro/zorro.c      |   19 ++++++++++++++++---
 include/linux/zorro.h      |   18 +++++++++++++++++-
 4 files changed, 38 insertions(+), 9 deletions(-)
arch/m68k/amiga/config.c +3 -3
index 93ab423758da..d956ddbfebe1 100644
@@ -174,12 +174,12 @@ int __init amiga_parse_bootinfo(const struct bi_record *record)
 #ifdef CONFIG_ZORRO
 		if (zorro_num_autocon < ZORRO_NUM_AUTO) {
 			const struct ConfigDev *cd = (struct ConfigDev *)data;
-			struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
+			struct zorro_dev_init *dev = &zorro_autocon_init[zorro_num_autocon++];
 			dev->rom = cd->cd_Rom;
 			dev->slotaddr = cd->cd_SlotAddr;
 			dev->slotsize = cd->cd_SlotSize;
-			dev->resource.start = (unsigned long)cd->cd_BoardAddr;
-			dev->resource.end = dev->resource.start + cd->cd_BoardSize - 1;
+			dev->boardaddr = (u32)cd->cd_BoardAddr;
+			dev->boardsize = cd->cd_BoardSize;
 		} else
 			printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
 #endif /* CONFIG_ZORRO */
arch/m68k/amiga/platform.c +2 -2
index dacd9f911f71..7847b2b1b5b6 100644
@@ -67,8 +67,8 @@ static int __init z_dev_present(zorro_id id)
 	unsigned int i;
 
 	for (i = 0; i < zorro_num_autocon; i++)
-		if (zorro_autocon[i].rom.er_Manufacturer == ZORRO_MANUF(id) &&
-		    zorro_autocon[i].rom.er_Product == ZORRO_PROD(id))
+		if (zorro_autocon_init[i].rom.er_Manufacturer == ZORRO_MANUF(id) &&
+		    zorro_autocon_init[i].rom.er_Product == ZORRO_PROD(id))
 			return 1;
 
 	return 0;
drivers/zorro/zorro.c +16 -3
index 858c9714b2f3..10c7f77aec08 100644
@@ -29,7 +29,8 @@
      */
 
 unsigned int zorro_num_autocon;
-struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
+struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata;
+struct zorro_dev *zorro_autocon;
 
 
     /*
@@ -38,6 +39,7 @@ struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
 
 struct zorro_bus {
 	struct device dev;
+	struct zorro_dev devices[0];
 };
 
 
@@ -125,16 +127,20 @@ static struct resource __init *zorro_find_parent_resource(
 static int __init amiga_zorro_probe(struct platform_device *pdev)
 {
 	struct zorro_bus *bus;
+	struct zorro_dev_init *zi;
 	struct zorro_dev *z;
 	struct resource *r;
 	unsigned int i;
 	int error;
 
 	/* Initialize the Zorro bus */
-	bus = kzalloc(sizeof(*bus), GFP_KERNEL);
+	bus = kzalloc(sizeof(*bus) +
+		      zorro_num_autocon * sizeof(bus->devices[0]),
+		      GFP_KERNEL);
 	if (!bus)
 		return -ENOMEM;
 
+	zorro_autocon = bus->devices;
 	bus->dev.parent = &pdev->dev;
 	dev_set_name(&bus->dev, "zorro");
 	error = device_register(&bus->dev);
@@ -151,15 +157,22 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 
 	/* First identify all devices ... */
 	for (i = 0; i < zorro_num_autocon; i++) {
+		zi = &zorro_autocon_init[i];
 		z = &zorro_autocon[i];
+
+		z->rom = zi->rom;
 		z->id = (z->rom.er_Manufacturer<<16) | (z->rom.er_Product<<8);
 		if (z->id == ZORRO_PROD_GVP_EPC_BASE) {
 			/* GVP quirk */
-			unsigned long magic = zorro_resource_start(z)+0x8000;
+			unsigned long magic = zi->boardaddr + 0x8000;
 			z->id |= *(u16 *)ZTWO_VADDR(magic) & GVP_PRODMASK;
 		}
+		z->slotaddr = zi->slotaddr;
+		z->slotsize = zi->slotsize;
 		sprintf(z->name, "Zorro device %08x", z->id);
 		zorro_name_device(z);
+		z->resource.start = zi->boardaddr;
+		z->resource.end = zi->boardaddr + zi->boardsize - 1;
 		z->resource.name = z->name;
 		r = zorro_find_parent_resource(pdev, z);
 		error = request_resource(r, &z->resource);
include/linux/zorro.h +17 -1
index dff42025649b..661cbd2a86ee 100644
@@ -175,7 +175,23 @@ static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z)
 
 
 extern unsigned int zorro_num_autocon;	/* # of autoconfig devices found */
-extern struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
+extern struct zorro_dev *zorro_autocon;
+
+
+    /*
+     * Minimal information about a Zorro device, passed from bootinfo
+     * Only available temporarily, i.e. until initmem has been freed!
+     */
+
+struct zorro_dev_init {
+	struct ExpansionRom rom;
+	u16 slotaddr;
+	u16 slotsize;
+	u32 boardaddr;
+	u32 boardsize;
+};
+
+extern struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata;
 
 
     /*
Signature · 1 line
1.7.9.5
author maintainer
#4 lore raw

PATCH 2/8 zorro: Do not allocate zorro_autocon[] statically

In reply to Geert Uytterhoeven

Currently the array of Zorro devices is allocated statically, wasting up to 4.5 KiB when running an Amiga or multi-platform kernel on a machine with no or a handful of Zorro expansion cards. Convert it to conditional dynamic memory allocation to fix this.

amiga_parse_bootinfo() still needs to store some information about the detected Zorro devices, at a time even the bootmem allocator is not yet available. This is now handled using a much smaller array (typically less than 0.5 KiB), which is __initdata and thus freed later.

---
 arch/m68k/amiga/config.c   |    6 +++---
 arch/m68k/amiga/platform.c |    4 ++--
 drivers/zorro/zorro.c      |   19 ++++++++++++++++---
 include/linux/zorro.h      |   18 +++++++++++++++++-
 4 files changed, 38 insertions(+), 9 deletions(-)
arch/m68k/amiga/config.c +3 -3
index 93ab423758da..d956ddbfebe1 100644
@@ -174,12 +174,12 @@ int __init amiga_parse_bootinfo(const struct bi_record *record)
 #ifdef CONFIG_ZORRO
 		if (zorro_num_autocon < ZORRO_NUM_AUTO) {
 			const struct ConfigDev *cd = (struct ConfigDev *)data;
-			struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
+			struct zorro_dev_init *dev = &zorro_autocon_init[zorro_num_autocon++];
 			dev->rom = cd->cd_Rom;
 			dev->slotaddr = cd->cd_SlotAddr;
 			dev->slotsize = cd->cd_SlotSize;
-			dev->resource.start = (unsigned long)cd->cd_BoardAddr;
-			dev->resource.end = dev->resource.start + cd->cd_BoardSize - 1;
+			dev->boardaddr = (u32)cd->cd_BoardAddr;
+			dev->boardsize = cd->cd_BoardSize;
 		} else
 			printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
 #endif /* CONFIG_ZORRO */
arch/m68k/amiga/platform.c +2 -2
index dacd9f911f71..7847b2b1b5b6 100644
@@ -67,8 +67,8 @@ static int __init z_dev_present(zorro_id id)
 	unsigned int i;
 
 	for (i = 0; i < zorro_num_autocon; i++)
-		if (zorro_autocon[i].rom.er_Manufacturer == ZORRO_MANUF(id) &&
-		    zorro_autocon[i].rom.er_Product == ZORRO_PROD(id))
+		if (zorro_autocon_init[i].rom.er_Manufacturer == ZORRO_MANUF(id) &&
+		    zorro_autocon_init[i].rom.er_Product == ZORRO_PROD(id))
 			return 1;
 
 	return 0;
drivers/zorro/zorro.c +16 -3
index 858c9714b2f3..10c7f77aec08 100644
@@ -29,7 +29,8 @@
      */
 
 unsigned int zorro_num_autocon;
-struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
+struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata;
+struct zorro_dev *zorro_autocon;
 
 
     /*
@@ -38,6 +39,7 @@ struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
 
 struct zorro_bus {
 	struct device dev;
+	struct zorro_dev devices[0];
 };
 
 
@@ -125,16 +127,20 @@ static struct resource __init *zorro_find_parent_resource(
 static int __init amiga_zorro_probe(struct platform_device *pdev)
 {
 	struct zorro_bus *bus;
+	struct zorro_dev_init *zi;
 	struct zorro_dev *z;
 	struct resource *r;
 	unsigned int i;
 	int error;
 
 	/* Initialize the Zorro bus */
-	bus = kzalloc(sizeof(*bus), GFP_KERNEL);
+	bus = kzalloc(sizeof(*bus) +
+		      zorro_num_autocon * sizeof(bus->devices[0]),
+		      GFP_KERNEL);
 	if (!bus)
 		return -ENOMEM;
 
+	zorro_autocon = bus->devices;
 	bus->dev.parent = &pdev->dev;
 	dev_set_name(&bus->dev, "zorro");
 	error = device_register(&bus->dev);
@@ -151,15 +157,22 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 
 	/* First identify all devices ... */
 	for (i = 0; i < zorro_num_autocon; i++) {
+		zi = &zorro_autocon_init[i];
 		z = &zorro_autocon[i];
+
+		z->rom = zi->rom;
 		z->id = (z->rom.er_Manufacturer<<16) | (z->rom.er_Product<<8);
 		if (z->id == ZORRO_PROD_GVP_EPC_BASE) {
 			/* GVP quirk */
-			unsigned long magic = zorro_resource_start(z)+0x8000;
+			unsigned long magic = zi->boardaddr + 0x8000;
 			z->id |= *(u16 *)ZTWO_VADDR(magic) & GVP_PRODMASK;
 		}
+		z->slotaddr = zi->slotaddr;
+		z->slotsize = zi->slotsize;
 		sprintf(z->name, "Zorro device %08x", z->id);
 		zorro_name_device(z);
+		z->resource.start = zi->boardaddr;
+		z->resource.end = zi->boardaddr + zi->boardsize - 1;
 		z->resource.name = z->name;
 		r = zorro_find_parent_resource(pdev, z);
 		error = request_resource(r, &z->resource);
include/linux/zorro.h +17 -1
index dff42025649b..661cbd2a86ee 100644
@@ -175,7 +175,23 @@ static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z)
 
 
 extern unsigned int zorro_num_autocon;	/* # of autoconfig devices found */
-extern struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
+extern struct zorro_dev *zorro_autocon;
+
+
+    /*
+     * Minimal information about a Zorro device, passed from bootinfo
+     * Only available temporarily, i.e. until initmem has been freed!
+     */
+
+struct zorro_dev_init {
+	struct ExpansionRom rom;
+	u16 slotaddr;
+	u16 slotsize;
+	u32 boardaddr;
+	u32 boardsize;
+};
+
+extern struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata;
 
 
     /*
Signature · 1 line
1.7.9.5
author maintainer
#5 lore raw

PATCH 3/8 zorro: Don't fill in dummy names in zorro_name_device()

In reply to Geert Uytterhoeven

If the device is not found in the database, it's not needed to fill in a dummy name. The caller of zorro_name_device() has already taken care of that to support CONFIG_ZORRO_NAMES=n.

---
 drivers/zorro/names.c |    1 -
 1 file changed, 1 deletion(-)
drivers/zorro/names.c +0 -1
index e8517c3d8e82..e44e04c4f29d 100644
@@ -69,7 +69,6 @@ void __init zorro_name_device(struct zorro_dev *dev)
 	} while (--i);
 
 	/* Couldn't find either the manufacturer nor the product */
-	sprintf(name, "Zorro device %08x", dev->id);
 	return;
 
 	match_manuf: {
Signature · 1 line
1.7.9.5
author maintainer
#6 lore raw

PATCH 3/8 zorro: Don't fill in dummy names in zorro_name_device()

In reply to Geert Uytterhoeven

If the device is not found in the database, it's not needed to fill in a dummy name. The caller of zorro_name_device() has already taken care of that to support CONFIG_ZORRO_NAMES=n.

---
 drivers/zorro/names.c |    1 -
 1 file changed, 1 deletion(-)
drivers/zorro/names.c +0 -1
index e8517c3d8e82..e44e04c4f29d 100644
@@ -69,7 +69,6 @@ void __init zorro_name_device(struct zorro_dev *dev)
 	} while (--i);
 
 	/* Couldn't find either the manufacturer nor the product */
-	sprintf(name, "Zorro device %08x", dev->id);
 	return;
 
 	match_manuf: {
Signature · 1 line
1.7.9.5
author maintainer
#7 lore raw

PATCH 4/8 zorro: Refactor conditional handling of Zorro device name database

In reply to Geert Uytterhoeven

Using an empty static inline function in the CONFIG_ZORRO_NAMES=n case allows to drop compilation of names.c.

---
 drivers/zorro/Makefile |    3 ++-
 drivers/zorro/names.c  |   10 ----------
 drivers/zorro/zorro.h  |    5 +++++
 3 files changed, 7 insertions(+), 11 deletions(-)
drivers/zorro/Makefile +2 -1
index f62172603215..7dc5332ff984 100644
@@ -2,8 +2,9 @@
 # Makefile for the Zorro bus specific drivers.
 #
 
-obj-$(CONFIG_ZORRO)	+= zorro.o zorro-driver.o zorro-sysfs.o names.o
+obj-$(CONFIG_ZORRO)	+= zorro.o zorro-driver.o zorro-sysfs.o
 obj-$(CONFIG_PROC_FS)	+= proc.o
+obj-$(CONFIG_ZORRO_NAMES) +=  names.o
 
 hostprogs-y 		:= gen-devlist
 
drivers/zorro/names.c +0 -10
index e44e04c4f29d..6f3fd9903ac3 100644
@@ -15,8 +15,6 @@
 #include <linux/zorro.h>
 
 
-#ifdef CONFIG_ZORRO_NAMES
-
 struct zorro_prod_info {
 	__u16 prod;
 	unsigned short seen;
@@ -97,11 +95,3 @@ void __init zorro_name_device(struct zorro_dev *dev)
 		}
 	}
 }
-
-#else
-
-void __init zorro_name_device(struct zorro_dev *dev)
-{
-}
-
-#endif
drivers/zorro/zorro.h +5 -0
index b682d5ccd63f..34119fb4e560 100644
@@ -1,4 +1,9 @@
 
+#ifdef CONFIG_ZORRO_NAMES
 extern void zorro_name_device(struct zorro_dev *z);
+#else
+static inline void zorro_name_device(struct zorro_dev *dev) { }
+#endif
+
 extern int zorro_create_sysfs_dev_files(struct zorro_dev *z);
 
Signature · 1 line
1.7.9.5
author maintainer
#8 lore raw

PATCH 4/8 zorro: Refactor conditional handling of Zorro device name database

In reply to Geert Uytterhoeven

Using an empty static inline function in the CONFIG_ZORRO_NAMES=n case allows to drop compilation of names.c.

---
 drivers/zorro/Makefile |    3 ++-
 drivers/zorro/names.c  |   10 ----------
 drivers/zorro/zorro.h  |    5 +++++
 3 files changed, 7 insertions(+), 11 deletions(-)
drivers/zorro/Makefile +2 -1
index f62172603215..7dc5332ff984 100644
@@ -2,8 +2,9 @@
 # Makefile for the Zorro bus specific drivers.
 #
 
-obj-$(CONFIG_ZORRO)	+= zorro.o zorro-driver.o zorro-sysfs.o names.o
+obj-$(CONFIG_ZORRO)	+= zorro.o zorro-driver.o zorro-sysfs.o
 obj-$(CONFIG_PROC_FS)	+= proc.o
+obj-$(CONFIG_ZORRO_NAMES) +=  names.o
 
 hostprogs-y 		:= gen-devlist
 
drivers/zorro/names.c +0 -10
index e44e04c4f29d..6f3fd9903ac3 100644
@@ -15,8 +15,6 @@
 #include <linux/zorro.h>
 
 
-#ifdef CONFIG_ZORRO_NAMES
-
 struct zorro_prod_info {
 	__u16 prod;
 	unsigned short seen;
@@ -97,11 +95,3 @@ void __init zorro_name_device(struct zorro_dev *dev)
 		}
 	}
 }
-
-#else
-
-void __init zorro_name_device(struct zorro_dev *dev)
-{
-}
-
-#endif
drivers/zorro/zorro.h +5 -0
index b682d5ccd63f..34119fb4e560 100644
@@ -1,4 +1,9 @@
 
+#ifdef CONFIG_ZORRO_NAMES
 extern void zorro_name_device(struct zorro_dev *z);
+#else
+static inline void zorro_name_device(struct zorro_dev *dev) { }
+#endif
+
 extern int zorro_create_sysfs_dev_files(struct zorro_dev *z);
 
Signature · 1 line
1.7.9.5
author maintainer
#9 lore raw

PATCH 5/8 zorro: Let the driver core handle device enumeration

In reply to Geert Uytterhoeven

Filling in dev_name of the Zorro bus type and dev.id of each device allows the driver core to enumerate devices, so we don't have to do that ourselves.

This changes the names of devices in sysfs from "%02x" to "zorro%u".

Note that filling in dev.id is also needed to support MFD Zorro devices.

---
 drivers/zorro/zorro-driver.c |   11 ++++++-----
 drivers/zorro/zorro.c        |    4 ++--
 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/zorro/zorro-driver.c +6 -5
index ac1db7f1bcab..eacae1434b73 100644
@@ -161,11 +161,12 @@ static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
 }
 
 struct bus_type zorro_bus_type = {
-	.name	= "zorro",
-	.match	= zorro_bus_match,
-	.uevent	= zorro_uevent,
-	.probe	= zorro_device_probe,
-	.remove	= zorro_device_remove,
+	.name     = "zorro",
+	.dev_name = "zorro",
+	.match    = zorro_bus_match,
+	.uevent   = zorro_uevent,
+	.probe    = zorro_device_probe,
+	.remove   = zorro_device_remove,
 };
 EXPORT_SYMBOL(zorro_bus_type);
 
drivers/zorro/zorro.c +2 -2
index 10c7f77aec08..450abf100f06 100644
@@ -142,7 +142,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 
 	zorro_autocon = bus->devices;
 	bus->dev.parent = &pdev->dev;
-	dev_set_name(&bus->dev, "zorro");
+	dev_set_name(&bus->dev, zorro_bus_type.name);
 	error = device_register(&bus->dev);
 	if (error) {
 		pr_err("Zorro: Error registering zorro_bus\n");
@@ -180,9 +180,9 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 			dev_err(&bus->dev,
 				"Address space collision on device %s %pR\n",
 				z->name, &z->resource);
-		dev_set_name(&z->dev, "%02x", i);
 		z->dev.parent = &bus->dev;
 		z->dev.bus = &zorro_bus_type;
+		z->dev.id = i;
 	}
 
 	/* ... then register them */
Signature · 1 line
1.7.9.5
author maintainer
#10 lore raw

PATCH 5/8 zorro: Let the driver core handle device enumeration

In reply to Geert Uytterhoeven

Filling in dev_name of the Zorro bus type and dev.id of each device allows the driver core to enumerate devices, so we don't have to do that ourselves.

This changes the names of devices in sysfs from "%02x" to "zorro%u".

Note that filling in dev.id is also needed to support MFD Zorro devices.

---
 drivers/zorro/zorro-driver.c |   11 ++++++-----
 drivers/zorro/zorro.c        |    4 ++--
 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/zorro/zorro-driver.c +6 -5
index ac1db7f1bcab..eacae1434b73 100644
@@ -161,11 +161,12 @@ static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
 }
 
 struct bus_type zorro_bus_type = {
-	.name	= "zorro",
-	.match	= zorro_bus_match,
-	.uevent	= zorro_uevent,
-	.probe	= zorro_device_probe,
-	.remove	= zorro_device_remove,
+	.name     = "zorro",
+	.dev_name = "zorro",
+	.match    = zorro_bus_match,
+	.uevent   = zorro_uevent,
+	.probe    = zorro_device_probe,
+	.remove   = zorro_device_remove,
 };
 EXPORT_SYMBOL(zorro_bus_type);
 
drivers/zorro/zorro.c +2 -2
index 10c7f77aec08..450abf100f06 100644
@@ -142,7 +142,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 
 	zorro_autocon = bus->devices;
 	bus->dev.parent = &pdev->dev;
-	dev_set_name(&bus->dev, "zorro");
+	dev_set_name(&bus->dev, zorro_bus_type.name);
 	error = device_register(&bus->dev);
 	if (error) {
 		pr_err("Zorro: Error registering zorro_bus\n");
@@ -180,9 +180,9 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 			dev_err(&bus->dev,
 				"Address space collision on device %s %pR\n",
 				z->name, &z->resource);
-		dev_set_name(&z->dev, "%02x", i);
 		z->dev.parent = &bus->dev;
 		z->dev.bus = &zorro_bus_type;
+		z->dev.id = i;
 	}
 
 	/* ... then register them */
Signature · 1 line
1.7.9.5
author maintainer
#11 lore raw

PATCH 6/8 zorro: ZTWO_VADDR() should return "void __iomem *"

In reply to Geert Uytterhoeven

ZTWO_VADDR() converts from physical to virtual I/O addresses, so it should return "void __iomem *" instead of "unsigned long".

This allows to drop several casts, but requires adding a few casts to accomodate legacy driver frameworks that store "unsigned long" I/O addresses.

---
 arch/m68k/amiga/chipram.c             |    2 +-
 arch/m68k/amiga/config.c              |    2 +-
 arch/m68k/include/asm/amigahw.h       |    2 +-
 drivers/block/z2ram.c                 |    4 ++--
 drivers/ide/buddha.c                  |    2 +-
 drivers/net/ethernet/8390/hydra.c     |    2 +-
 drivers/net/ethernet/8390/zorro8390.c |    4 ++--
 drivers/net/ethernet/amd/a2065.c      |    4 ++--
 drivers/net/ethernet/amd/ariadne.c    |    4 ++--
 drivers/parport/parport_mfc3.c        |    2 +-
 drivers/scsi/a2091.c                  |    2 +-
 drivers/scsi/a3000.c                  |    2 +-
 drivers/scsi/a4000t.c                 |    2 +-
 drivers/scsi/gvp11.c                  |    2 +-
 drivers/scsi/zorro7xx.c               |    2 +-
 drivers/video/amifb.c                 |    2 +-
 drivers/video/cirrusfb.c              |    4 ++--
 17 files changed, 22 insertions(+), 22 deletions(-)
arch/m68k/amiga/chipram.c +1 -1
index 99449fbf9a72..ba03cec3f711 100644
@@ -87,7 +87,7 @@ void *amiga_chip_alloc_res(unsigned long size, struct resource *res)
 
 	atomic_sub(size, &chipavail);
 	pr_debug("amiga_chip_alloc_res: returning %pR\n", res);
-	return (void *)ZTWO_VADDR(res->start);
+	return ZTWO_VADDR(res->start);
 }
 
 void amiga_chip_free(void *ptr)
arch/m68k/amiga/config.c +1 -1
index d956ddbfebe1..acd9c1640cfc 100644
@@ -618,7 +618,7 @@ static int __init amiga_savekmsg_setup(char *arg)
 
 	/* Just steal the block, the chipram allocator isn't functional yet */
 	amiga_chip_size -= SAVEKMSG_MAXMEM;
-	savekmsg = (void *)ZTWO_VADDR(CHIP_PHYSADDR + amiga_chip_size);
+	savekmsg = ZTWO_VADDR(CHIP_PHYSADDR + amiga_chip_size);
 	savekmsg->magic1 = SAVEKMSG_MAGIC1;
 	savekmsg->magic2 = SAVEKMSG_MAGIC2;
 	savekmsg->magicptr = ZTWO_PADDR(savekmsg);
arch/m68k/include/asm/amigahw.h +1 -1
index 7a19b5686a4a..3bef0b2ad945 100644
@@ -266,7 +266,7 @@ struct CIA {
 
 #define zTwoBase (0x80000000)
 #define ZTWO_PADDR(x) (((unsigned long)(x))-zTwoBase)
-#define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase)
+#define ZTWO_VADDR(x) ((void __iomem *)(((unsigned long)(x))+zTwoBase))
 
 #define CUSTOM_PHYSADDR     (0xdff000)
 #define amiga_custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR)))
drivers/block/z2ram.c +2 -2
index 5a95baf4b104..8b2a60cee3a0 100644
@@ -116,8 +116,8 @@ get_z2ram( void )
 	if ( test_bit( i, zorro_unused_z2ram ) )
 	{
 	    z2_count++;
-	    z2ram_map[ z2ram_size++ ] = 
-		ZTWO_VADDR( Z2RAM_START ) + ( i << Z2RAM_CHUNKSHIFT );
+	    z2ram_map[z2ram_size++] = (unsigned long)ZTWO_VADDR(Z2RAM_START) +
+				      (i << Z2RAM_CHUNKSHIFT);
 	    clear_bit( i, zorro_unused_z2ram );
 	}
     }
drivers/ide/buddha.c +1 -1
index b1d38590ac01..46eaf58d881b 100644
@@ -198,7 +198,7 @@ fail_base2:
 				continue;
 			}
 		}	  
-		buddha_board = ZTWO_VADDR(board);
+		buddha_board = (unsigned long)ZTWO_VADDR(board);
 		
 		/* write to BUDDHA_IRQ_MR to enable the board IRQ */
 		/* X-Surf doesn't have this.  IRQs are always on */
drivers/net/ethernet/8390/hydra.c +1 -1
index fb3dd4399cf3..f615fdec0f1b 100644
@@ -113,7 +113,7 @@ static const struct net_device_ops hydra_netdev_ops = {
 static int hydra_init(struct zorro_dev *z)
 {
     struct net_device *dev;
-    unsigned long board = ZTWO_VADDR(z->resource.start);
+    unsigned long board = (unsigned long)ZTWO_VADDR(z->resource.start);
     unsigned long ioaddr = board+HYDRA_NIC_BASE;
     const char name[] = "NE2000";
     int start_page, stop_page;
drivers/net/ethernet/8390/zorro8390.c +2 -2
index 85ec4c2d2645..ae2a12b7db62 100644
@@ -287,7 +287,7 @@ static const struct net_device_ops zorro8390_netdev_ops = {
 };
 
 static int zorro8390_init(struct net_device *dev, unsigned long board,
-			  const char *name, unsigned long ioaddr)
+			  const char *name, void __iomem *ioaddr)
 {
 	int i;
 	int err;
@@ -354,7 +354,7 @@ static int zorro8390_init(struct net_device *dev, unsigned long board,
 	start_page = NESM_START_PG;
 	stop_page = NESM_STOP_PG;
 
-	dev->base_addr = ioaddr;
+	dev->base_addr = (unsigned long)ioaddr;
 	dev->irq = IRQ_AMIGA_PORTS;
 
 	/* Install the Interrupt handler */
drivers/net/ethernet/amd/a2065.c +2 -2
index 0866e7627433..f492a19328e5 100644
@@ -713,8 +713,8 @@ static int a2065_init_one(struct zorro_dev *z,
 	dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
 	dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
 	dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
-	dev->base_addr = ZTWO_VADDR(base_addr);
-	dev->mem_start = ZTWO_VADDR(mem_start);
+	dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
+	dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
 	dev->mem_end = dev->mem_start + A2065_RAM_SIZE;
 
 	priv->ll = (volatile struct lance_regs *)dev->base_addr;
drivers/net/ethernet/amd/ariadne.c +2 -2
index c178eb4c8166..33822cb69366 100644
@@ -747,8 +747,8 @@ static int ariadne_init_one(struct zorro_dev *z,
 	dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
 	dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
 	dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
-	dev->base_addr = ZTWO_VADDR(base_addr);
-	dev->mem_start = ZTWO_VADDR(mem_start);
+	dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
+	dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
 	dev->mem_end = dev->mem_start + ARIADNE_RAM_SIZE;
 
 	dev->netdev_ops = &ariadne_netdev_ops;
drivers/parport/parport_mfc3.c +1 -1
index 7578d79b3688..2f650f68af14 100644
@@ -300,7 +300,7 @@ static int __init parport_mfc3_init(void)
 		if (!request_mem_region(piabase, sizeof(struct pia), "PIA"))
 			continue;
 
-		pp = (struct pia *)ZTWO_VADDR(piabase);
+		pp = ZTWO_VADDR(piabase);
 		pp->crb = 0;
 		pp->pddrb = 255; /* all data pins output */
 		pp->crb = PIA_DDR|32|8;
drivers/scsi/a2091.c +1 -1
index 30fa38a0ad39..9176bfbd5745 100644
@@ -201,7 +201,7 @@ static int a2091_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
 	instance->irq = IRQ_AMIGA_PORTS;
 	instance->unique_id = z->slotaddr;
 
-	regs = (struct a2091_scsiregs *)ZTWO_VADDR(z->resource.start);
+	regs = ZTWO_VADDR(z->resource.start);
 	regs->DAWR = DAWR_A2091;
 
 	wdregs.SASR = &regs->SASR;
drivers/scsi/a3000.c +1 -1
index c0f4f4290dd6..dd5b64726ddc 100644
@@ -220,7 +220,7 @@ static int __init amiga_a3000_scsi_probe(struct platform_device *pdev)
 
 	instance->irq = IRQ_AMIGA_PORTS;
 
-	regs = (struct a3000_scsiregs *)ZTWO_VADDR(res->start);
+	regs = ZTWO_VADDR(res->start);
 	regs->DAWR = DAWR_A3000;
 
 	wdregs.SASR = &regs->SASR;
drivers/scsi/a4000t.c +1 -1
index 70c521f79f7c..f5a2ab41543b 100644
@@ -56,7 +56,7 @@ static int __init amiga_a4000t_scsi_probe(struct platform_device *pdev)
 	scsi_addr = res->start + A4000T_SCSI_OFFSET;
 
 	/* Fill in the required pieces of hostdata */
-	hostdata->base = (void __iomem *)ZTWO_VADDR(scsi_addr);
+	hostdata->base = ZTWO_VADDR(scsi_addr);
 	hostdata->clock = 50;
 	hostdata->chip710 = 1;
 	hostdata->dmode_extra = DMODE_FC2;
drivers/scsi/gvp11.c +1 -1
index 2203ac281103..3b6f83ffddc4 100644
@@ -310,7 +310,7 @@ static int gvp11_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
 	if (!request_mem_region(address, 256, "wd33c93"))
 		return -EBUSY;
 
-	regs = (struct gvp11_scsiregs *)(ZTWO_VADDR(address));
+	regs = ZTWO_VADDR(address);
 
 	error = check_wd33c93(regs);
 	if (error)
drivers/scsi/zorro7xx.c +1 -1
index cbf3476c68cd..aff31991aea9 100644
@@ -104,7 +104,7 @@ static int zorro7xx_init_one(struct zorro_dev *z,
 	if (ioaddr > 0x01000000)
 		hostdata->base = ioremap(ioaddr, zorro_resource_len(z));
 	else
-		hostdata->base = (void __iomem *)ZTWO_VADDR(ioaddr);
+		hostdata->base = ZTWO_VADDR(ioaddr);
 
 	hostdata->clock = 50;
 	hostdata->chip710 = 1;
drivers/video/amifb.c +1 -1
index a6780eecff0e..81ba95fd2b3b 100644
@@ -3710,7 +3710,7 @@ default_chipset:
 	if (!videomemory) {
 		dev_warn(&pdev->dev,
 			 "Unable to map videomem cached writethrough\n");
-		info->screen_base = (char *)ZTWO_VADDR(info->fix.smem_start);
+		info->screen_base = ZTWO_VADDR(info->fix.smem_start);
 	} else
 		info->screen_base = (char *)videomemory;
 
drivers/video/cirrusfb.c +2 -2
index 97db3ba8f237..ce910327cc8e 100644
@@ -2262,7 +2262,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z,
 
 	info->fix.mmio_start = regbase;
 	cinfo->regbase = regbase > 16 * MB_ ? ioremap(regbase, 64 * 1024)
-					    : (caddr_t)ZTWO_VADDR(regbase);
+					    : ZTWO_VADDR(regbase);
 	if (!cinfo->regbase) {
 		dev_err(info->device, "Cannot map registers\n");
 		error = -EIO;
@@ -2272,7 +2272,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z,
 	info->fix.smem_start = rambase;
 	info->screen_size = ramsize;
 	info->screen_base = rambase > 16 * MB_ ? ioremap(rambase, ramsize)
-					       : (caddr_t)ZTWO_VADDR(rambase);
+					       : ZTWO_VADDR(rambase);
 	if (!info->screen_base) {
 		dev_err(info->device, "Cannot map video RAM\n");
 		error = -EIO;
Signature · 1 line
1.7.9.5
author maintainer
#12 lore raw

PATCH 6/8 zorro: ZTWO_VADDR() should return "void __iomem *"

In reply to Geert Uytterhoeven

ZTWO_VADDR() converts from physical to virtual I/O addresses, so it should return "void __iomem *" instead of "unsigned long".

This allows to drop several casts, but requires adding a few casts to accomodate legacy driver frameworks that store "unsigned long" I/O addresses.

---
 arch/m68k/amiga/chipram.c             |    2 +-
 arch/m68k/amiga/config.c              |    2 +-
 arch/m68k/include/asm/amigahw.h       |    2 +-
 drivers/block/z2ram.c                 |    4 ++--
 drivers/ide/buddha.c                  |    2 +-
 drivers/net/ethernet/8390/hydra.c     |    2 +-
 drivers/net/ethernet/8390/zorro8390.c |    4 ++--
 drivers/net/ethernet/amd/a2065.c      |    4 ++--
 drivers/net/ethernet/amd/ariadne.c    |    4 ++--
 drivers/parport/parport_mfc3.c        |    2 +-
 drivers/scsi/a2091.c                  |    2 +-
 drivers/scsi/a3000.c                  |    2 +-
 drivers/scsi/a4000t.c                 |    2 +-
 drivers/scsi/gvp11.c                  |    2 +-
 drivers/scsi/zorro7xx.c               |    2 +-
 drivers/video/amifb.c                 |    2 +-
 drivers/video/cirrusfb.c              |    4 ++--
 17 files changed, 22 insertions(+), 22 deletions(-)
arch/m68k/amiga/chipram.c +1 -1
index 99449fbf9a72..ba03cec3f711 100644
@@ -87,7 +87,7 @@ void *amiga_chip_alloc_res(unsigned long size, struct resource *res)
 
 	atomic_sub(size, &chipavail);
 	pr_debug("amiga_chip_alloc_res: returning %pR\n", res);
-	return (void *)ZTWO_VADDR(res->start);
+	return ZTWO_VADDR(res->start);
 }
 
 void amiga_chip_free(void *ptr)
arch/m68k/amiga/config.c +1 -1
index d956ddbfebe1..acd9c1640cfc 100644
@@ -618,7 +618,7 @@ static int __init amiga_savekmsg_setup(char *arg)
 
 	/* Just steal the block, the chipram allocator isn't functional yet */
 	amiga_chip_size -= SAVEKMSG_MAXMEM;
-	savekmsg = (void *)ZTWO_VADDR(CHIP_PHYSADDR + amiga_chip_size);
+	savekmsg = ZTWO_VADDR(CHIP_PHYSADDR + amiga_chip_size);
 	savekmsg->magic1 = SAVEKMSG_MAGIC1;
 	savekmsg->magic2 = SAVEKMSG_MAGIC2;
 	savekmsg->magicptr = ZTWO_PADDR(savekmsg);
arch/m68k/include/asm/amigahw.h +1 -1
index 7a19b5686a4a..3bef0b2ad945 100644
@@ -266,7 +266,7 @@ struct CIA {
 
 #define zTwoBase (0x80000000)
 #define ZTWO_PADDR(x) (((unsigned long)(x))-zTwoBase)
-#define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase)
+#define ZTWO_VADDR(x) ((void __iomem *)(((unsigned long)(x))+zTwoBase))
 
 #define CUSTOM_PHYSADDR     (0xdff000)
 #define amiga_custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR)))
drivers/block/z2ram.c +2 -2
index 5a95baf4b104..8b2a60cee3a0 100644
@@ -116,8 +116,8 @@ get_z2ram( void )
 	if ( test_bit( i, zorro_unused_z2ram ) )
 	{
 	    z2_count++;
-	    z2ram_map[ z2ram_size++ ] = 
-		ZTWO_VADDR( Z2RAM_START ) + ( i << Z2RAM_CHUNKSHIFT );
+	    z2ram_map[z2ram_size++] = (unsigned long)ZTWO_VADDR(Z2RAM_START) +
+				      (i << Z2RAM_CHUNKSHIFT);
 	    clear_bit( i, zorro_unused_z2ram );
 	}
     }
drivers/ide/buddha.c +1 -1
index b1d38590ac01..46eaf58d881b 100644
@@ -198,7 +198,7 @@ fail_base2:
 				continue;
 			}
 		}	  
-		buddha_board = ZTWO_VADDR(board);
+		buddha_board = (unsigned long)ZTWO_VADDR(board);
 		
 		/* write to BUDDHA_IRQ_MR to enable the board IRQ */
 		/* X-Surf doesn't have this.  IRQs are always on */
drivers/net/ethernet/8390/hydra.c +1 -1
index fb3dd4399cf3..f615fdec0f1b 100644
@@ -113,7 +113,7 @@ static const struct net_device_ops hydra_netdev_ops = {
 static int hydra_init(struct zorro_dev *z)
 {
     struct net_device *dev;
-    unsigned long board = ZTWO_VADDR(z->resource.start);
+    unsigned long board = (unsigned long)ZTWO_VADDR(z->resource.start);
     unsigned long ioaddr = board+HYDRA_NIC_BASE;
     const char name[] = "NE2000";
     int start_page, stop_page;
drivers/net/ethernet/8390/zorro8390.c +2 -2
index 85ec4c2d2645..ae2a12b7db62 100644
@@ -287,7 +287,7 @@ static const struct net_device_ops zorro8390_netdev_ops = {
 };
 
 static int zorro8390_init(struct net_device *dev, unsigned long board,
-			  const char *name, unsigned long ioaddr)
+			  const char *name, void __iomem *ioaddr)
 {
 	int i;
 	int err;
@@ -354,7 +354,7 @@ static int zorro8390_init(struct net_device *dev, unsigned long board,
 	start_page = NESM_START_PG;
 	stop_page = NESM_STOP_PG;
 
-	dev->base_addr = ioaddr;
+	dev->base_addr = (unsigned long)ioaddr;
 	dev->irq = IRQ_AMIGA_PORTS;
 
 	/* Install the Interrupt handler */
drivers/net/ethernet/amd/a2065.c +2 -2
index 0866e7627433..f492a19328e5 100644
@@ -713,8 +713,8 @@ static int a2065_init_one(struct zorro_dev *z,
 	dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
 	dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
 	dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
-	dev->base_addr = ZTWO_VADDR(base_addr);
-	dev->mem_start = ZTWO_VADDR(mem_start);
+	dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
+	dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
 	dev->mem_end = dev->mem_start + A2065_RAM_SIZE;
 
 	priv->ll = (volatile struct lance_regs *)dev->base_addr;
drivers/net/ethernet/amd/ariadne.c +2 -2
index c178eb4c8166..33822cb69366 100644
@@ -747,8 +747,8 @@ static int ariadne_init_one(struct zorro_dev *z,
 	dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
 	dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
 	dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
-	dev->base_addr = ZTWO_VADDR(base_addr);
-	dev->mem_start = ZTWO_VADDR(mem_start);
+	dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
+	dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
 	dev->mem_end = dev->mem_start + ARIADNE_RAM_SIZE;
 
 	dev->netdev_ops = &ariadne_netdev_ops;
drivers/parport/parport_mfc3.c +1 -1
index 7578d79b3688..2f650f68af14 100644
@@ -300,7 +300,7 @@ static int __init parport_mfc3_init(void)
 		if (!request_mem_region(piabase, sizeof(struct pia), "PIA"))
 			continue;
 
-		pp = (struct pia *)ZTWO_VADDR(piabase);
+		pp = ZTWO_VADDR(piabase);
 		pp->crb = 0;
 		pp->pddrb = 255; /* all data pins output */
 		pp->crb = PIA_DDR|32|8;
drivers/scsi/a2091.c +1 -1
index 30fa38a0ad39..9176bfbd5745 100644
@@ -201,7 +201,7 @@ static int a2091_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
 	instance->irq = IRQ_AMIGA_PORTS;
 	instance->unique_id = z->slotaddr;
 
-	regs = (struct a2091_scsiregs *)ZTWO_VADDR(z->resource.start);
+	regs = ZTWO_VADDR(z->resource.start);
 	regs->DAWR = DAWR_A2091;
 
 	wdregs.SASR = &regs->SASR;
drivers/scsi/a3000.c +1 -1
index c0f4f4290dd6..dd5b64726ddc 100644
@@ -220,7 +220,7 @@ static int __init amiga_a3000_scsi_probe(struct platform_device *pdev)
 
 	instance->irq = IRQ_AMIGA_PORTS;
 
-	regs = (struct a3000_scsiregs *)ZTWO_VADDR(res->start);
+	regs = ZTWO_VADDR(res->start);
 	regs->DAWR = DAWR_A3000;
 
 	wdregs.SASR = &regs->SASR;
drivers/scsi/a4000t.c +1 -1
index 70c521f79f7c..f5a2ab41543b 100644
@@ -56,7 +56,7 @@ static int __init amiga_a4000t_scsi_probe(struct platform_device *pdev)
 	scsi_addr = res->start + A4000T_SCSI_OFFSET;
 
 	/* Fill in the required pieces of hostdata */
-	hostdata->base = (void __iomem *)ZTWO_VADDR(scsi_addr);
+	hostdata->base = ZTWO_VADDR(scsi_addr);
 	hostdata->clock = 50;
 	hostdata->chip710 = 1;
 	hostdata->dmode_extra = DMODE_FC2;
drivers/scsi/gvp11.c +1 -1
index 2203ac281103..3b6f83ffddc4 100644
@@ -310,7 +310,7 @@ static int gvp11_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
 	if (!request_mem_region(address, 256, "wd33c93"))
 		return -EBUSY;
 
-	regs = (struct gvp11_scsiregs *)(ZTWO_VADDR(address));
+	regs = ZTWO_VADDR(address);
 
 	error = check_wd33c93(regs);
 	if (error)
drivers/scsi/zorro7xx.c +1 -1
index cbf3476c68cd..aff31991aea9 100644
@@ -104,7 +104,7 @@ static int zorro7xx_init_one(struct zorro_dev *z,
 	if (ioaddr > 0x01000000)
 		hostdata->base = ioremap(ioaddr, zorro_resource_len(z));
 	else
-		hostdata->base = (void __iomem *)ZTWO_VADDR(ioaddr);
+		hostdata->base = ZTWO_VADDR(ioaddr);
 
 	hostdata->clock = 50;
 	hostdata->chip710 = 1;
drivers/video/amifb.c +1 -1
index a6780eecff0e..81ba95fd2b3b 100644
@@ -3710,7 +3710,7 @@ default_chipset:
 	if (!videomemory) {
 		dev_warn(&pdev->dev,
 			 "Unable to map videomem cached writethrough\n");
-		info->screen_base = (char *)ZTWO_VADDR(info->fix.smem_start);
+		info->screen_base = ZTWO_VADDR(info->fix.smem_start);
 	} else
 		info->screen_base = (char *)videomemory;
 
drivers/video/cirrusfb.c +2 -2
index 97db3ba8f237..ce910327cc8e 100644
@@ -2262,7 +2262,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z,
 
 	info->fix.mmio_start = regbase;
 	cinfo->regbase = regbase > 16 * MB_ ? ioremap(regbase, 64 * 1024)
-					    : (caddr_t)ZTWO_VADDR(regbase);
+					    : ZTWO_VADDR(regbase);
 	if (!cinfo->regbase) {
 		dev_err(info->device, "Cannot map registers\n");
 		error = -EIO;
@@ -2272,7 +2272,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z,
 	info->fix.smem_start = rambase;
 	info->screen_size = ramsize;
 	info->screen_base = rambase > 16 * MB_ ? ioremap(rambase, ramsize)
-					       : (caddr_t)ZTWO_VADDR(rambase);
+					       : ZTWO_VADDR(rambase);
 	if (!info->screen_base) {
 		dev_err(info->device, "Cannot map video RAM\n");
 		error = -EIO;
Signature · 1 line
1.7.9.5
author maintainer
#13 lore raw

PATCH 7/8 zorro/UAPI: Disintegrate include/linux/zorro*.h

In reply to Geert Uytterhoeven

The Zorro definitions and device IDs are used by bootstraps, hence they should be exported through UAPI.

Unfortunately zorro.h was never marked for export when headers_install was introduced, so it was forgotten during the big UAPI disintegration. In addition, the removal of zorro_ids.h had been sneaked into commit 7e7a43c32a8970ea2bfc3d1af353dcb1a9237769 ("PCI: don't export device IDs to userspace") before, so it was also forgotten.

Split off and export the Zorro definitions used by bootstraps.

---
 Documentation/zorro.txt              |    3 +-
 include/linux/zorro.h                |  103 +------------------------------
 include/uapi/linux/Kbuild            |    2 +
 include/uapi/linux/zorro.h           |  113 ++++++++++++++++++++++++++++++++++
 include/{ => uapi}/linux/zorro_ids.h |    0
 5 files changed, 119 insertions(+), 102 deletions(-)
 create mode 100644 include/uapi/linux/zorro.h
 rename include/{ => uapi}/linux/zorro_ids.h (100%)
Documentation/zorro.txt +2 -1
index d17670400564..90a64d52bea2 100644
@@ -95,8 +95,9 @@ The treatment of these regions depends on the type of Zorro space:
 -------------
 
 linux/include/linux/zorro.h
+linux/include/uapi/linux/zorro.h
+linux/include/uapi/linux/zorro_ids.h
 linux/arch/m68k/include/asm/zorro.h
-linux/include/linux/zorro_ids.h
 linux/drivers/zorro
 /proc/bus/zorro
 
include/linux/zorro.h +2 -101

115 lines not on this page · raw message

include/uapi/linux/Kbuild +2 -0
index 115add2515aa..5b973b187eeb 100644
@@ -424,3 +424,5 @@ header-y += x25.h
 header-y += xattr.h
 header-y += xfrm.h
 header-y += hw_breakpoint.h
+header-y += zorro.h
+header-y += zorro_ids.h
include/uapi/linux/zorro.h new file +113 -0

113 lines not on this page · raw message

include/uapi/linux/zorro_ids.h renamed from include/linux/zorro_ids.h +0 -0
similarity index 100%
rename from include/linux/zorro_ids.h
rename to include/uapi/linux/zorro_ids.h
Signature · 1 line
1.7.9.5
author maintainer
#14 lore raw

PATCH 7/8 zorro/UAPI: Disintegrate include/linux/zorro*.h

In reply to Geert Uytterhoeven

The Zorro definitions and device IDs are used by bootstraps, hence they should be exported through UAPI.

Unfortunately zorro.h was never marked for export when headers_install was introduced, so it was forgotten during the big UAPI disintegration. In addition, the removal of zorro_ids.h had been sneaked into commit 7e7a43c32a8970ea2bfc3d1af353dcb1a9237769 ("PCI: don't export device IDs to userspace") before, so it was also forgotten.

Split off and export the Zorro definitions used by bootstraps.

---
 Documentation/zorro.txt              |    3 +-
 include/linux/zorro.h                |  103 +------------------------------
 include/uapi/linux/Kbuild            |    2 +
 include/uapi/linux/zorro.h           |  113 ++++++++++++++++++++++++++++++++++
 include/{ => uapi}/linux/zorro_ids.h |    0
 5 files changed, 119 insertions(+), 102 deletions(-)
 create mode 100644 include/uapi/linux/zorro.h
 rename include/{ => uapi}/linux/zorro_ids.h (100%)
Documentation/zorro.txt +2 -1
index d17670400564..90a64d52bea2 100644
@@ -95,8 +95,9 @@ The treatment of these regions depends on the type of Zorro space:
 -------------
 
 linux/include/linux/zorro.h
+linux/include/uapi/linux/zorro.h
+linux/include/uapi/linux/zorro_ids.h
 linux/arch/m68k/include/asm/zorro.h
-linux/include/linux/zorro_ids.h
 linux/drivers/zorro
 /proc/bus/zorro
 
include/linux/zorro.h +2 -101

115 lines not on this page · raw message

include/uapi/linux/Kbuild +2 -0
index 115add2515aa..5b973b187eeb 100644
@@ -424,3 +424,5 @@ header-y += x25.h
 header-y += xattr.h
 header-y += xfrm.h
 header-y += hw_breakpoint.h
+header-y += zorro.h
+header-y += zorro_ids.h
include/uapi/linux/zorro.h new file +113 -0

113 lines not on this page · raw message

include/uapi/linux/zorro_ids.h renamed from include/linux/zorro_ids.h +0 -0
similarity index 100%
rename from include/linux/zorro_ids.h
rename to include/uapi/linux/zorro_ids.h
Signature · 1 line
1.7.9.5
author maintainer
#15 lore raw

PATCH 8/8 zorro/UAPI: Use proper types (endianness/size) in <linux/zorro.h>

In reply to Geert Uytterhoeven

Fix member definitions for non-native userspace handling:
- All multi-byte values are big-endian, hence use __be*,
- All pointers are 32-bit pointers under AmigaOS, but unused (except for cd_BoardAddr) under Linux, hence use __be32.

---
 arch/m68k/amiga/config.c           |    9 +++----
 arch/m68k/amiga/platform.c         |    9 ++++---
 drivers/net/ethernet/amd/a2065.c   |    9 ++++---
 drivers/net/ethernet/amd/ariadne.c |    9 ++++---
 drivers/zorro/proc.c               |   10 ++++----
 drivers/zorro/zorro-sysfs.c        |   22 +++++++++++++----
 drivers/zorro/zorro.c              |    4 +++-
 include/uapi/linux/zorro.h         |   46 ++++++++++++++++++------------------
 8 files changed, 72 insertions(+), 46 deletions(-)
arch/m68k/amiga/config.c +5 -4
index acd9c1640cfc..65b5e937ebba 100644
@@ -28,6 +28,7 @@
 #include <linux/keyboard.h>
 
 #include <asm/bootinfo.h>
+#include <asm/byteorder.h>
 #include <asm/setup.h>
 #include <asm/pgtable.h>
 #include <asm/amigahw.h>
@@ -176,10 +177,10 @@ int __init amiga_parse_bootinfo(const struct bi_record *record)
 			const struct ConfigDev *cd = (struct ConfigDev *)data;
 			struct zorro_dev_init *dev = &zorro_autocon_init[zorro_num_autocon++];
 			dev->rom = cd->cd_Rom;
-			dev->slotaddr = cd->cd_SlotAddr;
-			dev->slotsize = cd->cd_SlotSize;
-			dev->boardaddr = (u32)cd->cd_BoardAddr;
-			dev->boardsize = cd->cd_BoardSize;
+			dev->slotaddr = be16_to_cpu(cd->cd_SlotAddr);
+			dev->slotsize = be16_to_cpu(cd->cd_SlotSize);
+			dev->boardaddr = be32_to_cpu(cd->cd_BoardAddr);
+			dev->boardsize = be32_to_cpu(cd->cd_BoardSize);
 		} else
 			printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
 #endif /* CONFIG_ZORRO */
arch/m68k/amiga/platform.c +6 -3
index 7847b2b1b5b6..d34029d7b058 100644
@@ -13,6 +13,7 @@
 
 #include <asm/amigahw.h>
 #include <asm/amigayle.h>
+#include <asm/byteorder.h>
 
 
 #ifdef CONFIG_ZORRO
@@ -66,10 +67,12 @@ static int __init z_dev_present(zorro_id id)
 {
 	unsigned int i;
 
-	for (i = 0; i < zorro_num_autocon; i++)
-		if (zorro_autocon_init[i].rom.er_Manufacturer == ZORRO_MANUF(id) &&
-		    zorro_autocon_init[i].rom.er_Product == ZORRO_PROD(id))
+	for (i = 0; i < zorro_num_autocon; i++) {
+		const struct ExpansionRom *rom = &zorro_autocon_init[i].rom;
+		if (be16_to_cpu(rom->er_Manufacturer) == ZORRO_MANUF(id) &&
+		    rom->er_Product == ZORRO_PROD(id))
 			return 1;
+	}
 
 	return 0;
 }
drivers/net/ethernet/amd/a2065.c +6 -3
index f492a19328e5..56139184b801 100644
@@ -57,6 +57,7 @@
 #include <linux/zorro.h>
 #include <linux/bitops.h>
 
+#include <asm/byteorder.h>
 #include <asm/irq.h>
 #include <asm/amigaints.h>
 #include <asm/amigahw.h>
@@ -678,6 +679,7 @@ static int a2065_init_one(struct zorro_dev *z,
 	unsigned long base_addr = board + A2065_LANCE;
 	unsigned long mem_start = board + A2065_RAM;
 	struct resource *r1, *r2;
+	u32 serial;
 	int err;
 
 	r1 = request_mem_region(base_addr, sizeof(struct lance_regs),
@@ -702,6 +704,7 @@ static int a2065_init_one(struct zorro_dev *z,
 	r1->name = dev->name;
 	r2->name = dev->name;
 
+	serial = be32_to_cpu(z->rom.er_SerialNumber);
 	dev->dev_addr[0] = 0x00;
 	if (z->id != ZORRO_PROD_AMERISTAR_A2065) {	/* Commodore */
 		dev->dev_addr[1] = 0x80;
@@ -710,9 +713,9 @@ static int a2065_init_one(struct zorro_dev *z,
 		dev->dev_addr[1] = 0x00;
 		dev->dev_addr[2] = 0x9f;
 	}
-	dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
-	dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
-	dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
+	dev->dev_addr[3] = (serial >> 16) & 0xff;
+	dev->dev_addr[4] = (serial >> 8) & 0xff;
+	dev->dev_addr[5] = serial & 0xff;
 	dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
 	dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
 	dev->mem_end = dev->mem_start + A2065_RAM_SIZE;
drivers/net/ethernet/amd/ariadne.c +6 -3
index 33822cb69366..b08101b31b8b 100644
@@ -51,6 +51,7 @@
 #include <linux/zorro.h>
 #include <linux/bitops.h>
 
+#include <asm/byteorder.h>
 #include <asm/amigaints.h>
 #include <asm/amigahw.h>
 #include <asm/irq.h>
@@ -718,6 +719,7 @@ static int ariadne_init_one(struct zorro_dev *z,
 	struct resource *r1, *r2;
 	struct net_device *dev;
 	struct ariadne_private *priv;
+	u32 serial;
 	int err;
 
 	r1 = request_mem_region(base_addr, sizeof(struct Am79C960), "Am79C960");
@@ -741,12 +743,13 @@ static int ariadne_init_one(struct zorro_dev *z,
 	r1->name = dev->name;
 	r2->name = dev->name;
 
+	serial = be32_to_cpu(z->rom.er_SerialNumber);
 	dev->dev_addr[0] = 0x00;
 	dev->dev_addr[1] = 0x60;
 	dev->dev_addr[2] = 0x30;
-	dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
-	dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
-	dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
+	dev->dev_addr[3] = (serial >> 16) & 0xff;
+	dev->dev_addr[4] = (serial >> 8) & 0xff;
+	dev->dev_addr[5] = serial & 0xff;
 	dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
 	dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
 	dev->mem_end = dev->mem_start + ARIADNE_RAM_SIZE;
drivers/zorro/proc.c +6 -4
index ea1ce822a8e0..6ac2579da0eb 100644
@@ -14,6 +14,8 @@
 #include <linux/seq_file.h>
 #include <linux/init.h>
 #include <linux/export.h>
+
+#include <asm/byteorder.h>
 #include <asm/uaccess.h>
 #include <asm/amigahw.h>
 #include <asm/setup.h>
@@ -41,10 +43,10 @@ proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *
 	/* Construct a ConfigDev */
 	memset(&cd, 0, sizeof(cd));
 	cd.cd_Rom = z->rom;
-	cd.cd_SlotAddr = z->slotaddr;
-	cd.cd_SlotSize = z->slotsize;
-	cd.cd_BoardAddr = (void *)zorro_resource_start(z);
-	cd.cd_BoardSize = zorro_resource_len(z);
+	cd.cd_SlotAddr = cpu_to_be16(z->slotaddr);
+	cd.cd_SlotSize = cpu_to_be16(z->slotsize);
+	cd.cd_BoardAddr = cpu_to_be32(zorro_resource_start(z));
+	cd.cd_BoardSize = cpu_to_be32(zorro_resource_len(z));
 
 	if (copy_to_user(buf, (void *)&cd + pos, nbytes))
 		return -EFAULT;
drivers/zorro/zorro-sysfs.c +17 -5
index 26f7184ef9e1..36b210f9b6b2 100644
@@ -16,6 +16,8 @@
 #include <linux/stat.h>
 #include <linux/string.h>
 
+#include <asm/byteorder.h>
+
 #include "zorro.h"
 
 
@@ -33,10 +35,20 @@ static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
 
 zorro_config_attr(id, id, "0x%08x\n");
 zorro_config_attr(type, rom.er_Type, "0x%02x\n");
-zorro_config_attr(serial, rom.er_SerialNumber, "0x%08x\n");
 zorro_config_attr(slotaddr, slotaddr, "0x%04x\n");
 zorro_config_attr(slotsize, slotsize, "0x%04x\n");
 
+static ssize_t
+show_serial(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct zorro_dev *z;
+
+	z = to_zorro_dev(dev);
+	return sprintf(buf, "0x%08x\n", be32_to_cpu(z->rom.er_SerialNumber));
+}
+
+static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL);
+
 static ssize_t zorro_show_resource(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct zorro_dev *z = to_zorro_dev(dev);
@@ -60,10 +72,10 @@ static ssize_t zorro_read_config(struct file *filp, struct kobject *kobj,
 	/* Construct a ConfigDev */
 	memset(&cd, 0, sizeof(cd));
 	cd.cd_Rom = z->rom;
-	cd.cd_SlotAddr = z->slotaddr;
-	cd.cd_SlotSize = z->slotsize;
-	cd.cd_BoardAddr = (void *)zorro_resource_start(z);
-	cd.cd_BoardSize = zorro_resource_len(z);
+	cd.cd_SlotAddr = cpu_to_be16(z->slotaddr);
+	cd.cd_SlotSize = cpu_to_be16(z->slotsize);
+	cd.cd_BoardAddr = cpu_to_be32(zorro_resource_start(z));
+	cd.cd_BoardSize = cpu_to_be32(zorro_resource_len(z));
 
 	return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd));
 }
drivers/zorro/zorro.c +3 -1
index 450abf100f06..707c1a5a0317 100644
@@ -18,6 +18,7 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
+#include <asm/byteorder.h>
 #include <asm/setup.h>
 #include <asm/amigahw.h>
 
@@ -161,7 +162,8 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 		z = &zorro_autocon[i];
 
 		z->rom = zi->rom;
-		z->id = (z->rom.er_Manufacturer<<16) | (z->rom.er_Product<<8);
+		z->id = (be16_to_cpu(z->rom.er_Manufacturer) << 16) |
+			(z->rom.er_Product << 8);
 		if (z->id == ZORRO_PROD_GVP_EPC_BASE) {
 			/* GVP quirk */
 			unsigned long magic = zi->boardaddr + 0x8000;
include/uapi/linux/zorro.h +23 -23

62 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author maintainer
#16 lore raw

PATCH 8/8 zorro/UAPI: Use proper types (endianness/size) in <linux/zorro.h>

In reply to Geert Uytterhoeven

Fix member definitions for non-native userspace handling:
- All multi-byte values are big-endian, hence use __be*,
- All pointers are 32-bit pointers under AmigaOS, but unused (except for cd_BoardAddr) under Linux, hence use __be32.

---
 arch/m68k/amiga/config.c           |    9 +++----
 arch/m68k/amiga/platform.c         |    9 ++++---
 drivers/net/ethernet/amd/a2065.c   |    9 ++++---
 drivers/net/ethernet/amd/ariadne.c |    9 ++++---
 drivers/zorro/proc.c               |   10 ++++----
 drivers/zorro/zorro-sysfs.c        |   22 +++++++++++++----
 drivers/zorro/zorro.c              |    4 +++-
 include/uapi/linux/zorro.h         |   46 ++++++++++++++++++------------------
 8 files changed, 72 insertions(+), 46 deletions(-)
arch/m68k/amiga/config.c +5 -4
index acd9c1640cfc..65b5e937ebba 100644
@@ -28,6 +28,7 @@
 #include <linux/keyboard.h>
 
 #include <asm/bootinfo.h>
+#include <asm/byteorder.h>
 #include <asm/setup.h>
 #include <asm/pgtable.h>
 #include <asm/amigahw.h>
@@ -176,10 +177,10 @@ int __init amiga_parse_bootinfo(const struct bi_record *record)
 			const struct ConfigDev *cd = (struct ConfigDev *)data;
 			struct zorro_dev_init *dev = &zorro_autocon_init[zorro_num_autocon++];
 			dev->rom = cd->cd_Rom;
-			dev->slotaddr = cd->cd_SlotAddr;
-			dev->slotsize = cd->cd_SlotSize;
-			dev->boardaddr = (u32)cd->cd_BoardAddr;
-			dev->boardsize = cd->cd_BoardSize;
+			dev->slotaddr = be16_to_cpu(cd->cd_SlotAddr);
+			dev->slotsize = be16_to_cpu(cd->cd_SlotSize);
+			dev->boardaddr = be32_to_cpu(cd->cd_BoardAddr);
+			dev->boardsize = be32_to_cpu(cd->cd_BoardSize);
 		} else
 			printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
 #endif /* CONFIG_ZORRO */
arch/m68k/amiga/platform.c +6 -3
index 7847b2b1b5b6..d34029d7b058 100644
@@ -13,6 +13,7 @@
 
 #include <asm/amigahw.h>
 #include <asm/amigayle.h>
+#include <asm/byteorder.h>
 
 
 #ifdef CONFIG_ZORRO
@@ -66,10 +67,12 @@ static int __init z_dev_present(zorro_id id)
 {
 	unsigned int i;
 
-	for (i = 0; i < zorro_num_autocon; i++)
-		if (zorro_autocon_init[i].rom.er_Manufacturer == ZORRO_MANUF(id) &&
-		    zorro_autocon_init[i].rom.er_Product == ZORRO_PROD(id))
+	for (i = 0; i < zorro_num_autocon; i++) {
+		const struct ExpansionRom *rom = &zorro_autocon_init[i].rom;
+		if (be16_to_cpu(rom->er_Manufacturer) == ZORRO_MANUF(id) &&
+		    rom->er_Product == ZORRO_PROD(id))
 			return 1;
+	}
 
 	return 0;
 }
drivers/net/ethernet/amd/a2065.c +6 -3
index f492a19328e5..56139184b801 100644
@@ -57,6 +57,7 @@
 #include <linux/zorro.h>
 #include <linux/bitops.h>
 
+#include <asm/byteorder.h>
 #include <asm/irq.h>
 #include <asm/amigaints.h>
 #include <asm/amigahw.h>
@@ -678,6 +679,7 @@ static int a2065_init_one(struct zorro_dev *z,
 	unsigned long base_addr = board + A2065_LANCE;
 	unsigned long mem_start = board + A2065_RAM;
 	struct resource *r1, *r2;
+	u32 serial;
 	int err;
 
 	r1 = request_mem_region(base_addr, sizeof(struct lance_regs),
@@ -702,6 +704,7 @@ static int a2065_init_one(struct zorro_dev *z,
 	r1->name = dev->name;
 	r2->name = dev->name;
 
+	serial = be32_to_cpu(z->rom.er_SerialNumber);
 	dev->dev_addr[0] = 0x00;
 	if (z->id != ZORRO_PROD_AMERISTAR_A2065) {	/* Commodore */
 		dev->dev_addr[1] = 0x80;
@@ -710,9 +713,9 @@ static int a2065_init_one(struct zorro_dev *z,
 		dev->dev_addr[1] = 0x00;
 		dev->dev_addr[2] = 0x9f;
 	}
-	dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
-	dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
-	dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
+	dev->dev_addr[3] = (serial >> 16) & 0xff;
+	dev->dev_addr[4] = (serial >> 8) & 0xff;
+	dev->dev_addr[5] = serial & 0xff;
 	dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
 	dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
 	dev->mem_end = dev->mem_start + A2065_RAM_SIZE;
drivers/net/ethernet/amd/ariadne.c +6 -3
index 33822cb69366..b08101b31b8b 100644
@@ -51,6 +51,7 @@
 #include <linux/zorro.h>
 #include <linux/bitops.h>
 
+#include <asm/byteorder.h>
 #include <asm/amigaints.h>
 #include <asm/amigahw.h>
 #include <asm/irq.h>
@@ -718,6 +719,7 @@ static int ariadne_init_one(struct zorro_dev *z,
 	struct resource *r1, *r2;
 	struct net_device *dev;
 	struct ariadne_private *priv;
+	u32 serial;
 	int err;
 
 	r1 = request_mem_region(base_addr, sizeof(struct Am79C960), "Am79C960");
@@ -741,12 +743,13 @@ static int ariadne_init_one(struct zorro_dev *z,
 	r1->name = dev->name;
 	r2->name = dev->name;
 
+	serial = be32_to_cpu(z->rom.er_SerialNumber);
 	dev->dev_addr[0] = 0x00;
 	dev->dev_addr[1] = 0x60;
 	dev->dev_addr[2] = 0x30;
-	dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
-	dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
-	dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
+	dev->dev_addr[3] = (serial >> 16) & 0xff;
+	dev->dev_addr[4] = (serial >> 8) & 0xff;
+	dev->dev_addr[5] = serial & 0xff;
 	dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
 	dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
 	dev->mem_end = dev->mem_start + ARIADNE_RAM_SIZE;
drivers/zorro/proc.c +6 -4
index ea1ce822a8e0..6ac2579da0eb 100644
@@ -14,6 +14,8 @@
 #include <linux/seq_file.h>
 #include <linux/init.h>
 #include <linux/export.h>
+
+#include <asm/byteorder.h>
 #include <asm/uaccess.h>
 #include <asm/amigahw.h>
 #include <asm/setup.h>
@@ -41,10 +43,10 @@ proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *
 	/* Construct a ConfigDev */
 	memset(&cd, 0, sizeof(cd));
 	cd.cd_Rom = z->rom;
-	cd.cd_SlotAddr = z->slotaddr;
-	cd.cd_SlotSize = z->slotsize;
-	cd.cd_BoardAddr = (void *)zorro_resource_start(z);
-	cd.cd_BoardSize = zorro_resource_len(z);
+	cd.cd_SlotAddr = cpu_to_be16(z->slotaddr);
+	cd.cd_SlotSize = cpu_to_be16(z->slotsize);
+	cd.cd_BoardAddr = cpu_to_be32(zorro_resource_start(z));
+	cd.cd_BoardSize = cpu_to_be32(zorro_resource_len(z));
 
 	if (copy_to_user(buf, (void *)&cd + pos, nbytes))
 		return -EFAULT;
drivers/zorro/zorro-sysfs.c +17 -5
index 26f7184ef9e1..36b210f9b6b2 100644
@@ -16,6 +16,8 @@
 #include <linux/stat.h>
 #include <linux/string.h>
 
+#include <asm/byteorder.h>
+
 #include "zorro.h"
 
 
@@ -33,10 +35,20 @@ static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
 
 zorro_config_attr(id, id, "0x%08x\n");
 zorro_config_attr(type, rom.er_Type, "0x%02x\n");
-zorro_config_attr(serial, rom.er_SerialNumber, "0x%08x\n");
 zorro_config_attr(slotaddr, slotaddr, "0x%04x\n");
 zorro_config_attr(slotsize, slotsize, "0x%04x\n");
 
+static ssize_t
+show_serial(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct zorro_dev *z;
+
+	z = to_zorro_dev(dev);
+	return sprintf(buf, "0x%08x\n", be32_to_cpu(z->rom.er_SerialNumber));
+}
+
+static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL);
+
 static ssize_t zorro_show_resource(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct zorro_dev *z = to_zorro_dev(dev);
@@ -60,10 +72,10 @@ static ssize_t zorro_read_config(struct file *filp, struct kobject *kobj,
 	/* Construct a ConfigDev */
 	memset(&cd, 0, sizeof(cd));
 	cd.cd_Rom = z->rom;
-	cd.cd_SlotAddr = z->slotaddr;
-	cd.cd_SlotSize = z->slotsize;
-	cd.cd_BoardAddr = (void *)zorro_resource_start(z);
-	cd.cd_BoardSize = zorro_resource_len(z);
+	cd.cd_SlotAddr = cpu_to_be16(z->slotaddr);
+	cd.cd_SlotSize = cpu_to_be16(z->slotsize);
+	cd.cd_BoardAddr = cpu_to_be32(zorro_resource_start(z));
+	cd.cd_BoardSize = cpu_to_be32(zorro_resource_len(z));
 
 	return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd));
 }
drivers/zorro/zorro.c +3 -1
index 450abf100f06..707c1a5a0317 100644
@@ -18,6 +18,7 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
+#include <asm/byteorder.h>
 #include <asm/setup.h>
 #include <asm/amigahw.h>
 
@@ -161,7 +162,8 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 		z = &zorro_autocon[i];
 
 		z->rom = zi->rom;
-		z->id = (z->rom.er_Manufacturer<<16) | (z->rom.er_Product<<8);
+		z->id = (be16_to_cpu(z->rom.er_Manufacturer) << 16) |
+			(z->rom.er_Product << 8);
 		if (z->id == ZORRO_PROD_GVP_EPC_BASE) {
 			/* GVP quirk */
 			unsigned long magic = zi->boardaddr + 0x8000;
include/uapi/linux/zorro.h +23 -23

62 lines not on this page · raw message

Signature · 1 line
1.7.9.5