add missing files not taken with github import
This commit is contained in:
1174
pci/ehci-hcd.c
Normal file
1174
pci/ehci-hcd.c
Normal file
File diff suppressed because it is too large
Load Diff
2380
pci/ohci-hcd.c
Normal file
2380
pci/ohci-hcd.c
Normal file
File diff suppressed because it is too large
Load Diff
66
pci/pci_errata.c
Executable file
66
pci/pci_errata.c
Executable file
@@ -0,0 +1,66 @@
|
||||
#include "pci_errata.h"
|
||||
#include "pci.h"
|
||||
#include <MCF5475.h>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
__attribute__((aligned(16))) void chip_errata_135(void)
|
||||
{
|
||||
/*
|
||||
* Errata type: Silicon
|
||||
* Affected component: PCI
|
||||
* Description: When core PCI transactions that involve writes to configuration or I/O space
|
||||
* are followed by a core line access to line addresses 0x4 and 0xC, core access
|
||||
* to the XL bus can hang.
|
||||
* Workaround: Prevent PCI configuration and I/O writes from being followed by the described
|
||||
* line access by the core by generating a known good XL bus transaction after
|
||||
* the PCI transaction.
|
||||
* Create a dummy function which is called immediately after each of the affected
|
||||
* transactions. There are three requirements for this dummy function.
|
||||
* 1. The function must be aligned to a 16-byte boundary.
|
||||
* 2. The function must contain a dummy write to a location on the XL bus,
|
||||
* preferably one with no side effects.
|
||||
* 3. The function must be longer than 32 bytes. If it is not, the function should
|
||||
* be padded with 16- or 48-bit TPF instructions placed after the end of
|
||||
* the function (after the RTS instruction) such that the length is longer
|
||||
* than 32 bytes.
|
||||
*/
|
||||
|
||||
__asm__ __volatile(
|
||||
" .extern __MBAR \n\t"
|
||||
" clr.l d0 \n\t"
|
||||
" move.l d0,__MBAR+0xF0C \n\t" /* Must use direct addressing. write to EPORT module */
|
||||
/* xlbus -> slavebus -> eport, writing '0' to register */
|
||||
/* has no effect */
|
||||
" rts \n\t"
|
||||
" tpf.l #0x0 \n\t"
|
||||
" tpf.l #0x0 \n\t"
|
||||
" tpf.l #0x0 \n\t"
|
||||
" tpf.l #0x0 \n\t"
|
||||
" tpf.l #0x0 \n\t"
|
||||
::: "d0", "memory");
|
||||
}
|
||||
|
||||
void chip_errata_055(int32_t handle)
|
||||
{
|
||||
uint32_t dummy;
|
||||
|
||||
return; /* test */
|
||||
|
||||
/* initiate PCI configuration access to device */
|
||||
MCF_PCI_PCICAR = MCF_PCI_PCICAR_E | /* enable configuration access special cycle */
|
||||
MCF_PCI_PCICAR_BUSNUM(3) | /* note: invalid bus number */
|
||||
MCF_PCI_PCICAR_DEVNUM(PCI_DEVICE_FROM_HANDLE(handle)) | /* device number, devices 0 - 9 are reserved */
|
||||
MCF_PCI_PCICAR_FUNCNUM(PCI_FUNCTION_FROM_HANDLE(handle)) | /* function number */
|
||||
MCF_PCI_PCICAR_DWORD(0);
|
||||
|
||||
/* issue a dummy read to an unsupported bus number (will fail) */
|
||||
dummy = * (volatile uint32_t *) PCI_IO_OFFSET; /* access device */
|
||||
|
||||
/* silently clear the PCI errors we produced just now */
|
||||
MCF_PCI_PCIISR = 0xffffffff; /* clear all errors */
|
||||
MCF_PCI_PCIGSCR = MCF_PCI_PCIGSCR_PE | MCF_PCI_PCIGSCR_SE;
|
||||
|
||||
(void) dummy;
|
||||
}
|
||||
|
||||
469
pci/pci_wrappers.S
Normal file
469
pci/pci_wrappers.S
Normal file
@@ -0,0 +1,469 @@
|
||||
/*
|
||||
* pci.S
|
||||
*
|
||||
* Purpose: PCI configuration for the Coldfire builtin PCI bridge.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Created on: 08.05.2014
|
||||
* Author: David Galvez
|
||||
*/
|
||||
|
||||
.global _wrapper_find_pci_device
|
||||
.global _wrapper_find_pci_classcode
|
||||
|
||||
.global _wrapper_read_config_longword
|
||||
.global _wrapper_read_config_word
|
||||
.global _wrapper_read_config_byte
|
||||
|
||||
.global _wrapper_fast_read_config_byte
|
||||
.global _wrapper_fast_read_config_word
|
||||
.global _wrapper_fast_read_config_longword
|
||||
|
||||
.global _wrapper_write_config_longword
|
||||
.global _wrapper_write_config_word
|
||||
.global _wrapper_write_config_byte
|
||||
|
||||
.global _wrapper_get_resource
|
||||
.global _wrapper_hook_interrupt
|
||||
.global _wrapper_unhook_interrupt
|
||||
|
||||
.global _wrapper_special_cycle
|
||||
.global _wrapper_get_routing
|
||||
.global _wrapper_set_interrupt
|
||||
.global _wrapper_get_resource
|
||||
.global _wrapper_get_card_used
|
||||
.global _wrapper_set_card_used
|
||||
|
||||
.global _wrapper_read_mem_byte
|
||||
.global _wrapper_read_mem_word
|
||||
.global _wrapper_read_mem_longword
|
||||
|
||||
.global _wrapper_fast_read_mem_byte
|
||||
.global _wrapper_fast_read_mem_word
|
||||
.global _wrapper_fast_read_mem_longword
|
||||
|
||||
.global _wrapper_write_mem_byte
|
||||
.global _wrapper_write_mem_word
|
||||
.global _wrapper_write_mem_longword
|
||||
|
||||
.global _wrapper_read_io_byte
|
||||
.global _wrapper_read_io_word
|
||||
.global _wrapper_read_io_longword
|
||||
|
||||
.global _wrapper_fast_read_io_byte
|
||||
.global _wrapper_fast_read_io_word
|
||||
.global _wrapper_fast_read_io_longword
|
||||
|
||||
.global _wrapper_write_io_byte
|
||||
.global _wrapper_write_io_word
|
||||
.global _wrapper_write_io_longword
|
||||
|
||||
.global _wrapper_get_machine_id
|
||||
.global _wrapper_get_pagesize
|
||||
|
||||
.global _wrapper_virt_to_bus
|
||||
.global _wrapper_bus_to_virt
|
||||
.global _wrapper_virt_to_phys
|
||||
.global _wrapper_phys_to_virt
|
||||
|
||||
|
||||
_wrapper_find_pci_device:
|
||||
move.l D1,-(SP) // index
|
||||
move.l D0,-(SP) // Vendor ID
|
||||
move.l #16,D1
|
||||
lsr.l D1,D0
|
||||
move.l D0,-(SP) // Device ID
|
||||
jsr _pci_find_device
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
_wrapper_find_pci_classcode:
|
||||
move.l D1,-(SP) // index
|
||||
move.l D0,-(SP) // ID
|
||||
jsr _pci_find_classcode
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
_wrapper_read_config_byte:
|
||||
move.l A0,-(SP) // pointer to space for read data
|
||||
move.l D1,-(SP) // PCI register
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_config_byte
|
||||
move.l 8(SP),A0 // PCI_BIOS expects value in memory
|
||||
move.l D0,(A0)
|
||||
add.l #12,SP
|
||||
move.l #0,D0
|
||||
rts
|
||||
|
||||
_wrapper_read_config_word:
|
||||
move.l A0,-(SP) // pointer to space for read data
|
||||
move.l D1,-(SP) // PCI register
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_config_word
|
||||
move.l 8(SP),A0 // little to big endian
|
||||
move.l D0,(A0)
|
||||
mvz.b 1(A0),D0
|
||||
lsl.l #8,D0
|
||||
move.b (A0),D0
|
||||
move.l D0,(A0) // PCI_BIOS expects value in memory, not in D0
|
||||
add.l #12,SP
|
||||
move.l #0,D0
|
||||
rts
|
||||
|
||||
_wrapper_read_config_longword:
|
||||
move.l A0,-(SP) // pointer to space for read data
|
||||
move.l D1,-(SP) // PCI register
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_config_longword
|
||||
move.l 8(SP),A0 // little to big endian
|
||||
move.l D0,(A0)
|
||||
mvz.b 3(A0),D0
|
||||
lsl.l #8,D0
|
||||
move.b 2(A0),D0
|
||||
lsl.l #8,D0
|
||||
move.b 1(A0),D0
|
||||
lsl.l #8,D0
|
||||
move.b (A0),D0
|
||||
move.l D0,(A0) // PCI_BIOS expects value in memory, not in D0
|
||||
add.l #12,SP
|
||||
move.l #0,D0
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_fast_read_config_byte:
|
||||
move.l D1,-(SP) // PCI register
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_fast_read_config_byte
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_fast_read_config_word:
|
||||
move.l D1,-(SP) // PCI register
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_fast_read_config_word
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_fast_read_config_longword:
|
||||
move.l D1,-(SP) // PCI register
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_fast_read_config_longword
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
_wrapper_write_config_byte:
|
||||
move.l D2,-(SP) // data to write
|
||||
move.l D1,-(SP) // PCI register
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_write_config_byte
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
_wrapper_write_config_word:
|
||||
move.l D0,-(SP) // make data little endian
|
||||
moveq #0,D1
|
||||
move.w D2,D1
|
||||
lsr.l #8,D1
|
||||
asl.l #8,D2
|
||||
or.l D1,D2
|
||||
move.l (SP)+,D0
|
||||
move.l D2,-(SP) // data to write
|
||||
move.l D1,-(SP) // PCI register
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_write_config_word
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
_wrapper_write_config_longword:
|
||||
move.l D0,-(SP)
|
||||
move.l D2,D0 // make data little endian
|
||||
lsr.l #8,D0
|
||||
asl.l #8,D2
|
||||
and.l #0x00FF00FF,D0
|
||||
and.l #0xFF00FF00,D2
|
||||
or.l D0,D2
|
||||
swap D2
|
||||
move.l (SP)+,D0
|
||||
move.l D2,-(SP) // data to write
|
||||
move.l D1,-(SP) // PCI register
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_write_config_longword
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
_wrapper_hook_interrupt:
|
||||
move.l A1,-(SP) // parameter for interrupt handler
|
||||
move.l A0,-(SP) // pointer to interrupt handler
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_hook_interrupt
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
_wrapper_unhook_interrupt:
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_unhook_interrupt
|
||||
addq.l #4,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_special_cycle:
|
||||
move.l D1,-(SP) // special cycle data
|
||||
move.l D0,-(SP) // bus number
|
||||
jsr _pci_special_cycle
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_get_routing:
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_get_routing
|
||||
addq.l #4,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_set_interrupt:
|
||||
move.l D1,-(SP) // mode
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_set_interrupt
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
_wrapper_get_resource:
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_get_resource
|
||||
addq.l #4,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_get_card_used:
|
||||
move.l D1,-(SP) // address
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_get_card_used
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_set_card_used:
|
||||
move.l A0,-(SP) // callback
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_set_card_used
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_read_mem_byte:
|
||||
move.l A0,-(SP) // pointer to data in memory
|
||||
move.l D1,-(SP) // address to access (in PCI memory address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_mem_byte
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_read_mem_word:
|
||||
move.l A0,-(SP) // pointer to data in memory
|
||||
move.l D1,-(SP) // address to access (in PCI memory address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_mem_word
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_read_mem_longword:
|
||||
move.l A0,-(SP) // pointer to data in memory
|
||||
move.l D1,-(SP) // address to access (in PCI memory address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_mem_longword
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_fast_read_mem_byte:
|
||||
move.l D1,-(SP) // address to access (in PCI memory address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_mem_byte
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_fast_read_mem_word:
|
||||
move.l D1,-(SP) // address to access (in PCI memory address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_mem_word
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_fast_read_mem_longword:
|
||||
move.l D1,-(SP) // address to access (in PCI memory address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_mem_longword
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_write_mem_byte:
|
||||
move.l D2,-(SP) // data to write
|
||||
move.l D1,-(SP) // address to access (in PCI memory address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_write_mem_byte
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_write_mem_word:
|
||||
move.l D2,-(SP) // data to write
|
||||
move.l D1,-(SP) // address to access (in PCI memory address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_write_mem_word
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_write_mem_longword:
|
||||
move.l D2,-(SP) // data to write
|
||||
move.l D1,-(SP) // address to access (in PCI memory address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_write_mem_longword
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_read_io_byte:
|
||||
move.l A0,-(SP) // pointer to data in memory
|
||||
move.l D1,-(SP) // address to access (in PCI I/O address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_io_byte
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_read_io_word:
|
||||
move.l A0,-(SP) // pointer to data in memory
|
||||
move.l D1,-(SP) // address to access (in PCI I/O address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_io_word
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_read_io_longword:
|
||||
move.l A0,-(SP) // pointer to data in memory
|
||||
move.l D1,-(SP) // address to access (in PCI I/O address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_io_longword
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_fast_read_io_byte:
|
||||
move.l D1,-(SP) // address to access (in PCI I/O address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_io_byte
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_fast_read_io_word:
|
||||
move.l D1,-(SP) // address to access (in PCI I/O address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_io_word
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_fast_read_io_longword:
|
||||
move.l D1,-(SP) // address to access (in PCI I/O address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_read_io_longword
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_write_io_byte:
|
||||
move.l D2,-(SP) // data to write
|
||||
move.l D1,-(SP) // address to access (in PCI I/O address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_write_io_byte
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_write_io_word:
|
||||
move.l D2,-(SP) // data to write
|
||||
move.l D1,-(SP) // address to access (in PCI I/O address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_write_io_word
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_write_io_longword:
|
||||
move.l D2,-(SP) // data to write
|
||||
move.l D1,-(SP) // address to access (in PCI I/O address space)
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_write_io_longword
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_get_machine_id:
|
||||
jsr _pci_get_machine_id
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_get_pagesize:
|
||||
jsr _pci_get_pagesize
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_virt_to_bus:
|
||||
move.l A0,-(SP) // ptr
|
||||
move.l D1,-(SP) // address in virtual CPU space
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_virt_to_bus
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_bus_to_virt:
|
||||
move.l A0,-(SP) // ptr
|
||||
move.l D1,-(SP) // PCI bus address
|
||||
move.l D0,-(SP) // handle
|
||||
jsr _pci_bus_to_virt
|
||||
add.l #12,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_virt_to_phys:
|
||||
move.l A0,-(SP) // ptr
|
||||
move.l D0,-(SP) // address in virtual CPU space
|
||||
jsr _pci_virt_to_phys
|
||||
addq.l #8,SP
|
||||
rts
|
||||
|
||||
/* Not implemented */
|
||||
_wrapper_phys_to_virt:
|
||||
move.l A0,-(SP) // ptr
|
||||
move.l D0,-(SP) // physical CPU address
|
||||
jsr _pci_phys_to_virt
|
||||
addq.l #8,SP
|
||||
rts
|
||||
Reference in New Issue
Block a user