Subject: Re: e/net card recognition at boot
To: charlie allom <charlie@pobox.com>
From: Bob Nestor <rnestor@augustmail.com>
List: port-mac68k
Date: 10/15/1999 18:23:05
charlie allom (charlie@pobox.com) wrote:
>At 6:13 PM -0500 15/10/99, Bob Nestor wrote:
>>If anyone wants the source code of this I'd be happy to accomidate them.
>>The program could use some work though since I stopped working on it when
>>I was able to give Allen enough info to get my card up and running.
>
>i wouldn't mind seeing if i could use it on my system bob, seeing as
>getting a MacOS partition near this mac will take me a while....
Like I said, it's not much but here it is:
#include <stdio.h>
#define BLOCK_SIZE 0x8000L
#define SLOT_SIZE 0x400000L
void main(void)
{
volatile long int *addr, *probe_addr;
long int i, j, k, value, test_value, new_value, mem_type;
FILE *dump;
int blocks[SLOT_SIZE/BLOCK_SIZE], num_blocks = SLOT_SIZE/BLOCK_SIZE;
long int dead_blocks[] = {0x400000};
struct {
long int start;
long int size;
} known[] = {{0x0, 0x100}, {0x40000, 0x20}, {0x80000, 0x140}};
char match, *types[] = {"16-bit ROM", "32-bit ROM", "16-bit Registers",
"32-bit Registers", "16-bit RAM", "32-bit RAM"};
addr = (long int *)0xfe000000;
for (i=0;i<num_blocks;i++)
blocks[i] = -1;
if ((dump = fopen("slot-diff", "w+")) == NULL) {
printf("Can't open output file\n");
return;
}
/*
* Dump the know areas first
*/
for (i=0; i<sizeof(known)/sizeof(known[0]);i++) {
printf ("Dump of block 0x%08lx", (long int)addr+known[i].start);
for (j=0;j<known[i].size;j+=4) {
probe_addr = addr+(j+known[i].start)/4;
if (((j/4) % 4) == 0)
printf ("\n0x%08lx: ", (long int)probe_addr);
printf ("0x%08lx ", *probe_addr);
}
printf("\n");
}
printf ("Probing for Registers and RAM\n");
for (i=0;i<SLOT_SIZE;i+=4) {
value = (long int)*(addr+i);
*(addr+j) = 0xffffffff;
new_value = (long int)*(addr+i);
if (value != new_value) {
if (value == 0xffffffff)
printf (" Location 0x%08lx appears to be RAM\n", (long
int)addr+j);
else
printf (" Location 0x%08lx appears to be Registers\n",
(long int)addr+i);
}
}
fclose(dump);
printf("Done.\n");
}