1 | /** @file
|
---|
2 | * DevPCNet - Private guest interface for the PCNet device. (DEV)
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2008 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_DevPCNet_h
|
---|
27 | #define ___VBox_DevPCNet_h
|
---|
28 |
|
---|
29 | #include <iprt/types.h>
|
---|
30 |
|
---|
31 | /** @defgroup grp_devpcnet AMD PCnet-PCI II / PCnet-FAST III (Am79C970A / Am79C973) Ethernet Controller Emulation.
|
---|
32 | * {
|
---|
33 | */
|
---|
34 |
|
---|
35 | #define PCNET_GUEST_INTERFACE_VERSION (1)
|
---|
36 | #define PCNET_GUEST_SHARED_MEMORY_SIZE _512K
|
---|
37 | #define PCNET_GUEST_TX_DESCRIPTOR_SIZE 16
|
---|
38 | #define PCNET_GUEST_RX_DESCRIPTOR_SIZE 16
|
---|
39 | #define PCNET_GUEST_MAX_TX_DESCRIPTORS 128
|
---|
40 | #define PCNET_GUEST_MAX_RX_DESCRIPTORS 256
|
---|
41 | #define PCNET_GUEST_NIC_BUFFER_SIZE 1536
|
---|
42 |
|
---|
43 | /* 256*16 + 128*16 + 256*1536 + 128*1536 = 582KB */
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * The header of the PCNet shared memory (VBox specific).
|
---|
47 | */
|
---|
48 | #pragma pack(1) /* paranoia */
|
---|
49 | typedef struct
|
---|
50 | {
|
---|
51 | /** The size of the shared memory that's being used.
|
---|
52 | * (This is <= PCNET_GUEST_SHARED_MEMORY_SIZE.) */
|
---|
53 | uint32_t cbUsed;
|
---|
54 | /** Version (PCNET_GUEST_INTERFACE_VERSION). */
|
---|
55 | uint32_t u32Version;
|
---|
56 | /** Flags (See PCNET_GUEST_FLAGS_*). */
|
---|
57 | uint32_t fFlags;
|
---|
58 | /** Align the following members to 64 bit. */
|
---|
59 | uint32_t u32Alignment;
|
---|
60 |
|
---|
61 | union
|
---|
62 | {
|
---|
63 | struct
|
---|
64 | {
|
---|
65 | /** The size (in bytes) of the transmit descriptor array. */
|
---|
66 | uint32_t cbTxDescriptors;
|
---|
67 | /** The size (in bytes) of the receive descriptor array. */
|
---|
68 | uint32_t cbRxDescriptors;
|
---|
69 | /** Offset of the transmit descriptors relative to this header. */
|
---|
70 | uint32_t offTxDescriptors;
|
---|
71 | /** Offset of the receive descriptors relative to this header. */
|
---|
72 | uint32_t offRxDescriptors;
|
---|
73 | /** Offset of the transmit buffers relative to this header. */
|
---|
74 | uint32_t offTxBuffers;
|
---|
75 | /** Offset of the receive buffers relative to this header. */
|
---|
76 | uint32_t offRxBuffers;
|
---|
77 | } V1;
|
---|
78 | } V;
|
---|
79 |
|
---|
80 | } PCNETGUESTSHAREDMEMORY;
|
---|
81 | #pragma pack()
|
---|
82 | /** Pointer to the PCNet shared memory header. */
|
---|
83 | typedef PCNETGUESTSHAREDMEMORY *PPCNETGUESTSHAREDMEMORY;
|
---|
84 | /** Const pointer to the PCNet shared memory header. */
|
---|
85 | typedef const PCNETGUESTSHAREDMEMORY *PCPCNETGUESTSHAREDMEMORY;
|
---|
86 |
|
---|
87 | /** @name fFlags definitions
|
---|
88 | * @{
|
---|
89 | */
|
---|
90 | /** Host admits existence private PCNet interface. */
|
---|
91 | #define PCNET_GUEST_FLAGS_ADMIT_HOST RT_BIT(0)
|
---|
92 | /** Guest admits using the private PCNet interface. */
|
---|
93 | #define PCNET_GUEST_FLAGS_ADMIT_GUEST RT_BIT(1)
|
---|
94 | /** @} */
|
---|
95 |
|
---|
96 | /** @} */
|
---|
97 |
|
---|
98 | #endif
|
---|
99 |
|
---|