1 diff -urp -x '*~' -x '*.orig' src/solx_devfs.c src/solx_devfs.c |
|
2 --- src/solx_devfs.c 2010-11-21 11:13:33.000000000 -0800 |
|
3 +++ src/solx_devfs.c 2011-02-02 20:56:47.794721917 -0800 |
|
4 @@ -118,6 +118,8 @@ static int pci_device_solx_devfs_write( |
|
5 const void * data, pciaddr_t offset, pciaddr_t size, |
|
6 pciaddr_t * bytes_written ); |
|
7 |
|
8 +static int pci_device_solx_devfs_boot_vga(struct pci_device *dev); |
|
9 + |
|
10 static int probe_dev(nexus_t *nexus, pcitool_reg_t *prg_p, |
|
11 struct pci_system *pci_sys); |
|
12 |
|
13 @@ -143,7 +145,8 @@ static const struct pci_system_methods s |
|
14 .read = pci_device_solx_devfs_read, |
|
15 .write = pci_device_solx_devfs_write, |
|
16 |
|
17 - .fill_capabilities = pci_fill_capabilities_generic |
|
18 + .fill_capabilities = pci_fill_capabilities_generic, |
|
19 + .boot_vga = pci_device_solx_devfs_boot_vga |
|
20 }; |
|
21 |
|
22 static nexus_t * |
|
23 @@ -706,12 +709,12 @@ pci_device_solx_devfs_probe( struct pci_ |
|
24 pciaddr_t bytes; |
|
25 int len = 0; |
|
26 uint ent = 0; |
|
27 + struct pci_device_private *priv = |
|
28 + (struct pci_device_private *) dev; |
|
29 |
|
30 err = pci_device_solx_devfs_read( dev, config, 0, 256, & bytes ); |
|
31 |
|
32 if ( bytes >= 64 ) { |
|
33 - struct pci_device_private *priv = |
|
34 - (struct pci_device_private *) dev; |
|
35 |
|
36 dev->vendor_id = (uint16_t)config[0] + ((uint16_t)config[1] << 8); |
|
37 dev->device_id = (uint16_t)config[2] + ((uint16_t)config[3] << 8); |
|
38 @@ -745,6 +748,16 @@ pci_device_solx_devfs_probe( struct pci_ |
|
39 } |
|
40 } |
|
41 if (args.node != DI_NODE_NIL) { |
|
42 + int *prop; |
|
43 + |
|
44 + priv->is_primary = 0; |
|
45 + |
|
46 + if (di_prop_lookup_ints(DDI_DEV_T_ANY, |
|
47 + args.node, "primary-controller", &prop) >= 1) { |
|
48 + if (prop[0]) |
|
49 + priv->is_primary = 1; |
|
50 + |
|
51 + } |
|
52 /* |
|
53 * It will succeed for sure, because it was |
|
54 * successfully called in find_target_node |
|
55 @@ -755,6 +768,7 @@ pci_device_solx_devfs_probe( struct pci_ |
|
56 |
|
57 } |
|
58 |
|
59 + |
|
60 if (len <= 0) |
|
61 goto cleanup; |
|
62 |
|
63 @@ -785,22 +799,33 @@ pci_device_solx_devfs_probe( struct pci_ |
|
64 } |
|
65 |
|
66 /* |
|
67 - * Solaris has its own BAR index. |
|
68 + * Each BAR address get its own region slot in sequence. |
|
69 + * 32 bit BAR: |
|
70 + * BAR 0x10 -> slot0, BAR 0x14 -> slot1... |
|
71 + * 64 bit BAR: |
|
72 + * BAR 0x10 -> slot0, BAR 0x18 -> slot2..., |
|
73 + * slot1 is part of BAR 0x10 |
|
74 * Linux give two region slot for 64 bit address. |
|
75 */ |
|
76 for (i = 0; i < len; i = i + CELL_NUMS_1275) { |
|
77 |
|
78 reg = (pci_regspec_t *)®buf[i]; |
|
79 ent = reg->pci_phys_hi & 0xff; |
|
80 + |
|
81 + if (ent > PCI_CONF_BASE5) { |
|
82 + fprintf(stderr, "error ent = %d\n", ent); |
|
83 + break; |
|
84 + } |
|
85 /* |
|
86 * G35 broken in BAR0 |
|
87 */ |
|
88 - ent = (ent - PCI_CONF_BASE0) >> 2; |
|
89 - if (ent >= 6) { |
|
90 - fprintf(stderr, "error ent = %d\n", ent); |
|
91 - break; |
|
92 - } |
|
93 - |
|
94 + if (ent < PCI_CONF_BASE0) { |
|
95 + /* |
|
96 + * VGA resource here and ignore it |
|
97 + */ |
|
98 + break; |
|
99 + } else |
|
100 + ent = (ent - PCI_CONF_BASE0) >> 2; |
|
101 /* |
|
102 * non relocatable resource is excluded |
|
103 * such like 0xa0000, 0x3b0. If it is met, |
|
104 @@ -1023,3 +1048,11 @@ pci_device_solx_devfs_map_range(struct p |
|
105 |
|
106 return err; |
|
107 } |
|
108 +static int pci_device_solx_devfs_boot_vga(struct pci_device *dev) |
|
109 +{ |
|
110 + struct pci_device_private *priv = |
|
111 + (struct pci_device_private *) dev; |
|
112 + |
|
113 + return (priv->is_primary); |
|
114 + |
|
115 +} |
|