Re: [ES40-developers] Patch: USB BAR support
Status: Alpha
Brought to you by:
iamcamiel
|
From: Camiel V. <iam...@gm...> - 2008-02-18 15:52:08
|
Hi Brian,
Thanks! I put it in.
Camiel.
On Feb 18, 2008 3:47 PM, Brian Wheeler <bdw...@in...> wrote:
> Beats me if it actually does what its supposed to, but linux and tru64
> boot past the USB check point without crashing es40 :)
>
> Brian
>
>
> Index: AliM1543C_usb.cpp
> ===================================================================
> RCS file: /cvsroot/es40/es40/src/AliM1543C_usb.cpp,v
> retrieving revision 1.3
> diff -u -r1.3 AliM1543C_usb.cpp
> --- AliM1543C_usb.cpp 30 Dec 2007 15:10:22 -0000 1.3
> +++ AliM1543C_usb.cpp 18 Feb 2008 14:34:45 -0000
> @@ -97,6 +97,12 @@
>
> ResetPCI();
>
> + state.usb_data[0x34/4] = 0x2edf;
> + state.usb_data[0x48/4] = 0x01000003;
> +
> +
> +
> +
> printf("%s: $Id: AliM1543C_usb.cpp,v 1.3 2007/12/30 15:10:22 iamcamiel Exp $\n",devid_string);
> }
>
> @@ -188,3 +194,111 @@
> printf("%s: %d bytes restored.\n",devid_string,ss);
> return 0;
> }
> +
> +u32 CAliM1543C_usb::ReadMem_Bar(int func,int bar, u32 address, int dsize) {
> + u32 data = 0;
> + switch(bar) {
> + case 0:
> + data = usb_hci_read(address,dsize);
> + break;
> + default:
> + printf("%%USB-W-READBAR: Bad BAR %d selected.\n",bar);
> + }
> + return data;
> +}
> +
> +
> +void CAliM1543C_usb::WriteMem_Bar(int func,int bar, u32 address, int dsize, u32 data) {
> + switch(bar) {
> + case 0:
> + usb_hci_write(address,dsize,data);
> + break;
> + default:
> + printf("%%USB-W-WRITEBAR: Bad BAR %d selected.\n",bar);
> + }
> + return;
> +}
> +
> +
> +u64 CAliM1543C_usb::usb_hci_read(u64 address, int dsize) {
> + u64 data = 0;
> + if(dsize != 32)
> + printf("%%USB-W-HCIREAD: Non dword read, returning 32 bits anyway.\n");
> + switch(address) {
> + case 0: // HcRevision
> + data = 0x00000110;
> + break;
> + case 4: // HcControl
> + case 8: // HcCommandStatus
> + case 0x0c: // HcInterruptStatus
> + case 0x10: // HcInterrupt Enable
> + case 0x14: // HcInterruptDisable
> + case 0x18: // HcHCCA (datasheet says 0x17, but that's wrong)
> + case 0x1c: // HcPeriodCurrentED
> + case 0x20: // HcControlHeadED
> + case 0x24: // HcControlCurrentED
> + case 0x28: // HcBulkHeadED
> + case 0x2c: // HcBulkCurrentED
> + case 0x30: // HcDoneHead
> + case 0x34: // HcFmInterval
> + case 0x38: // HcFrameRemaining
> + case 0x3c: // HcFmNumber
> + case 0x40: // HcPeriodicStart
> + case 0x44: // HcLSThreshold
> + case 0x48: // HcRhDescriptorA
> + case 0x4c: // HcRhDescriptorB
> + case 0x50: // HcRhStatus
> + case 0x54: // HcRhPortStatus1
> + case 0x58: // HcRhPortStatus1
> + case 0x5c: // HcRhPortStatus1
> + case 0x100: // HceControlRegister
> + case 0x104: // HceInputRegister
> + case 0x108: // HceOutputRegister
> + case 0x10c: // HceStatusRegister
> + data=state.usb_data[address/4];
> + break;
> +
> + default:
> + printf("%%USB-W-HCIREAD: Reading from unknown address %x. Ignoring.\n",address);
> + }
> + return data;
> +}
> +
> +
> +void CAliM1543C_usb::usb_hci_write(u64 address, int dsize, u64 data) {
> + if(dsize != 32)
> + printf("%%USB-W-HCIWRITE: Non dword write, writing 32 bits anyway.\n");
> + switch(address) {
> + case 4: // HcControl
> + case 8: // HcCommandStatus
> + case 0x0c: // HcInterruptStatus
> + case 0x10: // HcInterrupt Enable
> + case 0x14: // HcInterruptDisable
> + case 0x18: // HcHCCA (datasheet says 0x17, but that's wrong)
> + case 0x1c: // HcPeriodCurrentED
> + case 0x20: // HcControlHeadED
> + case 0x24: // HcControlCurrentED
> + case 0x28: // HcBulkHeadED
> + case 0x2c: // HcBulkCurrentED
> + case 0x30: // HcDoneHead
> + case 0x34: // HcFmInterval
> + case 0x38: // HcFrameRemaining
> + case 0x3c: // HcFmNumber
> + case 0x40: // HcPeriodicStart
> + case 0x44: // HcLSThreshold
> + case 0x48: // HcRhDescriptorA
> + case 0x4c: // HcRhDescriptorB
> + case 0x50: // HcRhStatus
> + case 0x54: // HcRhPortStatus1
> + case 0x58: // HcRhPortStatus1
> + case 0x5c: // HcRhPortStatus1
> + case 0x100: // HceControlRegister
> + case 0x104: // HceInputRegister
> + case 0x108: // HceOutputRegister
> + case 0x10c: // HceStatusRegister
> + state.usb_data[address/4]=data;
> + break;
> + default:
> + printf("%%USB-W-HCIWRITE: Writing to unknown address %x. Ignoring.\n",address);
> + }
> +}
> cvs diff: I know nothing about AliM1543C_usb.cpp.~1.3.~
> Index: AliM1543C_usb.h
> ===================================================================
> RCS file: /cvsroot/es40/es40/src/AliM1543C_usb.h,v
> retrieving revision 1.4
> diff -u -r1.4 AliM1543C_usb.h
> --- AliM1543C_usb.h 8 Jan 2008 16:38:09 -0000 1.4
> +++ AliM1543C_usb.h 18 Feb 2008 14:34:45 -0000
> @@ -68,13 +68,21 @@
> CAliM1543C_usb(CConfigurator * cfg, class CSystem * c, int pcibus, int pcidev);
> virtual ~CAliM1543C_usb();
>
> + virtual void WriteMem_Bar(int func,int bar, u32 address, int dsize, u32 data);
> + virtual u32 ReadMem_Bar(int func,int bar, u32 address, int dsize);
> +
> private:
>
> u64 usb_config_read(u64 address, int dsize);
> void usb_config_write(u64 address, int dsize, u64 data);
>
> + u64 usb_hci_read(u64 address, int dsize);
> + void usb_hci_write(u64 address, int dsize, u64 data);
> +
> +
> /// The state structure contains all elements that need to be saved to the statefile.
> struct SUSB_state {
> + u32 usb_data[0x110/4];
> } state;
>
> };
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Es40-developers mailing list
> Es4...@li...
> https://lists.sourceforge.net/lists/listinfo/es40-developers
>
|