hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/parisc/kernel/drivers.c
....@@ -1,10 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * drivers.c
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License
6
- * as published by the Free Software Foundation; either version
7
- * 2 of the License, or (at your option) any later version.
84 *
95 * Copyright (c) 1999 The Puffin Group
106 * Copyright (c) 2001 Matthew Wilcox for Hewlett Packard
....@@ -34,13 +30,15 @@
3430 #include <linux/spinlock.h>
3531 #include <linux/string.h>
3632 #include <linux/export.h>
33
+#include <linux/dma-map-ops.h>
3734 #include <asm/hardware.h>
3835 #include <asm/io.h>
3936 #include <asm/pdc.h>
4037 #include <asm/parisc-device.h>
38
+#include <asm/ropes.h>
4139
4240 /* See comments in include/asm-parisc/pci.h */
43
-const struct dma_map_ops *hppa_dma_ops __read_mostly;
41
+const struct dma_map_ops *hppa_dma_ops __ro_after_init;
4442 EXPORT_SYMBOL(hppa_dma_ops);
4543
4644 static struct device root = {
....@@ -255,6 +253,30 @@
255253
256254 ret = for_each_padev(find_device, &d);
257255 return ret ? d.dev : NULL;
256
+}
257
+
258
+static int __init is_IKE_device(struct device *dev, void *data)
259
+{
260
+ struct parisc_device *pdev = to_parisc_device(dev);
261
+
262
+ if (!check_dev(dev))
263
+ return 0;
264
+ if (pdev->id.hw_type != HPHW_BCPORT)
265
+ return 0;
266
+ if (IS_IKE(pdev) ||
267
+ (pdev->id.hversion == REO_MERCED_PORT) ||
268
+ (pdev->id.hversion == REOG_MERCED_PORT)) {
269
+ return 1;
270
+ }
271
+ return 0;
272
+}
273
+
274
+int __init machine_has_merced_bus(void)
275
+{
276
+ int ret;
277
+
278
+ ret = for_each_padev(is_IKE_device, NULL);
279
+ return ret ? 1 : 0;
258280 }
259281
260282 /**
....@@ -499,7 +521,6 @@
499521 dev->id.hversion_rev = iodc_data[1] & 0x0f;
500522 dev->id.sversion = ((iodc_data[4] & 0x0f) << 16) |
501523 (iodc_data[5] << 8) | iodc_data[6];
502
- dev->hpa.name = parisc_pathname(dev);
503524 dev->hpa.start = hpa;
504525 /* This is awkward. The STI spec says that gfx devices may occupy
505526 * 32MB or 64MB. Unfortunately, we don't know how to tell whether
....@@ -513,10 +534,10 @@
513534 dev->hpa.end = hpa + 0xfff;
514535 }
515536 dev->hpa.flags = IORESOURCE_MEM;
516
- name = parisc_hardware_description(&dev->id);
517
- if (name) {
518
- strlcpy(dev->name, name, sizeof(dev->name));
519
- }
537
+ dev->hpa.name = dev->name;
538
+ name = parisc_hardware_description(&dev->id) ? : "unknown";
539
+ snprintf(dev->name, sizeof(dev->name), "%s [%s]",
540
+ name, parisc_pathname(dev));
520541
521542 /* Silently fail things like mouse ports which are subsumed within
522543 * the keyboard controller
....@@ -862,15 +883,13 @@
862883 &root);
863884 }
864885
865
-static void print_parisc_device(struct parisc_device *dev)
886
+static __init void print_parisc_device(struct parisc_device *dev)
866887 {
867
- char hw_path[64];
868
- static int count;
888
+ static int count __initdata;
869889
870
- print_pa_hwpath(dev, hw_path);
871
- pr_info("%d. %s at %pap [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",
872
- ++count, dev->name, &(dev->hpa.start), hw_path, dev->id.hw_type,
873
- dev->id.hversion_rev, dev->id.hversion, dev->id.sversion);
890
+ pr_info("%d. %s at %pap { type:%d, hv:%#x, sv:%#x, rev:%#x }",
891
+ ++count, dev->name, &(dev->hpa.start), dev->id.hw_type,
892
+ dev->id.hversion, dev->id.sversion, dev->id.hversion_rev);
874893
875894 if (dev->num_addrs) {
876895 int k;
....@@ -1059,7 +1078,7 @@
10591078
10601079
10611080
1062
-static int print_one_device(struct device * dev, void * data)
1081
+static __init int print_one_device(struct device * dev, void * data)
10631082 {
10641083 struct parisc_device * pdev = to_parisc_device(dev);
10651084