Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
[SPARC64]: fix section mismatch warning in mdesc.c
[SPARC64]: fix section mismatch warning in pci_sunv4
[SPARC64]: Stop using drivers/char/rtc.c
[SPARC64]: Convert parport to of_platform_driver.
[SPARC]: Implement fb_is_primary_device().
[SPARC64]: Fix virq decomposition.
[SPARC64]: Use KERN_ERR in IRQ manipulation error printks.
[SPARC64]: Do not flood log with failed DS messages.
[SPARC64]: Add proper multicast support to VNET driver.
[SPARC64]: Handle multiple domain-services-port nodes properly.
[SPARC64]: Improve VIO device naming further.
[SPARC]: Make sure dev_archdata is filled in for all devices.
[SPARC]: Define minimal struct dev_archdata, similarly to sparc64.
[SPARC]: Fix serial console device detection.

+928 -835
+5
arch/sparc/kernel/ebus.c
··· 148 { 149 const struct linux_prom_registers *regs; 150 struct linux_ebus_child *child; 151 const int *irqs; 152 int i, n, len; 153 unsigned long baseaddr; ··· 234 } 235 } 236 } 237 238 dev->ofdev.node = dp; 239 dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
··· 148 { 149 const struct linux_prom_registers *regs; 150 struct linux_ebus_child *child; 151 + struct dev_archdata *sd; 152 const int *irqs; 153 int i, n, len; 154 unsigned long baseaddr; ··· 233 } 234 } 235 } 236 + 237 + sd = &dev->ofdev.dev.archdata; 238 + sd->prom_node = dp; 239 + sd->op = &dev->ofdev; 240 241 dev->ofdev.node = dp; 242 dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
+5
arch/sparc/kernel/of_device.c
··· 420 { 421 struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); 422 const struct linux_prom_irqs *intr; 423 int len, i; 424 425 if (!op) 426 return NULL; 427 428 op->node = dp; 429
··· 420 { 421 struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); 422 const struct linux_prom_irqs *intr; 423 + struct dev_archdata *sd; 424 int len, i; 425 426 if (!op) 427 return NULL; 428 + 429 + sd = &op->dev.archdata; 430 + sd->prom_node = dp; 431 + sd->op = op; 432 433 op->node = dp; 434
+5 -3
arch/sparc/kernel/process.c
··· 39 #include <asm/processor.h> 40 #include <asm/psr.h> 41 #include <asm/elf.h> 42 #include <asm/unistd.h> 43 44 /* ··· 151 local_irq_enable(); 152 mdelay(8); 153 local_irq_disable(); 154 - if (!serial_console && prom_palette) 155 prom_palette (1); 156 prom_halt(); 157 panic("Halt failed!"); ··· 167 168 p = strchr (reboot_command, '\n'); 169 if (p) *p = 0; 170 - if (!serial_console && prom_palette) 171 prom_palette (1); 172 if (cmd) 173 prom_reboot(cmd); ··· 180 void machine_power_off(void) 181 { 182 #ifdef CONFIG_SUN_AUXIO 183 - if (auxio_power_register && (!serial_console || scons_pwroff)) 184 *auxio_power_register |= AUXIO_POWER_OFF; 185 #endif 186 machine_halt();
··· 39 #include <asm/processor.h> 40 #include <asm/psr.h> 41 #include <asm/elf.h> 42 + #include <asm/prom.h> 43 #include <asm/unistd.h> 44 45 /* ··· 150 local_irq_enable(); 151 mdelay(8); 152 local_irq_disable(); 153 + if (prom_palette) 154 prom_palette (1); 155 prom_halt(); 156 panic("Halt failed!"); ··· 166 167 p = strchr (reboot_command, '\n'); 168 if (p) *p = 0; 169 + if (prom_palette) 170 prom_palette (1); 171 if (cmd) 172 prom_reboot(cmd); ··· 179 void machine_power_off(void) 180 { 181 #ifdef CONFIG_SUN_AUXIO 182 + if (auxio_power_register && 183 + (strcmp(of_console_device->type, "serial") || scons_pwroff)) 184 *auxio_power_register |= AUXIO_POWER_OFF; 185 #endif 186 machine_halt();
+131
arch/sparc/kernel/prom.c
··· 397 return dp; 398 } 399 400 void __init prom_build_devicetree(void) 401 { 402 struct device_node **nextp; ··· 538 allnodes->child = build_tree(allnodes, 539 prom_getchild(allnodes->node), 540 &nextp); 541 printk("PROM: Built device tree with %u bytes of memory.\n", 542 prom_early_allocated); 543 }
··· 397 return dp; 398 } 399 400 + struct device_node *of_console_device; 401 + EXPORT_SYMBOL(of_console_device); 402 + 403 + char *of_console_path; 404 + EXPORT_SYMBOL(of_console_path); 405 + 406 + char *of_console_options; 407 + EXPORT_SYMBOL(of_console_options); 408 + 409 + extern void restore_current(void); 410 + 411 + static void __init of_console_init(void) 412 + { 413 + char *msg = "OF stdout device is: %s\n"; 414 + struct device_node *dp; 415 + unsigned long flags; 416 + const char *type; 417 + phandle node; 418 + int skip, fd; 419 + 420 + of_console_path = prom_early_alloc(256); 421 + 422 + switch (prom_vers) { 423 + case PROM_V0: 424 + case PROM_SUN4: 425 + skip = 0; 426 + switch (*romvec->pv_stdout) { 427 + case PROMDEV_SCREEN: 428 + type = "display"; 429 + break; 430 + 431 + case PROMDEV_TTYB: 432 + skip = 1; 433 + /* FALLTHRU */ 434 + 435 + case PROMDEV_TTYA: 436 + type = "serial"; 437 + break; 438 + 439 + default: 440 + prom_printf("Invalid PROM_V0 stdout value %u\n", 441 + *romvec->pv_stdout); 442 + prom_halt(); 443 + } 444 + 445 + for_each_node_by_type(dp, type) { 446 + if (!skip--) 447 + break; 448 + } 449 + if (!dp) { 450 + prom_printf("Cannot find PROM_V0 console node.\n"); 451 + prom_halt(); 452 + } 453 + of_console_device = dp; 454 + 455 + strcpy(of_console_path, dp->full_name); 456 + if (!strcmp(type, "serial")) { 457 + strcat(of_console_path, 458 + (skip ? ":b" : ":a")); 459 + } 460 + break; 461 + 462 + default: 463 + case PROM_V2: 464 + case PROM_V3: 465 + fd = *romvec->pv_v2bootargs.fd_stdout; 466 + 467 + spin_lock_irqsave(&prom_lock, flags); 468 + node = (*romvec->pv_v2devops.v2_inst2pkg)(fd); 469 + restore_current(); 470 + spin_unlock_irqrestore(&prom_lock, flags); 471 + 472 + if (!node) { 473 + prom_printf("Cannot resolve stdout node from " 474 + "instance %08x.\n", fd); 475 + prom_halt(); 476 + } 477 + dp = of_find_node_by_phandle(node); 478 + type = of_get_property(dp, "device_type", NULL); 479 + 480 + if (!type) { 481 + prom_printf("Console stdout lacks " 482 + "device_type property.\n"); 483 + prom_halt(); 484 + } 485 + 486 + if (strcmp(type, "display") && strcmp(type, "serial")) { 487 + prom_printf("Console device_type is neither display " 488 + "nor serial.\n"); 489 + prom_halt(); 490 + } 491 + 492 + of_console_device = dp; 493 + 494 + if (prom_vers == PROM_V2) { 495 + strcpy(of_console_path, dp->full_name); 496 + switch (*romvec->pv_stdout) { 497 + case PROMDEV_TTYA: 498 + strcat(of_console_path, ":a"); 499 + break; 500 + case PROMDEV_TTYB: 501 + strcat(of_console_path, ":b"); 502 + break; 503 + } 504 + } else { 505 + const char *path; 506 + 507 + dp = of_find_node_by_path("/"); 508 + path = of_get_property(dp, "stdout-path", NULL); 509 + if (!path) { 510 + prom_printf("No stdout-path in root node.\n"); 511 + prom_halt(); 512 + } 513 + strcpy(of_console_path, path); 514 + } 515 + break; 516 + } 517 + 518 + of_console_options = strrchr(of_console_path, ':'); 519 + if (of_console_options) { 520 + of_console_options++; 521 + if (*of_console_options == '\0') 522 + of_console_options = NULL; 523 + } 524 + 525 + prom_printf(msg, of_console_path); 526 + printk(msg, of_console_path); 527 + } 528 + 529 void __init prom_build_devicetree(void) 530 { 531 struct device_node **nextp; ··· 409 allnodes->child = build_tree(allnodes, 410 prom_getchild(allnodes->node), 411 &nextp); 412 + of_console_init(); 413 + 414 printk("PROM: Built device tree with %u bytes of memory.\n", 415 prom_early_allocated); 416 }
+1 -64
arch/sparc/kernel/setup.c
··· 146 } 147 } 148 149 - static void __init process_console(char *commands) 150 - { 151 - serial_console = 0; 152 - commands += 8; 153 - /* Linux-style serial */ 154 - if (!strncmp(commands, "ttyS", 4)) 155 - serial_console = simple_strtoul(commands + 4, NULL, 10) + 1; 156 - else if (!strncmp(commands, "tty", 3)) { 157 - char c = *(commands + 3); 158 - /* Solaris-style serial */ 159 - if (c == 'a' || c == 'b') 160 - serial_console = c - 'a' + 1; 161 - /* else Linux-style fbcon, not serial */ 162 - } 163 - #if defined(CONFIG_PROM_CONSOLE) 164 - if (!strncmp(commands, "prom", 4)) { 165 - char *p; 166 - 167 - for (p = commands - 8; *p && *p != ' '; p++) 168 - *p = ' '; 169 - conswitchp = &prom_con; 170 - } 171 - #endif 172 - } 173 - 174 static void __init boot_flags_init(char *commands) 175 { 176 while (*commands) { ··· 162 process_switch(*commands++); 163 continue; 164 } 165 - if (!strncmp(commands, "console=", 8)) { 166 - process_console(commands); 167 - } else if (!strncmp(commands, "mem=", 4)) { 168 /* 169 * "mem=XXX[kKmM] overrides the PROM-reported 170 * memory size. ··· 314 smp_setup_cpu_possible_map(); 315 } 316 317 - static int __init set_preferred_console(void) 318 - { 319 - int idev, odev; 320 - 321 - /* The user has requested a console so this is already set up. */ 322 - if (serial_console >= 0) 323 - return -EBUSY; 324 - 325 - idev = prom_query_input_device(); 326 - odev = prom_query_output_device(); 327 - if (idev == PROMDEV_IKBD && odev == PROMDEV_OSCREEN) { 328 - serial_console = 0; 329 - } else if (idev == PROMDEV_ITTYA && odev == PROMDEV_OTTYA) { 330 - serial_console = 1; 331 - } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) { 332 - serial_console = 2; 333 - } else if (idev == PROMDEV_I_UNK && odev == PROMDEV_OTTYA) { 334 - prom_printf("MrCoffee ttya\n"); 335 - serial_console = 1; 336 - } else if (idev == PROMDEV_I_UNK && odev == PROMDEV_OSCREEN) { 337 - serial_console = 0; 338 - prom_printf("MrCoffee keyboard\n"); 339 - } else { 340 - prom_printf("Confusing console (idev %d, odev %d)\n", 341 - idev, odev); 342 - serial_console = 1; 343 - } 344 - 345 - if (serial_console) 346 - return add_preferred_console("ttyS", serial_console - 1, NULL); 347 - 348 - return -ENODEV; 349 - } 350 - console_initcall(set_preferred_console); 351 - 352 extern char *sparc_cpu_type; 353 extern char *sparc_fpu_type; 354 ··· 399 prom_cmdline(); 400 } 401 402 - int serial_console = -1; 403 int stop_a_enabled = 1; 404 405 static int __init topology_init(void)
··· 146 } 147 } 148 149 static void __init boot_flags_init(char *commands) 150 { 151 while (*commands) { ··· 187 process_switch(*commands++); 188 continue; 189 } 190 + if (!strncmp(commands, "mem=", 4)) { 191 /* 192 * "mem=XXX[kKmM] overrides the PROM-reported 193 * memory size. ··· 341 smp_setup_cpu_possible_map(); 342 } 343 344 extern char *sparc_cpu_type; 345 extern char *sparc_fpu_type; 346 ··· 461 prom_cmdline(); 462 } 463 464 int stop_a_enabled = 1; 465 466 static int __init topology_init(void)
-116
arch/sparc/prom/console.c
··· 102 while(prom_nbputchar(c) == -1) ; 103 return; 104 } 105 - 106 - /* Query for input device type */ 107 - enum prom_input_device 108 - prom_query_input_device(void) 109 - { 110 - unsigned long flags; 111 - int st_p; 112 - char propb[64]; 113 - char *p; 114 - int propl; 115 - 116 - switch(prom_vers) { 117 - case PROM_V0: 118 - case PROM_V2: 119 - case PROM_SUN4: 120 - default: 121 - switch(*romvec->pv_stdin) { 122 - case PROMDEV_KBD: return PROMDEV_IKBD; 123 - case PROMDEV_TTYA: return PROMDEV_ITTYA; 124 - case PROMDEV_TTYB: return PROMDEV_ITTYB; 125 - default: 126 - return PROMDEV_I_UNK; 127 - }; 128 - case PROM_V3: 129 - spin_lock_irqsave(&prom_lock, flags); 130 - st_p = (*romvec->pv_v2devops.v2_inst2pkg)(*romvec->pv_v2bootargs.fd_stdin); 131 - restore_current(); 132 - spin_unlock_irqrestore(&prom_lock, flags); 133 - if(prom_node_has_property(st_p, "keyboard")) 134 - return PROMDEV_IKBD; 135 - if (prom_getproperty(st_p, "name", propb, sizeof(propb)) != -1) { 136 - if(strncmp(propb, "keyboard", sizeof("serial")) == 0) 137 - return PROMDEV_IKBD; 138 - } 139 - if (prom_getproperty(st_p, "device_type", propb, sizeof(propb)) != -1) { 140 - if(strncmp(propb, "serial", sizeof("serial"))) 141 - return PROMDEV_I_UNK; 142 - } 143 - propl = prom_getproperty(prom_root_node, "stdin-path", propb, sizeof(propb)); 144 - if(propl > 2) { 145 - p = propb; 146 - while(*p) p++; p -= 2; 147 - if(p[0] == ':') { 148 - if(p[1] == 'a') 149 - return PROMDEV_ITTYA; 150 - else if(p[1] == 'b') 151 - return PROMDEV_ITTYB; 152 - } 153 - } 154 - return PROMDEV_I_UNK; 155 - } 156 - } 157 - 158 - /* Query for output device type */ 159 - 160 - enum prom_output_device 161 - prom_query_output_device(void) 162 - { 163 - unsigned long flags; 164 - int st_p; 165 - char propb[64]; 166 - char *p; 167 - int propl; 168 - 169 - switch(prom_vers) { 170 - case PROM_V0: 171 - case PROM_SUN4: 172 - switch(*romvec->pv_stdin) { 173 - case PROMDEV_SCREEN: return PROMDEV_OSCREEN; 174 - case PROMDEV_TTYA: return PROMDEV_OTTYA; 175 - case PROMDEV_TTYB: return PROMDEV_OTTYB; 176 - }; 177 - break; 178 - case PROM_V2: 179 - case PROM_V3: 180 - spin_lock_irqsave(&prom_lock, flags); 181 - st_p = (*romvec->pv_v2devops.v2_inst2pkg)(*romvec->pv_v2bootargs.fd_stdout); 182 - restore_current(); 183 - spin_unlock_irqrestore(&prom_lock, flags); 184 - propl = prom_getproperty(st_p, "device_type", propb, sizeof(propb)); 185 - if (propl == sizeof("display") && 186 - strncmp("display", propb, sizeof("display")) == 0) 187 - { 188 - return PROMDEV_OSCREEN; 189 - } 190 - if(prom_vers == PROM_V3) { 191 - if(propl >= 0 && 192 - strncmp("serial", propb, sizeof("serial")) != 0) 193 - return PROMDEV_O_UNK; 194 - propl = prom_getproperty(prom_root_node, "stdout-path", 195 - propb, sizeof(propb)); 196 - if(propl == CON_SIZE_JMC && 197 - strncmp(propb, con_name_jmc, CON_SIZE_JMC) == 0) 198 - return PROMDEV_OTTYA; 199 - if(propl > 2) { 200 - p = propb; 201 - while(*p) p++; p-= 2; 202 - if(p[0]==':') { 203 - if(p[1] == 'a') 204 - return PROMDEV_OTTYA; 205 - else if(p[1] == 'b') 206 - return PROMDEV_OTTYB; 207 - } 208 - } 209 - } else { 210 - switch(*romvec->pv_stdin) { 211 - case PROMDEV_TTYA: return PROMDEV_OTTYA; 212 - case PROMDEV_TTYB: return PROMDEV_OTTYB; 213 - }; 214 - } 215 - break; 216 - default: 217 - ; 218 - }; 219 - return PROMDEV_O_UNK; 220 - }
··· 102 while(prom_nbputchar(c) == -1) ; 103 return; 104 }
+2 -2
arch/sparc/prom/misc.c
··· 58 extern void install_linux_ticker(void); 59 unsigned long flags; 60 61 - if(!serial_console && prom_palette) 62 prom_palette (1); 63 spin_lock_irqsave(&prom_lock, flags); 64 install_obp_ticker(); ··· 69 #ifdef CONFIG_SUN_AUXIO 70 set_auxio(AUXIO_LED, 0); 71 #endif 72 - if(!serial_console && prom_palette) 73 prom_palette (0); 74 } 75
··· 58 extern void install_linux_ticker(void); 59 unsigned long flags; 60 61 + if (prom_palette) 62 prom_palette (1); 63 spin_lock_irqsave(&prom_lock, flags); 64 install_obp_ticker(); ··· 69 #ifdef CONFIG_SUN_AUXIO 70 set_auxio(AUXIO_LED, 0); 71 #endif 72 + if (prom_palette) 73 prom_palette (0); 74 } 75
+155 -94
arch/sparc64/kernel/ds.c
··· 124 __u64 result; 125 }; 126 127 struct ds_cap_state { 128 __u64 handle; 129 130 - void (*data)(struct ldc_channel *lp, 131 struct ds_cap_state *cp, 132 void *buf, int len); 133 ··· 140 #define CAP_STATE_REGISTERED 0x02 141 }; 142 143 - static void md_update_data(struct ldc_channel *lp, struct ds_cap_state *cp, 144 void *buf, int len); 145 - static void domain_shutdown_data(struct ldc_channel *lp, 146 struct ds_cap_state *cp, 147 void *buf, int len); 148 - static void domain_panic_data(struct ldc_channel *lp, 149 struct ds_cap_state *cp, 150 void *buf, int len); 151 #ifdef CONFIG_HOTPLUG_CPU 152 - static void dr_cpu_data(struct ldc_channel *lp, 153 struct ds_cap_state *cp, 154 void *buf, int len); 155 #endif 156 - static void ds_pri_data(struct ldc_channel *lp, 157 struct ds_cap_state *cp, 158 void *buf, int len); 159 - static void ds_var_data(struct ldc_channel *lp, 160 struct ds_cap_state *cp, 161 void *buf, int len); 162 163 - struct ds_cap_state ds_states[] = { 164 { 165 .service_id = "md-update", 166 .data = md_update_data, ··· 201 #define DS_HS_START 0x01 202 #define DS_HS_DONE 0x02 203 204 void *rcv_buf; 205 int rcv_buf_len; 206 }; 207 208 - static struct ds_info *ds_info; 209 210 - static struct ds_cap_state *find_cap(u64 handle) 211 { 212 unsigned int index = handle >> 32; 213 214 - if (index >= ARRAY_SIZE(ds_states)) 215 return NULL; 216 - return &ds_states[index]; 217 } 218 219 - static struct ds_cap_state *find_cap_by_string(const char *name) 220 { 221 int i; 222 223 - for (i = 0; i < ARRAY_SIZE(ds_states); i++) { 224 - if (strcmp(ds_states[i].service_id, name)) 225 continue; 226 227 - return &ds_states[i]; 228 } 229 return NULL; 230 } ··· 273 __u32 result; 274 }; 275 276 - static void md_update_data(struct ldc_channel *lp, 277 - struct ds_cap_state *dp, 278 void *buf, int len) 279 { 280 struct ds_data *dpkt = buf; 281 struct ds_md_update_req *rp; 282 struct { ··· 287 288 rp = (struct ds_md_update_req *) (dpkt + 1); 289 290 - printk(KERN_INFO PFX "Machine description update.\n"); 291 292 mdesc_update(); 293 294 memset(&pkt, 0, sizeof(pkt)); 295 pkt.data.tag.type = DS_DATA; 296 pkt.data.tag.len = sizeof(pkt) - sizeof(struct ds_msg_tag); 297 - pkt.data.handle = dp->handle; 298 pkt.res.req_num = rp->req_num; 299 pkt.res.result = DS_OK; 300 ··· 312 char reason[1]; 313 }; 314 315 - static void domain_shutdown_data(struct ldc_channel *lp, 316 - struct ds_cap_state *dp, 317 void *buf, int len) 318 { 319 struct ds_data *dpkt = buf; 320 struct ds_shutdown_req *rp; 321 struct { ··· 326 327 rp = (struct ds_shutdown_req *) (dpkt + 1); 328 329 - printk(KERN_ALERT PFX "Shutdown request from " 330 - "LDOM manager received.\n"); 331 332 memset(&pkt, 0, sizeof(pkt)); 333 pkt.data.tag.type = DS_DATA; 334 pkt.data.tag.len = sizeof(pkt) - sizeof(struct ds_msg_tag); 335 - pkt.data.handle = dp->handle; 336 pkt.res.req_num = rp->req_num; 337 pkt.res.result = DS_OK; 338 pkt.res.reason[0] = 0; ··· 352 char reason[1]; 353 }; 354 355 - static void domain_panic_data(struct ldc_channel *lp, 356 - struct ds_cap_state *dp, 357 void *buf, int len) 358 { 359 struct ds_data *dpkt = buf; 360 struct ds_panic_req *rp; 361 struct { ··· 366 367 rp = (struct ds_panic_req *) (dpkt + 1); 368 369 - printk(KERN_ALERT PFX "Panic request from " 370 - "LDOM manager received.\n"); 371 372 memset(&pkt, 0, sizeof(pkt)); 373 pkt.data.tag.type = DS_DATA; 374 pkt.data.tag.len = sizeof(pkt) - sizeof(struct ds_msg_tag); 375 - pkt.data.handle = dp->handle; 376 pkt.res.req_num = rp->req_num; 377 pkt.res.result = DS_OK; 378 pkt.res.reason[0] = 0; ··· 415 __u32 str_off; 416 }; 417 418 - static void __dr_cpu_send_error(struct ds_cap_state *cp, struct ds_data *data) 419 { 420 struct dr_cpu_tag *tag = (struct dr_cpu_tag *) (data + 1); 421 - struct ds_info *dp = ds_info; 422 struct { 423 struct ds_data data; 424 struct dr_cpu_tag tag; ··· 441 __ds_send(dp->lp, &pkt, msg_len); 442 } 443 444 - static void dr_cpu_send_error(struct ds_cap_state *cp, struct ds_data *data) 445 { 446 unsigned long flags; 447 448 spin_lock_irqsave(&ds_lock, flags); 449 - __dr_cpu_send_error(cp, data); 450 spin_unlock_irqrestore(&ds_lock, flags); 451 } 452 ··· 526 } 527 } 528 529 - static int dr_cpu_configure(struct ds_cap_state *cp, u64 req_num, 530 cpumask_t *mask) 531 { 532 struct ds_data *resp; ··· 550 for_each_cpu_mask(cpu, *mask) { 551 int err; 552 553 - printk(KERN_INFO PFX "Starting cpu %d...\n", cpu); 554 err = cpu_up(cpu); 555 if (err) { 556 __u32 res = DR_CPU_RES_FAILURE; ··· 566 res = DR_CPU_RES_CPU_NOT_RESPONDING; 567 } 568 569 - printk(KERN_INFO PFX "CPU startup failed err=%d\n", 570 - err); 571 dr_cpu_mark(resp, cpu, ncpus, res, stat); 572 } 573 } 574 575 spin_lock_irqsave(&ds_lock, flags); 576 - __ds_send(ds_info->lp, resp, resp_len); 577 spin_unlock_irqrestore(&ds_lock, flags); 578 579 kfree(resp); ··· 584 return 0; 585 } 586 587 - static int dr_cpu_unconfigure(struct ds_cap_state *cp, u64 req_num, 588 cpumask_t *mask) 589 { 590 struct ds_data *resp; ··· 606 for_each_cpu_mask(cpu, *mask) { 607 int err; 608 609 - printk(KERN_INFO PFX "CPU[%d]: Shutting down cpu %d...\n", 610 - smp_processor_id(), cpu); 611 err = cpu_down(cpu); 612 if (err) 613 dr_cpu_mark(resp, cpu, ncpus, ··· 616 } 617 618 spin_lock_irqsave(&ds_lock, flags); 619 - __ds_send(ds_info->lp, resp, resp_len); 620 spin_unlock_irqrestore(&ds_lock, flags); 621 622 kfree(resp); ··· 624 return 0; 625 } 626 627 - static void dr_cpu_data(struct ldc_channel *lp, 628 struct ds_cap_state *cp, 629 void *buf, int len) 630 { ··· 643 break; 644 645 default: 646 - dr_cpu_send_error(cp, data); 647 return; 648 } 649 ··· 659 } 660 661 if (tag->type == DR_CPU_CONFIGURE) 662 - err = dr_cpu_configure(cp, req_num, &mask); 663 else 664 - err = dr_cpu_unconfigure(cp, req_num, &mask); 665 666 if (err) 667 - dr_cpu_send_error(cp, data); 668 } 669 #endif /* CONFIG_HOTPLUG_CPU */ 670 ··· 676 #define DS_PRI_UPDATE 0x02 677 }; 678 679 - static void ds_pri_data(struct ldc_channel *lp, 680 - struct ds_cap_state *dp, 681 void *buf, int len) 682 { 683 struct ds_data *dpkt = buf; ··· 685 686 rp = (struct ds_pri_msg *) (dpkt + 1); 687 688 - printk(KERN_INFO PFX "PRI REQ [%lx:%lx], len=%d\n", 689 - rp->req_num, rp->type, len); 690 } 691 692 struct ds_var_hdr { ··· 721 static int ds_var_doorbell; 722 static int ds_var_response; 723 724 - static void ds_var_data(struct ldc_channel *lp, 725 - struct ds_cap_state *dp, 726 void *buf, int len) 727 { 728 struct ds_data *dpkt = buf; ··· 741 742 void ldom_set_var(const char *var, const char *value) 743 { 744 - struct ds_info *dp = ds_info; 745 struct ds_cap_state *cp; 746 747 - cp = find_cap_by_string("var-config"); 748 - if (cp->state != CAP_STATE_REGISTERED) 749 - cp = find_cap_by_string("var-config-backup"); 750 751 - if (cp->state == CAP_STATE_REGISTERED) { 752 union { 753 struct { 754 struct ds_data data; ··· 777 } header; 778 char all[512]; 779 } pkt; 780 - unsigned long flags; 781 char *base, *p; 782 int msg_len, loops; 783 ··· 817 818 if (ds_var_doorbell == 0 || 819 ds_var_response != DS_VAR_SUCCESS) 820 - printk(KERN_ERR PFX "var-config [%s:%s] " 821 "failed, response(%d).\n", 822 - var, value, 823 ds_var_response); 824 } else { 825 printk(KERN_ERR PFX "var-config not registered so " ··· 851 852 static void ds_conn_reset(struct ds_info *dp) 853 { 854 - printk(KERN_ERR PFX "ds_conn_reset() from %p\n", 855 - __builtin_return_address(0)); 856 } 857 858 static int register_services(struct ds_info *dp) ··· 860 struct ldc_channel *lp = dp->lp; 861 int i; 862 863 - for (i = 0; i < ARRAY_SIZE(ds_states); i++) { 864 struct { 865 struct ds_reg_req req; 866 u8 id_buf[256]; 867 } pbuf; 868 - struct ds_cap_state *cp = &ds_states[i]; 869 int err, msg_len; 870 u64 new_count; 871 ··· 910 911 if (pkt->type == DS_REG_ACK) { 912 struct ds_reg_ack *ap = (struct ds_reg_ack *) pkt; 913 - struct ds_cap_state *cp = find_cap(ap->handle); 914 915 if (!cp) { 916 - printk(KERN_ERR PFX "REG ACK for unknown handle %lx\n", 917 - ap->handle); 918 return 0; 919 } 920 - printk(KERN_INFO PFX "Registered %s service.\n", 921 - cp->service_id); 922 cp->state = CAP_STATE_REGISTERED; 923 } else if (pkt->type == DS_REG_NACK) { 924 struct ds_reg_nack *np = (struct ds_reg_nack *) pkt; 925 - struct ds_cap_state *cp = find_cap(np->handle); 926 927 if (!cp) { 928 - printk(KERN_ERR PFX "REG NACK for " 929 "unknown handle %lx\n", 930 - np->handle); 931 return 0; 932 } 933 - printk(KERN_INFO PFX "Could not register %s service\n", 934 - cp->service_id); 935 cp->state = CAP_STATE_UNKNOWN; 936 } 937 ··· 960 961 struct ds_queue_entry { 962 struct list_head list; 963 int req_len; 964 int __pad; 965 u64 req[0]; ··· 969 static void process_ds_work(void) 970 { 971 struct ds_queue_entry *qp, *tmp; 972 - static struct ds_info *dp; 973 unsigned long flags; 974 LIST_HEAD(todo); 975 ··· 977 INIT_LIST_HEAD(&ds_work_list); 978 spin_unlock_irqrestore(&ds_lock, flags); 979 980 - dp = ds_info; 981 - 982 list_for_each_entry_safe(qp, tmp, &todo, list) { 983 struct ds_data *dpkt = (struct ds_data *) qp->req; 984 - struct ds_cap_state *cp = find_cap(dpkt->handle); 985 int req_len = qp->req_len; 986 987 if (!cp) { 988 - printk(KERN_ERR PFX "Data for unknown handle %lu\n", 989 - dpkt->handle); 990 991 spin_lock_irqsave(&ds_lock, flags); 992 __send_ds_nack(dp, dpkt->handle); 993 spin_unlock_irqrestore(&ds_lock, flags); 994 } else { 995 - cp->data(dp->lp, cp, dpkt, req_len); 996 } 997 998 list_del(&qp->list); ··· 1028 if (!qp) { 1029 __send_ds_nack(dp, dpkt->handle); 1030 } else { 1031 memcpy(&qp->req, pkt, len); 1032 list_add_tail(&qp->list, &ds_work_list); 1033 wake_up(&ds_wait); ··· 1058 1059 dp->hs_state = 0; 1060 1061 - for (i = 0; i < ARRAY_SIZE(ds_states); i++) { 1062 - struct ds_cap_state *cp = &ds_states[i]; 1063 1064 cp->state = CAP_STATE_UNKNOWN; 1065 } ··· 1087 } 1088 1089 if (event != LDC_EVENT_DATA_READY) { 1090 - printk(KERN_WARNING PFX "Unexpected LDC event %d\n", event); 1091 spin_unlock_irqrestore(&ds_lock, flags); 1092 return; 1093 } ··· 1139 .mtu = 4096, 1140 .mode = LDC_MODE_STREAM, 1141 }; 1142 struct ldc_channel *lp; 1143 struct ds_info *dp; 1144 - int err; 1145 1146 if (ds_version_printed++ == 0) 1147 printk(KERN_INFO "%s", version); ··· 1153 if (!dp) 1154 goto out_err; 1155 1156 dp->rcv_buf = kzalloc(4096, GFP_KERNEL); 1157 if (!dp->rcv_buf) 1158 goto out_free_dp; 1159 1160 dp->rcv_buf_len = 4096; 1161 1162 ds_cfg.tx_irq = vdev->tx_irq; 1163 ds_cfg.rx_irq = vdev->rx_irq; ··· 1183 lp = ldc_alloc(vdev->channel_id, &ds_cfg, dp); 1184 if (IS_ERR(lp)) { 1185 err = PTR_ERR(lp); 1186 - goto out_free_rcv_buf; 1187 } 1188 dp->lp = lp; 1189 ··· 1191 if (err) 1192 goto out_free_ldc; 1193 1194 - ds_info = dp; 1195 1196 return err; 1197 1198 out_free_ldc: 1199 ldc_free(dp->lp); 1200 1201 out_free_rcv_buf: 1202 kfree(dp->rcv_buf); ··· 1238 1239 static int __init ds_init(void) 1240 { 1241 - int i; 1242 - 1243 - for (i = 0; i < ARRAY_SIZE(ds_states); i++) 1244 - ds_states[i].handle = ((u64)i << 32); 1245 - 1246 kthread_run(ds_thread, NULL, "kldomd"); 1247 1248 return vio_register_driver(&ds_driver);
··· 124 __u64 result; 125 }; 126 127 + struct ds_info; 128 struct ds_cap_state { 129 __u64 handle; 130 131 + void (*data)(struct ds_info *dp, 132 struct ds_cap_state *cp, 133 void *buf, int len); 134 ··· 139 #define CAP_STATE_REGISTERED 0x02 140 }; 141 142 + static void md_update_data(struct ds_info *dp, struct ds_cap_state *cp, 143 void *buf, int len); 144 + static void domain_shutdown_data(struct ds_info *dp, 145 struct ds_cap_state *cp, 146 void *buf, int len); 147 + static void domain_panic_data(struct ds_info *dp, 148 struct ds_cap_state *cp, 149 void *buf, int len); 150 #ifdef CONFIG_HOTPLUG_CPU 151 + static void dr_cpu_data(struct ds_info *dp, 152 struct ds_cap_state *cp, 153 void *buf, int len); 154 #endif 155 + static void ds_pri_data(struct ds_info *dp, 156 struct ds_cap_state *cp, 157 void *buf, int len); 158 + static void ds_var_data(struct ds_info *dp, 159 struct ds_cap_state *cp, 160 void *buf, int len); 161 162 + struct ds_cap_state ds_states_template[] = { 163 { 164 .service_id = "md-update", 165 .data = md_update_data, ··· 200 #define DS_HS_START 0x01 201 #define DS_HS_DONE 0x02 202 203 + u64 id; 204 + 205 void *rcv_buf; 206 int rcv_buf_len; 207 + 208 + struct ds_cap_state *ds_states; 209 + int num_ds_states; 210 + 211 + struct ds_info *next; 212 }; 213 214 + static struct ds_info *ds_info_list; 215 216 + static struct ds_cap_state *find_cap(struct ds_info *dp, u64 handle) 217 { 218 unsigned int index = handle >> 32; 219 220 + if (index >= dp->num_ds_states) 221 return NULL; 222 + return &dp->ds_states[index]; 223 } 224 225 + static struct ds_cap_state *find_cap_by_string(struct ds_info *dp, 226 + const char *name) 227 { 228 int i; 229 230 + for (i = 0; i < dp->num_ds_states; i++) { 231 + if (strcmp(dp->ds_states[i].service_id, name)) 232 continue; 233 234 + return &dp->ds_states[i]; 235 } 236 return NULL; 237 } ··· 264 __u32 result; 265 }; 266 267 + static void md_update_data(struct ds_info *dp, 268 + struct ds_cap_state *cp, 269 void *buf, int len) 270 { 271 + struct ldc_channel *lp = dp->lp; 272 struct ds_data *dpkt = buf; 273 struct ds_md_update_req *rp; 274 struct { ··· 277 278 rp = (struct ds_md_update_req *) (dpkt + 1); 279 280 + printk(KERN_INFO "ds-%lu: Machine description update.\n", dp->id); 281 282 mdesc_update(); 283 284 memset(&pkt, 0, sizeof(pkt)); 285 pkt.data.tag.type = DS_DATA; 286 pkt.data.tag.len = sizeof(pkt) - sizeof(struct ds_msg_tag); 287 + pkt.data.handle = cp->handle; 288 pkt.res.req_num = rp->req_num; 289 pkt.res.result = DS_OK; 290 ··· 302 char reason[1]; 303 }; 304 305 + static void domain_shutdown_data(struct ds_info *dp, 306 + struct ds_cap_state *cp, 307 void *buf, int len) 308 { 309 + struct ldc_channel *lp = dp->lp; 310 struct ds_data *dpkt = buf; 311 struct ds_shutdown_req *rp; 312 struct { ··· 315 316 rp = (struct ds_shutdown_req *) (dpkt + 1); 317 318 + printk(KERN_ALERT "ds-%lu: Shutdown request from " 319 + "LDOM manager received.\n", dp->id); 320 321 memset(&pkt, 0, sizeof(pkt)); 322 pkt.data.tag.type = DS_DATA; 323 pkt.data.tag.len = sizeof(pkt) - sizeof(struct ds_msg_tag); 324 + pkt.data.handle = cp->handle; 325 pkt.res.req_num = rp->req_num; 326 pkt.res.result = DS_OK; 327 pkt.res.reason[0] = 0; ··· 341 char reason[1]; 342 }; 343 344 + static void domain_panic_data(struct ds_info *dp, 345 + struct ds_cap_state *cp, 346 void *buf, int len) 347 { 348 + struct ldc_channel *lp = dp->lp; 349 struct ds_data *dpkt = buf; 350 struct ds_panic_req *rp; 351 struct { ··· 354 355 rp = (struct ds_panic_req *) (dpkt + 1); 356 357 + printk(KERN_ALERT "ds-%lu: Panic request from " 358 + "LDOM manager received.\n", dp->id); 359 360 memset(&pkt, 0, sizeof(pkt)); 361 pkt.data.tag.type = DS_DATA; 362 pkt.data.tag.len = sizeof(pkt) - sizeof(struct ds_msg_tag); 363 + pkt.data.handle = cp->handle; 364 pkt.res.req_num = rp->req_num; 365 pkt.res.result = DS_OK; 366 pkt.res.reason[0] = 0; ··· 403 __u32 str_off; 404 }; 405 406 + static void __dr_cpu_send_error(struct ds_info *dp, 407 + struct ds_cap_state *cp, 408 + struct ds_data *data) 409 { 410 struct dr_cpu_tag *tag = (struct dr_cpu_tag *) (data + 1); 411 struct { 412 struct ds_data data; 413 struct dr_cpu_tag tag; ··· 428 __ds_send(dp->lp, &pkt, msg_len); 429 } 430 431 + static void dr_cpu_send_error(struct ds_info *dp, 432 + struct ds_cap_state *cp, 433 + struct ds_data *data) 434 { 435 unsigned long flags; 436 437 spin_lock_irqsave(&ds_lock, flags); 438 + __dr_cpu_send_error(dp, cp, data); 439 spin_unlock_irqrestore(&ds_lock, flags); 440 } 441 ··· 511 } 512 } 513 514 + static int dr_cpu_configure(struct ds_info *dp, 515 + struct ds_cap_state *cp, 516 + u64 req_num, 517 cpumask_t *mask) 518 { 519 struct ds_data *resp; ··· 533 for_each_cpu_mask(cpu, *mask) { 534 int err; 535 536 + printk(KERN_INFO "ds-%lu: Starting cpu %d...\n", 537 + dp->id, cpu); 538 err = cpu_up(cpu); 539 if (err) { 540 __u32 res = DR_CPU_RES_FAILURE; ··· 548 res = DR_CPU_RES_CPU_NOT_RESPONDING; 549 } 550 551 + printk(KERN_INFO "ds-%lu: CPU startup failed err=%d\n", 552 + dp->id, err); 553 dr_cpu_mark(resp, cpu, ncpus, res, stat); 554 } 555 } 556 557 spin_lock_irqsave(&ds_lock, flags); 558 + __ds_send(dp->lp, resp, resp_len); 559 spin_unlock_irqrestore(&ds_lock, flags); 560 561 kfree(resp); ··· 566 return 0; 567 } 568 569 + static int dr_cpu_unconfigure(struct ds_info *dp, 570 + struct ds_cap_state *cp, 571 + u64 req_num, 572 cpumask_t *mask) 573 { 574 struct ds_data *resp; ··· 586 for_each_cpu_mask(cpu, *mask) { 587 int err; 588 589 + printk(KERN_INFO "ds-%lu: Shutting down cpu %d...\n", 590 + dp->id, cpu); 591 err = cpu_down(cpu); 592 if (err) 593 dr_cpu_mark(resp, cpu, ncpus, ··· 596 } 597 598 spin_lock_irqsave(&ds_lock, flags); 599 + __ds_send(dp->lp, resp, resp_len); 600 spin_unlock_irqrestore(&ds_lock, flags); 601 602 kfree(resp); ··· 604 return 0; 605 } 606 607 + static void dr_cpu_data(struct ds_info *dp, 608 struct ds_cap_state *cp, 609 void *buf, int len) 610 { ··· 623 break; 624 625 default: 626 + dr_cpu_send_error(dp, cp, data); 627 return; 628 } 629 ··· 639 } 640 641 if (tag->type == DR_CPU_CONFIGURE) 642 + err = dr_cpu_configure(dp, cp, req_num, &mask); 643 else 644 + err = dr_cpu_unconfigure(dp, cp, req_num, &mask); 645 646 if (err) 647 + dr_cpu_send_error(dp, cp, data); 648 } 649 #endif /* CONFIG_HOTPLUG_CPU */ 650 ··· 656 #define DS_PRI_UPDATE 0x02 657 }; 658 659 + static void ds_pri_data(struct ds_info *dp, 660 + struct ds_cap_state *cp, 661 void *buf, int len) 662 { 663 struct ds_data *dpkt = buf; ··· 665 666 rp = (struct ds_pri_msg *) (dpkt + 1); 667 668 + printk(KERN_INFO "ds-%lu: PRI REQ [%lx:%lx], len=%d\n", 669 + dp->id, rp->req_num, rp->type, len); 670 } 671 672 struct ds_var_hdr { ··· 701 static int ds_var_doorbell; 702 static int ds_var_response; 703 704 + static void ds_var_data(struct ds_info *dp, 705 + struct ds_cap_state *cp, 706 void *buf, int len) 707 { 708 struct ds_data *dpkt = buf; ··· 721 722 void ldom_set_var(const char *var, const char *value) 723 { 724 struct ds_cap_state *cp; 725 + struct ds_info *dp; 726 + unsigned long flags; 727 728 + spin_lock_irqsave(&ds_lock, flags); 729 + cp = NULL; 730 + for (dp = ds_info_list; dp; dp = dp->next) { 731 + struct ds_cap_state *tmp; 732 733 + tmp = find_cap_by_string(dp, "var-config"); 734 + if (tmp && tmp->state == CAP_STATE_REGISTERED) { 735 + cp = tmp; 736 + break; 737 + } 738 + } 739 + if (!cp) { 740 + for (dp = ds_info_list; dp; dp = dp->next) { 741 + struct ds_cap_state *tmp; 742 + 743 + tmp = find_cap_by_string(dp, "var-config-backup"); 744 + if (tmp && tmp->state == CAP_STATE_REGISTERED) { 745 + cp = tmp; 746 + break; 747 + } 748 + } 749 + } 750 + spin_unlock_irqrestore(&ds_lock, flags); 751 + 752 + if (cp) { 753 union { 754 struct { 755 struct ds_data data; ··· 736 } header; 737 char all[512]; 738 } pkt; 739 char *base, *p; 740 int msg_len, loops; 741 ··· 777 778 if (ds_var_doorbell == 0 || 779 ds_var_response != DS_VAR_SUCCESS) 780 + printk(KERN_ERR "ds-%lu: var-config [%s:%s] " 781 "failed, response(%d).\n", 782 + dp->id, var, value, 783 ds_var_response); 784 } else { 785 printk(KERN_ERR PFX "var-config not registered so " ··· 811 812 static void ds_conn_reset(struct ds_info *dp) 813 { 814 + printk(KERN_ERR "ds-%lu: ds_conn_reset() from %p\n", 815 + dp->id, __builtin_return_address(0)); 816 } 817 818 static int register_services(struct ds_info *dp) ··· 820 struct ldc_channel *lp = dp->lp; 821 int i; 822 823 + for (i = 0; i < dp->num_ds_states; i++) { 824 struct { 825 struct ds_reg_req req; 826 u8 id_buf[256]; 827 } pbuf; 828 + struct ds_cap_state *cp = &dp->ds_states[i]; 829 int err, msg_len; 830 u64 new_count; 831 ··· 870 871 if (pkt->type == DS_REG_ACK) { 872 struct ds_reg_ack *ap = (struct ds_reg_ack *) pkt; 873 + struct ds_cap_state *cp = find_cap(dp, ap->handle); 874 875 if (!cp) { 876 + printk(KERN_ERR "ds-%lu: REG ACK for unknown " 877 + "handle %lx\n", dp->id, ap->handle); 878 return 0; 879 } 880 + printk(KERN_INFO "ds-%lu: Registered %s service.\n", 881 + dp->id, cp->service_id); 882 cp->state = CAP_STATE_REGISTERED; 883 } else if (pkt->type == DS_REG_NACK) { 884 struct ds_reg_nack *np = (struct ds_reg_nack *) pkt; 885 + struct ds_cap_state *cp = find_cap(dp, np->handle); 886 887 if (!cp) { 888 + printk(KERN_ERR "ds-%lu: REG NACK for " 889 "unknown handle %lx\n", 890 + dp->id, np->handle); 891 return 0; 892 } 893 cp->state = CAP_STATE_UNKNOWN; 894 } 895 ··· 922 923 struct ds_queue_entry { 924 struct list_head list; 925 + struct ds_info *dp; 926 int req_len; 927 int __pad; 928 u64 req[0]; ··· 930 static void process_ds_work(void) 931 { 932 struct ds_queue_entry *qp, *tmp; 933 unsigned long flags; 934 LIST_HEAD(todo); 935 ··· 939 INIT_LIST_HEAD(&ds_work_list); 940 spin_unlock_irqrestore(&ds_lock, flags); 941 942 list_for_each_entry_safe(qp, tmp, &todo, list) { 943 struct ds_data *dpkt = (struct ds_data *) qp->req; 944 + struct ds_info *dp = qp->dp; 945 + struct ds_cap_state *cp = find_cap(dp, dpkt->handle); 946 int req_len = qp->req_len; 947 948 if (!cp) { 949 + printk(KERN_ERR "ds-%lu: Data for unknown " 950 + "handle %lu\n", 951 + dp->id, dpkt->handle); 952 953 spin_lock_irqsave(&ds_lock, flags); 954 __send_ds_nack(dp, dpkt->handle); 955 spin_unlock_irqrestore(&ds_lock, flags); 956 } else { 957 + cp->data(dp, cp, dpkt, req_len); 958 } 959 960 list_del(&qp->list); ··· 990 if (!qp) { 991 __send_ds_nack(dp, dpkt->handle); 992 } else { 993 + qp->dp = dp; 994 memcpy(&qp->req, pkt, len); 995 list_add_tail(&qp->list, &ds_work_list); 996 wake_up(&ds_wait); ··· 1019 1020 dp->hs_state = 0; 1021 1022 + for (i = 0; i < dp->num_ds_states; i++) { 1023 + struct ds_cap_state *cp = &dp->ds_states[i]; 1024 1025 cp->state = CAP_STATE_UNKNOWN; 1026 } ··· 1048 } 1049 1050 if (event != LDC_EVENT_DATA_READY) { 1051 + printk(KERN_WARNING "ds-%lu: Unexpected LDC event %d\n", 1052 + dp->id, event); 1053 spin_unlock_irqrestore(&ds_lock, flags); 1054 return; 1055 } ··· 1099 .mtu = 4096, 1100 .mode = LDC_MODE_STREAM, 1101 }; 1102 + struct mdesc_handle *hp; 1103 struct ldc_channel *lp; 1104 struct ds_info *dp; 1105 + const u64 *val; 1106 + int err, i; 1107 1108 if (ds_version_printed++ == 0) 1109 printk(KERN_INFO "%s", version); ··· 1111 if (!dp) 1112 goto out_err; 1113 1114 + hp = mdesc_grab(); 1115 + val = mdesc_get_property(hp, vdev->mp, "id", NULL); 1116 + if (val) 1117 + dp->id = *val; 1118 + mdesc_release(hp); 1119 + 1120 dp->rcv_buf = kzalloc(4096, GFP_KERNEL); 1121 if (!dp->rcv_buf) 1122 goto out_free_dp; 1123 1124 dp->rcv_buf_len = 4096; 1125 + 1126 + dp->ds_states = kzalloc(sizeof(ds_states_template), 1127 + GFP_KERNEL); 1128 + if (!dp->ds_states) 1129 + goto out_free_rcv_buf; 1130 + 1131 + memcpy(dp->ds_states, ds_states_template, 1132 + sizeof(ds_states_template)); 1133 + dp->num_ds_states = ARRAY_SIZE(ds_states_template); 1134 + 1135 + for (i = 0; i < dp->num_ds_states; i++) 1136 + dp->ds_states[i].handle = ((u64)i << 32); 1137 1138 ds_cfg.tx_irq = vdev->tx_irq; 1139 ds_cfg.rx_irq = vdev->rx_irq; ··· 1123 lp = ldc_alloc(vdev->channel_id, &ds_cfg, dp); 1124 if (IS_ERR(lp)) { 1125 err = PTR_ERR(lp); 1126 + goto out_free_ds_states; 1127 } 1128 dp->lp = lp; 1129 ··· 1131 if (err) 1132 goto out_free_ldc; 1133 1134 + spin_lock_irq(&ds_lock); 1135 + dp->next = ds_info_list; 1136 + ds_info_list = dp; 1137 + spin_unlock_irq(&ds_lock); 1138 1139 return err; 1140 1141 out_free_ldc: 1142 ldc_free(dp->lp); 1143 + 1144 + out_free_ds_states: 1145 + kfree(dp->ds_states); 1146 1147 out_free_rcv_buf: 1148 kfree(dp->rcv_buf); ··· 1172 1173 static int __init ds_init(void) 1174 { 1175 kthread_run(ds_thread, NULL, "kldomd"); 1176 1177 return vio_register_driver(&ds_driver);
+5
arch/sparc64/kernel/ebus.c
··· 362 static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *dev) 363 { 364 struct linux_ebus_child *child; 365 struct of_device *op; 366 int i, len; 367 ··· 387 for (i = 0; i < dev->num_irqs; i++) 388 dev->irqs[i] = op->irqs[i]; 389 } 390 391 dev->ofdev.node = dp; 392 dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
··· 362 static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *dev) 363 { 364 struct linux_ebus_child *child; 365 + struct dev_archdata *sd; 366 struct of_device *op; 367 int i, len; 368 ··· 386 for (i = 0; i < dev->num_irqs; i++) 387 dev->irqs[i] = op->irqs[i]; 388 } 389 + 390 + sd = &dev->ofdev.dev.archdata; 391 + sd->prom_node = dp; 392 + sd->op = &dev->ofdev; 393 394 dev->ofdev.node = dp; 395 dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
+39 -33
arch/sparc64/kernel/irq.c
··· 87 */ 88 #define irq_work(__cpu) &(trap_block[(__cpu)].irq_worklist) 89 90 - static unsigned int virt_to_real_irq_table[NR_IRQS]; 91 92 static unsigned char virt_irq_alloc(unsigned int real_irq) 93 { ··· 100 BUILD_BUG_ON(NR_IRQS >= 256); 101 102 for (ent = 1; ent < NR_IRQS; ent++) { 103 - if (!virt_to_real_irq_table[ent]) 104 break; 105 } 106 if (ent >= NR_IRQS) { ··· 108 return 0; 109 } 110 111 - virt_to_real_irq_table[ent] = real_irq; 112 113 return ent; 114 } ··· 121 if (virt_irq >= NR_IRQS) 122 return; 123 124 - real_irq = virt_to_real_irq_table[virt_irq]; 125 - virt_to_real_irq_table[virt_irq] = 0; 126 127 __bucket(real_irq)->virt_irq = 0; 128 } ··· 130 131 static unsigned int virt_to_real_irq(unsigned char virt_irq) 132 { 133 - return virt_to_real_irq_table[virt_irq]; 134 } 135 136 /* ··· 340 341 err = sun4v_intr_settarget(ino, cpuid); 342 if (err != HV_EOK) 343 - printk("sun4v_intr_settarget(%x,%lu): err(%d)\n", 344 - ino, cpuid, err); 345 err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE); 346 if (err != HV_EOK) 347 - printk("sun4v_intr_setstate(%x): " 348 "err(%d)\n", ino, err); 349 err = sun4v_intr_setenabled(ino, HV_INTR_ENABLED); 350 if (err != HV_EOK) 351 - printk("sun4v_intr_setenabled(%x): err(%d)\n", 352 ino, err); 353 } 354 } ··· 366 367 err = sun4v_intr_settarget(ino, cpuid); 368 if (err != HV_EOK) 369 - printk("sun4v_intr_settarget(%x,%lu): err(%d)\n", 370 - ino, cpuid, err); 371 } 372 } 373 ··· 381 382 err = sun4v_intr_setenabled(ino, HV_INTR_DISABLED); 383 if (err != HV_EOK) 384 - printk("sun4v_intr_setenabled(%x): " 385 "err(%d)\n", ino, err); 386 } 387 } ··· 414 415 err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE); 416 if (err != HV_EOK) 417 - printk("sun4v_intr_setstate(%x): " 418 "err(%d)\n", ino, err); 419 } 420 } ··· 422 static void sun4v_virq_enable(unsigned int virt_irq) 423 { 424 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 425 - unsigned int ino = bucket - &ivector_table[0]; 426 427 if (likely(bucket)) { 428 unsigned long cpuid, dev_handle, dev_ino; ··· 429 430 cpuid = irq_choose_cpu(virt_irq); 431 432 - dev_handle = ino & IMAP_IGN; 433 - dev_ino = ino & IMAP_INO; 434 435 err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid); 436 if (err != HV_EOK) 437 - printk("sun4v_vintr_set_target(%lx,%lx,%lu): " 438 "err(%d)\n", 439 dev_handle, dev_ino, cpuid, err); 440 err = sun4v_vintr_set_state(dev_handle, dev_ino, 441 HV_INTR_STATE_IDLE); 442 if (err != HV_EOK) 443 - printk("sun4v_vintr_set_state(%lx,%lx," 444 "HV_INTR_STATE_IDLE): err(%d)\n", 445 dev_handle, dev_ino, err); 446 err = sun4v_vintr_set_valid(dev_handle, dev_ino, 447 HV_INTR_ENABLED); 448 if (err != HV_EOK) 449 - printk("sun4v_vintr_set_state(%lx,%lx," 450 "HV_INTR_ENABLED): err(%d)\n", 451 dev_handle, dev_ino, err); 452 } ··· 455 static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask) 456 { 457 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 458 - unsigned int ino = bucket - &ivector_table[0]; 459 460 if (likely(bucket)) { 461 unsigned long cpuid, dev_handle, dev_ino; ··· 462 463 cpuid = irq_choose_cpu(virt_irq); 464 465 - dev_handle = ino & IMAP_IGN; 466 - dev_ino = ino & IMAP_INO; 467 468 err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid); 469 if (err != HV_EOK) 470 - printk("sun4v_vintr_set_target(%lx,%lx,%lu): " 471 "err(%d)\n", 472 dev_handle, dev_ino, cpuid, err); 473 } ··· 476 static void sun4v_virq_disable(unsigned int virt_irq) 477 { 478 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 479 - unsigned int ino = bucket - &ivector_table[0]; 480 481 if (likely(bucket)) { 482 unsigned long dev_handle, dev_ino; 483 int err; 484 485 - dev_handle = ino & IMAP_IGN; 486 - dev_ino = ino & IMAP_INO; 487 488 err = sun4v_vintr_set_valid(dev_handle, dev_ino, 489 HV_INTR_DISABLED); 490 if (err != HV_EOK) 491 - printk("sun4v_vintr_set_state(%lx,%lx," 492 "HV_INTR_DISABLED): err(%d)\n", 493 dev_handle, dev_ino, err); 494 } ··· 496 static void sun4v_virq_end(unsigned int virt_irq) 497 { 498 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 499 - unsigned int ino = bucket - &ivector_table[0]; 500 struct irq_desc *desc = irq_desc + virt_irq; 501 502 if (unlikely(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))) ··· 505 unsigned long dev_handle, dev_ino; 506 int err; 507 508 - dev_handle = ino & IMAP_IGN; 509 - dev_ino = ino & IMAP_INO; 510 511 err = sun4v_vintr_set_state(dev_handle, dev_ino, 512 HV_INTR_STATE_IDLE); 513 if (err != HV_EOK) 514 - printk("sun4v_vintr_set_state(%lx,%lx," 515 "HV_INTR_STATE_IDLE): err(%d)\n", 516 dev_handle, dev_ino, err); 517 } ··· 700 unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino) 701 { 702 unsigned long sysino, hv_err; 703 704 BUG_ON(devhandle & devino); 705 ··· 714 prom_halt(); 715 } 716 717 - return sun4v_build_common(sysino, &sun4v_virq); 718 } 719 720 #ifdef CONFIG_PCI_MSI
··· 87 */ 88 #define irq_work(__cpu) &(trap_block[(__cpu)].irq_worklist) 89 90 + static struct { 91 + unsigned int irq; 92 + unsigned int dev_handle; 93 + unsigned int dev_ino; 94 + } virt_to_real_irq_table[NR_IRQS]; 95 96 static unsigned char virt_irq_alloc(unsigned int real_irq) 97 { ··· 96 BUILD_BUG_ON(NR_IRQS >= 256); 97 98 for (ent = 1; ent < NR_IRQS; ent++) { 99 + if (!virt_to_real_irq_table[ent].irq) 100 break; 101 } 102 if (ent >= NR_IRQS) { ··· 104 return 0; 105 } 106 107 + virt_to_real_irq_table[ent].irq = real_irq; 108 109 return ent; 110 } ··· 117 if (virt_irq >= NR_IRQS) 118 return; 119 120 + real_irq = virt_to_real_irq_table[virt_irq].irq; 121 + virt_to_real_irq_table[virt_irq].irq = 0; 122 123 __bucket(real_irq)->virt_irq = 0; 124 } ··· 126 127 static unsigned int virt_to_real_irq(unsigned char virt_irq) 128 { 129 + return virt_to_real_irq_table[virt_irq].irq; 130 } 131 132 /* ··· 336 337 err = sun4v_intr_settarget(ino, cpuid); 338 if (err != HV_EOK) 339 + printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): " 340 + "err(%d)\n", ino, cpuid, err); 341 err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE); 342 if (err != HV_EOK) 343 + printk(KERN_ERR "sun4v_intr_setstate(%x): " 344 "err(%d)\n", ino, err); 345 err = sun4v_intr_setenabled(ino, HV_INTR_ENABLED); 346 if (err != HV_EOK) 347 + printk(KERN_ERR "sun4v_intr_setenabled(%x): err(%d)\n", 348 ino, err); 349 } 350 } ··· 362 363 err = sun4v_intr_settarget(ino, cpuid); 364 if (err != HV_EOK) 365 + printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): " 366 + "err(%d)\n", ino, cpuid, err); 367 } 368 } 369 ··· 377 378 err = sun4v_intr_setenabled(ino, HV_INTR_DISABLED); 379 if (err != HV_EOK) 380 + printk(KERN_ERR "sun4v_intr_setenabled(%x): " 381 "err(%d)\n", ino, err); 382 } 383 } ··· 410 411 err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE); 412 if (err != HV_EOK) 413 + printk(KERN_ERR "sun4v_intr_setstate(%x): " 414 "err(%d)\n", ino, err); 415 } 416 } ··· 418 static void sun4v_virq_enable(unsigned int virt_irq) 419 { 420 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 421 422 if (likely(bucket)) { 423 unsigned long cpuid, dev_handle, dev_ino; ··· 426 427 cpuid = irq_choose_cpu(virt_irq); 428 429 + dev_handle = virt_to_real_irq_table[virt_irq].dev_handle; 430 + dev_ino = virt_to_real_irq_table[virt_irq].dev_ino; 431 432 err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid); 433 if (err != HV_EOK) 434 + printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): " 435 "err(%d)\n", 436 dev_handle, dev_ino, cpuid, err); 437 err = sun4v_vintr_set_state(dev_handle, dev_ino, 438 HV_INTR_STATE_IDLE); 439 if (err != HV_EOK) 440 + printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx," 441 "HV_INTR_STATE_IDLE): err(%d)\n", 442 dev_handle, dev_ino, err); 443 err = sun4v_vintr_set_valid(dev_handle, dev_ino, 444 HV_INTR_ENABLED); 445 if (err != HV_EOK) 446 + printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx," 447 "HV_INTR_ENABLED): err(%d)\n", 448 dev_handle, dev_ino, err); 449 } ··· 452 static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask) 453 { 454 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 455 456 if (likely(bucket)) { 457 unsigned long cpuid, dev_handle, dev_ino; ··· 460 461 cpuid = irq_choose_cpu(virt_irq); 462 463 + dev_handle = virt_to_real_irq_table[virt_irq].dev_handle; 464 + dev_ino = virt_to_real_irq_table[virt_irq].dev_ino; 465 466 err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid); 467 if (err != HV_EOK) 468 + printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): " 469 "err(%d)\n", 470 dev_handle, dev_ino, cpuid, err); 471 } ··· 474 static void sun4v_virq_disable(unsigned int virt_irq) 475 { 476 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 477 478 if (likely(bucket)) { 479 unsigned long dev_handle, dev_ino; 480 int err; 481 482 + dev_handle = virt_to_real_irq_table[virt_irq].dev_handle; 483 + dev_ino = virt_to_real_irq_table[virt_irq].dev_ino; 484 485 err = sun4v_vintr_set_valid(dev_handle, dev_ino, 486 HV_INTR_DISABLED); 487 if (err != HV_EOK) 488 + printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx," 489 "HV_INTR_DISABLED): err(%d)\n", 490 dev_handle, dev_ino, err); 491 } ··· 495 static void sun4v_virq_end(unsigned int virt_irq) 496 { 497 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 498 struct irq_desc *desc = irq_desc + virt_irq; 499 500 if (unlikely(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))) ··· 505 unsigned long dev_handle, dev_ino; 506 int err; 507 508 + dev_handle = virt_to_real_irq_table[virt_irq].dev_handle; 509 + dev_ino = virt_to_real_irq_table[virt_irq].dev_ino; 510 511 err = sun4v_vintr_set_state(dev_handle, dev_ino, 512 HV_INTR_STATE_IDLE); 513 if (err != HV_EOK) 514 + printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx," 515 "HV_INTR_STATE_IDLE): err(%d)\n", 516 dev_handle, dev_ino, err); 517 } ··· 700 unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino) 701 { 702 unsigned long sysino, hv_err; 703 + unsigned int virq; 704 705 BUG_ON(devhandle & devino); 706 ··· 713 prom_halt(); 714 } 715 716 + virq = sun4v_build_common(sysino, &sun4v_virq); 717 + 718 + virt_to_real_irq_table[virq].dev_handle = devhandle; 719 + virt_to_real_irq_table[virq].dev_ino = devino; 720 + 721 + return virq; 722 } 723 724 #ifdef CONFIG_PCI_MSI
+5
arch/sparc64/kernel/isa.c
··· 79 80 while (dp) { 81 struct sparc_isa_device *isa_dev; 82 83 isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL); 84 if (!isa_dev) { 85 printk(KERN_DEBUG "ISA: cannot allocate isa_dev"); 86 return; 87 } 88 89 isa_dev->ofdev.node = dp; 90 isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev;
··· 79 80 while (dp) { 81 struct sparc_isa_device *isa_dev; 82 + struct dev_archdata *sd; 83 84 isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL); 85 if (!isa_dev) { 86 printk(KERN_DEBUG "ISA: cannot allocate isa_dev"); 87 return; 88 } 89 + 90 + sd = &isa_dev->ofdev.dev.archdata; 91 + sd->prom_node = dp; 92 + sd->op = &isa_dev->ofdev; 93 94 isa_dev->ofdev.node = dp; 95 isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev;
+3 -3
arch/sparc64/kernel/mdesc.c
··· 83 hp->handle_size = handle_size; 84 } 85 86 - static struct mdesc_handle *mdesc_bootmem_alloc(unsigned int mdesc_size) 87 { 88 struct mdesc_handle *hp; 89 unsigned int handle_size, alloc_size; ··· 123 } 124 } 125 126 - static struct mdesc_mem_ops bootmem_mdesc_memops = { 127 .alloc = mdesc_bootmem_alloc, 128 .free = mdesc_bootmem_free, 129 }; ··· 860 861 printk("MDESC: Size is %lu bytes.\n", len); 862 863 - hp = mdesc_alloc(len, &bootmem_mdesc_memops); 864 if (hp == NULL) { 865 prom_printf("MDESC: alloc of %lu bytes failed.\n", len); 866 prom_halt();
··· 83 hp->handle_size = handle_size; 84 } 85 86 + static struct mdesc_handle * __init mdesc_bootmem_alloc(unsigned int mdesc_size) 87 { 88 struct mdesc_handle *hp; 89 unsigned int handle_size, alloc_size; ··· 123 } 124 } 125 126 + static struct mdesc_mem_ops bootmem_mdesc_ops = { 127 .alloc = mdesc_bootmem_alloc, 128 .free = mdesc_bootmem_free, 129 }; ··· 860 861 printk("MDESC: Size is %lu bytes.\n", len); 862 863 + hp = mdesc_alloc(len, &bootmem_mdesc_ops); 864 if (hp == NULL) { 865 prom_printf("MDESC: alloc of %lu bytes failed.\n", len); 866 prom_halt();
+5
arch/sparc64/kernel/of_device.c
··· 752 { 753 struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); 754 const unsigned int *irq; 755 int len, i; 756 757 if (!op) 758 return NULL; 759 760 op->node = dp; 761
··· 752 { 753 struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); 754 const unsigned int *irq; 755 + struct dev_archdata *sd; 756 int len, i; 757 758 if (!op) 759 return NULL; 760 + 761 + sd = &op->dev.archdata; 762 + sd->prom_node = dp; 763 + sd->op = op; 764 765 op->node = dp; 766
+2 -2
arch/sparc64/kernel/pci_sun4v.c
··· 1129 } 1130 #endif /* !(CONFIG_PCI_MSI) */ 1131 1132 - static void pci_sun4v_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 devhandle) 1133 { 1134 struct pci_pbm_info *pbm; 1135 ··· 1163 pci_sun4v_msi_init(pbm); 1164 } 1165 1166 - void sun4v_pci_init(struct device_node *dp, char *model_name) 1167 { 1168 static int hvapi_negotiated = 0; 1169 struct pci_controller_info *p;
··· 1129 } 1130 #endif /* !(CONFIG_PCI_MSI) */ 1131 1132 + static void __init pci_sun4v_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 devhandle) 1133 { 1134 struct pci_pbm_info *pbm; 1135 ··· 1163 pci_sun4v_msi_init(pbm); 1164 } 1165 1166 + void __init sun4v_pci_init(struct device_node *dp, char *model_name) 1167 { 1168 static int hvapi_negotiated = 0; 1169 struct pci_controller_info *p;
+1 -1
arch/sparc64/kernel/power.c
··· 46 void machine_power_off(void) 47 { 48 sstate_poweroff(); 49 - if (!serial_console || scons_pwroff) { 50 if (power_reg) { 51 /* Both register bits seem to have the 52 * same effect, so until I figure out
··· 46 void machine_power_off(void) 47 { 48 sstate_poweroff(); 49 + if (strcmp(of_console_device->type, "serial") || scons_pwroff) { 50 if (power_reg) { 51 /* Both register bits seem to have the 52 * same effect, so until I figure out
+3 -3
arch/sparc64/kernel/process.c
··· 119 void machine_halt(void) 120 { 121 sstate_halt(); 122 - if (!serial_console && prom_palette) 123 prom_palette (1); 124 if (prom_keyboard) 125 prom_keyboard(); ··· 130 void machine_alt_power_off(void) 131 { 132 sstate_poweroff(); 133 - if (!serial_console && prom_palette) 134 prom_palette(1); 135 if (prom_keyboard) 136 prom_keyboard(); ··· 145 sstate_reboot(); 146 p = strchr (reboot_command, '\n'); 147 if (p) *p = 0; 148 - if (!serial_console && prom_palette) 149 prom_palette (1); 150 if (prom_keyboard) 151 prom_keyboard();
··· 119 void machine_halt(void) 120 { 121 sstate_halt(); 122 + if (prom_palette) 123 prom_palette (1); 124 if (prom_keyboard) 125 prom_keyboard(); ··· 130 void machine_alt_power_off(void) 131 { 132 sstate_poweroff(); 133 + if (prom_palette) 134 prom_palette(1); 135 if (prom_keyboard) 136 prom_keyboard(); ··· 145 sstate_reboot(); 146 p = strchr (reboot_command, '\n'); 147 if (p) *p = 0; 148 + if (prom_palette) 149 prom_palette (1); 150 if (prom_keyboard) 151 prom_keyboard();
+56
arch/sparc64/kernel/prom.c
··· 1646 smp_fill_in_sib_core_maps(); 1647 } 1648 1649 void __init prom_build_devicetree(void) 1650 { 1651 struct device_node **nextp; ··· 1712 allnodes->child = build_tree(allnodes, 1713 prom_getchild(allnodes->node), 1714 &nextp); 1715 printk("PROM: Built device tree with %u bytes of memory.\n", 1716 prom_early_allocated); 1717
··· 1646 smp_fill_in_sib_core_maps(); 1647 } 1648 1649 + struct device_node *of_console_device; 1650 + EXPORT_SYMBOL(of_console_device); 1651 + 1652 + char *of_console_path; 1653 + EXPORT_SYMBOL(of_console_path); 1654 + 1655 + char *of_console_options; 1656 + EXPORT_SYMBOL(of_console_options); 1657 + 1658 + static void __init of_console_init(void) 1659 + { 1660 + char *msg = "OF stdout device is: %s\n"; 1661 + struct device_node *dp; 1662 + const char *type; 1663 + phandle node; 1664 + 1665 + of_console_path = prom_early_alloc(256); 1666 + if (prom_ihandle2path(prom_stdout, of_console_path, 256) < 0) { 1667 + prom_printf("Cannot obtain path of stdout.\n"); 1668 + prom_halt(); 1669 + } 1670 + of_console_options = strrchr(of_console_path, ':'); 1671 + if (of_console_options) { 1672 + of_console_options++; 1673 + if (*of_console_options == '\0') 1674 + of_console_options = NULL; 1675 + } 1676 + 1677 + node = prom_inst2pkg(prom_stdout); 1678 + if (!node) { 1679 + prom_printf("Cannot resolve stdout node from " 1680 + "instance %08x.\n", prom_stdout); 1681 + prom_halt(); 1682 + } 1683 + 1684 + dp = of_find_node_by_phandle(node); 1685 + type = of_get_property(dp, "device_type", NULL); 1686 + if (!type) { 1687 + prom_printf("Console stdout lacks device_type property.\n"); 1688 + prom_halt(); 1689 + } 1690 + 1691 + if (strcmp(type, "display") && strcmp(type, "serial")) { 1692 + prom_printf("Console device_type is neither display " 1693 + "nor serial.\n"); 1694 + prom_halt(); 1695 + } 1696 + 1697 + of_console_device = dp; 1698 + 1699 + prom_printf(msg, of_console_path); 1700 + printk(msg, of_console_path); 1701 + } 1702 + 1703 void __init prom_build_devicetree(void) 1704 { 1705 struct device_node **nextp; ··· 1658 allnodes->child = build_tree(allnodes, 1659 prom_getchild(allnodes->node), 1660 &nextp); 1661 + of_console_init(); 1662 + 1663 printk("PROM: Built device tree with %u bytes of memory.\n", 1664 prom_early_allocated); 1665
+1 -69
arch/sparc64/kernel/setup.c
··· 133 } 134 } 135 136 - static void __init process_console(char *commands) 137 - { 138 - serial_console = 0; 139 - commands += 8; 140 - /* Linux-style serial */ 141 - if (!strncmp(commands, "ttyS", 4)) 142 - serial_console = simple_strtoul(commands + 4, NULL, 10) + 1; 143 - else if (!strncmp(commands, "tty", 3)) { 144 - char c = *(commands + 3); 145 - /* Solaris-style serial */ 146 - if (c == 'a' || c == 'b') { 147 - serial_console = c - 'a' + 1; 148 - prom_printf ("Using /dev/tty%c as console.\n", c); 149 - } 150 - /* else Linux-style fbcon, not serial */ 151 - } 152 - #if defined(CONFIG_PROM_CONSOLE) 153 - if (!strncmp(commands, "prom", 4)) { 154 - char *p; 155 - 156 - for (p = commands - 8; *p && *p != ' '; p++) 157 - *p = ' '; 158 - conswitchp = &prom_con; 159 - } 160 - #endif 161 - } 162 - 163 static void __init boot_flags_init(char *commands) 164 { 165 while (*commands) { ··· 149 process_switch(*commands++); 150 continue; 151 } 152 - if (!strncmp(commands, "console=", 8)) { 153 - process_console(commands); 154 - } else if (!strncmp(commands, "mem=", 4)) { 155 /* 156 * "mem=XXX[kKmM]" overrides the PROM-reported 157 * memory size. ··· 349 paging_init(); 350 } 351 352 - static int __init set_preferred_console(void) 353 - { 354 - int idev, odev; 355 - 356 - /* The user has requested a console so this is already set up. */ 357 - if (serial_console >= 0) 358 - return -EBUSY; 359 - 360 - idev = prom_query_input_device(); 361 - odev = prom_query_output_device(); 362 - if (idev == PROMDEV_IKBD && odev == PROMDEV_OSCREEN) { 363 - serial_console = 0; 364 - } else if (idev == PROMDEV_ITTYA && odev == PROMDEV_OTTYA) { 365 - serial_console = 1; 366 - } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) { 367 - serial_console = 2; 368 - } else if (idev == PROMDEV_IRSC && odev == PROMDEV_ORSC) { 369 - serial_console = 3; 370 - } else if (idev == PROMDEV_IVCONS && odev == PROMDEV_OVCONS) { 371 - /* sunhv_console_init() doesn't check the serial_console 372 - * value anyways... 373 - */ 374 - serial_console = 4; 375 - return add_preferred_console("ttyHV", 0, NULL); 376 - } else { 377 - prom_printf("Inconsistent console: " 378 - "input %d, output %d\n", 379 - idev, odev); 380 - prom_halt(); 381 - } 382 - 383 - if (serial_console) 384 - return add_preferred_console("ttyS", serial_console - 1, NULL); 385 - 386 - return -ENODEV; 387 - } 388 - console_initcall(set_preferred_console); 389 - 390 /* BUFFER is PAGE_SIZE bytes long. */ 391 392 extern char *sparc_cpu_type; ··· 441 prom_cmdline(); 442 } 443 444 - int serial_console = -1; 445 int stop_a_enabled = 1;
··· 133 } 134 } 135 136 static void __init boot_flags_init(char *commands) 137 { 138 while (*commands) { ··· 176 process_switch(*commands++); 177 continue; 178 } 179 + if (!strncmp(commands, "mem=", 4)) { 180 /* 181 * "mem=XXX[kKmM]" overrides the PROM-reported 182 * memory size. ··· 378 paging_init(); 379 } 380 381 /* BUFFER is PAGE_SIZE bytes long. */ 382 383 extern char *sparc_cpu_type; ··· 508 prom_cmdline(); 509 } 510 511 int stop_a_enabled = 1;
-1
arch/sparc64/kernel/sparc64_ksyms.c
··· 330 331 /* for input/keybdev */ 332 EXPORT_SYMBOL(sun_do_break); 333 - EXPORT_SYMBOL(serial_console); 334 EXPORT_SYMBOL(stop_a_enabled); 335 336 #ifdef CONFIG_DEBUG_BUGVERBOSE
··· 330 331 /* for input/keybdev */ 332 EXPORT_SYMBOL(sun_do_break); 333 EXPORT_SYMBOL(stop_a_enabled); 334 335 #ifdef CONFIG_DEBUG_BUGVERBOSE
+79
arch/sparc64/kernel/time.c
··· 1434 1435 return 0; 1436 } 1437 #endif /* CONFIG_PCI */ 1438 1439 struct mini_rtc_ops { ··· 1527 static struct mini_rtc_ops bq4802_rtc_ops = { 1528 .get_rtc_time = bq4802_get_rtc_time, 1529 .set_rtc_time = bq4802_set_rtc_time, 1530 }; 1531 #endif /* CONFIG_PCI */ 1532 ··· 1660 #ifdef CONFIG_PCI 1661 else if (bq4802_regs) 1662 mini_rtc_ops = &bq4802_rtc_ops; 1663 #endif /* CONFIG_PCI */ 1664 else 1665 return -ENODEV;
··· 1434 1435 return 0; 1436 } 1437 + 1438 + static void cmos_get_rtc_time(struct rtc_time *rtc_tm) 1439 + { 1440 + unsigned char ctrl; 1441 + 1442 + rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); 1443 + rtc_tm->tm_min = CMOS_READ(RTC_MINUTES); 1444 + rtc_tm->tm_hour = CMOS_READ(RTC_HOURS); 1445 + rtc_tm->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH); 1446 + rtc_tm->tm_mon = CMOS_READ(RTC_MONTH); 1447 + rtc_tm->tm_year = CMOS_READ(RTC_YEAR); 1448 + rtc_tm->tm_wday = CMOS_READ(RTC_DAY_OF_WEEK); 1449 + 1450 + ctrl = CMOS_READ(RTC_CONTROL); 1451 + if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 1452 + BCD_TO_BIN(rtc_tm->tm_sec); 1453 + BCD_TO_BIN(rtc_tm->tm_min); 1454 + BCD_TO_BIN(rtc_tm->tm_hour); 1455 + BCD_TO_BIN(rtc_tm->tm_mday); 1456 + BCD_TO_BIN(rtc_tm->tm_mon); 1457 + BCD_TO_BIN(rtc_tm->tm_year); 1458 + BCD_TO_BIN(rtc_tm->tm_wday); 1459 + } 1460 + 1461 + if (rtc_tm->tm_year <= 69) 1462 + rtc_tm->tm_year += 100; 1463 + 1464 + rtc_tm->tm_mon--; 1465 + } 1466 + 1467 + static int cmos_set_rtc_time(struct rtc_time *rtc_tm) 1468 + { 1469 + unsigned char mon, day, hrs, min, sec; 1470 + unsigned char save_control, save_freq_select; 1471 + unsigned int yrs; 1472 + 1473 + yrs = rtc_tm->tm_year; 1474 + mon = rtc_tm->tm_mon + 1; 1475 + day = rtc_tm->tm_mday; 1476 + hrs = rtc_tm->tm_hour; 1477 + min = rtc_tm->tm_min; 1478 + sec = rtc_tm->tm_sec; 1479 + 1480 + if (yrs >= 100) 1481 + yrs -= 100; 1482 + 1483 + if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 1484 + BIN_TO_BCD(sec); 1485 + BIN_TO_BCD(min); 1486 + BIN_TO_BCD(hrs); 1487 + BIN_TO_BCD(day); 1488 + BIN_TO_BCD(mon); 1489 + BIN_TO_BCD(yrs); 1490 + } 1491 + 1492 + save_control = CMOS_READ(RTC_CONTROL); 1493 + CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); 1494 + save_freq_select = CMOS_READ(RTC_FREQ_SELECT); 1495 + CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); 1496 + 1497 + CMOS_WRITE(yrs, RTC_YEAR); 1498 + CMOS_WRITE(mon, RTC_MONTH); 1499 + CMOS_WRITE(day, RTC_DAY_OF_MONTH); 1500 + CMOS_WRITE(hrs, RTC_HOURS); 1501 + CMOS_WRITE(min, RTC_MINUTES); 1502 + CMOS_WRITE(sec, RTC_SECONDS); 1503 + 1504 + CMOS_WRITE(save_control, RTC_CONTROL); 1505 + CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); 1506 + 1507 + return 0; 1508 + } 1509 #endif /* CONFIG_PCI */ 1510 1511 struct mini_rtc_ops { ··· 1455 static struct mini_rtc_ops bq4802_rtc_ops = { 1456 .get_rtc_time = bq4802_get_rtc_time, 1457 .set_rtc_time = bq4802_set_rtc_time, 1458 + }; 1459 + 1460 + static struct mini_rtc_ops cmos_rtc_ops = { 1461 + .get_rtc_time = cmos_get_rtc_time, 1462 + .set_rtc_time = cmos_set_rtc_time, 1463 }; 1464 #endif /* CONFIG_PCI */ 1465 ··· 1583 #ifdef CONFIG_PCI 1584 else if (bq4802_regs) 1585 mini_rtc_ops = &bq4802_rtc_ops; 1586 + else if (ds1287_regs) 1587 + mini_rtc_ops = &cmos_rtc_ops; 1588 #endif /* CONFIG_PCI */ 1589 else 1590 return -ENODEV;
+16 -19
arch/sparc64/kernel/vio.c
··· 205 struct device_node *dp; 206 struct vio_dev *vdev; 207 int err, tlen, clen; 208 - const u64 *id; 209 210 type = mdesc_get_property(hp, mp, "device-type", &tlen); 211 if (!type) { ··· 222 return NULL; 223 } 224 225 - if (!strcmp(type, "vdc-port")) { 226 - u64 a; 227 228 - id = NULL; 229 - mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_BACK) { 230 - u64 target; 231 232 - target = mdesc_arc_target(hp, a); 233 - id = mdesc_get_property(hp, target, 234 "cfg-handle", NULL); 235 - if (id) 236 - break; 237 - } 238 - if (!id) { 239 - printk(KERN_ERR "VIO: vdc-port lacks parent " 240 - "cfg-handle.\n"); 241 - return NULL; 242 - } 243 - } else 244 - id = mdesc_get_property(hp, mp, "id", NULL); 245 246 bus_id_name = type; 247 if (!strcmp(type, "domain-services-port")) ··· 278 snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s", 279 bus_id_name); 280 vdev->dev_no = ~(u64)0; 281 - } else { 282 snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu", 283 bus_id_name, *id); 284 vdev->dev_no = *id; 285 } 286 287 vdev->dev.parent = parent;
··· 205 struct device_node *dp; 206 struct vio_dev *vdev; 207 int err, tlen, clen; 208 + const u64 *id, *cfg_handle; 209 + u64 a; 210 211 type = mdesc_get_property(hp, mp, "device-type", &tlen); 212 if (!type) { ··· 221 return NULL; 222 } 223 224 + id = mdesc_get_property(hp, mp, "id", NULL); 225 226 + cfg_handle = NULL; 227 + mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_BACK) { 228 + u64 target; 229 230 + target = mdesc_arc_target(hp, a); 231 + cfg_handle = mdesc_get_property(hp, target, 232 "cfg-handle", NULL); 233 + if (cfg_handle) 234 + break; 235 + } 236 237 bus_id_name = type; 238 if (!strcmp(type, "domain-services-port")) ··· 285 snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s", 286 bus_id_name); 287 vdev->dev_no = ~(u64)0; 288 + } else if (!cfg_handle) { 289 snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu", 290 bus_id_name, *id); 291 vdev->dev_no = *id; 292 + } else { 293 + snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu-%lu", 294 + bus_id_name, *cfg_handle, *id); 295 + vdev->dev_no = *cfg_handle; 296 } 297 298 vdev->dev.parent = parent;
-85
arch/sparc64/prom/console.c
··· 73 P1275_INOUT(3,1), 74 prom_stdout, s, P1275_SIZE(len)); 75 } 76 - 77 - /* Query for input device type */ 78 - enum prom_input_device 79 - prom_query_input_device(void) 80 - { 81 - int st_p; 82 - char propb[64]; 83 - 84 - st_p = prom_inst2pkg(prom_stdin); 85 - if(prom_node_has_property(st_p, "keyboard")) 86 - return PROMDEV_IKBD; 87 - prom_getproperty(st_p, "device_type", propb, sizeof(propb)); 88 - if(strncmp(propb, "serial", 6)) 89 - return PROMDEV_I_UNK; 90 - /* FIXME: Is there any better way how to find out? */ 91 - memset(propb, 0, sizeof(propb)); 92 - st_p = prom_finddevice ("/options"); 93 - prom_getproperty(st_p, "input-device", propb, sizeof(propb)); 94 - 95 - /* 96 - * If we get here with propb == 'keyboard', we are on ttya, as 97 - * the PROM defaulted to this due to 'no input device'. 98 - */ 99 - if (!strncmp(propb, "keyboard", 8)) 100 - return PROMDEV_ITTYA; 101 - 102 - if (!strncmp (propb, "rsc", 3)) 103 - return PROMDEV_IRSC; 104 - 105 - if (!strncmp (propb, "virtual-console", 3)) 106 - return PROMDEV_IVCONS; 107 - 108 - if (strncmp (propb, "tty", 3) || !propb[3]) 109 - return PROMDEV_I_UNK; 110 - 111 - switch (propb[3]) { 112 - case 'a': return PROMDEV_ITTYA; 113 - case 'b': return PROMDEV_ITTYB; 114 - default: return PROMDEV_I_UNK; 115 - } 116 - } 117 - 118 - /* Query for output device type */ 119 - 120 - enum prom_output_device 121 - prom_query_output_device(void) 122 - { 123 - int st_p; 124 - char propb[64]; 125 - int propl; 126 - 127 - st_p = prom_inst2pkg(prom_stdout); 128 - propl = prom_getproperty(st_p, "device_type", propb, sizeof(propb)); 129 - if (propl >= 0 && propl == sizeof("display") && 130 - strncmp("display", propb, sizeof("display")) == 0) 131 - return PROMDEV_OSCREEN; 132 - if(strncmp("serial", propb, 6)) 133 - return PROMDEV_O_UNK; 134 - /* FIXME: Is there any better way how to find out? */ 135 - memset(propb, 0, sizeof(propb)); 136 - st_p = prom_finddevice ("/options"); 137 - prom_getproperty(st_p, "output-device", propb, sizeof(propb)); 138 - 139 - /* 140 - * If we get here with propb == 'screen', we are on ttya, as 141 - * the PROM defaulted to this due to 'no input device'. 142 - */ 143 - if (!strncmp(propb, "screen", 6)) 144 - return PROMDEV_OTTYA; 145 - 146 - if (!strncmp (propb, "rsc", 3)) 147 - return PROMDEV_ORSC; 148 - 149 - if (!strncmp (propb, "virtual-console", 3)) 150 - return PROMDEV_OVCONS; 151 - 152 - if (strncmp (propb, "tty", 3) || !propb[3]) 153 - return PROMDEV_O_UNK; 154 - 155 - switch (propb[3]) { 156 - case 'a': return PROMDEV_OTTYA; 157 - case 'b': return PROMDEV_OTTYB; 158 - default: return PROMDEV_O_UNK; 159 - } 160 - }
··· 73 P1275_INOUT(3,1), 74 prom_stdout, s, P1275_SIZE(len)); 75 }
+2 -2
arch/sparc64/prom/misc.c
··· 72 73 local_irq_save(flags); 74 75 - if (!serial_console && prom_palette) 76 prom_palette(1); 77 78 #ifdef CONFIG_SMP ··· 85 smp_release(); 86 #endif 87 88 - if (!serial_console && prom_palette) 89 prom_palette(0); 90 91 local_irq_restore(flags);
··· 72 73 local_irq_save(flags); 74 75 + if (prom_palette) 76 prom_palette(1); 77 78 #ifdef CONFIG_SMP ··· 85 smp_release(); 86 #endif 87 88 + if (prom_palette) 89 prom_palette(0); 90 91 local_irq_restore(flags);
+8
arch/sparc64/prom/tree.c
··· 304 if (node == -1) return 0; 305 return node; 306 }
··· 304 if (node == -1) return 0; 305 return node; 306 } 307 + 308 + int prom_ihandle2path(int handle, char *buffer, int bufsize) 309 + { 310 + return p1275_cmd("instance-to-path", 311 + P1275_ARG(1,P1275_ARG_OUT_BUF)| 312 + P1275_INOUT(3, 1), 313 + handle, buffer, P1275_SIZE(bufsize)); 314 + }
+1 -1
drivers/char/Kconfig
··· 726 727 config RTC 728 tristate "Enhanced Real Time Clock Support" 729 - depends on !PPC && !PARISC && !IA64 && !M68K && (!SPARC || PCI) && !FRV && !ARM && !SUPERH && !S390 730 ---help--- 731 If you say Y here and create a character special file /dev/rtc with 732 major number 10 and minor number 135 using mknod ("man mknod"), you
··· 726 727 config RTC 728 tristate "Enhanced Real Time Clock Support" 729 + depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC64 && (!SPARC32 || PCI) && !FRV && !ARM && !SUPERH && !S390 730 ---help--- 731 If you say Y here and create a character special file /dev/rtc with 732 major number 10 and minor number 135 using mknod ("man mknod"), you
+6 -24
drivers/char/rtc.c
··· 86 #include <asm/hpet.h> 87 #endif 88 89 - #ifdef __sparc__ 90 #include <linux/pci.h> 91 #include <asm/ebus.h> 92 - #ifdef __sparc_v9__ 93 - #include <asm/isa.h> 94 - #endif 95 96 static unsigned long rtc_port; 97 static int rtc_irq = PCI_IRQ_NONE; ··· 927 unsigned int year, ctrl; 928 char *guess = NULL; 929 #endif 930 - #ifdef __sparc__ 931 struct linux_ebus *ebus; 932 struct linux_ebus_device *edev; 933 - #ifdef __sparc_v9__ 934 - struct sparc_isa_bridge *isa_br; 935 - struct sparc_isa_device *isa_dev; 936 - #endif 937 #else 938 void *r; 939 #ifdef RTC_IRQ ··· 937 #endif 938 #endif 939 940 - #ifdef __sparc__ 941 for_each_ebus(ebus) { 942 for_each_ebusdev(edev, ebus) { 943 if(strcmp(edev->prom_node->name, "rtc") == 0) { ··· 947 } 948 } 949 } 950 - #ifdef __sparc_v9__ 951 - for_each_isa(isa_br) { 952 - for_each_isadev(isa_dev, isa_br) { 953 - if (strcmp(isa_dev->prom_node->name, "rtc") == 0) { 954 - rtc_port = isa_dev->resource.start; 955 - rtc_irq = isa_dev->irq; 956 - goto found; 957 - } 958 - } 959 - } 960 - #endif 961 rtc_has_irq = 0; 962 printk(KERN_ERR "rtc_init: no PC rtc found\n"); 963 return -EIO; ··· 1002 1003 #endif 1004 1005 - #endif /* __sparc__ vs. others */ 1006 1007 if (misc_register(&rtc_dev)) { 1008 #ifdef RTC_IRQ ··· 1087 remove_proc_entry ("driver/rtc", NULL); 1088 misc_deregister(&rtc_dev); 1089 1090 - #ifdef __sparc__ 1091 if (rtc_has_irq) 1092 free_irq (rtc_irq, &rtc_port); 1093 #else ··· 1099 if (rtc_has_irq) 1100 free_irq (RTC_IRQ, NULL); 1101 #endif 1102 - #endif /* __sparc__ */ 1103 } 1104 1105 module_init(rtc_init);
··· 86 #include <asm/hpet.h> 87 #endif 88 89 + #ifdef CONFIG_SPARC32 90 #include <linux/pci.h> 91 #include <asm/ebus.h> 92 93 static unsigned long rtc_port; 94 static int rtc_irq = PCI_IRQ_NONE; ··· 930 unsigned int year, ctrl; 931 char *guess = NULL; 932 #endif 933 + #ifdef CONFIG_SPARC32 934 struct linux_ebus *ebus; 935 struct linux_ebus_device *edev; 936 #else 937 void *r; 938 #ifdef RTC_IRQ ··· 944 #endif 945 #endif 946 947 + #ifdef CONFIG_SPARC32 948 for_each_ebus(ebus) { 949 for_each_ebusdev(edev, ebus) { 950 if(strcmp(edev->prom_node->name, "rtc") == 0) { ··· 954 } 955 } 956 } 957 rtc_has_irq = 0; 958 printk(KERN_ERR "rtc_init: no PC rtc found\n"); 959 return -EIO; ··· 1020 1021 #endif 1022 1023 + #endif /* CONFIG_SPARC32 vs. others */ 1024 1025 if (misc_register(&rtc_dev)) { 1026 #ifdef RTC_IRQ ··· 1105 remove_proc_entry ("driver/rtc", NULL); 1106 misc_deregister(&rtc_dev); 1107 1108 + #ifdef CONFIG_SPARC32 1109 if (rtc_has_irq) 1110 free_irq (rtc_irq, &rtc_port); 1111 #else ··· 1117 if (rtc_has_irq) 1118 free_irq (RTC_IRQ, NULL); 1119 #endif 1120 + #endif /* CONFIG_SPARC32 */ 1121 } 1122 1123 module_init(rtc_init);
+135 -2
drivers/net/sunvnet.c
··· 459 return 0; 460 } 461 462 static void maybe_tx_wakeup(struct vnet *vp) 463 { 464 struct net_device *dev = vp->dev; ··· 560 err = vnet_nack(port, &msgbuf); 561 } 562 } else if (msgbuf.tag.type == VIO_TYPE_CTRL) { 563 - err = vio_control_pkt_engine(vio, &msgbuf); 564 if (err) 565 break; 566 } else { ··· 750 return 0; 751 } 752 753 static void vnet_set_rx_mode(struct net_device *dev) 754 { 755 - /* XXX Implement multicast support XXX */ 756 } 757 758 static int vnet_change_mtu(struct net_device *dev, int new_mtu) ··· 1202 switch_port = 0; 1203 if (mdesc_get_property(hp, vdev->mp, "switch-port", NULL) != NULL) 1204 switch_port = 1; 1205 1206 spin_lock_irqsave(&vp->lock, flags); 1207 if (switch_port)
··· 459 return 0; 460 } 461 462 + static int handle_mcast(struct vnet_port *port, void *msgbuf) 463 + { 464 + struct vio_net_mcast_info *pkt = msgbuf; 465 + 466 + if (pkt->tag.stype != VIO_SUBTYPE_ACK) 467 + printk(KERN_ERR PFX "%s: Got unexpected MCAST reply " 468 + "[%02x:%02x:%04x:%08x]\n", 469 + port->vp->dev->name, 470 + pkt->tag.type, 471 + pkt->tag.stype, 472 + pkt->tag.stype_env, 473 + pkt->tag.sid); 474 + 475 + return 0; 476 + } 477 + 478 static void maybe_tx_wakeup(struct vnet *vp) 479 { 480 struct net_device *dev = vp->dev; ··· 544 err = vnet_nack(port, &msgbuf); 545 } 546 } else if (msgbuf.tag.type == VIO_TYPE_CTRL) { 547 + if (msgbuf.tag.stype_env == VNET_MCAST_INFO) 548 + err = handle_mcast(port, &msgbuf); 549 + else 550 + err = vio_control_pkt_engine(vio, &msgbuf); 551 if (err) 552 break; 553 } else { ··· 731 return 0; 732 } 733 734 + static struct vnet_mcast_entry *__vnet_mc_find(struct vnet *vp, u8 *addr) 735 + { 736 + struct vnet_mcast_entry *m; 737 + 738 + for (m = vp->mcast_list; m; m = m->next) { 739 + if (!memcmp(m->addr, addr, ETH_ALEN)) 740 + return m; 741 + } 742 + return NULL; 743 + } 744 + 745 + static void __update_mc_list(struct vnet *vp, struct net_device *dev) 746 + { 747 + struct dev_addr_list *p; 748 + 749 + for (p = dev->mc_list; p; p = p->next) { 750 + struct vnet_mcast_entry *m; 751 + 752 + m = __vnet_mc_find(vp, p->dmi_addr); 753 + if (m) { 754 + m->hit = 1; 755 + continue; 756 + } 757 + 758 + if (!m) { 759 + m = kzalloc(sizeof(*m), GFP_ATOMIC); 760 + if (!m) 761 + continue; 762 + memcpy(m->addr, p->dmi_addr, ETH_ALEN); 763 + m->hit = 1; 764 + 765 + m->next = vp->mcast_list; 766 + vp->mcast_list = m; 767 + } 768 + } 769 + } 770 + 771 + static void __send_mc_list(struct vnet *vp, struct vnet_port *port) 772 + { 773 + struct vio_net_mcast_info info; 774 + struct vnet_mcast_entry *m, **pp; 775 + int n_addrs; 776 + 777 + memset(&info, 0, sizeof(info)); 778 + 779 + info.tag.type = VIO_TYPE_CTRL; 780 + info.tag.stype = VIO_SUBTYPE_INFO; 781 + info.tag.stype_env = VNET_MCAST_INFO; 782 + info.tag.sid = vio_send_sid(&port->vio); 783 + info.set = 1; 784 + 785 + n_addrs = 0; 786 + for (m = vp->mcast_list; m; m = m->next) { 787 + if (m->sent) 788 + continue; 789 + m->sent = 1; 790 + memcpy(&info.mcast_addr[n_addrs * ETH_ALEN], 791 + m->addr, ETH_ALEN); 792 + if (++n_addrs == VNET_NUM_MCAST) { 793 + info.count = n_addrs; 794 + 795 + (void) vio_ldc_send(&port->vio, &info, 796 + sizeof(info)); 797 + n_addrs = 0; 798 + } 799 + } 800 + if (n_addrs) { 801 + info.count = n_addrs; 802 + (void) vio_ldc_send(&port->vio, &info, sizeof(info)); 803 + } 804 + 805 + info.set = 0; 806 + 807 + n_addrs = 0; 808 + pp = &vp->mcast_list; 809 + while ((m = *pp) != NULL) { 810 + if (m->hit) { 811 + m->hit = 0; 812 + pp = &m->next; 813 + continue; 814 + } 815 + 816 + memcpy(&info.mcast_addr[n_addrs * ETH_ALEN], 817 + m->addr, ETH_ALEN); 818 + if (++n_addrs == VNET_NUM_MCAST) { 819 + info.count = n_addrs; 820 + (void) vio_ldc_send(&port->vio, &info, 821 + sizeof(info)); 822 + n_addrs = 0; 823 + } 824 + 825 + *pp = m->next; 826 + kfree(m); 827 + } 828 + if (n_addrs) { 829 + info.count = n_addrs; 830 + (void) vio_ldc_send(&port->vio, &info, sizeof(info)); 831 + } 832 + } 833 + 834 static void vnet_set_rx_mode(struct net_device *dev) 835 { 836 + struct vnet *vp = netdev_priv(dev); 837 + struct vnet_port *port; 838 + unsigned long flags; 839 + 840 + spin_lock_irqsave(&vp->lock, flags); 841 + if (!list_empty(&vp->port_list)) { 842 + port = list_entry(vp->port_list.next, struct vnet_port, list); 843 + 844 + if (port->switch_port) { 845 + __update_mc_list(vp, dev); 846 + __send_mc_list(vp, port); 847 + } 848 + } 849 + spin_unlock_irqrestore(&vp->lock, flags); 850 } 851 852 static int vnet_change_mtu(struct net_device *dev, int new_mtu) ··· 1070 switch_port = 0; 1071 if (mdesc_get_property(hp, vdev->mp, "switch-port", NULL) != NULL) 1072 switch_port = 1; 1073 + port->switch_port = switch_port; 1074 1075 spin_lock_irqsave(&vp->lock, flags); 1076 if (switch_port)
+11
drivers/net/sunvnet.h
··· 30 31 struct hlist_node hash; 32 u8 raddr[ETH_ALEN]; 33 34 struct vnet *vp; 35 ··· 55 return val & (VNET_PORT_HASH_MASK); 56 } 57 58 struct vnet { 59 /* Protects port_list and port_hash. */ 60 spinlock_t lock; ··· 73 struct list_head port_list; 74 75 struct hlist_head port_hash[VNET_PORT_HASH_SIZE]; 76 77 struct list_head list; 78 u64 local_mac;
··· 30 31 struct hlist_node hash; 32 u8 raddr[ETH_ALEN]; 33 + u8 switch_port; 34 + u8 __pad; 35 36 struct vnet *vp; 37 ··· 53 return val & (VNET_PORT_HASH_MASK); 54 } 55 56 + struct vnet_mcast_entry { 57 + u8 addr[ETH_ALEN]; 58 + u8 sent; 59 + u8 hit; 60 + struct vnet_mcast_entry *next; 61 + }; 62 + 63 struct vnet { 64 /* Protects port_list and port_hash. */ 65 spinlock_t lock; ··· 64 struct list_head port_list; 65 66 struct hlist_head port_hash[VNET_PORT_HASH_SIZE]; 67 + 68 + struct vnet_mcast_entry *mcast_list; 69 70 struct list_head list; 71 u64 local_mac;
+5
drivers/sbus/sbus.c
··· 33 34 static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sdev) 35 { 36 unsigned long base; 37 const void *pval; 38 int len, err; ··· 67 } 68 69 sbus_fill_device_irq(sdev); 70 71 sdev->ofdev.node = dp; 72 if (sdev->parent)
··· 33 34 static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sdev) 35 { 36 + struct dev_archdata *sd; 37 unsigned long base; 38 const void *pval; 39 int len, err; ··· 66 } 67 68 sbus_fill_device_irq(sdev); 69 + 70 + sd = &sdev->ofdev.dev.archdata; 71 + sd->prom_node = dp; 72 + sd->op = &sdev->ofdev; 73 74 sdev->ofdev.node = dp; 75 if (sdev->parent)
+44 -75
drivers/serial/suncore.c
··· 16 #include <linux/tty.h> 17 #include <linux/errno.h> 18 #include <linux/string.h> 19 #include <linux/init.h> 20 21 - #include <asm/oplib.h> 22 23 #include "suncore.h" 24 ··· 27 28 EXPORT_SYMBOL(sunserial_current_minor); 29 30 void 31 sunserial_console_termios(struct console *con) 32 { 33 - char mode[16], buf[16], *s; 34 char mode_prop[] = "ttyX-mode"; 35 - char cd_prop[] = "ttyX-ignore-cd"; 36 - char dtr_prop[] = "ttyX-rts-dtr-off"; 37 - char *ssp_console_modes_prop = "ssp-console-modes"; 38 int baud, bits, stop, cflag; 39 char parity; 40 - int carrier = 0; 41 - int rtsdtr = 1; 42 - int topnd, nd; 43 44 - if (!serial_console) 45 - return; 46 47 - switch (serial_console) { 48 - case PROMDEV_OTTYA: 49 - mode_prop[3] = 'a'; 50 - cd_prop[3] = 'a'; 51 - dtr_prop[3] = 'a'; 52 - break; 53 54 - case PROMDEV_OTTYB: 55 - mode_prop[3] = 'b'; 56 - cd_prop[3] = 'b'; 57 - dtr_prop[3] = 'b'; 58 - break; 59 60 - case PROMDEV_ORSC: 61 - 62 - nd = prom_pathtoinode("rsc"); 63 - if (!nd) { 64 - strcpy(mode, "115200,8,n,1,-"); 65 - goto no_options; 66 - } 67 - 68 - if (!prom_node_has_property(nd, ssp_console_modes_prop)) { 69 - strcpy(mode, "115200,8,n,1,-"); 70 - goto no_options; 71 - } 72 - 73 - memset(mode, 0, sizeof(mode)); 74 - prom_getstring(nd, ssp_console_modes_prop, mode, sizeof(mode)); 75 - goto no_options; 76 - 77 - default: 78 - strcpy(mode, "9600,8,n,1,-"); 79 - goto no_options; 80 } 81 82 - topnd = prom_getchild(prom_root_node); 83 - nd = prom_searchsiblings(topnd, "options"); 84 - if (!nd) { 85 - strcpy(mode, "9600,8,n,1,-"); 86 - goto no_options; 87 - } 88 - 89 - if (!prom_node_has_property(nd, mode_prop)) { 90 - strcpy(mode, "9600,8,n,1,-"); 91 - goto no_options; 92 - } 93 - 94 - memset(mode, 0, sizeof(mode)); 95 - prom_getstring(nd, mode_prop, mode, sizeof(mode)); 96 - 97 - if (prom_node_has_property(nd, cd_prop)) { 98 - memset(buf, 0, sizeof(buf)); 99 - prom_getstring(nd, cd_prop, buf, sizeof(buf)); 100 - if (!strcmp(buf, "false")) 101 - carrier = 1; 102 - 103 - /* XXX: this is unused below. */ 104 - } 105 - 106 - if (prom_node_has_property(nd, dtr_prop)) { 107 - memset(buf, 0, sizeof(buf)); 108 - prom_getstring(nd, dtr_prop, buf, sizeof(buf)); 109 - if (!strcmp(buf, "false")) 110 - rtsdtr = 0; 111 - 112 - /* XXX: this is unused below. */ 113 - } 114 - 115 - no_options: 116 cflag = CREAD | HUPCL | CLOCAL; 117 118 s = mode;
··· 16 #include <linux/tty.h> 17 #include <linux/errno.h> 18 #include <linux/string.h> 19 + #include <linux/serial_core.h> 20 #include <linux/init.h> 21 22 + #include <asm/prom.h> 23 24 #include "suncore.h" 25 ··· 26 27 EXPORT_SYMBOL(sunserial_current_minor); 28 29 + int sunserial_console_match(struct console *con, struct device_node *dp, 30 + struct uart_driver *drv, int line) 31 + { 32 + int off; 33 + 34 + if (!con || of_console_device != dp) 35 + return 0; 36 + 37 + off = 0; 38 + if (of_console_options && 39 + *of_console_options == 'b') 40 + off = 1; 41 + 42 + if ((line & 1) != off) 43 + return 0; 44 + 45 + con->index = line; 46 + drv->cons = con; 47 + add_preferred_console(con->name, line, NULL); 48 + 49 + return 1; 50 + } 51 + EXPORT_SYMBOL(sunserial_console_match); 52 + 53 void 54 sunserial_console_termios(struct console *con) 55 { 56 + struct device_node *dp; 57 + const char *od, *mode, *s; 58 char mode_prop[] = "ttyX-mode"; 59 int baud, bits, stop, cflag; 60 char parity; 61 62 + dp = of_find_node_by_path("/options"); 63 + od = of_get_property(dp, "output-device", NULL); 64 + if (!strcmp(od, "rsc")) { 65 + mode = of_get_property(of_console_device, 66 + "ssp-console-modes", NULL); 67 + if (!mode) 68 + mode = "115200,8,n,1,-"; 69 + } else { 70 + char c; 71 72 + c = 'a'; 73 + if (of_console_options) 74 + c = *of_console_options; 75 76 + mode_prop[3] = c; 77 78 + mode = of_get_property(dp, mode_prop, NULL); 79 + if (!mode) 80 + mode = "9600,8,n,1,-"; 81 } 82 83 cflag = CREAD | HUPCL | CLOCAL; 84 85 s = mode;
+2
drivers/serial/suncore.h
··· 24 25 extern int sunserial_current_minor; 26 27 extern void sunserial_console_termios(struct console *); 28 29 #endif /* !(_SERIAL_SUN_H) */
··· 24 25 extern int sunserial_current_minor; 26 27 + extern int sunserial_console_match(struct console *, struct device_node *, 28 + struct uart_driver *, int); 29 extern void sunserial_console_termios(struct console *); 30 31 #endif /* !(_SERIAL_SUN_H) */
+2 -11
drivers/serial/sunhv.c
··· 520 .data = &sunhv_reg, 521 }; 522 523 - static inline struct console *SUNHV_CONSOLE(void) 524 - { 525 - if (con_is_present()) 526 - return NULL; 527 - 528 - sunhv_console.index = 0; 529 - 530 - return &sunhv_console; 531 - } 532 - 533 static int __devinit hv_probe(struct of_device *op, const struct of_device_id *match) 534 { 535 struct uart_port *port; ··· 572 sunhv_reg.tty_driver->name_base = sunhv_reg.minor - 64; 573 sunserial_current_minor += 1; 574 575 - sunhv_reg.cons = SUNHV_CONSOLE(); 576 577 err = uart_add_one_port(&sunhv_reg, port); 578 if (err)
··· 520 .data = &sunhv_reg, 521 }; 522 523 static int __devinit hv_probe(struct of_device *op, const struct of_device_id *match) 524 { 525 struct uart_port *port; ··· 582 sunhv_reg.tty_driver->name_base = sunhv_reg.minor - 64; 583 sunserial_current_minor += 1; 584 585 + sunserial_console_match(&sunhv_console, op->node, 586 + &sunhv_reg, port->line); 587 588 err = uart_add_one_port(&sunhv_reg, port); 589 if (err)
+5 -17
drivers/serial/sunsab.c
··· 968 969 static inline struct console *SUNSAB_CONSOLE(void) 970 { 971 - int i; 972 - 973 - if (con_is_present()) 974 - return NULL; 975 - 976 - for (i = 0; i < num_channels; i++) { 977 - int this_minor = sunsab_reg.minor + i; 978 - 979 - if ((this_minor - 64) == (serial_console - 1)) 980 - break; 981 - } 982 - if (i == num_channels) 983 - return NULL; 984 - 985 - sunsab_console.index = i; 986 - 987 return &sunsab_console; 988 } 989 #else ··· 1064 return err; 1065 } 1066 1067 uart_add_one_port(&sunsab_reg, &up[0].port); 1068 uart_add_one_port(&sunsab_reg, &up[1].port); 1069 1070 dev_set_drvdata(&op->dev, &up[0]); ··· 1153 } 1154 1155 sunsab_reg.tty_driver->name_base = sunsab_reg.minor - 64; 1156 - sunsab_reg.cons = SUNSAB_CONSOLE(); 1157 sunserial_current_minor += num_channels; 1158 } 1159
··· 968 969 static inline struct console *SUNSAB_CONSOLE(void) 970 { 971 return &sunsab_console; 972 } 973 #else ··· 1080 return err; 1081 } 1082 1083 + sunserial_console_match(SUNSAB_CONSOLE(), op->node, 1084 + &sunsab_reg, up[0].port.line); 1085 uart_add_one_port(&sunsab_reg, &up[0].port); 1086 + 1087 + sunserial_console_match(SUNSAB_CONSOLE(), op->node, 1088 + &sunsab_reg, up[1].port.line); 1089 uart_add_one_port(&sunsab_reg, &up[1].port); 1090 1091 dev_set_drvdata(&op->dev, &up[0]); ··· 1164 } 1165 1166 sunsab_reg.tty_driver->name_base = sunsab_reg.minor - 64; 1167 sunserial_current_minor += num_channels; 1168 } 1169
+4 -19
drivers/serial/sunsu.c
··· 1371 * Register console. 1372 */ 1373 1374 - static inline struct console *SUNSU_CONSOLE(int num_uart) 1375 { 1376 - int i; 1377 - 1378 - if (con_is_present()) 1379 - return NULL; 1380 - 1381 - for (i = 0; i < num_uart; i++) { 1382 - int this_minor = sunsu_reg.minor + i; 1383 - 1384 - if ((this_minor - 64) == (serial_console - 1)) 1385 - break; 1386 - } 1387 - if (i == num_uart) 1388 - return NULL; 1389 - 1390 - sunsu_console.index = i; 1391 - 1392 return &sunsu_console; 1393 } 1394 #else 1395 - #define SUNSU_CONSOLE(num_uart) (NULL) 1396 #define sunsu_serial_console_init() do { } while (0) 1397 #endif 1398 ··· 1466 1467 up->port.ops = &sunsu_pops; 1468 1469 err = uart_add_one_port(&sunsu_reg, &up->port); 1470 if (err) 1471 goto out_unmap; ··· 1558 return err; 1559 sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64; 1560 sunserial_current_minor += num_uart; 1561 - sunsu_reg.cons = SUNSU_CONSOLE(num_uart); 1562 } 1563 1564 err = of_register_driver(&su_driver, &of_bus_type);
··· 1371 * Register console. 1372 */ 1373 1374 + static inline struct console *SUNSU_CONSOLE(void) 1375 { 1376 return &sunsu_console; 1377 } 1378 #else 1379 + #define SUNSU_CONSOLE() (NULL) 1380 #define sunsu_serial_console_init() do { } while (0) 1381 #endif 1382 ··· 1482 1483 up->port.ops = &sunsu_pops; 1484 1485 + sunserial_console_match(SUNSU_CONSOLE(), dp, 1486 + &sunsu_reg, up->port.line); 1487 err = uart_add_one_port(&sunsu_reg, &up->port); 1488 if (err) 1489 goto out_unmap; ··· 1572 return err; 1573 sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64; 1574 sunserial_current_minor += num_uart; 1575 } 1576 1577 err = of_register_driver(&su_driver, &of_bus_type);
+6 -18
drivers/serial/sunzilog.c
··· 1226 1227 static inline struct console *SUNZILOG_CONSOLE(void) 1228 { 1229 - int i; 1230 - 1231 - if (con_is_present()) 1232 - return NULL; 1233 - 1234 - for (i = 0; i < NUM_CHANNELS; i++) { 1235 - int this_minor = sunzilog_reg.minor + i; 1236 - 1237 - if ((this_minor - 64) == (serial_console - 1)) 1238 - break; 1239 - } 1240 - if (i == NUM_CHANNELS) 1241 - return NULL; 1242 - 1243 - sunzilog_console_ops.index = i; 1244 - sunzilog_port_table[i].flags |= SUNZILOG_FLAG_IS_CONS; 1245 - 1246 return &sunzilog_console_ops; 1247 } 1248 ··· 1411 sunzilog_init_hw(&up[1]); 1412 1413 if (!keyboard_mouse) { 1414 err = uart_add_one_port(&sunzilog_reg, &up[0].port); 1415 if (err) { 1416 of_iounmap(&op->resource[0], 1417 rp, sizeof(struct zilog_layout)); 1418 return err; 1419 } 1420 err = uart_add_one_port(&sunzilog_reg, &up[1].port); 1421 if (err) { 1422 uart_remove_one_port(&sunzilog_reg, &up[0].port); ··· 1520 goto out_free_tables; 1521 1522 sunzilog_reg.tty_driver->name_base = sunzilog_reg.minor - 64; 1523 - sunzilog_reg.cons = SUNZILOG_CONSOLE(); 1524 1525 sunserial_current_minor += uart_count; 1526 }
··· 1226 1227 static inline struct console *SUNZILOG_CONSOLE(void) 1228 { 1229 return &sunzilog_console_ops; 1230 } 1231 ··· 1428 sunzilog_init_hw(&up[1]); 1429 1430 if (!keyboard_mouse) { 1431 + if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, 1432 + &sunzilog_reg, up[0].port.line)) 1433 + up->flags |= SUNZILOG_FLAG_IS_CONS; 1434 err = uart_add_one_port(&sunzilog_reg, &up[0].port); 1435 if (err) { 1436 of_iounmap(&op->resource[0], 1437 rp, sizeof(struct zilog_layout)); 1438 return err; 1439 } 1440 + if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, 1441 + &sunzilog_reg, up[1].port.line)) 1442 + up->flags |= SUNZILOG_FLAG_IS_CONS; 1443 err = uart_add_one_port(&sunzilog_reg, &up[1].port); 1444 if (err) { 1445 uart_remove_one_port(&sunzilog_reg, &up[0].port); ··· 1531 goto out_free_tables; 1532 1533 sunzilog_reg.tty_driver->name_base = sunzilog_reg.minor - 64; 1534 1535 sunserial_current_minor += uart_count; 1536 }
-4
drivers/video/aty/atyfb_base.c
··· 2913 int node, len, i, j, ret; 2914 u32 mem, chip_id; 2915 2916 - /* Do not attach when we have a serial console. */ 2917 - if (!con_is_present()) 2918 - return -ENXIO; 2919 - 2920 /* 2921 * Map memory-mapped registers. 2922 */
··· 2913 int node, len, i, j, ret; 2914 u32 mem, chip_id; 2915 2916 /* 2917 * Map memory-mapped registers. 2918 */
-4
drivers/video/igafb.c
··· 379 if (fb_get_options("igafb", NULL)) 380 return -ENODEV; 381 382 - /* Do not attach when we have a serial console. */ 383 - if (!con_is_present()) 384 - return -ENXIO; 385 - 386 pdev = pci_get_device(PCI_VENDOR_ID_INTERG, 387 PCI_DEVICE_ID_INTERG_1682, 0); 388 if (pdev == NULL) {
··· 379 if (fb_get_options("igafb", NULL)) 380 return -ENODEV; 381 382 pdev = pci_get_device(PCI_VENDOR_ID_INTERG, 383 PCI_DEVICE_ID_INTERG_1682, 0); 384 if (pdev == NULL) {
+13 -1
include/asm-sparc/device.h
··· 3 * 4 * This file is released under the GPLv2 5 */ 6 - #include <asm-generic/device.h> 7
··· 3 * 4 * This file is released under the GPLv2 5 */ 6 + #ifndef _ASM_SPARC_DEVICE_H 7 + #define _ASM_SPARC_DEVICE_H 8 + 9 + struct device_node; 10 + struct of_device; 11 + 12 + struct dev_archdata { 13 + struct device_node *prom_node; 14 + struct of_device *op; 15 + }; 16 + 17 + #endif /* _ASM_SPARC_DEVICE_H */ 18 + 19
+9
include/asm-sparc/fb.h
··· 1 #ifndef _ASM_FB_H_ 2 #define _ASM_FB_H_ 3 #include <linux/fb.h> 4 5 #define fb_pgprotect(...) do {} while (0) 6 7 static inline int fb_is_primary_device(struct fb_info *info) 8 { 9 return 0; 10 } 11
··· 1 #ifndef _ASM_FB_H_ 2 #define _ASM_FB_H_ 3 #include <linux/fb.h> 4 + #include <asm/prom.h> 5 6 #define fb_pgprotect(...) do {} while (0) 7 8 static inline int fb_is_primary_device(struct fb_info *info) 9 { 10 + struct device *dev = info->device; 11 + struct device_node *node; 12 + 13 + node = dev->archdata.prom_node; 14 + if (node && 15 + node == of_console_device) 16 + return 1; 17 + 18 return 0; 19 } 20
-26
include/asm-sparc/oplib.h
··· 158 extern void prom_printf(char *fmt, ...); 159 extern void prom_write(const char *buf, unsigned int len); 160 161 - /* Query for input device type */ 162 - 163 - enum prom_input_device { 164 - PROMDEV_IKBD, /* input from keyboard */ 165 - PROMDEV_ITTYA, /* input from ttya */ 166 - PROMDEV_ITTYB, /* input from ttyb */ 167 - PROMDEV_IRSC, /* input from rsc */ 168 - PROMDEV_IVCONS, /* input from virtual-console */ 169 - PROMDEV_I_UNK, 170 - }; 171 - 172 - extern enum prom_input_device prom_query_input_device(void); 173 - 174 - /* Query for output device type */ 175 - 176 - enum prom_output_device { 177 - PROMDEV_OSCREEN, /* to screen */ 178 - PROMDEV_OTTYA, /* to ttya */ 179 - PROMDEV_OTTYB, /* to ttyb */ 180 - PROMDEV_ORSC, /* to rsc */ 181 - PROMDEV_OVCONS, /* to virtual-console */ 182 - PROMDEV_O_UNK, 183 - }; 184 - 185 - extern enum prom_output_device prom_query_output_device(void); 186 - 187 /* Multiprocessor operations... */ 188 189 /* Start the CPU with the given device tree node, context table, and context
··· 158 extern void prom_printf(char *fmt, ...); 159 extern void prom_write(const char *buf, unsigned int len); 160 161 /* Multiprocessor operations... */ 162 163 /* Start the CPU with the given device tree node, context table, and context
+4
include/asm-sparc/prom.h
··· 85 */ 86 #include <linux/of.h> 87 88 #endif /* __KERNEL__ */ 89 #endif /* _SPARC_PROM_H */
··· 85 */ 86 #include <linux/of.h> 87 88 + extern struct device_node *of_console_device; 89 + extern char *of_console_path; 90 + extern char *of_console_options; 91 + 92 #endif /* __KERNEL__ */ 93 #endif /* _SPARC_PROM_H */
+9
include/asm-sparc64/fb.h
··· 3 #include <linux/fb.h> 4 #include <linux/fs.h> 5 #include <asm/page.h> 6 7 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, 8 unsigned long off) ··· 13 14 static inline int fb_is_primary_device(struct fb_info *info) 15 { 16 return 0; 17 } 18
··· 3 #include <linux/fb.h> 4 #include <linux/fs.h> 5 #include <asm/page.h> 6 + #include <asm/prom.h> 7 8 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, 9 unsigned long off) ··· 12 13 static inline int fb_is_primary_device(struct fb_info *info) 14 { 15 + struct device *dev = info->device; 16 + struct device_node *node; 17 + 18 + node = dev->archdata.prom_node; 19 + if (node && 20 + node == of_console_device) 21 + return 1; 22 + 23 return 0; 24 } 25
+2 -26
include/asm-sparc64/oplib.h
··· 140 extern void prom_printf(const char *fmt, ...); 141 extern void prom_write(const char *buf, unsigned int len); 142 143 - /* Query for input device type */ 144 - 145 - enum prom_input_device { 146 - PROMDEV_IKBD, /* input from keyboard */ 147 - PROMDEV_ITTYA, /* input from ttya */ 148 - PROMDEV_ITTYB, /* input from ttyb */ 149 - PROMDEV_IRSC, /* input from rsc */ 150 - PROMDEV_IVCONS, /* input from virtual-console */ 151 - PROMDEV_I_UNK, 152 - }; 153 - 154 - extern enum prom_input_device prom_query_input_device(void); 155 - 156 - /* Query for output device type */ 157 - 158 - enum prom_output_device { 159 - PROMDEV_OSCREEN, /* to screen */ 160 - PROMDEV_OTTYA, /* to ttya */ 161 - PROMDEV_OTTYB, /* to ttyb */ 162 - PROMDEV_ORSC, /* to rsc */ 163 - PROMDEV_OVCONS, /* to virtual-console */ 164 - PROMDEV_O_UNK, 165 - }; 166 - 167 - extern enum prom_output_device prom_query_output_device(void); 168 - 169 /* Multiprocessor operations... */ 170 #ifdef CONFIG_SMP 171 /* Start the CPU with the given device tree node at the passed program ··· 292 extern int prom_inst2pkg(int); 293 extern int prom_service_exists(const char *service_name); 294 extern void prom_sun4v_guest_soft_state(void); 295 296 /* Client interface level routines. */ 297 extern void prom_set_trap_table(unsigned long tba);
··· 140 extern void prom_printf(const char *fmt, ...); 141 extern void prom_write(const char *buf, unsigned int len); 142 143 /* Multiprocessor operations... */ 144 #ifdef CONFIG_SMP 145 /* Start the CPU with the given device tree node at the passed program ··· 318 extern int prom_inst2pkg(int); 319 extern int prom_service_exists(const char *service_name); 320 extern void prom_sun4v_guest_soft_state(void); 321 + 322 + extern int prom_ihandle2path(int handle, char *buffer, int bufsize); 323 324 /* Client interface level routines. */ 325 extern void prom_set_trap_table(unsigned long tba);
+137 -104
include/asm-sparc64/parport.h
··· 8 #define _ASM_SPARC64_PARPORT_H 1 9 10 #include <asm/ebus.h> 11 - #include <asm/isa.h> 12 #include <asm/ns87303.h> 13 14 #define PARPORT_PC_MAX_PORTS PARPORT_MAX 15 ··· 36 unsigned int addr; 37 unsigned int count; 38 int lock; 39 } sparc_ebus_dmas[PARPORT_PC_MAX_PORTS]; 40 41 static __inline__ int request_dma(unsigned int dmanr, const char *device_id) 42 { ··· 103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); 104 } 105 106 - static int ebus_ecpp_p(struct linux_ebus_device *edev) 107 { 108 - if (!strcmp(edev->prom_node->name, "ecpp")) 109 - return 1; 110 - if (!strcmp(edev->prom_node->name, "parallel")) { 111 - const char *compat; 112 113 - compat = of_get_property(edev->prom_node, 114 - "compatible", NULL); 115 - if (compat && 116 - (!strcmp(compat, "ecpp") || 117 - !strcmp(compat, "ns87317-ecpp") || 118 - !strcmp(compat + 13, "ecpp"))) 119 - return 1; 120 } 121 return 0; 122 } 123 124 - static int parport_isa_probe(int count) 125 { 126 - struct sparc_isa_bridge *isa_br; 127 - struct sparc_isa_device *isa_dev; 128 129 - for_each_isa(isa_br) { 130 - for_each_isadev(isa_dev, isa_br) { 131 - struct sparc_isa_device *child; 132 - unsigned long base; 133 - 134 - if (strcmp(isa_dev->prom_node->name, "dma")) 135 - continue; 136 - 137 - child = isa_dev->child; 138 - while (child) { 139 - if (!strcmp(child->prom_node->name, "parallel")) 140 - break; 141 - child = child->next; 142 - } 143 - if (!child) 144 - continue; 145 - 146 - base = child->resource.start; 147 - 148 - /* No DMA, see commentary in 149 - * asm-sparc64/floppy.h:isa_floppy_init() 150 - */ 151 - if (parport_pc_probe_port(base, base + 0x400, 152 - child->irq, PARPORT_DMA_NOFIFO, 153 - &child->bus->self->dev)) 154 - count++; 155 - } 156 - } 157 - 158 - return count; 159 - } 160 - 161 - static int parport_pc_find_nonpci_ports (int autoirq, int autodma) 162 - { 163 - struct linux_ebus *ebus; 164 - struct linux_ebus_device *edev; 165 - int count = 0; 166 - 167 - for_each_ebus(ebus) { 168 - for_each_ebusdev(edev, ebus) { 169 - if (ebus_ecpp_p(edev)) { 170 - unsigned long base = edev->resource[0].start; 171 - unsigned long config = edev->resource[1].start; 172 - unsigned long d_base = edev->resource[2].start; 173 - unsigned long d_len; 174 - 175 - spin_lock_init(&sparc_ebus_dmas[count].info.lock); 176 - d_len = (edev->resource[2].end - 177 - d_base) + 1; 178 - sparc_ebus_dmas[count].info.regs = 179 - ioremap(d_base, d_len); 180 - if (!sparc_ebus_dmas[count].info.regs) 181 - continue; 182 - sparc_ebus_dmas[count].info.flags = 0; 183 - sparc_ebus_dmas[count].info.callback = NULL; 184 - sparc_ebus_dmas[count].info.client_cookie = NULL; 185 - sparc_ebus_dmas[count].info.irq = 0xdeadbeef; 186 - strcpy(sparc_ebus_dmas[count].info.name, "parport"); 187 - if (ebus_dma_register(&sparc_ebus_dmas[count].info)) 188 - continue; 189 - ebus_dma_irq_enable(&sparc_ebus_dmas[count].info, 1); 190 - 191 - /* Configure IRQ to Push Pull, Level Low */ 192 - /* Enable ECP, set bit 2 of the CTR first */ 193 - outb(0x04, base + 0x02); 194 - ns87303_modify(config, PCR, 195 - PCR_EPP_ENABLE | 196 - PCR_IRQ_ODRAIN, 197 - PCR_ECP_ENABLE | 198 - PCR_ECP_CLK_ENA | 199 - PCR_IRQ_POLAR); 200 - 201 - /* CTR bit 5 controls direction of port */ 202 - ns87303_modify(config, PTR, 203 - 0, PTR_LPT_REG_DIR); 204 - 205 - if (parport_pc_probe_port(base, base + 0x400, 206 - edev->irqs[0], 207 - count, 208 - &ebus->self->dev)) 209 - count++; 210 - } 211 - } 212 - } 213 - 214 - count = parport_isa_probe(count); 215 - 216 - return count; 217 } 218 219 #endif /* !(_ASM_SPARC64_PARPORT_H */
··· 8 #define _ASM_SPARC64_PARPORT_H 1 9 10 #include <asm/ebus.h> 11 #include <asm/ns87303.h> 12 + #include <asm/of_device.h> 13 + #include <asm/prom.h> 14 15 #define PARPORT_PC_MAX_PORTS PARPORT_MAX 16 ··· 35 unsigned int addr; 36 unsigned int count; 37 int lock; 38 + 39 + struct parport *port; 40 } sparc_ebus_dmas[PARPORT_PC_MAX_PORTS]; 41 + 42 + static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS); 43 44 static __inline__ int request_dma(unsigned int dmanr, const char *device_id) 45 { ··· 98 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); 99 } 100 101 + static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match) 102 { 103 + unsigned long base = op->resource[0].start; 104 + unsigned long config = op->resource[1].start; 105 + unsigned long d_base = op->resource[2].start; 106 + unsigned long d_len; 107 + struct device_node *parent; 108 + struct parport *p; 109 + int slot, err; 110 111 + parent = op->node->parent; 112 + if (!strcmp(parent->name, "dma")) { 113 + p = parport_pc_probe_port(base, base + 0x400, 114 + op->irqs[0], PARPORT_DMA_NOFIFO, 115 + op->dev.parent); 116 + if (!p) 117 + return -ENOMEM; 118 + dev_set_drvdata(&op->dev, p); 119 + return 0; 120 } 121 + 122 + for (slot = 0; slot < PARPORT_PC_MAX_PORTS; slot++) { 123 + if (!test_and_set_bit(slot, dma_slot_map)) 124 + break; 125 + } 126 + err = -ENODEV; 127 + if (slot >= PARPORT_PC_MAX_PORTS) 128 + goto out_err; 129 + 130 + spin_lock_init(&sparc_ebus_dmas[slot].info.lock); 131 + 132 + d_len = (op->resource[2].end - d_base) + 1UL; 133 + sparc_ebus_dmas[slot].info.regs = 134 + of_ioremap(&op->resource[2], 0, d_len, "ECPP DMA"); 135 + 136 + if (!sparc_ebus_dmas[slot].info.regs) 137 + goto out_clear_map; 138 + 139 + sparc_ebus_dmas[slot].info.flags = 0; 140 + sparc_ebus_dmas[slot].info.callback = NULL; 141 + sparc_ebus_dmas[slot].info.client_cookie = NULL; 142 + sparc_ebus_dmas[slot].info.irq = 0xdeadbeef; 143 + strcpy(sparc_ebus_dmas[slot].info.name, "parport"); 144 + if (ebus_dma_register(&sparc_ebus_dmas[slot].info)) 145 + goto out_unmap_regs; 146 + 147 + ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 1); 148 + 149 + /* Configure IRQ to Push Pull, Level Low */ 150 + /* Enable ECP, set bit 2 of the CTR first */ 151 + outb(0x04, base + 0x02); 152 + ns87303_modify(config, PCR, 153 + PCR_EPP_ENABLE | 154 + PCR_IRQ_ODRAIN, 155 + PCR_ECP_ENABLE | 156 + PCR_ECP_CLK_ENA | 157 + PCR_IRQ_POLAR); 158 + 159 + /* CTR bit 5 controls direction of port */ 160 + ns87303_modify(config, PTR, 161 + 0, PTR_LPT_REG_DIR); 162 + 163 + p = parport_pc_probe_port(base, base + 0x400, 164 + op->irqs[0], 165 + slot, 166 + op->dev.parent); 167 + err = -ENOMEM; 168 + if (!p) 169 + goto out_disable_irq; 170 + 171 + dev_set_drvdata(&op->dev, p); 172 + 173 + return 0; 174 + 175 + out_disable_irq: 176 + ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0); 177 + ebus_dma_unregister(&sparc_ebus_dmas[slot].info); 178 + 179 + out_unmap_regs: 180 + of_iounmap(&op->resource[2], sparc_ebus_dmas[slot].info.regs, d_len); 181 + 182 + out_clear_map: 183 + clear_bit(slot, dma_slot_map); 184 + 185 + out_err: 186 + return err; 187 + } 188 + 189 + static int __devexit ecpp_remove(struct of_device *op) 190 + { 191 + struct parport *p = dev_get_drvdata(&op->dev); 192 + int slot = p->dma; 193 + 194 + parport_pc_unregister_port(p); 195 + 196 + if (slot != PARPORT_DMA_NOFIFO) { 197 + unsigned long d_base = op->resource[2].start; 198 + unsigned long d_len; 199 + 200 + d_len = (op->resource[2].end - d_base) + 1UL; 201 + 202 + ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0); 203 + ebus_dma_unregister(&sparc_ebus_dmas[slot].info); 204 + of_iounmap(&op->resource[2], 205 + sparc_ebus_dmas[slot].info.regs, 206 + d_len); 207 + clear_bit(slot, dma_slot_map); 208 + } 209 + 210 return 0; 211 } 212 213 + static struct of_device_id ecpp_match[] = { 214 + { 215 + .name = "ecpp", 216 + }, 217 + { 218 + .name = "parallel", 219 + .compatible = "ecpp", 220 + }, 221 + { 222 + .name = "parallel", 223 + .compatible = "ns87317-ecpp", 224 + }, 225 + {}, 226 + }; 227 + 228 + static struct of_platform_driver ecpp_driver = { 229 + .name = "ecpp", 230 + .match_table = ecpp_match, 231 + .probe = ecpp_probe, 232 + .remove = __devexit_p(ecpp_remove), 233 + }; 234 + 235 + static int parport_pc_find_nonpci_ports(int autoirq, int autodma) 236 { 237 + of_register_driver(&ecpp_driver, &of_bus_type); 238 239 + return 0; 240 } 241 242 #endif /* !(_ASM_SPARC64_PARPORT_H */
+4
include/asm-sparc64/prom.h
··· 94 */ 95 #include <linux/of.h> 96 97 #endif /* __KERNEL__ */ 98 #endif /* _SPARC64_PROM_H */
··· 94 */ 95 #include <linux/of.h> 96 97 + extern struct device_node *of_console_device; 98 + extern char *of_console_path; 99 + extern char *of_console_options; 100 + 101 #endif /* __KERNEL__ */ 102 #endif /* _SPARC64_PROM_H */
-6
include/asm-sparc64/system.h
··· 115 #ifndef __ASSEMBLY__ 116 117 extern void sun_do_break(void); 118 - extern int serial_console; 119 extern int stop_a_enabled; 120 - 121 - static __inline__ int con_is_present(void) 122 - { 123 - return serial_console ? 0 : 1; 124 - } 125 126 extern void synchronize_user_stack(void); 127
··· 115 #ifndef __ASSEMBLY__ 116 117 extern void sun_do_break(void); 118 extern int stop_a_enabled; 119 120 extern void synchronize_user_stack(void); 121