aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/sn/kernel/tiocx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/sn/kernel/tiocx.c')
-rw-r--r--arch/ia64/sn/kernel/tiocx.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index 66190d7e492d..ab9b5f35c2a7 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -21,6 +21,8 @@
21#include <asm/sn/types.h> 21#include <asm/sn/types.h>
22#include <asm/sn/shubio.h> 22#include <asm/sn/shubio.h>
23#include <asm/sn/tiocx.h> 23#include <asm/sn/tiocx.h>
24#include <asm/sn/l1.h>
25#include <asm/sn/module.h>
24#include "tio.h" 26#include "tio.h"
25#include "xtalk/xwidgetdev.h" 27#include "xtalk/xwidgetdev.h"
26#include "xtalk/hubdev.h" 28#include "xtalk/hubdev.h"
@@ -308,14 +310,12 @@ void tiocx_irq_free(struct sn_irq_info *sn_irq_info)
308 } 310 }
309} 311}
310 312
311uint64_t 313uint64_t tiocx_dma_addr(uint64_t addr)
312tiocx_dma_addr(uint64_t addr)
313{ 314{
314 return PHYS_TO_TIODMA(addr); 315 return PHYS_TO_TIODMA(addr);
315} 316}
316 317
317uint64_t 318uint64_t tiocx_swin_base(int nasid)
318tiocx_swin_base(int nasid)
319{ 319{
320 return TIO_SWIN_BASE(nasid, TIOCX_CORELET); 320 return TIO_SWIN_BASE(nasid, TIOCX_CORELET);
321} 321}
@@ -330,19 +330,6 @@ EXPORT_SYMBOL(tiocx_bus_type);
330EXPORT_SYMBOL(tiocx_dma_addr); 330EXPORT_SYMBOL(tiocx_dma_addr);
331EXPORT_SYMBOL(tiocx_swin_base); 331EXPORT_SYMBOL(tiocx_swin_base);
332 332
333static uint64_t tiocx_get_hubdev_info(u64 handle, u64 address)
334{
335
336 struct ia64_sal_retval ret_stuff;
337 ret_stuff.status = 0;
338 ret_stuff.v0 = 0;
339
340 ia64_sal_oemcall_nolock(&ret_stuff,
341 SN_SAL_IOIF_GET_HUBDEV_INFO,
342 handle, address, 0, 0, 0, 0, 0);
343 return ret_stuff.v0;
344}
345
346static void tio_conveyor_set(nasid_t nasid, int enable_flag) 333static void tio_conveyor_set(nasid_t nasid, int enable_flag)
347{ 334{
348 uint64_t ice_frz; 335 uint64_t ice_frz;
@@ -379,7 +366,29 @@ static void tio_corelet_reset(nasid_t nasid, int corelet)
379 udelay(2000); 366 udelay(2000);
380} 367}
381 368
382static int fpga_attached(nasid_t nasid) 369static int tiocx_btchar_get(int nasid)
370{
371 moduleid_t module_id;
372 geoid_t geoid;
373 int cnodeid;
374
375 cnodeid = nasid_to_cnodeid(nasid);
376 geoid = cnodeid_get_geoid(cnodeid);
377 module_id = geo_module(geoid);
378 return MODULE_GET_BTCHAR(module_id);
379}
380
381static int is_fpga_brick(int nasid)
382{
383 switch (tiocx_btchar_get(nasid)) {
384 case L1_BRICKTYPE_SA:
385 case L1_BRICKTYPE_ATHENA:
386 return 1;
387 }
388 return 0;
389}
390
391static int bitstream_loaded(nasid_t nasid)
383{ 392{
384 uint64_t cx_credits; 393 uint64_t cx_credits;
385 394
@@ -396,7 +405,7 @@ static int tiocx_reload(struct cx_dev *cx_dev)
396 int mfg_num = CX_DEV_NONE; 405 int mfg_num = CX_DEV_NONE;
397 nasid_t nasid = cx_dev->cx_id.nasid; 406 nasid_t nasid = cx_dev->cx_id.nasid;
398 407
399 if (fpga_attached(nasid)) { 408 if (bitstream_loaded(nasid)) {
400 uint64_t cx_id; 409 uint64_t cx_id;
401 410
402 cx_id = 411 cx_id =
@@ -427,9 +436,10 @@ static ssize_t show_cxdev_control(struct device *dev, char *buf)
427{ 436{
428 struct cx_dev *cx_dev = to_cx_dev(dev); 437 struct cx_dev *cx_dev = to_cx_dev(dev);
429 438
430 return sprintf(buf, "0x%x 0x%x 0x%x\n", 439 return sprintf(buf, "0x%x 0x%x 0x%x %d\n",
431 cx_dev->cx_id.nasid, 440 cx_dev->cx_id.nasid,
432 cx_dev->cx_id.part_num, cx_dev->cx_id.mfg_num); 441 cx_dev->cx_id.part_num, cx_dev->cx_id.mfg_num,
442 tiocx_btchar_get(cx_dev->cx_id.nasid));
433} 443}
434 444
435static ssize_t store_cxdev_control(struct device *dev, const char *buf, 445static ssize_t store_cxdev_control(struct device *dev, const char *buf,
@@ -475,20 +485,14 @@ static int __init tiocx_init(void)
475 if ((nasid = cnodeid_to_nasid(cnodeid)) < 0) 485 if ((nasid = cnodeid_to_nasid(cnodeid)) < 0)
476 break; /* No more nasids .. bail out of loop */ 486 break; /* No more nasids .. bail out of loop */
477 487
478 if (nasid & 0x1) { /* TIO's are always odd */ 488 if ((nasid & 0x1) && is_fpga_brick(nasid)) {
479 struct hubdev_info *hubdev; 489 struct hubdev_info *hubdev;
480 uint64_t status;
481 struct xwidget_info *widgetp; 490 struct xwidget_info *widgetp;
482 491
483 DBG("Found TIO at nasid 0x%x\n", nasid); 492 DBG("Found TIO at nasid 0x%x\n", nasid);
484 493
485 hubdev = 494 hubdev =
486 (struct hubdev_info *)(NODEPDA(cnodeid)->pdinfo); 495 (struct hubdev_info *)(NODEPDA(cnodeid)->pdinfo);
487 status =
488 tiocx_get_hubdev_info(nasid,
489 (uint64_t) __pa(hubdev));
490 if (status)
491 continue;
492 496
493 widgetp = &hubdev->hdi_xwidget_info[TIOCX_CORELET]; 497 widgetp = &hubdev->hdi_xwidget_info[TIOCX_CORELET];
494 498