99//! implementation.
1010
1111use crate :: debug:: * ;
12- use crate :: driver:: AsahiDevice ;
12+ use crate :: driver:: { AsahiDevRef , AsahiDevice } ;
1313use crate :: fw:: channels:: * ;
1414use crate :: fw:: initdata:: { raw, ChannelRing } ;
1515use crate :: fw:: types:: * ;
@@ -185,7 +185,7 @@ where
185185/// Device Control channel for global device management commands.
186186#[ versions( AGX ) ]
187187pub ( crate ) struct DeviceControlChannel {
188- dev : AsahiDevice ,
188+ dev : AsahiDevRef ,
189189 ch : TxChannel < ChannelState , DeviceControlMsg :: ver > ,
190190}
191191
@@ -199,7 +199,7 @@ impl DeviceControlChannel::ver {
199199 alloc : & mut gpu:: KernelAllocators ,
200200 ) -> Result < DeviceControlChannel :: ver > {
201201 Ok ( DeviceControlChannel :: ver {
202- dev : dev. clone ( ) ,
202+ dev : dev. into ( ) ,
203203 ch : TxChannel :: < ChannelState , DeviceControlMsg :: ver > :: new ( alloc, 0x100 ) ?,
204204 } )
205205 }
@@ -224,7 +224,7 @@ impl DeviceControlChannel::ver {
224224/// Pipe channel to submit WorkQueue execution requests.
225225#[ versions( AGX ) ]
226226pub ( crate ) struct PipeChannel {
227- dev : AsahiDevice ,
227+ dev : AsahiDevRef ,
228228 ch : TxChannel < ChannelState , PipeMsg :: ver > ,
229229}
230230
@@ -236,7 +236,7 @@ impl PipeChannel::ver {
236236 alloc : & mut gpu:: KernelAllocators ,
237237 ) -> Result < PipeChannel :: ver > {
238238 Ok ( PipeChannel :: ver {
239- dev : dev. clone ( ) ,
239+ dev : dev. into ( ) ,
240240 ch : TxChannel :: < ChannelState , PipeMsg :: ver > :: new ( alloc, 0x100 ) ?,
241241 } )
242242 }
@@ -255,7 +255,7 @@ impl PipeChannel::ver {
255255
256256/// Firmware Control channel, used for secure cache flush requests.
257257pub ( crate ) struct FwCtlChannel {
258- dev : AsahiDevice ,
258+ dev : AsahiDevRef ,
259259 ch : TxChannel < FwCtlChannelState , FwCtlMsg > ,
260260}
261261
@@ -268,7 +268,7 @@ impl FwCtlChannel {
268268 alloc : & mut gpu:: KernelAllocators ,
269269 ) -> Result < FwCtlChannel > {
270270 Ok ( FwCtlChannel {
271- dev : dev. clone ( ) ,
271+ dev : dev. into ( ) ,
272272 ch : TxChannel :: < FwCtlChannelState , FwCtlMsg > :: new_uncached ( alloc, 0x100 ) ?,
273273 } )
274274 }
@@ -293,7 +293,7 @@ impl FwCtlChannel {
293293/// Event channel, used to notify the driver of command completions, GPU faults and errors, and
294294/// other events.
295295pub ( crate ) struct EventChannel {
296- dev : AsahiDevice ,
296+ dev : AsahiDevRef ,
297297 ch : RxChannel < ChannelState , RawEventMsg > ,
298298 mgr : Arc < event:: EventManager > ,
299299 gpu : Option < Arc < dyn gpu:: GpuManager > > ,
@@ -307,7 +307,7 @@ impl EventChannel {
307307 mgr : Arc < event:: EventManager > ,
308308 ) -> Result < EventChannel > {
309309 Ok ( EventChannel {
310- dev : dev. clone ( ) ,
310+ dev : dev. into ( ) ,
311311 ch : RxChannel :: < ChannelState , RawEventMsg > :: new ( alloc, 0x100 ) ?,
312312 mgr,
313313 gpu : None ,
@@ -378,7 +378,7 @@ impl EventChannel {
378378/// levels), and it also uses a side buffer to actually hold the log messages, only passing around
379379/// pointers in the main buffer.
380380pub ( crate ) struct FwLogChannel {
381- dev : AsahiDevice ,
381+ dev : AsahiDevRef ,
382382 ch : RxChannel < FwLogChannelState , RawFwLogMsg > ,
383383 payload_buf : GpuArray < RawFwLogPayloadMsg > ,
384384}
@@ -393,7 +393,7 @@ impl FwLogChannel {
393393 alloc : & mut gpu:: KernelAllocators ,
394394 ) -> Result < FwLogChannel > {
395395 Ok ( FwLogChannel {
396- dev : dev. clone ( ) ,
396+ dev : dev. into ( ) ,
397397 ch : RxChannel :: < FwLogChannelState , RawFwLogMsg > :: new ( alloc, Self :: RING_SIZE ) ?,
398398 payload_buf : alloc
399399 . shared
@@ -467,7 +467,7 @@ impl FwLogChannel {
467467}
468468
469469pub ( crate ) struct KTraceChannel {
470- dev : AsahiDevice ,
470+ dev : AsahiDevRef ,
471471 ch : RxChannel < ChannelState , RawKTraceMsg > ,
472472}
473473
@@ -480,7 +480,7 @@ impl KTraceChannel {
480480 alloc : & mut gpu:: KernelAllocators ,
481481 ) -> Result < KTraceChannel > {
482482 Ok ( KTraceChannel {
483- dev : dev. clone ( ) ,
483+ dev : dev. into ( ) ,
484484 ch : RxChannel :: < ChannelState , RawKTraceMsg > :: new ( alloc, 0x200 ) ?,
485485 } )
486486 }
@@ -502,7 +502,7 @@ impl KTraceChannel {
502502/// Not really implemented other than debug logs yet...
503503#[ versions( AGX ) ]
504504pub ( crate ) struct StatsChannel {
505- dev : AsahiDevice ,
505+ dev : AsahiDevRef ,
506506 ch : RxChannel < ChannelState , RawStatsMsg :: ver > ,
507507}
508508
@@ -514,7 +514,7 @@ impl StatsChannel::ver {
514514 alloc : & mut gpu:: KernelAllocators ,
515515 ) -> Result < StatsChannel :: ver > {
516516 Ok ( StatsChannel :: ver {
517- dev : dev. clone ( ) ,
517+ dev : dev. into ( ) ,
518518 ch : RxChannel :: < ChannelState , RawStatsMsg :: ver > :: new ( alloc, 0x100 ) ?,
519519 } )
520520 }
0 commit comments