1 /* $NetBSD: hpc.c,v 1.36 2006/03/29 04:16:47 thorpej Exp $ */ 2 3 /* 4 * Copyright (c) 2000 Soren S. Jorvang 5 * Copyright (c) 2001 Rafal K. Boni 6 * Copyright (c) 2001 Jason R. Thorpe 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed for the 20 * NetBSD Project. See http://www.NetBSD.org/ for 21 * information about NetBSD. 22 * 4. The name of the author may not be used to endorse or promote products 23 * derived from this software without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 26 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 */ 36 37 #include <sys/cdefs.h> 38 __KERNEL_RCSID(0, "$NetBSD: hpc.c,v 1.36 2006/03/29 04:16:47 thorpej Exp $"); 39 40 #include <sys/param.h> 41 #include <sys/systm.h> 42 #include <sys/kernel.h> 43 #include <sys/device.h> 44 #include <sys/reboot.h> 45 #include <sys/callout.h> 46 47 #include <machine/machtype.h> 48 49 #include <sgimips/gio/gioreg.h> 50 #include <sgimips/gio/giovar.h> 51 52 #include <sgimips/hpc/hpcvar.h> 53 #include <sgimips/hpc/hpcreg.h> 54 #include <sgimips/ioc/iocreg.h> 55 56 #include "locators.h" 57 58 #define HPC_REVISION_MASK 0x3 59 #define HPC_REVISION_1 0x1 60 #define HPC_REVISION_15 0x2 61 #define HPC_REVISION_3 0x3 62 63 const struct hpc_device { 64 const char *hd_name; 65 bus_addr_t hd_base; 66 bus_addr_t hd_devoff; 67 bus_addr_t hd_dmaoff; 68 int hd_irq; 69 int hd_sysmask; 70 } hpc_devices[] = { 71 { "zsc", 72 HPC_BASE_ADDRESS_0, 73 /* XXX Magic numbers */ 74 HPC3_PBUS_CH6_DEVREGS + IOC_SERIAL_REGS, 0, 75 29, 76 HPCDEV_IP22 | HPCDEV_IP24 }, 77 78 /* probe order is important for IP20 zsc */ 79 80 { "zsc", /* serial 0/1 duart 1 */ 81 HPC_BASE_ADDRESS_0, 82 0x0d10, 0, 83 5, 84 HPCDEV_IP12 | HPCDEV_IP20 }, 85 86 { "zsc", /* kbd/ms duart 0 */ 87 HPC_BASE_ADDRESS_0, 88 0x0d00, 0, 89 5, 90 HPCDEV_IP12 | HPCDEV_IP20 }, 91 92 { "pckbc", 93 HPC_BASE_ADDRESS_0, 94 HPC3_PBUS_CH6_DEVREGS + IOC_KB_REGS, 0, 95 28, 96 HPCDEV_IP22 | HPCDEV_IP24 }, 97 98 { "sq", 99 HPC_BASE_ADDRESS_0, 100 HPC3_ENET_DEVREGS, HPC3_ENET_REGS, 101 3, 102 HPCDEV_IP22 | HPCDEV_IP24 }, 103 104 { "sq", 105 HPC_BASE_ADDRESS_0, 106 HPC1_ENET_DEVREGS, HPC1_ENET_REGS, 107 3, 108 HPCDEV_IP12 | HPCDEV_IP20 }, 109 110 { "sq", 111 HPC_BASE_ADDRESS_1, 112 HPC1_ENET_DEVREGS, HPC1_ENET_REGS, 113 6, 114 HPCDEV_IP12 | HPCDEV_IP20 }, 115 116 { "sq", 117 HPC_BASE_ADDRESS_1, 118 HPC1_ENET_DEVREGS, HPC1_ENET_REGS, 119 22, 120 HPCDEV_IP24 }, 121 122 { "sq", 123 HPC_BASE_ADDRESS_2, 124 HPC1_ENET_DEVREGS, HPC1_ENET_REGS, 125 15, 126 HPCDEV_IP12 | HPCDEV_IP20 }, 127 128 { "sq", 129 HPC_BASE_ADDRESS_2, 130 HPC1_ENET_DEVREGS, HPC1_ENET_REGS, 131 23, 132 HPCDEV_IP24 }, 133 134 { "wdsc", 135 HPC_BASE_ADDRESS_0, 136 HPC3_SCSI0_DEVREGS, HPC3_SCSI0_REGS, 137 1, /* XXX 1 = IRQ_LOCAL0 + 1 */ 138 HPCDEV_IP22 | HPCDEV_IP24 }, 139 140 { "wdsc", 141 HPC_BASE_ADDRESS_0, 142 HPC3_SCSI1_DEVREGS, HPC3_SCSI1_REGS, 143 2, /* XXX 2 = IRQ_LOCAL0 + 2 */ 144 HPCDEV_IP22 }, 145 146 { "wdsc", 147 HPC_BASE_ADDRESS_0, 148 HPC1_SCSI0_DEVREGS, HPC1_SCSI0_REGS, 149 2, /* XXX 1 = IRQ_LOCAL0 + 2 */ 150 HPCDEV_IP12 | HPCDEV_IP20 }, 151 152 { "dpclock", 153 HPC_BASE_ADDRESS_0, 154 HPC1_PBUS_BBRAM, 0, 155 -1, 156 HPCDEV_IP12 | HPCDEV_IP20 }, 157 158 { "dsclock", 159 HPC_BASE_ADDRESS_0, 160 HPC3_PBUS_BBRAM, 0, 161 -1, 162 HPCDEV_IP22 | HPCDEV_IP24 }, 163 164 { "haltwo", 165 HPC_BASE_ADDRESS_0, 166 HPC3_PBUS_CH0_DEVREGS, HPC3_PBUS_DMAREGS, 167 8 + 4, /* XXX IRQ_LOCAL1 + 4 */ 168 HPCDEV_IP22 | HPCDEV_IP24 }, 169 170 { "pi1ppc", 171 HPC_BASE_ADDRESS_0, 172 HPC3_PBUS_CH6_DEVREGS + IOC_PLP_REGS, 0, 173 -1, 174 HPCDEV_IP22 | HPCDEV_IP24 }, 175 176 { NULL, 177 0, 178 0, 0, 179 0, 180 0 181 } 182 }; 183 184 struct hpc_softc { 185 struct device sc_dev; 186 187 bus_addr_t sc_base; 188 189 bus_space_tag_t sc_ct; 190 bus_space_handle_t sc_ch; 191 }; 192 193 static struct hpc_values hpc1_values = { 194 .revision = 1, 195 .scsi0_regs = HPC1_SCSI0_REGS, 196 .scsi0_regs_size = HPC1_SCSI0_REGS_SIZE, 197 .scsi0_cbp = HPC1_SCSI0_CBP, 198 .scsi0_ndbp = HPC1_SCSI0_NDBP, 199 .scsi0_bc = HPC1_SCSI0_BC, 200 .scsi0_ctl = HPC1_SCSI0_CTL, 201 .scsi0_gio = HPC1_SCSI0_GIO, 202 .scsi0_dev = HPC1_SCSI0_DEV, 203 .scsi0_dmacfg = HPC1_SCSI0_DMACFG, 204 .scsi0_piocfg = HPC1_SCSI0_PIOCFG, 205 .scsi1_regs = HPC1_SCSI1_REGS, 206 .scsi1_regs_size = HPC1_SCSI1_REGS_SIZE, 207 .scsi1_cbp = HPC1_SCSI1_CBP, 208 .scsi1_ndbp = HPC1_SCSI1_NDBP, 209 .scsi1_bc = HPC1_SCSI1_BC, 210 .scsi1_ctl = HPC1_SCSI1_CTL, 211 .scsi1_gio = HPC1_SCSI1_GIO, 212 .scsi1_dev = HPC1_SCSI1_DEV, 213 .scsi1_dmacfg = HPC1_SCSI1_DMACFG, 214 .scsi1_piocfg = HPC1_SCSI1_PIOCFG, 215 .dmactl_dir = HPC1_DMACTL_DIR, 216 .dmactl_flush = HPC1_DMACTL_FLUSH, 217 .dmactl_active = HPC1_DMACTL_ACTIVE, 218 .dmactl_reset = HPC1_DMACTL_RESET, 219 .enet_regs = HPC1_ENET_REGS, 220 .enet_regs_size = HPC1_ENET_REGS_SIZE, 221 .enet_intdelay = HPC1_ENET_INTDELAY, 222 .enet_intdelayval = HPC1_ENET_INTDELAY_OFF, 223 .enetr_cbp = HPC1_ENETR_CBP, 224 .enetr_ndbp = HPC1_ENETR_NDBP, 225 .enetr_bc = HPC1_ENETR_BC, 226 .enetr_ctl = HPC1_ENETR_CTL, 227 .enetr_ctl_active = HPC1_ENETR_CTL_ACTIVE, 228 .enetr_reset = HPC1_ENETR_RESET, 229 .enetr_dmacfg = 0, 230 .enetr_piocfg = 0, 231 .enetx_cbp = HPC1_ENETX_CBP, 232 .enetx_ndbp = HPC1_ENETX_NDBP, 233 .enetx_bc = HPC1_ENETX_BC, 234 .enetx_ctl = HPC1_ENETX_CTL, 235 .enetx_ctl_active = HPC1_ENETX_CTL_ACTIVE, 236 .enetx_dev = 0, 237 .enetr_fifo = HPC1_ENETR_FIFO, 238 .enetr_fifo_size = HPC1_ENETR_FIFO_SIZE, 239 .enetx_fifo = HPC1_ENETX_FIFO, 240 .enetx_fifo_size = HPC1_ENETX_FIFO_SIZE, 241 .scsi0_devregs_size = HPC1_SCSI0_DEVREGS_SIZE, 242 .scsi1_devregs_size = HPC1_SCSI0_DEVREGS_SIZE, 243 .enet_devregs = HPC1_ENET_DEVREGS, 244 .enet_devregs_size = HPC1_ENET_DEVREGS_SIZE, 245 .pbus_fifo = 0, 246 .pbus_fifo_size = 0, 247 .pbus_bbram = 0, 248 #define MAX_SCSI_XFER (512*1024) 249 .scsi_max_xfer = MAX_SCSI_XFER, 250 .scsi_dma_segs = (MAX_SCSI_XFER / 4096), 251 .scsi_dma_segs_size = 4096, 252 .clk_freq = 100, 253 .dma_datain_cmd = (HPC1_DMACTL_ACTIVE | HPC1_DMACTL_DIR), 254 .dma_dataout_cmd = HPC1_DMACTL_ACTIVE, 255 .scsi_dmactl_flush = HPC1_DMACTL_FLUSH, 256 .scsi_dmactl_active = HPC1_DMACTL_ACTIVE, 257 .scsi_dmactl_reset = HPC1_DMACTL_RESET 258 }; 259 260 static struct hpc_values hpc3_values = { 261 .revision 3, 262 .scsi0_regs = HPC3_SCSI0_REGS, 263 .scsi0_regs_size = HPC3_SCSI0_REGS_SIZE, 264 .scsi0_cbp = HPC3_SCSI0_CBP, 265 .scsi0_ndbp = HPC3_SCSI0_NDBP, 266 .scsi0_bc = HPC3_SCSI0_BC, 267 .scsi0_ctl = HPC3_SCSI0_CTL, 268 .scsi0_gio = HPC3_SCSI0_GIO, 269 .scsi0_dev = HPC3_SCSI0_DEV, 270 .scsi0_dmacfg = HPC3_SCSI0_DMACFG, 271 .scsi0_piocfg = HPC3_SCSI0_PIOCFG, 272 .scsi1_regs = HPC3_SCSI1_REGS, 273 .scsi1_regs_size = HPC3_SCSI1_REGS_SIZE, 274 .scsi1_cbp = HPC3_SCSI1_CBP, 275 .scsi1_ndbp = HPC3_SCSI1_NDBP, 276 .scsi1_bc = HPC3_SCSI1_BC, 277 .scsi1_ctl = HPC3_SCSI1_CTL, 278 .scsi1_gio = HPC3_SCSI1_GIO, 279 .scsi1_dev = HPC3_SCSI1_DEV, 280 .scsi1_dmacfg = HPC3_SCSI1_DMACFG, 281 .scsi1_piocfg = HPC3_SCSI1_PIOCFG, 282 .dmactl_dir = HPC3_DMACTL_DIR, 283 .dmactl_flush = HPC3_DMACTL_FLUSH, 284 .dmactl_active = HPC3_DMACTL_ACTIVE, 285 .dmactl_reset = HPC3_DMACTL_RESET, 286 .enet_regs = HPC3_ENET_REGS, 287 .enet_regs_size = HPC3_ENET_REGS_SIZE, 288 .enet_intdelay = 0, 289 .enet_intdelayval = 0, 290 .enetr_cbp = HPC3_ENETR_CBP, 291 .enetr_ndbp = HPC3_ENETR_NDBP, 292 .enetr_bc = HPC3_ENETR_BC, 293 .enetr_ctl = HPC3_ENETR_CTL, 294 .enetr_ctl_active = HPC3_ENETR_CTL_ACTIVE, 295 .enetr_reset = HPC3_ENETR_RESET, 296 .enetr_dmacfg = HPC3_ENETR_DMACFG, 297 .enetr_piocfg = HPC3_ENETR_PIOCFG, 298 .enetx_cbp = HPC3_ENETX_CBP, 299 .enetx_ndbp = HPC3_ENETX_NDBP, 300 .enetx_bc = HPC3_ENETX_BC, 301 .enetx_ctl = HPC3_ENETX_CTL, 302 .enetx_ctl_active = HPC3_ENETX_CTL_ACTIVE, 303 .enetx_dev = HPC3_ENETX_DEV, 304 .enetr_fifo = HPC3_ENETR_FIFO, 305 .enetr_fifo_size = HPC3_ENETR_FIFO_SIZE, 306 .enetx_fifo = HPC3_ENETX_FIFO, 307 .enetx_fifo_size = HPC3_ENETX_FIFO_SIZE, 308 .scsi0_devregs_size = HPC3_SCSI0_DEVREGS_SIZE, 309 .scsi1_devregs_size = HPC3_SCSI1_DEVREGS_SIZE, 310 .enet_devregs = HPC3_ENET_DEVREGS, 311 .enet_devregs_size = HPC3_ENET_DEVREGS_SIZE, 312 .pbus_fifo = HPC3_PBUS_FIFO, 313 .pbus_fifo_size = HPC3_PBUS_FIFO_SIZE, 314 .pbus_bbram = HPC3_PBUS_BBRAM, 315 .scsi_max_xfer = MAX_SCSI_XFER, 316 .scsi_dma_segs = (MAX_SCSI_XFER / 8192), 317 .scsi_dma_segs_size = 8192, 318 .clk_freq = 100, 319 .dma_datain_cmd = HPC3_DMACTL_ACTIVE, 320 .dma_dataout_cmd = (HPC3_DMACTL_ACTIVE | HPC3_DMACTL_DIR), 321 .scsi_dmactl_flush = HPC3_DMACTL_FLUSH, 322 .scsi_dmactl_active = HPC3_DMACTL_ACTIVE, 323 .scsi_dmactl_reset = HPC3_DMACTL_RESET 324 }; 325 326 327 extern int mach_type; /* IPxx type */ 328 extern int mach_subtype; /* subtype: eg., Guiness/Fullhouse for IP22 */ 329 extern int mach_boardrev; /* machine board revision, in case it matters */ 330 331 extern struct sgimips_bus_dma_tag sgimips_default_bus_dma_tag; 332 333 static int powerintr_established; 334 335 int hpc_match(struct device *, struct cfdata *, void *); 336 void hpc_attach(struct device *, struct device *, void *); 337 int hpc_print(void *, const char *); 338 339 int hpc_revision(struct hpc_softc *, struct gio_attach_args *); 340 341 int hpc_submatch(struct device *, struct cfdata *, 342 const int *, void *); 343 344 int hpc_power_intr(void *); 345 346 #if defined(BLINK) 347 static struct callout hpc_blink_ch = CALLOUT_INITIALIZER; 348 static void hpc_blink(void *); 349 #endif 350 351 CFATTACH_DECL(hpc, sizeof(struct hpc_softc), 352 hpc_match, hpc_attach, NULL, NULL); 353 354 int 355 hpc_match(struct device *parent, struct cfdata *cf, void *aux) 356 { 357 struct gio_attach_args* ga = aux; 358 359 /* Make sure it's actually there and readable */ 360 if (badaddr((void*)MIPS_PHYS_TO_KSEG1(ga->ga_addr), sizeof(u_int32_t))) 361 return 0; 362 363 return 1; 364 } 365 366 void 367 hpc_attach(struct device *parent, struct device *self, void *aux) 368 { 369 struct hpc_softc *sc = (struct hpc_softc *)self; 370 struct gio_attach_args* ga = aux; 371 struct hpc_attach_args ha; 372 const struct hpc_device *hd; 373 uint32_t hpctype; 374 int sysmask; 375 376 switch (mach_type) { 377 case MACH_SGI_IP12: 378 sysmask = HPCDEV_IP12; 379 break; 380 381 case MACH_SGI_IP20: 382 sysmask = HPCDEV_IP20; 383 break; 384 385 case MACH_SGI_IP22: 386 if (mach_subtype == MACH_SGI_IP22_FULLHOUSE) 387 sysmask = HPCDEV_IP22; 388 else 389 sysmask = HPCDEV_IP24; 390 break; 391 392 default: 393 panic("hpc_attach: can't handle HPC on an IP%d", mach_type); 394 }; 395 396 if ((hpctype = hpc_revision(sc, ga)) == 0) 397 panic("hpc_attach: could not identify HPC revision\n"); 398 399 /* force big-endian mode */ 400 if (hpctype == 15) 401 *(uint32_t *)MIPS_PHYS_TO_KSEG1(ga->ga_addr+HPC1_BIGENDIAN) = 0; 402 403 printf(": SGI HPC%d%s\n", (hpctype == 3) ? 3 : 1, 404 (hpctype == 15) ? ".5" : ""); 405 406 sc->sc_ct = 1; 407 sc->sc_ch = ga->ga_ioh; 408 409 sc->sc_base = ga->ga_addr; 410 411 for (hd = hpc_devices; hd->hd_name != NULL; hd++) { 412 if (!(hd->hd_sysmask & sysmask) || hd->hd_base != sc->sc_base) 413 continue; 414 415 ha.ha_name = hd->hd_name; 416 ha.ha_devoff = hd->hd_devoff; 417 ha.ha_dmaoff = hd->hd_dmaoff; 418 ha.ha_irq = hd->hd_irq; 419 420 /* XXX This is disgusting. */ 421 ha.ha_st = 1; 422 ha.ha_sh = MIPS_PHYS_TO_KSEG1(sc->sc_base); 423 ha.ha_dmat = &sgimips_default_bus_dma_tag; 424 if (hpctype == 3) 425 ha.hpc_regs = &hpc3_values; 426 else 427 ha.hpc_regs = &hpc1_values; 428 ha.hpc_regs->revision = hpctype; 429 430 (void) config_found_sm_loc(self, "hpc", NULL, &ha, hpc_print, 431 hpc_submatch); 432 } 433 434 /* 435 * XXX: Only attach the powerfail interrupt once, since the 436 * interrupt code doesn't let you share interrupt just yet. 437 * 438 * Since the powerfail interrupt is hardcoded to read from 439 * a specific register anyway (XXX#2!), we don't care when 440 * it gets attached, as long as it only happens once. 441 */ 442 if (mach_type == MACH_SGI_IP22 && !powerintr_established) { 443 cpu_intr_establish(9, IPL_NONE, hpc_power_intr, sc); 444 powerintr_established++; 445 } 446 447 #if defined(BLINK) 448 if (mach_type == MACH_SGI_IP12 || mach_type == MACH_SGI_IP20) 449 hpc_blink(sc); 450 #endif 451 } 452 453 int 454 hpc_revision(struct hpc_softc *sc, struct gio_attach_args *ga) 455 { 456 int hpctype; 457 458 /* Allow forcing of our hpc revision. */ 459 switch (device_cfdata(&sc->sc_dev)->cf_flags & HPC_REVISION_MASK) { 460 case HPC_REVISION_1: 461 return (1); 462 463 case HPC_REVISION_15: 464 return (15); 465 466 case HPC_REVISION_3: 467 return (3); 468 } 469 470 /* XXX We should really come up with an autodetect mechanism */ 471 switch (mach_type) { 472 case MACH_SGI_IP12: 473 hpctype = 1; 474 break; 475 476 case MACH_SGI_IP20: 477 hpctype = 15; 478 break; 479 480 case MACH_SGI_IP22: 481 hpctype = 3; 482 break; 483 484 default: 485 return (0); 486 } 487 488 /* 489 * Verify HPC1 or HPC1.5 490 * 491 * For some reason the endian register isn't mapped on all 492 * machines (HPC1 machines?). 493 */ 494 if (hpctype == 1 || hpctype == 15) { 495 u_int32_t reg; 496 497 if (!badaddr((void *)MIPS_PHYS_TO_KSEG1(ga->ga_addr + 498 HPC1_BIGENDIAN), 4)) { 499 reg = *(uint32_t *)MIPS_PHYS_TO_KSEG1(ga->ga_addr + 500 HPC1_BIGENDIAN); 501 502 if (((reg >> HPC1_REVSHIFT) & HPC1_REVMASK) == 503 HPC1_REV15) 504 hpctype = 15; 505 else 506 hpctype = 1; 507 } else 508 hpctype = 1; 509 } 510 511 return (hpctype); 512 } 513 514 int 515 hpc_submatch(struct device *parent, struct cfdata *cf, 516 const int *ldesc, void *aux) 517 { 518 struct hpc_attach_args *ha = aux; 519 520 if (cf->cf_loc[HPCCF_OFFSET] != HPCCF_OFFSET_DEFAULT && 521 (bus_addr_t) cf->cf_loc[HPCCF_OFFSET] != ha->ha_devoff) 522 return (0); 523 524 return (config_match(parent, cf, aux)); 525 } 526 527 int 528 hpc_print(void *aux, const char *pnp) 529 { 530 struct hpc_attach_args *ha = aux; 531 532 if (pnp) 533 printf("%s at %s", ha->ha_name, pnp); 534 535 printf(" offset 0x%lx", ha->ha_devoff); 536 537 return (UNCONF); 538 } 539 540 int 541 hpc_power_intr(void *arg) 542 { 543 u_int32_t pwr_reg; 544 545 pwr_reg = *((volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(0x1fbd9850)); 546 *((volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(0x1fbd9850)) = pwr_reg; 547 548 printf("hpc_power_intr: panel reg = %08x\n", pwr_reg); 549 550 if (pwr_reg & 2) 551 cpu_reboot(RB_HALT, NULL); 552 553 return 1; 554 } 555 556 #if defined(BLINK) 557 static void 558 hpc_blink(void *self) 559 { 560 struct hpc_softc *sc = (struct hpc_softc *) self; 561 register int s; 562 int value; 563 564 s = splhigh(); 565 566 value = *(volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(HPC1_AUX_REGS); 567 value ^= HPC1_AUX_CONSLED; 568 *(volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(HPC1_AUX_REGS) = value; 569 splx(s); 570 571 /* 572 * Blink rate is: 573 * full cycle every second if completely idle (loadav = 0) 574 * full cycle every 2 seconds if loadav = 1 575 * full cycle every 3 seconds if loadav = 2 576 * etc. 577 */ 578 s = (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 1)); 579 callout_reset(&hpc_blink_ch, s, hpc_blink, sc); 580 } 581 #endif 582 583