* [Qemu-devel] Qemu cleanup. tale duex
@ 2006-04-28 23:21 Ben Taylor
0 siblings, 0 replies; only message in thread
From: Ben Taylor @ 2006-04-28 23:21 UTC (permalink / raw)
To: qemu-devel, Ben Dailey
[-- Attachment #1: Type: text/plain, Size: 488 bytes --]
---- Ben Dailey <bdailey@bhmsd.k12.in.us> wrote:
> You may want to send this may having gotten stripped by peoples viruses
> scanners.
>
> Ben
>
> >>> Ben Taylor <sol10x86@cox.net> 04/28/06 3:28 PM >>>
> This is just a cosmetic patch to move declarations to the begining of
> functions, and change things like "int x=(rand(y)) to"
>
> int x;
> x=(rand(y));
>
> As always, this is against the current CVS archive.
>
> Ben
Ok. let's try it again. third time's a charm.
[-- Attachment #2: qemu-cleanup.diff --]
[-- Type: text/x-patch, Size: 10015 bytes --]
diff -ruN qemu/hw/apic.c qemu-solaris/hw/apic.c
--- qemu/hw/apic.c 2005-12-16 20:27:28.000000000 -0500
+++ qemu-solaris/hw/apic.c 2006-04-28 13:28:54.103467000 -0400
@@ -108,7 +108,7 @@
unsigned int ret = 0;
#if defined(HOST_I386)
- __asm__ __volatile__ ("bsr %1, %0\n" : "+r" (ret) : "rm" (value));
+ __asm__ __volatile__ ("bsrl %1, %0\n" : "+r" (ret) : "rm" (value));
return ret;
#else
if (value > 0xffff)
@@ -129,7 +129,7 @@
unsigned int ret = 0;
#if defined(HOST_I386)
- __asm__ __volatile__ ("bsf %1, %0\n" : "+r" (ret) : "rm" (value));
+ __asm__ __volatile__ ("bsfl %1, %0\n" : "+r" (ret) : "rm" (value));
return ret;
#else
if (!value)
diff -ruN qemu/hw/es1370.c qemu-solaris/hw/es1370.c
--- qemu/hw/es1370.c 2005-11-20 11:20:39.000000000 -0500
+++ qemu-solaris/hw/es1370.c 2006-04-28 13:28:48.869352000 -0400
@@ -479,9 +479,10 @@
IO_WRITE_PROTO (es1370_writeb)
{
ES1370State *s = opaque;
- addr = es1370_fixup (s, addr);
uint32_t shift, mask;
+ addr = es1370_fixup (s, addr);
+
switch (addr) {
case ES1370_REG_CONTROL:
case ES1370_REG_CONTROL + 1:
@@ -516,9 +517,11 @@
IO_WRITE_PROTO (es1370_writew)
{
ES1370State *s = opaque;
- addr = es1370_fixup (s, addr);
uint32_t shift, mask;
- struct chan *d = &s->chan[0];
+ struct chan *d;
+
+ addr = es1370_fixup (s, addr);
+ d = &s->chan[0];
switch (addr) {
case ES1370_REG_CODEC:
diff -ruN qemu/hw/rtl8139.c qemu-solaris/hw/rtl8139.c
--- qemu/hw/rtl8139.c 2006-02-04 23:14:41.000000000 -0500
+++ qemu-solaris/hw/rtl8139.c 2006-04-28 13:30:43.411452000 -0400
@@ -808,6 +808,8 @@
printf(">>> RTL8139: broadcast packet received\n");
#endif
} else if (buf[0] & 0x01) {
+ int mcast_idx;
+
/* multicast */
if (!(s->RxConfig & AcceptMulticast))
{
@@ -817,7 +819,7 @@
return;
}
- int mcast_idx = compute_mcast_idx(buf);
+ mcast_idx = compute_mcast_idx(buf);
if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))))
{
@@ -872,6 +874,12 @@
if (rtl8139_cp_receiver_enabled(s))
{
+ int descriptor;
+ uint32_t val, rxdw0,rxdw1,rxbufLO,rxbufHI;
+ target_phys_addr_t cplus_rx_ring_desc;
+ uint32_t rx_space;
+ target_phys_addr_t rx_addr;
+
#if defined(DEBUG_RTL8139)
printf("RTL8139: in C+ Rx mode ================\n");
#endif
@@ -891,8 +899,7 @@
/* w2 low 32bit of Rx buffer ptr */
/* w3 high 32bit of Rx buffer ptr */
- int descriptor = s->currCPlusRxDesc;
- target_phys_addr_t cplus_rx_ring_desc;
+ descriptor = s->currCPlusRxDesc;
cplus_rx_ring_desc = rtl8139_addr64(s->RxRingAddrLO, s->RxRingAddrHI);
cplus_rx_ring_desc += 16 * descriptor;
@@ -902,8 +909,6 @@
descriptor, s->RxRingAddrHI, s->RxRingAddrLO, cplus_rx_ring_desc);
#endif
- uint32_t val, rxdw0,rxdw1,rxbufLO,rxbufHI;
-
cpu_physical_memory_read(cplus_rx_ring_desc, (uint8_t *)&val, 4);
rxdw0 = le32_to_cpu(val);
cpu_physical_memory_read(cplus_rx_ring_desc+4, (uint8_t *)&val, 4);
@@ -930,7 +935,7 @@
return;
}
- uint32_t rx_space = rxdw0 & CP_RX_BUFFER_SIZE_MASK;
+ rx_space = rxdw0 & CP_RX_BUFFER_SIZE_MASK;
if (size+4 > rx_space)
{
@@ -944,7 +949,7 @@
return;
}
- target_phys_addr_t rx_addr = rtl8139_addr64(rxbufLO, rxbufHI);
+ rx_addr = rtl8139_addr64(rxbufLO, rxbufHI);
/* receive/copy to target memory */
cpu_physical_memory_write( rx_addr, buf, size );
@@ -1025,11 +1030,14 @@
}
else
{
+ uint32_t val;
+ int avail;
+
#if defined(DEBUG_RTL8139)
printf("RTL8139: in ring Rx mode ================\n");
#endif
/* begin ring receiver mode */
- int avail = MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr, s->RxBufferSize);
+ avail = MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr, s->RxBufferSize);
/* if receiver buffer is empty then avail == 0 */
@@ -1050,7 +1058,7 @@
packet_header |= (((size+4) << 16) & 0xffff0000);
/* write header */
- uint32_t val = cpu_to_le32(packet_header);
+ val = cpu_to_le32(packet_header);
rtl8139_write_buffer(s, (uint8_t *)&val, 4);
@@ -1270,6 +1278,8 @@
static void rtl8139_BasicModeCtrl_write(RTL8139State *s, uint32_t val)
{
+ uint32 mask;
+
val &= 0xffff;
#ifdef DEBUG_RTL8139
@@ -1277,7 +1287,7 @@
#endif
/* mask unwriteable bits */
- uint32 mask = 0x4cff;
+ mask = 0x4cff;
if (1 || !rtl8139_config_writeable(s))
{
@@ -1330,6 +1340,7 @@
static void rtl8139_Cfg9346_write(RTL8139State *s, uint32_t val)
{
+ uint32_t opmode, eeprom_val;
val &= 0xff;
#ifdef DEBUG_RTL8139
@@ -1339,8 +1350,8 @@
/* mask unwriteable bits */
val = SET_MASKED(val, 0x31, s->Cfg9346);
- uint32_t opmode = val & 0xc0;
- uint32_t eeprom_val = val & 0xf;
+ opmode = val & 0xc0;
+ eeprom_val = val & 0xf;
if (opmode == 0x80) {
/* eeprom access */
@@ -1594,6 +1605,9 @@
static int rtl8139_transmit_one(RTL8139State *s, int descriptor)
{
+ int txsize;
+ uint8_t txbuffer[0x2000];
+
if (!rtl8139_transmitter_enabled(s))
{
#ifdef DEBUG_RTL8139
@@ -1614,8 +1628,7 @@
printf("RTL8139: +++ transmitting from descriptor %d\n", descriptor);
#endif
- int txsize = s->TxStatus[descriptor] & 0x1fff;
- uint8_t txbuffer[0x2000];
+ txsize = s->TxStatus[descriptor] & 0x1fff;
#ifdef DEBUG_RTL8139
printf("RTL8139: +++ transmit reading %d bytes from host memory at 0x%08x\n", txsize, s->TxAddr[descriptor]);
@@ -1641,6 +1654,52 @@
static int rtl8139_cplus_transmit_one(RTL8139State *s)
{
+/* w0 ownership flag */
+#define CP_TX_OWN (1<<31)
+/* w0 end of ring flag */
+#define CP_TX_EOR (1<<30)
+/* first segment of received packet flag */
+#define CP_TX_FS (1<<29)
+/* last segment of received packet flag */
+#define CP_TX_LS (1<<28)
+/* large send packet flag */
+#define CP_TX_LGSEN (1<<27)
+/* IP checksum offload flag */
+#define CP_TX_IPCS (1<<18)
+/* UDP checksum offload flag */
+#define CP_TX_UDPCS (1<<17)
+/* TCP checksum offload flag */
+#define CP_TX_TCPCS (1<<16)
+
+/* w0 bits 0...15 : buffer size */
+#define CP_TX_BUFFER_SIZE (1<<16)
+#define CP_TX_BUFFER_SIZE_MASK (CP_TX_BUFFER_SIZE - 1)
+/* w1 tag available flag */
+#define CP_RX_TAGC (1<<17)
+/* w1 bits 0...15 : VLAN tag */
+#define CP_TX_VLAN_TAG_MASK ((1<<16) - 1)
+/* w2 low 32bit of Rx buffer ptr */
+/* w3 high 32bit of Rx buffer ptr */
+
+/* set after transmission */
+/* FIFO underrun flag */
+#define CP_TX_STATUS_UNF (1<<25)
+/* transmit error summary flag, valid if set any of three below */
+#define CP_TX_STATUS_TES (1<<23)
+/* out-of-window collision flag */
+#define CP_TX_STATUS_OWC (1<<22)
+/* link failure flag */
+#define CP_TX_STATUS_LNKF (1<<21)
+/* excessive collisions flag */
+#define CP_TX_STATUS_EXC (1<<20)
+
+ int descriptor;
+ target_phys_addr_t cplus_tx_ring_desc;
+ uint32_t val, txdw0,txdw1,txbufLO,txbufHI;
+ int txsize;
+ target_phys_addr_t tx_addr;
+ uint8_t txbuffer[CP_TX_BUFFER_SIZE];
+
if (!rtl8139_transmitter_enabled(s))
{
#ifdef DEBUG_RTL8139
@@ -1657,10 +1716,9 @@
return 0 ;
}
- int descriptor = s->currCPlusTxDesc;
+ descriptor = s->currCPlusTxDesc;
- target_phys_addr_t cplus_tx_ring_desc =
- rtl8139_addr64(s->TxAddr[0], s->TxAddr[1]);
+ cplus_tx_ring_desc = rtl8139_addr64(s->TxAddr[0], s->TxAddr[1]);
/* Normal priority ring */
cplus_tx_ring_desc += 16 * descriptor;
@@ -1670,8 +1728,6 @@
descriptor, s->TxAddr[1], s->TxAddr[0], cplus_tx_ring_desc);
#endif
- uint32_t val, txdw0,txdw1,txbufLO,txbufHI;
-
cpu_physical_memory_read(cplus_tx_ring_desc, (uint8_t *)&val, 4);
txdw0 = le32_to_cpu(val);
cpu_physical_memory_read(cplus_tx_ring_desc+4, (uint8_t *)&val, 4);
@@ -1687,44 +1743,6 @@
txdw0, txdw1, txbufLO, txbufHI);
#endif
-/* w0 ownership flag */
-#define CP_TX_OWN (1<<31)
-/* w0 end of ring flag */
-#define CP_TX_EOR (1<<30)
-/* first segment of received packet flag */
-#define CP_TX_FS (1<<29)
-/* last segment of received packet flag */
-#define CP_TX_LS (1<<28)
-/* large send packet flag */
-#define CP_TX_LGSEN (1<<27)
-/* IP checksum offload flag */
-#define CP_TX_IPCS (1<<18)
-/* UDP checksum offload flag */
-#define CP_TX_UDPCS (1<<17)
-/* TCP checksum offload flag */
-#define CP_TX_TCPCS (1<<16)
-
-/* w0 bits 0...15 : buffer size */
-#define CP_TX_BUFFER_SIZE (1<<16)
-#define CP_TX_BUFFER_SIZE_MASK (CP_TX_BUFFER_SIZE - 1)
-/* w1 tag available flag */
-#define CP_RX_TAGC (1<<17)
-/* w1 bits 0...15 : VLAN tag */
-#define CP_TX_VLAN_TAG_MASK ((1<<16) - 1)
-/* w2 low 32bit of Rx buffer ptr */
-/* w3 high 32bit of Rx buffer ptr */
-
-/* set after transmission */
-/* FIFO underrun flag */
-#define CP_TX_STATUS_UNF (1<<25)
-/* transmit error summary flag, valid if set any of three below */
-#define CP_TX_STATUS_TES (1<<23)
-/* out-of-window collision flag */
-#define CP_TX_STATUS_OWC (1<<22)
-/* link failure flag */
-#define CP_TX_STATUS_LNKF (1<<21)
-/* excessive collisions flag */
-#define CP_TX_STATUS_EXC (1<<20)
if (!(txdw0 & CP_TX_OWN))
{
@@ -1738,10 +1756,8 @@
printf("RTL8139: +++ C+ Tx mode : transmitting from descriptor %d\n", descriptor);
#endif
- int txsize = txdw0 & CP_TX_BUFFER_SIZE_MASK;
- target_phys_addr_t tx_addr = rtl8139_addr64(txbufLO, txbufHI);
-
- uint8_t txbuffer[CP_TX_BUFFER_SIZE];
+ txsize = txdw0 & CP_TX_BUFFER_SIZE_MASK;
+ tx_addr = rtl8139_addr64(txbufLO, txbufHI);
#ifdef DEBUG_RTL8139
printf("RTL8139: +++ C+ mode transmit reading %d bytes from host memory at 0x%08x\n", txsize, tx_addr);
diff -ruN qemu/vl.c qemu-solaris/vl.c
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-04-28 23:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-28 23:21 [Qemu-devel] Qemu cleanup. tale duex Ben Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).