Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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