Remove pcibios forth support.

I had thought that this would be useful. However it was committed too
late, and wound up being unused. It's in the way of future work now,
so retire it rather than bring it forward.
This commit is contained in:
imp 2018-02-02 15:01:49 +00:00
parent ace91bb112
commit d01a0a7e6d
4 changed files with 1 additions and 231 deletions

View File

@ -40,6 +40,7 @@
# 20180201: Obsolete forth files
OLD_FILES+=boot/efi.4th
OLD_FILES+=boot/pcibios.4th
# 20180114: new clang import which bumps version from 5.0.1 to 6.0.0.
OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/allocator_interface.h

View File

@ -29,7 +29,6 @@ FILES+= logo-orbbw.4th
FILES+= menu.4th
FILES+= menu-commands.4th
FILES+= menusets.4th
FILES+= pcibios.4th
FILES+= screen.4th
FILES+= shortcuts.4th
FILES+= support.4th

View File

@ -1,47 +0,0 @@
\ Copyright (c) 2014 M. Warner Losh <imp@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
\ modification, are permitted provided that the following conditions
\ are met:
\ 1. Redistributions of source code must retain the above copyright
\ notice, this list of conditions and the following disclaimer.
\ 2. Redistributions in binary form must reproduce the above copyright
\ notice, this list of conditions and the following disclaimer in the
\ documentation and/or other materials provided with the distribution.
\
\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
\ SUCH DAMAGE.
\
\ $FreeBSD$
only forth also support-functions also builtins definitions
\ pci-device-count pci-id
\
\ Counts the number of instances of pci-id in the system and reports
\ it to the user.
: pci-device-count
0= if ( interpreted ) get_arguments then
0= if ." Need an argument" cr abort then
\ First argument is 0 when we're interprated. See support.4th
\ for get_arguments reading the rest of the line and parsing it
\ stack: argN lenN ... arg1 len1 N
hex ?number decimal
0= if ." Bad pci-id given (must be legal hex value)" cr abort then
dup pcibios-device-count ." Found " . ." instances of " hex . decimal cr
;
also forth definitions also builtins
builtin: pci-device-count

View File

@ -38,9 +38,6 @@ __FBSDID("$FreeBSD$");
#include <isapnp.h>
#include <btxv86.h>
#include "libi386.h"
#ifdef BOOT_FORTH
#include "ficl.h"
#endif
/*
* Stupid PCI BIOS interface doesn't let you simply enumerate everything
@ -406,183 +403,3 @@ biospci_locator(int8_t bus, uint8_t device, uint8_t function)
return ((bus << 8) | ((device & 0x1f) << 3) | (function & 0x7));
}
/*
* Counts the number of instances of devid we have in the system, as least as
* far as the PCI BIOS is able to tell.
*/
static int
biospci_count_device_type(uint32_t devid)
{
int i;
for (i = 0; 1; i++) {
v86.ctl = V86_FLAGS;
v86.addr = PCI_INT;
v86.eax = FIND_PCI_DEVICE;
v86.edx = devid & 0xffff; /* EDX - Vendor ID */
v86.ecx = (devid >> 16) & 0xffff; /* ECX - Device ID */
v86.esi = i;
v86int();
if (V86_CY(v86.efl) || (v86.eax & 0xff00))
break;
}
return i;
}
#ifdef BOOT_FORTH
/*
* pcibios-device-count (devid -- count)
*
* Returns the PCI BIOS' count of how many devices matching devid are in the system.
* devid is the 32-bit vendor + device.
*/
static void
ficlPciBiosCountDevices(FICL_VM *pVM)
{
uint32_t devid;
int i;
devid = stackPopINT(pVM->pStack);
i = biospci_count_device_type(devid);
stackPushINT(pVM->pStack, i);
}
/*
* pcibios-write-config (locator offset width value -- )
*
* Writes the specified config register.
* Locator is bus << 8 | device << 3 | fuction
* offset is the pci config register
* width is 0 for byte, 1 for word, 2 for dword
* value is the value to write
*/
static void
ficlPciBiosWriteConfig(FICL_VM *pVM)
{
uint32_t value, width, offset, locator;
value = stackPopINT(pVM->pStack);
width = stackPopINT(pVM->pStack);
offset = stackPopINT(pVM->pStack);
locator = stackPopINT(pVM->pStack);
biospci_write_config(locator, offset, width, value);
}
/*
* pcibios-read-config (locator offset width -- value)
*
* Reads the specified config register.
* Locator is bus << 8 | device << 3 | fuction
* offset is the pci config register
* width is 0 for byte, 1 for word, 2 for dword
* value is the value to read from the register
*/
static void
ficlPciBiosReadConfig(FICL_VM *pVM)
{
uint32_t value, width, offset, locator;
width = stackPopINT(pVM->pStack);
offset = stackPopINT(pVM->pStack);
locator = stackPopINT(pVM->pStack);
biospci_read_config(locator, offset, width, &value);
stackPushINT(pVM->pStack, value);
}
/*
* pcibios-find-devclass (class index -- locator)
*
* Finds the index'th instance of class in the pci tree.
* must be an exact match.
* class is the class to search for.
* index 0..N (set to 0, increment until error)
*
* Locator is bus << 8 | device << 3 | fuction (or -1 on error)
*/
static void
ficlPciBiosFindDevclass(FICL_VM *pVM)
{
uint32_t index, class, locator;
index = stackPopINT(pVM->pStack);
class = stackPopINT(pVM->pStack);
if (biospci_find_devclass(class, index, &locator))
locator = 0xffffffff;
stackPushINT(pVM->pStack, locator);
}
/*
* pcibios-find-device(devid index -- locator)
*
* Finds the index'th instance of devid in the pci tree.
* must be an exact match.
* class is the class to search for.
* index 0..N (set to 0, increment until error)
*
* Locator is bus << 8 | device << 3 | fuction (or -1 on error)
*/
static void
ficlPciBiosFindDevice(FICL_VM *pVM)
{
uint32_t index, devid, locator;
index = stackPopINT(pVM->pStack);
devid = stackPopINT(pVM->pStack);
if (biospci_find_device(devid, index, &locator))
locator = 0xffffffff;
stackPushINT(pVM->pStack, locator);
}
/*
* pcibios-find-device(bus device function -- locator)
*
* converts bus, device, function to locator.
*
* Locator is bus << 8 | device << 3 | fuction
*/
static void
ficlPciBiosLocator(FICL_VM *pVM)
{
uint32_t bus, device, function, locator;
function = stackPopINT(pVM->pStack);
device = stackPopINT(pVM->pStack);
bus = stackPopINT(pVM->pStack);
locator = biospci_locator(bus, device, function);
stackPushINT(pVM->pStack, locator);
}
/*
* Glue function to add the appropriate forth words to access pci bios
* functionality.
*/
static void ficlCompilePciBios(FICL_SYSTEM *pSys)
{
FICL_DICT *dp = pSys->dp;
assert (dp);
dictAppendWord(dp, "pcibios-device-count", ficlPciBiosCountDevices, FW_DEFAULT);
dictAppendWord(dp, "pcibios-read-config", ficlPciBiosReadConfig, FW_DEFAULT);
dictAppendWord(dp, "pcibios-write-config", ficlPciBiosWriteConfig, FW_DEFAULT);
dictAppendWord(dp, "pcibios-find-devclass", ficlPciBiosFindDevclass, FW_DEFAULT);
dictAppendWord(dp, "pcibios-find-device", ficlPciBiosFindDevice, FW_DEFAULT);
dictAppendWord(dp, "pcibios-locator", ficlPciBiosLocator, FW_DEFAULT);
ficlSetEnv(pSys, "pcibios-version", biospci_version);
}
FICL_COMPILE_SET(ficlCompilePciBios);
#endif