summaryrefslogtreecommitdiffstats
path: root/meta/packages/qemu/qemu-0.9.1+svn/qemu-n800-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/qemu/qemu-0.9.1+svn/qemu-n800-support.patch')
-rw-r--r--meta/packages/qemu/qemu-0.9.1+svn/qemu-n800-support.patch2381
1 files changed, 0 insertions, 2381 deletions
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/qemu-n800-support.patch b/meta/packages/qemu/qemu-0.9.1+svn/qemu-n800-support.patch
deleted file mode 100644
index 1224fb4cbd..0000000000
--- a/meta/packages/qemu/qemu-0.9.1+svn/qemu-n800-support.patch
+++ /dev/null
@@ -1,2381 +0,0 @@
1diff -urN 4242/cpu-all.h qemu-omap/cpu-all.h
2--- 4242/cpu-all.h 2008-04-24 21:26:19.000000000 +0100
3+++ qemu-omap/cpu-all.h 2008-04-23 09:57:55.000000000 +0100
4@@ -816,7 +816,7 @@
5 /* physical memory access */
6 #define TLB_INVALID_MASK (1 << 3)
7 #define IO_MEM_SHIFT 4
8-#define IO_MEM_NB_ENTRIES (1 << (TARGET_PAGE_BITS - IO_MEM_SHIFT))
9+#define IO_MEM_NB_ENTRIES (16 << (TARGET_PAGE_BITS - IO_MEM_SHIFT))
10
11 #define IO_MEM_RAM (0 << IO_MEM_SHIFT) /* hardcoded offset */
12 #define IO_MEM_ROM (1 << IO_MEM_SHIFT) /* hardcoded offset */
13diff -urN 4242/exec.c qemu-omap/exec.c
14--- 4242/exec.c 2008-04-24 18:11:49.000000000 +0100
15+++ qemu-omap/exec.c 2008-04-23 09:57:55.000000000 +0100
16@@ -1664,7 +1664,7 @@
17 {
18 if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && !(pd & IO_MEM_ROMD)) {
19 /* IO memory case */
20- address = vaddr | pd;
21+ address = vaddr | (pd & ~TARGET_PAGE_MASK);
22 addend = paddr;
23 } else {
24 /* standard memory */
25@@ -1698,7 +1698,9 @@
26 } else {
27 te->addr_read = -1;
28 }
29- if (prot & PAGE_EXEC) {
30+ if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && !(pd & IO_MEM_ROMD)) {
31+ te->addr_code = pd;
32+ } else if (prot & PAGE_EXEC) {
33 te->addr_code = address;
34 } else {
35 te->addr_code = -1;
36@@ -2493,7 +2495,9 @@
37 if (io_index <= 0) {
38 if (io_mem_nb >= IO_MEM_NB_ENTRIES)
39 return -1;
40- io_index = io_mem_nb++;
41+ do io_index = io_mem_nb++;
42+ while (((io_index << IO_MEM_SHIFT) & ~TARGET_PAGE_MASK)
43+ <= IO_MEM_NOTDIRTY);
44 } else {
45 if (io_index >= IO_MEM_NB_ENTRIES)
46 return -1;
47diff -urN 4242/hw/max7310.c qemu-omap/hw/max7310.c
48--- 4242/hw/max7310.c 2008-04-24 18:11:49.000000000 +0100
49+++ qemu-omap/hw/max7310.c 2008-03-02 19:31:55.000000000 +0000
50@@ -134,8 +134,8 @@
51 s->i2c_command_byte = 1;
52 break;
53 case I2C_FINISH:
54- if (s->len == 1)
55 #ifdef VERBOSE
56+ if (s->len == 1)
57 printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->len);
58 #endif
59 break;
60diff -urN 4242/hw/ndis.h qemu-omap/hw/ndis.h
61--- 4242/hw/ndis.h 1970-01-01 01:00:00.000000000 +0100
62+++ qemu-omap/hw/ndis.h 2008-04-23 09:57:56.000000000 +0100
63@@ -0,0 +1,217 @@
64+/*
65+ * ndis.h
66+ *
67+ * ntddndis.h modified by Benedikt Spranger <b.spranger@pengutronix.de>
68+ *
69+ * Thanks to the cygwin development team,
70+ * espacially to Casper S. Hornstrup <chorns@users.sourceforge.net>
71+ *
72+ * THIS SOFTWARE IS NOT COPYRIGHTED
73+ *
74+ * This source code is offered for use in the public domain. You may
75+ * use, modify or distribute it freely.
76+ *
77+ * This code is distributed in the hope that it will be useful but
78+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
79+ * DISCLAIMED. This includes but is not limited to warranties of
80+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
81+ *
82+ */
83+
84+#ifndef _LINUX_NDIS_H
85+#define _LINUX_NDIS_H
86+
87+
88+#define NDIS_STATUS_MULTICAST_FULL 0xC0010009
89+#define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A
90+#define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B
91+
92+enum NDIS_DEVICE_POWER_STATE {
93+ NdisDeviceStateUnspecified = 0,
94+ NdisDeviceStateD0,
95+ NdisDeviceStateD1,
96+ NdisDeviceStateD2,
97+ NdisDeviceStateD3,
98+ NdisDeviceStateMaximum
99+};
100+
101+struct NDIS_PM_WAKE_UP_CAPABILITIES {
102+ enum NDIS_DEVICE_POWER_STATE MinMagicPacketWakeUp;
103+ enum NDIS_DEVICE_POWER_STATE MinPatternWakeUp;
104+ enum NDIS_DEVICE_POWER_STATE MinLinkChangeWakeUp;
105+};
106+
107+/* NDIS_PNP_CAPABILITIES.Flags constants */
108+#define NDIS_DEVICE_WAKE_UP_ENABLE 0x00000001
109+#define NDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002
110+#define NDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004
111+
112+struct NDIS_PNP_CAPABILITIES {
113+ __le32 Flags;
114+ struct NDIS_PM_WAKE_UP_CAPABILITIES WakeUpCapabilities;
115+};
116+
117+struct NDIS_PM_PACKET_PATTERN {
118+ __le32 Priority;
119+ __le32 Reserved;
120+ __le32 MaskSize;
121+ __le32 PatternOffset;
122+ __le32 PatternSize;
123+ __le32 PatternFlags;
124+};
125+
126+
127+/* Required Object IDs (OIDs) */
128+#define OID_GEN_SUPPORTED_LIST 0x00010101
129+#define OID_GEN_HARDWARE_STATUS 0x00010102
130+#define OID_GEN_MEDIA_SUPPORTED 0x00010103
131+#define OID_GEN_MEDIA_IN_USE 0x00010104
132+#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
133+#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
134+#define OID_GEN_LINK_SPEED 0x00010107
135+#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
136+#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
137+#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
138+#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
139+#define OID_GEN_VENDOR_ID 0x0001010C
140+#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D
141+#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
142+#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
143+#define OID_GEN_DRIVER_VERSION 0x00010110
144+#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
145+#define OID_GEN_PROTOCOL_OPTIONS 0x00010112
146+#define OID_GEN_MAC_OPTIONS 0x00010113
147+#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
148+#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
149+#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
150+#define OID_GEN_SUPPORTED_GUIDS 0x00010117
151+#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
152+#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
153+#define OID_GEN_MACHINE_NAME 0x0001021A
154+#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
155+#define OID_GEN_VLAN_ID 0x0001021C
156+
157+/* Optional OIDs */
158+#define OID_GEN_MEDIA_CAPABILITIES 0x00010201
159+#define OID_GEN_PHYSICAL_MEDIUM 0x00010202
160+
161+/* Required statistics OIDs */
162+#define OID_GEN_XMIT_OK 0x00020101
163+#define OID_GEN_RCV_OK 0x00020102
164+#define OID_GEN_XMIT_ERROR 0x00020103
165+#define OID_GEN_RCV_ERROR 0x00020104
166+#define OID_GEN_RCV_NO_BUFFER 0x00020105
167+
168+/* Optional statistics OIDs */
169+#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
170+#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
171+#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
172+#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
173+#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
174+#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
175+#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207
176+#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
177+#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209
178+#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
179+#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
180+#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
181+#define OID_GEN_RCV_CRC_ERROR 0x0002020D
182+#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
183+#define OID_GEN_GET_TIME_CAPS 0x0002020F
184+#define OID_GEN_GET_NETCARD_TIME 0x00020210
185+#define OID_GEN_NETCARD_LOAD 0x00020211
186+#define OID_GEN_DEVICE_PROFILE 0x00020212
187+#define OID_GEN_INIT_TIME_MS 0x00020213
188+#define OID_GEN_RESET_COUNTS 0x00020214
189+#define OID_GEN_MEDIA_SENSE_COUNTS 0x00020215
190+#define OID_GEN_FRIENDLY_NAME 0x00020216
191+#define OID_GEN_MINIPORT_INFO 0x00020217
192+#define OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218
193+
194+/* IEEE 802.3 (Ethernet) OIDs */
195+#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
196+
197+#define OID_802_3_PERMANENT_ADDRESS 0x01010101
198+#define OID_802_3_CURRENT_ADDRESS 0x01010102
199+#define OID_802_3_MULTICAST_LIST 0x01010103
200+#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
201+#define OID_802_3_MAC_OPTIONS 0x01010105
202+#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
203+#define OID_802_3_XMIT_ONE_COLLISION 0x01020102
204+#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
205+#define OID_802_3_XMIT_DEFERRED 0x01020201
206+#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
207+#define OID_802_3_RCV_OVERRUN 0x01020203
208+#define OID_802_3_XMIT_UNDERRUN 0x01020204
209+#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
210+#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
211+#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
212+
213+/* OID_GEN_MINIPORT_INFO constants */
214+#define NDIS_MINIPORT_BUS_MASTER 0x00000001
215+#define NDIS_MINIPORT_WDM_DRIVER 0x00000002
216+#define NDIS_MINIPORT_SG_LIST 0x00000004
217+#define NDIS_MINIPORT_SUPPORTS_MEDIA_QUERY 0x00000008
218+#define NDIS_MINIPORT_INDICATES_PACKETS 0x00000010
219+#define NDIS_MINIPORT_IGNORE_PACKET_QUEUE 0x00000020
220+#define NDIS_MINIPORT_IGNORE_REQUEST_QUEUE 0x00000040
221+#define NDIS_MINIPORT_IGNORE_TOKEN_RING_ERRORS 0x00000080
222+#define NDIS_MINIPORT_INTERMEDIATE_DRIVER 0x00000100
223+#define NDIS_MINIPORT_IS_NDIS_5 0x00000200
224+#define NDIS_MINIPORT_IS_CO 0x00000400
225+#define NDIS_MINIPORT_DESERIALIZE 0x00000800
226+#define NDIS_MINIPORT_REQUIRES_MEDIA_POLLING 0x00001000
227+#define NDIS_MINIPORT_SUPPORTS_MEDIA_SENSE 0x00002000
228+#define NDIS_MINIPORT_NETBOOT_CARD 0x00004000
229+#define NDIS_MINIPORT_PM_SUPPORTED 0x00008000
230+#define NDIS_MINIPORT_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00010000
231+#define NDIS_MINIPORT_USES_SAFE_BUFFER_APIS 0x00020000
232+#define NDIS_MINIPORT_HIDDEN 0x00040000
233+#define NDIS_MINIPORT_SWENUM 0x00080000
234+#define NDIS_MINIPORT_SURPRISE_REMOVE_OK 0x00100000
235+#define NDIS_MINIPORT_NO_HALT_ON_SUSPEND 0x00200000
236+#define NDIS_MINIPORT_HARDWARE_DEVICE 0x00400000
237+#define NDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS 0x00800000
238+#define NDIS_MINIPORT_64BITS_DMA 0x01000000
239+
240+#define NDIS_MEDIUM_802_3 0x00000000
241+#define NDIS_MEDIUM_802_5 0x00000001
242+#define NDIS_MEDIUM_FDDI 0x00000002
243+#define NDIS_MEDIUM_WAN 0x00000003
244+#define NDIS_MEDIUM_LOCAL_TALK 0x00000004
245+#define NDIS_MEDIUM_DIX 0x00000005
246+#define NDIS_MEDIUM_ARCENT_RAW 0x00000006
247+#define NDIS_MEDIUM_ARCENT_878_2 0x00000007
248+#define NDIS_MEDIUM_ATM 0x00000008
249+#define NDIS_MEDIUM_WIRELESS_LAN 0x00000009
250+#define NDIS_MEDIUM_IRDA 0x0000000A
251+#define NDIS_MEDIUM_BPC 0x0000000B
252+#define NDIS_MEDIUM_CO_WAN 0x0000000C
253+#define NDIS_MEDIUM_1394 0x0000000D
254+
255+#define NDIS_PACKET_TYPE_DIRECTED 0x00000001
256+#define NDIS_PACKET_TYPE_MULTICAST 0x00000002
257+#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
258+#define NDIS_PACKET_TYPE_BROADCAST 0x00000008
259+#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
260+#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
261+#define NDIS_PACKET_TYPE_SMT 0x00000040
262+#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
263+#define NDIS_PACKET_TYPE_GROUP 0x00000100
264+#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200
265+#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400
266+#define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800
267+
268+#define NDIS_MEDIA_STATE_CONNECTED 0x00000000
269+#define NDIS_MEDIA_STATE_DISCONNECTED 0x00000001
270+
271+#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
272+#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
273+#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
274+#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
275+#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
276+#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
277+#define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
278+#define NDIS_MAC_OPTION_RESERVED 0x80000000
279+
280+#endif /* _LINUX_NDIS_H */
281diff -urN 4242/hw/nseries.c qemu-omap/hw/nseries.c
282--- 4242/hw/nseries.c 2008-04-24 18:11:49.000000000 +0100
283+++ qemu-omap/hw/nseries.c 2008-04-23 09:57:56.000000000 +0100
284@@ -602,6 +602,37 @@
285 (void *) &config7, sizeof(config7));
286 }
287
288+#if 0
289+static uint32_t n800_pinout[104] = {
290+ 0x080f00d8, 0x00d40808, 0x03080808, 0x080800d0,
291+ 0x00dc0808, 0x0b0f0f00, 0x080800b4, 0x00c00808,
292+ 0x08080808, 0x180800c4, 0x00b80000, 0x08080808,
293+ 0x080800bc, 0x00cc0808, 0x08081818, 0x18180128,
294+ 0x01241800, 0x18181818, 0x000000f0, 0x01300000,
295+ 0x00001b0b, 0x1b0f0138, 0x00e0181b, 0x1b031b0b,
296+ 0x180f0078, 0x00740018, 0x0f0f0f1a, 0x00000080,
297+ 0x007c0000, 0x00000000, 0x00000088, 0x00840000,
298+ 0x00000000, 0x00000094, 0x00980300, 0x0f180003,
299+ 0x0000008c, 0x00900f0f, 0x0f0f1b00, 0x0f00009c,
300+ 0x01140000, 0x1b1b0f18, 0x0818013c, 0x01400008,
301+ 0x00001818, 0x000b0110, 0x010c1800, 0x0b030b0f,
302+ 0x181800f4, 0x00f81818, 0x00000018, 0x000000fc,
303+ 0x00401808, 0x00000000, 0x0f1b0030, 0x003c0008,
304+ 0x00000000, 0x00000038, 0x00340000, 0x00000000,
305+ 0x1a080070, 0x00641a1a, 0x08080808, 0x08080060,
306+ 0x005c0808, 0x08080808, 0x08080058, 0x00540808,
307+ 0x08080808, 0x0808006c, 0x00680808, 0x08080808,
308+ 0x000000a8, 0x00b00000, 0x08080808, 0x000000a0,
309+ 0x00a40000, 0x00000000, 0x08ff0050, 0x004c0808,
310+ 0xffffffff, 0xffff0048, 0x0044ffff, 0xffffffff,
311+ 0x000000ac, 0x01040800, 0x08080b0f, 0x18180100,
312+ 0x01081818, 0x0b0b1808, 0x1a0300e4, 0x012c0b1a,
313+ 0x02020018, 0x0b000134, 0x011c0800, 0x0b1b1b00,
314+ 0x0f0000c8, 0x00ec181b, 0x000f0f02, 0x00180118,
315+ 0x01200000, 0x0f0b1b1b, 0x0f0200e8, 0x0000020b,
316+};
317+#endif
318+
319 /* Setup sequence done by the bootloader */
320 static void n800_boot_init(void *opaque)
321 {
322@@ -942,3 +973,71 @@
323 "Nokia N800 aka. RX-34 tablet (OMAP2420)",
324 n800_init,
325 };
326+
327+#if 0
328+/* cx3110x.c */
329+#define CY_ARM_INT 0x00
330+#define CY_ARM_INT_ENA 0x00
331+#define CY_HOST_INT 0x00
332+#define CY_HOST_INT_ENA 0x00
333+#define CY_HOST_INT_ACK 0x00
334+#define CY_GP1_COMM 0x00
335+#define CY_GP2_COMM 0x00
336+#define CY_DEV_CTRL_STA 0x00
337+#define CY_DMA_DATA 0x00 /* 16-bit */
338+#define CY_DMA_WR_CTRL 0x00 /* 16-bit */
339+#define CY_DMA_WR_LEN 0x00 /* 16-bit */
340+#define CY_DMA_WR_BASE 0x00
341+#define CY_DMA_RD_CTRL 0x00 /* 16-bit */
342+#define CY_DMA_RD_LEN 0x00 /* 16-bit */
343+#define CY_DMA_RD_BASE 0x00
344+
345+HW:
346+(spi bus 1.0)
347+ tsc2005
348+(spi bus 1.1)
349+ lcd_mipid
350+(spi bus 2.0)
351+ cx3110x (WLAN)
352+(spi somewhere?)
353+ pc2400m (WiMAX)
354+(i2c bus 0)
355+ TLV320AIC33 (audio codec on i2c)
356+ TCM825x (camera on i2c)
357+ lp5521 (LED on i2c)
358+ tsl2563 (light sensor, hwmon on i2c)
359+ lm8323 (keypad on i2c)
360+(i2c bus 1)
361+ tmp105 (temperature sensor, hwmon on i2c)
362+ menelaus (power on i2c)
363+
364+GPIO 0: out hi
365+GPIO 8: in hi
366+GPIO 9: out hi
367+GPIO 10: out lo
368+GPIO 12: out lo
369+GPIO 15: out lo
370+GPIO 23: out hi
371+GPIO 26: in hi, irq-186 rising
372+GPIO 53: out lo
373+GPIO 58: in hi, irq-218 low wakeup
374+GPIO 62: out lo
375+GPIO 64: out hi
376+GPIO 65: in hi
377+GPIO 66: out lo
378+GPIO 93: out lo
379+GPIO 94: in hi
380+GPIO 95: out lo
381+GPIO 96: out hi
382+GPIO 101: out lo
383+GPIO 102: in hi, irq-262 bothedge
384+GPIO 106: in hi, irq-266 falling wakeup
385+GPIO 107: in hi, irq-267 bothedge
386+GPIO 108: in lo, irq-268 rising wakeup
387+GPIO 109: in hi, irq-269 falling wakeup
388+GPIO 110: in hi, irq-270 bothedge
389+GPIO 111: in lo, irq-271 rising
390+GPIO 112: out hi
391+GPIO 118: out hi
392+GPIO 125: in lo, irq-285 rising
393+#endif
394diff -urN 4242/hw/omap2.c qemu-omap/hw/omap2.c
395--- 4242/hw/omap2.c 2008-04-24 18:11:49.000000000 +0100
396+++ qemu-omap/hw/omap2.c 2008-04-23 09:57:56.000000000 +0100
397@@ -3675,152 +3675,152 @@
398 omap_findclk(s, "dss_l4_iclk"));
399
400 /* All register mappings (includin those not currenlty implemented):
401- * SystemControlMod 48000000 - 48000fff
402- * SystemControlL4 48001000 - 48001fff
403- * 32kHz Timer Mod 48004000 - 48004fff
404- * 32kHz Timer L4 48005000 - 48005fff
405- * PRCM ModA 48008000 - 480087ff
406+ * SystemControlMod 48000000 - 48000fff (REV 0x00000010)
407+ * SystemControlL4 48001000 - 48001fff (0x00200010, 0x01000200, 0x00000000)
408+ * 32kHz Timer Mod 48004000 - 48004fff (REV 0x00000011)
409+ * 32kHz Timer L4 48005000 - 48005fff (0x00200010, 0x01000200, 0x00000000)
410+ * PRCM ModA 48008000 - 480087ff (REV 0x00000010)
411 * PRCM ModB 48008800 - 48008fff
412- * PRCM L4 48009000 - 48009fff
413- * TEST-BCM Mod 48012000 - 48012fff
414- * TEST-BCM L4 48013000 - 48013fff
415- * TEST-TAP Mod 48014000 - 48014fff
416- * TEST-TAP L4 48015000 - 48015fff
417- * GPIO1 Mod 48018000 - 48018fff
418- * GPIO Top 48019000 - 48019fff
419- * GPIO2 Mod 4801a000 - 4801afff
420- * GPIO L4 4801b000 - 4801bfff
421- * GPIO3 Mod 4801c000 - 4801cfff
422- * GPIO4 Mod 4801e000 - 4801efff
423- * WDTIMER1 Mod 48020000 - 48010fff
424+ * PRCM L4 48009000 - 48009fff (0x00200010, 0x00000200, 0x00000000)
425+ * TEST-BCM Mod 48012000 - 48012fff (REV 0x00000010)
426+ * TEST-BCM L4 48013000 - 48013fff (0x00200010, 0x00000200, 0x00000000)
427+ * TEST-TAP Mod 48014000 - 48014fff (REV 0x00000010)
428+ * TEST-TAP L4 48015000 - 48015fff (0x00200010, 0x00000200, 0x00000000)
429+ * GPIO1 Mod 48018000 - 48018fff (REV 0x00000018)
430+ * GPIO Top 48019000 - 48019fff (REV 0x00000011)
431+ * GPIO2 Mod 4801a000 - 4801afff (REV 0x00000018)
432+ * GPIO L4 4801b000 - 4801bfff (0x00200010, 0x00000200, 0x00000000)
433+ * GPIO3 Mod 4801c000 - 4801cfff (REV 0x00000018)
434+ * GPIO4 Mod 4801e000 - 4801efff (REV 0x00000018)
435+ * WDTIMER1 Mod 48020000 - 48010fff (REV Abort)
436 * WDTIMER Top 48021000 - 48011fff
437- * WDTIMER2 Mod 48022000 - 48012fff
438- * WDTIMER L4 48023000 - 48013fff
439- * WDTIMER3 Mod 48024000 - 48014fff
440- * WDTIMER3 L4 48025000 - 48015fff
441- * WDTIMER4 Mod 48026000 - 48016fff
442- * WDTIMER4 L4 48027000 - 48017fff
443- * GPTIMER1 Mod 48028000 - 48018fff
444- * GPTIMER1 L4 48029000 - 48019fff
445- * GPTIMER2 Mod 4802a000 - 4801afff
446- * GPTIMER2 L4 4802b000 - 4801bfff
447+ * WDTIMER2 Mod 48022000 - 48012fff (REV 0x00000011)
448+ * WDTIMER L4 48023000 - 48013fff (0x00200010, 0x00000200, 0x00000000)
449+ * WDTIMER3 Mod 48024000 - 48014fff (REV 0x00000011)
450+ * WDTIMER3 L4 48025000 - 48015fff (0x00200010, 0x00000200, 0x00000000)
451+ * WDTIMER4 Mod 48026000 - 48016fff (REV 0x00000011)
452+ * WDTIMER4 L4 48027000 - 48017fff (0x00200010, 0x00000200, 0x00000000)
453+ * GPTIMER1 Mod 48028000 - 48018fff (REV 0x00000013)
454+ * GPTIMER1 L4 48029000 - 48019fff (0x00200010, 0x00000200, 0x00000000)
455+ * GPTIMER2 Mod 4802a000 - 4801afff (REV Abort)
456+ * GPTIMER2 L4 4802b000 - 4801bfff (0x00200010, 0x00000200, 0x00000000)
457 * L4-Config AP 48040000 - 480407ff
458 * L4-Config IP 48040800 - 48040fff
459 * L4-Config LA 48041000 - 48041fff
460- * ARM11ETB Mod 48048000 - 48049fff
461- * ARM11ETB L4 4804a000 - 4804afff
462- * DISPLAY Top 48050000 - 480503ff
463- * DISPLAY DISPC 48050400 - 480507ff
464- * DISPLAY RFBI 48050800 - 48050bff
465- * DISPLAY VENC 48050c00 - 48050fff
466- * DISPLAY L4 48051000 - 48051fff
467- * CAMERA Top 48052000 - 480523ff
468- * CAMERA core 48052400 - 480527ff
469- * CAMERA DMA 48052800 - 48052bff
470- * CAMERA MMU 48052c00 - 48052fff
471- * CAMERA L4 48053000 - 48053fff
472- * SDMA Mod 48056000 - 48056fff
473- * SDMA L4 48057000 - 48057fff
474- * SSI Top 48058000 - 48058fff
475- * SSI GDD 48059000 - 48059fff
476- * SSI Port1 4805a000 - 4805afff
477- * SSI Port2 4805b000 - 4805bfff
478- * SSI L4 4805c000 - 4805cfff
479- * USB Mod 4805e000 - 480fefff
480- * USB L4 4805f000 - 480fffff
481- * WIN_TRACER1 Mod 48060000 - 48060fff
482- * WIN_TRACER1 L4 48061000 - 48061fff
483- * WIN_TRACER2 Mod 48062000 - 48062fff
484- * WIN_TRACER2 L4 48063000 - 48063fff
485- * WIN_TRACER3 Mod 48064000 - 48064fff
486- * WIN_TRACER3 L4 48065000 - 48065fff
487- * WIN_TRACER4 Top 48066000 - 480660ff
488- * WIN_TRACER4 ETT 48066100 - 480661ff
489- * WIN_TRACER4 WT 48066200 - 480662ff
490- * WIN_TRACER4 L4 48067000 - 48067fff
491- * XTI Mod 48068000 - 48068fff
492- * XTI L4 48069000 - 48069fff
493- * UART1 Mod 4806a000 - 4806afff
494- * UART1 L4 4806b000 - 4806bfff
495- * UART2 Mod 4806c000 - 4806cfff
496- * UART2 L4 4806d000 - 4806dfff
497- * UART3 Mod 4806e000 - 4806efff
498- * UART3 L4 4806f000 - 4806ffff
499- * I2C1 Mod 48070000 - 48070fff
500- * I2C1 L4 48071000 - 48071fff
501- * I2C2 Mod 48072000 - 48072fff
502- * I2C2 L4 48073000 - 48073fff
503- * McBSP1 Mod 48074000 - 48074fff
504- * McBSP1 L4 48075000 - 48075fff
505- * McBSP2 Mod 48076000 - 48076fff
506- * McBSP2 L4 48077000 - 48077fff
507- * GPTIMER3 Mod 48078000 - 48078fff
508- * GPTIMER3 L4 48079000 - 48079fff
509- * GPTIMER4 Mod 4807a000 - 4807afff
510- * GPTIMER4 L4 4807b000 - 4807bfff
511- * GPTIMER5 Mod 4807c000 - 4807cfff
512- * GPTIMER5 L4 4807d000 - 4807dfff
513- * GPTIMER6 Mod 4807e000 - 4807efff
514- * GPTIMER6 L4 4807f000 - 4807ffff
515- * GPTIMER7 Mod 48080000 - 48080fff
516- * GPTIMER7 L4 48081000 - 48081fff
517- * GPTIMER8 Mod 48082000 - 48082fff
518- * GPTIMER8 L4 48083000 - 48083fff
519- * GPTIMER9 Mod 48084000 - 48084fff
520- * GPTIMER9 L4 48085000 - 48085fff
521- * GPTIMER10 Mod 48086000 - 48086fff
522- * GPTIMER10 L4 48087000 - 48087fff
523- * GPTIMER11 Mod 48088000 - 48088fff
524- * GPTIMER11 L4 48089000 - 48089fff
525- * GPTIMER12 Mod 4808a000 - 4808afff
526- * GPTIMER12 L4 4808b000 - 4808bfff
527- * EAC Mod 48090000 - 48090fff
528- * EAC L4 48091000 - 48091fff
529- * FAC Mod 48092000 - 48092fff
530- * FAC L4 48093000 - 48093fff
531- * MAILBOX Mod 48094000 - 48094fff
532- * MAILBOX L4 48095000 - 48095fff
533- * SPI1 Mod 48098000 - 48098fff
534- * SPI1 L4 48099000 - 48099fff
535- * SPI2 Mod 4809a000 - 4809afff
536- * SPI2 L4 4809b000 - 4809bfff
537- * MMC/SDIO Mod 4809c000 - 4809cfff
538- * MMC/SDIO L4 4809d000 - 4809dfff
539- * MS_PRO Mod 4809e000 - 4809efff
540- * MS_PRO L4 4809f000 - 4809ffff
541- * RNG Mod 480a0000 - 480a0fff
542- * RNG L4 480a1000 - 480a1fff
543- * DES3DES Mod 480a2000 - 480a2fff
544- * DES3DES L4 480a3000 - 480a3fff
545- * SHA1MD5 Mod 480a4000 - 480a4fff
546- * SHA1MD5 L4 480a5000 - 480a5fff
547- * AES Mod 480a6000 - 480a6fff
548- * AES L4 480a7000 - 480a7fff
549- * PKA Mod 480a8000 - 480a9fff
550- * PKA L4 480aa000 - 480aafff
551- * MG Mod 480b0000 - 480b0fff
552- * MG L4 480b1000 - 480b1fff
553- * HDQ/1-wire Mod 480b2000 - 480b2fff
554- * HDQ/1-wire L4 480b3000 - 480b3fff
555- * MPU interrupt 480fe000 - 480fefff
556- * IVA RAM 5c000000 - 5c01ffff
557- * IVA ROM 5c020000 - 5c027fff
558- * IMG_BUF_A 5c040000 - 5c040fff
559- * IMG_BUF_B 5c042000 - 5c042fff
560- * VLCDS 5c048000 - 5c0487ff
561- * IMX_COEF 5c049000 - 5c04afff
562- * IMX_CMD 5c051000 - 5c051fff
563- * VLCDQ 5c053000 - 5c0533ff
564- * VLCDH 5c054000 - 5c054fff
565- * SEQ_CMD 5c055000 - 5c055fff
566- * IMX_REG 5c056000 - 5c0560ff
567- * VLCD_REG 5c056100 - 5c0561ff
568- * SEQ_REG 5c056200 - 5c0562ff
569- * IMG_BUF_REG 5c056300 - 5c0563ff
570- * SEQIRQ_REG 5c056400 - 5c0564ff
571- * OCP_REG 5c060000 - 5c060fff
572- * SYSC_REG 5c070000 - 5c070fff
573- * MMU_REG 5d000000 - 5d000fff
574+ * ARM11ETB Mod 48048000 - 48049fff (REV 0x00000011)
575+ * ARM11ETB L4 4804a000 - 4804afff (0x00200010, 0x00000200, 0x00000000)
576+ * DISPLAY Top 48050000 - 480503ff (REV 0x00000003)
577+ * DISPLAY DISPC 48050400 - 480507ff (REV 0x00000020)
578+ * DISPLAY RFBI 48050800 - 48050bff (REV 0x00000010)
579+ * DISPLAY VENC 48050c00 - 48050fff (REV Abort)
580+ * DISPLAY L4 48051000 - 48051fff (0x00200010, 0x00000200, 0x00000100)
581+ * CAMERA Top 48052000 - 480523ff (REV 0x00000020)
582+ * CAMERA core 48052400 - 480527ff (REV 0x00000020)
583+ * CAMERA DMA 48052800 - 48052bff (REV 0x00000020)
584+ * CAMERA MMU 48052c00 - 48052fff (REV 0x00000010)
585+ * CAMERA L4 48053000 - 48053fff (0x00200010, 0x00000200, 0x00000000)
586+ * SDMA Mod 48056000 - 48056fff (REV 0x00000020)
587+ * SDMA L4 48057000 - 48057fff (0x00200010, 0x00000200, 0x00000000)
588+ * SSI Top 48058000 - 48058fff (REV Abort)
589+ * SSI GDD 48059000 - 48059fff (REV Abort)
590+ * SSI Port1 4805a000 - 4805afff (REV Abort)
591+ * SSI Port2 4805b000 - 4805bfff (REV Abort)
592+ * SSI L4 4805c000 - 4805cfff (0x00200010, 0x00000200, 0x00000100)
593+ * USB Mod 4805e000 - 480fefff (REV Abort)
594+ * USB L4 4805f000 - 480fffff (0x00200010, 0x01000200, 0x00000100)
595+ * WIN_TRACER1 Mod 48060000 - 48060fff (REV 0x00000020)
596+ * WIN_TRACER1 L4 48061000 - 48061fff (0x00200010, 0x00000200, 0x00000000)
597+ * WIN_TRACER2 Mod 48062000 - 48062fff (REV 0x00000020)
598+ * WIN_TRACER2 L4 48063000 - 48063fff (0x00200010, 0x00000200, 0x00000000)
599+ * WIN_TRACER3 Mod 48064000 - 48064fff (REV 0x00000020)
600+ * WIN_TRACER3 L4 48065000 - 48065fff (0x00200010, 0x00000200, 0x00000000)
601+ * WIN_TRACER4 Top 48066000 - 480660ff (REV 0x00000011)
602+ * WIN_TRACER4 ETT 48066100 - 480661ff (REV 0x00000011)
603+ * WIN_TRACER4 WT 48066200 - 480662ff (REV 0x00000020)
604+ * WIN_TRACER4 L4 48067000 - 48067fff (0x00200010, 0x00000200, 0x00000000)
605+ * XTI Mod 48068000 - 48068fff (REV 0x00000010)
606+ * XTI L4 48069000 - 48069fff (0x00200010, 0x00000200, 0x00000000)
607+ * UART1 Mod 4806a000 - 4806afff (MVR Abort)
608+ * UART1 L4 4806b000 - 4806bfff (0x00200010, 0x00000200, 0x00000000)
609+ * UART2 Mod 4806c000 - 4806cfff (MVR Abort)
610+ * UART2 L4 4806d000 - 4806dfff (0x00200010, 0x00000200, 0x00000000)
611+ * UART3 Mod 4806e000 - 4806efff (MVR 0x20)
612+ * UART3 L4 4806f000 - 4806ffff (0x00200010, 0x00000200, 0x00000000)
613+ * I2C1 Mod 48070000 - 48070fff (REV 0x0034)
614+ * I2C1 L4 48071000 - 48071fff (0x00200010, 0x01000200, 0x01000000)
615+ * I2C2 Mod 48072000 - 48072fff (REV 0x0034)
616+ * I2C2 L4 48073000 - 48073fff (0x00200010, 0x01000200, 0x01000000)
617+ * McBSP1 Mod 48074000 - 48074fff (REV Abort)
618+ * McBSP1 L4 48075000 - 48075fff (0x00200010, 0x01000200, 0x01000000)
619+ * McBSP2 Mod 48076000 - 48076fff (REV Abort)
620+ * McBSP2 L4 48077000 - 48077fff (0x00200010, 0x01000200, 0x01000000)
621+ * GPTIMER3 Mod 48078000 - 48078fff (REV Abort)
622+ * GPTIMER3 L4 48079000 - 48079fff (0x00200010, 0x00000200, 0x00000000)
623+ * GPTIMER4 Mod 4807a000 - 4807afff (REV Abort)
624+ * GPTIMER4 L4 4807b000 - 4807bfff (0x00200010, 0x00000200, 0x00000000)
625+ * GPTIMER5 Mod 4807c000 - 4807cfff (REV Abort)
626+ * GPTIMER5 L4 4807d000 - 4807dfff (0x00200010, 0x00000200, 0x00000000)
627+ * GPTIMER6 Mod 4807e000 - 4807efff (REV Abort)
628+ * GPTIMER6 L4 4807f000 - 4807ffff (0x00200010, 0x00000200, 0x00000000)
629+ * GPTIMER7 Mod 48080000 - 48080fff (REV Abort)
630+ * GPTIMER7 L4 48081000 - 48081fff (0x00200010, 0x00000200, 0x00000000)
631+ * GPTIMER8 Mod 48082000 - 48082fff (REV Abort)
632+ * GPTIMER8 L4 48083000 - 48083fff (0x00200010, 0x00000200, 0x00000000)
633+ * GPTIMER9 Mod 48084000 - 48084fff (REV Abort)
634+ * GPTIMER9 L4 48085000 - 48085fff (0x00200010, 0x00000200, 0x00000000)
635+ * GPTIMER10 Mod 48086000 - 48086fff (REV Abort)
636+ * GPTIMER10 L4 48087000 - 48087fff (0x00200010, 0x00000200, 0x00000000)
637+ * GPTIMER11 Mod 48088000 - 48088fff (REV Abort)
638+ * GPTIMER11 L4 48089000 - 48089fff (0x00200010, 0x00000200, 0x00000000)
639+ * GPTIMER12 Mod 4808a000 - 4808afff (REV Abort)
640+ * GPTIMER12 L4 4808b000 - 4808bfff (0x00200010, 0x00000200, 0x00000000)
641+ * EAC Mod 48090000 - 48090fff (REV Abort)
642+ * EAC L4 48091000 - 48091fff (0x00200010, 0x00000200, 0x00000000)
643+ * FAC Mod 48092000 - 48092fff (REV Abort)
644+ * FAC L4 48093000 - 48093fff (0x00200010, 0x00000200, 0x00000000)
645+ * MAILBOX Mod 48094000 - 48094fff (REV 0x00000010)
646+ * MAILBOX L4 48095000 - 48095fff (0x00200010, 0x00000200, 0x00000000)
647+ * SPI1 Mod 48098000 - 48098fff (REV Abort)
648+ * SPI1 L4 48099000 - 48099fff (0x00200010, 0x00000200, 0x00000000)
649+ * SPI2 Mod 4809a000 - 4809afff (REV Abort)
650+ * SPI2 L4 4809b000 - 4809bfff (0x00200010, 0x00000200, 0x00000000)
651+ * MMC/SDIO Mod 4809c000 - 4809cfff (REV 0x0044)
652+ * MMC/SDIO L4 4809d000 - 4809dfff (0x00200010, 0x01000200, 0x01000000)
653+ * MS_PRO Mod 4809e000 - 4809efff (REV Abort)
654+ * MS_PRO L4 4809f000 - 4809ffff (0x00200010, 0x01000200, 0x01000000)
655+ * RNG Mod 480a0000 - 480a0fff (REV 0xFC066F93?)
656+ * RNG L4 480a1000 - 480a1fff (0x00200010, 0x01000200, 0x00000000)
657+ * DES3DES Mod 480a2000 - 480a2fff (REV 0x00000000?)
658+ * DES3DES L4 480a3000 - 480a3fff (0x00200010, 0x01000200, 0x00000000)
659+ * SHA1MD5 Mod 480a4000 - 480a4fff (REV 0x00000000?)
660+ * SHA1MD5 L4 480a5000 - 480a5fff (0x00200010, 0x01000200, 0x00000000)
661+ * AES Mod 480a6000 - 480a6fff (REV 0x00000000?)
662+ * AES L4 480a7000 - 480a7fff (0x00200010, 0x00000200, 0x00000000)
663+ * PKA Mod 480a8000 - 480a9fff (REV 0x00000000?)
664+ * PKA L4 480aa000 - 480aafff (0x00200010, 0x00000200, 0x00000000)
665+ * MG Mod 480b0000 - 480b0fff (REV Abort)
666+ * MG L4 480b1000 - 480b1fff (0x00200010, 0x01000200, 0x01000000)
667+ * HDQ/1-wire Mod 480b2000 - 480b2fff (REV 0x00000002)
668+ * HDQ/1-wire L4 480b3000 - 480b3fff (0x00200010, 0x00000200, 0x00000000)
669+ * MPU interrupt 480fe000 - 480fefff (REV 0x00000020)
670+ * IVA RAM 5c000000 - 5c01ffff (REV Abort)
671+ * IVA ROM 5c020000 - 5c027fff (REV Abort)
672+ * IMG_BUF_A 5c040000 - 5c040fff (REV Abort)
673+ * IMG_BUF_B 5c042000 - 5c042fff (REV Abort)
674+ * VLCDS 5c048000 - 5c0487ff (REV Abort)
675+ * IMX_COEF 5c049000 - 5c04afff (REV Abort)
676+ * IMX_CMD 5c051000 - 5c051fff (REV Abort)
677+ * VLCDQ 5c053000 - 5c0533ff (REV Abort)
678+ * VLCDH 5c054000 - 5c054fff (REV Abort)
679+ * SEQ_CMD 5c055000 - 5c055fff (REV Abort)
680+ * IMX_REG 5c056000 - 5c0560ff (REV Abort)
681+ * VLCD_REG 5c056100 - 5c0561ff (REV Abort)
682+ * SEQ_REG 5c056200 - 5c0562ff (REV Abort)
683+ * IMG_BUF_REG 5c056300 - 5c0563ff (REV Abort)
684+ * SEQIRQ_REG 5c056400 - 5c0564ff (REV Abort)
685+ * OCP_REG 5c060000 - 5c060fff (REV Abort)
686+ * SYSC_REG 5c070000 - 5c070fff (REV Abort)
687+ * MMU_REG 5d000000 - 5d000fff (REV Abort)
688 * sDMA R 68000400 - 680005ff
689 * sDMA W 68000600 - 680007ff
690 * Display Control 68000800 - 680009ff
691@@ -3849,9 +3849,9 @@
692 * GPMC (firewall) 68006000 - 680063ff
693 * GPMC (err login) 68006400 - 680067ff
694 * SMS (err login) 68006c00 - 68006fff
695- * SMS registers 68008000 - 68008fff
696- * SDRC registers 68009000 - 68009fff
697- * GPMC registers 6800a000 6800afff
698+ * SMS registers 68008000 - 68008fff (REV 0x00000020)
699+ * SDRC registers 68009000 - 68009fff (REV 0x00000020)
700+ * GPMC registers 6800a000 6800afff (REV 0x00000020)
701 */
702
703 qemu_register_reset(omap2_mpu_reset, s);
704diff -urN 4242/hw/pc.c qemu-omap/hw/pc.c
705--- 4242/hw/pc.c 2008-04-24 21:26:22.000000000 +0100
706+++ qemu-omap/hw/pc.c 2008-04-23 09:57:56.000000000 +0100
707@@ -445,6 +445,37 @@
708 bdrv_set_boot_sector(drives_table[hda].bdrv, bootsect, sizeof(bootsect));
709 }
710
711+static int load_kernel(const char *filename, uint8_t *addr,
712+ uint8_t *real_addr)
713+{
714+ int fd, size;
715+ int setup_sects;
716+
717+ fd = open(filename, O_RDONLY | O_BINARY);
718+ if (fd < 0)
719+ return -1;
720+
721+ /* load 16 bit code */
722+ if (read(fd, real_addr, 512) != 512)
723+ goto fail;
724+ setup_sects = real_addr[0x1F1];
725+ if (!setup_sects)
726+ setup_sects = 4;
727+ if (read(fd, real_addr + 512, setup_sects * 512) !=
728+ setup_sects * 512)
729+ goto fail;
730+
731+ /* load 32 bit code */
732+ size = read(fd, addr, 16 * 1024 * 1024);
733+ if (size < 0)
734+ goto fail;
735+ close(fd);
736+ return size;
737+ fail:
738+ close(fd);
739+ return -1;
740+}
741+
742 static long get_file_size(FILE *f)
743 {
744 long where, size;
745diff -urN 4242/hw/tusb6010.c qemu-omap/hw/tusb6010.c
746--- 4242/hw/tusb6010.c 2008-04-23 12:18:54.000000000 +0100
747+++ qemu-omap/hw/tusb6010.c 2008-04-23 09:57:56.000000000 +0100
748@@ -287,9 +287,6 @@
749 /* TODO: How is this signalled? */
750 }
751
752-extern CPUReadMemoryFunc *musb_read[];
753-extern CPUWriteMemoryFunc *musb_write[];
754-
755 static uint32_t tusb_async_readb(void *opaque, target_phys_addr_t addr)
756 {
757 struct tusb_s *s = (struct tusb_s *) opaque;
758diff -urN 4242/hw/usb.h qemu-omap/hw/usb.h
759--- 4242/hw/usb.h 2008-04-23 12:18:54.000000000 +0100
760+++ qemu-omap/hw/usb.h 2008-04-23 09:57:56.000000000 +0100
761@@ -219,6 +219,9 @@
762 /* usb-msd.c */
763 USBDevice *usb_msd_init(const char *filename);
764
765+/* usb-net.c */
766+USBDevice *usb_net_init(NICInfo *nd);
767+
768 /* usb-wacom.c */
769 USBDevice *usb_wacom_init(void);
770
771@@ -254,3 +257,7 @@
772 uint32_t musb_core_intr_get(struct musb_s *s);
773 void musb_core_intr_clear(struct musb_s *s, uint32_t mask);
774 void musb_set_size(struct musb_s *s, int epnum, int size, int is_tx);
775+#ifdef NEED_CPU_H
776+extern CPUReadMemoryFunc *musb_read[];
777+extern CPUWriteMemoryFunc *musb_write[];
778+#endif
779diff -urN 4242/hw/usb-hub.c qemu-omap/hw/usb-hub.c
780--- 4242/hw/usb-hub.c 2008-04-23 11:43:37.000000000 +0100
781+++ qemu-omap/hw/usb-hub.c 2008-04-23 09:57:56.000000000 +0100
782@@ -146,8 +146,8 @@
783 0x07, /* u8 ep_bLength; */
784 0x05, /* u8 ep_bDescriptorType; Endpoint */
785 0x81, /* u8 ep_bEndpointAddress; IN Endpoint 1 */
786- 0x03, /* u8 ep_bmAttributes; Interrupt */
787- 0x02, 0x00, /* u16 ep_wMaxPacketSize; 1 + (MAX_ROOT_PORTS / 8) */
788+ 0x03, /* u8 ep_bmAttributes; Interrupt */
789+ 0x02, 0x00, /* u16 ep_wMaxPacketSize; 1 + (MAX_ROOT_PORTS / 8) */
790 0xff /* u8 ep_bInterval; (255ms -- usb 2.0 spec) */
791 };
792
793diff -urN 4242/hw/usb-net.c qemu-omap/hw/usb-net.c
794--- 4242/hw/usb-net.c 1970-01-01 01:00:00.000000000 +0100
795+++ qemu-omap/hw/usb-net.c 2008-04-23 09:57:56.000000000 +0100
796@@ -0,0 +1,1334 @@
797+/*
798+ * QEMU USB Net devices
799+ *
800+ * Copyright (c) 2006 Thomas Sailer
801+ * based on usb-hid.c Copyright (c) 2005 Fabrice Bellard
802+ *
803+ * Permission is hereby granted, free of charge, to any person obtaining a copy
804+ * of this software and associated documentation files (the "Software"), to deal
805+ * in the Software without restriction, including without limitation the rights
806+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
807+ * copies of the Software, and to permit persons to whom the Software is
808+ * furnished to do so, subject to the following conditions:
809+ *
810+ * The above copyright notice and this permission notice shall be included in
811+ * all copies or substantial portions of the Software.
812+ *
813+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
814+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
815+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
816+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
817+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
818+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
819+ * THE SOFTWARE.
820+ */
821+
822+#include "qemu-common.h"
823+#include "usb.h"
824+#include "net.h"
825+#include "../audio/sys-queue.h"
826+
827+typedef uint32_t __le32;
828+#include "ndis.h"
829+
830+/*#define TRAFFIC_DEBUG*/
831+/* Thanks to NetChip Technologies for donating this product ID.
832+ * It's for devices with only CDC Ethernet configurations.
833+ */
834+#define CDC_VENDOR_NUM 0x0525 /* NetChip */
835+#define CDC_PRODUCT_NUM 0xa4a1 /* Linux-USB Ethernet Gadget */
836+/* For hardware that can talk RNDIS and either of the above protocols,
837+ * use this ID ... the windows INF files will know it.
838+ */
839+#define RNDIS_VENDOR_NUM 0x0525 /* NetChip */
840+#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */
841+
842+#define STRING_MANUFACTURER 1
843+#define STRING_PRODUCT 2
844+#define STRING_ETHADDR 3
845+#define STRING_DATA 4
846+#define STRING_CONTROL 5
847+#define STRING_RNDIS_CONTROL 6
848+#define STRING_CDC 7
849+#define STRING_SUBSET 8
850+#define STRING_RNDIS 9
851+#define STRING_SERIALNUMBER 10
852+
853+#define DEV_CONFIG_VALUE 1 /* cdc or subset */
854+#define DEV_RNDIS_CONFIG_VALUE 2 /* rndis; optional */
855+
856+#define USB_CDC_SUBCLASS_ACM 0x02
857+#define USB_CDC_SUBCLASS_ETHERNET 0x06
858+
859+#define USB_CDC_PROTO_NONE 0
860+#define USB_CDC_ACM_PROTO_VENDOR 0xff
861+
862+#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */
863+#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */
864+#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */
865+#define USB_CDC_UNION_TYPE 0x06 /* union_desc */
866+#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */
867+
868+#define USB_DT_CS_INTERFACE 0x24
869+#define USB_DT_CS_ENDPOINT 0x25
870+
871+#define ClassInterfaceRequest \
872+ ((USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE)<<8)
873+#define ClassInterfaceOutRequest \
874+ ((USB_DIR_OUT|USB_TYPE_CLASS|USB_RECIP_INTERFACE)<<8)
875+
876+#define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00
877+#define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01
878+#define USB_CDC_REQ_SET_LINE_CODING 0x20
879+#define USB_CDC_REQ_GET_LINE_CODING 0x21
880+#define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22
881+#define USB_CDC_REQ_SEND_BREAK 0x23
882+#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
883+#define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41
884+#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42
885+#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43
886+#define USB_CDC_GET_ETHERNET_STATISTIC 0x44
887+
888+#define USB_ENDPOINT_XFER_BULK 2
889+#define USB_ENDPOINT_XFER_INT 3
890+
891+#define LOG2_STATUS_INTERVAL_MSEC 5 /* 1 << 5 == 32 msec */
892+#define STATUS_BYTECOUNT 16 /* 8 byte header + data */
893+
894+#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */
895+
896+/*
897+ * mostly the same descriptor as the linux gadget rndis driver
898+ */
899+static const uint8_t qemu_net_dev_descriptor[] = {
900+ 0x12, /* u8 bLength; */
901+ USB_DT_DEVICE, /* u8 bDescriptorType; Device */
902+ 0x00, 0x02, /* u16 bcdUSB; v2.0 */
903+ USB_CLASS_COMM, /* u8 bDeviceClass; */
904+ 0x00, /* u8 bDeviceSubClass; */
905+ 0x00, /* u8 bDeviceProtocol; [ low/full speeds only ] */
906+ 0x40, /* u8 bMaxPacketSize0 */
907+ RNDIS_VENDOR_NUM & 0xff, RNDIS_VENDOR_NUM >> 8, /* u16 idVendor; */
908+ RNDIS_PRODUCT_NUM & 0xff, RNDIS_PRODUCT_NUM >> 8, /* u16 idProduct; */
909+ 0x00, 0x00, /* u16 bcdDevice */
910+ STRING_MANUFACTURER, /* u8 iManufacturer; */
911+ STRING_PRODUCT, /* u8 iProduct; */
912+ STRING_SERIALNUMBER, /* u8 iSerialNumber; */
913+ 0x02 /* u8 bNumConfigurations; */
914+};
915+
916+static const uint8_t qemu_net_rndis_config_descriptor[] = {
917+ /* Configuration Descriptor */
918+ 0x09, /* u8 bLength */
919+ USB_DT_CONFIG, /* u8 bDescriptorType */
920+ 0x43, 0x00, /* le16 wTotalLength */
921+ 0x02, /* u8 bNumInterfaces */
922+ DEV_RNDIS_CONFIG_VALUE, /* u8 bConfigurationValue */
923+ STRING_RNDIS, /* u8 iConfiguration */
924+ 0xc0, /* u8 bmAttributes */
925+ 0x32, /* u8 bMaxPower */
926+ /* RNDIS Control Interface */
927+ 0x09, /* u8 bLength */
928+ USB_DT_INTERFACE, /* u8 bDescriptorType */
929+ 0x00, /* u8 bInterfaceNumber */
930+ 0x00, /* u8 bAlternateSetting */
931+ 0x01, /* u8 bNumEndpoints */
932+ USB_CLASS_COMM, /* u8 bInterfaceClass */
933+ USB_CDC_SUBCLASS_ACM, /* u8 bInterfaceSubClass */
934+ USB_CDC_ACM_PROTO_VENDOR, /* u8 bInterfaceProtocol */
935+ STRING_RNDIS_CONTROL, /* u8 iInterface */
936+ /* Header Descriptor */
937+ 0x05, /* u8 bLength */
938+ USB_DT_CS_INTERFACE, /* u8 bDescriptorType */
939+ USB_CDC_HEADER_TYPE, /* u8 bDescriptorSubType */
940+ 0x10, 0x01, /* le16 bcdCDC */
941+ /* Call Management Descriptor */
942+ 0x05, /* u8 bLength */
943+ USB_DT_CS_INTERFACE, /* u8 bDescriptorType */
944+ USB_CDC_CALL_MANAGEMENT_TYPE, /* u8 bDescriptorSubType */
945+ 0x00, /* u8 bmCapabilities */
946+ 0x01, /* u8 bDataInterface */
947+ /* ACM Descriptor */
948+ 0x04, /* u8 bLength */
949+ USB_DT_CS_INTERFACE, /* u8 bDescriptorType */
950+ USB_CDC_ACM_TYPE, /* u8 bDescriptorSubType */
951+ 0x00, /* u8 bmCapabilities */
952+ /* Union Descriptor */
953+ 0x05, /* u8 bLength */
954+ USB_DT_CS_INTERFACE, /* u8 bDescriptorType */
955+ USB_CDC_UNION_TYPE, /* u8 bDescriptorSubType */
956+ 0x00, /* u8 bMasterInterface0 */
957+ 0x01, /* u8 bSlaveInterface0 */
958+ /* Status Descriptor */
959+ 0x07, /* u8 bLength */
960+ USB_DT_ENDPOINT, /* u8 bDescriptorType */
961+ USB_DIR_IN | 1, /* u8 bEndpointAddress */
962+ USB_ENDPOINT_XFER_INT, /* u8 bmAttributes */
963+ STATUS_BYTECOUNT & 0xff, STATUS_BYTECOUNT >> 8, /* le16 wMaxPacketSize */
964+ 1 << LOG2_STATUS_INTERVAL_MSEC, /* u8 bInterval */
965+ /* RNDIS Data Interface */
966+ 0x09, /* u8 bLength */
967+ USB_DT_INTERFACE, /* u8 bDescriptorType */
968+ 0x01, /* u8 bInterfaceNumber */
969+ 0x00, /* u8 bAlternateSetting */
970+ 0x02, /* u8 bNumEndpoints */
971+ USB_CLASS_CDC_DATA, /* u8 bInterfaceClass */
972+ 0x00, /* u8 bInterfaceSubClass */
973+ 0x00, /* u8 bInterfaceProtocol */
974+ STRING_DATA, /* u8 iInterface */
975+ /* Source Endpoint */
976+ 0x07, /* u8 bLength */
977+ USB_DT_ENDPOINT, /* u8 bDescriptorType */
978+ USB_DIR_IN | 2, /* u8 bEndpointAddress */
979+ USB_ENDPOINT_XFER_BULK, /* u8 bmAttributes */
980+ 0x40, 0x00, /* le16 wMaxPacketSize */
981+ 0x00, /* u8 bInterval */
982+ /* Sink Endpoint */
983+ 0x07, /* u8 bLength */
984+ USB_DT_ENDPOINT, /* u8 bDescriptorType */
985+ USB_DIR_OUT | 2, /* u8 bEndpointAddress */
986+ USB_ENDPOINT_XFER_BULK, /* u8 bmAttributes */
987+ 0x40, 0x00, /* le16 wMaxPacketSize */
988+ 0x00 /* u8 bInterval */
989+};
990+
991+static const uint8_t qemu_net_cdc_config_descriptor[] = {
992+ /* Configuration Descriptor */
993+ 0x09, /* u8 bLength */
994+ USB_DT_CONFIG, /* u8 bDescriptorType */
995+ 0x50, 0x00, /* le16 wTotalLength */
996+ 0x02, /* u8 bNumInterfaces */
997+ DEV_CONFIG_VALUE, /* u8 bConfigurationValue */
998+ STRING_CDC, /* u8 iConfiguration */
999+ 0xc0, /* u8 bmAttributes */
1000+ 0x32, /* u8 bMaxPower */
1001+ /* CDC Control Interface */
1002+ 0x09, /* u8 bLength */
1003+ USB_DT_INTERFACE, /* u8 bDescriptorType */
1004+ 0x00, /* u8 bInterfaceNumber */
1005+ 0x00, /* u8 bAlternateSetting */
1006+ 0x01, /* u8 bNumEndpoints */
1007+ USB_CLASS_COMM, /* u8 bInterfaceClass */
1008+ USB_CDC_SUBCLASS_ETHERNET, /* u8 bInterfaceSubClass */
1009+ USB_CDC_PROTO_NONE, /* u8 bInterfaceProtocol */
1010+ STRING_CONTROL, /* u8 iInterface */
1011+ /* Header Descriptor */
1012+ 0x05, /* u8 bLength */
1013+ USB_DT_CS_INTERFACE, /* u8 bDescriptorType */
1014+ USB_CDC_HEADER_TYPE, /* u8 bDescriptorSubType */
1015+ 0x10, 0x01, /* le16 bcdCDC */
1016+ /* Union Descriptor */
1017+ 0x05, /* u8 bLength */
1018+ USB_DT_CS_INTERFACE, /* u8 bDescriptorType */
1019+ USB_CDC_UNION_TYPE, /* u8 bDescriptorSubType */
1020+ 0x00, /* u8 bMasterInterface0 */
1021+ 0x01, /* u8 bSlaveInterface0 */
1022+ /* Ethernet Descriptor */
1023+ 0x0d, /* u8 bLength */
1024+ USB_DT_CS_INTERFACE, /* u8 bDescriptorType */
1025+ USB_CDC_ETHERNET_TYPE, /* u8 bDescriptorSubType */
1026+ STRING_ETHADDR, /* u8 iMACAddress */
1027+ 0x00, 0x00, 0x00, 0x00, /* le32 bmEthernetStatistics */
1028+ ETH_FRAME_LEN & 0xff, ETH_FRAME_LEN >> 8, /* le16 wMaxSegmentSize */
1029+ 0x00, 0x00, /* le16 wNumberMCFilters */
1030+ 0x00, /* u8 bNumberPowerFilters */
1031+ /* Status Descriptor */
1032+ 0x07, /* u8 bLength */
1033+ USB_DT_ENDPOINT, /* u8 bDescriptorType */
1034+ USB_DIR_IN | 1, /* u8 bEndpointAddress */
1035+ USB_ENDPOINT_XFER_INT, /* u8 bmAttributes */
1036+ STATUS_BYTECOUNT & 0xff, STATUS_BYTECOUNT >> 8, /* le16 wMaxPacketSize */
1037+ 1 << LOG2_STATUS_INTERVAL_MSEC, /* u8 bInterval */
1038+ /* CDC Data (nop) Interface */
1039+ 0x09, /* u8 bLength */
1040+ USB_DT_INTERFACE, /* u8 bDescriptorType */
1041+ 0x01, /* u8 bInterfaceNumber */
1042+ 0x00, /* u8 bAlternateSetting */
1043+ 0x00, /* u8 bNumEndpoints */
1044+ USB_CLASS_CDC_DATA, /* u8 bInterfaceClass */
1045+ 0x00, /* u8 bInterfaceSubClass */
1046+ 0x00, /* u8 bInterfaceProtocol */
1047+ 0x00, /* u8 iInterface */
1048+ /* CDC Data Interface */
1049+ 0x09, /* u8 bLength */
1050+ USB_DT_INTERFACE, /* u8 bDescriptorType */
1051+ 0x01, /* u8 bInterfaceNumber */
1052+ 0x01, /* u8 bAlternateSetting */
1053+ 0x02, /* u8 bNumEndpoints */
1054+ USB_CLASS_CDC_DATA, /* u8 bInterfaceClass */
1055+ 0x00, /* u8 bInterfaceSubClass */
1056+ 0x00, /* u8 bInterfaceProtocol */
1057+ STRING_DATA, /* u8 iInterface */
1058+ /* Source Endpoint */
1059+ 0x07, /* u8 bLength */
1060+ USB_DT_ENDPOINT, /* u8 bDescriptorType */
1061+ USB_DIR_IN | 2, /* u8 bEndpointAddress */
1062+ USB_ENDPOINT_XFER_BULK, /* u8 bmAttributes */
1063+ 0x40, 0x00, /* le16 wMaxPacketSize */
1064+ 0x00, /* u8 bInterval */
1065+ /* Sink Endpoint */
1066+ 0x07, /* u8 bLength */
1067+ USB_DT_ENDPOINT, /* u8 bDescriptorType */
1068+ USB_DIR_OUT | 2, /* u8 bEndpointAddress */
1069+ USB_ENDPOINT_XFER_BULK, /* u8 bmAttributes */
1070+ 0x40, 0x00, /* le16 wMaxPacketSize */
1071+ 0x00 /* u8 bInterval */
1072+};
1073+
1074+/*
1075+ * RNDIS Status
1076+ */
1077+
1078+#define RNDIS_MAXIMUM_FRAME_SIZE 1518
1079+#define RNDIS_MAX_TOTAL_SIZE 1558
1080+
1081+/* Remote NDIS Versions */
1082+#define RNDIS_MAJOR_VERSION 1
1083+#define RNDIS_MINOR_VERSION 0
1084+
1085+/* Status Values */
1086+#define RNDIS_STATUS_SUCCESS 0x00000000U /* Success */
1087+#define RNDIS_STATUS_FAILURE 0xC0000001U /* Unspecified error */
1088+#define RNDIS_STATUS_INVALID_DATA 0xC0010015U /* Invalid data */
1089+#define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBU /* Unsupported request */
1090+#define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BU /* Device connected */
1091+#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CU /* Device disconnected */
1092+
1093+/* Message Set for Connectionless (802.3) Devices */
1094+#define REMOTE_NDIS_PACKET_MSG 0x00000001U
1095+#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */
1096+#define REMOTE_NDIS_HALT_MSG 0x00000003U
1097+#define REMOTE_NDIS_QUERY_MSG 0x00000004U
1098+#define REMOTE_NDIS_SET_MSG 0x00000005U
1099+#define REMOTE_NDIS_RESET_MSG 0x00000006U
1100+#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007U
1101+#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008U
1102+
1103+/* Message completion */
1104+#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002U
1105+#define REMOTE_NDIS_QUERY_CMPLT 0x80000004U
1106+#define REMOTE_NDIS_SET_CMPLT 0x80000005U
1107+#define REMOTE_NDIS_RESET_CMPLT 0x80000006U
1108+#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008U
1109+
1110+/* Device Flags */
1111+#define RNDIS_DF_CONNECTIONLESS 0x00000001U
1112+#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002U
1113+
1114+#define RNDIS_MEDIUM_802_3 0x00000000U
1115+
1116+/* from drivers/net/sk98lin/h/skgepnmi.h */
1117+#define OID_PNP_CAPABILITIES 0xFD010100
1118+#define OID_PNP_SET_POWER 0xFD010101
1119+#define OID_PNP_QUERY_POWER 0xFD010102
1120+#define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103
1121+#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104
1122+#define OID_PNP_ENABLE_WAKE_UP 0xFD010106
1123+
1124+typedef struct rndis_init_msg_type
1125+{
1126+ __le32 MessageType;
1127+ __le32 MessageLength;
1128+ __le32 RequestID;
1129+ __le32 MajorVersion;
1130+ __le32 MinorVersion;
1131+ __le32 MaxTransferSize;
1132+} rndis_init_msg_type;
1133+
1134+typedef struct rndis_init_cmplt_type
1135+{
1136+ __le32 MessageType;
1137+ __le32 MessageLength;
1138+ __le32 RequestID;
1139+ __le32 Status;
1140+ __le32 MajorVersion;
1141+ __le32 MinorVersion;
1142+ __le32 DeviceFlags;
1143+ __le32 Medium;
1144+ __le32 MaxPacketsPerTransfer;
1145+ __le32 MaxTransferSize;
1146+ __le32 PacketAlignmentFactor;
1147+ __le32 AFListOffset;
1148+ __le32 AFListSize;
1149+} rndis_init_cmplt_type;
1150+
1151+typedef struct rndis_halt_msg_type
1152+{
1153+ __le32 MessageType;
1154+ __le32 MessageLength;
1155+ __le32 RequestID;
1156+} rndis_halt_msg_type;
1157+
1158+typedef struct rndis_query_msg_type
1159+{
1160+ __le32 MessageType;
1161+ __le32 MessageLength;
1162+ __le32 RequestID;
1163+ __le32 OID;
1164+ __le32 InformationBufferLength;
1165+ __le32 InformationBufferOffset;
1166+ __le32 DeviceVcHandle;
1167+} rndis_query_msg_type;
1168+
1169+typedef struct rndis_query_cmplt_type
1170+{
1171+ __le32 MessageType;
1172+ __le32 MessageLength;
1173+ __le32 RequestID;
1174+ __le32 Status;
1175+ __le32 InformationBufferLength;
1176+ __le32 InformationBufferOffset;
1177+} rndis_query_cmplt_type;
1178+
1179+typedef struct rndis_set_msg_type
1180+{
1181+ __le32 MessageType;
1182+ __le32 MessageLength;
1183+ __le32 RequestID;
1184+ __le32 OID;
1185+ __le32 InformationBufferLength;
1186+ __le32 InformationBufferOffset;
1187+ __le32 DeviceVcHandle;
1188+} rndis_set_msg_type;
1189+
1190+typedef struct rndis_set_cmplt_type
1191+{
1192+ __le32 MessageType;
1193+ __le32 MessageLength;
1194+ __le32 RequestID;
1195+ __le32 Status;
1196+} rndis_set_cmplt_type;
1197+
1198+typedef struct rndis_reset_msg_type
1199+{
1200+ __le32 MessageType;
1201+ __le32 MessageLength;
1202+ __le32 Reserved;
1203+} rndis_reset_msg_type;
1204+
1205+typedef struct rndis_reset_cmplt_type
1206+{
1207+ __le32 MessageType;
1208+ __le32 MessageLength;
1209+ __le32 Status;
1210+ __le32 AddressingReset;
1211+} rndis_reset_cmplt_type;
1212+
1213+typedef struct rndis_indicate_status_msg_type
1214+{
1215+ __le32 MessageType;
1216+ __le32 MessageLength;
1217+ __le32 Status;
1218+ __le32 StatusBufferLength;
1219+ __le32 StatusBufferOffset;
1220+} rndis_indicate_status_msg_type;
1221+
1222+typedef struct rndis_keepalive_msg_type
1223+{
1224+ __le32 MessageType;
1225+ __le32 MessageLength;
1226+ __le32 RequestID;
1227+} rndis_keepalive_msg_type;
1228+
1229+typedef struct rndis_keepalive_cmplt_type
1230+{
1231+ __le32 MessageType;
1232+ __le32 MessageLength;
1233+ __le32 RequestID;
1234+ __le32 Status;
1235+} rndis_keepalive_cmplt_type;
1236+
1237+struct rndis_packet_msg_type
1238+{
1239+ __le32 MessageType;
1240+ __le32 MessageLength;
1241+ __le32 DataOffset;
1242+ __le32 DataLength;
1243+ __le32 OOBDataOffset;
1244+ __le32 OOBDataLength;
1245+ __le32 NumOOBDataElements;
1246+ __le32 PerPacketInfoOffset;
1247+ __le32 PerPacketInfoLength;
1248+ __le32 VcHandle;
1249+ __le32 Reserved;
1250+};
1251+
1252+struct rndis_config_parameter
1253+{
1254+ __le32 ParameterNameOffset;
1255+ __le32 ParameterNameLength;
1256+ __le32 ParameterType;
1257+ __le32 ParameterValueOffset;
1258+ __le32 ParameterValueLength;
1259+};
1260+
1261+/* implementation specific */
1262+enum rndis_state
1263+{
1264+ RNDIS_UNINITIALIZED,
1265+ RNDIS_INITIALIZED,
1266+ RNDIS_DATA_INITIALIZED,
1267+};
1268+
1269+static const uint32_t oid_supported_list[] =
1270+{
1271+ /* the general stuff */
1272+ OID_GEN_SUPPORTED_LIST,
1273+ OID_GEN_HARDWARE_STATUS,
1274+ OID_GEN_MEDIA_SUPPORTED,
1275+ OID_GEN_MEDIA_IN_USE,
1276+ OID_GEN_MAXIMUM_FRAME_SIZE,
1277+ OID_GEN_LINK_SPEED,
1278+ OID_GEN_TRANSMIT_BLOCK_SIZE,
1279+ OID_GEN_RECEIVE_BLOCK_SIZE,
1280+ OID_GEN_VENDOR_ID,
1281+ OID_GEN_VENDOR_DESCRIPTION,
1282+ OID_GEN_VENDOR_DRIVER_VERSION,
1283+ OID_GEN_CURRENT_PACKET_FILTER,
1284+ OID_GEN_MAXIMUM_TOTAL_SIZE,
1285+ OID_GEN_MEDIA_CONNECT_STATUS,
1286+ OID_GEN_PHYSICAL_MEDIUM,
1287+ /* the statistical stuff */
1288+ OID_GEN_XMIT_OK,
1289+ OID_GEN_RCV_OK,
1290+ OID_GEN_XMIT_ERROR,
1291+ OID_GEN_RCV_ERROR,
1292+ OID_GEN_RCV_NO_BUFFER,
1293+ /* mandatory 802.3 */
1294+ /* the general stuff */
1295+ OID_802_3_PERMANENT_ADDRESS,
1296+ OID_802_3_CURRENT_ADDRESS,
1297+ OID_802_3_MULTICAST_LIST,
1298+ OID_802_3_MAC_OPTIONS,
1299+ OID_802_3_MAXIMUM_LIST_SIZE,
1300+
1301+ /* the statistical stuff */
1302+ OID_802_3_RCV_ERROR_ALIGNMENT,
1303+ OID_802_3_XMIT_ONE_COLLISION,
1304+ OID_802_3_XMIT_MORE_COLLISIONS
1305+};
1306+
1307+struct rndis_response {
1308+ TAILQ_ENTRY(rndis_response) entries;
1309+ uint32_t length;
1310+ uint8_t buf[0];
1311+};
1312+
1313+
1314+typedef struct USBNetState {
1315+ USBDevice dev;
1316+
1317+ unsigned int rndis;
1318+ enum rndis_state rndis_state;
1319+ uint32_t medium;
1320+ uint32_t speed;
1321+ uint32_t media_state;
1322+ uint16_t filter;
1323+ uint32_t vendorid;
1324+ uint8_t mac[6];
1325+
1326+ unsigned int out_ptr;
1327+ uint8_t out_buf[2048];
1328+
1329+ USBPacket *inpkt;
1330+ unsigned int in_ptr, in_len;
1331+ uint8_t in_buf[2048];
1332+
1333+ VLANClientState *vc;
1334+ TAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp;
1335+} USBNetState;
1336+
1337+
1338+static int ndis_query(USBNetState *s, uint32_t oid, uint8_t *inbuf, unsigned int inlen, uint8_t *outbuf)
1339+{
1340+ switch (oid) {
1341+ /* general oids (table 4-1) */
1342+ /* mandatory */
1343+ case OID_GEN_SUPPORTED_LIST:
1344+ {
1345+ unsigned int i, count = sizeof(oid_supported_list) / sizeof(uint32_t);
1346+ for (i = 0; i < count; i++)
1347+ ((__le32 *)outbuf)[i] = cpu_to_le32(oid_supported_list[i]);
1348+ return sizeof(oid_supported_list);
1349+ }
1350+
1351+ /* mandatory */
1352+ case OID_GEN_HARDWARE_STATUS:
1353+ *((__le32 *)outbuf) = cpu_to_le32(0);
1354+ return sizeof(__le32);
1355+
1356+ /* mandatory */
1357+ case OID_GEN_MEDIA_SUPPORTED:
1358+ *((__le32 *)outbuf) = cpu_to_le32(s->medium);
1359+ return sizeof(__le32);
1360+
1361+ /* mandatory */
1362+ case OID_GEN_MEDIA_IN_USE:
1363+ *((__le32 *)outbuf) = cpu_to_le32(s->medium);
1364+ return sizeof(__le32);
1365+
1366+ /* mandatory */
1367+ case OID_GEN_MAXIMUM_FRAME_SIZE:
1368+ *((__le32 *)outbuf) = cpu_to_le32(ETH_FRAME_LEN);
1369+ return sizeof(__le32);
1370+
1371+ /* mandatory */
1372+ case OID_GEN_LINK_SPEED:
1373+ *((__le32 *)outbuf) = cpu_to_le32(s->speed);
1374+ return sizeof(__le32);
1375+
1376+ /* mandatory */
1377+ case OID_GEN_TRANSMIT_BLOCK_SIZE:
1378+ *((__le32 *)outbuf) = cpu_to_le32(ETH_FRAME_LEN);
1379+ return sizeof(__le32);
1380+
1381+ /* mandatory */
1382+ case OID_GEN_RECEIVE_BLOCK_SIZE:
1383+ *((__le32 *)outbuf) = cpu_to_le32(ETH_FRAME_LEN);
1384+ return sizeof(__le32);
1385+
1386+ /* mandatory */
1387+ case OID_GEN_VENDOR_ID:
1388+ *((__le32 *)outbuf) = cpu_to_le32(0x1234);
1389+ return sizeof(__le32);
1390+
1391+ /* mandatory */
1392+ case OID_GEN_VENDOR_DESCRIPTION:
1393+ strcpy(outbuf, "QEMU USB RNDIS Net");
1394+ return strlen(outbuf) + 1;
1395+
1396+ case OID_GEN_VENDOR_DRIVER_VERSION:
1397+ *((__le32 *)outbuf) = cpu_to_le32(1);
1398+ return sizeof(__le32);
1399+
1400+ /* mandatory */
1401+ case OID_GEN_CURRENT_PACKET_FILTER:
1402+ *((__le32 *)outbuf) = cpu_to_le32(s->filter);
1403+ return sizeof(__le32);
1404+
1405+ /* mandatory */
1406+ case OID_GEN_MAXIMUM_TOTAL_SIZE:
1407+ *((__le32 *)outbuf) = cpu_to_le32(RNDIS_MAX_TOTAL_SIZE);
1408+ return sizeof(__le32);
1409+
1410+ /* mandatory */
1411+ case OID_GEN_MEDIA_CONNECT_STATUS:
1412+ *((__le32 *)outbuf) = cpu_to_le32(s->media_state);
1413+ return sizeof(__le32);
1414+
1415+ case OID_GEN_PHYSICAL_MEDIUM:
1416+ *((__le32 *)outbuf) = cpu_to_le32(0);
1417+ return sizeof(__le32);
1418+
1419+ case OID_GEN_MAC_OPTIONS:
1420+ *((__le32 *)outbuf) = cpu_to_le32(NDIS_MAC_OPTION_RECEIVE_SERIALIZED | NDIS_MAC_OPTION_FULL_DUPLEX);
1421+ return sizeof(__le32);
1422+
1423+ /* statistics OIDs (table 4-2) */
1424+ /* mandatory */
1425+ case OID_GEN_XMIT_OK:
1426+ *((__le32 *)outbuf) = cpu_to_le32(0);
1427+ return sizeof(__le32);
1428+
1429+ /* mandatory */
1430+ case OID_GEN_RCV_OK:
1431+ *((__le32 *)outbuf) = cpu_to_le32(0);
1432+ return sizeof(__le32);
1433+
1434+ /* mandatory */
1435+ case OID_GEN_XMIT_ERROR:
1436+ *((__le32 *)outbuf) = cpu_to_le32(0);
1437+ return sizeof(__le32);
1438+
1439+ /* mandatory */
1440+ case OID_GEN_RCV_ERROR:
1441+ *((__le32 *)outbuf) = cpu_to_le32(0);
1442+ return sizeof(__le32);
1443+
1444+ /* mandatory */
1445+ case OID_GEN_RCV_NO_BUFFER:
1446+ *((__le32 *)outbuf) = cpu_to_le32(0);
1447+ return sizeof(__le32);
1448+
1449+ /* ieee802.3 OIDs (table 4-3) */
1450+ /* mandatory */
1451+ case OID_802_3_PERMANENT_ADDRESS:
1452+ memcpy(outbuf, s->mac, 6);
1453+ return 6;
1454+
1455+ /* mandatory */
1456+ case OID_802_3_CURRENT_ADDRESS:
1457+ memcpy(outbuf, s->mac, 6);
1458+ return 6;
1459+
1460+ /* mandatory */
1461+ case OID_802_3_MULTICAST_LIST:
1462+ *((__le32 *)outbuf) = cpu_to_le32(0xE0000000);
1463+ return sizeof(__le32);
1464+
1465+ /* mandatory */
1466+ case OID_802_3_MAXIMUM_LIST_SIZE:
1467+ *((__le32 *)outbuf) = cpu_to_le32(1);
1468+ return sizeof(__le32);
1469+
1470+ case OID_802_3_MAC_OPTIONS:
1471+ return 0;
1472+
1473+ /* ieee802.3 statistics OIDs (table 4-4) */
1474+ /* mandatory */
1475+ case OID_802_3_RCV_ERROR_ALIGNMENT:
1476+ *((__le32 *)outbuf) = cpu_to_le32(0);
1477+ return sizeof(__le32);
1478+
1479+ /* mandatory */
1480+ case OID_802_3_XMIT_ONE_COLLISION:
1481+ *((__le32 *)outbuf) = cpu_to_le32(0);
1482+ return sizeof(__le32);
1483+
1484+ /* mandatory */
1485+ case OID_802_3_XMIT_MORE_COLLISIONS:
1486+ *((__le32 *)outbuf) = cpu_to_le32(0);
1487+ return sizeof(__le32);
1488+
1489+ default:
1490+ fprintf(stderr, "usbnet: unknown OID 0x%08x\n", oid);
1491+ return 0;
1492+ }
1493+ return -1;
1494+}
1495+
1496+static int ndis_set(USBNetState *s, uint32_t oid, uint8_t *inbuf, unsigned int inlen)
1497+{
1498+ switch (oid) {
1499+ case OID_GEN_CURRENT_PACKET_FILTER:
1500+ s->filter = le32_to_cpup((__le32 *)inbuf);
1501+ if (s->filter) {
1502+ s->rndis_state = RNDIS_DATA_INITIALIZED;
1503+ } else {
1504+ s->rndis_state = RNDIS_INITIALIZED;
1505+ }
1506+ return 0;
1507+
1508+ case OID_802_3_MULTICAST_LIST:
1509+ return 0;
1510+
1511+ }
1512+ return -1;
1513+}
1514+
1515+static int rndis_get_response(USBNetState *s, uint8_t *buf)
1516+{
1517+ int ret = 0;
1518+ struct rndis_response *r = s->rndis_resp.tqh_first;
1519+ if (!r)
1520+ return ret;
1521+ TAILQ_REMOVE(&s->rndis_resp, r, entries);
1522+ ret = r->length;
1523+ memcpy(buf, r->buf, r->length);
1524+ qemu_free(r);
1525+ return ret;
1526+}
1527+
1528+static void *rndis_queue_response(USBNetState *s, unsigned int length)
1529+{
1530+ struct rndis_response *r = qemu_mallocz(sizeof(struct rndis_response) + length);
1531+ if (!r)
1532+ return NULL;
1533+ TAILQ_INSERT_TAIL(&s->rndis_resp, r, entries);
1534+ r->length = length;
1535+ return &r->buf[0];
1536+}
1537+
1538+static void rndis_clear_responsequeue(USBNetState *s)
1539+{
1540+ struct rndis_response *r;
1541+
1542+ while ((r = s->rndis_resp.tqh_first)) {
1543+ TAILQ_REMOVE(&s->rndis_resp, r, entries);
1544+ qemu_free(r);
1545+ }
1546+}
1547+
1548+static int rndis_init_response(USBNetState *s, rndis_init_msg_type *buf)
1549+{
1550+ rndis_init_cmplt_type *resp = rndis_queue_response(s, sizeof(rndis_init_cmplt_type));
1551+ if (!resp)
1552+ return USB_RET_STALL;
1553+ resp->MessageType = cpu_to_le32(REMOTE_NDIS_INITIALIZE_CMPLT);
1554+ resp->MessageLength = cpu_to_le32(sizeof(rndis_init_cmplt_type));
1555+ resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
1556+ resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS);
1557+ resp->MajorVersion = cpu_to_le32(RNDIS_MAJOR_VERSION);
1558+ resp->MinorVersion = cpu_to_le32(RNDIS_MINOR_VERSION);
1559+ resp->DeviceFlags = cpu_to_le32(RNDIS_DF_CONNECTIONLESS);
1560+ resp->Medium = cpu_to_le32(RNDIS_MEDIUM_802_3);
1561+ resp->MaxPacketsPerTransfer = cpu_to_le32(1);
1562+ resp->MaxTransferSize = cpu_to_le32(ETH_FRAME_LEN + sizeof(struct rndis_packet_msg_type) + 22);
1563+ resp->PacketAlignmentFactor = cpu_to_le32(0);
1564+ resp->AFListOffset = cpu_to_le32(0);
1565+ resp->AFListSize = cpu_to_le32(0);
1566+ return 0;
1567+}
1568+
1569+static int rndis_query_response(USBNetState *s, rndis_query_msg_type *buf, unsigned int length)
1570+{
1571+ rndis_query_cmplt_type *resp;
1572+ uint8_t infobuf[sizeof(oid_supported_list)]; /* oid_supported_list is the largest data reply */
1573+ uint32_t bufoffs, buflen;
1574+ int infobuflen;
1575+ unsigned int resplen;
1576+ bufoffs = le32_to_cpu(buf->InformationBufferOffset) + 8;
1577+ buflen = le32_to_cpu(buf->InformationBufferLength);
1578+ if (bufoffs + buflen > length)
1579+ return USB_RET_STALL;
1580+ infobuflen = ndis_query(s, le32_to_cpu(buf->OID), bufoffs + (uint8_t *)buf, buflen, infobuf);
1581+ resplen = sizeof(rndis_query_cmplt_type) + ((infobuflen < 0) ? 0 : infobuflen);
1582+ resp = rndis_queue_response(s, resplen);
1583+ if (!resp)
1584+ return USB_RET_STALL;
1585+ resp->MessageType = cpu_to_le32(REMOTE_NDIS_QUERY_CMPLT);
1586+ resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
1587+ resp->MessageLength = cpu_to_le32(resplen);
1588+ if (infobuflen < 0) {
1589+ /* OID not supported */
1590+ resp->Status = cpu_to_le32(RNDIS_STATUS_NOT_SUPPORTED);
1591+ resp->InformationBufferLength = cpu_to_le32(0);
1592+ resp->InformationBufferOffset = cpu_to_le32(0);
1593+ return 0;
1594+ }
1595+ resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS);
1596+ resp->InformationBufferOffset = cpu_to_le32(infobuflen ? sizeof(rndis_query_cmplt_type) - 8 : 0);
1597+ resp->InformationBufferLength = cpu_to_le32(infobuflen);
1598+ memcpy(resp + 1, infobuf, infobuflen);
1599+ return 0;
1600+}
1601+
1602+static int rndis_set_response(USBNetState *s, rndis_set_msg_type *buf, unsigned int length)
1603+{
1604+ rndis_set_cmplt_type *resp = rndis_queue_response(s, sizeof(rndis_set_cmplt_type));
1605+ uint32_t bufoffs, buflen;
1606+ if (!resp)
1607+ return USB_RET_STALL;
1608+ bufoffs = le32_to_cpu(buf->InformationBufferOffset) + 8;
1609+ buflen = le32_to_cpu(buf->InformationBufferLength);
1610+ if (bufoffs + buflen > length)
1611+ return USB_RET_STALL;
1612+ int ret = ndis_set(s, le32_to_cpu(buf->OID), bufoffs + (uint8_t *)buf, buflen);
1613+ resp->MessageType = cpu_to_le32(REMOTE_NDIS_SET_CMPLT);
1614+ resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
1615+ resp->MessageLength = cpu_to_le32(sizeof(rndis_set_cmplt_type));
1616+ if (ret < 0) {
1617+ /* OID not supported */
1618+ resp->Status = cpu_to_le32(RNDIS_STATUS_NOT_SUPPORTED);
1619+ return 0;
1620+ }
1621+ resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS);
1622+ return 0;
1623+}
1624+
1625+static int rndis_reset_response(USBNetState *s, rndis_reset_msg_type *buf)
1626+{
1627+ rndis_reset_cmplt_type *resp = rndis_queue_response(s, sizeof(rndis_reset_cmplt_type));
1628+ if (!resp)
1629+ return USB_RET_STALL;
1630+ resp->MessageType = cpu_to_le32(REMOTE_NDIS_RESET_CMPLT);
1631+ resp->MessageLength = cpu_to_le32(sizeof(rndis_reset_cmplt_type));
1632+ resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS);
1633+ /* resent information */
1634+ resp->AddressingReset = cpu_to_le32(1);
1635+ return 0;
1636+}
1637+
1638+static int rndis_keepalive_response(USBNetState *s, rndis_keepalive_msg_type *buf)
1639+{
1640+ rndis_keepalive_cmplt_type *resp = rndis_queue_response(s, sizeof(rndis_keepalive_cmplt_type));
1641+ if (!resp)
1642+ return USB_RET_STALL;
1643+ resp->MessageType = cpu_to_le32(REMOTE_NDIS_KEEPALIVE_CMPLT);
1644+ resp->MessageLength = cpu_to_le32(sizeof(rndis_keepalive_cmplt_type));
1645+ resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
1646+ resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS);
1647+ return 0;
1648+}
1649+
1650+static int rndis_parse(USBNetState *s, uint8_t *data, int length)
1651+{
1652+ uint32_t MsgType, MsgLength;
1653+ __le32 *tmp = (__le32 *)data;
1654+ MsgType = le32_to_cpup(tmp++);
1655+ MsgLength = le32_to_cpup(tmp++);
1656+
1657+ switch (MsgType) {
1658+ case REMOTE_NDIS_INITIALIZE_MSG:
1659+ s->rndis_state = RNDIS_INITIALIZED;
1660+ return rndis_init_response(s, (rndis_init_msg_type *)data);
1661+
1662+ case REMOTE_NDIS_HALT_MSG:
1663+ s->rndis_state = RNDIS_UNINITIALIZED;
1664+ return 0;
1665+
1666+ case REMOTE_NDIS_QUERY_MSG:
1667+ return rndis_query_response(s, (rndis_query_msg_type *)data, length);
1668+
1669+ case REMOTE_NDIS_SET_MSG:
1670+ return rndis_set_response(s, (rndis_set_msg_type *)data, length);
1671+
1672+ case REMOTE_NDIS_RESET_MSG:
1673+ rndis_clear_responsequeue(s);
1674+ s->out_ptr = s->in_ptr = s->in_len = 0;
1675+ return rndis_reset_response(s, (rndis_reset_msg_type *)data);
1676+
1677+ case REMOTE_NDIS_KEEPALIVE_MSG:
1678+ /* For USB: host does this every 5 seconds */
1679+ return rndis_keepalive_response(s, (rndis_keepalive_msg_type *)data);
1680+ }
1681+ return USB_RET_STALL;
1682+}
1683+
1684+static void usb_net_handle_reset(USBDevice *dev)
1685+{
1686+}
1687+
1688+static int usb_net_handle_control(USBDevice *dev, int request, int value,
1689+ int index, int length, uint8_t *data)
1690+{
1691+ USBNetState *s = (USBNetState *)dev;
1692+ int ret = 0;
1693+
1694+ switch(request) {
1695+ case DeviceRequest | USB_REQ_GET_STATUS:
1696+ data[0] = (1 << USB_DEVICE_SELF_POWERED) |
1697+ (dev->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP);
1698+ data[1] = 0x00;
1699+ ret = 2;
1700+ break;
1701+
1702+ case DeviceOutRequest | USB_REQ_CLEAR_FEATURE:
1703+ if (value == USB_DEVICE_REMOTE_WAKEUP) {
1704+ dev->remote_wakeup = 0;
1705+ } else {
1706+ goto fail;
1707+ }
1708+ ret = 0;
1709+ break;
1710+
1711+ case DeviceOutRequest | USB_REQ_SET_FEATURE:
1712+ if (value == USB_DEVICE_REMOTE_WAKEUP) {
1713+ dev->remote_wakeup = 1;
1714+ } else {
1715+ goto fail;
1716+ }
1717+ ret = 0;
1718+ break;
1719+
1720+ case DeviceOutRequest | USB_REQ_SET_ADDRESS:
1721+ dev->addr = value;
1722+ ret = 0;
1723+ break;
1724+
1725+ case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND:
1726+ if (!s->rndis || value || index != 0)
1727+ goto fail;
1728+#if TRAFFIC_DEBUG
1729+ {
1730+ unsigned int i;
1731+ fprintf(stderr, "SEND_ENCAPSULATED_COMMAND:");
1732+ for (i = 0; i < length; i++) {
1733+ if (!(i & 15))
1734+ fprintf(stderr, "\n%04X:", i);
1735+ fprintf(stderr, " %02X", data[i]);
1736+ }
1737+ fprintf(stderr, "\n\n");
1738+ }
1739+#endif
1740+ ret = rndis_parse(s, data, length);
1741+ break;
1742+
1743+ case ClassInterfaceRequest | USB_CDC_GET_ENCAPSULATED_RESPONSE:
1744+ if (!s->rndis || value || index != 0)
1745+ goto fail;
1746+ ret = rndis_get_response(s, data);
1747+ if (!ret) {
1748+ data[0] = 0;
1749+ ret = 1;
1750+ }
1751+#if TRAFFIC_DEBUG
1752+ {
1753+ unsigned int i;
1754+ fprintf(stderr, "GET_ENCAPSULATED_RESPONSE:");
1755+ for (i = 0; i < ret; i++) {
1756+ if (!(i & 15))
1757+ fprintf(stderr, "\n%04X:", i);
1758+ fprintf(stderr, " %02X", data[i]);
1759+ }
1760+ fprintf(stderr, "\n\n");
1761+ }
1762+#endif
1763+ break;
1764+
1765+ case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
1766+ switch(value >> 8) {
1767+ case USB_DT_DEVICE:
1768+ ret = sizeof(qemu_net_dev_descriptor);
1769+ memcpy(data, qemu_net_dev_descriptor, ret);
1770+ break;
1771+
1772+ case USB_DT_CONFIG:
1773+ switch (value & 0xff) {
1774+ case 0:
1775+ ret = sizeof(qemu_net_rndis_config_descriptor);
1776+ memcpy(data, qemu_net_rndis_config_descriptor,
1777+ ret);
1778+ break;
1779+
1780+ case 1:
1781+ ret = sizeof(qemu_net_cdc_config_descriptor);
1782+ memcpy(data, qemu_net_cdc_config_descriptor,
1783+ ret);
1784+ break;
1785+
1786+ default:
1787+ goto fail;
1788+ }
1789+ data[2] = ret & 0xff;
1790+ data[3] = ret >> 8;
1791+ break;
1792+
1793+ case USB_DT_STRING:
1794+ switch (value & 0xff) {
1795+ case 0:
1796+ /* language ids */
1797+ data[0] = 4;
1798+ data[1] = 3;
1799+ data[2] = 0x09;
1800+ data[3] = 0x04;
1801+ ret = 4;
1802+ break;
1803+
1804+ case STRING_MANUFACTURER:
1805+ ret = set_usb_string(data, "QEMU");
1806+ break;
1807+
1808+ case STRING_PRODUCT:
1809+ ret = set_usb_string(data, "RNDIS/QEMU USB Network Device");
1810+ break;
1811+
1812+ case STRING_ETHADDR:
1813+ ret = set_usb_string(data, "400102030405");
1814+ break;
1815+
1816+ case STRING_DATA:
1817+ ret = set_usb_string(data, "QEMU USB Net Data Interface");
1818+ break;
1819+
1820+ case STRING_CONTROL:
1821+ ret = set_usb_string(data, "QEMU USB Net Control Interface");
1822+ break;
1823+
1824+ case STRING_RNDIS_CONTROL:
1825+ ret = set_usb_string(data, "QEMU USB Net RNDIS Control Interface");
1826+ break;
1827+
1828+ case STRING_CDC:
1829+ ret = set_usb_string(data, "QEMU USB Net CDC");
1830+ break;
1831+
1832+ case STRING_SUBSET:
1833+ ret = set_usb_string(data, "QEMU USB Net Subset");
1834+ break;
1835+
1836+ case STRING_RNDIS:
1837+ ret = set_usb_string(data, "QEMU USB Net RNDIS");
1838+ break;
1839+
1840+ case STRING_SERIALNUMBER:
1841+ ret = set_usb_string(data, "1");
1842+ break;
1843+
1844+ default:
1845+ goto fail;
1846+ }
1847+ break;
1848+
1849+ default:
1850+ goto fail;
1851+ }
1852+ break;
1853+
1854+ case DeviceRequest | USB_REQ_GET_CONFIGURATION:
1855+ data[0] = s->rndis ? DEV_RNDIS_CONFIG_VALUE : DEV_CONFIG_VALUE;
1856+ ret = 1;
1857+ break;
1858+
1859+ case DeviceOutRequest | USB_REQ_SET_CONFIGURATION:
1860+ switch (value & 0xff) {
1861+ case DEV_CONFIG_VALUE:
1862+ s->rndis = 0;
1863+ break;
1864+
1865+ case DEV_RNDIS_CONFIG_VALUE:
1866+ s->rndis = 1;
1867+ break;
1868+
1869+ default:
1870+ goto fail;
1871+ }
1872+ ret = 0;
1873+ break;
1874+
1875+ case DeviceRequest | USB_REQ_GET_INTERFACE:
1876+ case InterfaceRequest | USB_REQ_GET_INTERFACE:
1877+ data[0] = 0;
1878+ ret = 1;
1879+ break;
1880+
1881+ case DeviceOutRequest | USB_REQ_SET_INTERFACE:
1882+ case InterfaceOutRequest | USB_REQ_SET_INTERFACE:
1883+ ret = 0;
1884+ break;
1885+
1886+ default:
1887+ fail:
1888+ fprintf(stderr, "usbnet: failed control transaction: request 0x%x value 0x%x index 0x%x length 0x%x\n",
1889+ request, value, index, length);
1890+ ret = USB_RET_STALL;
1891+ break;
1892+ }
1893+ return ret;
1894+}
1895+
1896+static int usb_net_handle_statusin(USBNetState *s, USBPacket *p)
1897+{
1898+ int ret = 8;
1899+ if (p->len < 8)
1900+ return USB_RET_STALL;
1901+ ((__le32 *)p->data)[0] = cpu_to_le32(1);
1902+ ((__le32 *)p->data)[1] = cpu_to_le32(0);
1903+ if (!s->rndis_resp.tqh_first)
1904+ ret = USB_RET_NAK;
1905+#if DEBUG
1906+ fprintf(stderr, "usbnet: interrupt poll len %u return %d", p->len, ret);
1907+ {
1908+ int i;
1909+ fprintf(stderr, ":");
1910+ for (i = 0; i < ret; i++) {
1911+ if (!(i & 15))
1912+ fprintf(stderr, "\n%04X:", i);
1913+ fprintf(stderr, " %02X", p->data[i]);
1914+ }
1915+ fprintf(stderr, "\n\n");
1916+ }
1917+#endif
1918+ return ret;
1919+}
1920+
1921+static int usb_net_handle_datain(USBNetState *s, USBPacket *p)
1922+{
1923+ int ret = USB_RET_NAK;
1924+
1925+ if (s->in_ptr > s->in_len) {
1926+ s->in_ptr = s->in_len = 0;
1927+ ret = USB_RET_NAK;
1928+ return ret;
1929+ }
1930+ if (!s->in_len) {
1931+ ret = USB_RET_NAK;
1932+ return ret;
1933+ }
1934+ ret = s->in_len - s->in_ptr;
1935+ if (ret > p->len)
1936+ ret = p->len;
1937+ memcpy(p->data, &s->in_buf[s->in_ptr], ret);
1938+ s->in_ptr += ret;
1939+ if (s->in_ptr >= s->in_len && (s->rndis || (s->in_len & (64-1)) || !ret)) {
1940+ /* no short packet necessary */
1941+ s->in_ptr = s->in_len = 0;
1942+ }
1943+#if TRAFFIC_DEBUG
1944+ fprintf(stderr, "usbnet: data in len %u return %d", p->len, ret);
1945+ {
1946+ int i;
1947+ fprintf(stderr, ":");
1948+ for (i = 0; i < ret; i++) {
1949+ if (!(i & 15))
1950+ fprintf(stderr, "\n%04X:", i);
1951+ fprintf(stderr, " %02X", p->data[i]);
1952+ }
1953+ fprintf(stderr, "\n\n");
1954+ }
1955+#endif
1956+ return ret;
1957+}
1958+
1959+static int usb_net_handle_dataout(USBNetState *s, USBPacket *p)
1960+{
1961+ int ret = p->len;
1962+ int sz = sizeof(s->out_buf) - s->out_ptr;
1963+ struct rndis_packet_msg_type *msg = (struct rndis_packet_msg_type *)s->out_buf;
1964+ uint32_t len;
1965+
1966+#if TRAFFIC_DEBUG
1967+ fprintf(stderr, "usbnet: data out len %u\n", p->len);
1968+ {
1969+ int i;
1970+ fprintf(stderr, ":");
1971+ for (i = 0; i < p->len; i++) {
1972+ if (!(i & 15))
1973+ fprintf(stderr, "\n%04X:", i);
1974+ fprintf(stderr, " %02X", p->data[i]);
1975+ }
1976+ fprintf(stderr, "\n\n");
1977+ }
1978+#endif
1979+ if (sz > ret)
1980+ sz = ret;
1981+ memcpy(&s->out_buf[s->out_ptr], p->data, sz);
1982+ s->out_ptr += sz;
1983+ if (!s->rndis) {
1984+ if (ret < 64) {
1985+ qemu_send_packet(s->vc, s->out_buf, s->out_ptr);
1986+ s->out_ptr = 0;
1987+ }
1988+ return ret;
1989+ }
1990+ len = le32_to_cpu(msg->MessageLength);
1991+ if (s->out_ptr < 8 || s->out_ptr < len)
1992+ return ret;
1993+ if (le32_to_cpu(msg->MessageType) == REMOTE_NDIS_PACKET_MSG) {
1994+ uint32_t offs = 8 + le32_to_cpu(msg->DataOffset);
1995+ uint32_t size = le32_to_cpu(msg->DataLength);
1996+ if (offs + size <= len)
1997+ qemu_send_packet(s->vc, s->out_buf + offs, size);
1998+ }
1999+ s->out_ptr -= len;
2000+ memmove(s->out_buf, &s->out_buf[len], s->out_ptr);
2001+ return ret;
2002+}
2003+
2004+static int usb_net_handle_data(USBDevice *dev, USBPacket *p)
2005+{
2006+ USBNetState *s = (USBNetState *)dev;
2007+ int ret = 0;
2008+
2009+ switch(p->pid) {
2010+ case USB_TOKEN_IN:
2011+ switch (p->devep) {
2012+ case 1:
2013+ ret = usb_net_handle_statusin(s, p);
2014+ break;
2015+
2016+ case 2:
2017+ ret = usb_net_handle_datain(s, p);
2018+ break;
2019+
2020+ default:
2021+ goto fail;
2022+ }
2023+ break;
2024+
2025+ case USB_TOKEN_OUT:
2026+ switch (p->devep) {
2027+ case 2:
2028+ ret = usb_net_handle_dataout(s, p);
2029+ break;
2030+
2031+ default:
2032+ goto fail;
2033+ }
2034+ break;
2035+
2036+ default:
2037+ fail:
2038+ ret = USB_RET_STALL;
2039+ break;
2040+ }
2041+ if (ret == USB_RET_STALL)
2042+ fprintf(stderr, "usbnet: failed data transaction: pid 0x%x ep 0x%x len 0x%x\n", p->pid, p->devep, p->len);
2043+ return ret;
2044+}
2045+
2046+static void usbnet_receive(void *opaque, const uint8_t *buf, int size)
2047+{
2048+ USBNetState *s = opaque;
2049+
2050+ if (s->rndis) {
2051+ struct rndis_packet_msg_type *msg = (struct rndis_packet_msg_type *)s->in_buf;
2052+ if (!s->rndis_state == RNDIS_DATA_INITIALIZED)
2053+ return;
2054+ if (size + sizeof(struct rndis_packet_msg_type) > sizeof(s->in_buf))
2055+ return;
2056+ memset(msg, 0, sizeof(struct rndis_packet_msg_type));
2057+ msg->MessageType = cpu_to_le32(REMOTE_NDIS_PACKET_MSG);
2058+ msg->MessageLength = cpu_to_le32(size + sizeof(struct rndis_packet_msg_type));
2059+ msg->DataOffset = cpu_to_le32(sizeof(struct rndis_packet_msg_type) - 8);
2060+ msg->DataLength = cpu_to_le32(size);
2061+ //msg->OOBDataOffset;
2062+ //msg->OOBDataLength;
2063+ //msg->NumOOBDataElements;
2064+ //msg->PerPacketInfoOffset;
2065+ //msg->PerPacketInfoLength;
2066+ //msg->VcHandle;
2067+ //msg->Reserved;
2068+ memcpy(msg + 1, buf, size);
2069+ s->in_len = size + sizeof(struct rndis_packet_msg_type);
2070+ } else {
2071+ if (size > sizeof(s->in_buf))
2072+ return;
2073+ memcpy(s->in_buf, buf, size);
2074+ s->in_len = size;
2075+ }
2076+ s->in_ptr = 0;
2077+}
2078+
2079+static int usbnet_can_receive(void *opaque)
2080+{
2081+ USBNetState *s = opaque;
2082+
2083+ if (s->rndis && !s->rndis_state == RNDIS_DATA_INITIALIZED)
2084+ return 1;
2085+ return !s->in_len;
2086+}
2087+
2088+static void usb_net_handle_destroy(USBDevice *dev)
2089+{
2090+ USBNetState *s = (USBNetState *)dev;
2091+ rndis_clear_responsequeue(s);
2092+ qemu_free(s);
2093+}
2094+
2095+USBDevice *usb_net_init(NICInfo *nd)
2096+{
2097+ USBNetState *s;
2098+
2099+ s = qemu_mallocz(sizeof(USBNetState));
2100+ if (!s)
2101+ return NULL;
2102+ s->dev.speed = USB_SPEED_FULL;
2103+ s->dev.handle_packet = usb_generic_handle_packet;
2104+
2105+ s->dev.handle_reset = usb_net_handle_reset;
2106+ s->dev.handle_control = usb_net_handle_control;
2107+ s->dev.handle_data = usb_net_handle_data;
2108+ s->dev.handle_destroy = usb_net_handle_destroy;
2109+
2110+ s->rndis = 1;
2111+ s->rndis_state = RNDIS_UNINITIALIZED;
2112+ s->medium = NDIS_MEDIUM_802_3;
2113+ s->speed = 1000000; /* 100MBps, in 100Bps units */
2114+ s->media_state = NDIS_MEDIA_STATE_CONNECTED;
2115+ s->filter = 0;
2116+ s->vendorid = 0x1234;
2117+ memcpy(s->mac, nd->macaddr, 6);
2118+ TAILQ_INIT(&s->rndis_resp);
2119+
2120+ pstrcpy(s->dev.devname, sizeof(s->dev.devname), "QEMU USB Network Interface");
2121+ s->vc = qemu_new_vlan_client(nd->vlan, usbnet_receive, usbnet_can_receive, s);
2122+ snprintf(s->vc->info_str, sizeof(s->vc->info_str),
2123+ "usbnet macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
2124+ s->mac[0], s->mac[1], s->mac[2],
2125+ s->mac[3], s->mac[4], s->mac[5]);
2126+ fprintf(stderr, "usbnet: initialized mac %02x:%02x:%02x:%02x:%02x:%02x\n",
2127+ s->mac[0], s->mac[1], s->mac[2],
2128+ s->mac[3], s->mac[4], s->mac[5]);
2129+ return (USBDevice *)s;
2130+}
2131diff -urN 4242/Makefile qemu-omap/Makefile
2132--- 4242/Makefile 2008-04-24 20:17:05.000000000 +0100
2133+++ qemu-omap/Makefile 2008-04-23 09:57:55.000000000 +0100
2134@@ -55,7 +55,8 @@
2135 OBJS+=tmp105.o
2136 OBJS+=scsi-disk.o cdrom.o
2137 OBJS+=scsi-generic.o
2138-OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o usb-serial.o
2139+OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-net.o
2140+OBJS+=usb-wacom.o usb-serial.o
2141 OBJS+=sd.o ssi-sd.o
2142
2143 ifdef CONFIG_BRLAPI
2144diff -urN 4242/softmmu_template.h qemu-omap/softmmu_template.h
2145--- 4242/softmmu_template.h 2008-04-24 18:11:49.000000000 +0100
2146+++ qemu-omap/softmmu_template.h 2008-04-23 09:57:56.000000000 +0100
2147@@ -51,12 +51,15 @@
2148 int mmu_idx,
2149 void *retaddr);
2150 static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr,
2151- target_ulong tlb_addr)
2152+ target_ulong tlb_addr,
2153+ target_ulong tlb_io)
2154 {
2155 DATA_TYPE res;
2156 int index;
2157
2158- index = (tlb_addr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
2159+ index = (tlb_addr & ~TARGET_PAGE_MASK) >> IO_MEM_SHIFT;
2160+ if (index > 4)
2161+ index = (tlb_io >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
2162 #if SHIFT <= 2
2163 res = io_mem_read[index][SHIFT](io_mem_opaque[index], physaddr);
2164 #else
2165@@ -95,7 +98,9 @@
2166 /* IO access */
2167 if ((addr & (DATA_SIZE - 1)) != 0)
2168 goto do_unaligned_access;
2169- res = glue(io_read, SUFFIX)(physaddr, tlb_addr);
2170+ res = glue(io_read, SUFFIX)(physaddr, tlb_addr,
2171+ env->tlb_table[mmu_idx]
2172+ [index].addr_code);
2173 } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) {
2174 /* slow unaligned access (it spans two pages or IO) */
2175 do_unaligned_access:
2176@@ -147,7 +152,9 @@
2177 /* IO access */
2178 if ((addr & (DATA_SIZE - 1)) != 0)
2179 goto do_unaligned_access;
2180- res = glue(io_read, SUFFIX)(physaddr, tlb_addr);
2181+ res = glue(io_read, SUFFIX)(physaddr, tlb_addr,
2182+ env->tlb_table[mmu_idx]
2183+ [index].addr_code);
2184 } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) {
2185 do_unaligned_access:
2186 /* slow unaligned access (it spans two pages) */
2187@@ -186,11 +193,14 @@
2188 static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr,
2189 DATA_TYPE val,
2190 target_ulong tlb_addr,
2191- void *retaddr)
2192+ void *retaddr,
2193+ target_ulong tlb_io)
2194 {
2195 int index;
2196
2197- index = (tlb_addr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
2198+ index = (tlb_addr & ~TARGET_PAGE_MASK) >> IO_MEM_SHIFT;
2199+ if (index > 4)
2200+ index = (tlb_io >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
2201 env->mem_write_vaddr = tlb_addr;
2202 env->mem_write_pc = (unsigned long)retaddr;
2203 #if SHIFT <= 2
2204@@ -228,7 +238,8 @@
2205 if ((addr & (DATA_SIZE - 1)) != 0)
2206 goto do_unaligned_access;
2207 retaddr = GETPC();
2208- glue(io_write, SUFFIX)(physaddr, val, tlb_addr, retaddr);
2209+ glue(io_write, SUFFIX)(physaddr, val, tlb_addr, retaddr,
2210+ env->tlb_table[mmu_idx][index].addr_code);
2211 } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) {
2212 do_unaligned_access:
2213 retaddr = GETPC();
2214@@ -278,7 +289,8 @@
2215 /* IO access */
2216 if ((addr & (DATA_SIZE - 1)) != 0)
2217 goto do_unaligned_access;
2218- glue(io_write, SUFFIX)(physaddr, val, tlb_addr, retaddr);
2219+ glue(io_write, SUFFIX)(physaddr, val, tlb_addr, retaddr,
2220+ env->tlb_table[mmu_idx][index].addr_code);
2221 } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) {
2222 do_unaligned_access:
2223 /* XXX: not efficient, but simple */
2224diff -urN 4242/target-i386/cpu.h qemu-omap/target-i386/cpu.h
2225--- 4242/target-i386/cpu.h 2008-04-23 12:18:51.000000000 +0100
2226+++ qemu-omap/target-i386/cpu.h 2008-04-23 09:57:56.000000000 +0100
2227@@ -499,7 +499,7 @@
2228 SegmentCache idt; /* only base and limit are used */
2229
2230 target_ulong cr[9]; /* NOTE: cr1, cr5-7 are unused */
2231- uint64_t a20_mask;
2232+ uint32_t a20_mask;
2233
2234 /* FPU state */
2235 unsigned int fpstt; /* top of stack index */
2236diff -urN 4242/target-i386/helper2.c qemu-omap/target-i386/helper2.c
2237--- 4242/target-i386/helper2.c 2008-04-23 12:18:51.000000000 +0100
2238+++ qemu-omap/target-i386/helper2.c 2008-04-23 09:57:56.000000000 +0100
2239@@ -377,7 +377,7 @@
2240 env->hflags |= HF_GIF_MASK;
2241
2242 cpu_x86_update_cr0(env, 0x60000010);
2243- env->a20_mask = ~0x0;
2244+ env->a20_mask = 0xffffffff;
2245 env->smbase = 0x30000;
2246
2247 env->idt.limit = 0xffff;
2248@@ -695,7 +695,7 @@
2249 /* when a20 is changed, all the MMU mappings are invalid, so
2250 we must flush everything */
2251 tlb_flush(env, 1);
2252- env->a20_mask = (~0x100000) | (a20_state << 20);
2253+ env->a20_mask = 0xffefffff | (a20_state << 20);
2254 }
2255 }
2256
2257@@ -800,8 +800,7 @@
2258
2259 #else
2260
2261-/* Bits 52-62 of a PTE are reserved. Bit 63 is the NX bit. */
2262-#define PHYS_ADDR_MASK 0xffffffffff000L
2263+#define PHYS_ADDR_MASK 0xfffff000
2264
2265 /* return value:
2266 -1 = cannot handle fault
2267@@ -813,10 +812,9 @@
2268 int is_write1, int mmu_idx, int is_softmmu)
2269 {
2270 uint64_t ptep, pte;
2271- target_ulong pde_addr, pte_addr;
2272+ uint32_t pdpe_addr, pde_addr, pte_addr;
2273 int error_code, is_dirty, prot, page_size, ret, is_write, is_user;
2274- target_phys_addr_t paddr;
2275- uint32_t page_offset;
2276+ unsigned long paddr, page_offset;
2277 target_ulong vaddr, virt_addr;
2278
2279 is_user = mmu_idx == MMU_USER_IDX;
2280@@ -836,11 +834,12 @@
2281
2282 if (env->cr[4] & CR4_PAE_MASK) {
2283 uint64_t pde, pdpe;
2284- target_ulong pdpe_addr;
2285
2286+ /* XXX: we only use 32 bit physical addresses */
2287 #ifdef TARGET_X86_64
2288 if (env->hflags & HF_LMA_MASK) {
2289- uint64_t pml4e_addr, pml4e;
2290+ uint32_t pml4e_addr;
2291+ uint64_t pml4e;
2292 int32_t sext;
2293
2294 /* test virtual address sign extension */
2295@@ -1102,19 +1101,17 @@
2296
2297 target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
2298 {
2299- target_ulong pde_addr, pte_addr;
2300- uint64_t pte;
2301- target_phys_addr_t paddr;
2302- uint32_t page_offset;
2303- int page_size;
2304+ uint32_t pde_addr, pte_addr;
2305+ uint32_t pde, pte, paddr, page_offset, page_size;
2306
2307 if (env->cr[4] & CR4_PAE_MASK) {
2308- target_ulong pdpe_addr;
2309- uint64_t pde, pdpe;
2310+ uint32_t pdpe_addr, pde_addr, pte_addr;
2311+ uint32_t pdpe;
2312
2313+ /* XXX: we only use 32 bit physical addresses */
2314 #ifdef TARGET_X86_64
2315 if (env->hflags & HF_LMA_MASK) {
2316- uint64_t pml4e_addr, pml4e;
2317+ uint32_t pml4e_addr, pml4e;
2318 int32_t sext;
2319
2320 /* test virtual address sign extension */
2321@@ -1124,13 +1121,13 @@
2322
2323 pml4e_addr = ((env->cr[3] & ~0xfff) + (((addr >> 39) & 0x1ff) << 3)) &
2324 env->a20_mask;
2325- pml4e = ldq_phys(pml4e_addr);
2326+ pml4e = ldl_phys(pml4e_addr);
2327 if (!(pml4e & PG_PRESENT_MASK))
2328 return -1;
2329
2330 pdpe_addr = ((pml4e & ~0xfff) + (((addr >> 30) & 0x1ff) << 3)) &
2331 env->a20_mask;
2332- pdpe = ldq_phys(pdpe_addr);
2333+ pdpe = ldl_phys(pdpe_addr);
2334 if (!(pdpe & PG_PRESENT_MASK))
2335 return -1;
2336 } else
2337@@ -1138,14 +1135,14 @@
2338 {
2339 pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 27) & 0x18)) &
2340 env->a20_mask;
2341- pdpe = ldq_phys(pdpe_addr);
2342+ pdpe = ldl_phys(pdpe_addr);
2343 if (!(pdpe & PG_PRESENT_MASK))
2344 return -1;
2345 }
2346
2347 pde_addr = ((pdpe & ~0xfff) + (((addr >> 21) & 0x1ff) << 3)) &
2348 env->a20_mask;
2349- pde = ldq_phys(pde_addr);
2350+ pde = ldl_phys(pde_addr);
2351 if (!(pde & PG_PRESENT_MASK)) {
2352 return -1;
2353 }
2354@@ -1158,11 +1155,9 @@
2355 pte_addr = ((pde & ~0xfff) + (((addr >> 12) & 0x1ff) << 3)) &
2356 env->a20_mask;
2357 page_size = 4096;
2358- pte = ldq_phys(pte_addr);
2359+ pte = ldl_phys(pte_addr);
2360 }
2361 } else {
2362- uint32_t pde;
2363-
2364 if (!(env->cr[0] & CR0_PG_MASK)) {
2365 pte = addr;
2366 page_size = 4096;
2367diff -urN 4242/vl.c qemu-omap/vl.c
2368--- 4242/vl.c 2008-04-24 21:26:21.000000000 +0100
2369+++ qemu-omap/vl.c 2008-04-23 09:57:57.000000000 +0100
2370@@ -5284,6 +5284,11 @@
2371 dev = usb_keyboard_init();
2372 } else if (strstart(devname, "disk:", &p)) {
2373 dev = usb_msd_init(p);
2374+ } else if (strstart(devname, "net:", &p)) {
2375+ unsigned int nr = strtoul(p, NULL, 0);
2376+ if (nr >= (unsigned int) nb_nics || strcmp(nd_table[nr].model, "usb"))
2377+ return -1;
2378+ dev = usb_net_init(&nd_table[nr]);
2379 } else if (!strcmp(devname, "wacom-tablet")) {
2380 dev = usb_wacom_init();
2381 } else if (strstart(devname, "serial:", &p)) {