Short: Patches bugs in PCMCIA system V1.2 Author: artpo@wp.pl (Artur Pogoda) Uploader: artpo wp pl (Artur Pogoda) Type: util/boot Version: 1.2 Replaces: util/boot/CardPatch Requires: Kickstart 37.299+, A600/A1200 Architecture: m68k-amigaos Installation: Copy CardPatch to C: directory. Add "CardPatch" line to your Startup-Sequence or User-Startup. If you use CardPatch you need not use the opencnet patch. Description: When a PC Card is plugged in the PCMCIA slot and cnet.device is not run then Amiga system slows. CardPatch patches this "slow bug" and other bugs in card.resource. The CardResetCard() function is patched and each "new" card is reseted after it is inserted in the PCMCIA slot. Slow bug: If any program is run in the address space of $xxA00000 through $xxA3FFFF (where xx is any address of a CPU address bus on any turbo board), then GAYLE asserts the _CC_REG signal into the PCMCIA slot (pin 61). GAYLE does it regardless of the A24-A31 lines of the address bus and the _AS signal of the CPU. If a 16-bit PC Card is plugged in the PCMCIA slot then this card, in reply to the _CC_REG signal, drives the WP/_IOIS16 line to a low level ("write protect" line - pin 33 of the PCMCIA slot) and GAYLE generates a level 2 interrupt. CardPatch disables these interrupts but does not disable the write protect input (and GAYLE function). You can still read a level on this input by the ReadCardStatus() function but interrupts are not generated by any change of level on this input. This interrupt can be used by some PCMCIA devices for an identification for 8/16-bit cards. Therefore CardPatch can cause a problem with old turbo boards (4MB Fast RAM in ZorroII space) and with some rare PCMCIA hardware. In the developers' documentation for the PCMCIA system is the note as follows: " ...carddisk.device uses status change interrupts to note changes in the WRITE-PROTECT pin... " But regardless of the note, it is impossible to use any interrupt from this pin at present turbo boards. CardResetCard(): This function is patched by CardPatch but it will work (and will return TRUE) only if it is called from a task and not from a Forbid()/Permit() or Disable()/Enable() program space. If any condition described above is broken this function will return FALSE and the reset operation on a PC Card will not be done. CardPatch task: This task is added to Amiga system and it will reset each PC Card after it is inserted in the PCMCIA slot. Interrupt servers: Both card.resource interrupt servers are overwritten and the priority numbers of them are changed. The new interrupt server level 2 has priority number 125 and the new interrupt server level 6 has priority number -120. The PCMCIA slot is not blocked now after a PC Card is removed from it. Other changes: A bug in ReleaseCard() has been patched. This function sets bit 7 in the cah_CardFlags byte of the CardHandle structure and does not clear it later. This bit (flag), when is seted, causes that the CardHandle structure is "dead" in the owners list, and is unable to any choice for the owner of a PC Card. When a card is removed from the PCMCIA slot, card.resource clears the bits in all CardHandle structures of the owners list, and it causes that the structures are again able to a choise for the owner of a PC Card, when a card will be inserted in the slot. Each device which has received the cah_CardInserted interrupt, must examine the "new" PC Card and must call ReleaseCard() if is not interested in the card. Then a next device will be chosen from the owners list. CardPatch in versions 1.0 and 1.1 always clears bit 7 when ReleaseCard() is called and the protocol described above is corrupt. CardPatch in version 1.2 clears bit 7 only when ReleaseCard() is called with the CARDB_REMOVEHANDLE flag. This can be important when previously released the CardHandle structure is used again by the OwnCard() function with the CARDB_DELAYOWNERSHIP flag. A little bug in CardForceChange() has been patched, too. History: V1.0 - First Aminet release. V1.1 - Short: Patched bugs in CardPatch V1.0 ...and nothing more ;) Thanks to Luca "Hexaae" Longone for your constructive bug report. V1.2 - ReleaseCard() clears bit 7 in the cah_CardFlags byte of the CardHandle structure, only when it is called with the CARDB_REMOVEHANDLE flag. CacheClearU() is used against CacheClearE() (present in version 1.1) which cleared only the instruction cache. It could cause problems on systems with 68040 or 68060 processor working in the copyback mode.