X-Git-Url: https://git.saurik.com/apple/boot.git/blobdiff_plain/75b89a82fae8b6d553467b92cb5431b2b5b4df7e..bba600dda0ea8a76d875db7308f372bfc43f8506:/i386/libsaio/misc.c diff --git a/i386/libsaio/misc.c b/i386/libsaio/misc.c index 1336ee6..64a6221 100644 --- a/i386/libsaio/misc.c +++ b/i386/libsaio/misc.c @@ -1,12 +1,12 @@ /* - * 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. @@ -85,42 +85,58 @@ void enableA20() /* write output port */ outb(PORT_B, CMD_WOUT); + delay(100); /* wait until command is accepted */ while (inb(PORT_B) & KB_INFULL); outb(PORT_A, KB_A20); + delay(100); 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) -{ - /* - * Disable floppy: - * Hold controller in reset, - * disable DMA and IRQ, - * turn off floppy motors. - */ - outb(0x3F2, 0x00); -} -char * newString(const char * oldString) +//========================================================================== +// 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() { - if ( oldString ) - return strcpy(malloc(strlen(oldString)+1), oldString); - else - return NULL; + uint32_t cpuid_result[4]; + + do_cpuid(1, cpuid_result); + if ((cpuid_result[3] & 0x04000000) == 0) { + // Missing SSE2 + return 2; + } + return 0; } -void stop(const char * msg) +#ifndef BOOT1 + +//========================================================================== +// Return the platform name for this hardware. +// + +void +getPlatformName(char *nameBuf) { - error("\n%s\n", msg); - halt(); + strcpy(nameBuf, "ACPI"); } + +#endif +