.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * 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. |
---|
8 | 4 | * |
---|
9 | 5 | * Copyright (c) 1999 The Puffin Group |
---|
10 | 6 | * Copyright (c) 2001 Matthew Wilcox for Hewlett Packard |
---|
.. | .. |
---|
34 | 30 | #include <linux/spinlock.h> |
---|
35 | 31 | #include <linux/string.h> |
---|
36 | 32 | #include <linux/export.h> |
---|
| 33 | +#include <linux/dma-map-ops.h> |
---|
37 | 34 | #include <asm/hardware.h> |
---|
38 | 35 | #include <asm/io.h> |
---|
39 | 36 | #include <asm/pdc.h> |
---|
40 | 37 | #include <asm/parisc-device.h> |
---|
| 38 | +#include <asm/ropes.h> |
---|
41 | 39 | |
---|
42 | 40 | /* 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; |
---|
44 | 42 | EXPORT_SYMBOL(hppa_dma_ops); |
---|
45 | 43 | |
---|
46 | 44 | static struct device root = { |
---|
.. | .. |
---|
255 | 253 | |
---|
256 | 254 | ret = for_each_padev(find_device, &d); |
---|
257 | 255 | 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; |
---|
258 | 280 | } |
---|
259 | 281 | |
---|
260 | 282 | /** |
---|
.. | .. |
---|
499 | 521 | dev->id.hversion_rev = iodc_data[1] & 0x0f; |
---|
500 | 522 | dev->id.sversion = ((iodc_data[4] & 0x0f) << 16) | |
---|
501 | 523 | (iodc_data[5] << 8) | iodc_data[6]; |
---|
502 | | - dev->hpa.name = parisc_pathname(dev); |
---|
503 | 524 | dev->hpa.start = hpa; |
---|
504 | 525 | /* This is awkward. The STI spec says that gfx devices may occupy |
---|
505 | 526 | * 32MB or 64MB. Unfortunately, we don't know how to tell whether |
---|
.. | .. |
---|
513 | 534 | dev->hpa.end = hpa + 0xfff; |
---|
514 | 535 | } |
---|
515 | 536 | 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)); |
---|
520 | 541 | |
---|
521 | 542 | /* Silently fail things like mouse ports which are subsumed within |
---|
522 | 543 | * the keyboard controller |
---|
.. | .. |
---|
862 | 883 | &root); |
---|
863 | 884 | } |
---|
864 | 885 | |
---|
865 | | -static void print_parisc_device(struct parisc_device *dev) |
---|
| 886 | +static __init void print_parisc_device(struct parisc_device *dev) |
---|
866 | 887 | { |
---|
867 | | - char hw_path[64]; |
---|
868 | | - static int count; |
---|
| 888 | + static int count __initdata; |
---|
869 | 889 | |
---|
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); |
---|
874 | 893 | |
---|
875 | 894 | if (dev->num_addrs) { |
---|
876 | 895 | int k; |
---|
.. | .. |
---|
1059 | 1078 | |
---|
1060 | 1079 | |
---|
1061 | 1080 | |
---|
1062 | | -static int print_one_device(struct device * dev, void * data) |
---|
| 1081 | +static __init int print_one_device(struct device * dev, void * data) |
---|
1063 | 1082 | { |
---|
1064 | 1083 | struct parisc_device * pdev = to_parisc_device(dev); |
---|
1065 | 1084 | |
---|