[PATCH 3/8] arm: apple: Add RTKit support

Mark Kettenis mark.kettenis at xs4all.nl
Sat Jan 22 20:31:36 CET 2022


> From: Simon Glass <sjg at chromium.org>
> Date: Sat, 22 Jan 2022 10:17:14 -0700
> 
> Hi Mark,
> 
> On Sat, 22 Jan 2022 at 06:59, Mark Kettenis <mark.kettenis at xs4all.nl> wrote:
> >
> > > From: Simon Glass <sjg at chromium.org>
> > > Date: Fri, 21 Jan 2022 18:40:14 -0700
> > >
> > > Hi Mark,
> > >
> > > On Fri, 14 Jan 2022 at 04:05, Mark Kettenis <kettenis at openbsd.org> wrote:
> > > >
> > > > Most Apple IOPs run a firmware that is based on what Apple calls
> > > > RTKit. RTKit implements a common mailbox protocol.  This code
> > > > provides an implementation of the AP side of this protocol,
> > > > providing a function to initialize RTKit-based firmwares as well
> > > > as a function to do a clean shutdown of this firmware.
> > > >
> > > > Signed-off-by: Mark Kettenis <kettenis at openbsd.org>
> > > > ---
> > > >  arch/arm/include/asm/arch-apple/rtkit.h |  11 ++
> > > >  arch/arm/mach-apple/Makefile            |   1 +
> > > >  arch/arm/mach-apple/rtkit.c             | 231 ++++++++++++++++++++++++
> > > >  3 files changed, 243 insertions(+)
> > > >  create mode 100644 arch/arm/include/asm/arch-apple/rtkit.h
> > > >  create mode 100644 arch/arm/mach-apple/rtkit.c
> > >
> > > This should be a driver.
> >
> > This isn't a driver but just a bit of helper code that implements the
> > RTKit protocol.  It will be used by the Apple NVMe driver and a future
> > SMC driver.  The same approach is being taken in Linux.  Since it is
> > intended to be shared, I didn't put it in the NVMe driver itself.
> 
> It just seems to set up and close down the peripheral, so this could
> be a driver. What happens when someone needs to change it for a new
> generation? Normally we would use the compatible string for that, but
> here you have code that might get duplicated or parameterised in
> another way.

The protocol is versioned, and apple_rtkit_init() does the appropriate
version negotation.  Currently we support protocol versions 11 and 12
(which seem to correspond to the firmware distributed with macOS 11
and macOS 12).  But we haven't noticed any real differences between
those versions yet.

> Anyway if you really think this is the right way, it is OK. We do it
> elsewhere, iwc
> 
> Reviewed-by: Simon Glass <sjg at chromium.org>
> Tested on: Macbook Air M1
> Tested-by: Simon Glass <sjg at chromium.org>
> 
> Regards,
> Simon
> 


More information about the U-Boot mailing list