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