1 // SPDX-License-Identifier: GPL-2.0
3 * Zorro Device Name Tables
5 * Copyright (C) 1999--2000 Geert Uytterhoeven
7 * Based on the PCI version:
9 * Copyright 1992--1999 Drew Eckhardt, Frederic Potter,
10 * David Mosberger-Tang, Martin Mares
13 #include <linux/init.h>
14 #include <linux/kernel.h>
15 #include <linux/types.h>
16 #include <linux/zorro.h>
19 struct zorro_prod_info {
25 struct zorro_manuf_info {
29 struct zorro_prod_info *prods;
33 * This is ridiculous, but we want the strings in
34 * the .init section so that they don't take up
35 * real memory.. Parse the same file multiple times
36 * to get all the info.
38 #define MANUF( manuf, name ) static char __manufstr_##manuf[] __initdata = name;
40 #define PRODUCT( manuf, prod, name ) static char __prodstr_##manuf##prod[] __initdata = name;
44 #define MANUF( manuf, name ) static struct zorro_prod_info __prods_##manuf[] __initdata = {
46 #define PRODUCT( manuf, prod, name ) { 0x##prod, 0, __prodstr_##manuf##prod },
49 static struct zorro_manuf_info __initdata zorro_manuf_list[] = {
50 #define MANUF( manuf, name ) { 0x##manuf, ARRAY_SIZE(__prods_##manuf), __manufstr_##manuf, __prods_##manuf },
52 #define PRODUCT( manuf, prod, name )
56 #define MANUFS ARRAY_SIZE(zorro_manuf_list)
58 void __init zorro_name_device(struct zorro_dev *dev)
60 const struct zorro_manuf_info *manuf_p = zorro_manuf_list;
62 char *name = dev->name;
65 if (manuf_p->manuf == ZORRO_MANUF(dev->id))
70 /* Couldn't find either the manufacturer nor the product */
74 struct zorro_prod_info *prod_p = manuf_p->prods;
79 ((ZORRO_PROD(dev->id)<<8) | ZORRO_EPC(dev->id)))
85 /* Ok, found the manufacturer, but unknown product */
86 sprintf(name, "Zorro device %08x (%s)", dev->id, manuf_p->name);
91 char *n = name + sprintf(name, "%s %s", manuf_p->name, prod_p->name);
92 int nr = prod_p->seen + 1;
95 sprintf(n, " (#%d)", nr);