home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 255.lha / SetCPU_v1.5 / SetCPU.txt < prev    next >
Text File  |  1989-06-12  |  16KB  |  353 lines

  1.  
  2.               SetCPU V1.5
  3.         Copyright 1989 by Dave Haynie
  4.  
  5.  
  6.     SetCPU V1.5 is my third program designed for identification and
  7. modification of system parameters roughly related to different versions of 
  8. the Motorola 68000 family processors.  The program will identify the 
  9. various types of processors and coprocessors in any 680x0 system up to
  10. 68030/68882 systems.  It also makes an attempt to correctly identify an
  11. incorrectly designed but still functional 68020 system, several of which
  12. are known to exist as Amiga coprocessor boards.  It contains MMU code to 
  13. locate kernel ROM in write protected 32 bit ROM, with several optional 
  14. patches to that ROM.
  15.  
  16.     In any case, the syntax of the program is given as follows:
  17.  
  18.     SetCPU [INST|DATA] [[NO]CACHE|[NO]BURST] [CONFIG n]
  19.            [KICKROM path|dfN:] [VERBOSE] [CARDROM path]
  20.                [[NO]FASTROM [KEYPATCH n] [NOPATCH]] [TRAP n]
  21.                [HEAD] [CHECK 680x0|68851|6888x|MMU|FPU]
  22.  
  23. where "[]" indicates an optional parameter, "|" indicates a choice of
  24. parameters.  Typing "SetCPU ?" will retrieve this same syntax diagram.
  25. Typing SetCPU alone will result in the SYSTEM configuration being 
  26. send to the console, my current system returns this:
  27.  
  28.     SYSTEM: 68030 68882 FASTROM (INST: CACHE NOBURST) (DATA: NOCACHE NOBURST)
  29.  
  30. This indicates I have a 68030/68882 system, I've previously installed the 
  31. FASTROM translation, and my instruction cache is turned on (done by AmigaOS 
  32. V1.2 or V1.3).  Note that any parameters that don't make sense to the real 
  33. system configuration, such as asking to modify the data cache on a 68020 
  34. system or install the FASTROM translation on a 68000 system are just ignored.
  35.  
  36. [0] DISTRIBUTION
  37.  
  38.     This program may be distributed by any means as long as there are
  39. no charges specifically for the program.  Charges for downloading from
  40. electronic BBS systems, or charges for copying and media for freely 
  41. redistributable software libraries are certainly permissible.  Permission
  42. for any commercial distributions are negotiable; please contact me
  43. (eg, the author) if you're interested.
  44.  
  45. [1] CPU IDENTIFICATION
  46.  
  47.     There are two basic types of functions performed by SetCPU.  The 
  48. first of these is CPU system identification and cache control.  SetCPU will 
  49. tell about the type of CPU setup in your machine, which consists of the CPU
  50. itself and sometimes FPU or MMU coprocessors.  If the CPU supports caches,
  51. SetCPU will let you switch these caches, and associated cache line burst mode,
  52. on and off.  Finally, SetCPU can be used in a Startup-Sequence or other script
  53. to make decisions based on the system that's running.  This is quite useful 
  54. with accelerator cards like the Commodore A2620 that let you boot the machine
  55. with either 68020 or 68000 in charge.  The individual CPU group commands are 
  56. given below in detail:
  57.  
  58. [NO]CACHE
  59.     This command will switch on or off 68020 and 68030 caches.  If not 
  60.     qualified, it'll act on both instruction and data caches of the 68030.
  61.  
  62. [NO]BURST
  63.     This command will switch on or off the burst cache line fill request 
  64.     of the 68030.  If not qualified, it'll act on both instruction and 
  65.     data caches.
  66.  
  67. INST
  68.     This qualifies a CACHE or BURST operation to restrict it's application
  69.     to the instruction cache only.
  70.  
  71. DATA
  72.     This qualifies a CACHE or BURST operation to restrict it's application
  73.     to the data cache only.
  74.  
  75. CHECK 
  76.     This option lets you check for the existence of a particular CPU 
  77.     system component in a script.  It works like this:
  78.  
  79.         SetCPU CHECK 68020
  80.         If WARN
  81.             echo "No 68020 here!"
  82.         Else
  83.             echo "Sho nuff got a 68020 here!"
  84.         Endif
  85.  
  86.     The arguments to CHECK can be any of:
  87.  
  88.         68000    Matches the obvious
  89.         68010    "
  90.         68020    "
  91.         68030    "
  92.         68851    "
  93.         68881    "
  94.         68882    "
  95.         FPU    Matches 68881 or 68882
  96.         MMU    Matches 68851 or 68030
  97.  
  98. If any cache parameter doesn't apply to the system in use, it'll just be
  99. ignored.  Use the data cache and all burst modes with caution.  Some 
  100. 68030 systems aren't designed to correctly support the data cache, so
  101. switching it on may cause an instant system crash.  Even on systems that
  102. correctly support the 68030 data cache, some device drivers, especially
  103. those for DMA devices, may not work properly with the data cache enabled.
  104. You may wish to check with your system vendors to make sure before using
  105. the data cache in your standard system setup.
  106.  
  107.     SetCPU may report a "FPU Logic Error" on certain 68020 systems.  
  108. This is indicating a hardware problem with that board's floating point 
  109. coprocessor decoding, which results in the FPU responding to the MMU 
  110. addresses as well as it's own.  SetCPU knows how to handle such a board,
  111. but future software using the MMU may not, so it's a good idea to report
  112. this problem to the board vendor for repair.
  113.  
  114.  
  115. [2] ROM TRANSLATIONS
  116.  
  117.     The second thing that SetCPU V1.5 manages are ROM translations.  
  118. Using the MMU on systems so equipped, it can locate the Kernel ROM in the
  119. much faster 32 bit wide memory provided on many 32 bit systems.  It can
  120. also boot a ROM based system with an alternate version of KickStart.
  121. Most of the options here relate to MMU translation setup and various 
  122. modifications of the basic translation premise.
  123.  
  124.     As of this release, SetCPU's MMU configurations will support
  125. memory outside of the 68000's 24 bit address space, when it's present.
  126. In order for such memory to be recognized by SetCPU, it must be linked
  127. into the system free memory pool via AddMem (or any equivalent program)
  128. before SetCPU has been run.  SetCPU will only build MMU tables large
  129. enough to handle the amount of RAM at the time the MMU table is built,
  130. so running AddMem after an MMU translation is in effect can cause a 
  131. problem.  Since the KICKROM table is built before rebooting, use of
  132. AddMem won't be a problem after rebooting on the new OS, providing the
  133. same memory is added that was around when the KICKROM operation was
  134. started.
  135.  
  136. [NO]FASTROM
  137.     This activates the FASTROM translation on or off an MMU equipped 
  138.     system.  When switching on, it first allocates 256K of memory for
  139.     the ROM image, then at least 512 bytes of memory for the MMU table.
  140.     It copies the ROM into the image area, then applies the translation
  141.     by pointing the MMU at the table and activating it.  The NOFASTROM 
  142.     option will switch off the MMU and reclaim the memory used for the 
  143.     ROM image and MMU table.  If any other program set up the MMU
  144.     for something, this could be a very bad thing to do.  In general, 
  145.     until there's some level of OS support for the MMU in Amiga systems, 
  146.     you're really safe using only one MMU tool at a time.  If you have
  147.     an A2620 system, this option will always get 32 bit memory for you,
  148.     if not, you'll have to make sure that your 32 bit memory is the
  149.     first MEMF_FAST memory in the memory list for it to be used for the
  150.     ROM image.  Also, that ROM image will be allocated as far back on
  151.     that memory list as possible unless the "HEAD" option is specified.
  152.     The SetCPU "SYSTEM" line will report this setup as a "FASTROM" setup.
  153.  
  154. Suboptions are:
  155.  
  156.     KEYPATCH n
  157.         This will patch the keyboard scanning routine for machines 
  158.         that have Cherry keyboards (small function keys).  The "n"
  159.         parameter allows a variable delay between 1 and 100 to be
  160.         specified; the delay depends on the keyboard, but should
  161.         be pretty independent of CPU speed.
  162.     
  163.     NOPATCH
  164.         This prevents the normal ROM patches from being applied.
  165.         Normally the Workbench screen message is patched to say
  166.         "FastBench", as a visual indication that the FastROM 
  167.         routines are installed.  These patches are currently only
  168.         available under the release 1.3 Kernel.
  169.  
  170. CARDROM path
  171.  
  172.     When used in conjunction with the FASTROM option, this allows ROMs
  173.     from expansion cards to be located in fast memory as well.  The
  174.     path should reference a file containing lists of expansion cards
  175.     that should be translated if found.  It's necessary to read this
  176.     from a user-defined file, rather than from the expansion environment
  177.     itself, since an expansion device's ROM could be located close to
  178.     that device's registers; there's no way for SetCPU to know it's
  179.     safe to translate a card ROM image unless you tell it.  On my system
  180.     I read a file called CardROMList, which currently contains the single
  181.     line:
  182.  
  183.         0x202 0x01 0x10000 0x8000 0x4000 CBM_2090A_Disk_Controller
  184.  
  185.     All the numbers given are in C language hex format.  The parameters
  186.     are, in order, the device's manufacturer code, product code, the
  187.     device's size (in bytes), the ROM's offset from the configured board's
  188.     base address (in bytes), and the size of the ROM area to be
  189.     translated (in bytes).  The final item is text string to identify
  190.     the device; this'll be displayed by the VERBOSE option if the ROM
  191.     translation does in fact take place.  The "_" characters in the
  192.     name will be translated to " " characters.
  193.  
  194. HEAD
  195.     This option causes the SetCPU memory allocator to attempt memory
  196.     allocation for it's translated objects from the start of 32 bit
  197.     memory instead from the end, as it usually does.  Allocation from 
  198.     the end usually results in less fragmentation than from the start
  199.     (due to the alignment restrictions of MMU objects), though this
  200.     option is useful when dealing with merged memory lists.  It is
  201.     ignored when the ROM image and tables are in chip/$00C00000 memory.
  202.  
  203. KICKROM path|dfN:
  204.  
  205.     The KickROM option allows the system to be restarted with an
  206.     alternate ROM image.  This can be from a KickStart disk in a
  207.     specified floppy drive, or from a given file name.  If the
  208.     ROM image is accessible, this command will cause the system to
  209.     be immediately rebooted into the new OS.  Note that pre-1.3
  210.     versions of the Amiga operating system will probably have some
  211.     trouble with expansion cards, especially autoboot cards.  For
  212.     that reason there's the CONFIG 0 option, which is explained
  213.     later.
  214.  
  215.     The KICKROM command will reboot the machine with the new OS, but
  216.     that ROM image will be physically located in either memory at
  217.     $00C00000, if it's available, or chip memory, otherwise.  Once the
  218.     new OS has started up, issuing either "SetCPU FASTROM ..." or
  219.     "SetCPU KICKROM..." will cause that image to be moved into fast
  220.     memory, and the slow memory will be given back to the system.  The
  221.     SetCPU "SYSTEM" line will report a 16 bit KickROM image as a
  222.     "SLOWKICK", and a 32 bit KickROM image as a "FASTKICK".  A machine
  223.     running from a SLOWKICK kernel can't be re-KICKROMed, but can be
  224.     from a FASTKICK kernel.
  225.  
  226. CONFIG n
  227.     This option controls if and how expansion devices are recognized on 
  228.     a KICKROM boot.  At the default configuration level, level 2, the
  229.     expansion cards are left alone, allowing the new Kernel to try and
  230.     configure them.  Since some older operating system will choke on 
  231.     autoboot devices, this option will allow suppression of them for the
  232.     rebooting process.  When requesting a KICKROM boot, a CONFIG level
  233.     of 0 or 1 will prevent the devices from being recoginzed.
  234.  
  235.     Once rebooted in the new OS, moving from a SLOW    to a FAST Kick image,
  236.     as described above, the CONFIG status will be honored.  If the
  237.     devices weren't suppressed, nothing special happens.  If they were,
  238.     they'll stay suppressed, and you very likely won't have the memory
  239.     to support a FAST Kick image.  Specifying a CONFIG level of 2 at
  240.     this point will attempt to configure the devices without autobooting.
  241.     At level 1, the devices will be made visable to the system again,
  242.     but nothing will be done with them.
  243.  
  244.     As of the SetCPU V1.5 Gamma 6 release, CONFIG 0 appears to be 
  245.     required with the 1.2 operating system, at least if there's any
  246.     autoboot device, even if you're attempting to move from a slow to
  247.     fast kick image.  The next release will attempt to allow 1.2 to
  248.     configure non-autobooting devices at this point.
  249.  
  250. TRAP n
  251.     This option controls the level of error trapping handled for 
  252.     you by the SetCPU system.  The numeric parameter is actually 
  253.     optional for compatibility with SetCPU V1.4.  If no TRAP is 
  254.     specified, the default level 2 is enacted.  If the TRAP command is 
  255.     given without a parameter, trap level 0 will be setup.  
  256.  
  257.     Trap level 0 causes the MMU to look at all 32 bits of address;
  258.     access to any memory outside of the 24 bit space will result
  259.     in an exception, which if unhandled, results in a GURU 2.  Trap
  260.     level 1 will set up the MMU to only look at 24 bits of address space. 
  261.     Trap level 2 works like level 1, but additionally sets up a trap
  262.     handler for the Bus Error exception (which usually surfaces as a
  263.     GURU #2).  For normal operation (eg, running other people's code),
  264.     Trap level 2 is probably what you want.  For final testing of your
  265.     own code, levels 0 or 1 can catch things which would go unnoticed
  266.     on a 68000 machine, such as writing to ROM space or out of the 24
  267.     bit address space.
  268.  
  269.     The exception handler used for level 2 trapping catches things like
  270.     writes to protected areas of memory.  It just tells the bus machine
  271.     not to complete the write, and signals no error.  There's a slight
  272.     chance that this won't be enough repair for a program doing something
  273.     really outlandish -- at that point, running at level 1 will let the
  274.     GURU happen, which might help if you're debugging your own code.  
  275.     Other that that, there's probably nothing you can do to get such a
  276.     program working with the MMU turned on, other than having it fixed.
  277.     The other thing to consider is that this exception handler could
  278.     conflict with another system-level handler installed by a GOMF-like
  279.     program.  That shouldn't cause a big problem, since you'll the one
  280.     that was installed later, both of which presumably trap the error,
  281.     but it's something to be aware of.
  282.  
  283.     Under V1.3 and earlier releases, a DOS bug can cause invalid accesses,
  284.     which cause the exception, when running the EndCLI or NewCLI/NewShell 
  285.     programs; running at level 1 or 2 will avoid gurus with these commands.
  286.  
  287. VERBOSE    
  288.     This option more fully describes the system translations. 
  289.  
  290.  
  291. [3] CREDITS
  292.  
  293.     While this program is an entirely original work, nothing happens in
  294. vaccuum, this one included.  I'd like to mention folks who, directly or
  295. indirectly, helped make this thing happen:
  296.  
  297.     - Neil Katin, for writing some original MMU code while still working
  298.       at Commodore-Amiga.  His example got me started with SetCPU V1.4,
  299.       and while I never tried the version that supposedly worked a bit
  300.       like my KICKROM option, that nevertheless gave me confidence that
  301.       it could be done.
  302.  
  303.     - Jez San, for his "KeyHack" program.  First of all, KeyHack served
  304.       to take some of the heat off of SetCPU 1.4 for those folks with
  305.       the older German keyboards.  Secondly, with KeyHack installed on
  306.       my system, I knew where to look for the patch location.  
  307.  
  308.     - Bryce Nesbitt, Andy Finkel, and the other Commodore-Amiga software
  309.       folks, for giving me both the initial and final push toward making
  310.       the KICKROM stuff work.  For about 24 hour I got to be the gating
  311.       factor for both hardware and software efforts.  Fortunately, it
  312.       didn't last longer than that.  Bryce also gave me the secret to
  313.       reasonably CPU-speed independent software timing loops that don't
  314.       count on a living OS.  I shoulda figured that one out myself.
  315.  
  316.     - The rather numerous lot of beta testers, who during the rather
  317.       long testing period of SetCPU V1.5, found all kinds of horrible
  318.       and stupid screwups.  It should be pretty sound at this point,
  319.       if not absolutely perfect.  Undoubtedly worth the money.
  320.  
  321. [4] A FINAL NOTE
  322.  
  323.     I should point out here that much of what SetCPU does may be wrong in
  324. a future release of the OS.  Things like identifying the MMU, CPU, or FPU that
  325. aren't fully done in 1.3 may still work in a future OS release, but if that OS
  326. is correctly identifying the MMU, CPU (eg, 68020 vs. 68030), or FPU (eg, 68881
  327. vs. 68882), SetCPU should be using the OS's opinion of these items, not 
  328. testing them itself.  On a more drastic tack, if an OS ever starts using the
  329. MMU, the FASTROM and other MMU code will almost certainly break.  It's the job
  330. of the OS to arbitrate the MMU, and if the OS is doing that, no legal program 
  331. would be able to come along and muck with the MMU registers without reeking 
  332. havoc on the operating system.
  333.  
  334.     Finally, if you wish to contact me regarding bug reports, new
  335. releases, contributions of cash or macadamia nuts, or pretty much anything
  336. else, I can be reached at the below addresses.  I expect to at the very
  337. least maintain the 
  338.  
  339.  
  340.  
  341.             -Dave Haynie
  342.  
  343.         Logical Address:
  344.              PLINK:        D-Dave H
  345.              bix:        hazy
  346.              usenet:    {uunet,rutgers}!cbmvax!daveh
  347.  
  348.         Physical Address (after June 26):
  349.  
  350.              284 Memorial Drive
  351.              Gibbstown, NJ
  352.              08027
  353.