Updated Zorro-LAN-IDE Driver to 2.15
- Multicast fixes - new Microchip OUIs added to verification table
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
set up MMU for flash access using mmu.library
|
||||
|
||||
(C) 2022 Henryk Richter
|
||||
|
||||
The F0 area (0xF00000-0xF7ffff) is known to be
|
||||
reserved by Commodore for diagnostic ROMs (or
|
||||
BootROMs), as well as additional kickstart modules.
|
||||
|
||||
Some configurations of the MMU will mark this
|
||||
area as ROM such that write attempts are inhibited
|
||||
by the processor itself.
|
||||
|
||||
This code will revert any existing remapping (to
|
||||
RAM) and set up useable cache flags such that the
|
||||
Flash can be written to.
|
||||
|
||||
*/
|
||||
#define __NOLIBBASE__
|
||||
#include <proto/mmu.h>
|
||||
#include <mmu/context.h>
|
||||
#include <mmu/mmutags.h>
|
||||
#include "debug.h"
|
||||
#include "mmustuff.h"
|
||||
|
||||
|
||||
//extern struct Library *MMUBase;
|
||||
//extern struct DosLibrary *DOSBase;
|
||||
|
||||
#define CACHEFLAGS (MAPP_CACHEINHIBIT|MAPP_COPYBACK|MAPP_NONSERIALIZED|MAPP_IMPRECISE)
|
||||
|
||||
#define ROMFLAGS (MAPP_CACHEINHIBIT|MAPP_GLOBAL|MAPP_IO|MAPP_USER0)
|
||||
#define ROMCFLAGS (MAPP_CACHEINHIBIT|MAPP_COPYBACK|MAPP_NONSERIALIZED|MAPP_IMPRECISE|MAPP_GLOBAL|MAPP_IO|MAPP_WRITEPROTECTED|MAPP_ROM|MAPP_INVALID)
|
||||
|
||||
#ifdef __VBCC__
|
||||
#define BCAST
|
||||
#else
|
||||
#define BCAST (ULONG)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
set up MMU as I/O space from "base", "size" bytes,
|
||||
keep flags==0 for now
|
||||
|
||||
the device pointer is used to fetch the MMUbase from it, nothing more
|
||||
*/
|
||||
ASM SAVEDS LONG setupMMU( ASMR(a0) void *base ASMREG(a0),
|
||||
ASMR(d0) LONG size ASMREG(d0),
|
||||
ASMR(d1) ULONG flags ASMREG(d1),
|
||||
ASMR(a6) DEVBASEP ASMREG(a6) )
|
||||
{
|
||||
struct MMUContext *ctx,*sctx; /* default context, supervisor context */
|
||||
ULONG props;
|
||||
struct MinList *ctxl,*sctxl;
|
||||
struct TagItem tgs[2] = {{TAG_DONE,0},{TAG_DONE,0} };
|
||||
|
||||
if( !MMUBase )
|
||||
return 1; /* cannot setup MMU without MMULib */
|
||||
|
||||
ctx=DefaultContext();
|
||||
sctx=SuperContext(ctx);
|
||||
|
||||
props = GetPropertiesA(sctx,BCAST base,tgs);
|
||||
props |= GetPropertiesA(sctx,BCAST base,tgs);
|
||||
|
||||
D(( (STRPTR)"Current MMU props on 0x%lx area: 0x%lx\n",(ULONG)base,props));
|
||||
|
||||
LockContextList();
|
||||
LockMMUContext(ctx);
|
||||
LockMMUContext(sctx);
|
||||
|
||||
if( (props & MAPP_REMAPPED) )
|
||||
{
|
||||
D(( (STRPTR)"Memory was remapped elsewhere, reverting to physical location\n" ));
|
||||
|
||||
if( (ctxl=GetMapping(ctx)))
|
||||
{
|
||||
if( (sctxl=GetMapping(sctx)))
|
||||
{
|
||||
if( SetPropertiesA(ctx,0,MAPP_REMAPPED|CACHEFLAGS,BCAST base,size,tgs) )
|
||||
{
|
||||
if( SetPropertiesA(sctx,0,MAPP_REMAPPED|CACHEFLAGS,BCAST base,size,tgs) )
|
||||
{
|
||||
}
|
||||
}
|
||||
ReleaseMapping(sctx,sctxl);
|
||||
}
|
||||
ReleaseMapping(ctx,ctxl);
|
||||
}
|
||||
}
|
||||
|
||||
/* set desired flags */
|
||||
SetPropertiesA(ctx,ROMFLAGS,ROMCFLAGS, BCAST base,size,tgs);
|
||||
SetPropertiesA(sctx,ROMFLAGS,ROMCFLAGS,BCAST base,size,tgs);
|
||||
|
||||
RebuildTrees(ctx,sctx,NULL);
|
||||
|
||||
UnlockMMUContext(sctx);
|
||||
UnlockMMUContext(ctx);
|
||||
UnlockContextList();
|
||||
|
||||
props = GetPropertiesA(sctx,BCAST base,tgs);
|
||||
props |= GetPropertiesA(sctx,BCAST base,tgs);
|
||||
D(( (STRPTR)"New MMU props on 0x%lx area: 0x%lx\n",(ULONG)base,props));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user