Пример #1
0
/** /brief customize fsp parameters here if needed
 */
void romstage_fsp_rt_buffer_callback(FSP_INIT_RT_BUFFER *FspRtBuffer)
{
	struct hwinfo *hwi_main;
	UPD_DATA_REGION *UpdData = FspRtBuffer->Common.UpdDataRgnPtr;

	/* Initialize the Azalia Verb Tables to mainboard specific version */
	UpdData->AzaliaConfigPtr  = (UINT32)&mainboard_AzaliaConfig;

	/* Disable 2nd DIMM on Bakersport*/
#if IS_ENABLED(BOARD_INTEL_BAKERSPORT_FSP)
	UpdData->PcdMrcInitSPDAddr2 = 0x00; /* cannot use SPD_ADDR_DISABLED at this point */
#endif
	/* Get SPD data from hardware information block and setup memory down */
	/* parameters for FSP accordingly */
	hwi_main = get_hwinfo((char*)"hwinfo.hex");
	if (hwi_main) {
		UpdData->PcdMemoryParameters.EnableMemoryDown = 1;
		UpdData->PcdMemoryParameters.DRAMType = hwi_main->SPD[2];
		UpdData->PcdMemoryParameters.DIMM0Enable = hwi_main->SPD[3] & 0x01;
		UpdData->PcdMemoryParameters.DIMM1Enable = (hwi_main->SPD[3] >> 1) & 0x01;
		UpdData->PcdMemoryParameters.DIMMDensity = hwi_main->SPD[4];
		UpdData->PcdMemoryParameters.DIMMDWidth = hwi_main->SPD[5];
		UpdData->PcdMemoryParameters.DIMMSides = hwi_main->SPD[7];
		UpdData->PcdMemoryParameters.DIMMBusWidth = hwi_main->SPD[8];
		UpdData->PcdMemoryParameters.DRAMSpeed = hwi_main->SPD[12];
		UpdData->PcdMemoryParameters.DIMMtCL = hwi_main->SPD[14];
		UpdData->PcdMemoryParameters.DIMMtWR = hwi_main->SPD[17];
		UpdData->PcdMemoryParameters.DIMMtRPtRCD = hwi_main->SPD[18];
		UpdData->PcdMemoryParameters.DIMMtRRD = hwi_main->SPD[19];
		UpdData->PcdMemoryParameters.DIMMtWTR = hwi_main->SPD[26];
		UpdData->PcdMemoryParameters.DIMMtRTP = hwi_main->SPD[27];
		UpdData->PcdMemoryParameters.DIMMtFAW = hwi_main->SPD[28];
		/*If one need output from MRC to be used in Intel RMT, simply */
		/*enable the following line */
		//UpdData->PcdMrcDebugMsg = 1;
	} else
Пример #2
0
int main (int argc,char *argv[]) {
    int force = 0;
    pid_t consistency_pid;
    pid_t listener_pid;

    slave_get_options(&argc,&argv,&force,&sdb);

    logtool = DRQ_LOG_TOOL_SLAVE;

    // Set some standard defaults based on DRQUEUE_ROOT (must be already set!)
    set_default_env();

    // Config files overrides environment
    // Read the config file after reading the arguments, as those may change
    // the path to the config file
    if (sdb.conf[0]) {
        config_parse(sdb.conf);
    } else {
        config_parse_tool("slave");
    }

    if (!common_environment_check()) {
        log_auto (L_ERROR,"Error checking the environment: %s",drerrno_str());
        exit (1);
    }


    set_signal_handlers ();

    //system ("env | grep DRQUEUE");
    sdb.shmid = get_shared_memory_slave (force);
    sdb.comp = attach_shared_memory_slave (sdb.shmid);
    sdb.semid = get_semaphores_slave ();
    log_auto (L_INFO,"Starting...");

    computer_init (sdb.comp);
    sdb.comp->used = 1;
    get_hwinfo (&sdb.comp->hwinfo);
    computer_limits_cpu_init (sdb.comp); // computer_init_limits depends on the hardware information
    slave_set_limits (&sdb);	       // Override defaults
    logger_computer = sdb.comp;

    report_hwinfo (&sdb.comp->hwinfo);
    fprintf (stderr,"Working silently...");

    register_slave (sdb.comp);
    // Before sending the limits we have to set the pools
    computer_pool_set_from_environment (&sdb.comp->limits);
    computer_pool_list (&sdb.comp->limits);
    update_computer_limits(&sdb.comp->limits); /* Does not need to be locked because at this point */
    /* because there is only one process running. The rest of the time */
    /* either we call it locked or we make a copy of the limits while locked */
    /* and then we send that copy */

    if (pipe(phantom) != 0) {
        fprintf (stderr,"Phantom pipe could not be created\n");
        exit (1);
    }

    if ((listener_pid = fork()) == 0) {
        /* Create the listening process */
        log_auto (L_INFO,"Listener process starting...");
        set_signal_handlers_child_listening ();
        slave_listening_process (&sdb);
        log_auto (L_INFO,"Listener process exiting...");
        exit (0);
    } else if (listener_pid == -1) {
        drerrno_system = errno;
        log_auto (L_ERROR,"Could not create the listener process. (%s)", strerror(drerrno_system));
        slave_exit(SIGINT);
    }

    if ((consistency_pid = fork()) == 0) {
        // Create the consistency checks process
        // Signal are treated the same way as the listening process
        log_auto (L_INFO,"Consistency process starting...");
        set_signal_handlers_child_listening ();
        slave_consistency_process (&sdb);
        log_auto (L_INFO,"Consistency process exiting...");
        exit (0);
    } else if (consistency_pid == -1) {
        drerrno_system = errno;
        log_auto (L_ERROR,"Could not create the listener process. (%s)", strerror(drerrno_system));
        slave_exit(SIGINT);
    }

    while (1) {
        get_computer_status (&sdb.comp->status,sdb.semid);

        computer_autoenable_check (&sdb); /* Check if it's time for autoenable */

        while (computer_available(sdb.comp)) {
            uint16_t itask;
            if (request_job_available(&sdb,&itask)) {
                launch_task(&sdb,itask);
                update_computer_status (&sdb);
            } else {
                // computer not available
                break;   // break the while loop
            }
        } /* WARNING could be in this loop forever if no care is taken !! */

        update_computer_status (&sdb); /* sends the computer status to the master */
        /* Does not need to be locked because we lock inside it */

        FD_ZERO(&read_set);
        FD_SET(phantom[0],&read_set);
        timeout.tv_sec = SLAVEDELAY;
        timeout.tv_usec = 0;
        rs = select (phantom[0]+1,&read_set,NULL,NULL,&timeout);
        switch (rs) {
        case -1:
            /* Error in select */
            log_auto(L_ERROR,"Select call failed");
        case 0:
            log_auto(L_DEBUG,"Slave loop (select call timeout)");
            break;
        default:
            if (FD_ISSET(phantom[0],&read_set)) {
                log_auto(L_DEBUG,"Select call, notification came. Available for reading.");
                read(phantom[0],buffer,BUFFERLEN);
            } else {
                log_auto(L_WARNING,"Select call, report this message, please. It should never happen.");
            }
        }
    }

    exit (0);
}
Пример #3
0
static int pcnet_confcheck(struct pcmcia_device *p_dev, void *priv_data)
{
	int *priv = priv_data;
	int try = (*priv & 0x1);

	*priv &= (p_dev->resource[2]->end >= 0x4000) ? 0x10 : ~0x10;

	if (p_dev->config_index == 0)
		return -EINVAL;

	if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32)
		return -EINVAL;

	if (try)
		p_dev->io_lines = 16;
	return try_io_port(p_dev);
}

static hw_info_t *pcnet_try_config(struct pcmcia_device *link,
				   int *has_shmem, int try)
{
	struct net_device *dev = link->priv;
	hw_info_t *local_hw_info;
	pcnet_dev_t *info = PRIV(dev);
	int priv = try;
	int ret;

	ret = pcmcia_loop_config(link, pcnet_confcheck, &priv);
	if (ret) {
		dev_warn(&link->dev, "no useable port range found\n");
		return NULL;
	}
	*has_shmem = (priv & 0x10);

	if (!link->irq)
		return NULL;

	if (resource_size(link->resource[1]) == 8)
		link->config_flags |= CONF_ENABLE_SPKR;

	if ((link->manf_id == MANFID_IBM) &&
	    (link->card_id == PRODID_IBM_HOME_AND_AWAY))
		link->config_index |= 0x10;

	ret = pcmcia_enable_device(link);
	if (ret)
		return NULL;

	dev->irq = link->irq;
	dev->base_addr = link->resource[0]->start;

	if (info->flags & HAS_MISC_REG) {
		if ((if_port == 1) || (if_port == 2))
			dev->if_port = if_port;
		else
			dev_notice(&link->dev, "invalid if_port requested\n");
	} else
		dev->if_port = 0;

	if ((link->config_base == 0x03c0) &&
	    (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) {
		dev_info(&link->dev,
			"this is an AX88190 card - use axnet_cs instead.\n");
		return NULL;
	}

	local_hw_info = get_hwinfo(link);
	if (!local_hw_info)
		local_hw_info = get_prom(link);
	if (!local_hw_info)
		local_hw_info = get_dl10019(link);
	if (!local_hw_info)
		local_hw_info = get_ax88190(link);
	if (!local_hw_info)
		local_hw_info = get_hwired(link);

	return local_hw_info;
}

static int pcnet_config(struct pcmcia_device *link)
{
    struct net_device *dev = link->priv;
    pcnet_dev_t *info = PRIV(dev);
    int start_pg, stop_pg, cm_offset;
    int has_shmem = 0;
    hw_info_t *local_hw_info;

    dev_dbg(&link->dev, "pcnet_config\n");

    local_hw_info = pcnet_try_config(link, &has_shmem, 0);
    if (!local_hw_info) {
	    /* check whether forcing io_lines to 16 helps... */
	    pcmcia_disable_device(link);
	    local_hw_info = pcnet_try_config(link, &has_shmem, 1);
	    if (local_hw_info == NULL) {
		    dev_notice(&link->dev, "unable to read hardware net"
			    " address for io base %#3lx\n", dev->base_addr);
		    goto failed;
	    }
    }

    info->flags = local_hw_info->flags;
    /* Check for user overrides */
    info->flags |= (delay_output) ? DELAY_OUTPUT : 0;
    if ((link->manf_id == MANFID_SOCKET) &&
	((link->card_id == PRODID_SOCKET_LPE) ||
	 (link->card_id == PRODID_SOCKET_LPE_CF) ||
	 (link->card_id == PRODID_SOCKET_EIO)))
	info->flags &= ~USE_BIG_BUF;
    if (!use_big_buf)
	info->flags &= ~USE_BIG_BUF;

    if (info->flags & USE_BIG_BUF) {
	start_pg = SOCKET_START_PG;
	stop_pg = SOCKET_STOP_PG;
	cm_offset = 0x10000;
    } else {
	start_pg = PCNET_START_PG;
	stop_pg = PCNET_STOP_PG;
	cm_offset = 0;
    }

    /* has_shmem is ignored if use_shmem != -1 */
    if ((use_shmem == 0) || (!has_shmem && (use_shmem == -1)) ||
	(setup_shmem_window(link, start_pg, stop_pg, cm_offset) != 0))
	setup_dma_config(link, start_pg, stop_pg);

    ei_status.name = "NE2000";
    ei_status.word16 = 1;
    ei_status.reset_8390 = pcnet_reset_8390;

    if (info->flags & (IS_DL10019|IS_DL10022))
	mii_phy_probe(dev);

    SET_NETDEV_DEV(dev, &link->dev);

    if (register_netdev(dev) != 0) {
	pr_notice("register_netdev() failed\n");
	goto failed;
    }

    if (info->flags & (IS_DL10019|IS_DL10022)) {
	u_char id = inb(dev->base_addr + 0x1a);
	netdev_info(dev, "NE2000 (DL100%d rev %02x): ",
	       (info->flags & IS_DL10022) ? 22 : 19, id);
	if (info->pna_phy)
	    pr_cont("PNA, ");
    } else {
	netdev_info(dev, "NE2000 Compatible: ");
    }
    pr_cont("io %#3lx, irq %d,", dev->base_addr, dev->irq);
    if (info->flags & USE_SHMEM)
	pr_cont(" mem %#5lx,", dev->mem_start);
    if (info->flags & HAS_MISC_REG)
	pr_cont(" %s xcvr,", if_names[dev->if_port]);
    pr_cont(" hw_addr %pM\n", dev->dev_addr);
    return 0;

failed:
    pcnet_release(link);
    return -ENODEV;
} /* pcnet_config */

static void pcnet_release(struct pcmcia_device *link)
{
	pcnet_dev_t *info = PRIV(link->priv);

	dev_dbg(&link->dev, "pcnet_release\n");

	if (info->flags & USE_SHMEM)
		iounmap(info->base);

	pcmcia_disable_device(link);
}