02 August 2014, 15:10 | #1 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
CyberStormPPC/BlizzardPPC register information reversing
I am still stuck with undocumented register bits..
PPC code first does something (reads and writes to FFF0xxxx memory which appears to work correctly), then it does following CyberstormPPC/BlizzardPPC register writes: Write 0x85 to F60030 (IPL EMU) Write 0x85 to F60030 Write 0x85 to F60030 Write 0x85 to F60030 Write 0x01 to F60020 (LOCK) Above PPC code looks very boring, all written values are hardcoded: (Yes, PPC disassembler has been added. Unfortunately.) Code:
FFF04964 38000085 li r0, 133 FFF04968 98040030 stb r0, 48 (r4) FFF0496C 7C0004AC sync FFF04970 98040030 stb r0, 48 (r4) FFF04974 7C0004AC sync FFF04978 98040030 stb r0, 48 (r4) FFF0497C 7C0004AC sync FFF04980 98040030 stb r0, 48 (r4) FFF04984 7C0004AC sync FFF04988 38000001 li r0, 1 FFF0498C 98040020 stb r0, 32 (r4) FFF04990 4C00012C isync FFF04994 7C0004AC sync FFF04998 4E800020 blr LOCK bit 0 is totally undocumented. I assume it is some kind of strobe bit for triggering interrupt. But what kind of interrupt? I tried to trigger m68k level 2 interrupt (m68k has PPC related interrupt added), setting correct bits in F60008 so that interrupt handler accepts it but unfortunately interrupt handler only gets confused and accesses uninitialized memory. So apparently it isn't expecting interrupt, at least not yet. BPPC boot PPC code and ppctest.dms PowerUP test run identical code sequence. Last edited by Toni Wilen; 06 August 2014 at 08:36. |
04 August 2014, 14:43 | #2 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
As you know, unfortunately nothing is official. This is reverse engineered information, which I have found in AmigaOS4, Linux and NetBSD. I even wrote most of the NetBSD code for the CSPPC-port myself, but it is not working very well... Quote:
On CSPPC/BPPC Amigas there can be only one interrupt master CPU. Either the M68k is interrupted or the PPC. It can be controlled by the P5_INT_MASTER bit (when clearing the bit, the master is PPC). In PowerUp/WarpOS mode the interrupt master is still the M68k, while in a PPC-OS (OS4, NetBSD, Linux) the interrupt master is the PPC. As I understand, depending on the master-bit, you use either the P5_M68k_IPLn or P5_PPC_IPLn mask. A PPC interrupt master will use these lines to directly set the IPLn lines on the mainboard, which the disabled M68k no longer can do. This means when the PPC receives a serial level 6 interrupt it has to set P5_PPC_IPLn to 6, exactly like a M68k would do. I can only guess about the M68k-master mode. I think the P5_M68K_IPLn bits only reflects the status of the M68k SR register, in case the PPC needs it. Quote:
Writing to IPL_LVL...? Hmm. No. My guess is that you can use it to enable which individual interrupt levels are allowed to trigger the PPC's external interrupt line. In NetBSD I'm enabling all levels on startup. May be only relevant for PPC interrupt master mode. Last edited by phx; 04 August 2014 at 14:46. Reason: MSR EE, not IE. |
|||
04 August 2014, 15:06 | #3 | |||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
F60008 bits 2 and 3 are most likely PPC to M68K interrupt output enable and active bit (just like bits 0 and 1 are enable/active bits for SCSI interrupt), causing m68k int level 2 when both are active. Quote:
Quote:
|
|||
04 August 2014, 15:53 | #4 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Quote:
By using P5_PPC_IPL the PPC just emulates the missing M68k SR register. So writing to it masks out lower interrupt levels in the same way as the M68k could do by writing SR. Quote:
|
|||
04 August 2014, 21:52 | #5 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
ppctest.dms WarpOS test now passes!
It seems INT_LVL isn't for allowing/not allowing interrupts, I think it is used to activate PPC interrupt: If any bit 0 to 6 is active in INT_LVL AND IPL_EMU is less than any active INT_LVL interrupt number AND P5_ENABLE_IPL is active: PPC CPU interrupt line becomes active. (active as in bit is cleared, active low). This allows WarpOS test to work. It sets INT_LVL to 0x7f (all inactive), enables P5_ENABLE_IPL, sets IPL_EMU to 7 (IPL level 0). Later when 68k code wants to wake up PPC code, it clears INT_LVL bit 0. PPC interrupt code runs which sets it back to one. PowerUP does it totally differently.. btw, I guess this method only works when 68K is interrupt master. (68k gets "real" Paula interrupts) |
05 August 2014, 11:43 | #6 | ||||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Code:
Bit 7 set/clear Bit 3 PPC to M68k interrupt request? (active low?) Bit 2 PPC to M68k interrupt enable (active low?) Bit 1 SCSI interrupt request (active low?) Bit 0 SCSI interrupt enable (active low?) Quote:
So P5_ENABLE_IPL=0 enables the function of IPL_EMU and INT_LVL. But which part of IPL_EMU are you talking about? M68K_IPL or PPC_IPL? Quote:
Quote:
The INT_LVL bits are always set to 0x7f under OS4 and NetBSD. No idea what happens when you manipulate them there with a PPC interrupt master. I guess that P5_ENABLE_IPL was inactive, when INT_LVL was used to store keycodes? |
||||
05 August 2014, 12:44 | #7 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
I think this topic should be separate. Moved from beta thread. (EDIT: I'll reply to your question later)
Last edited by Toni Wilen; 05 August 2014 at 12:50. |
05 August 2014, 16:19 | #8 | ||||||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
||||||
05 August 2014, 20:34 | #9 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Did some real CSPPC tests.
REG_LOCK: Bit 0 is the only one that can be changed. (Write 0x81 -> gets set to 1 and 0x01 -> cleared). Other bits won't change. This register is normally used to unlock flash chip write mode by writing "magic" values in sequence. (0x60, 0x50, 0x30) IPL_EMU m68k IPL bits seems to be stuck at 7, writing won't change them, reading them in interrupt routine (I used level 3) still returned 7.. Even when ENABLE_IPL was active. DISABLE_INT bit is also stuck at 1. So apparently it is read-only too and perhaps DISABLE_INT and m68k IPL bits only work when PPC is active? (Or maybe even when PPC is interrupt master?) REG_IRQ: Clearing both bits 3 and 4 (not 2 and 3) are confirmed causing an interrupt. System froze when I cleared both Bits 2 and 5 can be also set or cleared. Bit 6 is stuck at zero. Speculation mode: PowerUP does something more if I trigger PPC interrupt when bit 0 is active (zero). PPC interrupt code sets it back to one which probably means it really should cause PPC interrupt. But the problem is that it is PPC code that clears this bit, PPC interrupting itself, why? (And after some interrupt it logs unexpected external interrupt crash information to serial port. Nothing appears on screen) BlizzardPPC flash unlock is totally different. REG_LOCK most likely only has single function, bit 0 + bit 3 is always set as a "I am BPPC" identification bit that for example flash updater checks. Write $42 to $f60092: write-enable flash, write to $f60093: read-only flash. Also maprom works differently, write $f60012: maprom on, write to $f60013: maprom off. |
05 August 2014, 21:08 | #10 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Some more information I got from various sources:
Reset sequence CSPPC (from NetBSD, OS4): Code:
P5_REG_LOCK = P5_MAGIC1|P5_MAGIC2; P5_REG_LOCK = P5_MAGIC1|P5_MAGIC3; P5_REG_LOCK = P5_MAGIC2|P5_MAGIC3; P5_REG_SHADOW = P5_SELF_RESET; P5_REG_RESET = P5_AMIGA_RESET; I'm not sure why this sequence is required and what SELF_RESET is for. Tests show that clearing P5_AMIGA_RESET is sufficient to reset the system. There seems to be no set/clear bit 7 in P5_REG_LOCK (?). The other known bit in REG_SHADOW is P5_SHADOW (Bit 0). It may be for mirroring the last 512K of Fast-RAM at 0xfff00000. But after booting in 68k mode the register is 0x4f here, which means SHADOW is inactive? But the mirror at 0xfff00000 is present. So my guess may be wrong. Edit: Tests show that clearing P5_SHADOW makes the system crash hard. It stays dead even after a normal keyboard reset. You need to press CTRL-Amiga-Amiga 10 seconds to wake it up again. Probably it is a ROM-shadow to copy the ROM somewhere into Fast RAM? Difference in BPPC reset routine: Before the unlocking the BPPC needs P5_BPPC_MAGIC = 0. Code sequence to take over the PPC, after initializing the PPC's reset vector (I used it in my NetBSD bootloader, taken from Linux APUS): Code:
P5_REG_RESET = P5_PPC_RESET; P5_REG_INT = P5_ENABLE_IPL; P5_REG_ENABLE = 0xa8; P5_REG_ENABLE = 0x10; P5_IPL_EMU = P5_SET_CLEAR | P5_DISABLE_INT; P5_REG_RESET = P5_SET_CLEAR | P5_REG_RESET; 1. Set bits 3 and 5. 2. Clear bit 4. Bit 3 would be a PPC to M68k interrupt request? Makes no sense here. Another interesting fact is that P5_DISABLE_INT seems to be active high, in contrast to most other bits. Last edited by phx; 05 August 2014 at 21:20. Reason: More details for P5_SHADOW and BPPC reset |
05 August 2014, 21:48 | #11 | |||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
Quote:
Quote:
Map rom not enabled: FFF00000 is last 512k of fast ram. You can copy KS ROM here and then enable map rom, if you want. Or to last 512k. (BlizKick writes to FFF00000) Map rom enabled: FFF00000 is second to last 512k of fast ram. last 512k of fast ram is used for kickstart mirror. This is not mirrored in FFFxxxxx anymore. (I have read all publicly available sources many times already) |
|||
05 August 2014, 21:57 | #12 | ||||||||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Oh... missed your new posting, while writing mine.
Quote:
Quote:
Do you know at which address the flash is written after that. Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Very good progress in reengineering here. |
||||||||
05 August 2014, 22:19 | #13 | ||||||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
I am quite sure this bit only does something when PPC is active. Quote:
Remember that "write-enable" only means flash chip sees write accesses, flash chip still needs flash write or erase access sequence to actually write anything. Just check any compatible flash chip datasheet to see how programming works. (29F010 or 29F040 for example) BPPC does not have flash enable bit here, it has separate registers (as I said above) Also because BPPC has 512k flash (vs 128k in Cyberstorms), it has extra flash mapping, if SCSI is disabled (P5_SCSI_RESET is cleared), flash also appear at $f40000-$f5ffff, this space is mostly used, very tiny part at $f5c000 is used for config saving only. Apparently last 128k of flash is always unmapped. At least flash updater only writes first 384k of flash. Quote:
My REG_IRQ = f60008. Quote:
Quote:
Quote:
|
||||||
06 August 2014, 09:42 | #14 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
As you know everything which was publically known, and more by reengineering, there is probably nothing left I could help you with. But nevertheless I'm very curious to find out about every detail of the register set to document it.
Quote:
Can you give more details about the address ranges of the Flash? Quote:
For the purpose of documentation, can you please repeat which are the enable-bits and which are the request-bits? |
||
06 August 2014, 11:24 | #15 | ||||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
Quote:
$f50000-$f5ffff (and apparently also $f70000-$f7ffff) is something unknown, possibly related to memory controller configuration because boot rom code writes to all kinds of addreses in this space and after each write it does memory check. I assume it configures memory (SIMM) layout and boot code searches for memory layout that creates best memory space layout (due to different size SIMMs). Or something like that. This does not need emulating. Quote:
f6xxxx is always board register io. Quote:
|
||||
06 August 2014, 12:07 | #16 |
Italian Amiga Zealot
Join Date: Jan 2009
Location: Italy
Age: 36
Posts: 1,910
|
Maybe Sam Jordan (the author of WarpOS) could help you, Toni? I've found his email address...
|
06 August 2014, 12:54 | #17 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Is it sufficient to run PPC code with M68k interrupt master? Thanks for the details. |
|
06 August 2014, 13:02 | #18 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
I knew him very good during his Amiga time (I wrote the WarpOS memory management and ppclibemu for him). I talked last to Sam more than four years ago. He left the Amiga more than a decade ago. He even left software development and earned a degree in Physics at a dutch University, where he probably is still working. Nevertheless, even if he could remember anything, which I doubt, he took the same reengineering approach as Toni does now. Only Ralph Schmidt and a few other Phase5 employees have the real information. |
|
06 August 2014, 13:03 | #19 | |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
Quote:
|
|
06 August 2014, 13:10 | #20 | |
Italian Amiga Zealot
Join Date: Jan 2009
Location: Italy
Age: 36
Posts: 1,910
|
Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
HELP cyberstormppc failure!!!!! | klapdeur | support.Hardware | 2 | 01 January 2010 13:02 |
Identifying CyberstormPPC | THX1138 | support.Hardware | 6 | 12 May 2007 17:00 |
CyberstormPPC card for A4000 | macce2 | MarketPlace | 71 | 13 February 2007 01:28 |
cyberstormPPC users, SCSI issues | superBuster | support.Hardware | 28 | 07 December 2006 20:36 |
For sale: CyberStormPPC 233 - 060/50 | martin-flash | MarketPlace | 13 | 16 June 2005 11:53 |
|
|