Skip to contentSkip to conversation

support BCV for rombios

PATCH In review Akio Takebe 3 participants 7 messages Dec 8, 2008 – Dec 18, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support BCV for rombios

Hi,

This patch supports BCV for PCI device.
If we use this patch in Xen, we would need some more fixes. This patch just support BCV.
We could boot a full virtualize guest from a Pass through device with VT-d on Xen.

Ref:
- XenSummit Asia 2008
http://www.xen.org/files/xensummit_tokyo/24_Hitoshi%20Matsumoto_en.pdf
- BIOS Boot Specification
http://www.phoenix.com/NR/rdonlyres/56E38DE2-3E6F-4743-835F-B4A53726ABED/0/specsbbs101.pdf

Best Regards,

Akio Takebe

Index: rombios.c
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v
retrieving revision 1.209
diff -c -r1.209 rombios.c
*** rombios.c 2 Jun 2008 20:08:10 -0000 1.209
--- rombios.c 8 Dec 2008 10:09:53 -0000
***************
*** 10194,10199 ****
--- 10194,10223 ----

    mov  ax, 2[bx]
    cmp  ax, #0x506e
    jne  no_bev
+ 
+   mov  ax, 0x16[bx] ;; 0x16 is the offset of Boot Connection Vector
+   cmp  ax, #0x0000
+   je   no_bcv
+ 
+   ;; Option ROM has BCV. Run it now.
+   push cx       ;; Push seg
+   push ax       ;; Push offset
+ 
+   ;; Point ES:DI at "$PnP", which tells the ROM that we are a PnP BIOS.
+   mov  bx, #0xf000
+   mov  es, bx
+   lea  di, pnp_string
+   /* jump to BCV function entry pointer */
+   mov  bp, sp   ;; Call ROM BCV routine using seg:off on stack
+   db   0xff     ;; call_far ss:[bp+0]
+   db   0x5e
+   db   0
+   cli           ;; In case expansion ROM BIOS turns IF on
+   add  sp, #2   ;; Pop offset value
+   pop  cx       ;; Pop seg value (restore CX)
+   ja   no_bev
+ 
+ no_bcv:
    mov  ax, 0x1a[bx] ;; 0x1A is also the offset into the expansion header of...
    cmp  ax, #0x0000  ;; the Bootstrap Entry Vector, or zero if there is none.
    je   no_bev

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 37 lines · Akio Takebe

Hi,

This patch supports BCV for PCI device.
If we use this patch in Xen, we would need some more fixes. This patch just support BCV.
We could boot a full virtualize guest from a Pass through device with VT-d on Xen.

Ref:
- XenSummit Asia 2008
http://www.xen.org/files/xensummit_tokyo/24_Hitoshi%20Matsumoto_en.pdf
- BIOS Boot Specification
http://www.phoenix.com/NR/rdonlyres/56E38DE2-3E6F-4743-835F-B4A53726ABED/0/specsbbs101.pdf

Best Regards,

Akio Takebe

Index: rombios.c
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v
retrieving revision 1.209
diff -c -r1.209 rombios.c
*** rombios.c 2 Jun 2008 20:08:10 -0000 1.209
--- rombios.c 8 Dec 2008 10:09:53 -0000
***************
*** 10194,10199 ****
--- 10194,10223 ----

    mov  ax, 2[bx]
    cmp  ax, #0x506e
    jne  no_bev

+

(quoted diff) +2 -0
+   mov  ax, 0x16[bx] ;; 0x16 is the offset of Boot Connection Vector
+   cmp  ax, #0x0000

Review

Quoted 10 lines
(quoted diff) +10 -0
+   je   no_bcv
+ 
+   ;; Option ROM has BCV. Run it now.
+   push cx       ;; Push seg
+   push ax       ;; Push offset
+ 
+   ;; Point ES:DI at "$PnP", which tells the ROM that we are a PnP BIOS.
+   mov  bx, #0xf000
+   mov  es, bx
+   lea  di, pnp_string

Should ax, bx and dx get set to some sane value, e.g. 0? Those are only needed for PnP ISA devices, but some broken option rom might expect something there.

Review

Quoted 9 lines
(quoted diff) +9 -0
+   /* jump to BCV function entry pointer */
+   mov  bp, sp   ;; Call ROM BCV routine using seg:off on stack
+   db   0xff     ;; call_far ss:[bp+0]
+   db   0x5e
+   db   0
+   cli           ;; In case expansion ROM BIOS turns IF on
+   add  sp, #2   ;; Pop offset value
+   pop  cx       ;; Pop seg value (restore CX)
+   ja   no_bev

ja? not jmp?

Quoted 4 lines

+ no_bcv:

    mov  ax, 0x1a[bx] ;; 0x1A is also the offset into the expansion header of...
    cmp  ax, #0x0000  ;; the Bootstrap Entry Vector, or zero if there is none.
    je   no_bev

- Sebastian

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

#2 lore raw
Quoted 8 lines · On Thursday 11 December 2008 00:02:40 Sebastian Herbszt wrote:

Review

Quoted 4 lines
(quoted diff) +4 -0
+   ;; Point ES:DI at "$PnP", which tells the ROM that we are a PnP BIOS.
+   mov  bx, #0xf000
+   mov  es, bx
+   lea  di, pnp_string

Should ax, bx and dx get set to some sane value, e.g. 0? Those are only needed for PnP ISA devices, but some broken option rom might expect something there.

I haven't checked the spec, but if the parameters are meant to match the initialisation vector or other similar entry points (e.g. the UNDI loader entry point for PXE ROMs) then %ax should contain the PCI bus:dev.fn number.

Michael

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

#3 lore raw

Hi,

Thank you for your comments.

Quoted 10 lines · On Thursday 11 December 2008 00:02:40 Sebastian Herbszt wrote:
Quoted 8 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+   ;; Point ES:DI at "$PnP", which tells the ROM that we are a PnP BIOS.
+   mov  bx, #0xf000
+   mov  es, bx
+   lea  di, pnp_string

Should ax, bx and dx get set to some sane value, e.g. 0? Those are only needed for PnP ISA devices, but some broken option rom might expect something there.

Hmm. I don't find specification in the BBS spec.
But as you said, we may need to add preserving registers. The patch is for PCI devices.
For ISA device, we would need to check if it is a PCI or ISA device.

Quoted 5 lines

I haven't checked the spec, but if the parameters are meant to match the initialisation vector or other similar entry points (e.g. the UNDI loader entry point for PXE ROMs) then %ax should contain the PCI bus:dev.fn number.

Michael

The BBS spec says:
"Note that for PCI cards, AX will not contain the PFA. PCI devices that need their PFA during execution of their BCV should store the PFA passed earlier when their option ROM’s initialization vector was called."

Best Regards,

Akio Takebe

#4 lore raw
In reply to Sebastian Herbszt

Hi,

Quoted 10 lines

Review

Quoted 9 lines
(quoted diff) +9 -0
+   /* jump to BCV function entry pointer */
+   mov  bp, sp   ;; Call ROM BCV routine using seg:off on stack
+   db   0xff     ;; call_far ss:[bp+0]
+   db   0x5e
+   db   0
+   cli           ;; In case expansion ROM BIOS turns IF on
+   add  sp, #2   ;; Pop offset value
+   pop  cx       ;; Pop seg value (restore CX)
+   ja   no_bev
Quoted 2 lines

ja? not jmp?

Oops. yes jmp.

Quoted 7 lines
Quoted 6 lines

+ no_bcv:

    mov  ax, 0x1a[bx] ;; 0x1A is also the offset into the expansion header 
of...
    cmp  ax, #0x0000  ;; the Bootstrap Entry Vector, or zero if there is 

none.
je no_bev

Best Regards,

Akio Takebe

#5 lore raw
Quoted 12 lines · Akio Takebe

Hi,

Quoted 10 lines
Quoted 9 lines
(quoted diff) +9 -0
+   /* jump to BCV function entry pointer */
+   mov  bp, sp   ;; Call ROM BCV routine using seg:off on stack
+   db   0xff     ;; call_far ss:[bp+0]
+   db   0x5e
+   db   0
+   cli           ;; In case expansion ROM BIOS turns IF on
+   add  sp, #2   ;; Pop offset value
+   pop  cx       ;; Pop seg value (restore CX)
+   ja   no_bev
Quoted 3 lines
Quoted 2 lines

ja? not jmp?

Oops. yes jmp.

Can you please resend a fixed version?

Thanks
Sebastian

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

#6 lore raw
Quoted 13 lines · Sebastian Herbszt
Quoted 12 lines · Akio Takebe

Hi,

Quoted 10 lines
Quoted 9 lines
(quoted diff) +9 -0
+   /* jump to BCV function entry pointer */
+   mov  bp, sp   ;; Call ROM BCV routine using seg:off on stack
+   db   0xff     ;; call_far ss:[bp+0]
+   db   0x5e
+   db   0
+   cli           ;; In case expansion ROM BIOS turns IF on
+   add  sp, #2   ;; Pop offset value
+   pop  cx       ;; Pop seg value (restore CX)
+   ja   no_bev
Quoted 10 lines
Quoted 3 lines
Quoted 2 lines

ja? not jmp?

Oops. yes jmp.

Can you please resend a fixed version?

Thanks
Sebastian

Sorry, and thank you for your review. I updeted our patch.

Best Regards,

Akio Takebe

Index: bios/rombios.c
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v
retrieving revision 1.222

rombios.c +24 -0
diff -u -r1.222 rombios.c
@@ -10251,6 +10251,30 @@
   mov  ax, 2[bx]
   cmp  ax, #0x506e
   jne  no_bev
+
+  mov  ax, 0x16[bx] ;; 0x16 is the offset of Boot Connection Vector
+  cmp  ax, #0x0000
+  je   no_bcv
+
+  ;; Option ROM has BCV. Run it now.
+  push cx       ;; Push seg
+  push ax       ;; Push offset
+
+  ;; Point ES:DI at "$PnP", which tells the ROM that we are a PnP BIOS.
+  mov  bx, #0xf000
+  mov  es, bx
+  lea  di, pnp_string
+  /* jump to BCV function entry pointer */
+  mov  bp, sp   ;; Call ROM BCV routine using seg:off on stack
+  db   0xff     ;; call_far ss:[bp+0]
+  db   0x5e
+  db   0
+  cli           ;; In case expansion ROM BIOS turns IF on
+  add  sp, #2   ;; Pop offset value
+  pop  cx       ;; Pop seg value (restore CX)
+  jmp   no_bev
+
+no_bcv:
   mov  ax, 0x1a[bx] ;; 0x1A is also the offset into the expansion header of...
   cmp  ax, #0x0000  ;; the Bootstrap Entry Vector, or zero if there is none.
   je   no_bev

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel