diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2004-04-16 22:54:49 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2004-04-16 22:54:49 +0000 |
commit | fb717a85e2ef17d39904d37fbff048b7cb5a9382 (patch) | |
tree | 0352463f9fd2b972a9fa8543ed33146ea719e52c /sys | |
parent | f44f84bdfb4cf00f2356f5cd28cf677c29f98971 (diff) |
probe correct amount of RAM on cards that have 64KB memory
>From: NetBSD
tested by Martin Reindl and nick@.
ok nick@.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mac68k/dev/if_ae.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/sys/arch/mac68k/dev/if_ae.c b/sys/arch/mac68k/dev/if_ae.c index 6cf639e4821..210686ee915 100644 --- a/sys/arch/mac68k/dev/if_ae.c +++ b/sys/arch/mac68k/dev/if_ae.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ae.c,v 1.21 2003/03/12 19:11:02 jason Exp $ */ +/* $OpenBSD: if_ae.c,v 1.22 2004/04/16 22:54:48 xsa Exp $ */ /* $NetBSD: if_ae.c,v 1.62 1997/04/24 16:52:05 scottr Exp $ */ /* @@ -80,7 +80,7 @@ ae_size_card_memory(bst, bsh, ofs) bus_space_handle_t bsh; int ofs; { - int i1, i2, i3, i4; + int i1, i2, i3, i4, i8; /* * banks; also assume it will generally mirror in upper banks @@ -90,11 +90,29 @@ ae_size_card_memory(bst, bsh, ofs) i2 = (8192 * 1); i3 = (8192 * 2); i4 = (8192 * 3); + i8 = (8192 * 4); - bus_space_write_2(bst, bsh, ofs + i1, 0x1111); - bus_space_write_2(bst, bsh, ofs + i2, 0x2222); - bus_space_write_2(bst, bsh, ofs + i3, 0x3333); + bus_space_write_2(bst, bsh, ofs + i8, 0x8888); bus_space_write_2(bst, bsh, ofs + i4, 0x4444); + bus_space_write_2(bst, bsh, ofs + i3, 0x3333); + bus_space_write_2(bst, bsh, ofs + i2, 0x2222); + bus_space_write_2(bst, bsh, ofs + i1, 0x1111); + + /* + * 1) If the memory range is decoded completely, it does not + * matter what we write first: High tags written into + * the void are lost. + * 2) If the memory range is not decoded completely (banks are + * mirrored), high tags are overwritten by lower ones. + * 3) Lazy implementation of pathological cases - none found yet. + */ + + if (bus_space_read_2(bst, bsh, ofs + i1) == 0x1111 && + bus_space_read_2(bst, bsh, ofs + i2) == 0x2222 && + bus_space_read_2(bst, bsh, ofs + i3) == 0x3333 && + bus_space_read_2(bst, bsh, ofs + i4) == 0x4444 && + bus_space_read_2(bst, bsh, ofs + i8) == 0x8888) + return 8192 * 8; if (bus_space_read_2(bst, bsh, ofs + i1) == 0x1111 && bus_space_read_2(bst, bsh, ofs + i2) == 0x2222 && |