diff options
-rw-r--r-- | drivers/nubus/nubus.c | 111 |
1 files changed, 5 insertions, 106 deletions
diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c index 77a48a5164ff..f879a0f78b14 100644 --- a/drivers/nubus/nubus.c +++ b/drivers/nubus/nubus.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/nubus.h> | 13 | #include <linux/nubus.h> |
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/delay.h> | ||
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
19 | #include <asm/setup.h> | 18 | #include <asm/setup.h> |
@@ -34,14 +33,6 @@ extern void oss_nubus_init(void); | |||
34 | 33 | ||
35 | #define NUBUS_TEST_PATTERN 0x5A932BC7 | 34 | #define NUBUS_TEST_PATTERN 0x5A932BC7 |
36 | 35 | ||
37 | /* Define this if you like to live dangerously - it is known not to | ||
38 | work on pretty much every machine except the Quadra 630 and the LC | ||
39 | III. */ | ||
40 | #undef I_WANT_TO_PROBE_SLOT_ZERO | ||
41 | |||
42 | /* This sometimes helps combat failure to boot */ | ||
43 | #undef TRY_TO_DODGE_WSOD | ||
44 | |||
45 | /* Globals */ | 36 | /* Globals */ |
46 | 37 | ||
47 | struct nubus_dev *nubus_devices; | 38 | struct nubus_dev *nubus_devices; |
@@ -454,10 +445,6 @@ nubus_get_functional_resource(struct nubus_board *board, int slot, | |||
454 | pr_info(" Function 0x%02x:\n", parent->type); | 445 | pr_info(" Function 0x%02x:\n", parent->type); |
455 | nubus_get_subdir(parent, &dir); | 446 | nubus_get_subdir(parent, &dir); |
456 | 447 | ||
457 | /* Apple seems to have botched the ROM on the IIx */ | ||
458 | if (slot == 0 && (unsigned long)dir.base % 2) | ||
459 | dir.base += 1; | ||
460 | |||
461 | pr_debug("%s: parent is 0x%p, dir is 0x%p\n", | 448 | pr_debug("%s: parent is 0x%p, dir is 0x%p\n", |
462 | __func__, parent->base, dir.base); | 449 | __func__, parent->base, dir.base); |
463 | 450 | ||
@@ -691,83 +678,6 @@ static int __init nubus_get_board_resource(struct nubus_board *board, int slot, | |||
691 | return 0; | 678 | return 0; |
692 | } | 679 | } |
693 | 680 | ||
694 | /* Attempt to bypass the somewhat non-obvious arrangement of | ||
695 | sResources in the motherboard ROM */ | ||
696 | static void __init nubus_find_rom_dir(struct nubus_board* board) | ||
697 | { | ||
698 | unsigned char *rp; | ||
699 | unsigned char *romdir; | ||
700 | struct nubus_dir dir; | ||
701 | struct nubus_dirent ent; | ||
702 | |||
703 | /* Check for the extra directory just under the format block */ | ||
704 | rp = board->fblock; | ||
705 | nubus_rewind(&rp, 4, board->lanes); | ||
706 | if (nubus_get_rom(&rp, 4, board->lanes) != NUBUS_TEST_PATTERN) { | ||
707 | /* OK, the ROM was telling the truth */ | ||
708 | board->directory = board->fblock; | ||
709 | nubus_move(&board->directory, | ||
710 | nubus_expand32(board->doffset), | ||
711 | board->lanes); | ||
712 | return; | ||
713 | } | ||
714 | |||
715 | /* On "slot zero", you have to walk down a few more | ||
716 | directories to get to the equivalent of a real card's root | ||
717 | directory. We don't know what they were smoking when they | ||
718 | came up with this. */ | ||
719 | romdir = nubus_rom_addr(board->slot); | ||
720 | nubus_rewind(&romdir, ROM_DIR_OFFSET, board->lanes); | ||
721 | dir.base = dir.ptr = romdir; | ||
722 | dir.done = 0; | ||
723 | dir.mask = board->lanes; | ||
724 | |||
725 | /* This one points to an "Unknown Macintosh" directory */ | ||
726 | if (nubus_readdir(&dir, &ent) == -1) | ||
727 | goto badrom; | ||
728 | |||
729 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | ||
730 | printk(KERN_INFO "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | ||
731 | /* This one takes us to where we want to go. */ | ||
732 | if (nubus_readdir(&dir, &ent) == -1) | ||
733 | goto badrom; | ||
734 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | ||
735 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | ||
736 | nubus_get_subdir(&ent, &dir); | ||
737 | |||
738 | /* Resource ID 01, also an "Unknown Macintosh" */ | ||
739 | if (nubus_readdir(&dir, &ent) == -1) | ||
740 | goto badrom; | ||
741 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | ||
742 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | ||
743 | |||
744 | /* FIXME: the first one is *not* always the right one. We | ||
745 | suspect this has something to do with the ROM revision. | ||
746 | "The HORROR ROM" (LC-series) uses 0x7e, while "The HORROR | ||
747 | Continues" (Q630) uses 0x7b. The DAFB Macs evidently use | ||
748 | something else. Please run "Slots" on your Mac (see | ||
749 | include/linux/nubus.h for where to get this program) and | ||
750 | tell us where the 'SiDirPtr' for Slot 0 is. If you feel | ||
751 | brave, you should also use MacsBug to walk down the ROM | ||
752 | directories like this function does and try to find the | ||
753 | path to that address... */ | ||
754 | if (nubus_readdir(&dir, &ent) == -1) | ||
755 | goto badrom; | ||
756 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | ||
757 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | ||
758 | |||
759 | /* Bwahahahaha... */ | ||
760 | nubus_get_subdir(&ent, &dir); | ||
761 | board->directory = dir.base; | ||
762 | return; | ||
763 | |||
764 | /* Even more evil laughter... */ | ||
765 | badrom: | ||
766 | board->directory = board->fblock; | ||
767 | nubus_move(&board->directory, nubus_expand32(board->doffset), board->lanes); | ||
768 | printk(KERN_ERR "nubus_get_rom_dir: ROM weirdness! Notify the developers...\n"); | ||
769 | } | ||
770 | |||
771 | /* Add a board (might be many devices) to the list */ | 681 | /* Add a board (might be many devices) to the list */ |
772 | static struct nubus_board * __init nubus_add_board(int slot, int bytelanes) | 682 | static struct nubus_board * __init nubus_add_board(int slot, int bytelanes) |
773 | { | 683 | { |
@@ -828,8 +738,11 @@ static struct nubus_board * __init nubus_add_board(int slot, int bytelanes) | |||
828 | * since the initial Macintosh ROM releases skipped the check. | 738 | * since the initial Macintosh ROM releases skipped the check. |
829 | */ | 739 | */ |
830 | 740 | ||
831 | /* Attempt to work around slot zero weirdness */ | 741 | /* Set up the directory pointer */ |
832 | nubus_find_rom_dir(board); | 742 | board->directory = board->fblock; |
743 | nubus_move(&board->directory, nubus_expand32(board->doffset), | ||
744 | board->lanes); | ||
745 | |||
833 | nubus_get_root_dir(board, &dir); | 746 | nubus_get_root_dir(board, &dir); |
834 | 747 | ||
835 | /* We're ready to rock */ | 748 | /* We're ready to rock */ |
@@ -849,9 +762,6 @@ static struct nubus_board * __init nubus_add_board(int slot, int bytelanes) | |||
849 | nubus_get_board_resource(board, slot, &ent); | 762 | nubus_get_board_resource(board, slot, &ent); |
850 | } | 763 | } |
851 | 764 | ||
852 | /* Aaaarrrrgghh! The LC III motherboard has *two* board | ||
853 | resources. I have no idea WTF to do about this. */ | ||
854 | |||
855 | while (nubus_readdir(&dir, &ent) != -1) { | 765 | while (nubus_readdir(&dir, &ent) != -1) { |
856 | struct nubus_dev *dev; | 766 | struct nubus_dev *dev; |
857 | struct nubus_dev **devp; | 767 | struct nubus_dev **devp; |
@@ -922,10 +832,6 @@ void __init nubus_scan_bus(void) | |||
922 | { | 832 | { |
923 | int slot; | 833 | int slot; |
924 | 834 | ||
925 | /* This might not work on your machine */ | ||
926 | #ifdef I_WANT_TO_PROBE_SLOT_ZERO | ||
927 | nubus_probe_slot(0); | ||
928 | #endif | ||
929 | for (slot = 9; slot < 15; slot++) { | 835 | for (slot = 9; slot < 15; slot++) { |
930 | nubus_probe_slot(slot); | 836 | nubus_probe_slot(slot); |
931 | } | 837 | } |
@@ -943,13 +849,6 @@ static int __init nubus_init(void) | |||
943 | via_nubus_init(); | 849 | via_nubus_init(); |
944 | } | 850 | } |
945 | 851 | ||
946 | #ifdef TRY_TO_DODGE_WSOD | ||
947 | /* Rogue Ethernet interrupts can kill the machine if we don't | ||
948 | do this. Obviously this is bogus. Hopefully the local VIA | ||
949 | gurus can fix the real cause of the problem. */ | ||
950 | mdelay(1000); | ||
951 | #endif | ||
952 | |||
953 | /* And probe */ | 852 | /* And probe */ |
954 | pr_info("NuBus: Scanning NuBus slots.\n"); | 853 | pr_info("NuBus: Scanning NuBus slots.\n"); |
955 | nubus_devices = NULL; | 854 | nubus_devices = NULL; |