*
* @APPLE_LICENSE_HEADER_START@
*
- * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ * The contents of this file constitute Original Code as defined in and
+ * are subject to the Apple Public Source License Version 1.1 (the
+ * "License"). You may not use this file except in compliance with the
+ * License. Please obtain a copy of the License at
+ * http://www.apple.com/publicsource and read it before using this file.
*
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This Original Code and all software distributed under the License are
+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include <pexpert/pexpert.h>
#include <pexpert/ppc/powermac.h>
#include <pexpert/device_tree.h>
-
-/* External declarations */
-
-unsigned int LockTimeOut = 12500000;
+#include <vm/pmap.h>
/* pe_identify_machine:
*
return 0;
}
-boolean_t PE_init_ethernet_debugger(void)
+vm_offset_t PE_find_scc(void)
{
- boolean_t result;
-#if 0
- DTEntry entryP;
- vm_offset_t *address;
- unsigned char *netAddr;
- int size;
- vm_offset_t io;
-
- if ((io = get_io_base_addr())
- && (DTFindEntry("name", "mace", &entryP) == kSuccess)
- && (DTGetProperty(entryP, "local-mac-address", (void **)&netAddr, &size) == kSuccess)
- && (DTGetProperty(entryP, "reg", (void **)&address, &size) == kSuccess)
- && (size == (2 * 3 * sizeof(vm_offset_t)) ))
- {
- extern boolean_t kdp_mace_init(void *baseAddresses[3],
- unsigned char *netAddr);
- void *maceAddrs[3];
-
- // address calculation not correct
- maceAddrs[0] = (void *) io_map(io + address[0], address[1]);
- maceAddrs[1] = (void *) io_map(io + address[2], 0x1000);
- maceAddrs[2] = (void *) (((vm_offset_t)maceAddrs[1])
- + address[4] - address[2]);
- result = kdp_mace_init( maceAddrs, netAddr );
-
- } else
-#endif
- result = FALSE;
-
- return result;
+ vm_offset_t io, sccadd;
+ DTEntry entryP;
+ vm_offset_t *sccregs;
+ unsigned int sccrsize;
+
+ if(!(io = get_io_base_addr())) { /* Get the I/O controller base address */
+ return (vm_offset_t)0; /* Hmmm, no I/O??? What gives??? How'd we even boot? */
+ }
+
+
+/* Note: if we find a escc-legacy, we need to kind of hack because it can be either an offset
+ into the iobase or the actual address itself. ORint the two should provide the correct
+ for either */
+
+ sccadd = 0; /* Assume none for now */
+
+ if(DTFindEntry("name", "escc-legacy", &entryP) == kSuccess) { /* Find the old fashioned serial port */
+ if (DTGetProperty(entryP, "reg", (void **)&sccregs, &sccrsize) == kSuccess) { /* Do we have some registers? */
+ sccadd = ((vm_offset_t)*sccregs | io); /* Get the address */
+ }
+ }
+
+ if(DTFindEntry("name", "escc", &entryP) == kSuccess) { /* Well, see if we just have the new fangled one */
+ sccadd = io + 0x12000; /* Yeah, but still return the oldie goldie... */
+ }
+
+ return sccadd; /* Return it if you found it */
}
-vm_offset_t PE_find_scc(void)
+unsigned int PE_init_taproot(vm_offset_t *taddr)
{
- vm_offset_t io;
- DTEntry entryP;
-
- if ((io = get_io_base_addr())
- && (DTFindEntry("name", "escc", &entryP) == kSuccess))
- io += 0x12000; /* Offset to legacy SCC Registers */
- else
- io = 0;
-
- return io;
+ DTEntry entryP;
+ vm_offset_t *tappdata;
+ unsigned int tappsize;
+
+
+ if(DTFindEntry("name", "memory-map", &entryP) != kSuccess) return 0; /* no memory map */
+
+ if (DTGetProperty(entryP, "TapRoot", (void **)&tappdata, &tappsize) != kSuccess) return 0; /* No TapRoot */
+
+ tappdata[1] = (tappdata[1] + 4095 ) & -4096; /* Make sure this is a whole page */
+
+ *taddr = io_map_spec(tappdata[0], tappdata[1], VM_WIMG_IO); /* Map it in and return the address */
+ tappdata[0] = *taddr; /* Also change property */
+ return tappdata[1]; /* And the size */
}