Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
6f7a251
Documentation
arch
alpha
arm
avr32
blackfin
cris
frv
h8300
ia64
m32r
m68k
m68knommu
microblaze
mips
alchemy
ar7
basler
bcm47xx
bcm63xx
boot
cavium-octeon
cobalt
configs
dec
emma
fw
gt64120
include
jazz
kernel
lasat
lib
loongson
common
Makefile
bonito-irq.c
cmdline.c
early_printk.c
env.c
init.c
irq.c
machtype.c
mem.c
pci.c
reset.c
serial.c
setup.c
time.c
uart_base.c
fuloong-2e
Kconfig
Makefile
math-emu
mipssim
mm
mti-malta
nxp
oprofile
pci
pmc-sierra
power
rb532
sgi-ip22
sgi-ip27
sgi-ip32
sibyte
sni
txx9
vr41xx
Kconfig
Kconfig.debug
Makefile
mn10300
parisc
powerpc
s390
score
sh
sparc
um
x86
xtensa
.gitignore
Kconfig
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
mips
/
loongson
/
common
/
pci.c
Blame
Blame
Latest commit
History
History
91 lines (77 loc) · 2.73 KB
Breadcrumbs
linux
/
arch
/
mips
/
loongson
/
common
/
pci.c
Top
File metadata and controls
Code
Blame
91 lines (77 loc) · 2.73 KB
Raw
/* * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology * Author: Fuxin Zhang, zhangfx@lemote.com * * This program 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 2 of the License, or (at your * option) any later version. */ #include <linux/pci.h> #include <pci.h> #include <loongson.h> static struct resource loongson_pci_mem_resource = { .name = "pci memory space", .start = LOONGSON_PCI_MEM_START, .end = LOONGSON_PCI_MEM_END, .flags = IORESOURCE_MEM, }; static struct resource loongson_pci_io_resource = { .name = "pci io space", .start = LOONGSON_PCI_IO_START, .end = IO_SPACE_LIMIT, .flags = IORESOURCE_IO, }; static struct pci_controller loongson_pci_controller = { .pci_ops = &loongson_pci_ops, .io_resource = &loongson_pci_io_resource, .mem_resource = &loongson_pci_mem_resource, .mem_offset = 0x00000000UL, .io_offset = 0x00000000UL, }; static void __init setup_pcimap(void) { /* * local to PCI mapping for CPU accessing PCI space * CPU address space [256M,448M] is window for accessing pci space * we set pcimap_lo[0,1,2] to map it to pci space[0M,64M], [320M,448M] * * pcimap: PCI_MAP2 PCI_Mem_Lo2 PCI_Mem_Lo1 PCI_Mem_Lo0 * [<2G] [384M,448M] [320M,384M] [0M,64M] */ LOONGSON_PCIMAP = LOONGSON_PCIMAP_PCIMAP_2 | LOONGSON_PCIMAP_WIN(2, LOONGSON_PCILO2_BASE) | LOONGSON_PCIMAP_WIN(1, LOONGSON_PCILO1_BASE) | LOONGSON_PCIMAP_WIN(0, 0); /* * PCI-DMA to local mapping: [2G,2G+256M] -> [0M,256M] */ LOONGSON_PCIBASE0 = 0x80000000ul; /* base: 2G -> mmap: 0M */ /* size: 256M, burst transmission, pre-fetch enable, 64bit */ LOONGSON_PCI_HIT0_SEL_L = 0xc000000cul; LOONGSON_PCI_HIT0_SEL_H = 0xfffffffful; LOONGSON_PCI_HIT1_SEL_L = 0x00000006ul; /* set this BAR as invalid */ LOONGSON_PCI_HIT1_SEL_H = 0x00000000ul; LOONGSON_PCI_HIT2_SEL_L = 0x00000006ul; /* set this BAR as invalid */ LOONGSON_PCI_HIT2_SEL_H = 0x00000000ul; /* avoid deadlock of PCI reading/writing lock operation */ LOONGSON_PCI_ISR4C = 0xd2000001ul; /* can not change gnt to break pci transfer when device's gnt not deassert for some broken device */ LOONGSON_PXARB_CFG = 0x00fe0105ul; #if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) /* * set cpu addr window2 to map CPU address space to PCI address space */ LOONGSON_ADDRWIN_CPUTOPCI(ADDRWIN_WIN2, LOONGSON_CPU_MEM_SRC, LOONGSON_PCI_MEM_DST, MMAP_CPUTOPCI_SIZE); #endif } static int __init pcibios_init(void) { setup_pcimap(); loongson_pci_controller.io_map_base = mips_io_port_base; register_pci_controller(&loongson_pci_controller); return 0; } arch_initcall(pcibios_init);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
You can’t perform that action at this time.