Example #1
0
void Group::GenerateEquations(IdList<Equation,hEquation> *l) {
    Equation eq;
    ZERO(&eq);
    if(type == IMPORTED) {
        // Normalize the quaternion
        ExprQuaternion q = {
            Expr::From(h.param(3)),
            Expr::From(h.param(4)),
            Expr::From(h.param(5)),
            Expr::From(h.param(6)) };
        AddEq(l, (q.Magnitude())->Minus(Expr::From(1)), 0);
    } else if(type == ROTATE) {
        // The axis and center of rotation are specified numerically
#define EC(x) (Expr::From(x))
#define EP(x) (Expr::From(h.param(x)))
        ExprVector orig = SK.GetEntity(predef.origin)->PointGetExprs();
        AddEq(l, (orig.x)->Minus(EP(0)), 0);
        AddEq(l, (orig.y)->Minus(EP(1)), 1);
        AddEq(l, (orig.z)->Minus(EP(2)), 2);
        // param 3 is the angle, which is free
        Vector axis = SK.GetEntity(predef.entityB)->VectorGetNum();
        axis = axis.WithMagnitude(1);
        AddEq(l, (EC(axis.x))->Minus(EP(4)), 3);
        AddEq(l, (EC(axis.y))->Minus(EP(5)), 4);
        AddEq(l, (EC(axis.z))->Minus(EP(6)), 5);
#undef EC
#undef EP
    } else if(type == EXTRUDE) {
        if(predef.entityB.v != Entity::FREE_IN_3D.v) {
            // The extrusion path is locked along a line, normal to the
            // specified workplane.
            Entity *w = SK.GetEntity(predef.entityB);
            ExprVector u = w->Normal()->NormalExprsU();
            ExprVector v = w->Normal()->NormalExprsV();
            ExprVector extruden = {
                Expr::From(h.param(0)),
                Expr::From(h.param(1)),
                Expr::From(h.param(2)) };

            AddEq(l, u.Dot(extruden), 0);
            AddEq(l, v.Dot(extruden), 1);
        }
    } else if(type == TRANSLATE) {
        if(predef.entityB.v != Entity::FREE_IN_3D.v) {
            Entity *w = SK.GetEntity(predef.entityB);
            ExprVector n = w->Normal()->NormalExprsN();
            ExprVector trans;
            trans = ExprVector::From(h.param(0), h.param(1), h.param(2));

            // The translation vector is parallel to the workplane
            AddEq(l, trans.Dot(n), 0);
        }
    }
}
Example #2
0
char *heap_claim(char *base, size_t required_size)
{
  _kernel_oserror *e;
  int              largest;
  unsigned int     actual_change;
  void            *block;
  heapcb          *cb;

  if (required_size == 0)
    return NULL;

  cb = getcb(base);
  if (cb == NULL)
    return NULL; /* unknown heap */

  /* Repeatedly attempt to claim a block of the required size */
  while ((e = _swix(OS_Heap, _INR(0,1)|_IN(3)|_OUT(2), 2, base,
                    required_size, &block)) != NULL)
  {
    int errnum;

    /* MemCheck_RegisterMiscBlock(e, sizeof(e->errnum)); */
    errnum = e->errnum;
    /* MemCheck_UnRegisterMiscBlock(e); */
    if (errnum != 0x184 /* Heap Full */)
    {
#ifndef NDEBUG
      EC(e);
#endif
      return NULL; /* unknown error */
    }

    /* Read largest free space */
    _swi(OS_Heap, _INR(0,1)|_OUT(2), 1, base, &largest);

    /* Increase the dynamic area by at least the difference between what we
     * want and what we have spare */
    if (EC(_swix(OS_ChangeDynamicArea, _INR(0,1)|_OUT(1), cb->area,
                 required_size - largest, &actual_change)) != NULL)
      return NULL; /* (most likely) out of memory */

    /* Resize the heap itself */
    _swi(OS_Heap, _INR(0,1)|_IN(3), 5, base, actual_change);
  }

  /* MemCheck_RegisterMiscBlock(block, required_size); */

  return block;
}
Example #3
0
static void decode_mc3_mce(struct mce *m)
{
	u16 ec = EC(m->status);
	u8 xec = XEC(m->status, xec_mask);

	if (boot_cpu_data.x86 >= 0x14) {
		pr_emerg("You shouldn't be seeing MC3 MCE on this cpu family,"
			 " please report on LKML.\n");
		return;
	}

	pr_emerg(HW_ERR "MC3 Error");

	if (xec == 0x0) {
		u8 r4 = R4(ec);

		if (!BUS_ERROR(ec) || (r4 != R4_DRD && r4 != R4_DWR))
			goto wrong_mc3_mce;

		pr_cont(" during %s.\n", R4_MSG(ec));
	} else
		goto wrong_mc3_mce;

	return;

 wrong_mc3_mce:
	pr_emerg(HW_ERR "Corrupted MC3 MCE info?\n");
}
Example #4
0
char *heap_create(const char *description, size_t size_limit)
{
  heapcb *cb;
  int     page_size;

  /* Get a new heapcb and link it into the start of the chain */
  cb = malloc(sizeof(heapcb));
  if (cb == NULL)
    return NULL; /* failed - unable to allocate space for control block */

  cb->next = first_cb;
  first_cb = cb;

  /* Create a dynamic area at least one page in size and set it up as a heap
   */
  _swi(OS_ReadMemMapInfo, _OUT(0), &page_size);

  if (EC(_swix(OS_DynamicArea, _INR(0,8)|_OUT(1)|_OUT(3), 0, -1, page_size,
               -1, 0x80, size_limit, NULL, -1, description, &cb->area,
               &cb->base)))
  {
    free(cb);
    return NULL;
  }

  /* page_size must be enough to hold the default heap structure */

  _swi(OS_Heap, _INR(0,1)|_IN(3), 0, cb->base, page_size);

  return cb->base;
}
Example #5
0
void heap_delete(char *base)
{
  heapcb *cb;
  heapcb *thiscb;

  cb = getcb(base);
  if (cb == NULL)
    return; /* unknown heap */

  /* Delete the dynamic area */
  EC(_swix(OS_DynamicArea, _INR(0,1), 1, cb->area));

  /* remove its heapcb from the chain */
  if (cb == first_cb)
  {
    /* start of chain */
    first_cb = first_cb->next;
  }
  else
  {
    /* elsewhere in chain */
    for (thiscb = first_cb; thiscb->next != cb; thiscb = thiscb->next)
      ;
    thiscb->next = cb->next;
  }

  free(cb);
}
Example #6
0
BitField StateConstraints::minimalTrap(const PetriNet& net,
									   const MarkVal* marking,
									   const MarkVal* resultMarking) const{
	const size_t nPlaces = net.numberOfPlaces();
	BitField trap(nPlaces);
	trap.set();
	trap = maxTrap(net, trap, resultMarking);
	if(!isMarked(trap, marking))
		return BitField(nPlaces).clear();

	//Get the exclusion candidates
	BitField EC(trap);
	BitField tmp(nPlaces);
	while(EC.any()){
		int exclude = EC.first();
		tmp = trap;
		tmp.clear(exclude);
		EC.clear(exclude);
		tmp = maxTrap(net, tmp, resultMarking);
		if(isMarked(tmp, marking)){
			trap = tmp;
			EC = tmp;
		}
	}
	return trap;
}
Example #7
0
static void decode_mc1_mce(struct mce *m)
{
	u16 ec = EC(m->status);
	u8 xec = XEC(m->status, xec_mask);

	pr_emerg(HW_ERR "MC1 Error: ");

	if (TLB_ERROR(ec))
		pr_cont("%s TLB %s.\n", LL_MSG(ec),
			(xec ? "multimatch" : "parity error"));
	else if (BUS_ERROR(ec)) {
		bool k8 = (boot_cpu_data.x86 == 0xf && (m->status & BIT_64(58)));

		pr_cont("during %s.\n", (k8 ? "system linefill" : "NB data read"));
	} else if (INT_ERROR(ec)) {
		if (xec <= 0x3f)
			pr_cont("Hardware Assert.\n");
		else
			goto wrong_mc1_mce;
	} else if (fam_ops->mc1_mce(ec, xec))
		;
	else
		goto wrong_mc1_mce;

	return;

wrong_mc1_mce:
	pr_emerg(HW_ERR "Corrupted MC1 MCE info?\n");
}
Example #8
0
static void decode_mc4_mce(struct mce *m)
{
	struct cpuinfo_x86 *c = &boot_cpu_data;
	int node_id = amd_get_nb_id(m->extcpu);
	u16 ec = EC(m->status);
	u8 xec = XEC(m->status, 0x1f);
	u8 offset = 0;

	pr_emerg(HW_ERR "MC4 Error (node %d): ", node_id);

	switch (xec) {
	case 0x0 ... 0xe:

		/* special handling for DRAM ECCs */
		if (xec == 0x0 || xec == 0x8) {
			/* no ECCs on F11h */
			if (c->x86 == 0x11)
				goto wrong_mc4_mce;

			pr_cont("%s.\n", mc4_mce_desc[xec]);

			if (nb_bus_decoder)
				nb_bus_decoder(node_id, m);
			return;
		}
		break;

	case 0xf:
		if (TLB_ERROR(ec))
			pr_cont("GART Table Walk data error.\n");
		else if (BUS_ERROR(ec))
			pr_cont("DMA Exclusion Vector Table Walk error.\n");
		else
			goto wrong_mc4_mce;
		return;

	case 0x19:
		if (boot_cpu_data.x86 == 0x15)
			pr_cont("Compute Unit Data Error.\n");
		else
			goto wrong_mc4_mce;
		return;

	case 0x1c ... 0x1f:
		offset = 13;
		break;

	default:
		goto wrong_mc4_mce;
	}

	pr_cont("%s.\n", mc4_mce_desc[xec - offset]);
	return;

 wrong_mc4_mce:
	pr_emerg(HW_ERR "Corrupted MC4 MCE info?\n");
}
Example #9
0
static void decode_mc2_mce(struct mce *m)
{
	u16 ec = EC(m->status);
	u8 xec = XEC(m->status, xec_mask);

	pr_emerg(HW_ERR "MC2 Error: ");

	if (!fam_ops->mc2_mce(ec, xec))
		pr_cont(HW_ERR "Corrupted MC2 MCE info?\n");
}
Example #10
0
static uint8_t *appendmsg(uint8_t *msg, const uint8_t *table, const uint8_t entry) {
  uint8_t i,tmp;

  i = 0;
  do {
    tmp = pgm_read_byte(table+i++);
    if (tmp == EC(entry) || tmp == EC(127))
      break;
  } while (1);

  if (tmp == EC(127)) {
    /* Unknown error */
    *msg++ = '?';
  } else {
    /* Skip over remaining error numbers */
    while (pgm_read_byte(table+i) >= EC(0)) i++;

    /* Copy error string to buffer */
    do {
      tmp = pgm_read_byte(table+i++);

      if (tmp < 32) {
        /* Abbreviation found, handle by recursion */
        msg = appendmsg(msg,abbrevs,tmp);
        continue;
      }

      if (tmp < EC(0))
        /* Don't copy error numbers */
        *msg++ = tmp;
    } while (tmp < EC(0));
  }

  return msg;
}
Example #11
0
const char *mime_fromfiletype(int filetype)
{
  static char buffer[256];

  if (EC(_swix(0x50b00 /* MimeMap_Translate */,
              _INR(0,3),
               0,
               filetype,
               2,
               buffer)) != NULL)
    return "application/octet-stream";

  return buffer;
}
Example #12
0
void amd_decode_nb_mce(struct mce *m)
{
	struct cpuinfo_x86 *c = &boot_cpu_data;
	int node_id = amd_get_nb_id(m->extcpu);
	u16 ec = EC(m->status);
	u8 xec = XEC(m->status, 0x1f);

	pr_emerg(HW_ERR "Northbridge Error (node %d): ", node_id);

	switch (xec) {
	case 0x2:
		pr_cont("Sync error (sync packets on HT link detected).\n");
		return;

	case 0x3:
		pr_cont("HT Master abort.\n");
		return;

	case 0x4:
		pr_cont("HT Target abort.\n");
		return;

	case 0x7:
		pr_cont("NB Watchdog timeout.\n");
		return;

	case 0x9:
		pr_cont("SVM DMA Exclusion Vector error.\n");
		return;

	default:
		break;
	}

	if (!fam_ops->nb_mce(ec, xec))
		goto wrong_nb_mce;

	if (c->x86 == 0xf || c->x86 == 0x10 || c->x86 == 0x15)
		if ((xec == 0x8 || xec == 0x0) && nb_bus_decoder)
			nb_bus_decoder(node_id, m);

	return;

wrong_nb_mce:
	pr_emerg(HW_ERR "Corrupted NB MCE info?\n");
}
Example #13
0
bool CSProperties::Write2XML(TiXmlNode& root, bool parameterised, bool sparse)
{
	TiXmlElement* prop=root.ToElement();
	if (prop==NULL) return false;

	prop->SetAttribute("ID",uiID);
	prop->SetAttribute("Name",sName.c_str());

	if (!sparse)
	{
		TiXmlElement FC("FillColor");
		FC.SetAttribute("R",FillColor.R);
		FC.SetAttribute("G",FillColor.G);
		FC.SetAttribute("B",FillColor.B);
		FC.SetAttribute("a",FillColor.a);
		prop->InsertEndChild(FC);
		TiXmlElement EC("EdgeColor");
		EC.SetAttribute("R",EdgeColor.R);
		EC.SetAttribute("G",EdgeColor.G);
		EC.SetAttribute("B",EdgeColor.B);
		EC.SetAttribute("a",EdgeColor.a);
		prop->InsertEndChild(EC);
	}

	if (m_Attribute_Name.size())
	{
		TiXmlElement Attributes("Attributes");
		for (size_t n=0;n<m_Attribute_Name.size();++n)
		{
			Attributes.SetAttribute(m_Attribute_Name.at(n).c_str(),m_Attribute_Value.at(n).c_str());
		}
		prop->InsertEndChild(Attributes);
	}

	TiXmlElement Primitives("Primitives");
	for (size_t i=0;i<vPrimitives.size();++i)
	{
		TiXmlElement PrimElem(vPrimitives.at(i)->GetTypeName().c_str());
		vPrimitives.at(i)->Write2XML(PrimElem,parameterised);
		Primitives.InsertEndChild(PrimElem);
	}
	prop->InsertEndChild(Primitives);

	return true;
}
static void amd_decode_ic_mce(struct mce *m)
{
	u16 ec = EC(m->status);
	u8 xec = XEC(m->status, xec_mask);

	pr_emerg(HW_ERR "Instruction Cache Error: ");

	if (TLB_ERROR(ec))
		pr_cont("%s TLB %s.\n", LL_MSG(ec),
			(xec ? "multimatch" : "parity error"));
	else if (BUS_ERROR(ec)) {
		bool k8 = (boot_cpu_data.x86 == 0xf && (m->status & BIT_64(58)));

		pr_cont("during %s.\n", (k8 ? "system linefill" : "NB data read"));
	} else if (fam_ops->ic_mce(ec, xec))
		;
	else
		pr_emerg(HW_ERR "Corrupted IC MCE info?\n");
}
Example #15
0
static void decode_mc0_mce(struct mce *m)
{
	u16 ec = EC(m->status);
	u8 xec = XEC(m->status, xec_mask);

	pr_emerg(HW_ERR "MC0 Error: ");

	/* TLB error signatures are the same across families */
	if (TLB_ERROR(ec)) {
		if (TT(ec) == TT_DATA) {
			pr_cont("%s TLB %s.\n", LL_MSG(ec),
				((xec == 2) ? "locked miss"
					    : (xec ? "multimatch" : "parity")));
			return;
		}
	} else if (fam_ops->mc0_mce(ec, xec))
		;
	else
		pr_emerg(HW_ERR "Corrupted MC0 MCE info?\n");
}
static void amd_decode_dc_mce(struct mce *m)
{
	u16 ec = EC(m->status);
	u8 xec = XEC(m->status, xec_mask);

	pr_emerg(HW_ERR "Data Cache Error: ");

	
	if (TLB_ERROR(ec)) {
		if (TT(ec) == TT_DATA) {
			pr_cont("%s TLB %s.\n", LL_MSG(ec),
				((xec == 2) ? "locked miss"
					    : (xec ? "multimatch" : "parity")));
			return;
		}
	} else if (fam_ops->dc_mce(ec, xec))
		;
	else
		pr_emerg(HW_ERR "Corrupted DC MCE info?\n");
}
Example #17
0
static void decode_mc2_mce(struct mce *m)
{
	u16 ec = EC(m->status);
	u8 xec = XEC(m->status, xec_mask);

	pr_emerg(HW_ERR "MC2 Error");

	if (xec == 0x1)
		pr_cont(" in the write data buffers.\n");
	else if (xec == 0x3)
		pr_cont(" in the victim data buffers.\n");
	else if (xec == 0x2 && MEM_ERROR(ec))
		pr_cont(": %s error in the L2 cache tags.\n", R4_MSG(ec));
	else if (xec == 0x0) {
		if (TLB_ERROR(ec))
			pr_cont(": %s error in a Page Descriptor Cache or "
				"Guest TLB.\n", TT_MSG(ec));
		else if (BUS_ERROR(ec))
			pr_cont(": %s/ECC error in data read from NB: %s.\n",
				R4_MSG(ec), PP_MSG(ec));
		else if (MEM_ERROR(ec)) {
			u8 r4 = R4(ec);

			if (r4 >= 0x7)
				pr_cont(": %s error during data copyback.\n",
					R4_MSG(ec));
			else if (r4 <= 0x1)
				pr_cont(": %s parity/ECC error during data "
					"access from L2.\n", R4_MSG(ec));
			else
				goto wrong_mc2_mce;
		} else
			goto wrong_mc2_mce;
	} else
		goto wrong_mc2_mce;

	return;

 wrong_mc2_mce:
	pr_emerg(HW_ERR "Corrupted MC2 MCE info?\n");
}
Example #18
0
int bitmap_save(image_choices *choices,
                image_t       *image,
                const char    *file_name)
{
  osspriteop_area *area;
  os_error        *e;

  NOT_USED(choices);

  area = (osspriteop_area *) image->image;
  e = EC(xosspriteop_save_sprite_file(osspriteop_PTR, area, file_name));
  if (e)
  {
    oserror_report_block(e);
    return TRUE; /* failure */
  }

  image->flags &= ~image_FLAG_MODIFIED;

  return FALSE; /* success */
}
Example #19
0
static void decode_f15_mc2_mce(struct mce *m)
{
	u16 ec = EC(m->status);
	u8 xec = XEC(m->status, xec_mask);

	pr_emerg(HW_ERR "MC2 Error: ");

	if (TLB_ERROR(ec)) {
		if (xec == 0x0)
			pr_cont("Data parity TLB read error.\n");
		else if (xec == 0x1)
			pr_cont("Poison data provided for TLB fill.\n");
		else
			goto wrong_f15_mc2_mce;
	} else if (BUS_ERROR(ec)) {
		if (xec > 2)
			goto wrong_f15_mc2_mce;

		pr_cont("Error during attempted NB data read.\n");
	} else if (MEM_ERROR(ec)) {
		switch (xec) {
		case 0x4 ... 0xc:
			pr_cont("%s.\n", f15h_mc2_mce_desc[xec - 0x4]);
			break;

		case 0x10 ... 0x14:
			pr_cont("%s.\n", f15h_mc2_mce_desc[xec - 0x7]);
			break;

		default:
			goto wrong_f15_mc2_mce;
		}
	}

	return;

 wrong_f15_mc2_mce:
	pr_emerg(HW_ERR "Corrupted MC2 MCE info?\n");
}
void client::clientMain(int commandport, int checktemp, int senderid, int loopNum, std::string test,std::string tempport)
{		
		std::mutex* lock = new std::mutex;
		Sender sndr1("send", loopNum, senderid * 2 + 1, checktemp, tempport, test);// sndr2("send", loopNum, senderid * 2 + 2, checktemp, tempport, test);
		Receiver* rcvr1 = new Receiver;//create sender and receiver 
		VaultDispatcher* Disp1;
		Disp1 = new VaultDispatcher("disp");
		EchoCommunicator* Echo1;
		FileCommunicator* File1;
		Echo1 = new EchoCommunicator("echo");
		File1 = new FileCommunicator("file");
		Disp1->Register(Echo1);
		Disp1->Register(File1);
		Echo1->Dispatcher(Disp1);
		File1->Dispatcher(Disp1);
		rcvr1->LOCK(lock);//assign lock to each of the communicator 
		Disp1->LOCK(lock);
		Echo1->LOCK(lock);
		File1->LOCK(lock);
		sndr1.LOCK(lock);
		std::thread sender1(&Sender::start, &sndr1, "127.0.0.1", 8080);
		std::thread AD(&VaultDispatcher::ProcessMsg1, Disp1);//open the thread to each of the processMsg function
		std::thread EC(&EchoCommunicator::ProcessMsg1, Echo1);
		std::thread FC(&FileCommunicator::ProcessMsg1, File1);
		rcvr1->DISP(Disp1);
		rcvr1->start(commandport);
		AD.join();
		EC.join();
		FC.join();
		sender1.join();
		while (Disp1->DisplayQ().size() != 0)
		{
			std::string getresult = Disp1->DisplayQ().deQ();
			display += '?' + getresult;
		}
}
Example #21
0
 operator EC() const { return EC(V); }
Example #22
0
#include "errormsg.h"

uint8_t current_error;
uint8_t error_buffer[CONFIG_ERROR_BUFFER_SIZE];

/// Version number string, will be added to message 73
const char PROGMEM versionstr[] = "cbmdisk V" VERSION;

/// Long version string, used for message 9
const char PROGMEM longverstr[] = LONGVERSION;

#define EC(x) x+0x80

/// Abbreviations used in the main error strings
static const PROGMEM uint8_t abbrevs[] = {
  EC(0), 'F','I','L','E',
  EC(1), 'R','E','A','D',
  EC(2), 'W','R','I','T','E',
  EC(3), ' ','E','R','R','O','R',
  EC(4), ' ','N','O','T',' ',
  EC(5), 'D','I','S','K',' ',
  EC(6), 'O','P','E','N',
  EC(7), 'R','E','C','O','R','D',
  EC(8), 'P','A','R','T','I','T','I','O','N',' ',
  EC(9), 'S','E','L','E','C','T','E','D',
  EC(10), 'I','L','L','E','G','A','L',
  EC(11), ' ','T','O','O',' ',
  EC(12), 'N','O',' ',
  EC(127)
};
void display(void){
  glClear(GL_COLOR_BUFFER_BIT);               // limpa a janela
  glColor3f (1.0, 1.0, 1.0);                  // cor da linha
  EC(0,0,7);
  glFlush();
}
Example #24
0
void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
    QString OldName = "";

    EditNetworkSetup EC( this );

    if( LBI ) {
      NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() );
      if( ! NC ) {
        return;
      }
      OldName = NC->name();
      EC.setNetworkSetup( NC );
    }

    EC.showMaximized();
    // disable refresh timer
    UpdateTimer->stop();

    // we need to retry
    while( 1 ) {
      if( EC.exec() == QDialog::Accepted ) {
        // toplevel item -> store
        NetworkSetup * NC = EC.networkSetup();
        if( NC->isModified() ) {
          if( LBI ) {
            if( NC->name() != OldName ) {
              // find if new name is free
              NetworkSetup * LCN = NSResources->findNetworkSetup(
                    NC->name() );
              if( LCN ) {
                QMessageBox::warning(
                  0,
                  tr( "In System Config" ),
                  tr( "Name %1 already exists" ).arg(NC->name())
                );
                continue; // restart exec
              } // else new name
              // new name -> remove item
              NSResources->removeNetworkSetup( OldName );
              NSResources->addNetworkSetup( NC, 0 );
            } // else not changed

            // no update (will come later)
            Profiles_LB->blockSignals( TRUE );
            Profiles_LB->changeItem( NC->devicePixmap(),
                                     NC->name(),
                                     Profiles_LB->index( LBI )
                                   );
            Profiles_LB->blockSignals( FALSE );
          } else {
            // new item
            int ci = Profiles_LB->count();
            NSResources->addNetworkSetup( NC, 0 );
            NC->setNumber( NSResources->assignNetworkSetupNumber() );
            Profiles_LB->insertItem( NC->devicePixmap(), NC->name() );
            Profiles_LB->setSelected( ci, TRUE );
          }
          SLOT_RefreshStates();
        }
      } else {
        // cancelled : reset NetworkSetup
        if( LBI ) {
          NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() );
          NC->reassign();
        }
      }
      break;
    }
    // reenable
    UpdateTimer->start( 5000 );
}
Example #25
0
void amd_decode_nb_mce(int node_id, struct mce *m, u32 nbcfg)
{
	struct cpuinfo_x86 *c = &boot_cpu_data;
	u16 ec   = EC(m->status);
	u8 xec   = XEC(m->status, 0x1f);
	u32 nbsh = (u32)(m->status >> 32);
	int core = -1;

	pr_emerg(HW_ERR "Northbridge Error (node %d", node_id);

	/* F10h, revD can disable ErrCpu[3:0] through ErrCpuVal */
	if (c->x86 == 0x10 && c->x86_model > 7) {
		if (nbsh & NBSH_ERR_CPU_VAL)
			core = nbsh & nb_err_cpumask;
	} else {
		u8 assoc_cpus = nbsh & nb_err_cpumask;

		if (assoc_cpus > 0)
			core = fls(assoc_cpus) - 1;
	}

	if (core >= 0)
		pr_cont(", core %d): ", core);
	else
		pr_cont("): ");

	switch (xec) {
	case 0x2:
		pr_cont("Sync error (sync packets on HT link detected).\n");
		return;

	case 0x3:
		pr_cont("HT Master abort.\n");
		return;

	case 0x4:
		pr_cont("HT Target abort.\n");
		return;

	case 0x7:
		pr_cont("NB Watchdog timeout.\n");
		return;

	case 0x9:
		pr_cont("SVM DMA Exclusion Vector error.\n");
		return;

	default:
		break;
	}

	if (!fam_ops->nb_mce(ec, xec))
		goto wrong_nb_mce;

	if (c->x86 == 0xf || c->x86 == 0x10 || c->x86 == 0x15)
		if ((xec == 0x8 || xec == 0x0) && nb_bus_decoder)
			nb_bus_decoder(node_id, m, nbcfg);

	return;

wrong_nb_mce:
	pr_emerg(HW_ERR "Corrupted NB MCE info?\n");
}