diff mbox

[edk2,3/5] OvmfPkg/IndustryStandard: add QemuFwCfgDma.h

Message ID 20161201175633.2538-4-lersek@redhat.com
State New
Headers show

Commit Message

Laszlo Ersek Dec. 1, 2016, 5:56 p.m. UTC
Add the type and macro definitions related to QEMU's DMA-like fw_cfg
access method in a dedicated header file.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

---
 OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h | 50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)

-- 
2.9.2


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Jordan Justen Dec. 1, 2016, 7:34 p.m. UTC | #1
On 2016-12-01 09:56:31, Laszlo Ersek wrote:
> Add the type and macro definitions related to QEMU's DMA-like fw_cfg

> access method in a dedicated header file.

> 

> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> Cc: Jordan Justen <jordan.l.justen@intel.com>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

> ---

>  OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h | 50 ++++++++++++++++++++


What do you think about just
OvmfPkg/Include/IndustryStandard/QemuFwCfg.h?

Arguably, the FIRMWARE_CONFIG_ITEM enums could be moved there as
well...

Then again, I think we could also just put this content into
OvmfPkg/Include/Library/QemuFwCfgLib.h.

-Jordan

>  1 file changed, 50 insertions(+)

> 

> diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h b/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h

> new file mode 100644

> index 000000000000..37a5804adb05

> --- /dev/null

> +++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h

> @@ -0,0 +1,50 @@

> +/** @file

> +  Macro and type definitions related to QEMU's DMA-like fw_cfg access method,

> +  based on "docs/specs/fw_cfg.txt" in the QEMU tree.

> +

> +  Copyright (C) 2016, Red Hat, Inc.

> +

> +  This program and the accompanying materials are licensed and made available

> +  under the terms and conditions of the BSD License which accompanies this

> +  distribution.  The full text of the license may be found at

> +  http://opensource.org/licenses/bsd-license.php

> +

> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT

> +  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

> +**/

> +

> +

> +#ifndef __FW_CFG_DMA__

> +#define __FW_CFG_DMA__

> +

> +#include <Base.h>

> +

> +//

> +// If the following bit is set in the UINT32 fw_cfg revision / feature bitmap

> +// -- read from key 0x0001 with the basic IO Port or MMIO method --, then the

> +// DMA interface is available.

> +//

> +#define FW_CFG_F_DMA BIT1

> +

> +//

> +// Communication structure for the DMA access method. All fields are encoded in

> +// big endian.

> +//

> +#pragma pack (1)

> +typedef struct {

> +  UINT32 Control;

> +  UINT32 Length;

> +  UINT64 Address;

> +} FW_CFG_DMA_ACCESS;

> +#pragma pack ()

> +

> +//

> +// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding).

> +//

> +#define FW_CFG_DMA_CTL_ERROR  BIT0

> +#define FW_CFG_DMA_CTL_READ   BIT1

> +#define FW_CFG_DMA_CTL_SKIP   BIT2

> +#define FW_CFG_DMA_CTL_SELECT BIT3

> +#define FW_CFG_DMA_CTL_WRITE  BIT4

> +

> +#endif

> -- 

> 2.9.2

> 

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Laszlo Ersek Dec. 1, 2016, 8:48 p.m. UTC | #2
On 12/01/16 20:34, Jordan Justen wrote:
> On 2016-12-01 09:56:31, Laszlo Ersek wrote:

>> Add the type and macro definitions related to QEMU's DMA-like fw_cfg

>> access method in a dedicated header file.

>>

>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> Cc: Jordan Justen <jordan.l.justen@intel.com>

>> Contributed-under: TianoCore Contribution Agreement 1.0

>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

>> ---

>>  OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h | 50 ++++++++++++++++++++

> 

> What do you think about just

> OvmfPkg/Include/IndustryStandard/QemuFwCfg.h?

> 

> Arguably, the FIRMWARE_CONFIG_ITEM enums could be moved there as

> well...

> 

> Then again, I think we could also just put this content into

> OvmfPkg/Include/Library/QemuFwCfgLib.h.


Adding this stuff to "OvmfPkg/Include/Library/QemuFwCfgLib.h" sounds
good to me; I'll do that in v2.

Thanks!
Laszlo

> -Jordan

> 

>>  1 file changed, 50 insertions(+)

>>

>> diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h b/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h

>> new file mode 100644

>> index 000000000000..37a5804adb05

>> --- /dev/null

>> +++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h

>> @@ -0,0 +1,50 @@

>> +/** @file

>> +  Macro and type definitions related to QEMU's DMA-like fw_cfg access method,

>> +  based on "docs/specs/fw_cfg.txt" in the QEMU tree.

>> +

>> +  Copyright (C) 2016, Red Hat, Inc.

>> +

>> +  This program and the accompanying materials are licensed and made available

>> +  under the terms and conditions of the BSD License which accompanies this

>> +  distribution.  The full text of the license may be found at

>> +  http://opensource.org/licenses/bsd-license.php

>> +

>> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT

>> +  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

>> +**/

>> +

>> +

>> +#ifndef __FW_CFG_DMA__

>> +#define __FW_CFG_DMA__

>> +

>> +#include <Base.h>

>> +

>> +//

>> +// If the following bit is set in the UINT32 fw_cfg revision / feature bitmap

>> +// -- read from key 0x0001 with the basic IO Port or MMIO method --, then the

>> +// DMA interface is available.

>> +//

>> +#define FW_CFG_F_DMA BIT1

>> +

>> +//

>> +// Communication structure for the DMA access method. All fields are encoded in

>> +// big endian.

>> +//

>> +#pragma pack (1)

>> +typedef struct {

>> +  UINT32 Control;

>> +  UINT32 Length;

>> +  UINT64 Address;

>> +} FW_CFG_DMA_ACCESS;

>> +#pragma pack ()

>> +

>> +//

>> +// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding).

>> +//

>> +#define FW_CFG_DMA_CTL_ERROR  BIT0

>> +#define FW_CFG_DMA_CTL_READ   BIT1

>> +#define FW_CFG_DMA_CTL_SKIP   BIT2

>> +#define FW_CFG_DMA_CTL_SELECT BIT3

>> +#define FW_CFG_DMA_CTL_WRITE  BIT4

>> +

>> +#endif

>> -- 

>> 2.9.2

>>

>>


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Jordan Justen Dec. 2, 2016, 1:01 a.m. UTC | #3
On 2016-12-01 12:48:51, Laszlo Ersek wrote:
> On 12/01/16 20:34, Jordan Justen wrote:

> > On 2016-12-01 09:56:31, Laszlo Ersek wrote:

> >> Add the type and macro definitions related to QEMU's DMA-like fw_cfg

> >> access method in a dedicated header file.

> >>

> >> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> >> Cc: Jordan Justen <jordan.l.justen@intel.com>

> >> Contributed-under: TianoCore Contribution Agreement 1.0

> >> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

> >> ---

> >>  OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h | 50 ++++++++++++++++++++

> > 

> > What do you think about just

> > OvmfPkg/Include/IndustryStandard/QemuFwCfg.h?

> > 

> > Arguably, the FIRMWARE_CONFIG_ITEM enums could be moved there as

> > well...

> > 

> > Then again, I think we could also just put this content into

> > OvmfPkg/Include/Library/QemuFwCfgLib.h.

> 

> Adding this stuff to "OvmfPkg/Include/Library/QemuFwCfgLib.h" sounds

> good to me; I'll do that in v2.

> 


Ok. By the way, I looked over the series, and with that change you can
add Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

I'll let you decide if you want to send out a v2.

-Jordan

> 

> > -Jordan

> > 

> >>  1 file changed, 50 insertions(+)

> >>

> >> diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h b/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h

> >> new file mode 100644

> >> index 000000000000..37a5804adb05

> >> --- /dev/null

> >> +++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h

> >> @@ -0,0 +1,50 @@

> >> +/** @file

> >> +  Macro and type definitions related to QEMU's DMA-like fw_cfg access method,

> >> +  based on "docs/specs/fw_cfg.txt" in the QEMU tree.

> >> +

> >> +  Copyright (C) 2016, Red Hat, Inc.

> >> +

> >> +  This program and the accompanying materials are licensed and made available

> >> +  under the terms and conditions of the BSD License which accompanies this

> >> +  distribution.  The full text of the license may be found at

> >> +  http://opensource.org/licenses/bsd-license.php

> >> +

> >> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT

> >> +  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

> >> +**/

> >> +

> >> +

> >> +#ifndef __FW_CFG_DMA__

> >> +#define __FW_CFG_DMA__

> >> +

> >> +#include <Base.h>

> >> +

> >> +//

> >> +// If the following bit is set in the UINT32 fw_cfg revision / feature bitmap

> >> +// -- read from key 0x0001 with the basic IO Port or MMIO method --, then the

> >> +// DMA interface is available.

> >> +//

> >> +#define FW_CFG_F_DMA BIT1

> >> +

> >> +//

> >> +// Communication structure for the DMA access method. All fields are encoded in

> >> +// big endian.

> >> +//

> >> +#pragma pack (1)

> >> +typedef struct {

> >> +  UINT32 Control;

> >> +  UINT32 Length;

> >> +  UINT64 Address;

> >> +} FW_CFG_DMA_ACCESS;

> >> +#pragma pack ()

> >> +

> >> +//

> >> +// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding).

> >> +//

> >> +#define FW_CFG_DMA_CTL_ERROR  BIT0

> >> +#define FW_CFG_DMA_CTL_READ   BIT1

> >> +#define FW_CFG_DMA_CTL_SKIP   BIT2

> >> +#define FW_CFG_DMA_CTL_SELECT BIT3

> >> +#define FW_CFG_DMA_CTL_WRITE  BIT4

> >> +

> >> +#endif

> >> -- 

> >> 2.9.2

> >>

> >>

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Laszlo Ersek Dec. 2, 2016, 10:05 a.m. UTC | #4
On 12/02/16 02:01, Jordan Justen wrote:
> On 2016-12-01 12:48:51, Laszlo Ersek wrote:

>> On 12/01/16 20:34, Jordan Justen wrote:

>>> On 2016-12-01 09:56:31, Laszlo Ersek wrote:

>>>> Add the type and macro definitions related to QEMU's DMA-like fw_cfg

>>>> access method in a dedicated header file.

>>>>

>>>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>>>> Cc: Jordan Justen <jordan.l.justen@intel.com>

>>>> Contributed-under: TianoCore Contribution Agreement 1.0

>>>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

>>>> ---

>>>>  OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h | 50 ++++++++++++++++++++

>>>

>>> What do you think about just

>>> OvmfPkg/Include/IndustryStandard/QemuFwCfg.h?

>>>

>>> Arguably, the FIRMWARE_CONFIG_ITEM enums could be moved there as

>>> well...

>>>

>>> Then again, I think we could also just put this content into

>>> OvmfPkg/Include/Library/QemuFwCfgLib.h.

>>

>> Adding this stuff to "OvmfPkg/Include/Library/QemuFwCfgLib.h" sounds

>> good to me; I'll do that in v2.

>>

> 

> Ok. By the way, I looked over the series, and with that change you can

> add Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>


Thank you!

> I'll let you decide if you want to send out a v2.


Yes, I will; first I'd like you to at least skim v2, second, I need
Ard's R-b for the ArmVirtPkg patches.

Hm, Ard seems to be on vacation (good choice :)), so maybe I'll CC Leif
as well. Then I'll use your R-b and hopefully Leif's in Ard's review's
stead.

Thanks!
Laszlo

> -Jordan

> 

>>

>>> -Jordan

>>>

>>>>  1 file changed, 50 insertions(+)

>>>>

>>>> diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h b/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h

>>>> new file mode 100644

>>>> index 000000000000..37a5804adb05

>>>> --- /dev/null

>>>> +++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h

>>>> @@ -0,0 +1,50 @@

>>>> +/** @file

>>>> +  Macro and type definitions related to QEMU's DMA-like fw_cfg access method,

>>>> +  based on "docs/specs/fw_cfg.txt" in the QEMU tree.

>>>> +

>>>> +  Copyright (C) 2016, Red Hat, Inc.

>>>> +

>>>> +  This program and the accompanying materials are licensed and made available

>>>> +  under the terms and conditions of the BSD License which accompanies this

>>>> +  distribution.  The full text of the license may be found at

>>>> +  http://opensource.org/licenses/bsd-license.php

>>>> +

>>>> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT

>>>> +  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

>>>> +**/

>>>> +

>>>> +

>>>> +#ifndef __FW_CFG_DMA__

>>>> +#define __FW_CFG_DMA__

>>>> +

>>>> +#include <Base.h>

>>>> +

>>>> +//

>>>> +// If the following bit is set in the UINT32 fw_cfg revision / feature bitmap

>>>> +// -- read from key 0x0001 with the basic IO Port or MMIO method --, then the

>>>> +// DMA interface is available.

>>>> +//

>>>> +#define FW_CFG_F_DMA BIT1

>>>> +

>>>> +//

>>>> +// Communication structure for the DMA access method. All fields are encoded in

>>>> +// big endian.

>>>> +//

>>>> +#pragma pack (1)

>>>> +typedef struct {

>>>> +  UINT32 Control;

>>>> +  UINT32 Length;

>>>> +  UINT64 Address;

>>>> +} FW_CFG_DMA_ACCESS;

>>>> +#pragma pack ()

>>>> +

>>>> +//

>>>> +// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding).

>>>> +//

>>>> +#define FW_CFG_DMA_CTL_ERROR  BIT0

>>>> +#define FW_CFG_DMA_CTL_READ   BIT1

>>>> +#define FW_CFG_DMA_CTL_SKIP   BIT2

>>>> +#define FW_CFG_DMA_CTL_SELECT BIT3

>>>> +#define FW_CFG_DMA_CTL_WRITE  BIT4

>>>> +

>>>> +#endif

>>>> -- 

>>>> 2.9.2

>>>>

>>>>

>>


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h b/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h
new file mode 100644
index 000000000000..37a5804adb05
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfgDma.h
@@ -0,0 +1,50 @@ 
+/** @file
+  Macro and type definitions related to QEMU's DMA-like fw_cfg access method,
+  based on "docs/specs/fw_cfg.txt" in the QEMU tree.
+
+  Copyright (C) 2016, Red Hat, Inc.
+
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+
+#ifndef __FW_CFG_DMA__
+#define __FW_CFG_DMA__
+
+#include <Base.h>
+
+//
+// If the following bit is set in the UINT32 fw_cfg revision / feature bitmap
+// -- read from key 0x0001 with the basic IO Port or MMIO method --, then the
+// DMA interface is available.
+//
+#define FW_CFG_F_DMA BIT1
+
+//
+// Communication structure for the DMA access method. All fields are encoded in
+// big endian.
+//
+#pragma pack (1)
+typedef struct {
+  UINT32 Control;
+  UINT32 Length;
+  UINT64 Address;
+} FW_CFG_DMA_ACCESS;
+#pragma pack ()
+
+//
+// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding).
+//
+#define FW_CFG_DMA_CTL_ERROR  BIT0
+#define FW_CFG_DMA_CTL_READ   BIT1
+#define FW_CFG_DMA_CTL_SKIP   BIT2
+#define FW_CFG_DMA_CTL_SELECT BIT3
+#define FW_CFG_DMA_CTL_WRITE  BIT4
+
+#endif