[coreboot] [DirectHW] [commit] r1 - branches tags trunk trunk/macosx trunk/macosx/DirectHW trunk/macosx/DirectHW/DirectHW.pmdoc trunk/macosx/DirectHW/DirectHW.xcodeproj trunk/macosx/DirectHW/build trunk/macos...

repository service svn at coreboot.org
Mon Mar 14 03:21:55 CET 2011


Author: stepan
Date: Mon Mar 14 03:21:55 2011
New Revision: 1
URL: https://tracker.coreboot.org/trac/directhw/changeset/1

Log:
Latest DirectHW version in public repository svn://coreboot.org/directhw
See http://www.coreboot.org/DirectHW for more information.

Added:
   branches/
   tags/
   trunk/
   trunk/macosx/
   trunk/macosx/DirectHW/
   trunk/macosx/DirectHW/Copying.rtf
   trunk/macosx/DirectHW/DirectHW-Framework-Info.plist
   trunk/macosx/DirectHW/DirectHW-Info.plist
   trunk/macosx/DirectHW/DirectHW-i386-only.diff
   trunk/macosx/DirectHW/DirectHW.c
   trunk/macosx/DirectHW/DirectHW.cpp
   trunk/macosx/DirectHW/DirectHW.h
   trunk/macosx/DirectHW/DirectHW.hpp
   trunk/macosx/DirectHW/DirectHW.pmdoc/
   trunk/macosx/DirectHW/DirectHW.pmdoc/01directhw-contents.xml
   trunk/macosx/DirectHW/DirectHW.pmdoc/01directhw.xml
   trunk/macosx/DirectHW/DirectHW.pmdoc/index.xml
   trunk/macosx/DirectHW/DirectHW.xcodeproj/
   trunk/macosx/DirectHW/DirectHW.xcodeproj/project.pbxproj
   trunk/macosx/DirectHW/Makefile
   trunk/macosx/DirectHW/ReadMe.rtf
   trunk/macosx/DirectHW/Welcome.rtf
   trunk/macosx/DirectHW/background.png   (contents, props changed)
   trunk/macosx/DirectHW/build/
   trunk/macosx/DirectHW/installer.png   (contents, props changed)
   trunk/macosx/Makefile
   trunk/macosx/create-dmg/
   trunk/macosx/create-dmg/create-dmg   (contents, props changed)
   trunk/macosx/create-dmg/sample   (contents, props changed)
   trunk/macosx/create-dmg/support/
   trunk/macosx/create-dmg/support/AdiumApplescriptRunner   (contents, props changed)
   trunk/macosx/create-dmg/support/template.applescript
   trunk/macosx/patches/
   trunk/macosx/patches/dmidecode-2.9.diff
   trunk/macosx/patches/flashrom-r1280.diff
   trunk/macosx/patches/inteltool-r6440.diff
   trunk/macosx/patches/msrtool-r6440.diff
   trunk/macosx/patches/nvramtool-r6440.diff
   trunk/macosx/patches/pciutils-3.1.7.diff
   trunk/macosx/patches/superiotool-r6440.diff
   trunk/windows/
   trunk/windows/README

Added: trunk/macosx/DirectHW/Copying.rtf
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/Copying.rtf	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,13 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320
+{\fonttbl\f0\fnil\fcharset0 Monaco;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\margl1440\margr1440\vieww12980\viewh15380\viewkind0
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+
+\f0\fs20 \cf0 DirectHW is Copyright \'a9 2008-2010 coresystems GmbH <{\field{\*\fldinst{HYPERLINK "mailto:info at coresystems.de"}}{\fldrslt info at coresystems.de}}>\
+\
+Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\
+\
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\
+\
+Visit {\field{\*\fldinst{HYPERLINK "http://www.coresystems.de/"}}{\fldrslt http://www.coresystems.de/}} for more information.}
\ No newline at end of file

Added: trunk/macosx/DirectHW/DirectHW-Framework-Info.plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/DirectHW-Framework-Info.plist	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>${EXECUTABLE_NAME}</string>
+	<key>CFBundleIdentifier</key>
+	<string>com.coresystems.DirectHW</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>FMWK</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>1.3</string>
+</dict>
+</plist>

Added: trunk/macosx/DirectHW/DirectHW-Info.plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/DirectHW-Info.plist	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>DirectHW</string>
+	<key>CFBundleIdentifier</key>
+	<string>com.coresystems.driver.DirectHW</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>DirectHW</string>
+	<key>CFBundlePackageType</key>
+	<string>KEXT</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>1.3</string>
+	<key>IOKitPersonalities</key>
+	<dict>
+		<key>DirectHWUserClient</key>
+		<dict>
+			<key>CFBundleIdentifier</key>
+			<string>com.coresystems.driver.DirectHW</string>
+			<key>IOClass</key>
+			<string>DirectHWService</string>
+			<key>IOMatchCategory</key>
+			<string>DirectHWService</string>
+			<key>IOProviderClass</key>
+			<string>IOResources</string>
+			<key>IOResourceMatch</key>
+			<string>IOKit</string>
+			<key>IOUserClientClass</key>
+			<string>DirectHWUserClient</string>
+		</dict>
+	</dict>
+	<key>OSBundleLibraries</key>
+	<dict>
+		<key>com.apple.kpi.mach</key>
+		<string>8.0.0</string>
+		<key>com.apple.kpi.iokit</key>
+		<string>8.0</string>
+		<key>com.apple.kpi.libkern</key>
+		<string>8.0</string>
+		<key>com.apple.kpi.unsupported</key>
+		<string>8.0</string>
+	</dict>
+</dict>
+</plist>

Added: trunk/macosx/DirectHW/DirectHW-i386-only.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/DirectHW-i386-only.diff	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,20 @@
+Index: DirectHW.xcodeproj/project.pbxproj
+===================================================================
+--- DirectHW.xcodeproj/project.pbxproj	(revision 110)
++++ DirectHW.xcodeproj/project.pbxproj	(working copy)
+@@ -202,7 +202,6 @@
+ 			isa = XCBuildConfiguration;
+ 			buildSettings = {
+ 				ARCHS = (
+-					x86_64,
+ 					i386,
+ 				);
+ 				COPY_PHASE_STRIP = NO;
+@@ -228,7 +227,6 @@
+ 			isa = XCBuildConfiguration;
+ 			buildSettings = {
+ 				ARCHS = (
+-					x86_64,
+ 					i386,
+ 				);
+ 				COPY_PHASE_STRIP = YES;

Added: trunk/macosx/DirectHW/DirectHW.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/DirectHW.c	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,388 @@
+/*
+ * DirectHW.c - userspace part for DirectHW
+ *
+ * Copyright © 2008-2010 coresystems GmbH <info at coresystems.de>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <AvailabilityMacros.h>
+#include <IOKit/IOKitLib.h>
+#include <ApplicationServices/ApplicationServices.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <unistd.h>
+#include <errno.h>
+#include "DirectHW.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED	((void *)-1)
+#endif
+
+/* define WANT_OLD_API for support of OSX 10.4 and earlier */
+#undef WANT_OLD_API
+
+/* define DEBUG to print Framework debugging information */
+#undef DEBUG
+
+#define     err_get_system(err) (((err)>>26)&0x3f)
+#define     err_get_sub(err)    (((err)>>14)&0xfff)
+#define     err_get_code(err)   ((err)&0x3fff)
+
+enum {
+	kReadIO,
+	kWriteIO,
+	kPrepareMap,
+	kReadMSR,
+	kWriteMSR,
+	kNumberOfMethods
+};
+
+typedef struct {
+	UInt32 offset;
+	UInt32 width;
+	UInt32 data;
+} iomem_t;
+
+typedef struct {
+	UInt64 addr;
+	UInt64 size;
+} map_t;
+
+typedef struct {
+	UInt32 core;
+	UInt32 index;
+	UInt32 hi;
+	UInt32 lo;
+} msrcmd_t;
+
+static io_connect_t connect = -1;
+static io_service_t iokit_uc;
+
+static int darwin_init(void)
+{
+	kern_return_t err;
+
+	/* Note the actual security happens in the kernel module.
+	 * This check is just candy to be able to get nicer output
+	 */
+	if (getuid() != 0) {
+		/* Fun's reserved for root */
+		errno = EPERM;
+		return -1;
+	}
+
+	/* Get the DirectHW driver service */
+	iokit_uc = IOServiceGetMatchingService(kIOMasterPortDefault,
+					IOServiceMatching("DirectHWService"));
+
+	if (!iokit_uc) {
+		printf("DirectHW.kext not loaded.\n");
+		errno = ENOSYS;
+		return -1;
+	}
+
+	/* Create an instance */
+	err = IOServiceOpen(iokit_uc, mach_task_self(), 0, &connect);
+
+	/* Should not go further if error with service open */
+	if (err != KERN_SUCCESS) {
+		printf("Could not create DirectHW instance.\n");
+		errno = ENOSYS;
+		return -1;
+	}
+
+	return 0;
+}
+
+static void darwin_cleanup(void)
+{
+	IOServiceClose(connect);
+}
+
+static int darwin_ioread(int pos, unsigned char * buf, int len)
+{
+
+	kern_return_t err;
+	size_t dataInLen = sizeof(iomem_t);
+	size_t dataOutLen = sizeof(iomem_t);
+	iomem_t in;
+	iomem_t out;
+	UInt32 tmpdata;
+
+	in.width = len;
+	in.offset = pos;
+
+	if (len > 4)
+		return 1;
+
+#if !defined(__LP64__) && defined(WANT_OLD_API)
+	/* Check if OSX 10.5 API is available */
+	if (IOConnectCallStructMethod != NULL) {
+#endif
+		err = IOConnectCallStructMethod(connect, kReadIO, &in, dataInLen, &out, &dataOutLen);
+#if !defined(__LP64__) && defined(WANT_OLD_API)
+	} else {
+		/* Use old API */
+		err = IOConnectMethodStructureIStructureO(connect, kReadIO, dataInLen, &dataOutLen, &in, &out);
+	}
+#endif
+
+	if (err != KERN_SUCCESS)
+		return 1;
+
+	tmpdata = out.data;
+
+	switch (len) {
+	case 1:
+		memcpy(buf, &tmpdata, 1);
+		break;
+	case 2:
+		memcpy(buf, &tmpdata, 2);
+		break;
+	case 4:
+		memcpy(buf, &tmpdata, 4);
+		break;
+	}
+
+	return 0;
+}
+
+static int darwin_iowrite(int pos, unsigned char * buf, int len)
+{
+	kern_return_t err;
+	size_t dataInLen = sizeof(iomem_t);
+	size_t dataOutLen = sizeof(iomem_t);
+	iomem_t in;
+	iomem_t out;
+
+	in.width = len;
+	in.offset = pos;
+	memcpy(&in.data, buf, len);
+
+	if (len > 4)
+		return 1;
+
+#if !defined(__LP64__) && defined(WANT_OLD_API)
+	/* Check if OSX 10.5 API is available */
+	if (IOConnectCallStructMethod != NULL) {
+#endif
+		err = IOConnectCallStructMethod(connect, kWriteIO, &in, dataInLen, &out, &dataOutLen);
+#if !defined(__LP64__) && defined(WANT_OLD_API)
+	} else {
+		/* Use old API */
+		err = IOConnectMethodStructureIStructureO(connect, kWriteIO, dataInLen, &dataOutLen, &in, &out);
+	}
+#endif
+
+	if (err != KERN_SUCCESS)
+		return 1;
+
+	return 0;
+}
+
+
+/* Compatibility interface */
+
+unsigned char inb(unsigned short addr)
+{
+	unsigned char ret;
+	darwin_ioread(addr, &ret, 1);
+	return ret;
+}
+
+unsigned short inw(unsigned short addr)
+{
+	unsigned short ret;
+	darwin_ioread(addr, (unsigned char *)&ret, 2);
+	return ret;
+}
+
+unsigned int inl(unsigned short addr)
+{
+	unsigned int ret;
+	darwin_ioread(addr, (unsigned char *)&ret, 4);
+	return ret;
+}
+
+void outb(unsigned char val, unsigned short addr)
+{
+	darwin_iowrite(addr, &val, 1);
+}
+
+void outw(unsigned short val, unsigned short addr)
+{
+	darwin_iowrite(addr, (unsigned char *)&val, 2);
+}
+
+void outl(unsigned int val, unsigned short addr)
+{
+	darwin_iowrite(addr, (unsigned char *)&val, 4);
+}
+
+int iopl(int level __attribute__((unused)))
+{
+	atexit(darwin_cleanup);
+	return darwin_init();
+}
+
+void *map_physical(uint64_t phys_addr, size_t len)
+{
+	kern_return_t err;
+#if __LP64__
+	mach_vm_address_t addr;
+	mach_vm_size_t size;
+#else
+        vm_address_t addr;
+        vm_size_t size;
+#endif
+	size_t dataInLen = sizeof(map_t);
+	size_t dataOutLen = sizeof(map_t);
+	map_t in, out;
+
+	in.addr = phys_addr;
+	in.size = len;
+
+#ifdef DEBUG
+	printf("map_phys: phys %08lx, %08x\n", phys_addr, len);
+#endif
+
+#if !defined(__LP64__) && defined(WANT_OLD_API)
+	/* Check if OSX 10.5 API is available */
+	if (IOConnectCallStructMethod != NULL) {
+#endif
+		err = IOConnectCallStructMethod(connect, kPrepareMap, &in, dataInLen, &out, &dataOutLen);
+#if !defined(__LP64__) && defined(WANT_OLD_API)
+	} else {
+		/* Use old API */
+		err = IOConnectMethodStructureIStructureO(connect, kPrepareMap, dataInLen, &dataOutLen, &in, &out);
+	}
+#endif
+
+	if (err != KERN_SUCCESS) {
+		printf("\nError(kPrepareMap): system 0x%x subsystem 0x%x code 0x%x ",
+				err_get_system(err), err_get_sub(err), err_get_code(err));
+
+		printf("physical 0x%08lx[0x%x]\n", phys_addr, (unsigned int)len);
+
+		switch (err_get_code(err)) {
+		case 0x2c2: printf("Invalid argument.\n"); errno = EINVAL; break;
+		case 0x2cd: printf("Device not open.\n"); errno = ENOENT; break;
+		}
+
+		return MAP_FAILED;
+	}
+
+        err = IOConnectMapMemory(connect, 0, mach_task_self(),
+			&addr, &size, kIOMapAnywhere | kIOMapInhibitCache);
+
+	/* Now this is odd; The above connect seems to be unfinished at the
+	 * time the function returns. So wait a little bit, or the calling
+	 * program will just segfault. Bummer. Who knows a better solution?
+	 */
+	usleep(1000);
+
+	if (err != KERN_SUCCESS) {
+		printf("\nError(IOConnectMapMemory): system 0x%x subsystem 0x%x code 0x%x ",
+				err_get_system(err), err_get_sub(err), err_get_code(err));
+
+		printf("physical 0x%08lx[0x%x]\n", phys_addr, (unsigned int)len);
+
+		switch (err_get_code(err)) {
+		case 0x2c2: printf("Invalid argument.\n"); errno = EINVAL; break;
+		case 0x2cd: printf("Device not open.\n"); errno = ENOENT; break;
+		}
+
+		return MAP_FAILED;
+	}
+
+#ifdef DEBUG
+	printf("map_phys: virt %08x, %08x\n", addr, size);
+#endif
+
+        return (void *)addr;
+}
+
+void unmap_physical(void *virt_addr __attribute__((unused)), size_t len __attribute__((unused)))
+{
+	// Nut'n Honey
+}
+
+static int current_logical_cpu = 0;
+
+msr_t rdmsr(int addr)
+{
+	kern_return_t err;
+	size_t dataInLen = sizeof(msrcmd_t);
+	size_t dataOutLen = sizeof(msrcmd_t);
+	msrcmd_t in, out;
+	msr_t ret = { INVALID_MSR_HI, INVALID_MSR_LO };
+
+	in.core = current_logical_cpu;
+	in.index = addr;
+
+#if !defined(__LP64__) && defined(WANT_OLD_API)
+	/* Check if OSX 10.5 API is available */
+	if (IOConnectCallStructMethod != NULL) {
+#endif
+		err = IOConnectCallStructMethod(connect, kReadMSR, &in, dataInLen, &out, &dataOutLen);
+#if !defined(__LP64__) && defined(WANT_OLD_API)
+	} else {
+		/* Use old API */
+		err = IOConnectMethodStructureIStructureO(connect, kReadMSR, dataInLen, &dataOutLen, &in, &out);
+	}
+#endif
+
+	if (err != KERN_SUCCESS)
+		return ret;
+
+	ret.lo = out.lo;
+	ret.hi = out.hi;
+
+	return ret;
+}
+
+int wrmsr(int addr, msr_t msr)
+{
+	kern_return_t err;
+	size_t dataInLen = sizeof(msrcmd_t);
+	size_t dataOutLen = sizeof(msrcmd_t);
+	msrcmd_t in, out;
+
+	in.core = current_logical_cpu;
+	in.index = addr;
+	in.lo = msr.lo;
+	in.hi = msr.hi;
+
+#if !defined(__LP64__) && defined(WANT_OLD_API)
+	/* Check if OSX 10.5 API is available */
+	if (IOConnectCallStructMethod != NULL) {
+#endif
+		err = IOConnectCallStructMethod(connect, kWriteMSR, &in, dataInLen, &out, &dataOutLen);
+#if !defined(__LP64__) && defined(WANT_OLD_API)
+	} else {
+		/* Use old API */
+		err = IOConnectMethodStructureIStructureO(connect, kWriteMSR, dataInLen, &dataOutLen, &in, &out);
+	}
+#endif
+
+	if (err != KERN_SUCCESS)
+		return 1;
+
+	return 0;
+}
+
+int logical_cpu_select(int cpu)
+{
+	current_logical_cpu = cpu;
+}
+

Added: trunk/macosx/DirectHW/DirectHW.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/DirectHW.cpp	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,395 @@
+/* DirectHW - Kernel extension to pass through IO commands to user space
+ *
+ * Copyright © 2008-2010 coresystems GmbH <info at coresystems.de>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <IOKit/IOLib.h>
+#include <IOKit/IOService.h>
+#include <IOKit/IOUserClient.h>
+#include <IOKit/IOKitKeys.h>
+#include <IOKit/IOMemoryDescriptor.h>
+#include <architecture/i386/pio.h>
+
+#include "DirectHW.hpp"
+
+#undef DEBUG_KEXT
+//#define DEBUG_KEXT
+
+#define super IOService
+
+OSDefineMetaClassAndStructors(DirectHWService, IOService)
+
+bool DirectHWService::start(IOService * provider)
+{
+        IOLog("DirectHW: Driver v%s (compiled on %s) loaded. "
+		"Visit http://www.coresystems.de/ for more information.\n",
+			DIRECTHW_VERSION, __DATE__);
+
+	if (super::start(provider)) {
+		registerService();
+		return true;
+	}
+
+	return false;
+}
+
+#undef super
+#define super IOUserClient
+
+OSDefineMetaClassAndStructors(DirectHWUserClient, IOUserClient)
+
+const IOExternalMethod DirectHWUserClient::fMethods[kNumberOfMethods] = {
+	{0, (IOMethod) & DirectHWUserClient::ReadIO, kIOUCStructIStructO, sizeof(iomem_t), sizeof(iomem_t)},
+	{0, (IOMethod) & DirectHWUserClient::WriteIO, kIOUCStructIStructO, sizeof(iomem_t), sizeof(iomem_t)},
+	{0, (IOMethod) & DirectHWUserClient::PrepareMap, kIOUCStructIStructO, sizeof(map_t), sizeof(map_t)},
+	{0, (IOMethod) & DirectHWUserClient::ReadMSR, kIOUCStructIStructO, sizeof(msrcmd_t), sizeof(msrcmd_t)},
+	{0, (IOMethod) & DirectHWUserClient::WriteMSR, kIOUCStructIStructO, sizeof(msrcmd_t), sizeof(msrcmd_t)}
+};
+
+bool DirectHWUserClient::initWithTask(task_t task, void *securityID, UInt32 type)
+{
+	bool ret;
+
+	ret = super::initWithTask(task, securityID, type);
+
+#ifdef DEBUG_KEXT
+	IOLog("DirectHW: initWithTask(%p, %p, %08lx)\n", (void *)task, securityID, type);
+#endif
+        if (!ret) {
+		IOLog("DirectHW: initWithTask failed.\n");
+		return false;
+	}
+
+	fTask = task;
+
+	return true;
+}
+
+IOExternalMethod *DirectHWUserClient::getTargetAndMethodForIndex(IOService ** target, UInt32 index)
+{
+	if (index < (UInt32) kNumberOfMethods) {
+		if (fMethods[index].object == (IOService *) 0)
+			*target = this;
+
+		return (IOExternalMethod *) & fMethods[index];
+	} else {
+		*target = NULL;
+		return NULL;
+	}
+}
+
+bool DirectHWUserClient::start(IOService * provider)
+{
+	bool success;
+
+#ifdef DEBUG_KEXT
+	IOLog("DirectHW: Starting DirectHWUserClient\n");
+#endif
+
+	fProvider = OSDynamicCast(DirectHWService, provider);
+	success = (fProvider != NULL);
+
+	if (kIOReturnSuccess != clientHasPrivilege(current_task(),kIOClientPrivilegeAdministrator)) {
+		IOLog("DirectHW: Need to be administrator.\n");
+		success = false;
+	}
+
+	if (success) {
+		success = super::start(provider);
+#ifdef DEBUG_KEXT
+		IOLog("DirectHW: Client successfully started.\n");
+#endif
+	} else {
+		IOLog("DirectHW: Could not start client.\n");
+	}
+	return success;
+}
+
+void DirectHWUserClient::stop(IOService *provider)
+{
+#ifdef DEBUG_KEXT
+	IOLog("DirectHW: Stopping client.\n");
+#endif
+	super::stop(provider);
+}
+
+IOReturn DirectHWUserClient::clientClose(void)
+{
+	bool success = terminate();
+	if (!success) {
+		IOLog("DirectHW: Client NOT successfully closed.\n");
+	} else {
+#ifdef DEBUG_KEXT
+		IOLog("DirectHW: Client successfully closed.\n");
+#endif
+	}
+
+	return kIOReturnSuccess;
+}
+
+IOReturn
+DirectHWUserClient::ReadIO(iomem_t * inStruct, iomem_t * outStruct,
+				IOByteCount inStructSize,
+				IOByteCount * outStructSize)
+{
+
+	if (fProvider == NULL || isInactive()) {
+		return kIOReturnNotAttached;
+	}
+	 
+	switch (inStruct->width) {
+	case 1:
+		outStruct->data = inb(inStruct->offset);
+		break;
+	case 2:
+		outStruct->data = inw(inStruct->offset);
+		break;
+	case 4:
+		outStruct->data = inl(inStruct->offset);
+		break;
+	default:
+		IOLog("DirectHW: Invalid read attempt %d bytes at IO address %x\n",
+		      (int)inStruct->width, (unsigned int)inStruct->offset);
+		break;
+	}
+
+#ifdef DEBUG_KEXT
+	IOLog("DirectHW: Read %d bytes at IO address %x (result=%x)\n",
+		      inStruct->width, inStruct->offset, outStruct->data);
+#endif
+
+
+	*outStructSize = sizeof(iomem_t);
+
+	return kIOReturnSuccess;
+}
+
+
+IOReturn
+DirectHWUserClient::WriteIO(iomem_t * inStruct, iomem_t * outStruct,
+				 IOByteCount inStructSize,
+				 IOByteCount * outStructSize)
+{
+	if (fProvider == NULL || isInactive()) {
+		return kIOReturnNotAttached;
+	} 
+	
+#ifdef DEBUG_KEXT
+	IOLog("DirectHW: Write %d bytes at IO address %x (value=%x)\n",
+		      inStruct->width, inStruct->offset, inStruct->data);
+#endif
+	
+	switch (inStruct->width) {
+	case 1:
+		outb(inStruct->offset, inStruct->data);
+		break;
+	case 2:
+		outw(inStruct->offset, inStruct->data);
+		break;
+	case 4:
+		outl(inStruct->offset, inStruct->data);
+		break;
+	default:
+		IOLog("DirectHW: Invalid write attempt %d bytes at IO address %x\n",
+		      (int)inStruct->width, (unsigned int)inStruct->offset);
+	}
+
+	*outStructSize = sizeof(iomem_t);
+
+	return kIOReturnSuccess;
+}
+
+
+IOReturn
+DirectHWUserClient::PrepareMap(map_t * inStruct, map_t * outStruct,
+				IOByteCount inStructSize,
+				IOByteCount * outStructSize)
+{
+	if (fProvider == NULL || isInactive()) {
+		return kIOReturnNotAttached;
+	} 
+
+	if(LastMapAddr || LastMapSize)
+		return kIOReturnNotOpen;
+
+	LastMapAddr = inStruct->addr;
+	LastMapSize = inStruct->size;
+
+#ifdef DEBUG_KEXT
+	IOLog("DirectHW: PrepareMap 0x%08x[0x%x]\n", LastMapAddr, LastMapSize);
+#endif
+
+	*outStructSize = sizeof(map_t);
+
+	return kIOReturnSuccess;
+}
+
+inline void
+DirectHWUserClient::cpuid(uint32_t op1, uint32_t op2, uint32_t *data)
+{
+	asm("cpuid"
+		: "=a" (data[0]),
+		"=b" (data[1]),
+		"=c" (data[2]),
+		"=d" (data[3])
+		: "a"(op1), "c"(op2));
+}
+
+void
+DirectHWUserClient::MSRHelperFunction(void *data)
+{
+	MSRHelper * MSRData = (MSRHelper *)data;
+	msrcmd_t * inStruct = MSRData->in;
+	msrcmd_t * outStruct = MSRData->out;
+
+	outStruct->core = -1;
+	outStruct->lo = INVALID_MSR_LO;
+	outStruct->hi = INVALID_MSR_HI;
+
+	uint32_t cpuiddata[4];
+
+	cpuid(1, 0, cpuiddata);
+	bool have_ht = ((cpuiddata[3] & (1 << 28)) != 0);
+	uint32_t core_id = cpuiddata[1] >> 24;
+
+	cpuid(11, 0, cpuiddata);
+	uint32_t smt_mask = ~((-1) << (cpuiddata[0] &0x1f));
+
+	// TODO: What we want is this:
+	// if (inStruct->core != cpu_to_core(cpu_number()))
+	//	return;
+
+	if ((core_id & smt_mask) != core_id)
+		return; // It's a HT thread
+
+	if (inStruct->core != cpu_number())
+		return;
+
+	IOLog("DirectHW: ReadMSRHelper %d %d %x \n", inStruct->core,
+		cpu_number(), smt_mask);
+
+	if (MSRData->Read) {
+		asm volatile (
+			"rdmsr"
+			: "=a" (outStruct->lo), "=d" (outStruct->hi)
+			: "c" (inStruct->index)
+		);
+	} else {
+		asm volatile (
+			"wrmsr"
+			: /* No outputs */
+			: "c" (inStruct->index), "a" (inStruct->lo), "d" (inStruct->hi)
+		);
+	}
+
+	outStruct->index = inStruct->index;
+	outStruct->core = inStruct->core;
+}
+
+IOReturn
+DirectHWUserClient::ReadMSR(msrcmd_t * inStruct, msrcmd_t * outStruct,
+				IOByteCount inStructSize,
+				IOByteCount * outStructSize)
+{
+	if (fProvider == NULL || isInactive()) {
+		return kIOReturnNotAttached;
+	} 
+
+	MSRHelper MSRData = { inStruct, outStruct, true };
+	mp_rendezvous(NULL, (void (*)(void *))MSRHelperFunction, NULL,
+			(void *)&MSRData);
+
+	*outStructSize = sizeof(msrcmd_t);
+
+	if (outStruct->core != inStruct->core)
+		return kIOReturnIOError;
+
+	IOLog("DirectHW: ReadMSR(0x%08x) = 0x%08x:0x%08x\n",
+			(unsigned int)inStruct->index,
+			(unsigned int)outStruct->hi,
+			(unsigned int)outStruct->lo);
+
+	return kIOReturnSuccess;
+}
+
+IOReturn
+DirectHWUserClient::WriteMSR(msrcmd_t * inStruct, msrcmd_t * outStruct,
+				IOByteCount inStructSize,
+				IOByteCount * outStructSize)
+{
+	if (fProvider == NULL || isInactive()) {
+		return kIOReturnNotAttached;
+	} 
+
+	IOLog("DirectHW: WriteMSR(0x%08x) = 0x%08x:0x%08x\n",
+			(unsigned int)inStruct->index,
+			(unsigned int)inStruct->hi,
+			(unsigned int)inStruct->lo);
+
+	MSRHelper MSRData = { inStruct, outStruct, false };
+	mp_rendezvous(NULL, (void (*)(void *))MSRHelperFunction, NULL,
+			(void *)&MSRData);
+
+	*outStructSize = sizeof(msrcmd_t);
+
+	if (outStruct->core != inStruct->core)
+		return kIOReturnIOError;
+
+	return kIOReturnSuccess;
+}
+
+IOReturn DirectHWUserClient::clientMemoryForType(UInt32 type, UInt32 *flags, IOMemoryDescriptor **memory)
+{
+	IOMemoryDescriptor *newmemory;
+
+#ifdef DEBUG_KEXT
+	IOLog("DirectHW: clientMemoryForType(%x, %p, %p)\n", type, flags, memory);
+#endif
+	if (type != 0) {
+		IOLog("DirectHW: Unknown mapping type %x.\n", (unsigned int)type);
+		return kIOReturnUnsupported;
+	}
+
+	if ((LastMapAddr == 0) && (LastMapSize == 0)) {
+		IOLog("DirectHW: No PrepareMap called.\n");
+		return kIOReturnNotAttached;
+	}
+
+#ifdef DEBUG_KEXT
+	IOLog("DirectHW: Mapping physical 0x%08x[0x%x]\n",
+			LastMapAddr, LastMapSize);
+#endif
+
+	newmemory = IOMemoryDescriptor::withPhysicalAddress(LastMapAddr, LastMapSize, kIODirectionIn);
+	
+	/* Reset mapping to zero */
+	LastMapAddr = 0;
+	LastMapSize = 0;
+
+	if (newmemory == 0) {
+		IOLog("DirectHW: Could not map memory!\n");
+		return kIOReturnNotOpen;
+	}
+
+	newmemory->retain();
+	*memory = newmemory;
+
+#ifdef DEBUG_KEXT
+	IOLog("DirectHW: Mapping succeeded.\n");
+#endif
+
+	return kIOReturnSuccess;
+}
+

Added: trunk/macosx/DirectHW/DirectHW.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/DirectHW.h	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,45 @@
+/*
+ * DirectHW.h - userspace part for DirectHW
+ *
+ * Copyright © 2008-2010 coresystems GmbH <info at coresystems.de>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef __DIRECTHW_H
+#define __DIRECTHW_H
+
+#include <stdint.h>
+
+int iopl(int unused);
+
+unsigned char inb(unsigned short addr);
+unsigned short inw(unsigned short addr);
+unsigned int inl(unsigned short addr);
+
+void outb(unsigned char val, unsigned short addr);
+void outw(unsigned short val, unsigned short addr);
+void outl(unsigned int val, unsigned short addr);
+
+void *map_physical(uint64_t phys_addr, size_t len);
+void unmap_physical(void *virt_addr, size_t len);
+
+typedef struct { uint32_t hi, lo; } msr_t;
+msr_t rdmsr(int addr);
+int wrmsr(int addr, msr_t msr);
+int logical_cpu_select(int cpu);
+
+#define INVALID_MSR_LO 0x63744857
+#define INVALID_MSR_HI 0x44697265
+
+#endif

Added: trunk/macosx/DirectHW/DirectHW.hpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/DirectHW.hpp	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,127 @@
+/* DirectHW - Kernel extension to pass through IO commands to user space
+ *
+ * Copyright © 2008-2010 coresystems GmbH <info at coresystems.de>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define DIRECTHW_VERSION "1.3"
+#define DIRECTHW_VERNUM 0x00100300
+
+/* */
+
+class DirectHWService:public IOService {
+	OSDeclareDefaultStructors(DirectHWService)
+
+      public:
+	virtual bool start(IOService * provider);
+
+};
+
+
+/* */
+
+class DirectHWService;
+
+class DirectHWUserClient:public IOUserClient {
+	OSDeclareDefaultStructors(DirectHWUserClient)
+
+	enum {
+		kReadIO,
+		kWriteIO,
+		kPrepareMap,
+		kReadMSR,
+		kWriteMSR,
+		kNumberOfMethods
+	};
+
+	typedef struct {
+		UInt32 offset;
+		UInt32 width;
+		UInt32 data;
+	} iomem_t;
+
+	typedef struct {
+		UInt64 addr;
+		UInt64 size;
+	} map_t;
+
+	typedef struct {
+		UInt32 core;
+		UInt32 index;
+		UInt32 hi;
+		UInt32 lo;
+	} msrcmd_t;
+
+      public:
+	virtual bool initWithTask(task_t task, void *securityID, UInt32 type);
+
+	virtual bool start(IOService * provider);
+	virtual void stop(IOService * provider);
+
+	virtual IOReturn clientMemoryForType(UInt32 type, UInt32 *flags, IOMemoryDescriptor **memory);
+
+	virtual IOReturn clientClose(void);
+
+      protected:
+	DirectHWService * fProvider;
+
+	static const IOExternalMethod fMethods[kNumberOfMethods];
+
+	virtual IOExternalMethod * getTargetAndMethodForIndex(IOService ** target, UInt32 index);
+
+	virtual IOReturn ReadIO(iomem_t * inStruct, iomem_t * outStruct,
+				 IOByteCount inStructSize,
+				 IOByteCount * outStructSize);
+
+	virtual IOReturn WriteIO(iomem_t * inStruct, iomem_t * outStruct,
+				  IOByteCount inStructSize,
+				  IOByteCount * outStructSize);
+
+	virtual IOReturn PrepareMap(map_t * inStruct, map_t * outStruct,
+				  IOByteCount inStructSize,
+				  IOByteCount * outStructSize);
+
+	virtual IOReturn ReadMSR(msrcmd_t * inStruct, msrcmd_t * outStruct,
+				  IOByteCount inStructSize,
+				  IOByteCount * outStructSize);
+
+	virtual IOReturn WriteMSR(msrcmd_t * inStruct, msrcmd_t * outStruct,
+				  IOByteCount inStructSize,
+				  IOByteCount * outStructSize);
+
+      private:
+	task_t fTask;
+	UInt64 LastMapAddr, LastMapSize;
+
+	static void MSRHelperFunction(void *data);
+	typedef struct { msrcmd_t *in, *out; bool Read; } MSRHelper;
+	static inline void cpuid(uint32_t op1, uint32_t op2, uint32_t *data);
+};
+
+extern "C" {
+
+/* from sys/osfmk/i386/mp.c */
+
+extern void mp_rendezvous(
+	void (*setup_func)(void *),
+	void (*action_func)(void *),
+	void (*teardown_func)(void *),
+	void *arg);
+
+extern int cpu_number(void);
+
+}
+
+#define INVALID_MSR_LO 0x63744857
+#define INVALID_MSR_HI 0x44697265

Added: trunk/macosx/DirectHW/DirectHW.pmdoc/01directhw-contents.xml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/DirectHW.pmdoc/01directhw-contents.xml	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,85 @@
+<pkg-contents spec="1.12">
+    <f n="DirectHW" o="root" g="wheel" p="16877" x="true" pt="build/DirectHW" m="true" t="file">
+        <f n="System" o="root" g="wheel" p="16877">
+            <f n="Library" o="root" g="wheel" p="16877">
+                <f n="Extensions" o="root" g="wheel" p="16877">
+                    <f n="DirectHW.kext" o="root" g="wheel" p="16877">
+                        <f n="Contents" o="root" g="wheel" p="16877">
+                            <f n="Info.plist" o="root" g="wheel" p="33188">
+                                <mod>mode</mod>
+                            </f>
+                            <f n="MacOS" o="root" g="wheel" p="16877">
+                                <f n="DirectHW" o="root" g="wheel" p="33188">
+                                    <mod>mode</mod>
+                                </f>
+                                <mod>mode</mod>
+                            </f>
+                            <mod>mode</mod>
+                        </f>
+                        <mod>mode</mod>
+                    </f>
+                </f>
+                <f n="Frameworks" o="root" g="wheel" p="16877">
+                    <f n="DirectHW.framework" o="root" g="wheel" p="16877">
+                        <f n="DirectHW" o="root" g="wheel" p="33261">
+                            <mod>mode</mod>
+                        </f>
+                        <f n="Headers" o="root" g="wheel" p="16877">
+                            <f n="DirectHW.h" o="root" g="wheel" p="33188">
+                                <mod>mode</mod>
+                            </f>
+                            <mod>mode</mod>
+                        </f>
+                        <f n="Resources" o="root" g="wheel" p="16877">
+                            <f n="Info.plist" o="root" g="wheel" p="33188">
+                                <mod>mode</mod>
+                            </f>
+                            <mod>mode</mod>
+                        </f>
+                        <f n="Versions" o="root" g="wheel" p="16877">
+                            <f n="A" o="root" g="wheel" p="16877">
+                                <f n="DirectHW" o="root" g="wheel" p="33261">
+                                    <mod>mode</mod>
+                                </f>
+                                <f n="Headers" o="root" g="wheel" p="16877">
+                                    <f n="DirectHW.h" o="root" g="wheel" p="33188">
+                                        <mod>mode</mod>
+                                    </f>
+                                    <mod>mode</mod>
+                                </f>
+                                <f n="Resources" o="root" g="wheel" p="16877">
+                                    <f n="Info.plist" o="root" g="wheel" p="33188">
+                                        <mod>mode</mod>
+                                    </f>
+                                    <mod>mode</mod>
+                                </f>
+                                <mod>mode</mod>
+                            </f>
+                            <f n="Current" o="root" g="wheel" p="16877">
+                                <f n="DirectHW" o="root" g="wheel" p="33261">
+                                    <mod>mode</mod>
+                                </f>
+                                <f n="Headers" o="root" g="wheel" p="16877">
+                                    <f n="DirectHW.h" o="root" g="wheel" p="33188">
+                                        <mod>mode</mod>
+                                    </f>
+                                    <mod>mode</mod>
+                                </f>
+                                <f n="Resources" o="root" g="wheel" p="16877">
+                                    <f n="Info.plist" o="root" g="wheel" p="33188">
+                                        <mod>mode</mod>
+                                    </f>
+                                    <mod>mode</mod>
+                                </f>
+                                <mod>mode</mod>
+                            </f>
+                            <mod>mode</mod>
+                        </f>
+                        <mod>mode</mod>
+                    </f>
+                </f>
+            </f>
+        </f>
+        <mod>group</mod>
+    </f>
+</pkg-contents>

Added: trunk/macosx/DirectHW/DirectHW.pmdoc/01directhw.xml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/DirectHW.pmdoc/01directhw.xml	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,29 @@
+<pkgref spec="1.12" uuid="9EEC00E4-527A-400E-A366-6F0D0ABB0D19">
+    <config>
+        <identifier>com.coresystems.directhw.DirectHW.pkg</identifier>
+        <version>1.0</version>
+        <description></description>
+        <post-install type="none"/>
+        <requireAuthorization/>
+        <installFrom relative="true" mod="true">build/DirectHW</installFrom>
+        <installTo>/</installTo>
+        <flags>
+            <followSymbolicLinks/>
+        </flags>
+        <packageStore type="internal"></packageStore>
+        <mod>installFrom.isRelativeType</mod>
+        <mod>installFrom.path</mod>
+        <mod>parent</mod>
+        <mod>installTo</mod>
+    </config>
+    <contents>
+        <file-list>01directhw-contents.xml</file-list>
+        <component id="com.coresystems.driver.DirectHW" path="build/DirectHW/System/Library/Extensions/DirectHW.kext" version="1.0"/>
+        <component id="com.coresystems.DirectHW" path="build/DirectHW/System/Library/Frameworks/DirectHW.framework" version="1.0"/>
+        <filter>/CVS$</filter>
+        <filter>/\.svn$</filter>
+        <filter>/\.cvsignore$</filter>
+        <filter>/\.cvspass$</filter>
+        <filter>/\.DS_Store$</filter>
+    </contents>
+</pkgref>

Added: trunk/macosx/DirectHW/DirectHW.pmdoc/index.xml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/DirectHW.pmdoc/index.xml	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,58 @@
+<pkmkdoc spec="1.12">
+    <properties>
+        <title>DirectHW</title>
+        <build>DirectHW.pkg</build>
+        <organization>com.coresystems</organization>
+        <userSees ui="easy"/>
+        <min-target os="3"/>
+        <domain system="true"/>
+    </properties>
+    <distribution>
+        <versions min-spec="1.000000"/>
+        <scripts>
+	    function CheckHardwareCompatibility() {
+                if (system.sysctl('hw.machine') == 'i386') {
+                    return true;
+                }
+            
+                if (system.sysctl('hw.machine') == 'x86_64') {
+                    return true;
+                }
+            
+                return false;
+            }
+        </scripts>
+    </distribution>
+    <contents>
+        <choice title="DirectHW" id="choice2" starts_selected="true" starts_enabled="true" starts_hidden="false">
+            <pkgref id="com.coresystems.directhw.DirectHW.pkg"/>
+        </choice>
+    </contents>
+    <resources bg-scale="none" bg-align="bottomleft">
+        <locale lang="en">
+            <resource relative="true" mod="true" type="background">installer.png</resource>
+            <resource relative="true" mod="true" type="license">Copying.rtf</resource>
+            <resource relative="true" mod="true" type="welcome">Welcome.rtf</resource>
+        </locale>
+    </resources>
+    <requirements>
+        <requirement id="java" operator="eq" value="true">
+            <argument>CheckHardwareCompatibility()</argument>
+            <message-title>Unsupported Architecture</message-title>
+            <message>DirectHW is only supported on Intel® based Apple systems.</message>
+        </requirement>
+    </requirements>
+    <flags/>
+    <postinstall>
+        <action id="com.apple.packagemaker.actions.loadkext">
+            <value>com.coresystems.driver.DirectHW</value>
+	    <type>component</type>
+        </action>
+    </postinstall>
+    <item type="file">01directhw.xml</item>
+    <mod>properties.title</mod>
+    <mod>postinstallActions.actions</mod>
+    <mod>description</mod>
+    <mod>properties.anywhereDomain</mod>
+    <mod>properties.systemDomain</mod>
+</pkmkdoc>

Added: trunk/macosx/DirectHW/DirectHW.xcodeproj/project.pbxproj
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/DirectHW.xcodeproj/project.pbxproj	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,336 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 44;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		5D9932DD0D0F97EF00760F43 /* DirectHW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D9932B30D0F95DD00760F43 /* DirectHW.cpp */; };
+		FDC4F2BC0E923E0C0006B2A5 /* DirectHW.h in Headers */ = {isa = PBXBuildFile; fileRef = FD12A6710E9235DB004BBD7B /* DirectHW.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		FDC4F2BD0E923E100006B2A5 /* DirectHW.c in Sources */ = {isa = PBXBuildFile; fileRef = FD12A6700E9235DB004BBD7B /* DirectHW.c */; };
+		FDC4F2BF0E923E2B0006B2A5 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDC4F2BE0E923E2B0006B2A5 /* IOKit.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+		5D9932B30D0F95DD00760F43 /* DirectHW.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectHW.cpp; sourceTree = "<group>"; };
+		5D9932B40D0F95DD00760F43 /* DirectHW.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectHW.hpp; sourceTree = "<group>"; };
+		5D9932D60D0F97D000760F43 /* DirectHW.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DirectHW.kext; sourceTree = BUILT_PRODUCTS_DIR; };
+		5D9932D70D0F97D000760F43 /* DirectHW-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DirectHW-Info.plist"; sourceTree = "<group>"; };
+		FD12A6700E9235DB004BBD7B /* DirectHW.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DirectHW.c; sourceTree = "<group>"; };
+		FD12A6710E9235DB004BBD7B /* DirectHW.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectHW.h; sourceTree = "<group>"; };
+		FDC4F1CB0E923CB30006B2A5 /* DirectHW-Framework-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DirectHW-Framework-Info.plist"; sourceTree = "<group>"; };
+		FDC4F2B50E923DF00006B2A5 /* DirectHW.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DirectHW.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		FDC4F2BE0E923E2B0006B2A5 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		5D9932D40D0F97D000760F43 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		FDC4F2B30E923DF00006B2A5 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				FDC4F2BF0E923E2B0006B2A5 /* IOKit.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		5D9932890D0F94EE00760F43 = {
+			isa = PBXGroup;
+			children = (
+				FDC4F2BE0E923E2B0006B2A5 /* IOKit.framework */,
+				5D9932940D0F94F500760F43 /* Source */,
+				5D99329C0D0F952400760F43 /* Products */,
+				5D9932D70D0F97D000760F43 /* DirectHW-Info.plist */,
+				FDC4F1CB0E923CB30006B2A5 /* DirectHW-Framework-Info.plist */,
+			);
+			sourceTree = "<group>";
+		};
+		5D9932940D0F94F500760F43 /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				FD12A6700E9235DB004BBD7B /* DirectHW.c */,
+				FD12A6710E9235DB004BBD7B /* DirectHW.h */,
+				5D9932B30D0F95DD00760F43 /* DirectHW.cpp */,
+				5D9932B40D0F95DD00760F43 /* DirectHW.hpp */,
+			);
+			name = Source;
+			sourceTree = "<group>";
+		};
+		5D99329C0D0F952400760F43 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				5D9932D60D0F97D000760F43 /* DirectHW.kext */,
+				FDC4F2B50E923DF00006B2A5 /* DirectHW.framework */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		FDC4F2B00E923DF00006B2A5 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				FDC4F2BC0E923E0C0006B2A5 /* DirectHW.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		5D9932D50D0F97D000760F43 /* KEXT */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 5D9932DB0D0F97D100760F43 /* Build configuration list for PBXNativeTarget "KEXT" */;
+			buildPhases = (
+				5D9932D20D0F97D000760F43 /* Sources */,
+				5D9932D30D0F97D000760F43 /* Resources */,
+				5D9932D40D0F97D000760F43 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = KEXT;
+			productName = DirectHW;
+			productReference = 5D9932D60D0F97D000760F43 /* DirectHW.kext */;
+			productType = "com.apple.product-type.kernel-extension.iokit";
+		};
+		FDC4F2B40E923DF00006B2A5 /* DirectHW */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = FDC4F2C00E923E2B0006B2A5 /* Build configuration list for PBXNativeTarget "DirectHW" */;
+			buildPhases = (
+				FDC4F2B00E923DF00006B2A5 /* Headers */,
+				FDC4F2B10E923DF00006B2A5 /* Resources */,
+				FDC4F2B20E923DF00006B2A5 /* Sources */,
+				FDC4F2B30E923DF00006B2A5 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = DirectHW;
+			productName = DirectHW;
+			productReference = FDC4F2B50E923DF00006B2A5 /* DirectHW.framework */;
+			productType = "com.apple.product-type.framework";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		5D99328B0D0F94EE00760F43 /* Project object */ = {
+			isa = PBXProject;
+			buildConfigurationList = 5D99328E0D0F94EE00760F43 /* Build configuration list for PBXProject "DirectHW" */;
+			compatibilityVersion = "Xcode 3.0";
+			hasScannedForEncodings = 0;
+			mainGroup = 5D9932890D0F94EE00760F43;
+			productRefGroup = 5D99329C0D0F952400760F43 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				5D9932D50D0F97D000760F43 /* KEXT */,
+				FDC4F2B40E923DF00006B2A5 /* DirectHW */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		5D9932D30D0F97D000760F43 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		FDC4F2B10E923DF00006B2A5 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		5D9932D20D0F97D000760F43 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				5D9932DD0D0F97EF00760F43 /* DirectHW.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		FDC4F2B20E923DF00006B2A5 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				FDC4F2BD0E923E100006B2A5 /* DirectHW.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		5D99328C0D0F94EE00760F43 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				STRIPFLAGS = "-no_uuid";
+			};
+			name = Debug;
+		};
+		5D99328D0D0F94EE00760F43 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				STRIPFLAGS = "-no_uuid";
+			};
+			name = Release;
+		};
+		5D9932D90D0F97D100760F43 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					x86_64,
+					i386,
+				);
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INFOPLIST_FILE = "DirectHW-Info.plist";
+				INSTALL_GROUP = wheel;
+				INSTALL_OWNER = root;
+				INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions";
+				MODULE_NAME = com.coresystems.driver.DirectHW;
+				MODULE_VERSION = 1.0;
+				PREBINDING = NO;
+				PRODUCT_NAME = DirectHW;
+				VALID_ARCHS = "i386 x86_64";
+				WRAPPER_EXTENSION = kext;
+				ZERO_LINK = NO;
+			};
+			name = Debug;
+		};
+		5D9932DA0D0F97D100760F43 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					x86_64,
+					i386,
+				);
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INFOPLIST_FILE = "DirectHW-Info.plist";
+				INSTALL_GROUP = wheel;
+				INSTALL_OWNER = root;
+				INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions";
+				MODULE_NAME = com.coresystems.driver.DirectHW;
+				MODULE_VERSION = 1.0;
+				PREBINDING = NO;
+				PRODUCT_NAME = DirectHW;
+				VALID_ARCHS = "i386 x86_64";
+				WRAPPER_EXTENSION = kext;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		FDC4F2B60E923DF00006B2A5 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					x86_64,
+					i386,
+				);
+				COPY_PHASE_STRIP = NO;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_VERSION = A;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				INFOPLIST_FILE = "DirectHW-Framework-Info.plist";
+				INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+				OTHER_LDFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = DirectHW;
+				VALID_ARCHS = "i386 x86_64";
+				ZERO_LINK = YES;
+			};
+			name = Debug;
+		};
+		FDC4F2B70E923DF00006B2A5 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					x86_64,
+					i386,
+				);
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				FRAMEWORK_VERSION = A;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				INFOPLIST_FILE = "DirectHW-Framework-Info.plist";
+				INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+				OTHER_LDFLAGS = "";
+				PREBINDING = NO;
+				PRODUCT_NAME = DirectHW;
+				VALID_ARCHS = "i386 x86_64";
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		5D99328E0D0F94EE00760F43 /* Build configuration list for PBXProject "DirectHW" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				5D99328C0D0F94EE00760F43 /* Debug */,
+				5D99328D0D0F94EE00760F43 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		5D9932DB0D0F97D100760F43 /* Build configuration list for PBXNativeTarget "KEXT" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				5D9932D90D0F97D100760F43 /* Debug */,
+				5D9932DA0D0F97D100760F43 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		FDC4F2C00E923E2B0006B2A5 /* Build configuration list for PBXNativeTarget "DirectHW" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				FDC4F2B60E923DF00006B2A5 /* Debug */,
+				FDC4F2B70E923DF00006B2A5 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 5D99328B0D0F94EE00760F43 /* Project object */;
+}

Added: trunk/macosx/DirectHW/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/Makefile	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,68 @@
+#
+# DirectHW - Kernel extension to pass through IO commands to user space
+#
+# Copyright © 2008-2010 coresystems GmbH <info at coresystems.de>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+all: dmg
+
+prepare:
+	if [ ! -r .patched ]; then \
+		test `uname -r  | cut -f1 -d\.` -lt 10 && \
+			patch -p0 < DirectHW-i386-only.diff || echo "Not patching."; \
+	fi
+	touch .patched
+
+build: prepare
+	xcodebuild -alltargets
+
+install: build
+	sudo xcodebuild -alltargets DSTROOT=`pwd`/build/DirectHW install
+
+package: install
+	/Developer/usr/bin/packagemaker -v --doc DirectHW.pmdoc \
+		--id com.coresystems.DirectHW --out build/DirectHW.pkg
+
+dmg: package
+	rm -rf DirectHW.dmg
+	rm -rf out
+	mkdir out
+	cp -r build/DirectHW.pkg out/Install\ DirectHW.pkg
+	cp -r ReadMe.rtf out/Read\ Me.rtf
+	/Developer/Tools/SetFile -a E out/Install\ DirectHW.pkg
+	/Developer/Tools/SetFile -a E out/Read\ Me.rtf
+	../create-dmg/create-dmg --window-size 447 337 \
+		--background background.png --icon-size 80 \
+		--volname "Install DirectHW" \
+		--icon "Install DirectHW.pkg" 142 64 \
+		--icon "Read Me.rtf" 310 64 \
+		DirectHW.dmg out
+
+load: install
+	cd build/DirectHW/System/Library/Extensions; sudo kextunload -v DirectHW.kext; sudo kextload -v DirectHW.kext
+
+installer: package
+	rm -rf ~/Desktop/DirectHW.pkg
+	cp -r build/DirectHW.pkg ~/Desktop
+
+clean:
+	sudo rm -rf build/Release build/DirectHW.build build/DirectHW build/DirectHW.pkg
+	rm -rf out
+
+distclean:
+	rm DirectHW.dmg
+
+.PHONY: prepare build install package dmg load copy clean distclean
+

Added: trunk/macosx/DirectHW/ReadMe.rtf
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/ReadMe.rtf	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,116 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320
+{\fonttbl\f0\fswiss\fcharset0 ArialMT;\f1\fnil\fcharset0 Monaco;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh9120\viewkind0
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+
+\f0\b\fs24 \cf0 Welcome to DirectHW by coresystems GmbH\
+
+\b0 \
+
+\b ABOUT\
+
+\b0 \
+DirectHW is a software compatibility layer for Mac OS X. It provides a kernel driver and framework that emulates the most commonly used hardware access functions on x86 machines, such as:\
+\
+	\'95	iopl\
+	\'95	inb, inw, inl, outb, outw, outl\
+	\'95	rdmsr, wrmsr\
+	\'95	mmap() of physical address space\
+\
+This package was originally intended to get the coreboot\'ae utilities running on Mac OS X. But you're encouraged to use it for many more opportunities.\
+\
+Visit {\field{\*\fldinst{HYPERLINK "http://www.coresystems.de/"}}{\fldrslt http://www.coresystems.de/}} for more information.\
+\
+\
+
+\b LICENSE\
+
+\b0 \
+DirectHW is Copyright \'a9 2008-2010 coresystems GmbH <{\field{\*\fldinst{HYPERLINK "mailto:info at coresystems.de"}}{\fldrslt info at coresystems.de}}>\
+\
+Permission to use, copy, modify, and/or distribute this software for any\
+purpose with or without fee is hereby granted, provided that the above\
+copyright notice and this permission notice appear in all copies.\
+\
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\
+\
+coreboot\'ae is a registered trademark of coresystems GmbH\
+\
+
+\b CHANGELOG\
+
+\b0 \
+
+\itap1\trowd \taflags1 \trgaph108\trleft-108 \trbrdrt\brdrnil \trbrdrl\brdrnil \trbrdrr\brdrnil 
+\clvertalc \clshdrawnil \clwWidth1460\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx2880
+\clvertalc \clshdrawnil \clwWidth560\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx5760
+\clvertalc \clshdrawnil \clwWidth8120\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx8640
+\pard\intbl\itap1\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+\cf0 2010/10/20\
+\cell 
+\pard\intbl\itap1\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+\cf0 v1.3\
+\cell 
+\pard\intbl\itap1\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\ql\qnatural\pardirnatural
+\cf0 - Implement SMP capable MSR handling\
+- Fix 32bit/64bit user space/kernel space\cell \row
+
+\itap1\trowd \taflags1 \trgaph108\trleft-108 \trbrdrl\brdrnil \trbrdrr\brdrnil 
+\clvertalc \clshdrawnil \clwWidth1460\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx2880
+\clvertalc \clshdrawnil \clwWidth560\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx5760
+\clvertalc \clshdrawnil \clwWidth8120\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx8640
+\pard\intbl\itap1\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\ql\qnatural\pardirnatural
+\cf0 2010/10/18\
+\
+\cell 
+\pard\intbl\itap1\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+\cf0 v1.2\
+\
+\cell 
+\pard\intbl\itap1\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\ql\qnatural\pardirnatural
+\cf0 - Rename to DirectHW\
+- Fix memory mapping return values\
+- Security fix, kept now checks for admin priviledges\cell \row
+
+\itap1\trowd \taflags1 \trgaph108\trleft-108 \trbrdrl\brdrnil \trbrdrr\brdrnil 
+\clvertalc \clshdrawnil \clwWidth1460\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx2880
+\clvertalc \clshdrawnil \clwWidth560\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx5760
+\clvertalc \clshdrawnil \clwWidth8120\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx8640
+\pard\intbl\itap1\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\ql\qnatural\pardirnatural
+\cf0 2009/08/30\cell 
+\pard\intbl\itap1\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+\cf0 v1.1\cell 
+\pard\intbl\itap1\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\ql\qnatural\pardirnatural
+\cf0 - Update for 64bit Mac OS X 10.6 (Snow Leopard)\cell \row
+
+\itap1\trowd \taflags1 \trgaph108\trleft-108 \trbrdrl\brdrnil \trbrdrt\brdrnil \trbrdrr\brdrnil 
+\clvertalc \clshdrawnil \clwWidth1460\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx2880
+\clvertalc \clshdrawnil \clwWidth560\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx5760
+\clvertalc \clshdrawnil \clwWidth8120\clftsWidth3 \clbrdrt\brdrs\brdrw20\brdrcf1 \clbrdrl\brdrs\brdrw20\brdrcf1 \clbrdrb\brdrs\brdrw20\brdrcf1 \clbrdrr\brdrs\brdrw20\brdrcf1 \clpadl100 \clpadr100 \gaph\cellx8640
+\pard\intbl\itap1\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\ql\qnatural\pardirnatural
+\cf0 2008/11/16\cell 
+\pard\intbl\itap1\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+\cf0 v1.0\cell 
+\pard\intbl\itap1\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\ql\qnatural\pardirnatural
+\cf0 - Initial version\cell \lastrow\row
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+\cf0 \
+\
+
+\b CONTACT\
+
+\b0 \
+Please contact us at <{\field{\*\fldinst{HYPERLINK "mailto:info at coresystems.de"}}{\fldrslt info at coresystems.de}}>.\
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+
+\f1\fs20 \cf0 \
+\
+\
+}
\ No newline at end of file

Added: trunk/macosx/DirectHW/Welcome.rtf
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/DirectHW/Welcome.rtf	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,33 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320
+{\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
+{\colortbl;\red255\green255\blue255;\red128\green128\blue128;\red100\green100\blue100;}
+{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1}}
+{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}
+\paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkind0
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+
+\f0\b\fs26 \cf2 Welcome to DirectHW by coresystems GmbH\
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\sl120\slmult1\ql\qnatural\pardirnatural
+
+\b0 \cf2 \
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+\cf2 DirectHW is a software compatibility layer for Mac OS X. It provides a kernel driver and framework that emulates the most commonly used hardware access functions on x86 machines, such as:\
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\sl120\slmult1\ql\qnatural\pardirnatural
+\cf2 \
+\pard\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\ql\qnatural\pardirnatural
+\ls1\ilvl0\cf2 {\listtext	\'95	}iopl\
+{\listtext	\'95	}inb, inw, inl, outb, outw, outl\
+{\listtext	\'95	}rdmsr, wrmsr\
+{\listtext	\'95	}mmap() of physical address space\
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\sl120\slmult1\ql\qnatural\pardirnatural
+\cf2 \
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+\cf2 This package was originally intended to get the coreboot\'ae utilities running on Mac OS X. But you're encouraged to use it for many more opportunities.\
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\sl120\slmult1\ql\qnatural\pardirnatural
+\cf2 \
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+\cf2 Visit {\field{\*\fldinst{HYPERLINK "http://www.coresystems.de/"}}{\fldrslt \cf3 http://www.coresystems.de/}} for more information.\
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\sl120\slmult1\ql\qnatural\pardirnatural
+\cf2 \
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
+\cf2 You will now be guided through the steps necessary to install this software.}
\ No newline at end of file

Added: trunk/macosx/DirectHW/background.png
==============================================================================
Binary file. No diff available.

Added: trunk/macosx/DirectHW/installer.png
==============================================================================
Binary file. No diff available.

Added: trunk/macosx/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/Makefile	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,47 @@
+all:
+	@echo "make directhw	-	builds DirectHW dmg."
+	@echo "make pciutils	-	builds pciutils dmg."
+	#@echo "make tools	-	builds coreboot utilities dmg."
+	@echo "make clean	-	clean up."
+
+PCIUTILS=pciutils-3.1.7
+
+directhw:
+	$(MAKE) -C DirectHW
+
+pciutils:
+	rm -rf $(PCIUTILS)
+	wget ftp://ftp.kernel.org/pub/software/utils/pciutils/$(PCIUTILS).tar.bz2
+	tar xvjf $(PCIUTILS).tar.bz2
+	patch -p0 < patches/$(PCIUTILS).diff
+	cd $(PCIUTILS); \
+	make OPT="-O2 -arch i386 -arch x86_64" LDFLAGS="-arch i386 -arch x86_64" IDSDIR=/usr/share; \
+	make install DESTDIR=$(shell pwd)/$(PCIUTILS)/root PREFIX=/usr ; \
+	make install-lib DESTDIR=$(shell pwd)/$(PCIUTILS)/root PREFIX=/usr ; \
+	/Developer/usr/bin/packagemaker -v --doc $(shell pwd)/$(PCIUTILS)/osx/pciutils.pmdoc --id com.pciutils --out pciutils.pkg
+	rm -rf $(PCIUTILS).dmg
+	rm -rf out
+	mkdir out
+	cp -r $(PCIUTILS)/pciutils.pkg out/Install\ PCI\ Utilities.pkg
+	cp -r $(PCIUTILS)/osx/Welcome.rtf out/Read\ Me.rtf
+	/Developer/Tools/SetFile -a E out/Install\ PCI\ Utilities.pkg
+	/Developer/Tools/SetFile -a E out/Read\ Me.rtf
+	./create-dmg/create-dmg --window-size 447 337 --background \
+	DirectHW/background.png --icon-size 80 \
+	--volname "Install PCI Utilities" \
+	--icon "Install PCI Utilities.pkg" 142 64 \
+	--icon "Read Me.rtf" 310 64 $(PCIUTILS).dmg out
+
+#tools: 
+#	$(MAKE) -C tools
+
+#patches:
+#	$(MAKE) -C upstream
+
+clean:
+	#cd $(PCIUTILS); make clean; rm -rf pciutils.pkg; rm -rf root
+	#cd tools; make clean
+	cd DirectHW; make clean
+
+.PHONY: all directhw pciutils tools patches clean
+

Added: trunk/macosx/create-dmg/create-dmg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/create-dmg/create-dmg	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,169 @@
+#! /bin/bash
+
+# Create a read-only disk image of the contents of a folder
+#
+# Usage: make-diskimage <image_file>
+#                       <src_folder>
+#                       <volume_name>
+#                       <applescript>
+#                       <artpath>
+#                       <eula_resource_file>
+
+set -e;
+
+function pure_version() {
+  echo '1.0.0.2'
+}
+
+function version() {
+  echo "create-dmg $(pure_version)"
+}
+
+function usage() {
+  version
+  echo "Creates a fancy DMG file."
+  echo "Usage:  $(basename $0) options... image.dmg source_folder"
+  echo "All contents of source_folder will be copied into the disk image."
+  echo "Options:"
+  echo "  --volname name"
+  echo "      set volume name (displayed in the Finder sidebar and window title)"
+  echo "  --background pic.png"
+  echo "      set folder background image (provide png, gif, jpg)"
+  echo "  --window-pos x y"
+  echo "      set position the folder window"
+  echo "  --window-size width height"
+  echo "      set size of the folder window"
+  echo "  --icon-size icon_size"
+  echo "      set window icons size (up to 128)"
+  echo "  --icon file_name x y"
+  echo "      set position of the file's icon"
+  echo "  --custom-icon file_name custom_icon_or_sample_file x y"
+  echo "      set position and custom icon"
+  echo "  --version         show tool version number"
+  echo "  -h, --help        display this help"
+  exit 0
+}
+
+WINX=10
+WINY=60
+WINW=600
+WINH=400
+ICON_SIZE=128
+
+while test "${1:0:1}" = "-"; do
+  case $1 in
+    --volname)
+      VOLUME_NAME="$2"
+      shift; shift;;
+    --background)
+      BACKGROUND_FILE="$2"
+      BACKGROUND_FILE_NAME="$(basename $BACKGROUND_FILE)"
+      BACKGROUND_CLAUSE="set background picture of opts to file \".background:$BACKGROUND_FILE_NAME\""
+      shift; shift;;
+    --icon-size)
+      ICON_SIZE="$2"
+      shift; shift;;
+    --window-pos)
+      WINX=$2; WINY=$3
+      shift; shift; shift;;
+    --window-size)
+      WINW=$2; WINH=$3
+      shift; shift; shift;;
+    --icon)
+      POSITION_CLAUSE="${POSITION_CLAUSE}set position of item \"$2\" to {$3, $4}
+"
+      echo $POSITION_CLAUSE
+      shift; shift; shift; shift;;
+    --custom-icon)
+      shift; shift; shift; shift; shift;;
+    -h | --help)
+      usage;;
+    --version)
+      version; exit 0;;
+    --pure-version)
+      pure_version; exit 0;;
+    -*)
+      echo "Unknown option $1. Run with --help for help."
+      exit 1;;
+  esac
+done
+
+test -z "$2" && {
+  echo "Not enough arguments. Invoke with --help for help."
+  exit 1
+}
+
+DMG_PATH="$1"
+DMG_DIRNAME="$(dirname "$DMG_PATH")"
+DMG_DIR="$(cd $DMG_DIRNAME > /dev/null; pwd)"
+DMG_NAME="$(basename "$DMG_PATH")"
+DMG_TEMP_NAME="$DMG_DIR/rw.${DMG_NAME}"
+SRC_FOLDER="$(cd "$2" > /dev/null; pwd)"
+test -z "$VOLUME_NAME" && VOLUME_NAME="$(basename "$DMG_PATH" .dmg)"
+
+AUX_PATH="$(cd "$(dirname $0)"; pwd)/support"
+
+test -d "$AUX_PATH" || {
+  echo "Cannot find support directory: $AUX_PATH"
+  exit 1
+}
+
+# Create the image
+echo "Creating disk image..."
+test -f "${DMG_TEMP_NAME}" && rm -f "${DMG_TEMP_NAME}"
+hdiutil create -srcfolder "$SRC_FOLDER" -volname "${VOLUME_NAME}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size 300m "${DMG_TEMP_NAME}"
+
+# mount it
+echo "Mounting disk image..."
+MOUNT_DIR="/Volumes/${VOLUME_NAME}"
+echo "Mount directory: $MOUNT_DIR"
+DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | egrep '^/dev/' | sed 1q | awk '{print $1}')
+echo "Device name:     $DEV_NAME"
+
+#cp RightDS_Store "/Volumes/${VOLUME_NAME}/.DS_Store"
+
+if ! test -z "$BACKGROUND_FILE"; then
+  echo "Copying background file..."
+  test -d "$MOUNT_DIR/.background" || mkdir "$MOUNT_DIR/.background"
+  cp "$BACKGROUND_FILE" "$MOUNT_DIR/.background/$BACKGROUND_FILE_NAME"
+fi
+
+# run applescript
+APPLESCRIPT=$(mktemp -t createdmg)
+cat "$AUX_PATH/template.applescript" | sed -e "s/WINX/$WINX/g" -e "s/WINY/$WINY/g" -e "s/WINW/$WINW/g" -e "s/WINH/$WINH/g" -e "s/BACKGROUND_CLAUSE/$BACKGROUND_CLAUSE/g" -e "s/ICON_SIZE/$ICON_SIZE/g" | perl -pe  "s/POSITION_CLAUSE/$POSITION_CLAUSE/g" >"$APPLESCRIPT"
+
+echo "Running Applescript: ./AdiumApplescriptRunner \"${APPLESCRIPT}\" process_disk_image \"${VOLUME_NAME}\""
+"$AUX_PATH/AdiumApplescriptRunner" "${APPLESCRIPT}" process_disk_image "${VOLUME_NAME}" || true
+echo "Done running the applescript..."
+sleep 4
+
+# make sure it's not world writeable
+echo "Fixing permissions..."
+chmod -Rf go-w "${MOUNT_DIR}" || true
+echo "Done fixing permissions."
+
+# make the top window open itself on mount:
+if [ -x /usr/local/bin/openUp ]; then
+    echo "Applying openUp..."
+    /usr/local/bin/openUp "${MOUNT_DIR}"
+fi
+
+# unmount
+echo "Unmounting disk image..."
+hdiutil detach "${DEV_NAME}"
+
+# compress image
+echo "Compressing disk image..."
+hdiutil convert "${DMG_TEMP_NAME}" -format UDZO -imagekey zlib-level=9 -o "${DMG_DIR}/${DMG_NAME}"
+rm -f "${DMG_TEMP_NAME}"
+
+# adding EULA resources
+if [ ! -z "${EULA_RSRC}" -a "${EULA_RSRC}" != "-null-" ]; then
+        echo "adding EULA resources"
+        hdiutil unflatten "${DMG_DIR}/${DMG_NAME}"
+        /Developer/Tools/ResMerger -a "${EULA_RSRC}" -o "${DMG_DIR}/${DMG_NAME}"
+        hdiutil flatten "${DMG_DIR}/${DMG_NAME}"
+fi
+
+echo "Disk image done"
+exit 0

Added: trunk/macosx/create-dmg/sample
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/create-dmg/sample	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,3 @@
+#! /bin/bash
+test -f test2.dmg && rm test2.dmg
+./create-dmg --window-size 500 300 --background ~/Projects/eclipse-osx-repackager/build/background.gif --icon-size 96 --volname "Hyper Foo" --icon "Applications" 380 205 --icon "Eclipse OS X Repackager" 110 205 test2.dmg /Users/andreyvit/Projects/eclipse-osx-repackager/temp/Eclipse\ OS\ X\ Repackager\ r10/

Added: trunk/macosx/create-dmg/support/AdiumApplescriptRunner
==============================================================================
Binary file. No diff available.

Added: trunk/macosx/create-dmg/support/template.applescript
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/create-dmg/support/template.applescript	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,105 @@
+on run -- for testing in script editor
+	process_disk_image("Adium X 1.0b20", "/Users/evands/adium-1.0/Release/Artwork")
+end run
+
+on process_disk_image(volumeName)
+	tell application "Finder"
+		tell disk (volumeName as string)
+			open
+			
+			set theXOrigin to WINX
+			set theYOrigin to WINY
+			set theWidth to WINW
+			set theHeight to WINH
+			
+			set theBottomRightX to (theXOrigin + theWidth)
+			set theBottomRightY to (theYOrigin + theHeight)
+			set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\""
+			--			do shell script "rm " & dsStore
+			
+			tell container window
+				set current view to icon view
+				set toolbar visible to false
+				set statusbar visible to false
+				set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
+				set statusbar visible to false
+			end tell
+			
+			set opts to the icon view options of container window
+			tell opts
+				set icon size to ICON_SIZE
+				set arrangement to not arranged
+			end tell
+			-- set background picture of opts to file ".background:background.png"
+			BACKGROUND_CLAUSE
+			
+			-- Positioning
+			POSITION_CLAUSE
+			-- set position of item "Adium.app" to {196, 273}
+			
+			-- Custom icons
+			-- my copyIconOfTo(artPath & "/ApplicationsIcon", "/Volumes/" & volumeName & "/Applications")
+			
+			-- Label colors
+			-- set label index of item "Adium.app" to 6
+			-- set label index of item "License.txt" to 7
+			-- set label index of item "Changes.txt" to 7
+			-- set label index of item "Applications" to 4
+			
+			update without registering applications
+			-- Force saving of the size
+      delay 1
+      
+			tell container window
+				set statusbar visible to false
+				set the bounds to {theXOrigin, theYOrigin, theBottomRightX - 10, theBottomRightY - 10}
+			end tell
+			
+			update without registering applications
+		end tell
+		
+    delay 1
+		
+		tell disk (volumeName as string)
+			tell container window
+				set statusbar visible to false
+				set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
+			end tell
+			
+			update without registering applications
+	  end tell
+		
+		--give the finder some time to write the .DS_Store file
+    delay 3
+    
+		set waitTime to 0
+		set ejectMe to false
+		repeat while ejectMe is false
+			delay 1
+			set waitTime to waitTime + 1
+			
+			if (do shell script "[ -f " & dsStore & " ]; echo $?") = "0" then set ejectMe to true
+		end repeat
+		log "waited " & waitTime & " seconds for .DS_STORE to be created."
+	end tell
+end process_disk_image
+
+on copyIconOfTo(aFileOrFolderWithIcon, aFileOrFolder)
+	tell application "Finder" to set f to POSIX file aFileOrFolderWithIcon as alias
+	-- grab the file's icon
+	my CopyOrPaste(f, "c")
+	-- now the icon is in the clipboard
+	tell application "Finder" to set c to POSIX file aFileOrFolder as alias
+	my CopyOrPaste(result, "v")
+end copyIconOfTo
+
+on CopyOrPaste(i, cv)
+	tell application "Finder"
+		activate
+		open information window of i
+	end tell
+	tell application "System Events" to tell process "Finder" to tell window 1
+		keystroke tab -- select icon button
+		keystroke (cv & "w") using command down (* (copy or paste) + close window *)
+	end tell -- window 1 then process Finder then System Events
+end CopyOrPaste
\ No newline at end of file

Added: trunk/macosx/patches/dmidecode-2.9.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/patches/dmidecode-2.9.diff	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,206 @@
+Index: dmidecode-2.9/config.h
+===================================================================
+--- dmidecode-2.9/config.h	(revision 122)
++++ dmidecode-2.9/config.h	(working copy)
+@@ -9,8 +9,12 @@
+ #ifdef __BEOS__
+ #define DEFAULT_MEM_DEV "/dev/misc/mem"
+ #else
++#ifdef __APPLE__
++#define DEFAULT_MEM_DEV "DirectHW"
++#else
+ #define DEFAULT_MEM_DEV "/dev/mem"
+ #endif
++#endif
+ 
+ /* Use mmap or not */
+ #ifndef __BEOS__
+Index: dmidecode-2.9/util.c
+===================================================================
+--- dmidecode-2.9/util.c	(revision 122)
++++ dmidecode-2.9/util.c	(working copy)
+@@ -47,6 +47,10 @@
+ #include "types.h"
+ #include "util.h"
+ 
++#ifdef __APPLE__
++#include <DirectHW/DirectHW.h>
++#endif
++
+ #ifndef USE_MMAP
+ static int myread(int fd, u8 *buf, size_t count, const char *prefix)
+ {
+@@ -97,6 +101,7 @@
+ void *mem_chunk(size_t base, size_t len, const char *devmem)
+ {
+ 	void *p;
++#ifndef __APPLE__
+ 	int fd;
+ #ifdef USE_MMAP
+ 	size_t mmoffset;
+@@ -160,6 +165,22 @@
+ 	
+ 	if(close(fd)==-1)
+ 		perror(devmem);
+-	
++#else
++	void *v;
++	iopl(3);
++	if((v=map_physical(base, len))==NULL)
++	{
++		perror("map_physical");
++		return NULL;
++	}
++
++	if((p=malloc(len))==NULL)
++	{
++		perror("malloc");
++		return NULL;
++	}
++	memcpy(p, v, len);
++	unmap_physical(v, len);
++#endif
+ 	return p;
+ }
+Index: dmidecode-2.9/Makefile
+===================================================================
+--- dmidecode-2.9/Makefile	(revision 122)
++++ dmidecode-2.9/Makefile	(working copy)
+@@ -21,6 +21,11 @@
+ # Pass linker flags here
+ LDFLAGS =
+ 
++OS_ARCH = $(shell uname)
++ifeq ($(OS_ARCH), Darwin)
++LDFLAGS += -framework IOKit -framework DirectHW
++endif
++
+ DESTDIR =
+ prefix  = /usr/local
+ sbindir = $(prefix)/sbin
+Index: dmidecode-2.9/biosdecode.c
+===================================================================
+--- dmidecode-2.9/biosdecode.c	(revision 122)
++++ dmidecode-2.9/biosdecode.c	(working copy)
+@@ -557,9 +557,15 @@
+ static int parse_command_line(int argc, char * const argv[])
+ {
+ 	int option;
++#ifndef __APPLE__
+ 	const char *optstring = "d:hV";
++#else
++	const char *optstring = "hV";
++#endif
+ 	struct option longopts[]={
++#ifndef __APPLE__
+ 		{ "dev-mem", required_argument, NULL, 'd' },
++#endif
+ 		{ "help", no_argument, NULL, 'h' },
+ 		{ "version", no_argument, NULL, 'V' },
+ 		{ 0, 0, 0, 0 }
+@@ -568,9 +574,11 @@
+ 	while((option=getopt_long(argc, argv, optstring, longopts, NULL))!=-1)
+ 		switch(option)
+ 		{
++#ifndef __APPLE__
+ 			case 'd':
+ 				opt.devmem=optarg;
+ 				break;
++#endif
+ 			case 'h':
+ 				opt.flags|=FLAG_HELP;
+ 				break;
+@@ -589,7 +597,9 @@
+ 	static const char *help=
+ 		"Usage: biosdecode [OPTIONS]\n"
+ 		"Options are:\n"
++#ifndef __APPLE__
+ 		" -d, --dev-mem FILE     Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n"
++#endif
+ 		" -h, --help             Display this help text and exit\n"
+ 		" -V, --version          Display the version and exit\n";
+ 	
+Index: dmidecode-2.9/vpdopt.c
+===================================================================
+--- dmidecode-2.9/vpdopt.c	(revision 122)
++++ dmidecode-2.9/vpdopt.c	(working copy)
+@@ -92,9 +92,15 @@
+ int parse_command_line(int argc, char * const argv[])
+ {
+ 	int option;
++#ifndef __APPLE__
+ 	const char *optstring = "d:hs:uV";
++#else
++	const char *optstring = "hs:uV";
++#endif
+ 	struct option longopts[]={
++#ifndef __APPLE__
+ 		{ "dev-mem", required_argument, NULL, 'd' },
++#endif
+ 		{ "help", no_argument, NULL, 'h' },
+ 		{ "string", required_argument, NULL, 's' },
+ 		{ "dump", no_argument, NULL, 'u' },
+@@ -105,9 +111,11 @@
+ 	while((option=getopt_long(argc, argv, optstring, longopts, NULL))!=-1)
+ 		switch(option)
+ 		{
++#ifndef __APPLE__
+ 			case 'd':
+ 				opt.devmem=optarg;
+ 				break;
++#endif
+ 			case 'h':
+ 				opt.flags|=FLAG_HELP;
+ 				break;
+@@ -147,7 +155,9 @@
+ 	static const char *help=
+ 		"Usage: vpddecode [OPTIONS]\n"
+ 		"Options are:\n"
++#ifndef __APPLE__
+ 		" -d, --dev-mem FILE     Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n"
++#endif
+ 		" -h, --help             Display this help text and exit\n"
+ 		" -s, --string KEYWORD   Only display the value of the given VPD string\n"
+ 		" -u, --dump             Do not decode the VPD records\n"
+Index: dmidecode-2.9/ownership.c
+===================================================================
+--- dmidecode-2.9/ownership.c	(revision 122)
++++ dmidecode-2.9/ownership.c	(working copy)
+@@ -112,9 +112,15 @@
+ static int parse_command_line(int argc, char * const argv[])
+ {
+ 	int option;
++#ifndef __APPLE__
+ 	const char *optstring = "d:hV";
++#else
++	const char *optstring = "hV";
++#endif
+ 	struct option longopts[]={
++#ifndef __APPLE__
+ 		{ "dev-mem", required_argument, NULL, 'd' },
++#endif
+ 		{ "help", no_argument, NULL, 'h' },
+ 		{ "version", no_argument, NULL, 'V' },
+ 		{ 0, 0, 0, 0 }
+@@ -123,9 +129,11 @@
+ 	while((option=getopt_long(argc, argv, optstring, longopts, NULL))!=-1)
+ 		switch(option)
+ 		{
++#ifndef __APPLE__
+ 			case 'd':
+ 				opt.devmem=optarg;
+ 				break;
++#endif
+ 			case 'h':
+ 				opt.flags|=FLAG_HELP;
+ 				break;
+@@ -144,7 +152,9 @@
+ 	static const char *help=
+ 		"Usage: ownership [OPTIONS]\n"
+ 		"Options are:\n"
++#ifndef __APPLE__
+ 		" -d, --dev-mem FILE     Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n"
++#endif
+ 		" -h, --help             Display this help text and exit\n"
+ 		" -V, --version          Display the version and exit\n";
+ 	

Added: trunk/macosx/patches/flashrom-r1280.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/patches/flashrom-r1280.diff	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,41 @@
+Index: flashrom-r1280/hwaccess.h
+===================================================================
+--- flashrom-r1280/hwaccess.h
++++ flashrom-r1280/hwaccess.h
+@@ -194,7 +194,7 @@
+ #else
+ #if defined(__DARWIN__)
+     /* Header is part of the DirectHW library. */
+-    #include <DirectIO/darwinio.h>
++    #include <DirectHW/DirectHW.h>
+     #define off64_t off_t
+     #define lseek64 lseek
+ #endif
+Index: flashrom-r1280/Makefile
+===================================================================
+--- flashrom-r1280/Makefile
++++ flashrom-r1280/Makefile
+@@ -44,8 +44,8 @@
+ endif
+ ifeq ($(OS_ARCH), Darwin)
+ CPPFLAGS += -I/opt/local/include -I/usr/local/include
+-# DirectIO framework can be found in the DirectHW library.
+-LDFLAGS += -framework IOKit -framework DirectIO -L/opt/local/lib -L/usr/local/lib
++# DirectHW framework can be found in the DirectHW library.
++LDFLAGS += -framework IOKit -framework DirectHW -L/opt/local/lib -L/usr/local/lib
+ endif
+ ifeq ($(OS_ARCH), FreeBSD)
+ CPPFLAGS += -I/usr/local/include
+Index: flashrom-r1280/physmap.c
+===================================================================
+--- flashrom-r1280/physmap.c
++++ flashrom-r1280/physmap.c
+@@ -134,7 +134,7 @@
+ }
+ #elif defined(__DARWIN__)
+ 
+-#define MEM_DEV "DirectIO"
++#define MEM_DEV "DirectHW"
+ 
+ static void *sys_physmap(unsigned long phys_addr, size_t len)
+ {

Added: trunk/macosx/patches/inteltool-r6440.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/patches/inteltool-r6440.diff	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,48 @@
+Index: inteltool-r6440/inteltool.h
+===================================================================
+--- inteltool-r6440/inteltool.h
++++ inteltool-r6440/inteltool.h
+@@ -26,7 +26,7 @@
+ #if (defined(__MACH__) && defined(__APPLE__))
+ /* DirectHW is available here: http://www.coresystems.de/en/directhw */
+ #define __DARWIN__
+-#include <DirectIO/darwinio.h>
++#include <DirectHW/DirectHW.h>
+ #endif
+ #include <pci/pci.h>
+ 
+@@ -111,7 +111,7 @@
+ #endif
+ typedef struct { uint16_t addr; int size; char *name; } io_register_t;
+ 
+-void *map_physical(unsigned long phys_addr, size_t len);
++void *map_physical(uint64_t phys_addr, size_t len);
+ void unmap_physical(void *virt_addr, size_t len);
+ 
+ unsigned int cpuid(unsigned int op);
+Index: inteltool-r6440/inteltool.c
+===================================================================
+--- inteltool-r6440/inteltool.c
++++ inteltool-r6440/inteltool.c
+@@ -85,7 +85,7 @@
+ #ifndef __DARWIN__
+ static int fd_mem;
+ 
+-void *map_physical(unsigned long phys_addr, size_t len)
++void *map_physical(uint64_t phys_addr, size_t len)
+ {
+ 	void *virt_addr;
+ 
+Index: inteltool-r6440/Makefile
+===================================================================
+--- inteltool-r6440/Makefile
++++ inteltool-r6440/Makefile
+@@ -31,7 +31,7 @@
+ 
+ OS_ARCH	= $(shell uname)
+ ifeq ($(OS_ARCH), Darwin)
+-LDFLAGS = -framework DirectIO -lpci -lz
++LDFLAGS = -framework DirectHW -lpci -lz
+ endif
+ ifeq ($(OS_ARCH), FreeBSD)
+ CFLAGS += -I/usr/local/include

Added: trunk/macosx/patches/msrtool-r6440.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/patches/msrtool-r6440.diff	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,57 @@
+Index: msrtool-r6440/msrtool.c
+===================================================================
+--- msrtool-r6440/msrtool.c
++++ msrtool-r6440/msrtool.c
+@@ -49,7 +49,7 @@
+ 
+ static struct sysdef allsystems[] = {
+ 	{ "linux", "Linux with /dev/cpu/*/msr", linux_probe, linux_open, linux_close, linux_rdmsr },
+-	{ "darwin", "OS X with DirectIO", darwin_probe, darwin_open, darwin_close, darwin_rdmsr },
++	{ "darwin", "Mac OS X with DirectHW", darwin_probe, darwin_open, darwin_close, darwin_rdmsr },
+ 	{ "freebsd", "FreeBSD with /dev/cpuctl*", freebsd_probe, freebsd_open, freebsd_close, freebsd_rdmsr },
+ 	{ SYSTEM_EOT }
+ };
+Index: msrtool-r6440/configure
+===================================================================
+--- msrtool-r6440/configure
++++ msrtool-r6440/configure
+@@ -155,7 +155,7 @@
+ 	rm -f .config.c
+ 	exit 1
+ }
+-LDFLAGS=`trylink "libpci (from pciutils)" "${pc_LDFLAGS}" "-lpci -lz" "-L/usr/local/lib -lpci -lz" "-framework DirectIO -lpci -lz"` || {
++LDFLAGS=`trylink "libpci (from pciutils)" "${pc_LDFLAGS}" "-lpci -lz" "-L/usr/local/lib -lpci -lz" "-framework DirectHW -lpci -lz"` || {
+ 	rm -f .config.c .config.o
+ 	exit 1
+ }
+Index: msrtool-r6440/msrtool.h
+===================================================================
+--- msrtool-r6440/msrtool.h
++++ msrtool-r6440/msrtool.h
+@@ -24,9 +24,9 @@
+ #include <stdio.h>
+ #include <stdint.h>
+ #if (defined(__MACH__) && defined(__APPLE__))
+-/* DirectIO is available here: http://www.coresystems.de/en/directio */
++/* DirectHW is available here: http://www.coreboot.org/DirectHW */
+ #define __DARWIN__
+-#include <DirectIO/darwinio.h>
++#include <DirectHW/DirectHW.h>
+ #endif
+ #if defined(__FreeBSD__)
+ #include <sys/ioctl.h>
+Index: msrtool-r6440/darwin.c
+===================================================================
+--- msrtool-r6440/darwin.c
++++ msrtool-r6440/darwin.c
+@@ -26,8 +26,8 @@
+ 
+ #include "msrtool.h"
+ 
+-/* This Darwin support requires DirectIO, which is available at
+- * http://www.coresystems.de/en/directio
++/* This Darwin support requires DirectHW, which is available at
++ * http://www.coreboot.org/DirectHW
+  */
+ 
+ int darwin_probe(const struct sysdef *system)

Added: trunk/macosx/patches/nvramtool-r6440.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/patches/nvramtool-r6440.diff	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,26 @@
+Index: nvramtool-r6440/accessors/cmos-hw-unix.c
+===================================================================
+--- nvramtool-r6440/accessors/cmos-hw-unix.c
++++ nvramtool-r6440/accessors/cmos-hw-unix.c
+@@ -15,7 +15,7 @@
+ #include <sys/io.h>
+ #endif
+ #if (defined(__MACH__) && defined(__APPLE__))
+-#include <DirectIO/darwinio.h>
++#include <DirectHW/DirectHW.h>
+ #endif
+ #if defined(__NetBSD__)
+ #if defined(__i386__) || defined(__x86_64__) 
+Index: nvramtool-r6440/Makefile
+===================================================================
+--- nvramtool-r6440/Makefile
++++ nvramtool-r6440/Makefile
+@@ -37,7 +37,7 @@
+ 
+ OS_ARCH        = $(shell uname)
+ ifeq ($(OS_ARCH), Darwin)
+-LDFLAGS = -framework DirectIO
++LDFLAGS = -framework DirectHW
+ endif
+ ifeq ($(OS_ARCH), NetBSD)
+ LDFLAGS = -l$(shell uname -p)

Added: trunk/macosx/patches/pciutils-3.1.7.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/patches/pciutils-3.1.7.diff	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,189 @@
+Index: pciutils-3.1.7/osx/Welcome.rtf
+===================================================================
+--- pciutils-3.1.7/osx/Welcome.rtf
++++ pciutils-3.1.7/osx/Welcome.rtf
+@@ -0,0 +1,20 @@
++{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540
++{\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
++{\colortbl;\red255\green255\blue255;\red128\green128\blue128;}
++\paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkind0
++\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
++
++\f0\b\fs26 \cf2 Welcome to PCI Utilities\
++\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\sl120\slmult1\ql\qnatural\pardirnatural
++
++\b0 \cf2 \
++\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
++\cf2 This package contains the PCI Utilities, version 3.1.7.\
++\
++Copyright (c) 1997--2010 Martin Mares <mj at ucw.cz>\
++\
++The PCI Utilities package contains a library for portable access to PCI bus configuration registers and several utilities based on this library.\
++\
++You also might want to look at the pciutils web page containing release notes and other news: http://mj.ucw.cz/pciutils.shtml .\
++\
++You will now be guided through the steps necessary to install this software.}
+Index: pciutils-3.1.7/osx/pciutils.pmdoc/01root.xml
+===================================================================
+--- pciutils-3.1.7/osx/pciutils.pmdoc/01root.xml
++++ pciutils-3.1.7/osx/pciutils.pmdoc/01root.xml
+@@ -0,0 +1,24 @@
++<pkgref spec="1.12" uuid="94522C23-7BEF-4761-8AA3-4FE2E2784DB7">
++    <config>
++        <identifier>com.pciutils.pciutils.pkg</identifier>
++	<version>1</version>
++	<description></description>
++	<post-install type="none"/>
++        <requireAuthorization/>
++        <installFrom relative="true" mod="true">../root/</installFrom>
++        <flags>
++            <followSymbolicLinks/>
++        </flags>
++        <packageStore type="internal"></packageStore>
++	<mod>parent</mod>
++	<mod>installFrom.path</mod>
++	<mod>identifier</mod>
++    </config>
++    <contents>
++	<filter>/CVS$</filter>
++	<filter>/\.svn$</filter>
++	<filter>/\.cvsignore$</filter>
++	<filter>/\.cvspass$</filter>
++	<filter>/\.DS_Store$</filter>
++    </contents>
++</pkgref>
+Index: pciutils-3.1.7/osx/pciutils.pmdoc/index.xml
+===================================================================
+--- pciutils-3.1.7/osx/pciutils.pmdoc/index.xml
++++ pciutils-3.1.7/osx/pciutils.pmdoc/index.xml
+@@ -0,0 +1,53 @@
++<pkmkdoc spec="1.12">
++    <properties>
++        <title>PCI Utilities</title>
++	<build>pciutils.pkg</build>
++	<organization>com.pciutils</organization>
++	<userSees ui="easy"/>
++        <min-target os="2"/>
++        <domain system="true"/>
++    </properties>
++    <distribution>
++        <versions min-spec="1.000000"/><scripts>
++            function CheckHardwareCompatibility() {
++            if (system.sysctl('hw.machine') == 'i386') {
++            return true;
++            }
++            
++            if (system.sysctl('hw.machine') == 'x86_64') {
++            return true;
++            }
++            
++            return false;
++            }
++        </scripts>
++    </distribution>
++    <description>The PCI Utilities package contains a library for portable access to PCI bus configuration registers and several utilities based on this library.
++    </description>
++    <contents>
++        <choice title="PCI Utilities" id="choice0" starts_selected="true" starts_enabled="true" starts_hidden="false">
++            <pkgref id="com.pciutils.pciutils.pkg"/>
++        </choice>
++    </contents>
++    <resources bg-scale="none" bg-align="bottomleft">
++        <locale lang="en">
++	    <resource relative="true" mod="true" type="license">../COPYING</resource>
++	    <resource relative="true" mod="true" type="welcome">Welcome.rtf</resource>
++        </locale>
++    </resources>
++    <requirements>
++        <requirement id="java" operator="eq" value="true">
++            <argument>CheckHardwareCompatibility()</argument>
++	    <message-title>Unsupported Architecture</message-title>
++	    <message>PCI utilities are only supported on Intel® based Apple systems.</message>
++        </requirement>
++    </requirements>
++    <flags/>
++    <item type="file">01root.xml</item>
++    <mod>properties.userDomain</mod>
++    <mod>properties.systemDomain</mod>
++    <mod>properties.anywhereDomain</mod>
++    <mod>properties.title</mod>
++    <mod>description</mod>
++    <mod>postinstallActions.actions</mod>
++</pkmkdoc>
+Index: pciutils-3.1.7/lib/i386-io-darwin.h
+===================================================================
+--- pciutils-3.1.7/lib/i386-io-darwin.h
++++ pciutils-3.1.7/lib/i386-io-darwin.h
+@@ -0,0 +1,30 @@
++/*
++ * Copyright (C) 2008-2010 coresystems GmbH
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
++ */
++
++#include <DirectHW/DirectHW.h>
++
++static int intel_setup_io(struct pci_access *a __attribute__((unused)))
++{
++	return !iopl(0);
++}
++
++static int intel_cleanup_io(struct pci_access *a __attribute__((unused)))
++{
++	return 1;
++}
++
+Index: pciutils-3.1.7/lib/configure
+===================================================================
+--- pciutils-3.1.7/lib/configure
++++ pciutils-3.1.7/lib/configure
+@@ -8,9 +8,9 @@
+ echo_n() {
+ 	if [ -n "$BASH" ]
+ 	then
+-		echo -n "$*"
++		/bin/echo -n "$*"
+ 	else
+-		echo "$*\c"
++		/bin/echo "$*\c"
+ 	fi
+ }
+ 
+@@ -124,6 +124,12 @@
+ 		echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+ 		echo >>$m 'WITH_LIBS+=-lioperm'
+ 		;;
++	darwin)
++		echo_n " i386-ports"
++		echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
++		echo >>$c '#define PCI_HAVE_64BIT_ADDRESS'
++		echo >>$m 'WITH_LIBS+=-framework DirectHW'
++		;;
+         *)
+ 		echo " Unfortunately, your OS is not supported by the PCI Library"
+ 		exit 1
+Index: pciutils-3.1.7/lib/i386-ports.c
+===================================================================
+--- pciutils-3.1.7/lib/i386-ports.c
++++ pciutils-3.1.7/lib/i386-ports.c
+@@ -22,6 +22,8 @@
+ #include "i386-io-windows.h"
+ #elif defined(PCI_OS_CYGWIN)
+ #include "i386-io-cygwin.h"
++#elif defined(PCI_OS_DARWIN)
++#include "i386-io-darwin.h"
+ #else
+ #error Do not know how to access I/O ports on this OS.
+ #endif

Added: trunk/macosx/patches/superiotool-r6440.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/macosx/patches/superiotool-r6440.diff	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1,28 @@
+Index: superiotool-r6440/superiotool.h
+===================================================================
+--- superiotool-r6440/superiotool.h
++++ superiotool-r6440/superiotool.h
+@@ -33,8 +33,8 @@
+ #include <sys/io.h>
+ #endif
+ #if (defined(__MACH__) && defined(__APPLE__))
+-/* DirectIO is available here: http://www.coresystems.de/en/directio */
+-#include <DirectIO/darwinio.h>
++/* DirectHW is available here: http://www.coreboot.org/DirectHW */
++#include <DirectHW/DirectHW.h>
+ #endif
+ 
+ #ifdef PCI_SUPPORT
+Index: superiotool-r6440/Makefile
+===================================================================
+--- superiotool-r6440/Makefile
++++ superiotool-r6440/Makefile
+@@ -37,7 +37,7 @@
+ 
+ OS_ARCH = $(shell uname)
+ ifeq ($(OS_ARCH), Darwin)
+-LIBS = -framework IOKit -framework DirectIO -lpci -lz
++LIBS = -framework IOKit -framework DirectHW -lpci -lz
+ endif
+ ifeq ($(OS_ARCH), FreeBSD)
+ CFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \

Added: trunk/windows/README
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/windows/README	Mon Mar 14 03:21:55 2011	(r1)
@@ -0,0 +1 @@
+work in progress




More information about the coreboot mailing list