Date: Sun, 2 Apr 2006 08:07:14 GMT From: John-Mark Gurney <jmg@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 94451 for review Message-ID: <200604020807.k3287EIH020631@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=94451 Change 94451 by jmg@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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604020807.k3287EIH020631>