示例#1
0
/*-------------------------------------------------------------------*/
int build_config (char *hercules_cnf)
{
int     i;                              /* Array subscript           */
int     devtmax;                        /* Max number device threads */

    sysblk.xpndsize = 0;

    sysblk.maxcpu = MAX_CPU_ENGINES;
#ifdef    _FEATURE_VECTOR_FACILITY
    sysblk.numvec = sysblk.maxcpu;
#else  //!_FEATURE_VECTOR_FACILITY
    sysblk.numvec = 0;
#endif // _FEATURE_VECTOR_FACILITY

#if defined(_900)
    set_archlvl(_ARCH_900_NAME);
#elif defined(_390)
    set_archlvl(_ARCH_390_NAME);
#else
    set_archlvl(_ARCH_370_NAME);
#endif
    devtmax  = MAX_DEVICE_THREADS;



#ifdef OPTION_PTTRACE
    ptt_trace_init (0, 1);
#endif


#if defined(OPTION_FISHIO)
    InitIOScheduler                     // initialize i/o scheduler...
    (
        sysblk.arch_mode,               // (for calling execute_ccw_chain)
        &sysblk.devprio,                // (ptr to device thread priority)
        MAX_DEVICE_THREAD_IDLE_SECS,    // (maximum device thread wait time)
        devtmax                         // (maximum #of device threads allowed)
    );
#else // !defined(OPTION_FISHIO)
    /* Set max number device threads */
    sysblk.devtmax = devtmax;
    sysblk.devtwait = sysblk.devtnbr =
    sysblk.devthwm  = sysblk.devtunavail = 0;
#endif // defined(OPTION_FISHIO)

#if defined(OPTION_LPP_RESTRICT)
    /* Default the licence setting */
    losc_set(PGM_PRD_OS_RESTRICTED);
#endif

    /* Reset the clock steering registers */
    csr_reset();

    /* Default CPU type CP */
    for (i = 0; i < sysblk.maxcpu; i++)
        sysblk.ptyp[i] = SCCB_PTYP_CP;

    /* Default Storage & NUMCPU */
    configure_storage(2);
    configure_numcpu(1);

    if (hercules_cnf && (process_config(hercules_cnf)))
        return -1;

    return 0;
} /* end function build_config */
示例#2
0
DLL_EXPORT int ptt_cmd(int argc, char *argv[], char* cmdline)
{
    int  rc = 0;
    int  n, to = -1;
    char c;

    UNREFERENCED(cmdline);

    if (argc > 1)
    {
        /* process arguments; last arg can be trace table size */
        for (--argc, argv++; argc; --argc, ++argv)
        {
            if (strcasecmp("opts", argv[0]) == 0)
                continue;
            else if (strcasecmp("error", argv[0]) == 0)
            {
                pttclass |= PTT_CL_ERR;
                continue;
            }
            else if (strcasecmp("noerror", argv[0]) == 0)
            {
                pttclass &= ~PTT_CL_ERR;
                continue;
            }
            else if (strcasecmp("control", argv[0]) == 0)
            {
                pttclass |= PTT_CL_INF;
                continue;
            }
            else if (strcasecmp("nocontrol", argv[0]) == 0)
            {
                pttclass &= ~PTT_CL_INF;
                continue;
            }
            else if (strcasecmp("prog", argv[0]) == 0)
            {
                pttclass |= PTT_CL_PGM;
                continue;
            }
            else if (strcasecmp("noprog", argv[0]) == 0)
            {
                pttclass &= ~PTT_CL_PGM;
                continue;
            }
            else if (strcasecmp("inter", argv[0]) == 0)
            {
                pttclass |= PTT_CL_CSF;
                continue;
            }
            else if (strcasecmp("nointer", argv[0]) == 0)
            {
                pttclass &= ~PTT_CL_CSF;
                continue;
            }
            else if (strcasecmp("sie", argv[0]) == 0)
            {
                pttclass |= PTT_CL_SIE;
                continue;
            }
            else if (strcasecmp("nosie", argv[0]) == 0)
            {
                pttclass &= ~PTT_CL_SIE;
                continue;
            }
            else if (strcasecmp("signal", argv[0]) == 0)
            {
                pttclass |= PTT_CL_SIG;
                continue;
            }
            else if (strcasecmp("nosignal", argv[0]) == 0)
            {
                pttclass &= ~PTT_CL_SIG;
                continue;
            }
            else if (strcasecmp("io", argv[0]) == 0)
            {
                pttclass |= PTT_CL_IO;
                continue;
            }
            else if (strcasecmp("noio", argv[0]) == 0)
            {
                pttclass &= ~PTT_CL_IO;
                continue;
            }
            else if (strcasecmp("timer", argv[0]) == 0)
            {
                pttclass |= PTT_CL_TMR;
                continue;
            }
            else if (strcasecmp("notimer", argv[0]) == 0)
            {
                pttclass &= ~PTT_CL_TMR;
                continue;
            }
            else if (strcasecmp("logger", argv[0]) == 0)
            {
                pttclass |= PTT_CL_LOG;
                continue;
            }
            else if (strcasecmp("nologger", argv[0]) == 0)
            {
                pttclass &= ~PTT_CL_LOG;
                continue;
            }
            else if (strcasecmp("nothreads", argv[0]) == 0)
            {
                pttclass &= ~PTT_CL_THR;
                continue;
            }
            else if (strcasecmp("threads", argv[0]) == 0)
            {
                pttclass |= PTT_CL_THR;
                continue;
            }
            else if (strcasecmp("nolock", argv[0]) == 0)
            {
                pttnolock = 1;
                continue;
            }
            else if (strcasecmp("lock", argv[0]) == 0)
            {
                pttnolock = 0;
                continue;
            }
            else if (strcasecmp("notod", argv[0]) == 0)
            {
                pttnotod = 1;
                continue;
            }
            else if (strcasecmp("tod", argv[0]) == 0)
            {
                pttnotod = 0;
                continue;
            }
            else if (strcasecmp("nowrap", argv[0]) == 0)
            {
                pttnowrap = 1;
                continue;
            }
            else if (strcasecmp("wrap", argv[0]) == 0)
            {
                pttnowrap = 0;
                continue;
            }
            else if (strncasecmp("to=", argv[0], 3) == 0 && strlen(argv[0]) > 3
                  && (sscanf(&argv[0][3], "%d%c", &to, &c) == 1 && to >= 0))
            {
                pttto = to;
                continue;
            }
            else if (argc == 1 && sscanf(argv[0], "%d%c", &n, &c) == 1 && n >= 0)
            {
                OBTAIN_PTTLOCK;
                if (pttracen == 0)
                {
                    if (pttrace != NULL)
                    {
                        RELEASE_PTTLOCK;
                        WRMSG(HHC90010, "E");
                        return -1;
                    }
                }
                else if (pttrace)
                {
                    pttracen = 0;
                    RELEASE_PTTLOCK;
                    usleep(1000);
                    OBTAIN_PTTLOCK;
                    free (pttrace);
                    pttrace = NULL;
                }
                ptt_trace_init (n, 0);
                RELEASE_PTTLOCK;
            }
            else
            {
                WRMSG(HHC90011, "E", argv[0]);
                rc = -1;
                break;
            }
        } /* for each ptt argument */

        /* wakeup timeout thread if to= specified */
        if (to >= 0 && ptttotid)
        {
            obtain_lock (&ptttolock);
            ptttotid = 0;
            signal_condition (&ptttocond);
            release_lock (&ptttolock);
        }

        /* start timeout thread if positive to= specified */
        if (to > 0)
        {
            obtain_lock (&ptttolock);
            ptttotid = 0;
            rc = create_thread (&ptttotid, NULL, ptt_timeout, NULL, "ptt_timeout");
        if (rc)
            WRMSG(HHC00102, "E", strerror(rc));
            release_lock (&ptttolock);
        }
    }
    else
    {
        if (pttracen)
            rc = ptt_pthread_print();

        WRMSG(HHC90012, "I",
               (pttclass & PTT_CL_INF) ? "control " : "",
               (pttclass & PTT_CL_ERR) ? "error " : "",
               (pttclass & PTT_CL_PGM) ? "prog " : "",
               (pttclass & PTT_CL_CSF) ? "inter " : "",
               (pttclass & PTT_CL_SIE) ? "sie " : "",
               (pttclass & PTT_CL_SIG) ? "signal " : "",
               (pttclass & PTT_CL_IO) ? "io " : "",
               (pttclass & PTT_CL_TMR) ? "timer " : "",
               (pttclass & PTT_CL_THR) ? "threads " : "",
               (pttclass & PTT_CL_LOG) ? "logger " : "",
               pttnolock ? "nolock" : "lock",
               pttnotod ? "notod" : "tod",
               pttnowrap ? "nowrap" : "wrap",
               pttto,
               pttracen);
    }

    return rc;
}
示例#3
0
/*-------------------------------------------------------------------*/
int build_config (const char *hercules_cnf)
{
int     i;                              /* Array subscript           */
int     devtmax;                        /* Max number device threads */

    /*      From impl.c, using system defaults of:
     *
     * LPARNUM  1                       # LPAR 1 with LPAR ID 01
     * CPUIDFMT 0                       # CPU ID format 0
     * XPNDSIZE 0                       # Expanded storage size
     */

    sysblk.xpndsize = 0;

    /* Set sysblk.maxcpu to our preferred default value, if possible */
#if (PREF_DEF_MAXCPU <= MAX_CPU_ENGINES)
    sysblk.maxcpu = PREF_DEF_MAXCPU;
#else
    WARNING( "sysblk.maxcpu reduced from " QSTR( PREF_DEF_MAXCPU ) " to " QSTR( MAX_CPU_ENGINES ))
    sysblk.maxcpu = MAX_CPU_ENGINES;
#endif

#ifdef    _FEATURE_VECTOR_FACILITY
    sysblk.numvec = sysblk.maxcpu;
#else  //!_FEATURE_VECTOR_FACILITY
    sysblk.numvec = 0;
#endif // _FEATURE_VECTOR_FACILITY

#if defined(_900)
    set_archlvl(_ARCH_900_NAME);
#elif defined(_390)
    set_archlvl(_ARCH_390_NAME);
#else
    set_archlvl(_ARCH_370_NAME);
#endif
    devtmax  = MAX_DEVICE_THREADS;

    ptt_trace_init (0, 1);

    /* Set max number device threads */
    sysblk.devtmax = devtmax;
    sysblk.devtwait = sysblk.devtnbr =
    sysblk.devthwm  = sysblk.devtunavail = 0;

#if defined(OPTION_LPP_RESTRICT)
    /* Default the licence setting */
    losc_set(PGM_PRD_OS_RESTRICTED);
#endif

    /* Reset the clock steering registers */
    csr_reset();

    /* Default CPU type CP */
    for (i = 0; i < sysblk.maxcpu; i++)
        sysblk.ptyp[i] = SCCB_PTYP_CP;

    /* Default main storage to 2M with one CPU */
    configure_storage(2 << (SHIFT_MEBIBYTE - 12));
    configure_numcpu(1);

    if (hercules_cnf && (process_config(hercules_cnf)))
        return -1;

    /* Connect each channel set to its home cpu */
    for (i = 0; i < sysblk.maxcpu; i++)
        if (IS_CPU_ONLINE(i))
            sysblk.regs[i]->chanset = i < FEATURE_LCSS_MAX ? i : 0xFFFF;

    return 0;
} /* end function build_config */