PERFORCE change 94573 for review
Kip Macy
kmacy at FreeBSD.org
Tue Apr 4 01:22:19 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=94573
Change 94573 by kmacy at kmacy_storage:sun4v_work on 2006/04/04 01:22:05
local HV PCI support changes
Affected files ...
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#18 edit
Differences ...
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#18 (text+ko) ====
@@ -138,17 +138,24 @@
int br[2];
int n;
+ printf("hvpci_attach: dev_name=%s dev_type=%s\n",
+ ofw_bus_get_name(dev), ofw_bus_get_type(dev));
+
node = ofw_bus_get_node(dev);
+ printf("hvpci_attach: %p, node: %#x\n", dev, node);
if (node == -1)
panic("%s: ofw_bus_get_node failed.", __func__);
sc = device_get_softc(dev);
- n = OF_getprop(node, "bus-range", (void *)br, sizeof br);
+ n = OF_getprop(node, "bus-range", &br[0], 8);
+
if (n == -1)
panic("%s: could not get bus-range", __func__);
- if (n != sizeof br)
+ if (n != sizeof(br))
panic("%s: broken bus-range (%d)", __func__, n);
+
sc->hs_busnum = br[0];
+
#if 0
if (OF_getprop(node, "reg", &cell, sizeof cell) == -1)
panic("%s: OF_getprop failed.", __func__);
@@ -185,26 +192,37 @@
int width)
{
struct hvpci_softc *sc;
- uint32_t data;
- int r;
- uint64_t ret;
+ uint32_t data = -1;
+ uint64_t r;
+ uint32_t ret;
sc = device_get_softc(dev);
r = hvio_config_get(sc->hs_devhandle, HVPCI_BDF(bus, slot, func),
reg, width, (pci_cfg_data_t *)&data);
- printf("%d = read_config(%#lx, %#x, %d, %d) = %#x\n", r,
- sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, data);
if (r == H_EOK) {
switch (width) {
case 1:
ret = data & 0xff;
+#if 0
+ printf("%ld = read_config(%#lx, %#x, %d, %d) = %#x\n", r,
+ sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, ret);
+#endif
break;
case 2:
ret = data & 0xffff;
+#if 0
+ printf("%ld = read_config(%#lx, %#x, %d, %d) = %#x\n", r,
+ sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, ret);
+#endif
+
break;
case 4:
ret = data;
+#if 0
+ printf("%ld = read_config(%#lx, %#x, %d, %d) = %#x\n", r,
+ sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, ret);
+#endif
break;
default:
ret = -1;
@@ -225,24 +243,29 @@
uint32_t val, int width)
{
struct hvpci_softc *sc;
- uint32_t data;
+ pci_cfg_data_t data = { 0 };
+ uint64_t r;
sc = device_get_softc(dev);
switch (width) {
case 1:
- data = val;
+ data.qw = (uint8_t)val;
break;
case 2:
- data = val & 0xffff;
+ data.qw = (uint16_t)(val & 0xffff);
break;
case 4:
- data = val;
+ data.qw = (uint32_t)val;
break;
default:
panic("unsupported width: %d", width);
}
- hvio_config_put(sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg,
- width, (pci_cfg_data_t)data);
+
+ r = hvio_config_put(sc->hs_devhandle, HVPCI_BDF(bus, slot, func),
+ reg, width, (pci_cfg_data_t)data);
+
+ if (r)
+ printf("put failed with: %ld\n", r);
}
#ifdef notyet
More information about the p4-projects
mailing list