@@ -141,17 +141,17 @@ unsafe impl AsBytes for GspFwWprMeta {}
141141// are valid.
142142unsafe impl FromBytes for GspFwWprMeta { }
143143
144- type GspFwWprMetaBootResumeInfo = r570_144 :: GspFwWprMeta__bindgen_ty_1 ;
145- type GspFwWprMetaBootInfo = r570_144 :: GspFwWprMeta__bindgen_ty_1__bindgen_ty_1 ;
144+ type GspFwWprMetaBootResumeInfo = bindings :: GspFwWprMeta__bindgen_ty_1 ;
145+ type GspFwWprMetaBootInfo = bindings :: GspFwWprMeta__bindgen_ty_1__bindgen_ty_1 ;
146146
147147impl GspFwWprMeta {
148148 /// Fill in and return a `GspFwWprMeta` suitable for booting `gsp_firmware` using the
149149 /// `fb_layout` layout.
150150 pub ( crate ) fn new ( gsp_firmware : & GspFirmware , fb_layout : & FbLayout ) -> Self {
151151 Self ( bindings:: GspFwWprMeta {
152152 // CAST: we want to store the bits of `GSP_FW_WPR_META_MAGIC` unmodified.
153- magic : r570_144 :: GSP_FW_WPR_META_MAGIC as u64 ,
154- revision : u64:: from ( r570_144 :: GSP_FW_WPR_META_REVISION ) ,
153+ magic : bindings :: GSP_FW_WPR_META_MAGIC as u64 ,
154+ revision : u64:: from ( bindings :: GSP_FW_WPR_META_REVISION ) ,
155155 sysmemAddrOfRadix3Elf : gsp_firmware. radix3_dma_handle ( ) ,
156156 sizeOfRadix3Elf : u64:: from_safe_cast ( gsp_firmware. size ) ,
157157 sysmemAddrOfBootloader : gsp_firmware. bootloader . ucode . dma_handle ( ) ,
@@ -315,19 +315,19 @@ impl From<MsgFunction> for u32 {
315315#[ repr( u32 ) ]
316316pub ( crate ) enum SeqBufOpcode {
317317 // Core operation opcodes
318- CoreReset = r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET ,
319- CoreResume = r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESUME ,
320- CoreStart = r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START ,
321- CoreWaitForHalt = r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT ,
318+ CoreReset = bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET ,
319+ CoreResume = bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESUME ,
320+ CoreStart = bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START ,
321+ CoreWaitForHalt = bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT ,
322322
323323 // Delay opcode
324- DelayUs = r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_DELAY_US ,
324+ DelayUs = bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_DELAY_US ,
325325
326326 // Register operation opcodes
327- RegModify = r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_MODIFY ,
328- RegPoll = r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_POLL ,
329- RegStore = r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE ,
330- RegWrite = r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE ,
327+ RegModify = bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_MODIFY ,
328+ RegPoll = bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_POLL ,
329+ RegStore = bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE ,
330+ RegWrite = bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE ,
331331}
332332
333333impl fmt:: Display for SeqBufOpcode {
@@ -351,25 +351,25 @@ impl TryFrom<u32> for SeqBufOpcode {
351351
352352 fn try_from ( value : u32 ) -> Result < SeqBufOpcode > {
353353 match value {
354- r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET => {
354+ bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET => {
355355 Ok ( SeqBufOpcode :: CoreReset )
356356 }
357- r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESUME => {
357+ bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESUME => {
358358 Ok ( SeqBufOpcode :: CoreResume )
359359 }
360- r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START => {
360+ bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START => {
361361 Ok ( SeqBufOpcode :: CoreStart )
362362 }
363- r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT => {
363+ bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT => {
364364 Ok ( SeqBufOpcode :: CoreWaitForHalt )
365365 }
366- r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_DELAY_US => Ok ( SeqBufOpcode :: DelayUs ) ,
367- r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_MODIFY => {
366+ bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_DELAY_US => Ok ( SeqBufOpcode :: DelayUs ) ,
367+ bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_MODIFY => {
368368 Ok ( SeqBufOpcode :: RegModify )
369369 }
370- r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_POLL => Ok ( SeqBufOpcode :: RegPoll ) ,
371- r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE => Ok ( SeqBufOpcode :: RegStore ) ,
372- r570_144 :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE => Ok ( SeqBufOpcode :: RegWrite ) ,
370+ bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_POLL => Ok ( SeqBufOpcode :: RegPoll ) ,
371+ bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE => Ok ( SeqBufOpcode :: RegStore ) ,
372+ bindings :: GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE => Ok ( SeqBufOpcode :: RegWrite ) ,
373373 _ => Err ( EINVAL ) ,
374374 }
375375 }
@@ -385,7 +385,7 @@ impl From<SeqBufOpcode> for u32 {
385385/// Wrapper for GSP sequencer register write payload.
386386#[ repr( transparent) ]
387387#[ derive( Copy , Clone ) ]
388- pub ( crate ) struct RegWritePayload ( r570_144 :: GSP_SEQ_BUF_PAYLOAD_REG_WRITE ) ;
388+ pub ( crate ) struct RegWritePayload ( bindings :: GSP_SEQ_BUF_PAYLOAD_REG_WRITE ) ;
389389
390390impl RegWritePayload {
391391 /// Returns the register address.
@@ -408,7 +408,7 @@ unsafe impl AsBytes for RegWritePayload {}
408408/// Wrapper for GSP sequencer register modify payload.
409409#[ repr( transparent) ]
410410#[ derive( Copy , Clone ) ]
411- pub ( crate ) struct RegModifyPayload ( r570_144 :: GSP_SEQ_BUF_PAYLOAD_REG_MODIFY ) ;
411+ pub ( crate ) struct RegModifyPayload ( bindings :: GSP_SEQ_BUF_PAYLOAD_REG_MODIFY ) ;
412412
413413impl RegModifyPayload {
414414 /// Returns the register address.
@@ -436,7 +436,7 @@ unsafe impl AsBytes for RegModifyPayload {}
436436/// Wrapper for GSP sequencer register poll payload.
437437#[ repr( transparent) ]
438438#[ derive( Copy , Clone ) ]
439- pub ( crate ) struct RegPollPayload ( r570_144 :: GSP_SEQ_BUF_PAYLOAD_REG_POLL ) ;
439+ pub ( crate ) struct RegPollPayload ( bindings :: GSP_SEQ_BUF_PAYLOAD_REG_POLL ) ;
440440
441441impl RegPollPayload {
442442 /// Returns the register address.
@@ -469,7 +469,7 @@ unsafe impl AsBytes for RegPollPayload {}
469469/// Wrapper for GSP sequencer delay payload.
470470#[ repr( transparent) ]
471471#[ derive( Copy , Clone ) ]
472- pub ( crate ) struct DelayUsPayload ( r570_144 :: GSP_SEQ_BUF_PAYLOAD_DELAY_US ) ;
472+ pub ( crate ) struct DelayUsPayload ( bindings :: GSP_SEQ_BUF_PAYLOAD_DELAY_US ) ;
473473
474474impl DelayUsPayload {
475475 /// Returns the delay value in microseconds.
@@ -487,7 +487,7 @@ unsafe impl AsBytes for DelayUsPayload {}
487487/// Wrapper for GSP sequencer register store payload.
488488#[ repr( transparent) ]
489489#[ derive( Copy , Clone ) ]
490- pub ( crate ) struct RegStorePayload ( r570_144 :: GSP_SEQ_BUF_PAYLOAD_REG_STORE ) ;
490+ pub ( crate ) struct RegStorePayload ( bindings :: GSP_SEQ_BUF_PAYLOAD_REG_STORE ) ;
491491
492492impl RegStorePayload {
493493 /// Returns the register address.
@@ -510,7 +510,7 @@ unsafe impl AsBytes for RegStorePayload {}
510510
511511/// Wrapper for GSP sequencer buffer command.
512512#[ repr( transparent) ]
513- pub ( crate ) struct SequencerBufferCmd ( r570_144 :: GSP_SEQUENCER_BUFFER_CMD ) ;
513+ pub ( crate ) struct SequencerBufferCmd ( bindings :: GSP_SEQUENCER_BUFFER_CMD ) ;
514514
515515impl SequencerBufferCmd {
516516 /// Returns the opcode as a `SeqBufOpcode` enum, or error if invalid.
@@ -612,7 +612,7 @@ unsafe impl AsBytes for SequencerBufferCmd {}
612612
613613/// Wrapper for GSP run CPU sequencer RPC.
614614#[ repr( transparent) ]
615- pub ( crate ) struct RunCpuSequencer ( r570_144 :: rpc_run_cpu_sequencer_v17_00 ) ;
615+ pub ( crate ) struct RunCpuSequencer ( bindings :: rpc_run_cpu_sequencer_v17_00 ) ;
616616
617617impl RunCpuSequencer {
618618 /// Returns the command index.
@@ -797,13 +797,6 @@ impl bindings::rpc_message_header_v {
797797 }
798798}
799799
800- // SAFETY: We can't derive the Zeroable trait for this binding because the
801- // procedural macro doesn't support the syntax used by bindgen to create the
802- // __IncompleteArrayField types. So instead we implement it here, which is safe
803- // because these are explicitly padded structures only containing types for
804- // which any bit pattern, including all zeros, is valid.
805- unsafe impl Zeroable for bindings:: rpc_message_header_v { }
806-
807800/// GSP Message Element.
808801///
809802/// This is essentially a message header expected to be followed by the message data.
@@ -853,11 +846,16 @@ impl GspMsgElement {
853846 self . inner . checkSum = checksum;
854847 }
855848
856- /// Returns the total length of the message.
849+ /// Returns the length of the message's payload.
850+ pub ( crate ) fn payload_length ( & self ) -> usize {
851+ // `rpc.length` includes the length of the RPC message header.
852+ num:: u32_as_usize ( self . inner . rpc . length )
853+ . saturating_sub ( size_of :: < bindings:: rpc_message_header_v > ( ) )
854+ }
855+
856+ /// Returns the total length of the message, message and RPC headers included.
857857 pub ( crate ) fn length ( & self ) -> usize {
858- // `rpc.length` includes the length of the GspRpcHeader but not the message header.
859- size_of :: < Self > ( ) - size_of :: < bindings:: rpc_message_header_v > ( )
860- + num:: u32_as_usize ( self . inner . rpc . length )
858+ size_of :: < Self > ( ) + self . payload_length ( )
861859 }
862860
863861 // Returns the sequence number of the message.
0 commit comments