Skip to contentSkip to conversation

AppleSMC device

PATCH In review Alexander Graf 3 participants 4 messages Jan 8, 2008 – Feb 25, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 4/9 AppleSMC device

Apples hardware dongle sits withing the fan control. To get Mac OS X up and running, this control device needs to be emulated and given the correct dongle key. This key has to be given via the command line.

Makefile.target +1 -1
Index: qemu-snapshot-2008-01-08_05/Makefile.target
===================================================================
@@ -441,7 +441,7 @@ ifeq ($(TARGET_BASE_ARCH), i386)
 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
-VL_OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o smbios.o hpet.o lpc.o
+VL_OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o smbios.o hpet.o lpc.o applesmc.o
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
hw/applesmc.c new file +171 -0

171 lines not on this page · raw message

hw/pc.h +4 -0
Index: qemu-snapshot-2008-01-08_05/hw/pc.h
===================================================================
@@ -142,6 +142,10 @@ void pci_piix4_ide_init(PCIBus *bus, Blo
 
 void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd);
 
+/* applesmc.c */
+void applesmc_init(void);
+void applesmc_setkey(char *key);
+
 /* lpc.c */
 void lpc_init(PCIBus *bus, int devfn, qemu_irq *pic);
 
vl.c +12 -0
Index: qemu-snapshot-2008-01-08_05/vl.c
===================================================================
@@ -7604,6 +7604,7 @@ static void help(int exitcode)
            "-std-vga        simulate a standard VGA card with VESA Bochs Extensions\n"
            "                (default is CL-GD5446 PCI VGA)\n"
            "-no-acpi        disable ACPI\n"
+           "-osk key        set AppleSMC key\n"
 #endif
            "-no-reboot      exit instead of rebooting\n"
            "-loadvm file    start right away with a saved state (loadvm in monitor)\n"
@@ -7719,6 +7720,9 @@ enum {
     QEMU_OPTION_old_param,
     QEMU_OPTION_clock,
     QEMU_OPTION_startdate,
+#ifdef TARGET_I386
+    QEMU_OPTION_osk,
+#endif
 };
 
 typedef struct QEMUOption {
@@ -7827,6 +7831,9 @@ const QEMUOption qemu_options[] = {
 #endif
     { "clock", HAS_ARG, QEMU_OPTION_clock },
     { "startdate", HAS_ARG, QEMU_OPTION_startdate },
+#ifdef TARGET_I386
+    { "osk", HAS_ARG, QEMU_OPTION_osk },
+#endif
     { NULL },
 };
 
@@ -8661,6 +8668,11 @@ int main(int argc, char **argv)
                     }
                 }
                 break;
+#ifdef TARGET_I386
+            case QEMU_OPTION_osk:
+                applesmc_setkey(optarg);
+                break;
+#endif
             }
         }
     }
#1 lore raw
Quoted 3 lines · On Tuesday 08 January 2008 09:22:49 Alexander Graf wrote:

Apples hardware dongle sits withing the fan control. To get Mac OS X up and running, this control device needs to be emulated and given the correct dongle key. This key has to be given via the command line.

How is the key obtained? I have access to a couple of macintoshes, but I don't know what code to run on them to snapshot the key?

Rob

Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.
#2 lore raw
Quoted 7 lines · Rob Landley
Quoted 3 lines · On Tuesday 08 January 2008 09:22:49 Alexander Graf wrote:

Apples hardware dongle sits withing the fan control. To get Mac OS X up and running, this control device needs to be emulated and given the correct dongle key. This key has to be given via the command line.

How is the key obtained? I have access to a couple of macintoshes, but I don't know what code to run on them to snapshot the key?

You need to read the keys OSK0 and OSK1 from your own SMC device using the applesmc driver on Linux. You can find a piece of code that does this on OSX on Amit Singh's website.

If you are on Linux, I wrote a script that does this for you: http://alex.csgraf.de/qemu/getkey

Remember that you have to be on an Intel Mac, as the PPC Macs lack this chip.

Alex

#3 lore raw
In reply to Rob Landley
Quoted 7 lines · Rob Landley
Quoted 3 lines · On Tuesday 08 January 2008 09:22:49 Alexander Graf wrote:

Apples hardware dongle sits withing the fan control. To get Mac OS X up and running, this control device needs to be emulated and given the correct dongle key. This key has to be given via the command line.

How is the key obtained? I have access to a couple of macintoshes, but I don't know what code to run on them to snapshot the key?

Two minutes with google suggests the correct values are:

OSK0 [ch8*] (bytes 6f 75 72 68 61 72 64 77 6f 72 6b 62 79 74 68 65 73 65 77 6f 72 64 73 67 75 61 72 64 65 64 70 6c)
OSK1 [ch8*] (bytes 65 61 73 65 64 6f 6e 74 73 74 65 61 6c 28 63 29 41 70 70 6c 65 43 6f 6d 70 75 74 65 72 49 6e 63)

Which are obviously not machine specific values.

Paul