Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/47224 )
Change subject: libpayload: Use typedef for OHCI enums ......................................................................
libpayload: Use typedef for OHCI enums
The OHCI header file declares various enums as follows:
enum { ... } enum_name;
Since the name is at the end, this is actually declaring a variable called enum_name and *not* a type, which is causing a multiple definition error in GCC 10. Add typedef to each enum so it declares a type to prevent this.
Signed-off-by: Jacob Garber jgarber1@ualberta.ca Change-Id: I452c0a1b118990942aa53f1e7e77f5e8378e8975 --- M payloads/libpayload/drivers/usb/ohci_private.h 1 file changed, 16 insertions(+), 14 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/24/47224/1
diff --git a/payloads/libpayload/drivers/usb/ohci_private.h b/payloads/libpayload/drivers/usb/ohci_private.h index 796be29..aa51490 100644 --- a/payloads/libpayload/drivers/usb/ohci_private.h +++ b/payloads/libpayload/drivers/usb/ohci_private.h @@ -36,7 +36,7 @@ // FIXME: fake typedef enum { CMD} reg;
- enum { + typedef enum { NumberDownstreamPorts = 1 << 0, PowerSwitchingMode = 1 << 8, NoPowerSwitching = 1 << 9, @@ -46,17 +46,17 @@ PowerOnToPowerGoodTime = 1 << 24 } HcRhDescriptorAReg;
- enum { + typedef enum { NumberDownstreamPortsMask = MASK(0, 8), PowerOnToPowerGoodTimeMask = MASK(24, 8) } HcRhDescriptorAMask;
- enum { + typedef enum { DeviceRemovable = 1 << 0, PortPowerControlMask = 1 << 16 } HcRhDescriptorBReg;
- enum { + typedef enum { CurrentConnectStatus = 1 << 0, PortEnableStatus = 1 << 1, PortSuspendStatus = 1 << 2, @@ -70,7 +70,8 @@ PortOverCurrentIndicatorChange = 1 << 19, PortResetStatusChange = 1 << 20 } HcRhPortStatusRead; - enum { + + typedef enum { ClearPortEnable = 1 << 0, SetPortEnable = 1 << 1, SetPortSuspend = 1 << 2, @@ -80,7 +81,7 @@ ClearPortPower = 1 << 9, } HcRhPortStatusSet;
- enum { + typedef enum { LocalPowerStatus = 1 << 0, OverCurrentIndicator = 1 << 1, DeviceRemoteWakeupEnable = 1 << 15, @@ -89,18 +90,19 @@ ClearRemoteWakeupEnable = 1 << 31 } HcRhStatusReg;
- enum { + typedef enum { FrameInterval = 1 << 0, FSLargestDataPacket = 1 << 16, FrameIntervalToggle = 1 << 31 } HcFmIntervalOffset; - enum { + + typedef enum { FrameIntervalMask = MASK(0, 14), FSLargestDataPacketMask = MASK(16, 15), FrameIntervalToggleMask = MASK(31, 1) } HcFmIntervalMask;
- enum { + typedef enum { ControlBulkServiceRatio = 1 << 0, PeriodicListEnable = 1 << 2, IsochronousEnable = 1 << 3, @@ -112,7 +114,7 @@ RemoteWakeupEnable = 1 << 10 } HcControlReg;
- enum { + typedef enum { ControlBulkServiceRatioMask = MASK(0, 2), HostControllerFunctionalStateMask = MASK(6, 2) } HcControlMask; @@ -124,7 +126,7 @@ USBSuspend = 3*HostControllerFunctionalState };
- enum { + typedef enum { HostControllerReset = 1 << 0, ControlListFilled = 1 << 1, BulkListFilled = 1 << 2, @@ -132,16 +134,16 @@ SchedulingOverrunCount = 1 << 16 } HcCommandStatusReg;
- enum { + typedef enum { SchedulingOverrunCountMask = MASK(16, 2) } HcCommandStatusMask;
- enum { + typedef enum { FrameRemaining = 1 << 0, FrameRemainingToggle = 1 << 31 } HcFmRemainingReg;
- enum { + typedef enum { SchedulingOverrung = 1 << 0, WritebackDoneHead = 1 << 1, StartofFrame = 1 << 2,
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47224 )
Change subject: libpayload: Use typedef for OHCI enums ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/47224/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/47224/1//COMMIT_MSG@7 PS1, Line 7: libpayload: Use typedef for OHCI enums Why not simply delete the names?
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47224 )
Change subject: libpayload: Use typedef for OHCI enums ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/47224/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/47224/1//COMMIT_MSG@7 PS1, Line 7: libpayload: Use typedef for OHCI enums
Why not simply delete the names?
I'd prefer to move the names where they belong (before the opening brace). They still have a little documentary value, but we don't really want to use them as types, as it seems.
Hello build bot (Jenkins), Nico Huber, Patrick Georgi, Martin Roth, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/47224
to look at the new patch set (#2).
Change subject: libpayload: Make OHCI enums into types ......................................................................
libpayload: Make OHCI enums into types
The OHCI header file declares various enums as follows:
enum { ... } enum_name;
Since the name is at the end, this is actually declaring a variable called enum_name and *not* a type, which is causing a multiple definition error in GCC 10. Move the enum_name before the opening brace to prevent this.
Signed-off-by: Jacob Garber jgarber1@ualberta.ca Change-Id: I452c0a1b118990942aa53f1e7e77f5e8378e8975 --- M payloads/libpayload/drivers/usb/ohci_private.h 1 file changed, 30 insertions(+), 28 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/24/47224/2
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47224 )
Change subject: libpayload: Make OHCI enums into types ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/47224/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/47224/1//COMMIT_MSG@7 PS1, Line 7: libpayload: Use typedef for OHCI enums
I'd prefer to move the names where they belong (before the opening […]
Done
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47224 )
Change subject: libpayload: Make OHCI enums into types ......................................................................
Patch Set 2: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/47224/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/47224/1//COMMIT_MSG@7 PS1, Line 7: libpayload: Use typedef for OHCI enums
Done
Looks good.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47224 )
Change subject: libpayload: Make OHCI enums into types ......................................................................
Patch Set 2: Code-Review+2
Nico Huber has submitted this change. ( https://review.coreboot.org/c/coreboot/+/47224 )
Change subject: libpayload: Make OHCI enums into types ......................................................................
libpayload: Make OHCI enums into types
The OHCI header file declares various enums as follows:
enum { ... } enum_name;
Since the name is at the end, this is actually declaring a variable called enum_name and *not* a type, which is causing a multiple definition error in GCC 10. Move the enum_name before the opening brace to prevent this.
Signed-off-by: Jacob Garber jgarber1@ualberta.ca Change-Id: I452c0a1b118990942aa53f1e7e77f5e8378e8975 Reviewed-on: https://review.coreboot.org/c/coreboot/+/47224 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Angel Pons th3fanbus@gmail.com Reviewed-by: Nico Huber nico.h@gmx.de --- M payloads/libpayload/drivers/usb/ohci_private.h 1 file changed, 30 insertions(+), 28 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Angel Pons: Looks good to me, approved
diff --git a/payloads/libpayload/drivers/usb/ohci_private.h b/payloads/libpayload/drivers/usb/ohci_private.h index 796be29..e29e590 100644 --- a/payloads/libpayload/drivers/usb/ohci_private.h +++ b/payloads/libpayload/drivers/usb/ohci_private.h @@ -36,7 +36,7 @@ // FIXME: fake typedef enum { CMD} reg;
- enum { + enum HcRhDescriptorAReg { NumberDownstreamPorts = 1 << 0, PowerSwitchingMode = 1 << 8, NoPowerSwitching = 1 << 9, @@ -44,19 +44,19 @@ OverCurrentProtectionMode = 1 << 11, NoOverCurrentProtection = 1 << 12, PowerOnToPowerGoodTime = 1 << 24 - } HcRhDescriptorAReg; + };
- enum { + enum HcRhDescriptorAMask { NumberDownstreamPortsMask = MASK(0, 8), PowerOnToPowerGoodTimeMask = MASK(24, 8) - } HcRhDescriptorAMask; + };
- enum { + enum HcRhDescriptorBReg { DeviceRemovable = 1 << 0, PortPowerControlMask = 1 << 16 - } HcRhDescriptorBReg; + };
- enum { + enum HcRhPortStatusRead { CurrentConnectStatus = 1 << 0, PortEnableStatus = 1 << 1, PortSuspendStatus = 1 << 2, @@ -69,8 +69,9 @@ PortSuspendStatusChange = 1 << 18, PortOverCurrentIndicatorChange = 1 << 19, PortResetStatusChange = 1 << 20 - } HcRhPortStatusRead; - enum { + }; + + enum HcRhPortStatusSet { ClearPortEnable = 1 << 0, SetPortEnable = 1 << 1, SetPortSuspend = 1 << 2, @@ -78,29 +79,30 @@ SetPortReset = 1 << 4, SetPortPower = 1 << 8, ClearPortPower = 1 << 9, - } HcRhPortStatusSet; + };
- enum { + enum HcRhStatusReg { LocalPowerStatus = 1 << 0, OverCurrentIndicator = 1 << 1, DeviceRemoteWakeupEnable = 1 << 15, LocalPowerStatusChange = 1 << 16, OverCurrentIndicatorChange = 1 << 17, ClearRemoteWakeupEnable = 1 << 31 - } HcRhStatusReg; + };
- enum { + enum HcFmIntervalOffset { FrameInterval = 1 << 0, FSLargestDataPacket = 1 << 16, FrameIntervalToggle = 1 << 31 - } HcFmIntervalOffset; - enum { + }; + + enum HcFmIntervalMask { FrameIntervalMask = MASK(0, 14), FSLargestDataPacketMask = MASK(16, 15), FrameIntervalToggleMask = MASK(31, 1) - } HcFmIntervalMask; + };
- enum { + enum HcControlReg { ControlBulkServiceRatio = 1 << 0, PeriodicListEnable = 1 << 2, IsochronousEnable = 1 << 3, @@ -110,12 +112,12 @@ InterruptRouting = 1 << 8, RemoteWakeupConnected = 1 << 9, RemoteWakeupEnable = 1 << 10 - } HcControlReg; + };
- enum { + enum HcControlMask { ControlBulkServiceRatioMask = MASK(0, 2), HostControllerFunctionalStateMask = MASK(6, 2) - } HcControlMask; + };
enum { USBReset = 0*HostControllerFunctionalState, @@ -124,24 +126,24 @@ USBSuspend = 3*HostControllerFunctionalState };
- enum { + enum HcCommandStatusReg { HostControllerReset = 1 << 0, ControlListFilled = 1 << 1, BulkListFilled = 1 << 2, OwnershipChangeRequest = 1 << 3, SchedulingOverrunCount = 1 << 16 - } HcCommandStatusReg; + };
- enum { + enum HcCommandStatusMask { SchedulingOverrunCountMask = MASK(16, 2) - } HcCommandStatusMask; + };
- enum { + enum HcFmRemainingReg { FrameRemaining = 1 << 0, FrameRemainingToggle = 1 << 31 - } HcFmRemainingReg; + };
- enum { + enum HcInterruptStatusReg { SchedulingOverrung = 1 << 0, WritebackDoneHead = 1 << 1, StartofFrame = 1 << 2, @@ -150,7 +152,7 @@ FrameNumberOverflow = 1 << 5, RootHubStatusChange = 1 << 6, OwnershipChange = 1 << 30 - } HcInterruptStatusReg; + };
typedef struct { // Control and Status Partition