|
| 1 | +$NetBSD: patch-src_solx__devfs.c,v 1.5 2017/07/07 10:13:57 jperkin Exp $ |
| 2 | + |
| 3 | +Revert upstream commit fe556c48dad96717b0ba71d489575c6b90b46448 which breaks |
| 4 | +device lookup completely on illumos. |
| 5 | + |
| 6 | +--- src/solx_devfs.c.orig 2017-04-04 13:46:41.000000000 +0000 |
| 7 | ++++ src/solx_devfs.c |
| 8 | +@@ -1,6 +1,6 @@ |
| 9 | + /* |
| 10 | + * (C) Copyright IBM Corporation 2006 |
| 11 | +- * Copyright (c) 2007, 2009, 2011, 2012, 2016 Oracle and/or its affiliates. |
| 12 | ++ * Copyright (c) 2007, 2009, 2011, 2012, 2015 Oracle and/or its affiliates. |
| 13 | + * All Rights Reserved. |
| 14 | + * |
| 15 | + * Permission is hereby granted, free of charge, to any person obtaining a |
| 16 | +@@ -65,7 +65,7 @@ typedef struct nexus { |
| 17 | + int first_bus; |
| 18 | + int last_bus; |
| 19 | + int domain; |
| 20 | +- char *path; /* for open */ |
| 21 | ++ char *path; /* for errors/debugging; fd is all we need */ |
| 22 | + char *dev_path; |
| 23 | + struct nexus *next; |
| 24 | + } nexus_t; |
| 25 | +@@ -297,6 +297,7 @@ probe_nexus_node(di_node_t di_node, di_m |
| 26 | + int pci_node = 0; |
| 27 | + int first_bus = 0, last_bus = PCI_REG_BUS_G(PCI_REG_BUS_M); |
| 28 | + int domain = 0; |
| 29 | ++ di_node_t rnode = DI_NODE_NIL; |
| 30 | + #ifdef __sparc |
| 31 | + int bus_range_found = 0; |
| 32 | + int device_type_found = 0; |
| 33 | +@@ -422,12 +423,21 @@ probe_nexus_node(di_node_t di_node, di_m |
| 34 | + nexus->dev_path = strdup(nexus_dev_path); |
| 35 | + di_devfs_path_free(nexus_dev_path); |
| 36 | + |
| 37 | ++ if ((rnode = di_init(nexus->dev_path, DINFOCPYALL)) == DI_NODE_NIL) { |
| 38 | ++ (void) fprintf(stderr, "di_init failed: %s\n", strerror(errno)); |
| 39 | ++ close(fd); |
| 40 | ++ free(nexus->path); |
| 41 | ++ free(nexus->dev_path); |
| 42 | ++ free(nexus); |
| 43 | ++ return (DI_WALK_TERMINATE); |
| 44 | ++ } |
| 45 | ++ |
| 46 | + /* Walk through devices under the rnode */ |
| 47 | + args.pinfo = pinfo; |
| 48 | + args.nexus = nexus; |
| 49 | + args.ret = 0; |
| 50 | + |
| 51 | +- (void) di_walk_node(di_node, DI_WALK_CLDFIRST, (void *)&args, probe_device_node); |
| 52 | ++ (void) di_walk_node(rnode, DI_WALK_CLDFIRST, (void *)&args, probe_device_node); |
| 53 | + |
| 54 | + close(fd); |
| 55 | + |
| 56 | +@@ -435,6 +445,7 @@ probe_nexus_node(di_node_t di_node, di_m |
| 57 | + free(nexus->path); |
| 58 | + free(nexus->dev_path); |
| 59 | + free(nexus); |
| 60 | ++ di_fini(rnode); |
| 61 | + return (DI_WALK_TERMINATE); |
| 62 | + } |
| 63 | + |
| 64 | +@@ -446,6 +457,10 @@ probe_nexus_node(di_node_t di_node, di_m |
| 65 | + free(nexus); |
| 66 | + } |
| 67 | + |
| 68 | ++ if (rnode != DI_NODE_NIL) { |
| 69 | ++ di_fini(rnode); |
| 70 | ++ } |
| 71 | ++ |
| 72 | + return DI_WALK_CONTINUE; |
| 73 | + } |
| 74 | + |
| 75 | +@@ -538,7 +553,7 @@ pci_device_solx_devfs_probe( struct pci_ |
| 76 | + * starting to find if it is MEM/MEM64/IO |
| 77 | + * using libdevinfo |
| 78 | + */ |
| 79 | +- if ((rnode = di_init(nexus->dev_path, DINFOCACHE)) == DI_NODE_NIL) { |
| 80 | ++ if ((rnode = di_init(nexus->dev_path, DINFOCPYALL)) == DI_NODE_NIL) { |
| 81 | + err = errno; |
| 82 | + (void) fprintf(stderr, "di_init failed: %s\n", strerror(errno)); |
| 83 | + } else { |
| 84 | +@@ -1070,7 +1085,7 @@ pci_system_solx_devfs_create( void ) |
| 85 | + return 0; |
| 86 | + } |
| 87 | + |
| 88 | +- if ((di_node = di_init("/", DINFOCACHE)) == DI_NODE_NIL) { |
| 89 | ++ if ((di_node = di_init("/", DINFOCPYALL)) == DI_NODE_NIL) { |
| 90 | + err = errno; |
| 91 | + (void) fprintf(stderr, "di_init() failed: %s\n", |
| 92 | + strerror(errno)); |
0 commit comments