aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcibios.c
Commit message (Collapse)AuthorAgeFilesLines
* pci: Split low-level pci code from higher-level 'struct pci_device' codeKevin O'Connor2016-02-031-0/+1
| | | | | | | | | Split pci.c into pci.c and pcidevice.c. The low-level code that interacts directly with the PCI devices remains in pci.c, while functions dealing with the higher level pci_device cache move to pcidevice.c. Only pci.c is needed in 16bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move pirtable definitions from hw/pci.h to std/pirtable.h and util.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor2013-09-181-4/+4
| | | | | | Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename util.c to string.c and introduce string.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move code centered around specific hardware devices to src/hw/Kevin O'Connor2013-09-021-2/+2
| | | | | | Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Separate out 16bit PCI-BIOS entry point from regular int 0x1a entry point.Kevin O'Connor2013-03-031-8/+8
| | | | | | | The PCI-BIOS entry point can be called in 16bit protected mode, so separate its entry code from the legacy 0x1a code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Convert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.Kevin O'Connor2013-02-181-1/+1
| | | | | | | | | | | Convert all users of the alternative variable exports to VARFSEG. There isn't a significant distinction between the existing types of exports, so it's simpler to just use one type going forward. The new VARFSEG declaration is only emitting when in 32bit mode, so update and move some variables as needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Normalize POST initialization function name suffixes.Kevin O'Connor2013-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The POST phase has to invoke many initialization functions, and these functions can have complex inter-dependencies. Try to categorize the functions into 4 classes: preinit - functions called very early in POST where function ordering is very important and the code has limited access to other interfaces. init - functions that initialize internal interfaces and standard external interfaces. This code is generally not dependent on particular hardware and typically does not communicate directly with any hardware devices. setup - functions which access hardware or are dependent on particular hardware or platform devices. prepboot - functions that finalize internal interfaces and that prepare for the boot phase. This patch attempts to normalize the suffixes - functions that used _init(), _setup(), _finalize(), or similar that did not follow the above pattern were renamed. Other than function name changes, there should be no code impact to this patch. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Minor - Replace PirOffset with PirAddr.Kevin O'Connor2012-06-091-2/+3
| | | | | | | | | Technically, the PIR table could be placed at 0xf0000, which would result in a PirOffset=0, which would confuse the code. So, use an absolute address (PirAddr) instead. This also matches what the ACPI and SMBIOS code does. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* EBDA cleanups.Kevin O'Connor2012-05-201-1/+1
| | | | | | | | | Clean up includes of biosvar.h. Rename GET/SET_EBDA2 to GET/SET_EBDA - nearly all users use the extended form now anyway. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename the apm, pcibios, and elf entry points.Kevin O'Connor2011-07-101-4/+4
| | | | | | | Use a more consistent naming that matches entry_xxx to handle_xxx where possible. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename foreachbdf_in_bus to foreachbdf and simplify it.Kevin O'Connor2011-07-021-4/+4
| | | | | | | | Now that all callers of foreachbdf have been converted to foreachbdf_in_bus, simplify the pci_next() code - it no longer needs to track PCI bridges. Also, rename the remaining users of foreachbdf_in_bus to foreachbdf.
* Convert remaining callers of foreachbdf to foreachbdf_in_bus.Kevin O'Connor2011-07-021-26/+29
| | | | | | | Convert the last few callers of foreachbdf to foreachbdf_in_bus. This is in preparation for simplification of foreachbdf_in_bus. Also add in addition debugging messages to pci_probe.
* Rename foreachpci macro to foreachbdf.Kevin O'Connor2011-06-191-3/+3
|
* Reduce #ifs by weeding out some cross-chunk function definitions.Kevin O'Connor2010-01-031-2/+0
| | | | | | | | | | Reduce the need for placing #if guards around functions that are marked as VISIBLE in another code chunk by declaring the functions as "weak" when they are not needed. It's still necessary to ensure that no C code references the data from a different chunk (or an -fwhole-program compile might try to keep a local reference).
* Be sure to add "void" to all function prototypes that take no args.Kevin O'Connor2010-01-031-2/+2
| | | | Omitting "void" leads to a K&R style declaration which was not intended.
* Add support for 32bit PCI BIOS entry.Kevin O'Connor2009-12-301-3/+45
| | | | | | | | | Create a new code blob (code32seg) with support for 32bit functions that need to utilize explicit segment accesses. This code blob uses global variables relative to %gs and with a dynamic code offset (determined by get_global_offset()). Add BIOS32 structure and code. Add code for 32bit PCI BIOS code.
* Distinguish between debug reports for unimplemented vs invalid calls.Kevin O'Connor2009-12-131-6/+6
| | | | | | | | Don't use "fail" in the debug output - as this confuses users. When reporting on an invalid parameter - use the word "invalid". When reporting on an unimplemented call - state it is unimplemented. Add separate debug levels for unimplemented vs invalid calls. Also, increase the debug level of several entry points.
* Minor - use a struct when working with pcibios 1ab10e param.Kevin O'Connor2009-01-211-8/+13
|
* Implement memcpy_far and checksum_far, and replace _fl variants.Kevin O'Connor2009-01-191-5/+5
| | | | | | The "flat" mode variants work in real mode, but will not work in protected mode. So, replace with versions that take explicit segments.
* Rename MAKE_FARPTR (and similar) to MAKE_FLATPTR.Kevin O'Connor2009-01-191-3/+3
| | | | | | | | The term "far pointer" is used in many 16bit specs, and it is different from what MAKE_FARPTR creates. So, use the term "flat pointer" in the code to distinguish between the two meanings. Also, use the suffix "_fl" consistently when working with "flat pointers".
* Fix apparent bug in pci bios handle_1ab10e function.Kevin O'Connor2009-01-191-1/+1
| | | | The PIR entry copy was copying the header instead of the slots.
* Change license from GPLv3 to LGPLv3.Kevin O'Connor2009-01-151-1/+1
| | | | | | | | Change license of contributions from Kevin O'Connor from GPLv3 to LGPLv3 (or later). Since the work as a whole is based on Kevin's contributions and the "bochs bios" which has a license of LGPL (v2 or later), this effectively makes the work as a whole available under LGPLv3 (or later).
* Move pir table offset from ebda to a global variable.Kevin O'Connor2008-12-281-5/+7
| | | | Also, make sure the pir table is defined with the 16bit code.
* Don't allow start_bdf with new auto max bus detection code.Kevin O'Connor2008-12-041-23/+28
| | | | | | | | It's not valid to set a "start bdf" when search for a device now, because we wont be able to properly detect the maximum bus unless we start at the beginning. Change callers that need to resume a search to use foreachpci() macro. Update all callers so that they don't pass in the now unused start_bdf.
* Only touch PCI functions > 0 on multi-function devices; rescan max pci each ↵Kevin O'Connor2008-11-291-1/+6
| | | | | | | | | | | time. Some single-function devices will respond to all sub-functions - and this confuses things. So, when scanning the PCI bus make sure to only touch function 0 on single-function devices. Since the bus scanning code is necessarily complex now, we might as well implement max bus detection inline with all pci scans. So, there is no need to scan for the max bus at startup.
* Overhaul PCI config functions.Kevin O'Connor2008-11-091-23/+29
| | | | | | | | Remove PCIDevice struct and replace with a "u16" with BDF - Bus/Device/Function. This simplifies the code in several places. Also, scan for and store the maximum PCI bus found during startup. The previous config option CONFIG_PCI_BUS_COUNT is no longer needed and has been removed.
* Avoid casting EBDA variables ipl.description and pir_loc.Kevin O'Connor2008-11-081-1/+1
| | | | | | Define them using their native types (pointers). Also, fix an apparent bug in mptable coreboot processing - it incorrectly overwrote the pir_loc variable.
* Rename pci_find_class() to pci_find_classprog(), and add new functions.Kevin O'Connor2008-08-311-1/+1
| | | | | | New pci_find_class() searches by just class, not class and prog-if. Add some new pci config space definitions. Add inline functions for converting to/from bus/dev/fn to bdf to PCIDevice.
* Rename memcpy() to memcpy_far() and add regular memcpy() code.Kevin O'Connor2008-08-291-1/+1
|
* Return max bus number in int 1a/b101 call.Kevin O'Connor2008-08-171-5/+4
| | | | | | Add new option CONFIG_PCI_BUS_COUNT to set max bus count. Use that option consistently in handle_1ab101() and pci.c. Also, clean up comments of handle_1ab101().
* Misc fixes and updates.Kevin O'Connor2008-07-191-0/+1
| | | | | | | | Minor code cleanups. Fix parenthesis imbalance in keyboard led test. The printf() call is only used in 32bit mode - make this explicit to the compiler - it improves the code generation. Clear the screen after initializing the vga option rom.
* Extract 'struct bregs' out of biosvar.h; clean up header includes.Kevin O'Connor2008-07-041-0/+2
|
* PCI fixesKevin O'Connor2008-06-211-1/+1
| | | | | | | | | Only set the PIR table signature and checksum in the init function - that way, if it is disabled at runtime (eg, due to coreboot) then it wont be found by the OS. Fix parameter swap bug in handle_1ab102. Add support for more than one bus in pci scanning code (but only have 1 bus for now).
* Generate PIR table at post time.Kevin O'Connor2008-06-121-100/+8
| | | | | | | Move the predefined PIR table (only useful on emulators) to its own file - pirtable.c. Have the pcibios code inspect the pre-built PIR table on 1ab10e calls.
* Move PIR table definitions to pcibios.h.Kevin O'Connor2008-06-111-28/+2
| | | | Also add a copyright to pci.c.
* Update PCI devid of PIR table.Kevin O'Connor2008-06-071-4/+6
| | | | | This devid change synchs code with bochs cvs. Also fix minor bug causing bus to not be returned in pcibios calls.
* PCI enhancements.Kevin O'Connor2008-05-241-62/+25
| | | | | | | | | | | | Allow one to enable/disable PIR tables separately from PCI BIOS support. Use standard PORT_* defs for 0xcf8/0xcfc port accesses. Don't pass PCIDevice pointers around - the struct is small enough to pass in a register. Extract out pci_find_device and pci_find_class functions from PCI BIOS code. Remove PCI_FIXED_HOST_BRIDGE check - the check is too late if standard PCI support isn't available. If standard support is available, then the code should be okay to run.
* Minor change - use set_success() instead of set_cf in pcibios.c.Kevin O'Connor2008-03-211-1/+1
| | | | Using set_success permits easier debug hooks in the future.
* Basic support for PCI BIOS.Kevin O'Connor2008-03-161-0/+322
This patch adds real-mode pci bios callbacks. It also adds support for a hardcoded $PIR table. The pci config functions are moved from rombios32.c to pci.c. Note that protected mode pci-bios calls were not added.