diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-02 13:10:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-02 13:10:52 -0400 |
commit | ceb198bb007b84ead867e87a71ffe715c4412b15 (patch) | |
tree | 2d933558cdef1f0e8e7f8efed8b1444a5558fa04 | |
parent | b68e7e952f24527de62f4768b1cead91f92f5f6e (diff) | |
parent | f6ab4d59a5fe205f12287e515a43fc5e6de779b1 (diff) |
Merge tag 'm68k-for-v4.12-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
Pull m68k updates from Geert Uytterhoeven:
- more kernel message modernizations and cleanups
- Mac and Nubus improvements and cleanups.
* tag 'm68k-for-v4.12-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
nubus: Add MVC and VSC video card definitions
nubus: Clean up whitespace
nubus: Clean up printk calls
nubus: Fix nubus_rewinddir
m68k/mac: Clarify IOP message alloc/free confusion
m68k/mac: Adopt platform_device_register_simple()
m68k/mac: Modernize printing of kernel messages
m68k/mac: IOP - Modernize printing of kernel messages
-rw-r--r-- | arch/m68k/mac/config.c | 61 | ||||
-rw-r--r-- | arch/m68k/mac/iop.c | 93 | ||||
-rw-r--r-- | arch/m68k/mac/misc.c | 23 | ||||
-rw-r--r-- | drivers/nubus/nubus.c | 459 | ||||
-rw-r--r-- | include/uapi/linux/nubus.h | 4 |
5 files changed, 278 insertions, 362 deletions
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 9dc65a4c28d2..22123f7e8f75 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c | |||
@@ -150,7 +150,7 @@ static void mac_cache_card_flush(int writeback) | |||
150 | void __init config_mac(void) | 150 | void __init config_mac(void) |
151 | { | 151 | { |
152 | if (!MACH_IS_MAC) | 152 | if (!MACH_IS_MAC) |
153 | printk(KERN_ERR "ERROR: no Mac, but config_mac() called!!\n"); | 153 | pr_err("ERROR: no Mac, but config_mac() called!!\n"); |
154 | 154 | ||
155 | mach_sched_init = mac_sched_init; | 155 | mach_sched_init = mac_sched_init; |
156 | mach_init_IRQ = mac_init_IRQ; | 156 | mach_init_IRQ = mac_init_IRQ; |
@@ -837,8 +837,7 @@ static void __init mac_identify(void) | |||
837 | /* no bootinfo model id -> NetBSD booter was used! */ | 837 | /* no bootinfo model id -> NetBSD booter was used! */ |
838 | /* XXX FIXME: breaks for model > 31 */ | 838 | /* XXX FIXME: breaks for model > 31 */ |
839 | model = (mac_bi_data.cpuid >> 2) & 63; | 839 | model = (mac_bi_data.cpuid >> 2) & 63; |
840 | printk(KERN_WARNING "No bootinfo model ID, using cpuid instead " | 840 | pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n"); |
841 | "(obsolete bootloader?)\n"); | ||
842 | } | 841 | } |
843 | 842 | ||
844 | macintosh_config = mac_data_table; | 843 | macintosh_config = mac_data_table; |
@@ -880,14 +879,13 @@ static void __init mac_identify(void) | |||
880 | */ | 879 | */ |
881 | iop_preinit(); | 880 | iop_preinit(); |
882 | 881 | ||
883 | printk(KERN_INFO "Detected Macintosh model: %d\n", model); | 882 | pr_info("Detected Macintosh model: %d\n", model); |
884 | 883 | ||
885 | /* | 884 | /* |
886 | * Report booter data: | 885 | * Report booter data: |
887 | */ | 886 | */ |
888 | printk(KERN_DEBUG " Penguin bootinfo data:\n"); | 887 | printk(KERN_DEBUG " Penguin bootinfo data:\n"); |
889 | printk(KERN_DEBUG " Video: addr 0x%lx " | 888 | printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n", |
890 | "row 0x%lx depth %lx dimensions %ld x %ld\n", | ||
891 | mac_bi_data.videoaddr, mac_bi_data.videorow, | 889 | mac_bi_data.videoaddr, mac_bi_data.videorow, |
892 | mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF, | 890 | mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF, |
893 | mac_bi_data.dimensions >> 16); | 891 | mac_bi_data.dimensions >> 16); |
@@ -912,7 +910,7 @@ static void __init mac_identify(void) | |||
912 | 910 | ||
913 | static void __init mac_report_hardware(void) | 911 | static void __init mac_report_hardware(void) |
914 | { | 912 | { |
915 | printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name); | 913 | pr_info("Apple Macintosh %s\n", macintosh_config->name); |
916 | } | 914 | } |
917 | 915 | ||
918 | static void mac_get_model(char *str) | 916 | static void mac_get_model(char *str) |
@@ -921,15 +919,6 @@ static void mac_get_model(char *str) | |||
921 | strcat(str, macintosh_config->name); | 919 | strcat(str, macintosh_config->name); |
922 | } | 920 | } |
923 | 921 | ||
924 | static struct resource swim_rsrc = { .flags = IORESOURCE_MEM }; | ||
925 | |||
926 | static struct platform_device swim_pdev = { | ||
927 | .name = "swim", | ||
928 | .id = -1, | ||
929 | .num_resources = 1, | ||
930 | .resource = &swim_rsrc, | ||
931 | }; | ||
932 | |||
933 | static const struct resource mac_scsi_iifx_rsrc[] __initconst = { | 922 | static const struct resource mac_scsi_iifx_rsrc[] __initconst = { |
934 | { | 923 | { |
935 | .flags = IORESOURCE_IRQ, | 924 | .flags = IORESOURCE_IRQ, |
@@ -994,26 +983,6 @@ static const struct resource mac_scsi_ccl_rsrc[] __initconst = { | |||
994 | }, | 983 | }, |
995 | }; | 984 | }; |
996 | 985 | ||
997 | static struct platform_device esp_0_pdev = { | ||
998 | .name = "mac_esp", | ||
999 | .id = 0, | ||
1000 | }; | ||
1001 | |||
1002 | static struct platform_device esp_1_pdev = { | ||
1003 | .name = "mac_esp", | ||
1004 | .id = 1, | ||
1005 | }; | ||
1006 | |||
1007 | static struct platform_device sonic_pdev = { | ||
1008 | .name = "macsonic", | ||
1009 | .id = -1, | ||
1010 | }; | ||
1011 | |||
1012 | static struct platform_device mace_pdev = { | ||
1013 | .name = "macmace", | ||
1014 | .id = -1, | ||
1015 | }; | ||
1016 | |||
1017 | int __init mac_platform_init(void) | 986 | int __init mac_platform_init(void) |
1018 | { | 987 | { |
1019 | u8 *swim_base; | 988 | u8 *swim_base; |
@@ -1045,9 +1014,13 @@ int __init mac_platform_init(void) | |||
1045 | } | 1014 | } |
1046 | 1015 | ||
1047 | if (swim_base) { | 1016 | if (swim_base) { |
1048 | swim_rsrc.start = (resource_size_t) swim_base, | 1017 | struct resource swim_rsrc = { |
1049 | swim_rsrc.end = (resource_size_t) swim_base + 0x2000, | 1018 | .flags = IORESOURCE_MEM, |
1050 | platform_device_register(&swim_pdev); | 1019 | .start = (resource_size_t)swim_base, |
1020 | .end = (resource_size_t)swim_base + 0x2000, | ||
1021 | }; | ||
1022 | |||
1023 | platform_device_register_simple("swim", -1, &swim_rsrc, 1); | ||
1051 | } | 1024 | } |
1052 | 1025 | ||
1053 | /* | 1026 | /* |
@@ -1057,13 +1030,13 @@ int __init mac_platform_init(void) | |||
1057 | switch (macintosh_config->scsi_type) { | 1030 | switch (macintosh_config->scsi_type) { |
1058 | case MAC_SCSI_QUADRA: | 1031 | case MAC_SCSI_QUADRA: |
1059 | case MAC_SCSI_QUADRA3: | 1032 | case MAC_SCSI_QUADRA3: |
1060 | platform_device_register(&esp_0_pdev); | 1033 | platform_device_register_simple("mac_esp", 0, NULL, 0); |
1061 | break; | 1034 | break; |
1062 | case MAC_SCSI_QUADRA2: | 1035 | case MAC_SCSI_QUADRA2: |
1063 | platform_device_register(&esp_0_pdev); | 1036 | platform_device_register_simple("mac_esp", 0, NULL, 0); |
1064 | if ((macintosh_config->ident == MAC_MODEL_Q900) || | 1037 | if ((macintosh_config->ident == MAC_MODEL_Q900) || |
1065 | (macintosh_config->ident == MAC_MODEL_Q950)) | 1038 | (macintosh_config->ident == MAC_MODEL_Q950)) |
1066 | platform_device_register(&esp_1_pdev); | 1039 | platform_device_register_simple("mac_esp", 1, NULL, 0); |
1067 | break; | 1040 | break; |
1068 | case MAC_SCSI_IIFX: | 1041 | case MAC_SCSI_IIFX: |
1069 | /* Addresses from The Guide to Mac Family Hardware. | 1042 | /* Addresses from The Guide to Mac Family Hardware. |
@@ -1129,10 +1102,10 @@ int __init mac_platform_init(void) | |||
1129 | 1102 | ||
1130 | switch (macintosh_config->ether_type) { | 1103 | switch (macintosh_config->ether_type) { |
1131 | case MAC_ETHER_SONIC: | 1104 | case MAC_ETHER_SONIC: |
1132 | platform_device_register(&sonic_pdev); | 1105 | platform_device_register_simple("macsonic", -1, NULL, 0); |
1133 | break; | 1106 | break; |
1134 | case MAC_ETHER_MACE: | 1107 | case MAC_ETHER_MACE: |
1135 | platform_device_register(&mace_pdev); | 1108 | platform_device_register_simple("macmace", -1, NULL, 0); |
1136 | break; | 1109 | break; |
1137 | } | 1110 | } |
1138 | 1111 | ||
diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c index 7990b6f50105..4c1e606e7d03 100644 --- a/arch/m68k/mac/iop.c +++ b/arch/m68k/mac/iop.c | |||
@@ -115,7 +115,17 @@ | |||
115 | #include <asm/macints.h> | 115 | #include <asm/macints.h> |
116 | #include <asm/mac_iop.h> | 116 | #include <asm/mac_iop.h> |
117 | 117 | ||
118 | /*#define DEBUG_IOP*/ | 118 | #ifdef DEBUG |
119 | #define iop_pr_debug(fmt, ...) \ | ||
120 | printk(KERN_DEBUG "%s: " fmt, __func__, ##__VA_ARGS__) | ||
121 | #define iop_pr_cont(fmt, ...) \ | ||
122 | printk(KERN_CONT fmt, ##__VA_ARGS__) | ||
123 | #else | ||
124 | #define iop_pr_debug(fmt, ...) \ | ||
125 | no_printk(KERN_DEBUG "%s: " fmt, __func__, ##__VA_ARGS__) | ||
126 | #define iop_pr_cont(fmt, ...) \ | ||
127 | no_printk(KERN_CONT fmt, ##__VA_ARGS__) | ||
128 | #endif | ||
119 | 129 | ||
120 | /* Non-zero if the IOPs are present */ | 130 | /* Non-zero if the IOPs are present */ |
121 | 131 | ||
@@ -200,7 +210,7 @@ static int iop_alive(volatile struct mac_iop *iop) | |||
200 | return retval; | 210 | return retval; |
201 | } | 211 | } |
202 | 212 | ||
203 | static struct iop_msg *iop_alloc_msg(void) | 213 | static struct iop_msg *iop_get_unused_msg(void) |
204 | { | 214 | { |
205 | int i; | 215 | int i; |
206 | unsigned long flags; | 216 | unsigned long flags; |
@@ -219,11 +229,6 @@ static struct iop_msg *iop_alloc_msg(void) | |||
219 | return NULL; | 229 | return NULL; |
220 | } | 230 | } |
221 | 231 | ||
222 | static void iop_free_msg(struct iop_msg *msg) | ||
223 | { | ||
224 | msg->status = IOP_MSGSTATUS_UNUSED; | ||
225 | } | ||
226 | |||
227 | /* | 232 | /* |
228 | * This is called by the startup code before anything else. Its purpose | 233 | * This is called by the startup code before anything else. Its purpose |
229 | * is to find and initialize the IOPs early in the boot sequence, so that | 234 | * is to find and initialize the IOPs early in the boot sequence, so that |
@@ -268,10 +273,10 @@ void __init iop_init(void) | |||
268 | int i; | 273 | int i; |
269 | 274 | ||
270 | if (iop_scc_present) { | 275 | if (iop_scc_present) { |
271 | printk("IOP: detected SCC IOP at %p\n", iop_base[IOP_NUM_SCC]); | 276 | pr_info("IOP: detected SCC IOP at %p\n", iop_base[IOP_NUM_SCC]); |
272 | } | 277 | } |
273 | if (iop_ism_present) { | 278 | if (iop_ism_present) { |
274 | printk("IOP: detected ISM IOP at %p\n", iop_base[IOP_NUM_ISM]); | 279 | pr_info("IOP: detected ISM IOP at %p\n", iop_base[IOP_NUM_ISM]); |
275 | iop_start(iop_base[IOP_NUM_ISM]); | 280 | iop_start(iop_base[IOP_NUM_ISM]); |
276 | iop_alive(iop_base[IOP_NUM_ISM]); /* clears the alive flag */ | 281 | iop_alive(iop_base[IOP_NUM_ISM]); /* clears the alive flag */ |
277 | } | 282 | } |
@@ -310,9 +315,9 @@ void __init iop_register_interrupts(void) | |||
310 | pr_err("Couldn't register ISM IOP interrupt\n"); | 315 | pr_err("Couldn't register ISM IOP interrupt\n"); |
311 | } | 316 | } |
312 | if (!iop_alive(iop_base[IOP_NUM_ISM])) { | 317 | if (!iop_alive(iop_base[IOP_NUM_ISM])) { |
313 | printk("IOP: oh my god, they killed the ISM IOP!\n"); | 318 | pr_warn("IOP: oh my god, they killed the ISM IOP!\n"); |
314 | } else { | 319 | } else { |
315 | printk("IOP: the ISM IOP seems to be alive.\n"); | 320 | pr_warn("IOP: the ISM IOP seems to be alive.\n"); |
316 | } | 321 | } |
317 | } | 322 | } |
318 | } | 323 | } |
@@ -349,9 +354,8 @@ void iop_complete_message(struct iop_msg *msg) | |||
349 | int chan = msg->channel; | 354 | int chan = msg->channel; |
350 | int i,offset; | 355 | int i,offset; |
351 | 356 | ||
352 | #ifdef DEBUG_IOP | 357 | iop_pr_debug("msg %p iop_num %d channel %d\n", msg, msg->iop_num, |
353 | printk("iop_complete(%p): iop %d chan %d\n", msg, msg->iop_num, msg->channel); | 358 | msg->channel); |
354 | #endif | ||
355 | 359 | ||
356 | offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN); | 360 | offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN); |
357 | 361 | ||
@@ -363,7 +367,7 @@ void iop_complete_message(struct iop_msg *msg) | |||
363 | IOP_ADDR_RECV_STATE + chan, IOP_MSG_COMPLETE); | 367 | IOP_ADDR_RECV_STATE + chan, IOP_MSG_COMPLETE); |
364 | iop_interrupt(iop_base[msg->iop_num]); | 368 | iop_interrupt(iop_base[msg->iop_num]); |
365 | 369 | ||
366 | iop_free_msg(msg); | 370 | msg->status = IOP_MSGSTATUS_UNUSED; |
367 | } | 371 | } |
368 | 372 | ||
369 | /* | 373 | /* |
@@ -394,12 +398,10 @@ static void iop_do_send(struct iop_msg *msg) | |||
394 | static void iop_handle_send(uint iop_num, uint chan) | 398 | static void iop_handle_send(uint iop_num, uint chan) |
395 | { | 399 | { |
396 | volatile struct mac_iop *iop = iop_base[iop_num]; | 400 | volatile struct mac_iop *iop = iop_base[iop_num]; |
397 | struct iop_msg *msg,*msg2; | 401 | struct iop_msg *msg; |
398 | int i,offset; | 402 | int i,offset; |
399 | 403 | ||
400 | #ifdef DEBUG_IOP | 404 | iop_pr_debug("iop_num %d chan %d\n", iop_num, chan); |
401 | printk("iop_handle_send: iop %d channel %d\n", iop_num, chan); | ||
402 | #endif | ||
403 | 405 | ||
404 | iop_writeb(iop, IOP_ADDR_SEND_STATE + chan, IOP_MSG_IDLE); | 406 | iop_writeb(iop, IOP_ADDR_SEND_STATE + chan, IOP_MSG_IDLE); |
405 | 407 | ||
@@ -411,10 +413,8 @@ static void iop_handle_send(uint iop_num, uint chan) | |||
411 | msg->reply[i] = iop_readb(iop, offset); | 413 | msg->reply[i] = iop_readb(iop, offset); |
412 | } | 414 | } |
413 | if (msg->handler) (*msg->handler)(msg); | 415 | if (msg->handler) (*msg->handler)(msg); |
414 | msg2 = msg; | 416 | msg->status = IOP_MSGSTATUS_UNUSED; |
415 | msg = msg->next; | 417 | msg = msg->next; |
416 | iop_free_msg(msg2); | ||
417 | |||
418 | iop_send_queue[iop_num][chan] = msg; | 418 | iop_send_queue[iop_num][chan] = msg; |
419 | if (msg) iop_do_send(msg); | 419 | if (msg) iop_do_send(msg); |
420 | } | 420 | } |
@@ -430,11 +430,9 @@ static void iop_handle_recv(uint iop_num, uint chan) | |||
430 | int i,offset; | 430 | int i,offset; |
431 | struct iop_msg *msg; | 431 | struct iop_msg *msg; |
432 | 432 | ||
433 | #ifdef DEBUG_IOP | 433 | iop_pr_debug("iop_num %d chan %d\n", iop_num, chan); |
434 | printk("iop_handle_recv: iop %d channel %d\n", iop_num, chan); | ||
435 | #endif | ||
436 | 434 | ||
437 | msg = iop_alloc_msg(); | 435 | msg = iop_get_unused_msg(); |
438 | msg->iop_num = iop_num; | 436 | msg->iop_num = iop_num; |
439 | msg->channel = chan; | 437 | msg->channel = chan; |
440 | msg->status = IOP_MSGSTATUS_UNSOL; | 438 | msg->status = IOP_MSGSTATUS_UNSOL; |
@@ -454,14 +452,9 @@ static void iop_handle_recv(uint iop_num, uint chan) | |||
454 | if (msg->handler) { | 452 | if (msg->handler) { |
455 | (*msg->handler)(msg); | 453 | (*msg->handler)(msg); |
456 | } else { | 454 | } else { |
457 | #ifdef DEBUG_IOP | 455 | iop_pr_debug("unclaimed message on iop_num %d chan %d\n", |
458 | printk("iop_handle_recv: unclaimed message on iop %d channel %d\n", iop_num, chan); | 456 | iop_num, chan); |
459 | printk("iop_handle_recv:"); | 457 | iop_pr_debug("%*ph\n", IOP_MSG_LEN, msg->message); |
460 | for (i = 0 ; i < IOP_MSG_LEN ; i++) { | ||
461 | printk(" %02X", (uint) msg->message[i]); | ||
462 | } | ||
463 | printk("\n"); | ||
464 | #endif | ||
465 | iop_complete_message(msg); | 458 | iop_complete_message(msg); |
466 | } | 459 | } |
467 | } | 460 | } |
@@ -484,7 +477,7 @@ int iop_send_message(uint iop_num, uint chan, void *privdata, | |||
484 | if (chan >= NUM_IOP_CHAN) return -EINVAL; | 477 | if (chan >= NUM_IOP_CHAN) return -EINVAL; |
485 | if (msg_len > IOP_MSG_LEN) return -EINVAL; | 478 | if (msg_len > IOP_MSG_LEN) return -EINVAL; |
486 | 479 | ||
487 | msg = iop_alloc_msg(); | 480 | msg = iop_get_unused_msg(); |
488 | if (!msg) return -ENOMEM; | 481 | if (!msg) return -ENOMEM; |
489 | 482 | ||
490 | msg->next = NULL; | 483 | msg->next = NULL; |
@@ -574,50 +567,34 @@ irqreturn_t iop_ism_irq(int irq, void *dev_id) | |||
574 | volatile struct mac_iop *iop = iop_base[iop_num]; | 567 | volatile struct mac_iop *iop = iop_base[iop_num]; |
575 | int i,state; | 568 | int i,state; |
576 | 569 | ||
577 | #ifdef DEBUG_IOP | 570 | iop_pr_debug("status %02X\n", iop->status_ctrl); |
578 | printk("iop_ism_irq: status = %02X\n", (uint) iop->status_ctrl); | ||
579 | #endif | ||
580 | 571 | ||
581 | /* INT0 indicates a state change on an outgoing message channel */ | 572 | /* INT0 indicates a state change on an outgoing message channel */ |
582 | 573 | ||
583 | if (iop->status_ctrl & IOP_INT0) { | 574 | if (iop->status_ctrl & IOP_INT0) { |
584 | iop->status_ctrl = IOP_INT0 | IOP_RUN | IOP_AUTOINC; | 575 | iop->status_ctrl = IOP_INT0 | IOP_RUN | IOP_AUTOINC; |
585 | #ifdef DEBUG_IOP | 576 | iop_pr_debug("new status %02X, send states", iop->status_ctrl); |
586 | printk("iop_ism_irq: new status = %02X, send states", | ||
587 | (uint) iop->status_ctrl); | ||
588 | #endif | ||
589 | for (i = 0 ; i < NUM_IOP_CHAN ; i++) { | 577 | for (i = 0 ; i < NUM_IOP_CHAN ; i++) { |
590 | state = iop_readb(iop, IOP_ADDR_SEND_STATE + i); | 578 | state = iop_readb(iop, IOP_ADDR_SEND_STATE + i); |
591 | #ifdef DEBUG_IOP | 579 | iop_pr_cont(" %02X", state); |
592 | printk(" %02X", state); | ||
593 | #endif | ||
594 | if (state == IOP_MSG_COMPLETE) { | 580 | if (state == IOP_MSG_COMPLETE) { |
595 | iop_handle_send(iop_num, i); | 581 | iop_handle_send(iop_num, i); |
596 | } | 582 | } |
597 | } | 583 | } |
598 | #ifdef DEBUG_IOP | 584 | iop_pr_cont("\n"); |
599 | printk("\n"); | ||
600 | #endif | ||
601 | } | 585 | } |
602 | 586 | ||
603 | if (iop->status_ctrl & IOP_INT1) { /* INT1 for incoming msgs */ | 587 | if (iop->status_ctrl & IOP_INT1) { /* INT1 for incoming msgs */ |
604 | iop->status_ctrl = IOP_INT1 | IOP_RUN | IOP_AUTOINC; | 588 | iop->status_ctrl = IOP_INT1 | IOP_RUN | IOP_AUTOINC; |
605 | #ifdef DEBUG_IOP | 589 | iop_pr_debug("new status %02X, recv states", iop->status_ctrl); |
606 | printk("iop_ism_irq: new status = %02X, recv states", | ||
607 | (uint) iop->status_ctrl); | ||
608 | #endif | ||
609 | for (i = 0 ; i < NUM_IOP_CHAN ; i++) { | 590 | for (i = 0 ; i < NUM_IOP_CHAN ; i++) { |
610 | state = iop_readb(iop, IOP_ADDR_RECV_STATE + i); | 591 | state = iop_readb(iop, IOP_ADDR_RECV_STATE + i); |
611 | #ifdef DEBUG_IOP | 592 | iop_pr_cont(" %02X", state); |
612 | printk(" %02X", state); | ||
613 | #endif | ||
614 | if (state == IOP_MSG_NEW) { | 593 | if (state == IOP_MSG_NEW) { |
615 | iop_handle_recv(iop_num, i); | 594 | iop_handle_recv(iop_num, i); |
616 | } | 595 | } |
617 | } | 596 | } |
618 | #ifdef DEBUG_IOP | 597 | iop_pr_cont("\n"); |
619 | printk("\n"); | ||
620 | #endif | ||
621 | } | 598 | } |
622 | return IRQ_HANDLED; | 599 | return IRQ_HANDLED; |
623 | } | 600 | } |
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c index 5b01704c85eb..8aa8792e3174 100644 --- a/arch/m68k/mac/misc.c +++ b/arch/m68k/mac/misc.c | |||
@@ -281,8 +281,7 @@ static long via_read_time(void) | |||
281 | last_result.idata = result.idata; | 281 | last_result.idata = result.idata; |
282 | } | 282 | } |
283 | 283 | ||
284 | pr_err("via_read_time: failed to read a stable value; " | 284 | pr_err("via_read_time: failed to read a stable value; got 0x%08lx then 0x%08lx\n", |
285 | "got 0x%08lx then 0x%08lx\n", | ||
286 | last_result.idata, result.idata); | 285 | last_result.idata, result.idata); |
287 | 286 | ||
288 | return 0; | 287 | return 0; |
@@ -465,7 +464,7 @@ void mac_poweroff(void) | |||
465 | #endif | 464 | #endif |
466 | } | 465 | } |
467 | local_irq_enable(); | 466 | local_irq_enable(); |
468 | printk("It is now safe to turn off your Macintosh.\n"); | 467 | pr_crit("It is now safe to turn off your Macintosh.\n"); |
469 | while(1); | 468 | while(1); |
470 | } | 469 | } |
471 | 470 | ||
@@ -556,7 +555,7 @@ void mac_reset(void) | |||
556 | 555 | ||
557 | /* should never get here */ | 556 | /* should never get here */ |
558 | local_irq_enable(); | 557 | local_irq_enable(); |
559 | printk ("Restart failed. Please restart manually.\n"); | 558 | pr_crit("Restart failed. Please restart manually.\n"); |
560 | while(1); | 559 | while(1); |
561 | } | 560 | } |
562 | 561 | ||
@@ -661,17 +660,13 @@ int mac_hwclk(int op, struct rtc_time *t) | |||
661 | unmktime(now, 0, | 660 | unmktime(now, 0, |
662 | &t->tm_year, &t->tm_mon, &t->tm_mday, | 661 | &t->tm_year, &t->tm_mon, &t->tm_mday, |
663 | &t->tm_hour, &t->tm_min, &t->tm_sec); | 662 | &t->tm_hour, &t->tm_min, &t->tm_sec); |
664 | #if 0 | 663 | pr_debug("%s: read %04d-%02d-%-2d %02d:%02d:%02d\n", |
665 | printk("mac_hwclk: read %04d-%02d-%-2d %02d:%02d:%02d\n", | 664 | __func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, |
666 | t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, | 665 | t->tm_hour, t->tm_min, t->tm_sec); |
667 | t->tm_hour, t->tm_min, t->tm_sec); | ||
668 | #endif | ||
669 | } else { /* write */ | 666 | } else { /* write */ |
670 | #if 0 | 667 | pr_debug("%s: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n", |
671 | printk("mac_hwclk: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n", | 668 | __func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, |
672 | t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, | 669 | t->tm_hour, t->tm_min, t->tm_sec); |
673 | t->tm_hour, t->tm_min, t->tm_sec); | ||
674 | #endif | ||
675 | 670 | ||
676 | now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, | 671 | now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, |
677 | t->tm_hour, t->tm_min, t->tm_sec); | 672 | t->tm_hour, t->tm_min, t->tm_sec); |
diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c index 3319cf19deeb..77a48a5164ff 100644 --- a/drivers/nubus/nubus.c +++ b/drivers/nubus/nubus.c | |||
@@ -44,8 +44,8 @@ extern void oss_nubus_init(void); | |||
44 | 44 | ||
45 | /* Globals */ | 45 | /* Globals */ |
46 | 46 | ||
47 | struct nubus_dev* nubus_devices; | 47 | struct nubus_dev *nubus_devices; |
48 | struct nubus_board* nubus_boards; | 48 | struct nubus_board *nubus_boards; |
49 | 49 | ||
50 | /* Meaning of "bytelanes": | 50 | /* Meaning of "bytelanes": |
51 | 51 | ||
@@ -69,26 +69,26 @@ struct nubus_board* nubus_boards; | |||
69 | 69 | ||
70 | Etcetera, etcetera. Hopefully this clears up some confusion over | 70 | Etcetera, etcetera. Hopefully this clears up some confusion over |
71 | what the following code actually does. */ | 71 | what the following code actually does. */ |
72 | 72 | ||
73 | static inline int not_useful(void *p, int map) | 73 | static inline int not_useful(void *p, int map) |
74 | { | 74 | { |
75 | unsigned long pv=(unsigned long)p; | 75 | unsigned long pv = (unsigned long)p; |
76 | |||
76 | pv &= 3; | 77 | pv &= 3; |
77 | if(map & (1<<pv)) | 78 | if (map & (1 << pv)) |
78 | return 0; | 79 | return 0; |
79 | return 1; | 80 | return 1; |
80 | } | 81 | } |
81 | 82 | ||
82 | static unsigned long nubus_get_rom(unsigned char **ptr, int len, int map) | 83 | static unsigned long nubus_get_rom(unsigned char **ptr, int len, int map) |
83 | { | 84 | { |
84 | /* This will hold the result */ | 85 | /* This will hold the result */ |
85 | unsigned long v = 0; | 86 | unsigned long v = 0; |
86 | unsigned char *p = *ptr; | 87 | unsigned char *p = *ptr; |
87 | 88 | ||
88 | while(len) | 89 | while (len) { |
89 | { | ||
90 | v <<= 8; | 90 | v <<= 8; |
91 | while(not_useful(p,map)) | 91 | while (not_useful(p, map)) |
92 | p++; | 92 | p++; |
93 | v |= *p++; | 93 | v |= *p++; |
94 | len--; | 94 | len--; |
@@ -99,31 +99,28 @@ static unsigned long nubus_get_rom(unsigned char **ptr, int len, int map) | |||
99 | 99 | ||
100 | static void nubus_rewind(unsigned char **ptr, int len, int map) | 100 | static void nubus_rewind(unsigned char **ptr, int len, int map) |
101 | { | 101 | { |
102 | unsigned char *p=*ptr; | 102 | unsigned char *p = *ptr; |
103 | 103 | ||
104 | /* Sanity check */ | 104 | /* Sanity check */ |
105 | if(len > 65536) | 105 | if (len > 65536) |
106 | printk(KERN_ERR "rewind of 0x%08x!\n", len); | 106 | pr_err("rewind of 0x%08x!\n", len); |
107 | while(len) | 107 | while (len) { |
108 | { | 108 | do { |
109 | do | ||
110 | { | ||
111 | p--; | 109 | p--; |
112 | } | 110 | } while (not_useful(p, map)); |
113 | while(not_useful(p, map)); | ||
114 | len--; | 111 | len--; |
115 | } | 112 | } |
116 | *ptr=p; | 113 | *ptr = p; |
117 | } | 114 | } |
118 | 115 | ||
119 | static void nubus_advance(unsigned char **ptr, int len, int map) | 116 | static void nubus_advance(unsigned char **ptr, int len, int map) |
120 | { | 117 | { |
121 | unsigned char *p = *ptr; | 118 | unsigned char *p = *ptr; |
122 | if(len>65536) | 119 | |
123 | printk(KERN_ERR "advance of 0x%08x!\n", len); | 120 | if (len > 65536) |
124 | while(len) | 121 | pr_err("advance of 0x%08x!\n", len); |
125 | { | 122 | while (len) { |
126 | while(not_useful(p,map)) | 123 | while (not_useful(p, map)) |
127 | p++; | 124 | p++; |
128 | p++; | 125 | p++; |
129 | len--; | 126 | len--; |
@@ -133,9 +130,9 @@ static void nubus_advance(unsigned char **ptr, int len, int map) | |||
133 | 130 | ||
134 | static void nubus_move(unsigned char **ptr, int len, int map) | 131 | static void nubus_move(unsigned char **ptr, int len, int map) |
135 | { | 132 | { |
136 | if(len > 0) | 133 | if (len > 0) |
137 | nubus_advance(ptr, len, map); | 134 | nubus_advance(ptr, len, map); |
138 | else if(len < 0) | 135 | else if (len < 0) |
139 | nubus_rewind(ptr, -len, map); | 136 | nubus_rewind(ptr, -len, map); |
140 | } | 137 | } |
141 | 138 | ||
@@ -148,23 +145,24 @@ static void nubus_move(unsigned char **ptr, int len, int map) | |||
148 | 145 | ||
149 | static inline long nubus_expand32(long foo) | 146 | static inline long nubus_expand32(long foo) |
150 | { | 147 | { |
151 | if(foo & 0x00800000) /* 24bit negative */ | 148 | if (foo & 0x00800000) /* 24bit negative */ |
152 | foo |= 0xFF000000; | 149 | foo |= 0xFF000000; |
153 | return foo; | 150 | return foo; |
154 | } | 151 | } |
155 | 152 | ||
156 | static inline void *nubus_rom_addr(int slot) | 153 | static inline void *nubus_rom_addr(int slot) |
157 | { | 154 | { |
158 | /* | 155 | /* |
159 | * Returns the first byte after the card. We then walk | 156 | * Returns the first byte after the card. We then walk |
160 | * backwards to get the lane register and the config | 157 | * backwards to get the lane register and the config |
161 | */ | 158 | */ |
162 | return (void *)(0xF1000000+(slot<<24)); | 159 | return (void *)(0xF1000000 + (slot << 24)); |
163 | } | 160 | } |
164 | 161 | ||
165 | static unsigned char *nubus_dirptr(const struct nubus_dirent *nd) | 162 | static unsigned char *nubus_dirptr(const struct nubus_dirent *nd) |
166 | { | 163 | { |
167 | unsigned char *p = nd->base; | 164 | unsigned char *p = nd->base; |
165 | |||
168 | /* Essentially, just step over the bytelanes using whatever | 166 | /* Essentially, just step over the bytelanes using whatever |
169 | offset we might have found */ | 167 | offset we might have found */ |
170 | nubus_move(&p, nubus_expand32(nd->data), nd->mask); | 168 | nubus_move(&p, nubus_expand32(nd->data), nd->mask); |
@@ -175,36 +173,36 @@ static unsigned char *nubus_dirptr(const struct nubus_dirent *nd) | |||
175 | /* These two are for pulling resource data blocks (i.e. stuff that's | 173 | /* These two are for pulling resource data blocks (i.e. stuff that's |
176 | pointed to with offsets) out of the card ROM. */ | 174 | pointed to with offsets) out of the card ROM. */ |
177 | 175 | ||
178 | void nubus_get_rsrc_mem(void *dest, const struct nubus_dirent* dirent, | 176 | void nubus_get_rsrc_mem(void *dest, const struct nubus_dirent *dirent, |
179 | int len) | 177 | int len) |
180 | { | 178 | { |
181 | unsigned char *t = (unsigned char *)dest; | 179 | unsigned char *t = (unsigned char *)dest; |
182 | unsigned char *p = nubus_dirptr(dirent); | 180 | unsigned char *p = nubus_dirptr(dirent); |
183 | while(len) | 181 | |
184 | { | 182 | while (len) { |
185 | *t++ = nubus_get_rom(&p, 1, dirent->mask); | 183 | *t++ = nubus_get_rom(&p, 1, dirent->mask); |
186 | len--; | 184 | len--; |
187 | } | 185 | } |
188 | } | 186 | } |
189 | EXPORT_SYMBOL(nubus_get_rsrc_mem); | 187 | EXPORT_SYMBOL(nubus_get_rsrc_mem); |
190 | 188 | ||
191 | void nubus_get_rsrc_str(void *dest, const struct nubus_dirent* dirent, | 189 | void nubus_get_rsrc_str(void *dest, const struct nubus_dirent *dirent, |
192 | int len) | 190 | int len) |
193 | { | 191 | { |
194 | unsigned char *t=(unsigned char *)dest; | 192 | unsigned char *t = (unsigned char *)dest; |
195 | unsigned char *p = nubus_dirptr(dirent); | 193 | unsigned char *p = nubus_dirptr(dirent); |
196 | while(len) | 194 | |
197 | { | 195 | while (len) { |
198 | *t = nubus_get_rom(&p, 1, dirent->mask); | 196 | *t = nubus_get_rom(&p, 1, dirent->mask); |
199 | if(!*t++) | 197 | if (!*t++) |
200 | break; | 198 | break; |
201 | len--; | 199 | len--; |
202 | } | 200 | } |
203 | } | 201 | } |
204 | EXPORT_SYMBOL(nubus_get_rsrc_str); | 202 | EXPORT_SYMBOL(nubus_get_rsrc_str); |
205 | 203 | ||
206 | int nubus_get_root_dir(const struct nubus_board* board, | 204 | int nubus_get_root_dir(const struct nubus_board *board, |
207 | struct nubus_dir* dir) | 205 | struct nubus_dir *dir) |
208 | { | 206 | { |
209 | dir->ptr = dir->base = board->directory; | 207 | dir->ptr = dir->base = board->directory; |
210 | dir->done = 0; | 208 | dir->done = 0; |
@@ -214,8 +212,8 @@ int nubus_get_root_dir(const struct nubus_board* board, | |||
214 | EXPORT_SYMBOL(nubus_get_root_dir); | 212 | EXPORT_SYMBOL(nubus_get_root_dir); |
215 | 213 | ||
216 | /* This is a slyly renamed version of the above */ | 214 | /* This is a slyly renamed version of the above */ |
217 | int nubus_get_func_dir(const struct nubus_dev* dev, | 215 | int nubus_get_func_dir(const struct nubus_dev *dev, |
218 | struct nubus_dir* dir) | 216 | struct nubus_dir *dir) |
219 | { | 217 | { |
220 | dir->ptr = dir->base = dev->directory; | 218 | dir->ptr = dir->base = dev->directory; |
221 | dir->done = 0; | 219 | dir->done = 0; |
@@ -224,11 +222,11 @@ int nubus_get_func_dir(const struct nubus_dev* dev, | |||
224 | } | 222 | } |
225 | EXPORT_SYMBOL(nubus_get_func_dir); | 223 | EXPORT_SYMBOL(nubus_get_func_dir); |
226 | 224 | ||
227 | int nubus_get_board_dir(const struct nubus_board* board, | 225 | int nubus_get_board_dir(const struct nubus_board *board, |
228 | struct nubus_dir* dir) | 226 | struct nubus_dir *dir) |
229 | { | 227 | { |
230 | struct nubus_dirent ent; | 228 | struct nubus_dirent ent; |
231 | 229 | ||
232 | dir->ptr = dir->base = board->directory; | 230 | dir->ptr = dir->base = board->directory; |
233 | dir->done = 0; | 231 | dir->done = 0; |
234 | dir->mask = board->lanes; | 232 | dir->mask = board->lanes; |
@@ -256,6 +254,7 @@ EXPORT_SYMBOL(nubus_get_subdir); | |||
256 | int nubus_readdir(struct nubus_dir *nd, struct nubus_dirent *ent) | 254 | int nubus_readdir(struct nubus_dir *nd, struct nubus_dirent *ent) |
257 | { | 255 | { |
258 | u32 resid; | 256 | u32 resid; |
257 | |||
259 | if (nd->done) | 258 | if (nd->done) |
260 | return -1; | 259 | return -1; |
261 | 260 | ||
@@ -266,25 +265,25 @@ int nubus_readdir(struct nubus_dir *nd, struct nubus_dirent *ent) | |||
266 | resid = nubus_get_rom(&nd->ptr, 4, nd->mask); | 265 | resid = nubus_get_rom(&nd->ptr, 4, nd->mask); |
267 | 266 | ||
268 | /* EOL marker, as per the Apple docs */ | 267 | /* EOL marker, as per the Apple docs */ |
269 | if((resid&0xff000000) == 0xff000000) | 268 | if ((resid & 0xff000000) == 0xff000000) { |
270 | { | ||
271 | /* Mark it as done */ | 269 | /* Mark it as done */ |
272 | nd->done = 1; | 270 | nd->done = 1; |
273 | return -1; | 271 | return -1; |
274 | } | 272 | } |
275 | 273 | ||
276 | /* First byte is the resource ID */ | 274 | /* First byte is the resource ID */ |
277 | ent->type = resid >> 24; | 275 | ent->type = resid >> 24; |
278 | /* Low 3 bytes might contain data (or might not) */ | 276 | /* Low 3 bytes might contain data (or might not) */ |
279 | ent->data = resid & 0xffffff; | 277 | ent->data = resid & 0xffffff; |
280 | ent->mask = nd->mask; | 278 | ent->mask = nd->mask; |
281 | return 0; | 279 | return 0; |
282 | } | 280 | } |
283 | EXPORT_SYMBOL(nubus_readdir); | 281 | EXPORT_SYMBOL(nubus_readdir); |
284 | 282 | ||
285 | int nubus_rewinddir(struct nubus_dir* dir) | 283 | int nubus_rewinddir(struct nubus_dir *dir) |
286 | { | 284 | { |
287 | dir->ptr = dir->base; | 285 | dir->ptr = dir->base; |
286 | dir->done = 0; | ||
288 | return 0; | 287 | return 0; |
289 | } | 288 | } |
290 | EXPORT_SYMBOL(nubus_rewinddir); | 289 | EXPORT_SYMBOL(nubus_rewinddir); |
@@ -292,20 +291,15 @@ EXPORT_SYMBOL(nubus_rewinddir); | |||
292 | /* Driver interface functions, more or less like in pci.c */ | 291 | /* Driver interface functions, more or less like in pci.c */ |
293 | 292 | ||
294 | struct nubus_dev* | 293 | struct nubus_dev* |
295 | nubus_find_device(unsigned short category, | 294 | nubus_find_device(unsigned short category, unsigned short type, |
296 | unsigned short type, | 295 | unsigned short dr_hw, unsigned short dr_sw, |
297 | unsigned short dr_hw, | 296 | const struct nubus_dev *from) |
298 | unsigned short dr_sw, | ||
299 | const struct nubus_dev* from) | ||
300 | { | 297 | { |
301 | struct nubus_dev* itor = | 298 | struct nubus_dev *itor = from ? from->next : nubus_devices; |
302 | from ? from->next : nubus_devices; | ||
303 | 299 | ||
304 | while (itor) { | 300 | while (itor) { |
305 | if (itor->category == category | 301 | if (itor->category == category && itor->type == type && |
306 | && itor->type == type | 302 | itor->dr_hw == dr_hw && itor->dr_sw == dr_sw) |
307 | && itor->dr_hw == dr_hw | ||
308 | && itor->dr_sw == dr_sw) | ||
309 | return itor; | 303 | return itor; |
310 | itor = itor->next; | 304 | itor = itor->next; |
311 | } | 305 | } |
@@ -314,16 +308,13 @@ nubus_find_device(unsigned short category, | |||
314 | EXPORT_SYMBOL(nubus_find_device); | 308 | EXPORT_SYMBOL(nubus_find_device); |
315 | 309 | ||
316 | struct nubus_dev* | 310 | struct nubus_dev* |
317 | nubus_find_type(unsigned short category, | 311 | nubus_find_type(unsigned short category, unsigned short type, |
318 | unsigned short type, | 312 | const struct nubus_dev *from) |
319 | const struct nubus_dev* from) | ||
320 | { | 313 | { |
321 | struct nubus_dev* itor = | 314 | struct nubus_dev *itor = from ? from->next : nubus_devices; |
322 | from ? from->next : nubus_devices; | ||
323 | 315 | ||
324 | while (itor) { | 316 | while (itor) { |
325 | if (itor->category == category | 317 | if (itor->category == category && itor->type == type) |
326 | && itor->type == type) | ||
327 | return itor; | 318 | return itor; |
328 | itor = itor->next; | 319 | itor = itor->next; |
329 | } | 320 | } |
@@ -332,12 +323,10 @@ nubus_find_type(unsigned short category, | |||
332 | EXPORT_SYMBOL(nubus_find_type); | 323 | EXPORT_SYMBOL(nubus_find_type); |
333 | 324 | ||
334 | struct nubus_dev* | 325 | struct nubus_dev* |
335 | nubus_find_slot(unsigned int slot, | 326 | nubus_find_slot(unsigned int slot, const struct nubus_dev *from) |
336 | const struct nubus_dev* from) | ||
337 | { | 327 | { |
338 | struct nubus_dev* itor = | 328 | struct nubus_dev *itor = from ? from->next : nubus_devices; |
339 | from ? from->next : nubus_devices; | 329 | |
340 | |||
341 | while (itor) { | 330 | while (itor) { |
342 | if (itor->board->slot == slot) | 331 | if (itor->board->slot == slot) |
343 | return itor; | 332 | return itor; |
@@ -348,13 +337,13 @@ nubus_find_slot(unsigned int slot, | |||
348 | EXPORT_SYMBOL(nubus_find_slot); | 337 | EXPORT_SYMBOL(nubus_find_slot); |
349 | 338 | ||
350 | int | 339 | int |
351 | nubus_find_rsrc(struct nubus_dir* dir, unsigned char rsrc_type, | 340 | nubus_find_rsrc(struct nubus_dir *dir, unsigned char rsrc_type, |
352 | struct nubus_dirent* ent) | 341 | struct nubus_dirent *ent) |
353 | { | 342 | { |
354 | while (nubus_readdir(dir, ent) != -1) { | 343 | while (nubus_readdir(dir, ent) != -1) { |
355 | if (ent->type == rsrc_type) | 344 | if (ent->type == rsrc_type) |
356 | return 0; | 345 | return 0; |
357 | } | 346 | } |
358 | return -1; | 347 | return -1; |
359 | } | 348 | } |
360 | EXPORT_SYMBOL(nubus_find_rsrc); | 349 | EXPORT_SYMBOL(nubus_find_rsrc); |
@@ -368,77 +357,74 @@ EXPORT_SYMBOL(nubus_find_rsrc); | |||
368 | among other things. The rest of it should go in the /proc code. | 357 | among other things. The rest of it should go in the /proc code. |
369 | For now, we just use it to give verbose boot logs. */ | 358 | For now, we just use it to give verbose boot logs. */ |
370 | 359 | ||
371 | static int __init nubus_show_display_resource(struct nubus_dev* dev, | 360 | static int __init nubus_show_display_resource(struct nubus_dev *dev, |
372 | const struct nubus_dirent* ent) | 361 | const struct nubus_dirent *ent) |
373 | { | 362 | { |
374 | switch (ent->type) { | 363 | switch (ent->type) { |
375 | case NUBUS_RESID_GAMMADIR: | 364 | case NUBUS_RESID_GAMMADIR: |
376 | printk(KERN_INFO " gamma directory offset: 0x%06x\n", ent->data); | 365 | pr_info(" gamma directory offset: 0x%06x\n", ent->data); |
377 | break; | 366 | break; |
378 | case 0x0080 ... 0x0085: | 367 | case 0x0080 ... 0x0085: |
379 | printk(KERN_INFO " mode %02X info offset: 0x%06x\n", | 368 | pr_info(" mode %02X info offset: 0x%06x\n", |
380 | ent->type, ent->data); | 369 | ent->type, ent->data); |
381 | break; | 370 | break; |
382 | default: | 371 | default: |
383 | printk(KERN_INFO " unknown resource %02X, data 0x%06x\n", | 372 | pr_info(" unknown resource %02X, data 0x%06x\n", |
384 | ent->type, ent->data); | 373 | ent->type, ent->data); |
385 | } | 374 | } |
386 | return 0; | 375 | return 0; |
387 | } | 376 | } |
388 | 377 | ||
389 | static int __init nubus_show_network_resource(struct nubus_dev* dev, | 378 | static int __init nubus_show_network_resource(struct nubus_dev *dev, |
390 | const struct nubus_dirent* ent) | 379 | const struct nubus_dirent *ent) |
391 | { | 380 | { |
392 | switch (ent->type) { | 381 | switch (ent->type) { |
393 | case NUBUS_RESID_MAC_ADDRESS: | 382 | case NUBUS_RESID_MAC_ADDRESS: |
394 | { | 383 | { |
395 | char addr[6]; | 384 | char addr[6]; |
396 | int i; | 385 | |
397 | |||
398 | nubus_get_rsrc_mem(addr, ent, 6); | 386 | nubus_get_rsrc_mem(addr, ent, 6); |
399 | printk(KERN_INFO " MAC address: "); | 387 | pr_info(" MAC address: %pM\n", addr); |
400 | for (i = 0; i < 6; i++) | ||
401 | printk("%02x%s", addr[i] & 0xff, | ||
402 | i == 5 ? "" : ":"); | ||
403 | printk("\n"); | ||
404 | break; | 388 | break; |
405 | } | 389 | } |
406 | default: | 390 | default: |
407 | printk(KERN_INFO " unknown resource %02X, data 0x%06x\n", | 391 | pr_info(" unknown resource %02X, data 0x%06x\n", |
408 | ent->type, ent->data); | 392 | ent->type, ent->data); |
409 | } | 393 | } |
410 | return 0; | 394 | return 0; |
411 | } | 395 | } |
412 | 396 | ||
413 | static int __init nubus_show_cpu_resource(struct nubus_dev* dev, | 397 | static int __init nubus_show_cpu_resource(struct nubus_dev *dev, |
414 | const struct nubus_dirent* ent) | 398 | const struct nubus_dirent *ent) |
415 | { | 399 | { |
416 | switch (ent->type) { | 400 | switch (ent->type) { |
417 | case NUBUS_RESID_MEMINFO: | 401 | case NUBUS_RESID_MEMINFO: |
418 | { | 402 | { |
419 | unsigned long meminfo[2]; | 403 | unsigned long meminfo[2]; |
404 | |||
420 | nubus_get_rsrc_mem(&meminfo, ent, 8); | 405 | nubus_get_rsrc_mem(&meminfo, ent, 8); |
421 | printk(KERN_INFO " memory: [ 0x%08lx 0x%08lx ]\n", | 406 | pr_info(" memory: [ 0x%08lx 0x%08lx ]\n", |
422 | meminfo[0], meminfo[1]); | 407 | meminfo[0], meminfo[1]); |
423 | break; | 408 | break; |
424 | } | 409 | } |
425 | case NUBUS_RESID_ROMINFO: | 410 | case NUBUS_RESID_ROMINFO: |
426 | { | 411 | { |
427 | unsigned long rominfo[2]; | 412 | unsigned long rominfo[2]; |
413 | |||
428 | nubus_get_rsrc_mem(&rominfo, ent, 8); | 414 | nubus_get_rsrc_mem(&rominfo, ent, 8); |
429 | printk(KERN_INFO " ROM: [ 0x%08lx 0x%08lx ]\n", | 415 | pr_info(" ROM: [ 0x%08lx 0x%08lx ]\n", |
430 | rominfo[0], rominfo[1]); | 416 | rominfo[0], rominfo[1]); |
431 | break; | 417 | break; |
432 | } | 418 | } |
433 | default: | 419 | default: |
434 | printk(KERN_INFO " unknown resource %02X, data 0x%06x\n", | 420 | pr_info(" unknown resource %02X, data 0x%06x\n", |
435 | ent->type, ent->data); | 421 | ent->type, ent->data); |
436 | } | 422 | } |
437 | return 0; | 423 | return 0; |
438 | } | 424 | } |
439 | 425 | ||
440 | static int __init nubus_show_private_resource(struct nubus_dev* dev, | 426 | static int __init nubus_show_private_resource(struct nubus_dev *dev, |
441 | const struct nubus_dirent* ent) | 427 | const struct nubus_dirent *ent) |
442 | { | 428 | { |
443 | switch (dev->category) { | 429 | switch (dev->category) { |
444 | case NUBUS_CAT_DISPLAY: | 430 | case NUBUS_CAT_DISPLAY: |
@@ -451,59 +437,56 @@ static int __init nubus_show_private_resource(struct nubus_dev* dev, | |||
451 | nubus_show_cpu_resource(dev, ent); | 437 | nubus_show_cpu_resource(dev, ent); |
452 | break; | 438 | break; |
453 | default: | 439 | default: |
454 | printk(KERN_INFO " unknown resource %02X, data 0x%06x\n", | 440 | pr_info(" unknown resource %02X, data 0x%06x\n", |
455 | ent->type, ent->data); | 441 | ent->type, ent->data); |
456 | } | 442 | } |
457 | return 0; | 443 | return 0; |
458 | } | 444 | } |
459 | 445 | ||
460 | static struct nubus_dev* __init | 446 | static struct nubus_dev * __init |
461 | nubus_get_functional_resource(struct nubus_board* board, | 447 | nubus_get_functional_resource(struct nubus_board *board, int slot, |
462 | int slot, | 448 | const struct nubus_dirent *parent) |
463 | const struct nubus_dirent* parent) | ||
464 | { | 449 | { |
465 | struct nubus_dir dir; | 450 | struct nubus_dir dir; |
466 | struct nubus_dirent ent; | 451 | struct nubus_dirent ent; |
467 | struct nubus_dev* dev; | 452 | struct nubus_dev *dev; |
468 | 453 | ||
469 | printk(KERN_INFO " Function 0x%02x:\n", parent->type); | 454 | pr_info(" Function 0x%02x:\n", parent->type); |
470 | nubus_get_subdir(parent, &dir); | 455 | nubus_get_subdir(parent, &dir); |
471 | 456 | ||
472 | /* Apple seems to have botched the ROM on the IIx */ | 457 | /* Apple seems to have botched the ROM on the IIx */ |
473 | if (slot == 0 && (unsigned long)dir.base % 2) | 458 | if (slot == 0 && (unsigned long)dir.base % 2) |
474 | dir.base += 1; | 459 | dir.base += 1; |
475 | 460 | ||
476 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | 461 | pr_debug("%s: parent is 0x%p, dir is 0x%p\n", |
477 | printk(KERN_DEBUG "nubus_get_functional_resource: parent is 0x%p, dir is 0x%p\n", | 462 | __func__, parent->base, dir.base); |
478 | parent->base, dir.base); | ||
479 | 463 | ||
480 | /* Actually we should probably panic if this fails */ | 464 | /* Actually we should probably panic if this fails */ |
481 | if ((dev = kzalloc(sizeof(*dev), GFP_ATOMIC)) == NULL) | 465 | if ((dev = kzalloc(sizeof(*dev), GFP_ATOMIC)) == NULL) |
482 | return NULL; | 466 | return NULL; |
483 | dev->resid = parent->type; | 467 | dev->resid = parent->type; |
484 | dev->directory = dir.base; | 468 | dev->directory = dir.base; |
485 | dev->board = board; | 469 | dev->board = board; |
486 | 470 | ||
487 | while (nubus_readdir(&dir, &ent) != -1) | 471 | while (nubus_readdir(&dir, &ent) != -1) { |
488 | { | 472 | switch (ent.type) { |
489 | switch(ent.type) | ||
490 | { | ||
491 | case NUBUS_RESID_TYPE: | 473 | case NUBUS_RESID_TYPE: |
492 | { | 474 | { |
493 | unsigned short nbtdata[4]; | 475 | unsigned short nbtdata[4]; |
476 | |||
494 | nubus_get_rsrc_mem(nbtdata, &ent, 8); | 477 | nubus_get_rsrc_mem(nbtdata, &ent, 8); |
495 | dev->category = nbtdata[0]; | 478 | dev->category = nbtdata[0]; |
496 | dev->type = nbtdata[1]; | 479 | dev->type = nbtdata[1]; |
497 | dev->dr_sw = nbtdata[2]; | 480 | dev->dr_sw = nbtdata[2]; |
498 | dev->dr_hw = nbtdata[3]; | 481 | dev->dr_hw = nbtdata[3]; |
499 | printk(KERN_INFO " type: [cat 0x%x type 0x%x hw 0x%x sw 0x%x]\n", | 482 | pr_info(" type: [cat 0x%x type 0x%x sw 0x%x hw 0x%x]\n", |
500 | nbtdata[0], nbtdata[1], nbtdata[2], nbtdata[3]); | 483 | nbtdata[0], nbtdata[1], nbtdata[2], nbtdata[3]); |
501 | break; | 484 | break; |
502 | } | 485 | } |
503 | case NUBUS_RESID_NAME: | 486 | case NUBUS_RESID_NAME: |
504 | { | 487 | { |
505 | nubus_get_rsrc_str(dev->name, &ent, 64); | 488 | nubus_get_rsrc_str(dev->name, &ent, 64); |
506 | printk(KERN_INFO " name: %s\n", dev->name); | 489 | pr_info(" name: %s\n", dev->name); |
507 | break; | 490 | break; |
508 | } | 491 | } |
509 | case NUBUS_RESID_DRVRDIR: | 492 | case NUBUS_RESID_DRVRDIR: |
@@ -512,11 +495,11 @@ static struct nubus_dev* __init | |||
512 | use this :-) */ | 495 | use this :-) */ |
513 | struct nubus_dir drvr_dir; | 496 | struct nubus_dir drvr_dir; |
514 | struct nubus_dirent drvr_ent; | 497 | struct nubus_dirent drvr_ent; |
498 | |||
515 | nubus_get_subdir(&ent, &drvr_dir); | 499 | nubus_get_subdir(&ent, &drvr_dir); |
516 | nubus_readdir(&drvr_dir, &drvr_ent); | 500 | nubus_readdir(&drvr_dir, &drvr_ent); |
517 | dev->driver = nubus_dirptr(&drvr_ent); | 501 | dev->driver = nubus_dirptr(&drvr_ent); |
518 | printk(KERN_INFO " driver at: 0x%p\n", | 502 | pr_info(" driver at: 0x%p\n", dev->driver); |
519 | dev->driver); | ||
520 | break; | 503 | break; |
521 | } | 504 | } |
522 | case NUBUS_RESID_MINOR_BASEOS: | 505 | case NUBUS_RESID_MINOR_BASEOS: |
@@ -524,22 +507,20 @@ static struct nubus_dev* __init | |||
524 | multiple framebuffers. It might be handy | 507 | multiple framebuffers. It might be handy |
525 | for Ethernet as well */ | 508 | for Ethernet as well */ |
526 | nubus_get_rsrc_mem(&dev->iobase, &ent, 4); | 509 | nubus_get_rsrc_mem(&dev->iobase, &ent, 4); |
527 | printk(KERN_INFO " memory offset: 0x%08lx\n", | 510 | pr_info(" memory offset: 0x%08lx\n", dev->iobase); |
528 | dev->iobase); | ||
529 | break; | 511 | break; |
530 | case NUBUS_RESID_MINOR_LENGTH: | 512 | case NUBUS_RESID_MINOR_LENGTH: |
531 | /* Ditto */ | 513 | /* Ditto */ |
532 | nubus_get_rsrc_mem(&dev->iosize, &ent, 4); | 514 | nubus_get_rsrc_mem(&dev->iosize, &ent, 4); |
533 | printk(KERN_INFO " memory length: 0x%08lx\n", | 515 | pr_info(" memory length: 0x%08lx\n", dev->iosize); |
534 | dev->iosize); | 516 | break; |
535 | break; | ||
536 | case NUBUS_RESID_FLAGS: | 517 | case NUBUS_RESID_FLAGS: |
537 | dev->flags = ent.data; | 518 | dev->flags = ent.data; |
538 | printk(KERN_INFO " flags: 0x%06x\n", dev->flags); | 519 | pr_info(" flags: 0x%06x\n", dev->flags); |
539 | break; | 520 | break; |
540 | case NUBUS_RESID_HWDEVID: | 521 | case NUBUS_RESID_HWDEVID: |
541 | dev->hwdevid = ent.data; | 522 | dev->hwdevid = ent.data; |
542 | printk(KERN_INFO " hwdevid: 0x%06x\n", dev->hwdevid); | 523 | pr_info(" hwdevid: 0x%06x\n", dev->hwdevid); |
543 | break; | 524 | break; |
544 | default: | 525 | default: |
545 | /* Local/Private resources have their own | 526 | /* Local/Private resources have their own |
@@ -547,16 +528,17 @@ static struct nubus_dev* __init | |||
547 | nubus_show_private_resource(dev, &ent); | 528 | nubus_show_private_resource(dev, &ent); |
548 | } | 529 | } |
549 | } | 530 | } |
550 | 531 | ||
551 | return dev; | 532 | return dev; |
552 | } | 533 | } |
553 | 534 | ||
554 | /* This is cool. */ | 535 | /* This is cool. */ |
555 | static int __init nubus_get_vidnames(struct nubus_board* board, | 536 | static int __init nubus_get_vidnames(struct nubus_board *board, |
556 | const struct nubus_dirent* parent) | 537 | const struct nubus_dirent *parent) |
557 | { | 538 | { |
558 | struct nubus_dir dir; | 539 | struct nubus_dir dir; |
559 | struct nubus_dirent ent; | 540 | struct nubus_dirent ent; |
541 | |||
560 | /* FIXME: obviously we want to put this in a header file soon */ | 542 | /* FIXME: obviously we want to put this in a header file soon */ |
561 | struct vidmode { | 543 | struct vidmode { |
562 | u32 size; | 544 | u32 size; |
@@ -566,100 +548,92 @@ static int __init nubus_get_vidnames(struct nubus_board* board, | |||
566 | char name[32]; | 548 | char name[32]; |
567 | }; | 549 | }; |
568 | 550 | ||
569 | printk(KERN_INFO " video modes supported:\n"); | 551 | pr_info(" video modes supported:\n"); |
570 | nubus_get_subdir(parent, &dir); | 552 | nubus_get_subdir(parent, &dir); |
571 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | 553 | pr_debug("%s: parent is 0x%p, dir is 0x%p\n", |
572 | printk(KERN_DEBUG "nubus_get_vidnames: parent is 0x%p, dir is 0x%p\n", | 554 | __func__, parent->base, dir.base); |
573 | parent->base, dir.base); | ||
574 | 555 | ||
575 | while(nubus_readdir(&dir, &ent) != -1) | 556 | while (nubus_readdir(&dir, &ent) != -1) { |
576 | { | ||
577 | struct vidmode mode; | 557 | struct vidmode mode; |
578 | u32 size; | 558 | u32 size; |
579 | 559 | ||
580 | /* First get the length */ | 560 | /* First get the length */ |
581 | nubus_get_rsrc_mem(&size, &ent, 4); | 561 | nubus_get_rsrc_mem(&size, &ent, 4); |
582 | 562 | ||
583 | /* Now clobber the whole thing */ | 563 | /* Now clobber the whole thing */ |
584 | if (size > sizeof(mode) - 1) | 564 | if (size > sizeof(mode) - 1) |
585 | size = sizeof(mode) - 1; | 565 | size = sizeof(mode) - 1; |
586 | memset(&mode, 0, sizeof(mode)); | 566 | memset(&mode, 0, sizeof(mode)); |
587 | nubus_get_rsrc_mem(&mode, &ent, size); | 567 | nubus_get_rsrc_mem(&mode, &ent, size); |
588 | printk (KERN_INFO " %02X: (%02X) %s\n", ent.type, | 568 | pr_info(" %02X: (%02X) %s\n", ent.type, |
589 | mode.id, mode.name); | 569 | mode.id, mode.name); |
590 | } | 570 | } |
591 | return 0; | 571 | return 0; |
592 | } | 572 | } |
593 | 573 | ||
594 | /* This is *really* cool. */ | 574 | /* This is *really* cool. */ |
595 | static int __init nubus_get_icon(struct nubus_board* board, | 575 | static int __init nubus_get_icon(struct nubus_board *board, |
596 | const struct nubus_dirent* ent) | 576 | const struct nubus_dirent *ent) |
597 | { | 577 | { |
598 | /* Should be 32x32 if my memory serves me correctly */ | 578 | /* Should be 32x32 if my memory serves me correctly */ |
599 | unsigned char icon[128]; | 579 | unsigned char icon[128]; |
600 | int x, y; | 580 | int x, y; |
601 | 581 | ||
602 | nubus_get_rsrc_mem(&icon, ent, 128); | 582 | nubus_get_rsrc_mem(&icon, ent, 128); |
603 | printk(KERN_INFO " icon:\n"); | 583 | pr_info(" icon:\n"); |
604 | 584 | ||
605 | /* We should actually plot these somewhere in the framebuffer | 585 | /* We should actually plot these somewhere in the framebuffer |
606 | init. This is just to demonstrate that they do, in fact, | 586 | init. This is just to demonstrate that they do, in fact, |
607 | exist */ | 587 | exist */ |
608 | for (y = 0; y < 32; y++) { | 588 | for (y = 0; y < 32; y++) { |
609 | printk(KERN_INFO " "); | 589 | pr_info(" "); |
610 | for (x = 0; x < 32; x++) { | 590 | for (x = 0; x < 32; x++) { |
611 | if (icon[y*4 + x/8] | 591 | if (icon[y * 4 + x / 8] & (0x80 >> (x % 8))) |
612 | & (0x80 >> (x%8))) | 592 | pr_cont("*"); |
613 | printk("*"); | ||
614 | else | 593 | else |
615 | printk(" "); | 594 | pr_cont(" "); |
616 | } | 595 | } |
617 | printk("\n"); | 596 | pr_cont("\n"); |
618 | } | 597 | } |
619 | return 0; | 598 | return 0; |
620 | } | 599 | } |
621 | 600 | ||
622 | static int __init nubus_get_vendorinfo(struct nubus_board* board, | 601 | static int __init nubus_get_vendorinfo(struct nubus_board *board, |
623 | const struct nubus_dirent* parent) | 602 | const struct nubus_dirent *parent) |
624 | { | 603 | { |
625 | struct nubus_dir dir; | 604 | struct nubus_dir dir; |
626 | struct nubus_dirent ent; | 605 | struct nubus_dirent ent; |
627 | static char* vendor_fields[6] = {"ID", "serial", "revision", | 606 | static char *vendor_fields[6] = { "ID", "serial", "revision", |
628 | "part", "date", "unknown field"}; | 607 | "part", "date", "unknown field" }; |
629 | 608 | ||
630 | printk(KERN_INFO " vendor info:\n"); | 609 | pr_info(" vendor info:\n"); |
631 | nubus_get_subdir(parent, &dir); | 610 | nubus_get_subdir(parent, &dir); |
632 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | 611 | pr_debug("%s: parent is 0x%p, dir is 0x%p\n", |
633 | printk(KERN_DEBUG "nubus_get_vendorinfo: parent is 0x%p, dir is 0x%p\n", | 612 | __func__, parent->base, dir.base); |
634 | parent->base, dir.base); | ||
635 | 613 | ||
636 | while(nubus_readdir(&dir, &ent) != -1) | 614 | while (nubus_readdir(&dir, &ent) != -1) { |
637 | { | ||
638 | char name[64]; | 615 | char name[64]; |
639 | 616 | ||
640 | /* These are all strings, we think */ | 617 | /* These are all strings, we think */ |
641 | nubus_get_rsrc_str(name, &ent, 64); | 618 | nubus_get_rsrc_str(name, &ent, 64); |
642 | if (ent.type > 5) | 619 | if (ent.type > 5) |
643 | ent.type = 5; | 620 | ent.type = 5; |
644 | printk(KERN_INFO " %s: %s\n", | 621 | pr_info(" %s: %s\n", vendor_fields[ent.type - 1], name); |
645 | vendor_fields[ent.type-1], name); | ||
646 | } | 622 | } |
647 | return 0; | 623 | return 0; |
648 | } | 624 | } |
649 | 625 | ||
650 | static int __init nubus_get_board_resource(struct nubus_board* board, int slot, | 626 | static int __init nubus_get_board_resource(struct nubus_board *board, int slot, |
651 | const struct nubus_dirent* parent) | 627 | const struct nubus_dirent *parent) |
652 | { | 628 | { |
653 | struct nubus_dir dir; | 629 | struct nubus_dir dir; |
654 | struct nubus_dirent ent; | 630 | struct nubus_dirent ent; |
655 | 631 | ||
656 | nubus_get_subdir(parent, &dir); | 632 | nubus_get_subdir(parent, &dir); |
657 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | 633 | pr_debug("%s: parent is 0x%p, dir is 0x%p\n", |
658 | printk(KERN_DEBUG "nubus_get_board_resource: parent is 0x%p, dir is 0x%p\n", | 634 | __func__, parent->base, dir.base); |
659 | parent->base, dir.base); | ||
660 | 635 | ||
661 | while(nubus_readdir(&dir, &ent) != -1) | 636 | while (nubus_readdir(&dir, &ent) != -1) { |
662 | { | ||
663 | switch (ent.type) { | 637 | switch (ent.type) { |
664 | case NUBUS_RESID_TYPE: | 638 | case NUBUS_RESID_TYPE: |
665 | { | 639 | { |
@@ -668,50 +642,49 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot, | |||
668 | useful except insofar as it tells us that | 642 | useful except insofar as it tells us that |
669 | we really are looking at a board resource. */ | 643 | we really are looking at a board resource. */ |
670 | nubus_get_rsrc_mem(nbtdata, &ent, 8); | 644 | nubus_get_rsrc_mem(nbtdata, &ent, 8); |
671 | printk(KERN_INFO " type: [cat 0x%x type 0x%x hw 0x%x sw 0x%x]\n", | 645 | pr_info(" type: [cat 0x%x type 0x%x sw 0x%x hw 0x%x]\n", |
672 | nbtdata[0], nbtdata[1], nbtdata[2], | 646 | nbtdata[0], nbtdata[1], nbtdata[2], nbtdata[3]); |
673 | nbtdata[3]); | ||
674 | if (nbtdata[0] != 1 || nbtdata[1] != 0 || | 647 | if (nbtdata[0] != 1 || nbtdata[1] != 0 || |
675 | nbtdata[2] != 0 || nbtdata[3] != 0) | 648 | nbtdata[2] != 0 || nbtdata[3] != 0) |
676 | printk(KERN_ERR "this sResource is not a board resource!\n"); | 649 | pr_err("this sResource is not a board resource!\n"); |
677 | break; | 650 | break; |
678 | } | 651 | } |
679 | case NUBUS_RESID_NAME: | 652 | case NUBUS_RESID_NAME: |
680 | nubus_get_rsrc_str(board->name, &ent, 64); | 653 | nubus_get_rsrc_str(board->name, &ent, 64); |
681 | printk(KERN_INFO " name: %s\n", board->name); | 654 | pr_info(" name: %s\n", board->name); |
682 | break; | 655 | break; |
683 | case NUBUS_RESID_ICON: | 656 | case NUBUS_RESID_ICON: |
684 | nubus_get_icon(board, &ent); | 657 | nubus_get_icon(board, &ent); |
685 | break; | 658 | break; |
686 | case NUBUS_RESID_BOARDID: | 659 | case NUBUS_RESID_BOARDID: |
687 | printk(KERN_INFO " board id: 0x%x\n", ent.data); | 660 | pr_info(" board id: 0x%x\n", ent.data); |
688 | break; | 661 | break; |
689 | case NUBUS_RESID_PRIMARYINIT: | 662 | case NUBUS_RESID_PRIMARYINIT: |
690 | printk(KERN_INFO " primary init offset: 0x%06x\n", ent.data); | 663 | pr_info(" primary init offset: 0x%06x\n", ent.data); |
691 | break; | 664 | break; |
692 | case NUBUS_RESID_VENDORINFO: | 665 | case NUBUS_RESID_VENDORINFO: |
693 | nubus_get_vendorinfo(board, &ent); | 666 | nubus_get_vendorinfo(board, &ent); |
694 | break; | 667 | break; |
695 | case NUBUS_RESID_FLAGS: | 668 | case NUBUS_RESID_FLAGS: |
696 | printk(KERN_INFO " flags: 0x%06x\n", ent.data); | 669 | pr_info(" flags: 0x%06x\n", ent.data); |
697 | break; | 670 | break; |
698 | case NUBUS_RESID_HWDEVID: | 671 | case NUBUS_RESID_HWDEVID: |
699 | printk(KERN_INFO " hwdevid: 0x%06x\n", ent.data); | 672 | pr_info(" hwdevid: 0x%06x\n", ent.data); |
700 | break; | 673 | break; |
701 | case NUBUS_RESID_SECONDINIT: | 674 | case NUBUS_RESID_SECONDINIT: |
702 | printk(KERN_INFO " secondary init offset: 0x%06x\n", ent.data); | 675 | pr_info(" secondary init offset: 0x%06x\n", ent.data); |
703 | break; | 676 | break; |
704 | /* WTF isn't this in the functional resources? */ | 677 | /* WTF isn't this in the functional resources? */ |
705 | case NUBUS_RESID_VIDNAMES: | 678 | case NUBUS_RESID_VIDNAMES: |
706 | nubus_get_vidnames(board, &ent); | 679 | nubus_get_vidnames(board, &ent); |
707 | break; | 680 | break; |
708 | /* Same goes for this */ | 681 | /* Same goes for this */ |
709 | case NUBUS_RESID_VIDMODES: | 682 | case NUBUS_RESID_VIDMODES: |
710 | printk(KERN_INFO " video mode parameter directory offset: 0x%06x\n", | 683 | pr_info(" video mode parameter directory offset: 0x%06x\n", |
711 | ent.data); | 684 | ent.data); |
712 | break; | 685 | break; |
713 | default: | 686 | default: |
714 | printk(KERN_INFO " unknown resource %02X, data 0x%06x\n", | 687 | pr_info(" unknown resource %02X, data 0x%06x\n", |
715 | ent.type, ent.data); | 688 | ent.type, ent.data); |
716 | } | 689 | } |
717 | } | 690 | } |
@@ -722,8 +695,8 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot, | |||
722 | sResources in the motherboard ROM */ | 695 | sResources in the motherboard ROM */ |
723 | static void __init nubus_find_rom_dir(struct nubus_board* board) | 696 | static void __init nubus_find_rom_dir(struct nubus_board* board) |
724 | { | 697 | { |
725 | unsigned char* rp; | 698 | unsigned char *rp; |
726 | unsigned char* romdir; | 699 | unsigned char *romdir; |
727 | struct nubus_dir dir; | 700 | struct nubus_dir dir; |
728 | struct nubus_dirent ent; | 701 | struct nubus_dirent ent; |
729 | 702 | ||
@@ -756,14 +729,14 @@ static void __init nubus_find_rom_dir(struct nubus_board* board) | |||
756 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | 729 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
757 | printk(KERN_INFO "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | 730 | printk(KERN_INFO "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); |
758 | /* This one takes us to where we want to go. */ | 731 | /* This one takes us to where we want to go. */ |
759 | if (nubus_readdir(&dir, &ent) == -1) | 732 | if (nubus_readdir(&dir, &ent) == -1) |
760 | goto badrom; | 733 | goto badrom; |
761 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | 734 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
762 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | 735 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); |
763 | nubus_get_subdir(&ent, &dir); | 736 | nubus_get_subdir(&ent, &dir); |
764 | 737 | ||
765 | /* Resource ID 01, also an "Unknown Macintosh" */ | 738 | /* Resource ID 01, also an "Unknown Macintosh" */ |
766 | if (nubus_readdir(&dir, &ent) == -1) | 739 | if (nubus_readdir(&dir, &ent) == -1) |
767 | goto badrom; | 740 | goto badrom; |
768 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | 741 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
769 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | 742 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); |
@@ -782,12 +755,12 @@ static void __init nubus_find_rom_dir(struct nubus_board* board) | |||
782 | goto badrom; | 755 | goto badrom; |
783 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) | 756 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
784 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | 757 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); |
785 | 758 | ||
786 | /* Bwahahahaha... */ | 759 | /* Bwahahahaha... */ |
787 | nubus_get_subdir(&ent, &dir); | 760 | nubus_get_subdir(&ent, &dir); |
788 | board->directory = dir.base; | 761 | board->directory = dir.base; |
789 | return; | 762 | return; |
790 | 763 | ||
791 | /* Even more evil laughter... */ | 764 | /* Even more evil laughter... */ |
792 | badrom: | 765 | badrom: |
793 | board->directory = board->fblock; | 766 | board->directory = board->fblock; |
@@ -796,43 +769,38 @@ static void __init nubus_find_rom_dir(struct nubus_board* board) | |||
796 | } | 769 | } |
797 | 770 | ||
798 | /* Add a board (might be many devices) to the list */ | 771 | /* Add a board (might be many devices) to the list */ |
799 | static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) | 772 | static struct nubus_board * __init nubus_add_board(int slot, int bytelanes) |
800 | { | 773 | { |
801 | struct nubus_board* board; | 774 | struct nubus_board *board; |
802 | struct nubus_board** boardp; | 775 | struct nubus_board **boardp; |
803 | |||
804 | unsigned char *rp; | 776 | unsigned char *rp; |
805 | unsigned long dpat; | 777 | unsigned long dpat; |
806 | struct nubus_dir dir; | 778 | struct nubus_dir dir; |
807 | struct nubus_dirent ent; | 779 | struct nubus_dirent ent; |
808 | 780 | ||
809 | /* Move to the start of the format block */ | 781 | /* Move to the start of the format block */ |
810 | rp = nubus_rom_addr(slot); | 782 | rp = nubus_rom_addr(slot); |
811 | nubus_rewind(&rp, FORMAT_BLOCK_SIZE, bytelanes); | 783 | nubus_rewind(&rp, FORMAT_BLOCK_SIZE, bytelanes); |
812 | 784 | ||
813 | /* Actually we should probably panic if this fails */ | 785 | /* Actually we should probably panic if this fails */ |
814 | if ((board = kzalloc(sizeof(*board), GFP_ATOMIC)) == NULL) | 786 | if ((board = kzalloc(sizeof(*board), GFP_ATOMIC)) == NULL) |
815 | return NULL; | 787 | return NULL; |
816 | board->fblock = rp; | 788 | board->fblock = rp; |
817 | 789 | ||
818 | /* Dump the format block for debugging purposes */ | 790 | /* Dump the format block for debugging purposes */ |
819 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) { | 791 | pr_debug("Slot %X, format block at 0x%p:\n", slot, rp); |
820 | int i; | 792 | pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes)); |
821 | printk(KERN_DEBUG "Slot %X, format block at 0x%p\n", | 793 | pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes)); |
822 | slot, rp); | 794 | pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes)); |
823 | printk(KERN_DEBUG "Format block: "); | 795 | pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes)); |
824 | for (i = 0; i < FORMAT_BLOCK_SIZE; i += 4) { | 796 | pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes)); |
825 | unsigned short foo, bar; | 797 | pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes)); |
826 | foo = nubus_get_rom(&rp, 2, bytelanes); | 798 | pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes)); |
827 | bar = nubus_get_rom(&rp, 2, bytelanes); | 799 | pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes)); |
828 | printk("%04x %04x ", foo, bar); | 800 | rp = board->fblock; |
829 | } | 801 | |
830 | printk("\n"); | ||
831 | rp = board->fblock; | ||
832 | } | ||
833 | |||
834 | board->slot = slot; | 802 | board->slot = slot; |
835 | board->slot_addr = (unsigned long) nubus_slot_addr(slot); | 803 | board->slot_addr = (unsigned long)nubus_slot_addr(slot); |
836 | board->doffset = nubus_get_rom(&rp, 4, bytelanes); | 804 | board->doffset = nubus_get_rom(&rp, 4, bytelanes); |
837 | /* rom_length is *supposed* to be the total length of the | 805 | /* rom_length is *supposed* to be the total length of the |
838 | * ROM. In practice it is the "amount of ROM used to compute | 806 | * ROM. In practice it is the "amount of ROM used to compute |
@@ -843,16 +811,16 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) | |||
843 | board->rom_length = nubus_get_rom(&rp, 4, bytelanes); | 811 | board->rom_length = nubus_get_rom(&rp, 4, bytelanes); |
844 | board->crc = nubus_get_rom(&rp, 4, bytelanes); | 812 | board->crc = nubus_get_rom(&rp, 4, bytelanes); |
845 | board->rev = nubus_get_rom(&rp, 1, bytelanes); | 813 | board->rev = nubus_get_rom(&rp, 1, bytelanes); |
846 | board->format = nubus_get_rom(&rp,1, bytelanes); | 814 | board->format = nubus_get_rom(&rp, 1, bytelanes); |
847 | board->lanes = bytelanes; | 815 | board->lanes = bytelanes; |
848 | 816 | ||
849 | /* Directory offset should be small and negative... */ | 817 | /* Directory offset should be small and negative... */ |
850 | if(!(board->doffset & 0x00FF0000)) | 818 | if (!(board->doffset & 0x00FF0000)) |
851 | printk(KERN_WARNING "Dodgy doffset!\n"); | 819 | pr_warn("Dodgy doffset!\n"); |
852 | dpat = nubus_get_rom(&rp, 4, bytelanes); | 820 | dpat = nubus_get_rom(&rp, 4, bytelanes); |
853 | if(dpat != NUBUS_TEST_PATTERN) | 821 | if (dpat != NUBUS_TEST_PATTERN) |
854 | printk(KERN_WARNING "Wrong test pattern %08lx!\n", dpat); | 822 | pr_warn("Wrong test pattern %08lx!\n", dpat); |
855 | 823 | ||
856 | /* | 824 | /* |
857 | * I wonder how the CRC is meant to work - | 825 | * I wonder how the CRC is meant to work - |
858 | * any takers ? | 826 | * any takers ? |
@@ -862,10 +830,10 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) | |||
862 | 830 | ||
863 | /* Attempt to work around slot zero weirdness */ | 831 | /* Attempt to work around slot zero weirdness */ |
864 | nubus_find_rom_dir(board); | 832 | nubus_find_rom_dir(board); |
865 | nubus_get_root_dir(board, &dir); | 833 | nubus_get_root_dir(board, &dir); |
866 | 834 | ||
867 | /* We're ready to rock */ | 835 | /* We're ready to rock */ |
868 | printk(KERN_INFO "Slot %X:\n", slot); | 836 | pr_info("Slot %X:\n", slot); |
869 | 837 | ||
870 | /* Each slot should have one board resource and any number of | 838 | /* Each slot should have one board resource and any number of |
871 | functional resources. So we'll fill in some fields in the | 839 | functional resources. So we'll fill in some fields in the |
@@ -874,10 +842,10 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) | |||
874 | for each of them. */ | 842 | for each of them. */ |
875 | if (nubus_readdir(&dir, &ent) == -1) { | 843 | if (nubus_readdir(&dir, &ent) == -1) { |
876 | /* We can't have this! */ | 844 | /* We can't have this! */ |
877 | printk(KERN_ERR "Board resource not found!\n"); | 845 | pr_err("Board resource not found!\n"); |
878 | return NULL; | 846 | return NULL; |
879 | } else { | 847 | } else { |
880 | printk(KERN_INFO " Board resource:\n"); | 848 | pr_info(" Board resource:\n"); |
881 | nubus_get_board_resource(board, slot, &ent); | 849 | nubus_get_board_resource(board, slot, &ent); |
882 | } | 850 | } |
883 | 851 | ||
@@ -885,8 +853,9 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) | |||
885 | resources. I have no idea WTF to do about this. */ | 853 | resources. I have no idea WTF to do about this. */ |
886 | 854 | ||
887 | while (nubus_readdir(&dir, &ent) != -1) { | 855 | while (nubus_readdir(&dir, &ent) != -1) { |
888 | struct nubus_dev* dev; | 856 | struct nubus_dev *dev; |
889 | struct nubus_dev** devp; | 857 | struct nubus_dev **devp; |
858 | |||
890 | dev = nubus_get_functional_resource(board, slot, &ent); | 859 | dev = nubus_get_functional_resource(board, slot, &ent); |
891 | if (dev == NULL) | 860 | if (dev == NULL) |
892 | continue; | 861 | continue; |
@@ -894,32 +863,33 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) | |||
894 | /* We zeroed this out above */ | 863 | /* We zeroed this out above */ |
895 | if (board->first_dev == NULL) | 864 | if (board->first_dev == NULL) |
896 | board->first_dev = dev; | 865 | board->first_dev = dev; |
897 | 866 | ||
898 | /* Put it on the global NuBus device chain. Keep entries in order. */ | 867 | /* Put it on the global NuBus device chain. Keep entries in order. */ |
899 | for (devp=&nubus_devices; *devp!=NULL; devp=&((*devp)->next)) | 868 | for (devp = &nubus_devices; *devp != NULL; |
869 | devp = &((*devp)->next)) | ||
900 | /* spin */; | 870 | /* spin */; |
901 | *devp = dev; | 871 | *devp = dev; |
902 | dev->next = NULL; | 872 | dev->next = NULL; |
903 | } | 873 | } |
904 | 874 | ||
905 | /* Put it on the global NuBus board chain. Keep entries in order. */ | 875 | /* Put it on the global NuBus board chain. Keep entries in order. */ |
906 | for (boardp=&nubus_boards; *boardp!=NULL; boardp=&((*boardp)->next)) | 876 | for (boardp = &nubus_boards; *boardp != NULL; |
877 | boardp = &((*boardp)->next)) | ||
907 | /* spin */; | 878 | /* spin */; |
908 | *boardp = board; | 879 | *boardp = board; |
909 | board->next = NULL; | 880 | board->next = NULL; |
910 | 881 | ||
911 | return board; | 882 | return board; |
912 | } | 883 | } |
913 | 884 | ||
914 | void __init nubus_probe_slot(int slot) | 885 | void __init nubus_probe_slot(int slot) |
915 | { | 886 | { |
916 | unsigned char dp; | 887 | unsigned char dp; |
917 | unsigned char* rp; | 888 | unsigned char *rp; |
918 | int i; | 889 | int i; |
919 | 890 | ||
920 | rp = nubus_rom_addr(slot); | 891 | rp = nubus_rom_addr(slot); |
921 | for(i = 4; i; i--) | 892 | for (i = 4; i; i--) { |
922 | { | ||
923 | int card_present; | 893 | int card_present; |
924 | 894 | ||
925 | rp--; | 895 | rp--; |
@@ -927,7 +897,6 @@ void __init nubus_probe_slot(int slot) | |||
927 | if (!card_present) | 897 | if (!card_present) |
928 | continue; | 898 | continue; |
929 | 899 | ||
930 | printk(KERN_DEBUG "Now probing slot %X at %p\n", slot, rp); | ||
931 | dp = *rp; | 900 | dp = *rp; |
932 | if(dp == 0) | 901 | if(dp == 0) |
933 | continue; | 902 | continue; |
@@ -935,11 +904,11 @@ void __init nubus_probe_slot(int slot) | |||
935 | /* The last byte of the format block consists of two | 904 | /* The last byte of the format block consists of two |
936 | nybbles which are "mirror images" of each other. | 905 | nybbles which are "mirror images" of each other. |
937 | These show us the valid bytelanes */ | 906 | These show us the valid bytelanes */ |
938 | if ((((dp>>4) ^ dp) & 0x0F) != 0x0F) | 907 | if ((((dp >> 4) ^ dp) & 0x0F) != 0x0F) |
939 | continue; | 908 | continue; |
940 | /* Check that this value is actually *on* one of the | 909 | /* Check that this value is actually *on* one of the |
941 | bytelanes it claims are valid! */ | 910 | bytelanes it claims are valid! */ |
942 | if ((dp & 0x0F) >= (1<<i)) | 911 | if ((dp & 0x0F) >= (1 << i)) |
943 | continue; | 912 | continue; |
944 | 913 | ||
945 | /* Looks promising. Let's put it on the list. */ | 914 | /* Looks promising. Let's put it on the list. */ |
@@ -952,19 +921,19 @@ void __init nubus_probe_slot(int slot) | |||
952 | void __init nubus_scan_bus(void) | 921 | void __init nubus_scan_bus(void) |
953 | { | 922 | { |
954 | int slot; | 923 | int slot; |
924 | |||
955 | /* This might not work on your machine */ | 925 | /* This might not work on your machine */ |
956 | #ifdef I_WANT_TO_PROBE_SLOT_ZERO | 926 | #ifdef I_WANT_TO_PROBE_SLOT_ZERO |
957 | nubus_probe_slot(0); | 927 | nubus_probe_slot(0); |
958 | #endif | 928 | #endif |
959 | for(slot = 9; slot < 15; slot++) | 929 | for (slot = 9; slot < 15; slot++) { |
960 | { | ||
961 | nubus_probe_slot(slot); | 930 | nubus_probe_slot(slot); |
962 | } | 931 | } |
963 | } | 932 | } |
964 | 933 | ||
965 | static int __init nubus_init(void) | 934 | static int __init nubus_init(void) |
966 | { | 935 | { |
967 | if (!MACH_IS_MAC) | 936 | if (!MACH_IS_MAC) |
968 | return 0; | 937 | return 0; |
969 | 938 | ||
970 | /* Initialize the NuBus interrupts */ | 939 | /* Initialize the NuBus interrupts */ |
@@ -980,11 +949,11 @@ static int __init nubus_init(void) | |||
980 | gurus can fix the real cause of the problem. */ | 949 | gurus can fix the real cause of the problem. */ |
981 | mdelay(1000); | 950 | mdelay(1000); |
982 | #endif | 951 | #endif |
983 | 952 | ||
984 | /* And probe */ | 953 | /* And probe */ |
985 | printk("NuBus: Scanning NuBus slots.\n"); | 954 | pr_info("NuBus: Scanning NuBus slots.\n"); |
986 | nubus_devices = NULL; | 955 | nubus_devices = NULL; |
987 | nubus_boards = NULL; | 956 | nubus_boards = NULL; |
988 | nubus_scan_bus(); | 957 | nubus_scan_bus(); |
989 | nubus_proc_init(); | 958 | nubus_proc_init(); |
990 | return 0; | 959 | return 0; |
diff --git a/include/uapi/linux/nubus.h b/include/uapi/linux/nubus.h index 77513d2b5638..ac516064f0ee 100644 --- a/include/uapi/linux/nubus.h +++ b/include/uapi/linux/nubus.h | |||
@@ -113,13 +113,15 @@ enum nubus_drhw { | |||
113 | NUBUS_DRHW_SIGMA_CLRMAX = 0x0007, /* Sigma Design ColorMax */ | 113 | NUBUS_DRHW_SIGMA_CLRMAX = 0x0007, /* Sigma Design ColorMax */ |
114 | NUBUS_DRHW_APPLE_SE30 = 0x0009, /* Apple SE/30 video */ | 114 | NUBUS_DRHW_APPLE_SE30 = 0x0009, /* Apple SE/30 video */ |
115 | NUBUS_DRHW_APPLE_HRVC = 0x0013, /* Mac II High-Res Video Card */ | 115 | NUBUS_DRHW_APPLE_HRVC = 0x0013, /* Mac II High-Res Video Card */ |
116 | NUBUS_DRHW_APPLE_MVC = 0x0014, /* Mac II Monochrome Video Card */ | ||
116 | NUBUS_DRHW_APPLE_PVC = 0x0017, /* Mac II Portrait Video Card */ | 117 | NUBUS_DRHW_APPLE_PVC = 0x0017, /* Mac II Portrait Video Card */ |
117 | NUBUS_DRHW_APPLE_RBV1 = 0x0018, /* IIci RBV video */ | 118 | NUBUS_DRHW_APPLE_RBV1 = 0x0018, /* IIci RBV video */ |
118 | NUBUS_DRHW_APPLE_MDC = 0x0019, /* Macintosh Display Card */ | 119 | NUBUS_DRHW_APPLE_MDC = 0x0019, /* Macintosh Display Card */ |
120 | NUBUS_DRHW_APPLE_VSC = 0x0020, /* Duo MiniDock ViSC framebuffer */ | ||
119 | NUBUS_DRHW_APPLE_SONORA = 0x0022, /* Sonora built-in video */ | 121 | NUBUS_DRHW_APPLE_SONORA = 0x0022, /* Sonora built-in video */ |
122 | NUBUS_DRHW_APPLE_JET = 0x0029, /* Jet framebuffer (DuoDock) */ | ||
120 | NUBUS_DRHW_APPLE_24AC = 0x002b, /* Mac 24AC Video Card */ | 123 | NUBUS_DRHW_APPLE_24AC = 0x002b, /* Mac 24AC Video Card */ |
121 | NUBUS_DRHW_APPLE_VALKYRIE = 0x002e, | 124 | NUBUS_DRHW_APPLE_VALKYRIE = 0x002e, |
122 | NUBUS_DRHW_APPLE_JET = 0x0029, /* Jet framebuffer (DuoDock) */ | ||
123 | NUBUS_DRHW_SMAC_GFX = 0x0105, /* SuperMac GFX */ | 125 | NUBUS_DRHW_SMAC_GFX = 0x0105, /* SuperMac GFX */ |
124 | NUBUS_DRHW_RASTER_CB264 = 0x013B, /* RasterOps ColorBoard 264 */ | 126 | NUBUS_DRHW_RASTER_CB264 = 0x013B, /* RasterOps ColorBoard 264 */ |
125 | NUBUS_DRHW_MICRON_XCEED = 0x0146, /* Micron Exceed color */ | 127 | NUBUS_DRHW_MICRON_XCEED = 0x0146, /* Micron Exceed color */ |