PERFORCE change 94451 for review
John-Mark Gurney
jmg at FreeBSD.org
Sun Apr 2 08:07:15 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=94451
Change 94451 by jmg at jmg_carbon-60 on 2006/04/02 08:06:48
use casting instead of the union..
Affected files ...
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#9 edit
Differences ...
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#9 (text+ko) ====
@@ -158,7 +158,7 @@
{
struct hvpci_softc *sc;
pci_config_size_t size;
- pci_cfg_data_t data;
+ uint32_t data;
uint32_t ret;
int r;
@@ -182,18 +182,18 @@
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.dw);
+ sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, data);
if (r == H_EOK) {
switch (width) {
case 1:
- ret = data.b;
+ ret = *(uint8_t *)&data;
break;
case 2:
- ret = data.w;
+ ret = *(uint16_t *)&data;
break;
case 4:
- ret = data.dw;
+ ret = data;
break;
}
return ret;
@@ -213,7 +213,7 @@
{
struct hvpci_softc *sc;
pci_config_size_t size;
- pci_cfg_data_t data;
+ uint32_t data;
uint32_t err_flags;
sc = device_get_softc(dev);
@@ -221,15 +221,15 @@
switch (width) {
case 1:
size = PCI_CFG_SIZE_BYTE;
- data.b = val;
+ *(uint8_t *)&data = val;
break;
case 2:
size = PCI_CFG_SIZE_WORD;
- data.w = val;
+ *(uint16_t *)&data = val;
break;
case 4:
size = PCI_CFG_SIZE_DWORD;
- data.dw = val;
+ data = val;
break;
default:
panic("unsupported width: %d", width);
More information about the p4-projects
mailing list