Add Amiga Zorro bus module device table support

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
---
 depmod.c         |    1 +
 depmod.h         |    2 ++
 moduleops_core.c |    5 +++++
 tables.c         |   26 ++++++++++++++++++++++++++
 tables.h         |    8 ++++++++
 5 files changed, 42 insertions(+)

--- module-init-tools-3.3-pre11.orig/depmod.c
+++ module-init-tools-3.3-pre11/depmod.c
@@ -793,6 +793,7 @@ static struct depfile depfiles[] = {
        { "modules.inputmap", output_input_table },
        { "modules.ofmap", output_of_table },
        { "modules.seriomap", output_serio_table },
+       { "modules.zorromap", output_zorro_table },
        { "modules.alias", output_aliases },
        { "modules.symbols", output_symbols },
 };
--- module-init-tools-3.3-pre11.orig/depmod.h
+++ module-init-tools-3.3-pre11/depmod.h
@@ -57,6 +57,8 @@ struct module
        void *serio_table;
        unsigned int of_size;
        void *of_table;
+       unsigned int zorro_size;
+       void *zorro_table;
 
        /* File contents and length. */
        void *data;
--- module-init-tools-3.3-pre11.orig/moduleops_core.c
+++ module-init-tools-3.3-pre11/moduleops_core.c
@@ -234,6 +234,11 @@ static void PERBIT(fetch_tables)(struct 
        module->of_table = PERBIT(deref_sym)(module->data,
                                        "__mod_of_device_table",
                                        NULL, module->conv);
+
+       module->zorro_size = PERBIT(ZORRO_DEVICE_SIZE);
+       module->zorro_table = PERBIT(deref_sym)(module->data,
+                                       "__mod_zorro_device_table",
+                                       NULL, module->conv);
 }
 
 struct module_ops PERBIT(mod_ops) = {
--- module-init-tools-3.3-pre11.orig/tables.c
+++ module-init-tools-3.3-pre11/tables.c
@@ -549,3 +549,29 @@ void output_of_table(struct module *modu
                        output_of_entry(e, shortname, out);
        }
 }
+
+/* We set driver_data to zero */
+static void output_zorro_entry(struct zorro_device_id *zorro, char *name, FILE 
*out,
+                            int conv)
+{
+       fprintf(out, "%-20s 0x%08x 0x0\n", name, END(zorro->id, conv));
+}
+
+void output_zorro_table(struct module *modules, FILE *out)
+{
+       struct module *i;
+
+       fprintf(out, "# zorro module       id         driver_data\n");
+
+       for (i = modules; i; i = i->next) {
+               struct zorro_device_id *e;
+               char shortname[strlen(i->pathname) + 1];
+
+               if (!i->zorro_table)
+                       continue;
+
+               make_shortname(shortname, i->pathname);
+               for (e = i->zorro_table; e->id; e = (void *)e + i->zorro_size)
+                       output_zorro_entry(e, shortname, out, i->conv);
+       }
+}
--- module-init-tools-3.3-pre11.orig/tables.h
+++ module-init-tools-3.3-pre11/tables.h
@@ -173,6 +173,13 @@ struct of_device_id {
 #define OF_DEVICE_SIZE32 (32 * 2 + 128 + 4)
 #define OF_DEVICE_SIZE64 (32 * 2 + 128 + 8)
 
+struct zorro_device_id {
+       unsigned int id;                /* Device ID or ZORRO_WILDCARD */
+};
+
+#define ZORRO_DEVICE_SIZE32 (1 * 4 + 4)
+#define ZORRO_DEVICE_SIZE64 (1 * 4 + 8)
+
 /* Functions provided by tables.c */
 struct module;
 void output_usb_table(struct module *modules, FILE *out);
@@ -183,5 +190,6 @@ void output_isapnp_table(struct module *
 void output_input_table(struct module *modules, FILE *out);
 void output_serio_table(struct module *modules, FILE *out);
 void output_of_table(struct module *modules, FILE *out);
+void output_zorro_table(struct module *modules, FILE *out);
 
 #endif /* MODINITTOOLS_TABLES_H */

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


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to