Patchwork patch: disable IPMI on the dell s1850

login
register
about
Submitter ron minnich
Date 2009-09-16 05:36:17
Message ID <13426df10909152236r3df6ff86g29810b5aa2ad4cff@mail.gmail.com>
Download mbox | patch
Permalink /patch/255/
State Accepted
Headers show

Comments

ron minnich - 2009-09-16 05:36:17
attached.

ron
Peter Stuge - 2009-09-16 19:28:20
ron minnich wrote:
> attached.

This looks great - but if it applies in general for all BMCs then
maybe it should be outside the dell/s1850 directory?

Otherwise fine;

Acked-by: Peter Stuge <peter@stuge.se>
ron minnich - 2009-09-16 19:53:04
On Wed, Sep 16, 2009 at 12:28 PM, Peter Stuge <peter@stuge.se> wrote:
> ron minnich wrote:
>> attached.
>
> This looks great - but if it applies in general for all BMCs then
> maybe it should be outside the dell/s1850 directory?

Not yet. We need to do a lot more testing. This code is very specific
to the 1850 for now.

I agree with you in principal however!

thanks

ron
Carl-Daniel Hailfinger - 2009-09-26 17:40:31
On 16.09.2009 21:53, ron minnich wrote:
> On Wed, Sep 16, 2009 at 12:28 PM, Peter Stuge <peter@stuge.se> wrote:
>   
>> ron minnich wrote:
>>     
>>> attached.
>>>       
>> This looks great - but if it applies in general for all BMCs then
>> maybe it should be outside the dell/s1850 directory?
>>     
>
> Not yet. We need to do a lot more testing. This code is very specific
> to the 1850 for now.
>   

For the record, this was committed in r4640.

Regards,
Carl-Daniel

Patch

This is a patch for killing IPMI on the s1850 -- or at least geting the BMC
out of the way of the serial port. Tested extensively in user mode.
Works and gets the BMC out of my way, which is good, because there
are few more useless things than IPMI and the BMC.
The BMC, all by itself, is the cause of most of our problems in booting
and talking to these nodes. 

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>

Index: src/mainboard/dell/s1850/auto.c
===================================================================
--- src/mainboard/dell/s1850/auto.c	(revision 4636)
+++ src/mainboard/dell/s1850/auto.c	(working copy)
@@ -74,6 +74,107 @@ 
 #include "sdram/generic_sdram.c"
 
 
+/* IPMI garbage. This is all test stuff, if it really works we'll move it somewhere
+ */
+
+#define nftransport  0xc
+
+#define OBF  0
+#define IBF 1
+
+#define ipmidata  0xca0
+#define ipmicsr  0xca4
+
+
+static inline void  ibfzero(void)
+{
+	while(inb(ipmicsr) &  (1<<IBF)) 
+		;
+}
+static inline void  clearobf(void)
+{
+	(void) inb(ipmidata);
+}
+
+static inline void  waitobf(void)
+{
+	while((inb(ipmicsr) &  (1<<OBF)) == 0) 
+		;
+}
+/* quite possibly the stupidest interface ever designed. */
+static inline void  first_cmd_byte(unsigned char byte)
+{
+	ibfzero();
+	clearobf();
+	outb(0x61, ipmicsr);
+	ibfzero();
+	clearobf();
+	outb(byte, ipmidata);
+}
+
+static inline void  next_cmd_byte(unsigned char byte)
+{
+
+	ibfzero();
+	clearobf();
+	outb(byte, ipmidata);
+}
+
+static inline void  last_cmd_byte(unsigned char byte)
+{
+	outb(0x62, ipmicsr);
+
+	ibfzero();
+	clearobf();
+	outb(byte,  ipmidata);
+}
+
+static inline void read_response_byte(void)
+{
+	int val = -1;
+	if ((inb(ipmicsr)>>6) != 1)
+		return;
+
+	ibfzero();
+	waitobf();
+	val = inb(ipmidata);
+	outb(0x68, ipmidata);
+
+	/* see if it is done */
+	if ((inb(ipmicsr)>>6) != 1){
+		/* wait for the dummy read. Which describes this protocol */
+		waitobf();
+		(void)inb(ipmidata);
+	}
+}
+
+static inline void ipmidelay(void)
+{
+	int i;
+	for(i = 0; i < 1000; i++) {
+		inb(0x80);
+	}
+}
+
+static inline void bmc_foad(void)
+{
+	unsigned char c;
+	/* be safe; make sure it is really ready */
+	while ((inb(ipmicsr)>>6)) {
+		outb(0x60, ipmicsr);
+		inb(ipmidata);
+	}
+	first_cmd_byte(nftransport << 2);
+	ipmidelay();
+	next_cmd_byte(0x12);
+	ipmidelay();
+	next_cmd_byte(2);
+	ipmidelay();
+	last_cmd_byte(3);
+	ipmidelay();
+}
+
+/* end IPMI garbage */
 static void main(unsigned long bist)
 {
 	/*
@@ -100,6 +201,7 @@ 
 		}
 	}
 	/* Setup the console */
+	bmc_foad();
 	outb(0x87,0x2e);
 	outb(0x87,0x2e);
 	pnp_write_config(CONSOLE_SERIAL_DEV, 0x24, 0x84 | (1 << 6));