PERFORCE change 94449 for review
John-Mark Gurney
jmg at FreeBSD.org
Sun Apr 2 06:25:08 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=94449
Change 94449 by jmg at jmg_carbon-60 on 2006/04/02 06:24:07
convert FreeBSD's width to HV's size enum... and use the union
to get the proper returned data.. hopefully packing won't be an
issue...
Affected files ...
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#7 edit
Differences ...
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#7 (text+ko) ====
@@ -157,22 +157,46 @@
int width)
{
struct hvpci_softc *sc;
- int r;
-#ifdef notyet
+ pci_config_size_t size;
pci_cfg_data_t data;
-#endif
- uint32_t data;
+ uint32_t ret;
sc = device_get_softc(dev);
- data = 0;
+ switch (width) {
+ case 1:
+ size = PCI_CFG_SIZE_BYTE;
+ break;
+ case 2:
+ size = PCI_CFG_SIZE_WORD;
+ break;
+ case 4:
+ size = PCI_CFG_SIZE_DWORD;
+ break;
+ default:
+ panic("unsupported width: %d", width);
+ }
+
r = hvio_config_get(sc->hs_devhandle, HVPCI_BDF(bus, slot, func),
- reg, width, &data);
+ reg, size, &data);
printf("%d = read_config(%#x, %#x, %d, %d) = %#x\n", r,
- sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, data);
- if (r == H_EOK)
- return data;
+ sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, data.dw);
+
+ if (r == H_EOK) {
+ switch (width) {
+ case 1:
+ ret = data.b;
+ break;
+ case 2:
+ ret = data.w;
+ break;
+ case 4:
+ ret = data.dw;
+ break;
+ }
+ return ret;
+ }
return -1;
}
More information about the p4-projects
mailing list