/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
- * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
+ * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
* Reserved. This file contains Original Code and/or Modifications of
* Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.1 (the "License"). You may not use this file
+ * Source License Version 2.0 (the "License"). You may not use this file
* except in compliance with the License. Please obtain a copy of the
* License at http://www.apple.com/publicsource and read it before using
* this file.
* All rights reserved.
*/
-#include "io_inline.h"
#include "libsaio.h"
/*
void enableA20()
{
- /* make sure that the input buffer is empty */
- while (inb(PORT_B) & KB_INFULL);
+ /* make sure that the input buffer is empty */
+ while (inb(PORT_B) & KB_INFULL);
- /* make sure that the output buffer is empty */
- if (inb(PORT_B) & KB_OUTFULL)
- (void)inb(PORT_A);
+ /* make sure that the output buffer is empty */
+ if (inb(PORT_B) & KB_OUTFULL)
+ (void)inb(PORT_A);
- /* make sure that the input buffer is empty */
- while (inb(PORT_B) & KB_INFULL);
+ /* make sure that the input buffer is empty */
+ while (inb(PORT_B) & KB_INFULL);
- /* write output port */
- outb(PORT_B, CMD_WOUT);
+ /* write output port */
+ outb(PORT_B, CMD_WOUT);
+ delay(100);
- /* wait until command is accepted */
- while (inb(PORT_B) & KB_INFULL);
+ /* wait until command is accepted */
+ while (inb(PORT_B) & KB_INFULL);
- outb(PORT_A, KB_A20);
+ outb(PORT_A, KB_A20);
+ delay(100);
- while (inb(PORT_B) & KB_INFULL); /* wait until done */
+ while (inb(PORT_B) & KB_INFULL); /* wait until done */
}
-void sleep(int n)
+static inline void
+do_cpuid(uint32_t selector, uint32_t *data)
{
- int endtime = (time18() + 18*n);
- while (time18() < endtime);
+ asm volatile ("cpuid"
+ : "=a" (data[0]),
+ "=b" (data[1]),
+ "=c" (data[2]),
+ "=d" (data[3])
+ : "a"(selector));
}
-void turnOffFloppy(void)
+
+//==========================================================================
+// Check to see that this is a supported hardware configuration.
+// If this hardware is supported, return 0.
+// If this hardware is not supported, return an error code.
+
+int
+checkForSupportedHardware()
{
- /*
- * Disable floppy:
- * Hold controller in reset,
- * disable DMA and IRQ,
- * turn off floppy motors.
- */
- outb(0x3F2, 0x00);
+ uint32_t cpuid_result[4];
+
+ do_cpuid(1, cpuid_result);
+ if ((cpuid_result[3] & 0x04000000) == 0) {
+ // Missing SSE2
+ return 2;
+ }
+ return 0;
}
-char * newString(char * oldString)
+#ifndef BOOT1
+
+//==========================================================================
+// Return the platform name for this hardware.
+//
+
+void
+getPlatformName(char *nameBuf)
{
- if ( oldString )
- return strcpy(malloc(strlen(oldString)+1), oldString);
- else
- return NULL;
+ strcpy(nameBuf, "ACPI");
}
+
+#endif
+