| @@ -282,27 +282,27 @@ TCXProbe(DriverPtr drv, int flags) | | | @@ -282,27 +282,27 @@ TCXProbe(DriverPtr drv, int flags) |
282 | free(pEnt); | | 282 | free(pEnt); |
283 | } | | 283 | } |
284 | free(usedChips); | | 284 | free(usedChips); |
285 | return foundScreen; | | 285 | return foundScreen; |
286 | } | | 286 | } |
287 | | | 287 | |
288 | /* Mandatory */ | | 288 | /* Mandatory */ |
289 | static Bool | | 289 | static Bool |
290 | TCXPreInit(ScrnInfoPtr pScrn, int flags) | | 290 | TCXPreInit(ScrnInfoPtr pScrn, int flags) |
291 | { | | 291 | { |
292 | TcxPtr pTcx; | | 292 | TcxPtr pTcx; |
293 | sbusDevicePtr psdp = NULL; | | 293 | sbusDevicePtr psdp = NULL; |
294 | MessageType from; | | 294 | MessageType from; |
295 | int i; | | 295 | int i, prom; |
296 | int hwCursor, lowDepth; | | 296 | int hwCursor, lowDepth; |
297 | | | 297 | |
298 | if (flags & PROBE_DETECT) return FALSE; | | 298 | if (flags & PROBE_DETECT) return FALSE; |
299 | | | 299 | |
300 | /* | | 300 | /* |
301 | * Note: This function is only called once at server startup, and | | 301 | * Note: This function is only called once at server startup, and |
302 | * not at the start of each server generation. This means that | | 302 | * not at the start of each server generation. This means that |
303 | * only things that are persistent across server generations can | | 303 | * only things that are persistent across server generations can |
304 | * be initialised here. xf86Screens[] is (pScrn is a pointer to one | | 304 | * be initialised here. xf86Screens[] is (pScrn is a pointer to one |
305 | * of these). Privates allocated using xf86AllocateScrnInfoPrivateIndex() | | 305 | * of these). Privates allocated using xf86AllocateScrnInfoPrivateIndex() |
306 | * are too, and should be used for data that must persist across | | 306 | * are too, and should be used for data that must persist across |
307 | * server generations. | | 307 | * server generations. |
308 | * | | 308 | * |
| @@ -331,38 +331,54 @@ TCXPreInit(ScrnInfoPtr pScrn, int flags) | | | @@ -331,38 +331,54 @@ TCXPreInit(ScrnInfoPtr pScrn, int flags) |
331 | psdp = xf86GetSbusInfoForEntity(pEnt->index); | | 331 | psdp = xf86GetSbusInfoForEntity(pEnt->index); |
332 | pTcx->psdp = psdp; | | 332 | pTcx->psdp = psdp; |
333 | } else | | 333 | } else |
334 | return FALSE; | | 334 | return FALSE; |
335 | } | | 335 | } |
336 | if (psdp == NULL) | | 336 | if (psdp == NULL) |
337 | return FALSE; | | 337 | return FALSE; |
338 | | | 338 | |
339 | /********************** | | 339 | /********************** |
340 | check card capabilities | | 340 | check card capabilities |
341 | **********************/ | | 341 | **********************/ |
342 | hwCursor = 0; | | 342 | hwCursor = 0; |
343 | lowDepth = 1; | | 343 | lowDepth = 1; |
344 | if (sparcPromInit() >= 0) { | | 344 | |
345 | hwCursor = sparcPromGetBool(&psdp->node, "hw-cursor"); | | 345 | prom = sparcPromInit(); |
346 | lowDepth = sparcPromGetBool(&psdp->node, "tcx-8-bit"); | | 346 | hwCursor = sparcPromGetBool(&psdp->node, "hw-cursor"); |
347 | sparcPromClose(); | | 347 | lowDepth = sparcPromGetBool(&psdp->node, "tcx-8-bit"); |
348 | } | | | |
349 | | | 348 | |
350 | pTcx->Is8bit = (lowDepth != 0); | | 349 | pTcx->Is8bit = (lowDepth != 0); |
351 | /* all S24 support a hardware cursor */ | | 350 | /* all S24 support a hardware cursor */ |
352 | if (!lowDepth) | | 351 | if (!lowDepth) { |
353 | hwCursor = 1; | | 352 | hwCursor = 1; |
| | | 353 | pTcx->vramsize = 0x100000; /* size of the 8bit fb */ |
| | | 354 | } else { |
| | | 355 | char *b; |
| | | 356 | int len = 4, v = 0; |
| | | 357 | |
| | | 358 | /* see if we have more than 1MB vram */ |
| | | 359 | pTcx->vramsize = 0x100000; |
| | | 360 | if ((b = sparcPromGetProperty(&psdp->node, "vram", &len)) != NULL) { |
| | | 361 | memcpy(&v, b, 4); |
| | | 362 | if ((v > 0) && (v < 3)) |
| | | 363 | pTcx->vramsize = 0x100000 * v; |
| | | 364 | } |
| | | 365 | xf86Msg(X_ERROR, "found %d MB video memory\n", v); |
| | | 366 | |
| | | 367 | } |
| | | 368 | if (prom) |
| | | 369 | sparcPromClose(); |
354 | | | 370 | |
355 | xf86Msg(X_ERROR, "hw-cursor: %d\n", hwCursor); | | 371 | xf86Msg(X_ERROR, "hw-cursor: %d\n", hwCursor); |
356 | | | 372 | |
357 | /********************* | | 373 | /********************* |
358 | deal with depth | | 374 | deal with depth |
359 | *********************/ | | 375 | *********************/ |
360 | | | 376 | |
361 | if (!xf86SetDepthBpp(pScrn, lowDepth ? 8 : 0, 0, 0, | | 377 | if (!xf86SetDepthBpp(pScrn, lowDepth ? 8 : 0, 0, 0, |
362 | lowDepth ? NoDepth24Support : Support32bppFb)) { | | 378 | lowDepth ? NoDepth24Support : Support32bppFb)) { |
363 | return FALSE; | | 379 | return FALSE; |
364 | } else { | | 380 | } else { |
365 | /* Check that the returned depth is one we support */ | | 381 | /* Check that the returned depth is one we support */ |
366 | switch (pScrn->depth) { | | 382 | switch (pScrn->depth) { |
367 | case 8: | | 383 | case 8: |
368 | /* OK */ | | 384 | /* OK */ |
| @@ -498,51 +514,51 @@ TCXScreenInit(SCREEN_INIT_ARGS_DECL) | | | @@ -498,51 +514,51 @@ TCXScreenInit(SCREEN_INIT_ARGS_DECL) |
498 | VisualPtr visual; | | 514 | VisualPtr visual; |
499 | int ret; | | 515 | int ret; |
500 | | | 516 | |
501 | /* | | 517 | /* |
502 | * First get the ScrnInfoRec | | 518 | * First get the ScrnInfoRec |
503 | */ | | 519 | */ |
504 | pScrn = xf86ScreenToScrn(pScreen); | | 520 | pScrn = xf86ScreenToScrn(pScreen); |
505 | | | 521 | |
506 | pTcx = GET_TCX_FROM_SCRN(pScrn); | | 522 | pTcx = GET_TCX_FROM_SCRN(pScrn); |
507 | | | 523 | |
508 | /* Map the TCX memory */ | | 524 | /* Map the TCX memory */ |
509 | if (pScrn->depth == 8) { | | 525 | if (pScrn->depth == 8) { |
510 | pTcx->fb = | | 526 | pTcx->fb = |
511 | xf86MapSbusMem (pTcx->psdp, TCX_RAM8_VOFF, 1024 * 1024); | | 527 | xf86MapSbusMem (pTcx->psdp, TCX_RAM8_VOFF, pTcx->vramsize); |
512 | pTcx->pitchshift = 0; | | 528 | pTcx->pitchshift = 0; |
513 | } else { | | 529 | } else { |
514 | pTcx->fb = | | 530 | pTcx->fb = |
515 | xf86MapSbusMem (pTcx->psdp, TCX_RAM24_VOFF, 1024 * 1024 * 4); | | 531 | xf86MapSbusMem (pTcx->psdp, TCX_RAM24_VOFF, 1024 * 1024 * 4); |
516 | pTcx->cplane = | | 532 | pTcx->cplane = |
517 | xf86MapSbusMem (pTcx->psdp, TCX_CPLANE_VOFF, 1024 * 1024 * 4); | | 533 | xf86MapSbusMem (pTcx->psdp, TCX_CPLANE_VOFF, 1024 * 1024 * 4); |
518 | pTcx->pitchshift = 2; | | 534 | pTcx->pitchshift = 2; |
519 | if (! pTcx->cplane) | | 535 | if (! pTcx->cplane) |
520 | return FALSE; | | 536 | return FALSE; |
521 | } | | 537 | } |
522 | if (pTcx->HWCursor == TRUE) { | | 538 | if (pTcx->HWCursor == TRUE) { |
523 | pTcx->thc = xf86MapSbusMem (pTcx->psdp, TCX_THC_VOFF, 8192); | | 539 | pTcx->thc = xf86MapSbusMem (pTcx->psdp, TCX_THC_VOFF, 8192); |
524 | if (! pTcx->thc) | | 540 | if (! pTcx->thc) |
525 | return FALSE; | | 541 | return FALSE; |
526 | } | | 542 | } |
527 | | | 543 | |
528 | if (pTcx->Is8bit) { | | 544 | if (pTcx->Is8bit) { |
529 | /* use STIP and BLIT on tcx */ | | 545 | /* use STIP and BLIT on tcx */ |
530 | pTcx->rblit = xf86MapSbusMem(pTcx->psdp, TCX_BLIT_VOFF, 8 * 1024 * 1024); | | 546 | pTcx->rblit = xf86MapSbusMem(pTcx->psdp, TCX_BLIT_VOFF, 8 * pTcx->vramsize); |
531 | if (pTcx->rblit == NULL) { | | 547 | if (pTcx->rblit == NULL) { |
532 | xf86Msg(X_ERROR, "Couldn't map BLIT space\n"); | | 548 | xf86Msg(X_ERROR, "Couldn't map BLIT space\n"); |
533 | return FALSE; | | 549 | return FALSE; |
534 | } | | 550 | } |
535 | pTcx->rstip = xf86MapSbusMem(pTcx->psdp, TCX_STIP_VOFF, 8 * 1024 * 1024); | | 551 | pTcx->rstip = xf86MapSbusMem(pTcx->psdp, TCX_STIP_VOFF, 8 * pTcx->vramsize); |
536 | if (pTcx->rstip == NULL) { | | 552 | if (pTcx->rstip == NULL) { |
537 | xf86Msg(X_ERROR, "Couldn't map STIP space\n"); | | 553 | xf86Msg(X_ERROR, "Couldn't map STIP space\n"); |
538 | return FALSE; | | 554 | return FALSE; |
539 | } | | 555 | } |
540 | } else { | | 556 | } else { |
541 | /* use RSTIP and RBLIT on S24 */ | | 557 | /* use RSTIP and RBLIT on S24 */ |
542 | pTcx->rblit = xf86MapSbusMem(pTcx->psdp, TCX_RBLIT_VOFF, 8 * 1024 * 1024); | | 558 | pTcx->rblit = xf86MapSbusMem(pTcx->psdp, TCX_RBLIT_VOFF, 8 * 1024 * 1024); |
543 | if (pTcx->rblit == NULL) { | | 559 | if (pTcx->rblit == NULL) { |
544 | xf86Msg(X_ERROR, "Couldn't map RBLIT space\n"); | | 560 | xf86Msg(X_ERROR, "Couldn't map RBLIT space\n"); |
545 | return FALSE; | | 561 | return FALSE; |
546 | } | | 562 | } |
547 | pTcx->rstip = xf86MapSbusMem(pTcx->psdp, TCX_RSTIP_VOFF, 8 * 1024 * 1024); | | 563 | pTcx->rstip = xf86MapSbusMem(pTcx->psdp, TCX_RSTIP_VOFF, 8 * 1024 * 1024); |
548 | if (pTcx->rstip == NULL) { | | 564 | if (pTcx->rstip == NULL) { |